Commit ac5c2a54 by 墨竹

fix:收费改为消息队列

parent 723e82ff
......@@ -23,7 +23,17 @@ public interface HaobanQywxFeeApiService {
* @author mozhu
* @date 2022-08-03 17:28:56
*/
void insert(String param);
void run(String param);
/**
* "routerName": "qywxAddFeeMq"
*
* @param wxEnterpriseId wx企业id
* @author mozhu
* @date 2022-08-11 14:38:50
*/
void addFee(String wxEnterpriseId);
/**
......
......@@ -11,6 +11,7 @@ import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.AlertMessageDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeAccountInterceptLogDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDTO;
......@@ -31,6 +32,7 @@ import com.gic.wechat.api.dto.qywx.fee.*;
import com.gic.wechat.api.dto.qywx.fee.qdto.FeeOrderListQDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -64,18 +66,34 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
private HaobanQywxFeeAccountInterceptLogService haobanQywxFeeAccountInterceptLogService;
@Override
public void insert(String param) {
public void run(String param) {
List<TabHaobanWxEnterprise> tabHaobanWxEnterprises = wxEnterpriseService.listAll();
String serviceCorpid = config.getCorpid();
for (TabHaobanWxEnterprise wxEnterprise : tabHaobanWxEnterprises) {
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId();
GicMQClient instance = GICMQClientUtil.getClientInstance();
try {
instance.sendMessage("addFeeMq", wxEnterprise.getWxEnterpriseId());
} catch (Exception e) {
logger.info("发送消息处理异常:{}", e.getMessage(),e);
}
}
}
@Override
public void addFee(String wxEnterpriseId) {
if (StringUtils.isBlank(wxEnterpriseId)) {
logger.error("wx企业id为空");
return;
}
String serviceCorpid = config.getCorpid();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
String corpid = qwDTO.getThirdCorpid();
String corpName = wxEnterpriseDTO.getCorpName();
String autoActiveStatus = qywxUserApiService.getAutoActiveStatus(corpid, serviceCorpid);
if (!"1".equals(autoActiveStatus)) {
logger.info("未开启自动激活:{}", corpid);
wxEnterpriseService.updateAutoActiveFlagById(0, wxEnterpriseId);
continue;
return;
}
logger.info("企微收费:{},{}", corpid, wxEnterpriseId);
......@@ -228,7 +246,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
if (haobanQywxFeeDetailDTO != null) {
TabHaobanQywxFee tabHaobanQywxFee = new TabHaobanQywxFee();
tabHaobanQywxFee.setQwFeeId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFee.setCorpName(wxEnterprise.getCorpName());
tabHaobanQywxFee.setCorpName(corpName);
tabHaobanQywxFee.setCorpId(corpid);
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFee.setInterceptTime(haobanQywxFeeDetailDTO.getInterceptTime());
......@@ -238,14 +256,14 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFee.setInterceptFlag(0);
haobanQywxFeeService.insert(tabHaobanQywxFee);
//告警
messageAlert(wxEnterpriseId, wxEnterprise.getCorpName(), corpid, AlertTypeEnum.FEE_ALARM.getName());
messageAlert(wxEnterpriseId, corpName, corpid, AlertTypeEnum.FEE_ALARM.getName());
}
List<TabHaobanQywxFeeAccountInterceptLog> tabHaobanQywxFeeAccountInterceptLogs = haobanQywxFeeAccountInterceptLogService.queryByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isNotEmpty(tabHaobanQywxFeeAccountInterceptLogs)) {
TabHaobanQywxFee tabHaobanQywxFee = new TabHaobanQywxFee();
tabHaobanQywxFee.setQwFeeId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFee.setCorpName(wxEnterprise.getCorpName());
tabHaobanQywxFee.setCorpName(corpName);
tabHaobanQywxFee.setCorpId(corpid);
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFee.setInterceptTime(DateUtil.offsetDay(new Date(), -1));
......@@ -256,8 +274,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
haobanQywxFeeService.insert(tabHaobanQywxFee);
}
}
}
@Override
public Page<HaobanQywxFeeDTO> listPage(QywxFeeListQDTO qywxFeeListQDTO) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment