Commit 94cddc37 by 墨竹

fix:收费

parent b7f11349
......@@ -10,6 +10,7 @@ public interface MemberUnionRelateConsumer {
/**
* desc: 添加好友关系-存量会员新增
* "routerName": "addMemberUnionRelateMq"
*
* @param messageParam 消息参数
* @author : YongEn
......
......@@ -133,7 +133,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
logger.error("订单为空");
return;
}
List<Map<String, String>> activeCodeList = new ArrayList<>();
for (String orderId : orderIds) {
FeeOrderDeatilResponseDTO order = qywxUserApiService.getOrder(corpid, serviceCorpid, orderId);
if (order.getErrcode() != 0) {
......@@ -173,7 +173,13 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
logger.info("订单账号列表报错:{}", accountListResponseDTO.getErrmsg());
break;
}
addOrderAccount(wxEnterpriseId,serviceCorpid,corpid,orderId,accountListResponseDTO.getAccountList());
for (AccountListDTO accountListDTO : accountListResponseDTO.getAccountList()) {
Map<String, String> map = new HashMap<>();
map.put("orderId", orderId);
map.put("activeCode", accountListDTO.getActiveCode());
activeCodeList.add(map);
}
Integer hasMore = accountListResponseDTO.getHasMore();
if (hasMore == 0) {
......@@ -183,10 +189,46 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
feeOrderListQDTO.setCursor(feeOrderListQDTO.getCursor());
accountListResponseDTO = qywxUserApiService.listOrderAccount(corpid, serviceCorpid, feeOrderListQDTO);
for (AccountListDTO accountListDTO : accountListResponseDTO.getAccountList()) {
Map<String, String> map = new HashMap<>();
map.put("orderId", orderId);
map.put("activeCode", accountListDTO.getActiveCode());
activeCodeList.add(map);
}
}
addOrderAccount(wxEnterpriseId, serviceCorpid, corpid, activeCodeList);
List<String> userIdList = new ArrayList<>();
//企业账号
while (true) {
FeeOrderListQDTO feeOrderListQDTO = new FeeOrderListQDTO();
feeOrderListQDTO.setCorpid(corpid);
feeOrderListQDTO.setLimit(Manage3Constants.QW_LIMIT);
AccountListResponseDTO accountListResponseDTO = qywxUserApiService.listActivedAccount(corpid, serviceCorpid, feeOrderListQDTO);
if (accountListResponseDTO.getErrcode() != 0) {
logger.info("订单账号列表报错:{}", accountListResponseDTO.getErrmsg());
break;
}
addOrderAccount(wxEnterpriseId,serviceCorpid,corpid,orderId,accountListResponseDTO.getAccountList());
List<AccountListDTO> accountList = accountListResponseDTO.getAccountList();
for (AccountListDTO accountListDTO : accountList) {
userIdList.add(accountListDTO.getUserid());
}
Integer hasMore = accountListResponseDTO.getHasMore();
if (hasMore == 0) {
logger.error("无更多账号");
break;
}
feeOrderListQDTO.setCursor(feeOrderListQDTO.getCursor());
accountListResponseDTO = qywxUserApiService.listActivedAccount(corpid, serviceCorpid, feeOrderListQDTO);
for (AccountListDTO accountListDTO : accountListResponseDTO.getAccountList()) {
userIdList.add(accountListDTO.getUserid());
}
}
addAccountStaff(wxEnterpriseId, serviceCorpid, corpid, userIdList);
//更新企微状态
wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId);
......@@ -230,17 +272,14 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
}
}
private void addOrderAccount(String wxEnterpriseId, String serviceCorpid, String corpid, String orderId, List<AccountListDTO> accountList) {
if (CollectionUtils.isEmpty(accountList)) {
private void addOrderAccount(String wxEnterpriseId, String serviceCorpid, String corpid, List<Map<String, String>> activeCodeList) {
if (CollectionUtils.isEmpty(activeCodeList)) {
logger.error("订单账号无激活码");
return;
}
for (AccountListDTO orderListAccount : accountList) {
String activeCode = orderListAccount.getActiveCode();
if (StringUtils.isBlank(activeCode)) {
logger.error("订单无激活码");
continue;
}
for (Map<String, String> activeCodeMap : activeCodeList) {
String activeCode = activeCodeMap.get("activeCode");
String orderId = activeCodeMap.get("orderId");
ActiveInfoCodeResponseDTO activeInfoCodeResponseDTO = qywxUserApiService.getActiveInfoByCode(corpid, serviceCorpid, activeCode);
if (activeInfoCodeResponseDTO.getErrcode() != 0) {
logger.error("激活码详情报错:{}", activeInfoCodeResponseDTO.getErrmsg());
......@@ -259,12 +298,20 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFeeOrderAccount.setExpireTime(DateUtil.date(activeInfoCodeResponseDTO.getExpireTime() * 1000));
tabHaobanQywxFeeOrderAccount.setActiveTime(DateUtil.date(activeInfoCodeResponseDTO.getActiveTime() * 1000));
haobanQywxFeeOrderAccountService.insert(tabHaobanQywxFeeOrderAccount);
}
}
private void addAccountStaff(String wxEnterpriseId, String serviceCorpid, String corpid, List<String> useridList) {
if (CollectionUtils.isEmpty(useridList)) {
logger.error("成员激活为空");
return;
}
for (String userid : useridList) {
//更新成员
ActiveInfoUserResponseDTO activeInfoUserResponseDTO = qywxUserApiService.getActiveInfoByUser(corpid, serviceCorpid, userid);
if (activeInfoUserResponseDTO.getErrcode() != 0) {
logger.info("成员激活详情报错:{}", activeInfoUserResponseDTO.getErrmsg());
break;
return;
}
List<AccountListDTO> activeInfoList = activeInfoUserResponseDTO.getActiveInfoList();
Integer activeStatus = activeInfoUserResponseDTO.getActiveStatus();
......@@ -282,7 +329,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFeeAccountStaff.setActiveCode(accountListDTO.getActiveCode());
tabHaobanQywxFeeAccountStaff.setAccountType(accountListDTO.getType());
tabHaobanQywxFeeAccountStaff.setExpireTime(DateUtil.date(accountListDTO.getExpireTime() * 1000));
tabHaobanQywxFeeAccountStaff.setActiveTime(DateUtil.date(accountListDTO.getActiveTime()* 1000));
tabHaobanQywxFeeAccountStaff.setActiveTime(DateUtil.date(accountListDTO.getActiveTime() * 1000));
haobanQywxFeeAccountStaffService.insert(tabHaobanQywxFeeAccountStaff);
}
if (tabHaobanStaff != null) {
......
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