Commit 027a95c0 by 墨竹

fix:刷新好友bug修改

parent ea73ea12
......@@ -101,6 +101,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
reason = "员工不存在";
return;
}
String staffId = tabHaobanStaff.getStaffId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.info("没有存在企业关联:wxEnterpriseId:{}", wxEnterpriseId);
......@@ -108,15 +109,8 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
reason = "没有关联企业";
return;
}
String corpid = wxEnterpriseDTO.getCorpid();
//wxUserId 兼容
if (corpid.length() > 20) {
wxUserId = tabHaobanStaff.getWxOpenUseId();
} else {
wxUserId = tabHaobanStaff.getWxUserId();
}
//relationkey
relationKey = SecureUtil.md5(wxUserId + "_" + externalUserDTO.getName() + "_" + externalUserDTO.getAddCreateTime());
relationKey = SecureUtil.md5(staffId + "_" + externalUserDTO.getName() + "_" + externalUserDTO.getAddCreateTime());
logger.info("relationKey:{},{}", relationKey, externalUserDTO.getExternalUserId());
// 根据关联键relationkey查看自建应用 是否有数据
TabHaobanPreDealLog selfPre = preDealService.getByRelationKey(taskId, PreDealTypeEnum.self_friend.getVal(), relationKey);
......@@ -336,7 +330,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
try {
clientInstance.sendBatchMessages("departmentSyncDealMq", ret);
} catch (Exception e) {
logger.info("发送失败:{}", taskId,e);
logger.info("发送失败:{}", taskId, e);
e.printStackTrace();
}
}
......
package com.gic.haoban.manage.service.task.friend;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
......@@ -11,8 +10,10 @@ import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.exception.WxApiLimitException;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.task.BaseSyncOperation;
import com.gic.mq.sdk.GicMQClient;
......@@ -44,6 +45,8 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
private SyncTaskService syncTaskService;
@Autowired
private FriendClerkSyncNewOperation friendClerkSyncNewOperation;
@Autowired
private StaffService staffService;
private static final String TRY_AGAIN = "haoban_fresh_wx_friend_again_";
......@@ -64,6 +67,13 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
dealException(taskId, dataPre.getDataId(), null, "好友不存在");
return;
}
TabHaobanStaff tabHaobanStaff = staffService.selectByUserIdAndEnterpriseId(wxUserId, wxEnterpriseId);
if (tabHaobanStaff == null) {
dealFlag = false;
reason = "员工不存在";
return;
}
String staffId = tabHaobanStaff.getStaffId();
//自有应用信息
JSONObject json = new JSONObject();
json.put("name", pojo.getName());
......@@ -73,7 +83,7 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
json.put("addCreateTime", pojo.getAddCreateTime());
//relationkey
String relationKey = SecureUtil.md5(wxUserId + "_" + pojo.getName() + "_" + pojo.getAddCreateTime());
String relationKey = SecureUtil.md5(staffId + "_" + pojo.getName() + "_" + pojo.getAddCreateTime());
//更新状态
preDealService.updateFriendStatusByDataId(taskId, dataPre.getDataId(), PreDealStatusEnum.computed.getVal(), reason, json.toJSONString(), relationKey);
dealSuccess(taskId, dataPre.getDataId(), null, wxEnterpriseId);
......
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