|
|
@@ -13,9 +13,7 @@ import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
|
|
|
import com.cyksj.mapper.corp.CorpFollowActiveCodeMapper;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
import com.cyksj.mapper.sys.SysConfigChangeRecordMapper;
|
|
|
-import com.cyksj.model.dto.YhServiceChangeDto;
|
|
|
-import com.cyksj.model.dto.YhServiceDto;
|
|
|
-import com.cyksj.model.dto.YhServiceNameDto;
|
|
|
+import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.CmsUser;
|
|
|
import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
|
|
|
import com.cyksj.model.entity.CorpFollowActiveCode;
|
|
|
@@ -35,7 +33,10 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.DayOfWeek;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -66,11 +67,12 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
private final WxCorpOps corpOps;
|
|
|
|
|
|
@Override
|
|
|
- public Boolean changeRecord(Long adminId, String sysKey, String sysValue, String updateValue) throws Exception {
|
|
|
+ public SysServiceChangeDto changeRecord(Long adminId, String sysKey, String sysValue, String updateValue) throws Exception {
|
|
|
CmsUser cmsUser = cmsUserMapper.selectById(adminId);
|
|
|
if (cmsUser == null) {
|
|
|
throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
}
|
|
|
+ SysServiceChangeDto sysServiceChangeDto = new SysServiceChangeDto();
|
|
|
//保存客服系统配置key前后更新数据
|
|
|
if (Constant.serviceKeys.contains(sysKey)) {
|
|
|
if (!StrUtil.equals(sysValue, updateValue)) {
|
|
|
@@ -130,6 +132,7 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
SmsUtil.sendLuoKey2Msg(Constant.DUTY_SERVICE_CHANGE_NOTIFY_PHONE, String.format(Constant.DUTY_SERVICE_CHANGE_MSG, weekdayMsgNotifySb));
|
|
|
}
|
|
|
}
|
|
|
+ sysServiceChangeDto.setChangeCsImg(true);
|
|
|
} else {
|
|
|
List<YhServiceNameDto> before = Jsons.parseList(sysValue, YhServiceNameDto.class);
|
|
|
Map<Integer, List<YhServiceNameDto>> afterIndxMap = Jsons.parseList(updateValue, YhServiceNameDto.class).stream().collect(Collectors.groupingBy(YhServiceNameDto::getIndx));
|
|
|
@@ -142,15 +145,15 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ if (CollUtil.isNotEmpty(updateFollowIndxList)) {
|
|
|
+ sysServiceChangeDto.setChangeCsName(true);
|
|
|
+ sysServiceChangeDto.setUpdateFollowIndxs(updateFollowIndxList);
|
|
|
+ }
|
|
|
}
|
|
|
this.save(sysConfigChangeRecord);
|
|
|
- if (CollUtil.isNotEmpty(updateFollowIndxList)) {
|
|
|
- updateCorpFollowLinkConfig(updateFollowIndxList);
|
|
|
- }
|
|
|
- return true;
|
|
|
}
|
|
|
}
|
|
|
- return false;
|
|
|
+ return sysServiceChangeDto;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -192,13 +195,15 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public void updateCorpFollowLinkConfig(List<Integer> updateFollowIndx) throws Exception {
|
|
|
List<CorpFollowActiveCode> corpFollowActiveCodes = corpFollowActiveCodeMapper.selectActiveCodeByFollowIndx(updateFollowIndx);
|
|
|
+ Map<Integer, List<CorpFollowServiceDto>> corpYhFollowService = sysCorpServiceRelateService.getCorpYhFollowService();
|
|
|
//去更新活码对应客服 成员id
|
|
|
corpFollowActiveCodes.forEach(data -> {
|
|
|
try {
|
|
|
List<Integer> upUserIndxList = Jsons.parseList(data.getFollowStr(), Integer.class);
|
|
|
- List<String> up_followStrList = sysCorpServiceRelateService.getFollowIdsByRelateIds(Jsons.parseList(data.getFollowStr(), Integer.class));
|
|
|
+ List<String> up_followStrList = getFollowIdsByIndxIds(corpYhFollowService, upUserIndxList);
|
|
|
String code_str = corpFollowDynamicConfigService.createCorpFollowActiveCode(up_followStrList, upUserIndxList, Constant.AC_CODE_KEY + data.getId(), data.getIsDuty());
|
|
|
data.setCodeStr(code_str);
|
|
|
Set<String> keys = redisService.keys(RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getNameFormat(data.getId(), "*"));
|
|
|
@@ -222,7 +227,7 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
//值班客服
|
|
|
String userList = link.getUserList();
|
|
|
|
|
|
- List<String> followIds = sysCorpServiceRelateService.getFollowIdsByRelateIds(Jsons.parseList(userList, Integer.class));
|
|
|
+ List<String> followIds = getFollowIdsByIndxIds(corpYhFollowService, Jsons.parseList(userList, Integer.class));
|
|
|
range.setUserList(followIds);
|
|
|
wxCpLinkUpd.setRange(range);
|
|
|
WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionUpdateLink(null, wxCpLinkUpd);
|
|
|
@@ -239,4 +244,15 @@ public class SysConfigChangeRecordServiceImpl extends ServiceImpl<SysConfigChang
|
|
|
XxlJobUtil.executeMarkDynamicRuleTagJob(XxlJobInfo.getExecuteTaskInstance(Constant.CORP_LINK_JOB_ID, StrUtil.EMPTY).toString());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public List<String> getFollowIdsByIndxIds(Map<Integer, List<CorpFollowServiceDto>> corpYhFollowService, List<Integer> indxIds) {
|
|
|
+ List<String> followIds = new ArrayList<>();
|
|
|
+ indxIds.forEach(indx -> {
|
|
|
+ List<CorpFollowServiceDto> corpFollowServiceDtos = corpYhFollowService.get(indx);
|
|
|
+ if (CollUtil.isNotEmpty(corpFollowServiceDtos)) {
|
|
|
+ followIds.add(corpFollowServiceDtos.get(0).getFollowId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return followIds;
|
|
|
+ }
|
|
|
}
|