|
|
@@ -6,21 +6,26 @@ 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.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;
|
|
|
import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -47,6 +52,8 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
|
|
|
private final SysConfigService sysConfigService;
|
|
|
|
|
|
+ private final CorpCustomerAcquisitionLinkExtraCustomerMapper corpCustomerAcquisitionLinkExtraCustomerMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 新增获客助手链接
|
|
|
*/
|
|
|
@@ -123,4 +130,56 @@ public class CorpCustomerAcquistionLinkController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 针对获客链接添加额外客服
|
|
|
+ */
|
|
|
+ @PostMapping("/add/extra/service")
|
|
|
+ public Result<String> addExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) {
|
|
|
+ corpCustomerAcquisitionLinkExtraCustomerMapper.insert(extraCustomer);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改获客链接添加额外客服
|
|
|
+ */
|
|
|
+ @PutMapping("/update/extra/service")
|
|
|
+ public Result<String> updateExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) {
|
|
|
+ corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(extraCustomer);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除获客链接添加额外客服
|
|
|
+ */
|
|
|
+ @DeleteMapping("/del/extra/service/{id}")
|
|
|
+ public Result<String> delExtraService(@PathVariable Long id) {
|
|
|
+ Optional.ofNullable(corpCustomerAcquisitionLinkExtraCustomerMapper.selectById(id))
|
|
|
+ .ifPresent(e -> {
|
|
|
+ if (e.getDeleted()) {
|
|
|
+ e.setDeleted(false);
|
|
|
+ corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取获客链接添加额外客服
|
|
|
+ */
|
|
|
+ @GetMapping("/get/extra/service")
|
|
|
+ public Result<SearchResult<CorpCustomerAcquisitionLinkExtraCustomerView>> getExtraService() throws Exception {
|
|
|
+ SearchResult<CorpCustomerAcquisitionLinkExtraCustomerView> search = beanSearcher.search(CorpCustomerAcquisitionLinkExtraCustomerView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .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));
|
|
|
+ search.getDataList().forEach(e->{
|
|
|
+ Optional.ofNullable(serviceMap.get(e.getServiceId()))
|
|
|
+ .ifPresent(service -> e.setServiceName(service.get(0).getName()));
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+
|
|
|
}
|