Commit e520a263 by 墨竹

feat:企微标签打标签改为消息队列

parent 0be28b3b
...@@ -484,12 +484,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -484,12 +484,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("corpid",wxEnterprise.getCorpid()); jsonObject.put("corpid", wxEnterprise.getCorpid());
jsonObject.put("suiteId", wxSuiteid); jsonObject.put("suiteId", wxSuiteid);
jsonObject.put("wxUserId",wxUserId); jsonObject.put("wxUserId", wxUserId);
jsonObject.put("externalUserId",externalUserId); jsonObject.put("externalUserId", externalUserId);
jsonObject.put("needSetTags",StringUtils.join(needSetTags,",")); jsonObject.put("needSetTags", StringUtils.join(needSetTags, ","));
jsonObject.put("needDelTags",StringUtils.join(needDelTags,",")); jsonObject.put("needDelTags", StringUtils.join(needDelTags, ","));
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
clientInstance.sendMessage("qywxMarkTagMq", jsonObject.toJSONString()); clientInstance.sendMessage("qywxMarkTagMq", jsonObject.toJSONString());
...@@ -570,14 +570,14 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -570,14 +570,14 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
} }
Map<String, Set<String>> externalTagMap = getExternalTagMap(externalUseridInfo, wxEnterpriseId); Map<String, Set<String>> externalTagMap = getExternalTagMap(externalUseridInfo, wxEnterpriseId);
if (MapUtils.isEmpty(externalTagMap)) { if (MapUtils.isEmpty(externalTagMap)) {
logger.info("该用户没有不存在好友关系,获取不到关联导购打的标签,:externalUseridInfo:{}",externalUseridInfo); logger.info("该用户没有不存在好友关系,获取不到关联导购打的标签,:externalUseridInfo:{}", externalUseridInfo);
resp.setMessage("该用户没有不存在好友关系,获取不到关联导购打的标签"); resp.setMessage("该用户没有不存在好友关系,获取不到关联导购打的标签");
return resp; return resp;
} }
//当前操作用户企业打的标签 //当前操作用户企业打的标签
Set<String> staffChangeTagKeys = externalTagMap.get(wxUserId); Set<String> staffChangeTagKeys = externalTagMap.get(wxUserId);
if (CollectionUtils.isEmpty(staffChangeTagKeys)) { if (CollectionUtils.isEmpty(staffChangeTagKeys)) {
logger.info("该用户没有不存在好友关系,获取不到关联导购打的标签,wxUserId:{}",wxUserId); logger.info("该用户没有不存在好友关系,获取不到关联导购打的标签,wxUserId:{}", wxUserId);
resp.setMessage("该用户没有不存在好友关系,获取不到关联导购打的标签"); resp.setMessage("该用户没有不存在好友关系,获取不到关联导购打的标签");
return resp; return resp;
} }
...@@ -586,7 +586,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -586,7 +586,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//获取该外部联系人的所有会员 //获取该外部联系人的所有会员
List<TabHaobanExternalClerkRelated> clerkRelateds = externalClerkRelatedService.listExternalByExternalUserid(wxEnterpriseId, externalUserId); List<TabHaobanExternalClerkRelated> clerkRelateds = externalClerkRelatedService.listExternalByExternalUserid(wxEnterpriseId, externalUserId);
if (CollectionUtils.isEmpty(clerkRelateds)) { if (CollectionUtils.isEmpty(clerkRelateds)) {
logger.info("该用户没关联对应的好友:{}",externalUserId); logger.info("该用户没关联对应的好友:{}", externalUserId);
resp.setMessage("该用户没关联对应的好友"); resp.setMessage("该用户没关联对应的好友");
return resp; return resp;
} }
...@@ -932,8 +932,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -932,8 +932,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
String externalUserId = jsonObject.getString("externalUserId"); String externalUserId = jsonObject.getString("externalUserId");
String needSetTags = jsonObject.getString("needSetTags"); String needSetTags = jsonObject.getString("needSetTags");
String needDelTags = jsonObject.getString("needDelTags"); String needDelTags = jsonObject.getString("needDelTags");
String key = "HAOBAN:QYWX:TAG:"+wxUserId+externalUserId; String key = "HAOBAN:QYWX:TAG:" + wxUserId + externalUserId;
//重试5次
Integer currentTimes = Convert.toInt(RedisUtil.getCache(key), 0); Integer currentTimes = Convert.toInt(RedisUtil.getCache(key), 0);
if (currentTimes > MAX_TIMES) { if (currentTimes > MAX_TIMES) {
logger.error("企微打标签超过最大次数,key:{}", key); logger.error("企微打标签超过最大次数,key:{}", key);
...@@ -945,7 +944,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -945,7 +944,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("权限不对,重试三次:{},{}", wxUserId, externalUserId); logger.info("权限不对,重试三次:{},{}", wxUserId, externalUserId);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
clientInstance.sendMessage("qywxMarkTagMq", jsonObject.toJSONString(),30); clientInstance.sendMessage("qywxMarkTagMq", jsonObject.toJSONString(), 30);
} catch (Exception e) { } catch (Exception e) {
logger.info("企微标签同步qywxMarkTagMq发送失败:{}", e.getMessage(), e); logger.info("企微标签同步qywxMarkTagMq发送失败:{}", e.getMessage(), e);
} }
......
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