|
@@ -2,17 +2,17 @@ package com.cyksj.web.controller.manage.corp;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.cyksj.common.constant.Constant;
|
|
|
|
|
import com.cyksj.common.util.Jsons;
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
|
|
+import com.cyksj.mapper.SysCorpFollowRelateMapper;
|
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkExtraCustomerMapper;
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkExtraCustomerMapper;
|
|
|
import com.cyksj.mapper.corp.CorpFollowMapper;
|
|
import com.cyksj.mapper.corp.CorpFollowMapper;
|
|
|
import com.cyksj.mapper.corp.CorpTagMapper;
|
|
import com.cyksj.mapper.corp.CorpTagMapper;
|
|
|
import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
|
|
import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
|
|
|
-import com.cyksj.model.dto.CorpFollowServiceDto;
|
|
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.views.CorpCustomerAcquisitionLinkExtraCustomerView;
|
|
import com.cyksj.model.views.CorpCustomerAcquisitionLinkExtraCustomerView;
|
|
|
|
|
+import com.cyksj.model.views.SysCorpFollowView;
|
|
|
import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
|
|
import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
|
|
|
import com.cyksj.service.sys.SysConfigService;
|
|
import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
@@ -54,6 +54,8 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
|
|
|
|
|
private final CorpCustomerAcquisitionLinkExtraCustomerMapper corpCustomerAcquisitionLinkExtraCustomerMapper;
|
|
private final CorpCustomerAcquisitionLinkExtraCustomerMapper corpCustomerAcquisitionLinkExtraCustomerMapper;
|
|
|
|
|
|
|
|
|
|
+ private final SysCorpFollowRelateMapper sysCorpFollowRelateMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增获客助手链接
|
|
* 新增获客助手链接
|
|
|
*/
|
|
*/
|
|
@@ -89,35 +91,33 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
public Result<SearchResult<CorpCustomerAcquisitionLink>> get() throws Exception {
|
|
public Result<SearchResult<CorpCustomerAcquisitionLink>> get() throws Exception {
|
|
|
SearchResult<CorpCustomerAcquisitionLink> search = beanSearcher.search(CorpCustomerAcquisitionLink.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
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<SysCorpFollowView> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowView.class, MapUtils.builder().build());
|
|
|
|
|
|
|
|
- search.getDataList().forEach(e->{
|
|
|
|
|
|
|
+ search.getDataList().forEach(e -> {
|
|
|
try {
|
|
try {
|
|
|
List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> {
|
|
List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> {
|
|
|
try {
|
|
try {
|
|
|
- return Jsons.parseList(e.getUserList(), Integer.class).contains(cf.getIndx());
|
|
|
|
|
|
|
+ return Jsons.parseList(e.getUserList(), Long.class).contains(cf.getSid());
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
- }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
|
|
|
|
|
|
|
+ }).map(SysCorpFollowView::getShowName).collect(Collectors.toList());
|
|
|
e.setUserStrList(userStrList);
|
|
e.setUserStrList(userStrList);
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
|
|
if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
|
|
|
List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> {
|
|
List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> {
|
|
|
try {
|
|
try {
|
|
|
- return Jsons.parseList(e.getChooseDutyUsers(), Integer.class).contains(cf.getIndx());
|
|
|
|
|
|
|
+ return Jsons.parseList(e.getChooseDutyUsers(), Long.class).contains(cf.getSid());
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
- }).map(CorpFollowServiceDto::getName).collect(Collectors.toList());
|
|
|
|
|
|
|
+ }).map(SysCorpFollowView::getShowName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
e.setChooseDutyUserList(dutyUserList);
|
|
e.setChooseDutyUserList(dutyUserList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<String> tagStrList = corpTagMapper.selectList(Wrappers.lambdaQuery(CorpTag.class)
|
|
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);
|
|
e.setTagStrList(tagStrList);
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
}
|
|
}
|
|
@@ -135,7 +135,10 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/add/extra/service")
|
|
@PostMapping("/add/extra/service")
|
|
|
public Result<String> addExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
|
|
public Result<String> addExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
|
|
|
- corpCustomerAcquisitionLinkExtraCustomerMapper.insert(extraCustomer);
|
|
|
|
|
|
|
+ Integer serviceId = extraCustomer.getServiceId();
|
|
|
|
|
+ SysCorpFollowRelate sysCorpFollowRelate = sysCorpFollowRelateMapper.selectById(serviceId);
|
|
|
|
|
+ extraCustomer.setFollowId(sysCorpFollowRelate.getFollowId());
|
|
|
|
|
+ corpCustomerAcquisitionLinkExtraCustomerMapper.insert(extraCustomer);
|
|
|
corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
|
|
corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
@@ -145,6 +148,9 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
*/
|
|
*/
|
|
|
@PutMapping("/update/extra/service")
|
|
@PutMapping("/update/extra/service")
|
|
|
public Result<String> updateExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
|
|
public Result<String> updateExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
|
|
|
|
|
+ Integer serviceId = extraCustomer.getServiceId();
|
|
|
|
|
+ SysCorpFollowRelate sysCorpFollowRelate = sysCorpFollowRelateMapper.selectById(serviceId);
|
|
|
|
|
+ extraCustomer.setFollowId(sysCorpFollowRelate.getFollowId());
|
|
|
corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(extraCustomer);
|
|
corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(extraCustomer);
|
|
|
corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
|
|
corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
@@ -178,12 +184,11 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
.orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getAcId).asc()
|
|
.orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getAcId).asc()
|
|
|
.orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getCreatedTime).desc()
|
|
.orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getCreatedTime).desc()
|
|
|
.build());
|
|
.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<SysCorpFollowView> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowView.class, MapUtils.builder().build());
|
|
|
|
|
+ Map<Long, List<SysCorpFollowView>> serviceMap = corpFollowServiceDtos.stream().collect(Collectors.groupingBy(SysCorpFollowView::getSid));
|
|
|
search.getDataList().forEach(e->{
|
|
search.getDataList().forEach(e->{
|
|
|
Optional.ofNullable(serviceMap.get(e.getServiceId()))
|
|
Optional.ofNullable(serviceMap.get(e.getServiceId()))
|
|
|
- .ifPresent(service -> e.setServiceName(service.get(0).getName()));
|
|
|
|
|
|
|
+ .ifPresent(service -> e.setServiceName(service.get(0).getShowName()));
|
|
|
});
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
}
|