|
|
@@ -110,7 +110,7 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
List<FollowedUser> followedUsers = externalContact.getFollowedUsers();
|
|
|
//保存企微用户
|
|
|
CorpUser corpUser = saveOrUpdateCorpUser(message, corpUserInfo, followedUsers);
|
|
|
- if (StrUtil.equals(message.getState(), Constant.DY_CS_CODE_KEY)) {
|
|
|
+ if (StrUtil.isNotBlank(message.getState())) {
|
|
|
try {
|
|
|
followedUsers = wxCorpOps.getExternalContact(message.getToUserName(), message.getExternalUserId()).getFollowedUsers();
|
|
|
} catch (Exception e) {
|
|
|
@@ -425,29 +425,36 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
corpUser.setType(corpUserInfo.getType());
|
|
|
//扫码来源
|
|
|
corpUser.setState(message.getState());
|
|
|
- //打标签
|
|
|
- if (StrUtil.equals(message.getState(), Constant.DY_CS_CODE_KEY) && CollUtil.isNotEmpty(followedUsers)) {
|
|
|
- //查询对应标签是否存在
|
|
|
- CorpTag corpTag = corpTagMapper.selectOne(Wrappers.lambdaQuery(CorpTag.class)
|
|
|
- .eq(CorpTag::getName, Constant.DY_CS_CODE_KEY).last("limit 1"));
|
|
|
- if (corpTag == null) {
|
|
|
+ if (StrUtil.isNotBlank(message.getState())) {
|
|
|
+ //打标签
|
|
|
+ SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
+ .eq(SysConfig::getSysKey, Constant.ACTIVE_CODE_TEMP_KEY).last("limit 1"));
|
|
|
+ if (one != null && StrUtil.isNotBlank(one.getSysValue()) && CollUtil.isNotEmpty(followedUsers)) {
|
|
|
try {
|
|
|
- corpTag = addCorpTag(Constant.DY_CS_CODE_KEY, Constant.DY_CS_CODE_KEY, message.getToUserName());
|
|
|
+ List<String> activeCodeList = Jsons.parseList(one.getSysValue(), String.class);
|
|
|
+ if (activeCodeList.contains(message.getState())) {
|
|
|
+ //查询对应标签是否存在
|
|
|
+ CorpTag corpTag = corpTagMapper.selectOne(Wrappers.lambdaQuery(CorpTag.class)
|
|
|
+ .eq(CorpTag::getName, message.getState()).last("limit 1"));
|
|
|
+ if (corpTag == null) {
|
|
|
+ try {
|
|
|
+ corpTag = addCorpTag(message.getState(), message.getState(), message.getToUserName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (corpTag != null) {
|
|
|
+ List<String> tagId = List.of(corpTag.getTagId());
|
|
|
+ followedUsers.forEach(follow -> {
|
|
|
+ try {
|
|
|
+ wxCorpOps.markTag(corpUserInfo.getExternalUserId(), follow.getUserId(), tagId.toArray(new String[tagId.size()]), null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
- if (corpTag != null) {
|
|
|
- List<String> dy_tag = List.of(corpTag.getTagId());
|
|
|
- followedUsers.forEach(follow -> {
|
|
|
- if (!Constant.DY_CUS.contains(follow.getUserId())) {
|
|
|
- return;
|
|
|
- }
|
|
|
- try {
|
|
|
- wxCorpOps.markTag(corpUserInfo.getExternalUserId(), follow.getUserId(), dy_tag.toArray(new String[dy_tag.size()]), null);
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
//新增修改客户信息
|