Commit 0bbc06f3 authored by lcl's avatar lcl

增加客户认领接口

parent b31f6a98
...@@ -16,7 +16,6 @@ import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto; ...@@ -16,7 +16,6 @@ import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import com.dsk.system.domain.customer.dto.CustomerSearchDto; import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerService; import com.dsk.system.service.ICustomerService;
import com.dsk.web.controller.search.service.BusinessOpportunityRadarService; import com.dsk.web.controller.search.service.BusinessOpportunityRadarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -68,6 +67,23 @@ public class CustomerController extends BaseController { ...@@ -68,6 +67,23 @@ public class CustomerController extends BaseController {
@PostMapping() @PostMapping()
@RepeatSubmit @RepeatSubmit
public AjaxResult add(@RequestBody Customer customer) { 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.getCompanyName())) throw new BeanException("企业名称不能为空");
if (ObjectUtils.isEmpty(customer.getCompanyId())) { if (ObjectUtils.isEmpty(customer.getCompanyId())) {
try { try {
...@@ -79,7 +95,6 @@ public class CustomerController extends BaseController { ...@@ -79,7 +95,6 @@ public class CustomerController extends BaseController {
logger.debug("获取企业id错误!error:{}", e.getMessage()); logger.debug("获取企业id错误!error:{}", e.getMessage());
} }
} }
return AjaxResult.success(baseService.add(customer));
} }
/** /**
......
...@@ -76,6 +76,7 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -76,6 +76,7 @@ public class CustomerServiceImpl implements ICustomerService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean add(Customer customer) { public boolean add(Customer customer) {
if (ObjectUtils.isEmpty(customer.getUipId())) {
try { try {
R res = enterpriseService.getUipId(customer.getCompanyName()); R res = enterpriseService.getUipId(customer.getCompanyName());
if (!ObjectUtils.isEmpty(res.getData())) { if (!ObjectUtils.isEmpty(res.getData())) {
...@@ -84,7 +85,7 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -84,7 +85,7 @@ public class CustomerServiceImpl implements ICustomerService {
} catch (Exception e) { } catch (Exception e) {
log.error("获取城投平台企业id错误!error:{}", e.getMessage()); log.error("获取城投平台企业id错误!error:{}", e.getMessage());
} }
}
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
customer.setCreateId(userId); customer.setCreateId(userId);
customer.setUpdateId(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