Kaynağa Gözat

重构活码、获客链接客服关系

zoujiajian 2 yıl önce
ebeveyn
işleme
2a1c71ce85

+ 6 - 1
netflix-dao/src/main/java/com/cyksj/model/dto/CorpFollowActiveCodeDto.java

@@ -15,10 +15,15 @@ import lombok.Setter;
 public class CorpFollowActiveCodeDto {
 
 	/**
-	 * 企业微信的客服id 数组
+	 * 客服id 数组
 	 */
 	private String followIds;
 
+	/**
+	 * 最新 值班客服id
+	 */
+	private String userIndxList;
+
 	/**
 	 * 对应系统配置的客服
 	 */

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowActiveCode.java

@@ -27,7 +27,7 @@ public class CorpFollowActiveCode extends BaseEntity{
 	@TableField(exist = false)
 	@DbIgnore
 	@NotNull(message = "请选择对应客服")
-	private List<String> followIds;
+	private List<Integer> userIndxList;
 
 	/**
 	 * 客服

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/corp/CorpFollowDynamicConfigService.java

@@ -13,7 +13,7 @@ import java.util.List;
 public interface CorpFollowDynamicConfigService {
 	String corpFollowContactConfig(CorpFollowContact corpFollowContact) throws Exception;
 
-	String createCorpFollowActiveCode(List<String> followIds, String state, Boolean isDuty) throws Exception;
+	String createCorpFollowActiveCode(List<String> followIds, List<Integer> userIndxList, String state, Boolean isDuty) throws Exception;
 
 	void updateCorpFollowActiveCode(String oldMarkTag, String markTag) throws Exception;
 }

+ 13 - 3
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquisitionLinkServiceImpl.java

@@ -1,11 +1,11 @@
 package com.cyksj.service.corp.impl;
 
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.util.Jsons;
 import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
 import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkPopularizeMapper;
 import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
@@ -16,6 +16,7 @@ import com.cyksj.model.request.corp.link.WxCpLinkAddResp;
 import com.cyksj.model.request.corp.link.WxCpLinkUpd;
 import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
 import com.cyksj.service.corp.WxCorpOps;
+import com.cyksj.service.sys.SysCorpServiceRelateService;
 import com.cyksj.xxljob.XxlJobInfo;
 import com.cyksj.xxljob.XxlJobUtil;
 import lombok.RequiredArgsConstructor;
@@ -23,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 import java.util.Optional;
 
 /**
@@ -38,6 +40,8 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
 
     private final CorpCustomerAcquisitionLinkPopularizeMapper corpCustomerAcquisitionLinkPopularizeMapper;
 
+    private final SysCorpServiceRelateService sysCorpServiceRelateService;
+
     @Override
     @Transactional(rollbackFor = Throwable.class)
     public void add(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
@@ -45,7 +49,10 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
         wxCpLinkAdd.setLinkName(corpCustomerAcquisitionLink.getLinkName());
         wxCpLinkAdd.setSkipVerify(corpCustomerAcquisitionLink.getSkipVerify());
         Range range = new Range();
-        range.setUserList(JSONUtil.parseArray(corpCustomerAcquisitionLink.getUserList()).toList(String.class));
+        String userList = corpCustomerAcquisitionLink.getUserList();
+        //值班客服
+        List<String> followIds = sysCorpServiceRelateService.getFollowIdsByRelateIds(Jsons.parseList(userList, Integer.class));
+        range.setUserList(followIds);
         wxCpLinkAdd.setRange(range);
         WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionCreateLink(null, wxCpLinkAdd);
         corpCustomerAcquisitionLink.setUrl(wxCpLinkAddResp.getLink().getUrl());
@@ -72,7 +79,10 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
         wxCpLinkUpd.setLinkId(corpCustomerAcquisitionLink.getLinkId());
         wxCpLinkUpd.setSkipVerify(corpCustomerAcquisitionLink.getSkipVerify());
         Range range = new Range();
-        range.setUserList(JSONUtil.parseArray(corpCustomerAcquisitionLink.getUserList()).toList(String.class));
+        String userList = corpCustomerAcquisitionLink.getUserList();
+        //值班客服
+        List<String> followIds = sysCorpServiceRelateService.getFollowIdsByRelateIds(Jsons.parseList(userList, Integer.class));
+        range.setUserList(followIds);
         wxCpLinkUpd.setRange(range);
 
         WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionUpdateLink(null, wxCpLinkUpd);

+ 11 - 6
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquistionServiceImpl.java

@@ -2,7 +2,6 @@ package com.cyksj.service.corp.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.snowflake.Sequence;
 import com.cyksj.common.util.Jsons;
@@ -16,6 +15,7 @@ import com.cyksj.redis.RedisService;
 import com.cyksj.service.corp.CorpCustomerAcquistionService;
 import com.cyksj.service.corp.WxCorpOps;
 import com.cyksj.service.sys.SysConfigService;
+import com.cyksj.service.sys.SysCorpServiceRelateService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -45,6 +45,8 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
 
     private final SysConfigService sysConfigService;
 
+    private final SysCorpServiceRelateService sysCorpServiceRelateService;
+
     private final WxCorpOps corpOps;
 
 
@@ -94,9 +96,9 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
         if (corpCustomerAcquisitionLink.getIsDuty()) {
             String userList = corpCustomerAcquisitionLink.getUserList();
 
-            List<String> users = Jsons.parseList(userList, String.class);
+            List<Integer> users = Jsons.parseList(userList, Integer.class);
             if (users.size() > 1) {
-                List<String> dutyServices = sysConfigService.getDutyServices();
+                List<Integer> dutyServices = sysConfigService.getDutyServices();
                 //值班
                 if (CollUtil.isNotEmpty(dutyServices)) {
 
@@ -104,9 +106,9 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
                     if (chooseDutyUsers == null) {
                         chooseDutyUsers = userList;
                     }
-                    List<String> chooseUserList = Jsons.parseList(chooseDutyUsers, String.class);
+                    List<Integer> chooseUserList = Jsons.parseList(chooseDutyUsers, Integer.class);
 
-                    Set<String> fitUsers = dutyServices.stream().filter(e -> users.contains(e)).collect(Collectors.toSet());
+                    Set<Integer> fitUsers = dutyServices.stream().filter(e -> users.contains(e)).collect(Collectors.toSet());
                     if (CollUtil.isNotEmpty(fitUsers) && (fitUsers.size() != chooseUserList.size() || !chooseUserList.containsAll(fitUsers))) {
 
                         corpCustomerAcquisitionLink.setChooseDutyUsers(Jsons.toJson(fitUsers));
@@ -117,7 +119,10 @@ public class CorpCustomerAcquistionServiceImpl implements CorpCustomerAcquistion
                         wxCpLinkUpd.setLinkId(corpCustomerAcquisitionLink.getLinkId());
                         wxCpLinkUpd.setSkipVerify(corpCustomerAcquisitionLink.getSkipVerify());
                         Range range = new Range();
-                        range.setUserList(JSONUtil.parseArray(corpCustomerAcquisitionLink.getChooseDutyUsers()).toList(String.class));
+                        List<Integer> userIndxList = Jsons.parseList(corpCustomerAcquisitionLink.getChooseDutyUsers(), Integer.class);
+                        List<String> followIds = sysCorpServiceRelateService.getFollowIdsByRelateIds(userIndxList);
+
+                        range.setUserList(followIds);
                         wxCpLinkUpd.setRange(range);
                         corpOps.customerAcquisitionUpdateLink(null, wxCpLinkUpd);
 

+ 13 - 7
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowActiveCodeFrontServiceImpl.java

@@ -91,19 +91,19 @@ public class CorpFollowActiveCodeFrontServiceImpl implements CorpFollowActiveCod
 		if (activeCodeDtos.size() == 1) {
 			return activeCodeDtos.get(0).getQrCode();
 		}
-		List<String> dutyServices = sysConfigService.getDutyServices();
-		String chooseFollowId = null;
+		List<Integer> dutyServices = sysConfigService.getDutyServices();
+		Integer chooseFollowId = null;
 		//值班
 		if (CollUtil.isNotEmpty(dutyServices)) {
-			List<String> collectFollow = new ArrayList<>();
+			List<Integer> collectFollow = new ArrayList<>();
 			activeCodeDtos.stream().forEach(e -> {
 				try {
-					collectFollow.addAll(JSONUtil.parseArray(e.getFollowIds()).toList(String.class));
+					collectFollow.addAll(JSONUtil.parseArray(e.getUserIndxList()).toList(Integer.class));
 				} catch (Exception ex) {
 					System.out.println(ex.getMessage());
 				}
 			});
-			List<String> collect = dutyServices.stream().filter(fid -> collectFollow.contains(fid)).collect(Collectors.toList());
+			List<Integer> collect = dutyServices.stream().filter(fid -> collectFollow.contains(fid)).collect(Collectors.toList());
 			if (CollUtil.isNotEmpty(collect)) {
 				chooseFollowId = collect.get(RandomUtil.randomInt(collect.size()));
 			}
@@ -112,8 +112,14 @@ public class CorpFollowActiveCodeFrontServiceImpl implements CorpFollowActiveCod
 		CorpFollowActiveCodeDto activeCodeDto = null;
 		if (chooseFollowId != null) {
 			log.info("寻找合适值班客服:{}", chooseFollowId);
-			final String csFollowId = chooseFollowId;
-			activeCodeDto = activeCodeDtos.stream().filter(active -> active.getFollowIds().contains(csFollowId)).findFirst().get();
+			final Integer csFollowId = chooseFollowId;
+			activeCodeDto = activeCodeDtos.stream().filter(active -> {
+				try {
+					return Jsons.parseList(active.getUserIndxList(), Integer.class).contains(csFollowId);
+				} catch (Exception e) {
+				}
+				return false;
+			}).findFirst().get();
 		}
 
 		if (activeCodeDto == null) {

+ 5 - 4
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowDynamicConfigServiceImpl.java

@@ -62,7 +62,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 	}
 
 	@Override
-	public String createCorpFollowActiveCode(List<String> followIds, String state, Boolean isDuty) throws Exception {
+	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"));
@@ -84,7 +84,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 			if (StrUtil.isEmpty(serviceNames)) {
 				throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
 			}
-			CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(followIds, state, type, serviceNames);
+			CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(followIds, userIndxList, state, type, serviceNames);
 			codeList.add(corpFollowActiveCodeDto);
 		} else {
 			Map<String, List<CorpFollowServiceDto>> csMap = null;
@@ -95,7 +95,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 				throw BusinessRuntimeException.getInstance("存在被删除的客服,请刷新页面重试");
 			}
 			for (String followId : followIds) {
-				CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), state, type, csMap.get(followId).get(0).getName());
+				CorpFollowActiveCodeDto corpFollowActiveCodeDto = createCorpFollowActiveCode(List.of(followId), userIndxList, state, type, csMap.get(followId).get(0).getName());
 				codeList.add(corpFollowActiveCodeDto);
 			}
 		}
@@ -117,7 +117,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 		}
 	}
 
-	public CorpFollowActiveCodeDto createCorpFollowActiveCode(List<String> followIds, String state, Integer type, String serviceName) throws Exception {
+	public CorpFollowActiveCodeDto createCorpFollowActiveCode(List<String> followIds, List<Integer> userIndxList, String state, Integer type, String serviceName) throws Exception {
 		CorpFollowContact c = new CorpFollowContact();
 		c.setType(type);
 		c.setScene(2);
@@ -131,6 +131,7 @@ public class CorpFollowDynamicConfigServiceImpl implements CorpFollowDynamicConf
 		String configId = jsonObject.getStr("config_id");
 		CorpFollowActiveCodeDto corpFollowActiveCodeDto = new CorpFollowActiveCodeDto();
 		corpFollowActiveCodeDto.setFollowIds(followIds.toString());
+		corpFollowActiveCodeDto.setUserIndxList(userIndxList.toString());
 		corpFollowActiveCodeDto.setServiceNames(serviceName);
 		corpFollowActiveCodeDto.setQrCode(qrCode);
 		corpFollowActiveCodeDto.setConfigId(configId);

+ 18 - 12
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowServiceImpl.java

@@ -19,6 +19,7 @@ import com.cyksj.service.corp.CorpFollowDynamicConfigService;
 import com.cyksj.service.corp.CorpFollowService;
 import com.cyksj.service.corp.WxCorpOps;
 import com.cyksj.service.mange.cms.CmsUserManager;
+import com.cyksj.service.sys.SysCorpServiceRelateService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
@@ -51,6 +52,8 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 
 	private final RedisService redisService;
 
+	private final SysCorpServiceRelateService sysCorpServiceRelateService;
+
 	@Override
 	@Transactional(rollbackFor = Throwable.class)
 	public void postActiveCode(Long adminId, CorpFollowActiveCode activeCode) throws Exception {
@@ -59,11 +62,13 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 			activeCode.setOperator(cmsUser.getNickname());
 		}
 		Boolean isDuty = Optional.ofNullable(activeCode.getIsDuty()).orElse(false);
-		List<String> followIds = activeCode.getFollowIds();
-		if (CollUtil.isEmpty(followIds)) {
+		List<Integer> userIndxList = activeCode.getUserIndxList();
+
+		if (CollUtil.isEmpty(userIndxList)) {
 			throw BusinessRuntimeException.getInstance("请选择对应客服");
 		}
-		activeCode.setFollowStr(Jsons.toJson(followIds));
+		activeCode.setFollowStr(Jsons.toJson(userIndxList));
+		List<String> followStrList = sysCorpServiceRelateService.getFollowIdsByRelateIds(userIndxList);
 		activeCode.setMarkTag(activeCode.getMarkTag().trim());
 		String text = activeCode.getText();
 		if (StrUtil.isNotBlank(text) && text.length() > 4000) {
@@ -83,9 +88,9 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 		}
 		if (!isDuty) {
 			//生成一个活码 一个客服或多个客服
-			codeStr = corpFollowDynamicConfigService.createCorpFollowActiveCode(followIds, Constant.AC_CODE_KEY + activeCode.getId(), isDuty);
+			codeStr = corpFollowDynamicConfigService.createCorpFollowActiveCode(followStrList, userIndxList, Constant.AC_CODE_KEY + activeCode.getId(), isDuty);
 		} else {
-			codeStr = corpFollowDynamicConfigService.createCorpFollowActiveCode(followIds, Constant.AC_CODE_KEY + activeCode.getId(), isDuty);
+			codeStr = corpFollowDynamicConfigService.createCorpFollowActiveCode(followStrList, userIndxList, Constant.AC_CODE_KEY + activeCode.getId(), isDuty);
 		}
 		activeCode.setCodeStr(codeStr);
 		corpFollowActiveCodeMapper.updateById(activeCode);
@@ -102,22 +107,23 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 			throw BusinessRuntimeException.getInstance("对应的数据已不存在");
 		}
 		String db_followStr = dbActiveCode.getFollowStr();
-		List<String> up_corpFollows = activeCode.getFollowIds();
-		if (CollUtil.isEmpty(up_corpFollows)) {
+		List<Integer> upUserIndxList = activeCode.getUserIndxList();
+		if (CollUtil.isEmpty(upUserIndxList)) {
 			throw BusinessRuntimeException.getInstance("请选择对应客服");
 		}
-		activeCode.setFollowStr(Jsons.toJson(up_corpFollows));
+		activeCode.setFollowStr(Jsons.toJson(upUserIndxList));
+		List<String> up_followStrList = sysCorpServiceRelateService.getFollowIdsByRelateIds(upUserIndxList);
 		if (StrUtil.isEmpty(activeCode.getMarkTag())) {
 			throw BusinessRuntimeException.getInstance("请输入标签");
 		}
-		List<String> db_followIds = Jsons.parseList(db_followStr, String.class);
+		List<Integer> db_followIds = Jsons.parseList(db_followStr, Integer.class);
 		Boolean isReCreateAcCode = false;
 		Boolean isUpdateAcCode = false;
-		if (db_followIds.size() != up_corpFollows.size()) {
+		if (db_followIds.size() != upUserIndxList.size()) {
 			isReCreateAcCode = true;
 		}
 		if (!isReCreateAcCode) {
-			for (String upFollowId : up_corpFollows) {
+			for (Integer upFollowId : upUserIndxList) {
 				if (!db_followIds.contains(upFollowId)) {
 					isReCreateAcCode = true;
 					break;
@@ -143,7 +149,7 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 
 		//重新构建活码配置
 		if (isReCreateAcCode) {
-			String code_str = corpFollowDynamicConfigService.createCorpFollowActiveCode(up_corpFollows, Constant.AC_CODE_KEY + activeCode.getId(), up_isDuty);
+			String code_str = corpFollowDynamicConfigService.createCorpFollowActiveCode(up_followStrList, upUserIndxList, Constant.AC_CODE_KEY + activeCode.getId(), up_isDuty);
 			activeCode.setCodeStr(code_str);
 			Set<String> keys = redisService.keys(RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getNameFormat(activeCode.getId(), "*"));
 			redisService.del(keys.toArray(String[]::new));

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/sys/SysConfigService.java

@@ -17,5 +17,5 @@ public interface SysConfigService extends IService<SysConfig> {
 	 */
 	String getDefaultShopConfigByType(String type);
 
-	List<String> getDutyServices() throws Exception;
+	List<Integer> getDutyServices() throws Exception;
 }

+ 22 - 0
netflix-service/src/main/java/com/cyksj/service/sys/SysCorpServiceRelateService.java

@@ -0,0 +1,22 @@
+package com.cyksj.service.sys;
+
+import com.cyksj.model.dto.CorpFollowServiceDto;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: SysCorpServiceRelateService
+ * 创建者: JavaZou
+ * 创建时间:2024/1/11 12:07
+ */
+public interface SysCorpServiceRelateService {
+
+	List<String> getFollowIdsByRelateIds(List<Integer> indxIds) throws Exception;
+
+	/**
+	 * 获取客服对照关系
+	 */
+	Map<Integer, List<CorpFollowServiceDto>> getCorpYhFollowService() throws Exception;
+}

+ 7 - 7
netflix-service/src/main/java/com/cyksj/service/sys/impl/SysConfigServiceImpl.java

@@ -6,9 +6,11 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cyksj.common.constant.Constant;
+import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.service.CropDutyServiceDateService;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.mapper.sys.SysConfigMapper;
+import com.cyksj.model.dto.CorpFollowServiceDto;
 import com.cyksj.model.dto.DefaultShopConfig;
 import com.cyksj.model.dto.YhServiceDto;
 import com.cyksj.model.entity.ShopConfig;
@@ -61,7 +63,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper,SysConfig>
 
 
 	@Override
-	public List<String> getDutyServices() throws Exception {
+	public List<Integer> getDutyServices() throws Exception {
 		SysConfig sysConfig = this.getOne(Wrappers.lambdaQuery(SysConfig.class)
 				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(0))
 				.last("limit 1"));
@@ -91,13 +93,11 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper,SysConfig>
 			}
 		}
 		LocalDateTime now = LocalDateTime.now();
