Commit e2c17e9f by 墨竹

feat:代开发转换回退代码

parent 69437f1f
...@@ -362,10 +362,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -362,10 +362,6 @@ public class StaffApiServiceImpl implements StaffApiService {
String openUserid = getOpenUserid(userId, corpid); String openUserid = getOpenUserid(userId, corpid);
if (StringUtils.isNotBlank(openUserid)) { if (StringUtils.isNotBlank(openUserid)) {
staff.setWxOpenUseId(openUserid); staff.setWxOpenUseId(openUserid);
String userid = getUserid(openUserid, wxEnterpriseId);
if (StringUtils.isNotBlank(userid)) {
staff.setWxUserId(userid);
}
} }
//成员更改或更新 //成员更改或更新
if (StringUtils.isBlank(staff.getStaffId())) { if (StringUtils.isBlank(staff.getStaffId())) {
......
...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DealParamMqDTO; import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum; import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
...@@ -17,7 +16,6 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -17,7 +16,6 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper; import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog; import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask; import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.service.PreDealService; import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SecretSettingService; import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.SyncTaskService; import com.gic.haoban.manage.service.service.SyncTaskService;
...@@ -165,37 +163,6 @@ public class QywxStaffSyncOperation implements BaseSyncOperation { ...@@ -165,37 +163,6 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
} }
} }
} }
Integer useridFlag = wxEnterpriseDTO.getUseridFlag();
logger.info("同步通讯录完成,批量处理wx_user_id,corpid:{},useridFlag:{}", corpid,useridFlag);
if (corpid.length() < 20 && useridFlag == 1) {
// 限流器
RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("haoban:manage3:updateWxUserId:limit");
// 每1秒产生5个令牌
rateLimiter.trySetRate(RateType.OVERALL, 5, 1, RateIntervalUnit.SECONDS);
TabHaobanWxApplication tabHaobanWxApplication = wxApplicationMapper.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 3);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, 5);
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("openuseridToUserid 转换完成,为最后一个");
break;
}
pageNum++;
logger.info("openuseridToUserid 请求:corpid:{}", corpid);
List<QywxNewUseridDTO> qywxNewUseridDTOS = qywxUserApiService.getSelfOpenuseridToUserid(tabHaobanWxApplication.getCorpid(), secretSetting.getSecretVal(), tabHaobanWxApplication.getAgentId(), staffDTOS.stream().map(StaffDTO::getWxUserId).collect(Collectors.toList()));
if (CollectionUtils.isNotEmpty(qywxNewUseridDTOS)) {
for (QywxNewUseridDTO qywxNewUseridDTO : qywxNewUseridDTOS) {
staffApiService.updateWxUserIdsByWxOpenUserId(wxEnterpriseId, qywxNewUseridDTO.getOpen_userid(), qywxNewUseridDTO.getUserid());
}
}
}
}
} }
} }
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