Commit 049d60db by 墨竹

fix:离职继承改为消息队列

parent a61fd045
...@@ -20,11 +20,22 @@ public interface HandoverOperationApiService { ...@@ -20,11 +20,22 @@ public interface HandoverOperationApiService {
*/ */
public void batchQywxHandoverTimeTask(String params); public void batchQywxHandoverTimeTask(String params);
/**
* 处理企微离职继承
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-04-26 17:29:30
*/
public void dealQywxEnterpriseHandoverMq(String wxEnterpriseId);
/** /**
* 定时处理企业微信 离职基础的结果(废弃) * 定时处理企业微信 离职基础的结果(废弃)
* *
* @param params * @param params
*/ */
@Deprecated
public void BatchQywxHandoverResultTimeTask(String params); public void BatchQywxHandoverResultTimeTask(String params);
/** /**
......
...@@ -9,7 +9,6 @@ import com.gic.haoban.manage.api.dto.HandoverExternalDTO; ...@@ -9,7 +9,6 @@ import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO; import com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO; import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.*; import com.gic.haoban.manage.service.dao.mapper.*;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
...@@ -124,7 +123,6 @@ public class HandoverServiceImpl implements HandoverService { ...@@ -124,7 +123,6 @@ public class HandoverServiceImpl implements HandoverService {
}); });
handoverExternalMapper.insertBatch(needAdd); handoverExternalMapper.insertBatch(needAdd);
} }
}); });
//删除不需要的staff数据 //删除不需要的staff数据
List<TabHandoverStaff> handoverStaffList = handoverStaffMapper.listByWxEnterpriseId(wxEnterpriseId); List<TabHandoverStaff> handoverStaffList = handoverStaffMapper.listByWxEnterpriseId(wxEnterpriseId);
......
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
...@@ -16,6 +17,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff; ...@@ -16,6 +17,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.HandoverService; import com.gic.haoban.manage.service.service.HandoverService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.dto.qywx.QywxTransferCustomerInfoDTO; import com.gic.wechat.api.dto.qywx.QywxTransferCustomerInfoDTO;
import com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO; import com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO;
import com.gic.wechat.api.dto.qywx.response.QywxGetUnassignedListDTO; import com.gic.wechat.api.dto.qywx.response.QywxGetUnassignedListDTO;
...@@ -60,17 +62,25 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -60,17 +62,25 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
@Override @Override
public void batchQywxHandoverTimeTask(String params) { public void batchQywxHandoverTimeTask(String params) {
logger.info("定时拉取离职基础的人员:{}", params); logger.info("定时拉取离职基础的人员start:{}", params);
List<YwWxEnterpriseDTO> dtoList = wxEnterpriseApiService.listAll(); List<YwWxEnterpriseDTO> dtoList = wxEnterpriseApiService.listAll();
for (YwWxEnterpriseDTO enterpriseDTO : dtoList) { for (YwWxEnterpriseDTO enterpriseDTO : dtoList) {
GicMQClient instance = GICMQClientUtil.getClientInstance();
try { try {
dealQywxEnterpriseHandover(enterpriseDTO.getWxEnterpriseId()); instance.sendMessage("dealQywxEnterpriseHandoverMq", enterpriseDTO.getWxEnterpriseId());
dealQywxEnterpriseHandoverResult(enterpriseDTO.getWxEnterpriseId());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.info("发送消息队列异常:{},{}", JSONObject.toJSONString(enterpriseDTO), e);
logger.info("商户处理异常:{},{}", JSONObject.toJSONString(enterpriseDTO), e);
} }
} }
logger.info("定时拉取离职基础的人员end:{}", params);
}
@Override
public void dealQywxEnterpriseHandoverMq(String wxEnterpriseId) {
logger.info("离职继承start...{}",wxEnterpriseId);
dealQywxEnterpriseHandover(wxEnterpriseId);
dealQywxEnterpriseHandoverResult(wxEnterpriseId);
logger.info("离职继承end...{}",wxEnterpriseId);
} }
@Override @Override
...@@ -96,11 +106,17 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -96,11 +106,17 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
handoverService.saveHandover(wxEnterpriseId, allQywxUnassigned); handoverService.saveHandover(wxEnterpriseId, allQywxUnassigned);
} }
/**
* 获取离职成员客户列表
* @param wxEnterpriseDTO
* @return
*/
private List<QywxUnassignedInfoDTO> getAllQywxUnassigned(WxEnterpriseDTO wxEnterpriseDTO) { private List<QywxUnassignedInfoDTO> getAllQywxUnassigned(WxEnterpriseDTO wxEnterpriseDTO) {
List<QywxUnassignedInfoDTO> ret = new ArrayList<>(); List<QywxUnassignedInfoDTO> ret = new ArrayList<>();
QywxGetUnassignedListDTO unassignedListDTO = null; QywxGetUnassignedListDTO unassignedListDTO = null;
String cursor = null; String cursor = null;
do { do {
//离职成员客户列表
unassignedListDTO = qywxUserApiService.getUnassignedList(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), cursor); unassignedListDTO = qywxUserApiService.getUnassignedList(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), cursor);
cursor = unassignedListDTO.getNextCursor(); cursor = unassignedListDTO.getNextCursor();
if (CollectionUtils.isNotEmpty(unassignedListDTO.getInfo())) { if (CollectionUtils.isNotEmpty(unassignedListDTO.getInfo())) {
...@@ -140,7 +156,6 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -140,7 +156,6 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
} }
List<QywxTransferCustomerInfoDTO> customerResults = customerDTO.getCustomer(); List<QywxTransferCustomerInfoDTO> customerResults = customerDTO.getCustomer();
handoverService.dealResult(wxEnterpriseId, dto.getHandoverTransferId(), customerResults); handoverService.dealResult(wxEnterpriseId, dto.getHandoverTransferId(), customerResults);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.info("处理异常:{},{}", JSONObject.toJSONString(dto), e); logger.info("处理异常:{},{}", JSONObject.toJSONString(dto), e);
......
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