-		List<String> dutyServices = getDutyServices(workdayServices, saturdayServices, sundayServices, holidayDateMap, now);
+		List<Integer> dutyServices = getDutyServices(workdayServices, saturdayServices, sundayServices, holidayDateMap, now);
 		return dutyServices;
 	}
 
-
-
-	public List<String> getDutyServices(List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday, Map<String, List<YhServiceDto>> holidayDateMap, LocalDateTime now) {
+	public List<Integer> getDutyServices(List<YhServiceDto> workday, List<YhServiceDto> saturday, List<YhServiceDto> sunday, Map<String, List<YhServiceDto>> holidayDateMap, LocalDateTime now) {
 		if (CollUtil.isNotEmpty(workday)) {
 			DayOfWeek currentDayOfWeek = now.getDayOfWeek();
 
@@ -105,9 +105,9 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper,SysConfig>
 			//获取值班客服
 			List<YhServiceDto> dutyServiceCodes = getTimeDutyServices(carryServices, workday, saturday, sunday, holidayDateMap, currentDayOfWeek, now);
 			if (CollUtil.isNotEmpty(dutyServiceCodes)) {
-				Set<String> collectFollow = new HashSet<>();
+				Set<Integer> collectFollow = new HashSet<>();
 				for (YhServiceDto dutyServiceCode : dutyServiceCodes) {
-					dutyServiceCode.getSelect().stream().filter(e -> StrUtil.isNotBlank(e.getFollowId())).forEach(cs -> collectFollow.add(cs.getFollowId()));
+					dutyServiceCode.getSelect().stream().filter(e -> StrUtil.isNotBlank(e.getFollowId())).forEach(cs -> collectFollow.add(cs.getIndex()));
 				}
 				return new ArrayList<>(collectFollow);
 			}

+ 60 - 0
netflix-service/src/main/java/com/cyksj/service/sys/impl/SysCorpServiceRelateServiceImpl.java

@@ -0,0 +1,60 @@
+package com.cyksj.service.sys.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+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.model.dto.CorpFollowServiceDto;
+import com.cyksj.model.entity.SysConfig;
+import com.cyksj.service.sys.SysCorpServiceRelateService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: SysCorpServiceRelateServiceImpl
+ * 创建者: JavaZou
+ * 创建时间:2024/1/11 12:07
+ */
+@Service
+@RequiredArgsConstructor
+public class SysCorpServiceRelateServiceImpl implements SysCorpServiceRelateService {
+	private final SysConfigMapper sysConfigMapper;
+
+
+	@Override
+	public List<String> getFollowIdsByRelateIds(List<Integer> indxIds) throws Exception {
+		//值班客服
+		Map<Integer, List<CorpFollowServiceDto>> corpYhFollowService = this.getCorpYhFollowService();
+		List<String> followIds = new ArrayList<>();
+		indxIds.forEach(indx -> {
+			List<CorpFollowServiceDto> corpFollowServiceDtos = corpYhFollowService.get(indx);
+			if (CollUtil.isEmpty(corpFollowServiceDtos)) {
+				throw BusinessRuntimeException.getInstance("存在被删除的值班客服");
+			}
+			followIds.add(corpFollowServiceDtos.get(0).getFollowId());
+		});
+		return followIds;
+	}
+
+
+	@Override
+	public Map<Integer, List<CorpFollowServiceDto>> getCorpYhFollowService() throws Exception {
+		SysConfig config = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.serviceKeys.get(1)).last("limit 1"));
+		if (config == null || StrUtil.isEmpty(config.getSysValue())) {
+			throw BusinessRuntimeException.getInstance("未配置对应系统值班客服");
+		}
+		String sysValue = config.getSysValue();
+		List<CorpFollowServiceDto> corpFollowServiceDtos = Jsons.parseList(sysValue, CorpFollowServiceDto.class);
+		return corpFollowServiceDtos.stream().collect(Collectors.groupingBy(CorpFollowServiceDto::getIndx));
+	}
+}

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

@@ -88,11 +88,23 @@ public class CorpCustomerAcquistionLinkController {
 
         search.getDataList().forEach(e->{
             try {
-                List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> e.getUserList().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+                List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> {
+                    try {
+                        return Jsons.parseList(e.getUserList(), Integer.class).contains(cf.getIndx());
+                    } catch (Exception ex) {
+                    }
+                    return false;
+                }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
                 e.setUserStrList(userStrList);
 
                 if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
-                    List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> e.getChooseDutyUsers().contains(cf.getFollowId())).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
+                    List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> {
+                        try {
+                            return Jsons.parseList(e.getChooseDutyUsers(), Integer.class).contains(cf.getIndx());
+                        } catch (Exception ex) {
+                        }
+                        return false;
+                    }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
 
                     e.setChooseDutyUserList(dutyUserList);
                 }