|
|
@@ -27,9 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj
|
|
|
@@ -66,12 +64,11 @@ public class CorpFollowServiceImpl implements CorpFollowService {
|
|
|
activeCode.setOperator(cmsUser.getNickname());
|
|
|
}
|
|
|
Boolean isDuty = Optional.ofNullable(activeCode.getIsDuty()).orElse(false);
|
|
|
- List<CorpFollow> followList = activeCode.getFollowList();
|
|
|
- if (CollUtil.isEmpty(followList)) {
|
|
|
+ List<String> followIds = activeCode.getFollowIds();
|
|
|
+ if (CollUtil.isEmpty(followIds)) {
|
|
|
throw BusinessRuntimeException.getInstance("请选择对应客服");
|
|
|
}
|
|
|
- activeCode.setFollowStr(Jsons.toJson(followList));
|
|
|
- List<String> followIds = followList.stream().map(CorpFollow::getUserid).collect(Collectors.toList());
|
|
|
+ activeCode.setFollowStr(followIds.toString());
|
|
|
activeCode.setMarkTag(activeCode.getMarkTag().trim());
|
|
|
String text = activeCode.getText();
|
|
|
if (StrUtil.isNotBlank(text) && text.length() > 4000) {
|
|
|
@@ -110,27 +107,23 @@ public class CorpFollowServiceImpl implements CorpFollowService {
|
|
|
throw BusinessRuntimeException.getInstance("对应的数据已不存在");
|
|
|
}
|
|
|
String db_followStr = dbActiveCode.getFollowStr();
|
|
|
- List<CorpFollow> up_corpFollows = activeCode.getFollowList();
|
|
|
+ List<String> up_corpFollows = activeCode.getFollowIds();
|
|
|
if (CollUtil.isEmpty(up_corpFollows)) {
|
|
|
throw BusinessRuntimeException.getInstance("请选择对应客服");
|
|
|
}
|
|
|
- activeCode.setFollowStr(Jsons.toJson(up_corpFollows));
|
|
|
+ activeCode.setFollowStr(up_corpFollows.toString());
|
|
|
if (StrUtil.isEmpty(activeCode.getMarkTag())) {
|
|
|
throw BusinessRuntimeException.getInstance("请输入标签");
|
|
|
}
|
|
|
- List<CorpFollow> db_corpFollows = Jsons.parseList(db_followStr, CorpFollow.class);
|
|
|
+ List<String> db_followIds = Jsons.parseList(db_followStr, String.class);
|
|
|
Boolean isReCreateAcCode = false;
|
|
|
Boolean isUpdateAcCode = false;
|
|
|
- List<String> followIds = null;
|
|
|
- if (db_corpFollows.size() != up_corpFollows.size()) {
|
|
|
+ if (db_followIds.size() != up_corpFollows.size()) {
|
|
|
isReCreateAcCode = true;
|
|
|
- followIds = db_corpFollows.stream().map(CorpFollow::getUserid).collect(Collectors.toList());
|
|
|
}
|
|
|
if (!isReCreateAcCode) {
|
|
|
- Map<String, List<CorpFollow>> db_follow_collect = db_corpFollows.stream().collect(Collectors.groupingBy(CorpFollow::getUserid));
|
|
|
- for (CorpFollow upCorpFollow : up_corpFollows) {
|
|
|
- List<CorpFollow> corpFollows = db_follow_collect.get(upCorpFollow.getUserid());
|
|
|
- if (CollUtil.isEmpty(corpFollows)) {
|
|
|
+ for (String upFollowId : up_corpFollows) {
|
|
|
+ if (!db_followIds.contains(upFollowId)) {
|
|
|
isReCreateAcCode = true;
|
|
|
break;
|
|
|
}
|
|
|
@@ -152,7 +145,7 @@ public class CorpFollowServiceImpl implements CorpFollowService {
|
|
|
|
|
|
//重新构建活码配置
|
|
|
if (isReCreateAcCode) {
|
|
|
- String code_str = corpFollowDynamicConfigService.createCorpFollowActiveCode(followIds, Constant.AC_CODE_KEY + activeCode.getId(), up_isDuty);
|
|
|
+ String code_str = corpFollowDynamicConfigService.createCorpFollowActiveCode(up_corpFollows, Constant.AC_CODE_KEY + activeCode.getId(), up_isDuty);
|
|
|
activeCode.setCodeStr(code_str);
|
|
|
} else if (isUpdateAcCode) {
|
|
|
corpFollowDynamicConfigService.updateCorpFollowActiveCode(dbActiveCode.getMarkTag(), activeCode.getMarkTag());
|