Commit d8624cb1 by jinxin

Merge branch 'bugfix/2023-02-22' into test_branch

parents db5119bd 4338f45b
...@@ -28,10 +28,22 @@ public class TransferActiveCodeDTO implements Serializable { ...@@ -28,10 +28,22 @@ public class TransferActiveCodeDTO implements Serializable {
*/ */
private Integer failedNum; private Integer failedNum;
/** /**
* 成功明细
*/
private List<Map<String, String>> successList;
/**
* 失败明细 * 失败明细
*/ */
private List<Map<String, String>> failedList; private List<Map<String, String>> failedList;
public List<Map<String, String>> getSuccessList() {
return successList;
}
public void setSuccessList(List<Map<String, String>> successList) {
this.successList = successList;
}
public Integer getTotalNum() { public Integer getTotalNum() {
return totalNum; return totalNum;
} }
...@@ -67,6 +79,15 @@ public class TransferActiveCodeDTO implements Serializable { ...@@ -67,6 +79,15 @@ public class TransferActiveCodeDTO implements Serializable {
//操作日志记录 //操作日志记录
public String logRecord() { public String logRecord() {
StringBuilder log = new StringBuilder(); StringBuilder log = new StringBuilder();
//记录单个转移的成功日志
if (CollUtil.isNotEmpty(this.successList) && this.totalNum==1){
Map<String, String> stringMap = this.successList.get(0);
String handoverStaffPhone = null==stringMap.get("handoverStaffPhone")?"":stringMap.get("handoverStaffPhone");
String takeoverStaffPhone = null==stringMap.get("takeoverStaffPhone")?"":stringMap.get("takeoverStaffPhone");
log.append("将"+stringMap.get("handoverStaffName")+"-"+handoverStaffPhone+"的许可手动转移给"
+stringMap.get("takeoverStaffName")+"-"+takeoverStaffPhone);
return log.toString();
}
log.append("共需转移" + this.totalNum + ",成功" + this.successNum + ",失败" + this.failedNum + "。"); log.append("共需转移" + this.totalNum + ",成功" + this.successNum + ",失败" + this.failedNum + "。");
if (CollUtil.isNotEmpty(this.failedList)) { if (CollUtil.isNotEmpty(this.failedList)) {
log.append("失败明细:"); log.append("失败明细:");
......
...@@ -117,7 +117,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -117,7 +117,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
logger.info("通知会员 删除企微好友,该会员无任何好友关系,memberId:{}", memberId); logger.info("通知会员 删除企微好友,该会员无任何好友关系,memberId:{}", memberId);
memberApiService.updateMemberQywxFlag(enterpriseId, memberId, 0); memberApiService.updateMemberQywxFlag(enterpriseId, memberId, 0);
memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 0, new Date()); memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 0, new Date());
return; continue;
} }
logger.info("通知会员 删除企微好友 每次调用更新为非企微好友时间 memberId:{}", memberId); logger.info("通知会员 删除企微好友 每次调用更新为非企微好友时间 memberId:{}", memberId);
memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 1, new Date()); memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 1, new Date());
......
...@@ -355,7 +355,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -355,7 +355,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
clientInstance.sendBatchMessages("departmentSyncDealMq", listRet); clientInstance.sendBatchMessages("departmentSyncDealMq", listRet, 10);
} catch (Exception e) { } catch (Exception e) {
logger.info("发送失败:{},{}", taskId, JSONObject.toJSONString(listRet)); logger.info("发送失败:{},{}", taskId, JSONObject.toJSONString(listRet));
e.printStackTrace(); e.printStackTrace();
......
...@@ -17,7 +17,9 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -17,7 +17,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.redisson.api.RAtomicLong;
import org.redisson.api.RRateLimiter; import org.redisson.api.RRateLimiter;
import org.redisson.api.RSet;
import org.redisson.api.RateIntervalUnit; import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType; import org.redisson.api.RateType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,6 +47,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum; ...@@ -45,6 +47,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum;
import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum; import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService; import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.manage.api.constants.Manage3Constants; import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.ContentMaterialDTO; import com.gic.haoban.manage.api.dto.ContentMaterialDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO; import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
...@@ -382,17 +385,79 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -382,17 +385,79 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
DealQywxExternalUserPojo dealQywxExternalUserPojo = new DealQywxExternalUserPojo(); DealQywxExternalUserPojo dealQywxExternalUserPojo = new DealQywxExternalUserPojo();
dealQywxExternalUserPojo.setType(DealQywxExternalUserPojo.DealType.add.getType()); dealQywxExternalUserPojo.setType(DealQywxExternalUserPojo.DealType.add.getType());
dealQywxExternalUserPojo.setData(dto); dealQywxExternalUserPojo.setData(dto);
GicMQClient instance = GICMQClientUtil.getClientInstance(); GicMQClient instance = GICMQClientUtil.getClientInstance();
String mqName = "dealQywxExternalUserMq" ;
if(this.mqCheck(dto)) {
mqName = "dealQywxExternalUserMq2";
}
try { try {
instance.sendMessage("dealQywxExternalUserMq", JSONObject.toJSONString(dealQywxExternalUserPojo)); instance.sendMessage(mqName, JSONObject.toJSONString(dealQywxExternalUserPojo));
} catch (Exception e) { } catch (Exception e) {
log.info("异步处理异常:{}", e); log.info("异步处理异常:{}", e);
} }
return null; return null;
} }
// 加好友量大的迁移到mq2
int maxCount = 800 ;
private boolean mqCheck(QwFrientNoticeDTO dto) {
boolean flag = false ;
Object obj = RedisUtil.getCache("dealQywxExternalUserMq2") ;
String corpid = dto.getCorpid() ;
if(null != obj) {
String str = obj.toString() ;
if(StringUtils.isNotBlank(corpid) && str.contains(corpid)) {
flag = true ;
log.info("加好友计数,手动配置到userMq2,corpid={}",corpid);
return flag ;
}
}
if(null != obj && obj.toString().equals("0")) {
return false ;
}
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid) ;
if(null != wxEnterprise) {
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId() ;
flag = this.needToMq2(wxEnterpriseId) ;
if(!flag) {
long times = this.getTimes(wxEnterpriseId) ;
if("wp59NLDQAAtTbif_SxAixUQVqMld4vug".equals(corpid)) {
maxCount = 2 ;
}
if(times>maxCount) {
if(!needToMq2(wxEnterpriseId)) {
log.info("加好友计数发送告警,id={}",wxEnterpriseId);
DingUtils.send("加好友mq切换,企业="+ wxEnterpriseId, false);
}
log.info("加好友计数,自动到userMq2,{}",wxEnterpriseId);
this.addToMq2Mark(wxEnterpriseId);
flag = true ;
}
}
}
return flag ;
}
private long getTimes(String wxEnterpriseId) {
String key = "qwadd:count:"+wxEnterpriseId ;
RAtomicLong cache = RedisUtil.getRedisClient().getAtomicLong(key);
long val = cache.addAndGet(1);
if (val <= 1) {
cache.expire(1, TimeUnit.MINUTES);
}
return val ;
}
private void addToMq2Mark(String wxEnterpriseId) {
String key = "qwadd:count2:"+wxEnterpriseId ;
RedisUtil.setCache(key, 1,600L);
}
private boolean needToMq2(String wxEnterpriseId) {
String key = "qwadd:count2:"+wxEnterpriseId ;
return null != RedisUtil.getCache(key) ;
}
@Override @Override
public String addMemberUnionidRelatedNew(MemberUnionidRelatedDTO dto, String wxUserId) { public String addMemberUnionidRelatedNew(MemberUnionidRelatedDTO dto, String wxUserId) {
String corpId = dto.getCorpid(); String corpId = dto.getCorpid();
...@@ -1175,7 +1240,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -1175,7 +1240,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
GicMQClient instance = GICMQClientUtil.getClientInstance(); GicMQClient instance = GICMQClientUtil.getClientInstance();
try { try {
instance.sendMessage("dealQywxExternalUserMq", JSONObject.toJSONString(dealQywxExternalUserPojo)); instance.sendMessage("dealQywxExternalUserMq3", JSONObject.toJSONString(dealQywxExternalUserPojo));
} catch (Exception e) { } catch (Exception e) {
log.info("异步处理异常:{}", e); log.info("异步处理异常:{}", e);
} }
...@@ -1189,7 +1254,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -1189,7 +1254,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
GicMQClient instance = GICMQClientUtil.getClientInstance(); GicMQClient instance = GICMQClientUtil.getClientInstance();
try { try {
instance.sendMessage("dealQywxExternalUserMq", JSONObject.toJSONString(dealQywxExternalUserPojo)); instance.sendMessage("dealQywxExternalUserMq3", JSONObject.toJSONString(dealQywxExternalUserPojo));
} catch (Exception e) { } catch (Exception e) {
log.info("异步处理异常:{}", e); log.info("异步处理异常:{}", e);
} }
......
...@@ -971,6 +971,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -971,6 +971,7 @@ public class StaffApiServiceImpl implements StaffApiService {
logger.info("转移成员返回结果:{}",JSONObject.toJSONString(listServiceResponse)); logger.info("转移成员返回结果:{}",JSONObject.toJSONString(listServiceResponse));
int successNum=0,failedNum=0; int successNum=0,failedNum=0;
List<Map<String,String>> failedList =new ArrayList<>(); List<Map<String,String>> failedList =new ArrayList<>();
List<Map<String,String>> successList =new ArrayList<>();
if (Constant.SUCCESS.equals(listServiceResponse.getCode())){ if (Constant.SUCCESS.equals(listServiceResponse.getCode())){
List<AccountTransferUserDTO> resultList = listServiceResponse.getResult(); List<AccountTransferUserDTO> resultList = listServiceResponse.getResult();
result.setTotalNum(resultList.size()); result.setTotalNum(resultList.size());
...@@ -984,6 +985,13 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -984,6 +985,13 @@ public class StaffApiServiceImpl implements StaffApiService {
staffMapper.updateStaffInfoByStaffId(handoverStaff.getStaffId(),null,null,null); staffMapper.updateStaffInfoByStaffId(handoverStaff.getStaffId(),null,null,null);
//更新接收成员的许可信息 //更新接收成员的许可信息
staffMapper.updateStaffInfoByStaffId(takeOverStaff.getStaffId(),handoverStaff.getActiveTime(),handoverStaff.getExpireTime(), handoverStaff.getActiveCode()); staffMapper.updateStaffInfoByStaffId(takeOverStaff.getStaffId(),handoverStaff.getActiveTime(),handoverStaff.getExpireTime(), handoverStaff.getActiveCode());
//记录转移成功明细
Map<String,String> successMap = new HashMap<>(8);
successMap.put("handoverStaffName",handoverStaff.getStaffName());
successMap.put("handoverStaffPhone",handoverStaff.getPhoneNumber());
successMap.put("takeoverStaffName",takeOverStaff.getStaffName());
successMap.put("takeoverStaffPhone",takeOverStaff.getPhoneNumber());
successList.add(successMap);
}else{ }else{
//企微转移失败,记录失败明细 //企微转移失败,记录失败明细
...@@ -1000,6 +1008,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1000,6 +1008,7 @@ public class StaffApiServiceImpl implements StaffApiService {
result.setSuccessNum(successNum); result.setSuccessNum(successNum);
result.setFailedNum(failedNum); result.setFailedNum(failedNum);
result.setFailedList(failedList); result.setFailedList(failedList);
result.setSuccessList(successList);
return com.gic.api.base.commons.ServiceResponse.success(result); return com.gic.api.base.commons.ServiceResponse.success(result);
} }
//企业微信接口调用失败,记录错误 //企业微信接口调用失败,记录错误
......
...@@ -487,7 +487,7 @@ public class StaffController extends WebBaseController { ...@@ -487,7 +487,7 @@ public class StaffController extends WebBaseController {
List<DepartmentDTO> relationList = departmentApiService.listSonByDepartmentIds(departmentIdSet, wxEnterpriseId); List<DepartmentDTO> relationList = departmentApiService.listSonByDepartmentIds(departmentIdSet, wxEnterpriseId);
Map<String, DepartmentDTO> departmentMap = relationList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, s -> s)); Map<String, DepartmentDTO> departmentMap = relationList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, s -> s));
List<String> departmentIds = new ArrayList<>(); List<String> departmentIds = new ArrayList<>();
if(!needDep) { if(needDep) {
departmentIds = relationList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList()); departmentIds = relationList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList());
} }
List<StaffDTO> staffAllList = Lists.newArrayListWithCapacity(5000); List<StaffDTO> staffAllList = Lists.newArrayListWithCapacity(5000);
......
...@@ -124,6 +124,6 @@ ...@@ -124,6 +124,6 @@
<dubbo:reference id="settingApiService" interface="com.gic.haoban.app.aggregation.api.service.SettingApiService" timeout="10000" retries="0" check="false"/> <dubbo:reference id="settingApiService" interface="com.gic.haoban.app.aggregation.api.service.SettingApiService" timeout="10000" retries="0" check="false"/>
<!-- <dubbo:reference id="newDataTargetConfigApiService" interface="com.gic.enterprise.api.service.target.NewDataTargetConfigApiService" timeout="100000" retries="0" check="false" />--> <dubbo:reference id="newDataTargetConfigApiService" interface="com.gic.enterprise.api.service.target.NewDataTargetConfigApiService" timeout="100000" retries="0" check="false" />
</beans> </beans>
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