Commit 134f4a30 by fudahua

导购刷新好友超时时间

parent c721c95b
......@@ -795,6 +795,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
String res = qywxUserApiService.listSelfExternalUserid(enterprise.getCorpid(), secretSetting.getSecretVal(), wxUserId);
log.info("【查询自建应用】res={}",res);
if (res != null && res.equals("1")) {
log.info("代表需要重试");
return null;
}
if(StringUtils.isBlank(res)){
return list;
}
......@@ -819,6 +823,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String wxRes = qywxUserApiService.listExternalUserid(enterprise.getCorpid(), config.getWxSuiteid(), wxUserId);
List<String> list = new ArrayList<>();
log.info("【查询第三方应用】res={}",wxRes);
if (wxRes != null && wxRes.equals("1")) {
log.info("代表需要重试");
return null;
}
if(StringUtils.isBlank(wxRes)){
return list;
}
......
......@@ -38,6 +38,8 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
private SyncTaskService syncTaskService;
private static final String FRIEND_LOCK = "haoban_fresh_wx_friend_lock_";
private static final String TRY_AGAIN = "haoban_fresh_wx_friend_again_";
@Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("dealParamMqDTO={},dataPre={}", JSON.toJSONString(dealParamMqDTO), JSON.toJSONString(dataPre));
......@@ -49,7 +51,11 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
String wxUserId = dataPre.getDataId();
//获取所有外部联系人的外部联系人ids
List<String> selfUserIdList = memberUnionidRelatedApiService.listSelfExterialList(wxEnterpriseId, wxUserId);
logger.info("selfUserIdList={}", selfUserIdList.size());
logger.info("selfUserIdList={}", JSONObject.toJSONString(selfUserIdList));
if (null == selfUserIdList && tryAgainToMq(dataPre)) {
logger.info("自建应用调用第三方接口进入重试");
return;
}
if (CollectionUtils.isEmpty(selfUserIdList)) {
logger.info("改用户没有外部联系人:{}", JSONObject.toJSONString(dataPre));
dealFlag = false;
......@@ -58,6 +64,10 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
}
//第三方服务商的外部联系人
List<String> userIdList = memberUnionidRelatedApiService.listExterialList(wxEnterpriseId, wxUserId);
if (null == selfUserIdList && tryAgainToMq(dataPre)) {
logger.info("第三方服务商外部联系人调用失败进入重试:{}", dataPre.getDataId());
return;
}
if (CollectionUtils.isEmpty(userIdList)) {
logger.info("改用户没有外部联系人2:{}", JSONObject.toJSONString(dataPre));
dealFlag = false;
......@@ -107,6 +117,24 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
}
}
private boolean tryAgainToMq(TabHaobanPreDealLog dataPre) {
logger.info("需要重试:{}", dataPre.getDataId());
String key = TRY_AGAIN + dataPre.getTaskId() + ":" + dataPre.getDataId();
Object cache = RedisUtil.getCache(key);
if (null == cache) {
RedisUtil.setCache(key, 1);
} else {
Integer count = Integer.valueOf(cache.toString());
if (count > 5) {
return false;
}
}
HashSet<String> reTrysIds = new HashSet<>();
reTrysIds.add(dataPre.getDataId());
dealDepartmentToMq(dataPre.getTaskId(), reTrysIds, SyncTaskStatusEnum.friend_clerk_sync);
return true;
}
@Override
public void dealException(String taskId, String dataId, String enterpriseId, String reason) {
preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.exception.getVal(), reason);
......
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