|
|
@@ -3,20 +3,19 @@ package com.cyksj.service.corp.impl;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
-import com.cyksj.mapper.sys.SysConfigMapper;
|
|
|
import com.cyksj.mapper.corp.CorpFollowConfigMapper;
|
|
|
import com.cyksj.mapper.corp.CorpTagMapper;
|
|
|
import com.cyksj.model.dto.CorpFollowActiveCodeDto;
|
|
|
-import com.cyksj.model.dto.CorpFollowServiceDto;
|
|
|
import com.cyksj.model.entity.CorpFollowConfig;
|
|
|
import com.cyksj.model.entity.CorpTag;
|
|
|
-import com.cyksj.model.entity.SysConfig;
|
|
|
+import com.cyksj.model.entity.SysCorpFollowRelate;
|
|
|
import com.cyksj.model.request.corp.CorpFollowContact;
|
|
|
import com.cyksj.service.corp.CorpFollowDynamicConfigService;
|
|
|
import com.cyksj.service.corp.WxCorpOps;
|
|
|
+import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -42,7 +41,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
|
|
|
|
|
|
private final CorpTagMapper corpTagMapper;
|
|
|
|
|
|
- private final SysConfigMapper sysConfigMapper;
|
|
|
+ private final BeanSearcher beanSearcher;
|
|
|
|
|
|
@Override
|
|
|
public String corpFollowContactConfig(CorpFollowContact corpFollowContact) throws Exception {
|
|
|
@@ -64,12 +63,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
|
|
|
@Override
|
|
|
public String createCorpFollowActiveCode(List<String> followIds, List<Integer> userIndxList, String state, Boolean isDuty) throws Exception {
|
|
|
List<CorpFollowActiveCodeDto> codeList = new ArrayList<>();
|
|
|
- SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
- .eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
|
|
|
- List<CorpFollowServiceDto> corpFollowServiceDtos = null;
|
|
|
- if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
|
|
|
- corpFollowServiceDtos = Jsons.parseList(sysConfig.getSysValue(), CorpFollowServiceDto.class);
|
|
|
- }
|
|
|
+ List<SysCorpFollowRelate> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowRelate.class, MapUtils.builder().build());
|
|
|
Integer type = 1;
|
|
|
if (!isDuty) {
|
|
|
//不是值班 多人生成一个二维码
|
|
|
@@ -79,7 +73,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
|
|
|
}
|
|
|
String serviceNames = null;
|
|
|
if (corpFollowServiceDtos != null) {
|
|
|
- serviceNames = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.joining(","));
|
|
|
+ serviceNames = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).map(SysCorpFollowRelate::getName).collect(Collectors.joining(","));
|
|
|
}
|
|
|
if (StrUtil.isEmpty(serviceNames)) {
|
|
|
throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
|
|
|
@@ -87,16 +81,16 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
|
|
|
CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(followIds, userIndxList, state, type, serviceNames);
|
|
|
codeList.add(corpFollowActiveCodeDto);
|
|
|
} else {
|
|
|
- Map<String, List<CorpFollowServiceDto>> csMap = null;
|
|
|
+ Map<String, List<SysCorpFollowRelate>> csMap = null;
|
|
|
if (corpFollowServiceDtos != null) {
|
|
|
- csMap = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).collect(Collectors.groupingBy(CorpFollowServiceDto::getFollowId));
|
|
|
+ csMap = corpFollowServiceDtos.stream().filter(cs -> followIds.contains(cs.getFollowId())).collect(Collectors.groupingBy(SysCorpFollowRelate::getFollowId));
|
|
|
}
|
|
|
if (csMap == null || csMap.keySet().size() != followIds.size()) {
|
|
|
throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
|
|
|
}
|
|
|
for (String followId : followIds) {
|
|
|
- CorpFollowServiceDto corpFollowServiceDto = csMap.get(followId).get(0);
|
|
|
- CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), List.of(corpFollowServiceDto.getIndx()), state, type, corpFollowServiceDto.getName());
|
|
|
+ SysCorpFollowRelate corpFollowServiceDto = csMap.get(followId).get(0);
|
|
|
+ CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), List.of(Integer.parseInt(corpFollowServiceDto.getId().toString())), state, type, corpFollowServiceDto.getName());
|
|
|
codeList.add(corpFollowActiveCodeDto);
|
|
|
}
|
|
|
}
|