Commit c7ee0b00 by 徐高华

第三方和代开id

parent 285111ff
...@@ -96,7 +96,7 @@ public class HandoverServiceImpl implements HandoverService { ...@@ -96,7 +96,7 @@ public class HandoverServiceImpl implements HandoverService {
Map<String, List<QywxUnassignedInfoDTO>> handoverUserMap = infoList.stream().collect(Collectors.groupingBy(dto -> dto.getHandoverUserid())); Map<String, List<QywxUnassignedInfoDTO>> handoverUserMap = infoList.stream().collect(Collectors.groupingBy(dto -> dto.getHandoverUserid()));
handoverUserMap.forEach((userId, list) -> { handoverUserMap.forEach((userId, list) -> {
boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getThirdCorpid()); boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getDkCorpid());
if (checkFlag) { if (checkFlag) {
logger.info("该用户存在,不需要离职基础:{},{}", userId, wxEnterpriseId); logger.info("该用户存在,不需要离职基础:{},{}", userId, wxEnterpriseId);
return; return;
......
...@@ -189,6 +189,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -189,6 +189,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
if(wxSecurityType < 1 || wxSecurityType > 4) { if(wxSecurityType < 1 || wxSecurityType > 4) {
return ; return ;
} }
com.gic.haoban.manage.service.util.DingUtils.send("更新WxSecurityType告警,wxEnterpriseId="+wxEnterpriseId, null, true);
this.mapper.updateWxSecurityType(wxEnterpriseId, wxSecurityType); this.mapper.updateWxSecurityType(wxEnterpriseId, wxSecurityType);
} }
......
...@@ -535,7 +535,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -535,7 +535,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
unlockTask(wxEnterpriseId); unlockTask(wxEnterpriseId);
return "没有配置secret"; return "没有配置secret";
} }
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getThirdCorpid(), secretSetting.getSecretVal(), 1); List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), 1);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
logger.info("没有数据同步"); logger.info("没有数据同步");
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal());
......
...@@ -386,7 +386,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -386,7 +386,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else { } else {
userIds.add(relationDTO.getQwUserId()); userIds.add(relationDTO.getQwUserId());
} }
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getDkCorpid(), config.getWxSuiteid(), send); QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), send);
logger.info("configId:{}", JSON.toJSONString(configResp)); logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id(); String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) { if (StringUtils.isBlank(configId)) {
......
...@@ -128,38 +128,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation { ...@@ -128,38 +128,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
dealSyncOperationApiService.unlockTask(wxEnterpriseId); dealSyncOperationApiService.unlockTask(wxEnterpriseId);
dealSyncOperationApiService.cleanDiffrence(wxEnterpriseId, taskId); dealSyncOperationApiService.cleanDiffrence(wxEnterpriseId, taskId);
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId); logger.info("同步通讯录完成");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
String corpid = qwDTO.getThirdCorpid() ;
Integer externalFlag = wxEnterpriseDTO.getExternalFlag();
logger.info("同步通讯录完成,批量处理wx_open_user_id,corpid:{},externalFlag:{}", corpid,externalFlag);
if (corpid.length() > 20 || externalFlag == 1) {
// 限流器
RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("haoban:manage3:updateWxOpenUserId:limit");
// 每1秒产生5个令牌
rateLimiter.trySetRate(RateType.OVERALL, 5, 1, RateIntervalUnit.SECONDS);
int pageNum = 1;
while (true) {
// 获取令牌
rateLimiter.acquire();
//企微转换最多支持1000个
//批量处理wx_user_id to wx_open_user_id
Page<StaffDTO> staffDTOPageInfo = staffApiService.listUserIdByWxEnterpriseId(wxEnterpriseId, pageNum, 1000);
List<StaffDTO> staffDTOS = staffDTOPageInfo.getResult();
if (CollectionUtils.isEmpty(staffDTOS)) {
logger.info("useridToOpenuserid 转换完成,为最后一个");
break;
}
pageNum++;
logger.info("useridToOpenuserid请求:corpid:{}", corpid);
List<QywxNewUseridDTO> qywxNewUseridDTOS = qywxUserApiService.useridToOpenuserid(corpid, config.getWxSuiteid(), staffDTOS.stream().map(StaffDTO::getWxUserId).collect(Collectors.toList()));
if (CollectionUtils.isNotEmpty(qywxNewUseridDTOS)) {
for (QywxNewUseridDTO qywxNewUseridDTO : qywxNewUseridDTOS) {
staffApiService.updateOpenUserIdsByUserId(wxEnterpriseId, qywxNewUseridDTO.getUserid(), qywxNewUseridDTO.getOpen_userid());
}
}
}
}
} }
} }
RedisUtil.unlock(key); RedisUtil.unlock(key);
......
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