Commit 0bbc06f3 authored by lcl's avatar lcl

增加客户认领接口

parent b31f6a98
......@@ -16,7 +16,6 @@ import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerService;
import com.dsk.web.controller.search.service.BusinessOpportunityRadarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils;
......@@ -68,6 +67,23 @@ public class CustomerController extends BaseController {
@PostMapping()
@RepeatSubmit
public AjaxResult add(@RequestBody Customer customer) {
dealWithcustomerData(customer);
return AjaxResult.success(baseService.add(customer));
}
/**
* 认领客户
*/
// @PreAuthorize("@ss.hasPermi('customer:claim')")
@PostMapping("/claim")
@RepeatSubmit
public AjaxResult claim(@RequestBody Customer customer) {
if (ObjectUtils.isEmpty(customer.getUipId())) throw new BeanException("城投uipId不能为空");
dealWithcustomerData(customer);
return AjaxResult.success(baseService.add(customer));
}
private void dealWithcustomerData(Customer customer){
if (ObjectUtils.isEmpty(customer.getCompanyName())) throw new BeanException("企业名称不能为空");
if (ObjectUtils.isEmpty(customer.getCompanyId())) {
try {
......@@ -79,7 +95,6 @@ public class CustomerController extends BaseController {
logger.debug("获取企业id错误!error:{}", e.getMessage());
}
}
return AjaxResult.success(baseService.add(customer));
}
/**
......
......@@ -76,15 +76,16 @@ public class CustomerServiceImpl implements ICustomerService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(Customer customer) {
try {
R res = enterpriseService.getUipId(customer.getCompanyName());
if (!ObjectUtils.isEmpty(res.getData())) {
customer.setUipId(MapUtil.getStr(BeanUtil.beanToMap(res.getData()), "uipId"));
if (ObjectUtils.isEmpty(customer.getUipId())) {
try {
R res = enterpriseService.getUipId(customer.getCompanyName());
if (!ObjectUtils.isEmpty(res.getData())) {
customer.setUipId(MapUtil.getStr(BeanUtil.beanToMap(res.getData()), "uipId"));
}
} catch (Exception e) {
log.error("获取城投平台企业id错误!error:{}", e.getMessage());
}
} catch (Exception e) {
log.error("获取城投平台企业id错误!error:{}", e.getMessage());
}
Long userId = SecurityUtils.getUserId();
customer.setCreateId(userId);
customer.setUpdateId(userId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment