zoujiajian 2 anni fa
parent
commit
4aecf085ff

+ 13 - 8
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java

@@ -2,17 +2,17 @@ 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;
 import com.cyksj.mapper.corp.CorpFollowMapper;
 import com.cyksj.mapper.corp.CorpTagMapper;
 import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
-import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
-import com.cyksj.model.entity.CorpFollow;
-import com.cyksj.model.entity.CorpTag;
-import com.cyksj.model.entity.CorpWelcomeTemplate;
+import com.cyksj.model.dto.CorpFollowServiceDto;
+import com.cyksj.model.entity.*;
 import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
+import com.cyksj.service.sys.SysConfigService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
@@ -45,6 +45,8 @@ public class CorpCustomerAcquistionLinkController {
 
     private final HttpServletRequest request;
 
+    private final SysConfigService sysConfigService;
+
     /**
      * 新增获客助手链接
      */
@@ -80,15 +82,18 @@ 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);
+
         search.getDataList().forEach(e->{
             try {
-                List<String> userStrList = corpFollowMapper.selectList(Wrappers.lambdaQuery(CorpFollow.class)
-                        .in(CorpFollow::getUserid, Jsons.parseList(e.getUserList(),String.class))).stream().map(CorpFollow::getName).collect(Collectors.toList());
+                List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> e.getUserList().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
                 e.setUserStrList(userStrList);
 
                 if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
-                    List<String> dutyUserList = corpFollowMapper.selectList(Wrappers.lambdaQuery(CorpFollow.class)
-                            .in(CorpFollow::getUserid, Jsons.parseList(e.getChooseDutyUsers(), String.class))).stream().map(CorpFollow::getName).collect(Collectors.toList());
+                    List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> e.getChooseDutyUsers().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+
                     e.setChooseDutyUserList(dutyUserList);
                 }