Просмотр исходного кода

Merge branch 'sys_corp_follow_func' into pre

zoujiajian 2 лет назад
Родитель
Сommit
4c03104f5d

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/CorpFollowServiceDto.java

@@ -18,4 +18,6 @@ public class CorpFollowServiceDto {
 	private Integer indx;
 
 	private String followId;
+
+	private String img;
 }

+ 10 - 16
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowDynamicConfigServiceImpl.java

@@ -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);
 			}
 		}

+ 2 - 10
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CmsCorpFollowActiveCodeController.java

@@ -3,7 +3,6 @@ package com.cyksj.web.controller.manage.corp;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
@@ -11,7 +10,6 @@ import com.cyksj.mapper.OrderDonMapper;
 import com.cyksj.mapper.corp.CorpUserMapper;
 import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
 import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.model.dto.CorpFollowServiceDto;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.corp.Attachments;
 import com.cyksj.model.request.corp.CorpFollowContact;
@@ -95,14 +93,8 @@ public class CmsCorpFollowActiveCodeController {
 	 * 可选客服配置
 	 */
 	@GetMapping("/get/available/follow")
-	public Result<List<CorpFollowServiceDto>> getAvailableFollow() throws Exception {
-		SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
-		if (config == null || StrUtil.isEmpty(config.getSysValue())) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		String sysValue = config.getSysValue();
-		List<CorpFollowServiceDto> corpFollowServiceDtos = Jsons.parseList(sysValue, CorpFollowServiceDto.class);
+	public Result<List<SysCorpFollowRelate>> getAvailableFollow() {
+		List<SysCorpFollowRelate> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowRelate.class, MapUtils.builder().build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(corpFollowServiceDtos);
 	}
 

+ 9 - 14
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java

@@ -2,7 +2,6 @@ package com.cyksj.web.controller.manage.corp;
 
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
@@ -11,7 +10,6 @@ import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkExtraCustomerMapper;
 import com.cyksj.mapper.corp.CorpFollowMapper;
 import com.cyksj.mapper.corp.CorpTagMapper;
 import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
-import com.cyksj.model.dto.CorpFollowServiceDto;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.views.CorpCustomerAcquisitionLinkExtraCustomerView;
 import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
@@ -92,35 +90,33 @@ public class CorpCustomerAcquistionLinkController {
     public Result<SearchResult<CorpCustomerAcquisitionLink>> get() throws Exception {
         SearchResult<CorpCustomerAcquisitionLink> search = beanSearcher.search(CorpCustomerAcquisitionLink.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 
-        SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-                .eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
-        List<CorpFollowServiceDto> corpFollowServiceDtos = Jsons.parseList(config.getSysValue(), CorpFollowServiceDto.class);
+        List<SysCorpFollowRelate> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowRelate.class, MapUtils.builder().build());
 
-        search.getDataList().forEach(e->{
+        search.getDataList().forEach(e -> {
             try {
                 List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> {
                     try {
-                        return Jsons.parseList(e.getUserList(), Integer.class).contains(cf.getIndx());
+                        return Jsons.parseList(e.getUserList(), Integer.class).contains(cf.getId());
                     } catch (Exception ex) {
                     }
                     return false;
-                }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+                }).map(SysCorpFollowRelate::getName).collect(Collectors.toList());
                 e.setUserStrList(userStrList);
 
                 if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
                     List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> {
                         try {
-                            return Jsons.parseList(e.getChooseDutyUsers(), Integer.class).contains(cf.getIndx());
+                            return Jsons.parseList(e.getChooseDutyUsers(), Integer.class).contains(cf.getId());
                         } catch (Exception ex) {
                         }
                         return false;
-                    }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+                    }).map(SysCorpFollowRelate::getName).collect(Collectors.toList());
 
                     e.setChooseDutyUserList(dutyUserList);
                 }
 
                 List<String> tagStrList = corpTagMapper.selectList(Wrappers.lambdaQuery(CorpTag.class)
-                        .in(CorpTag::getId, Jsons.parseList(e.getTags(),Long.class))).stream().map(CorpTag::getName).collect(Collectors.toList());
+                        .in(CorpTag::getId, Jsons.parseList(e.getTags(), Long.class))).stream().map(CorpTag::getName).collect(Collectors.toList());
                 e.setTagStrList(tagStrList);
             } catch (Exception ex) {
             }
@@ -187,9 +183,8 @@ public class CorpCustomerAcquistionLinkController {
                 .orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getAcId).asc()
                 .orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getCreatedTime).desc()
                 .build());
-        SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-                .eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
-        Map<Integer, List<CorpFollowServiceDto>> serviceMap = Jsons.parseList(config.getSysValue(), CorpFollowServiceDto.class).stream().collect(Collectors.groupingBy(CorpFollowServiceDto::getIndx));
+        List<SysCorpFollowRelate> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowRelate.class, MapUtils.builder().build());
+        Map<Long, List<SysCorpFollowRelate>> serviceMap = corpFollowServiceDtos.stream().collect(Collectors.groupingBy(SysCorpFollowRelate::getId));
         search.getDataList().forEach(e->{
             Optional.ofNullable(serviceMap.get(e.getServiceId()))
                     .ifPresent(service -> e.setServiceName(service.get(0).getName()));