|
@@ -1,5 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.customer.controller.admin.businessopportunity;
|
|
|
|
|
|
+import cn.iocoder.yudao.module.customer.controller.admin.info.vo.CustomerInfoRespVO;
|
|
|
+import cn.iocoder.yudao.module.customer.service.info.CustomerInfoService;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
@@ -43,6 +45,8 @@ public class CustomerBusinessOpportunityController {
|
|
|
private CustomerBusinessOpportunityService businessOpportunityService;
|
|
|
@Resource
|
|
|
private DeptApi deptApi;
|
|
|
+ @Resource
|
|
|
+ private CustomerInfoService customerInfoService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建客户商机")
|
|
@@ -87,11 +91,17 @@ public class CustomerBusinessOpportunityController {
|
|
|
// 部门
|
|
|
if (respVO.getDeptId() != null) {
|
|
|
DeptRespDTO dept = deptApi.getDept(respVO.getDeptId());
|
|
|
- respVO.setDeptName(dept.getName());
|
|
|
if (dept != null && StringUtils.isNotBlank(dept.getName())) {
|
|
|
respVO.setDeptName(dept.getName());
|
|
|
}
|
|
|
}
|
|
|
+ // 客户
|
|
|
+ if (respVO.getCustomerId() != null) {
|
|
|
+ CustomerInfoRespVO infoRespVO = customerInfoService.getById(respVO.getCustomerId());
|
|
|
+ if (infoRespVO != null && StringUtils.isNotBlank(infoRespVO.getCustomerName())) {
|
|
|
+ respVO.setCustomerName(infoRespVO.getCustomerName());
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
return success(result);
|
|
@@ -105,9 +115,29 @@ public class CustomerBusinessOpportunityController {
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<CustomerBusinessOpportunityDO> list = businessOpportunityService.getBusinessOpportunityPage(pageReqVO).getList();
|
|
|
+ List<CustomerBusinessOpportunityRespVO> result = BeanUtils.toBean(list, CustomerBusinessOpportunityRespVO.class);
|
|
|
+ if (result != null && result.size() > 0) {
|
|
|
+ result.forEach(respVO -> {
|
|
|
+ // 部门
|
|
|
+ if (respVO.getDeptId() != null) {
|
|
|
+ DeptRespDTO dept = deptApi.getDept(respVO.getDeptId());
|
|
|
+ if (dept != null && StringUtils.isNotBlank(dept.getName())) {
|
|
|
+ respVO.setDeptName(dept.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 客户
|
|
|
+ if (respVO.getCustomerId() != null) {
|
|
|
+ CustomerInfoRespVO infoRespVO = customerInfoService.getById(respVO.getCustomerId());
|
|
|
+ if (infoRespVO != null && StringUtils.isNotBlank(infoRespVO.getCustomerName())) {
|
|
|
+ respVO.setCustomerName(infoRespVO.getCustomerName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 导出 Excel
|
|
|
ExcelUtils.write(response, "客户商机.xls", "数据", CustomerBusinessOpportunityRespVO.class,
|
|
|
- BeanUtils.toBean(list, CustomerBusinessOpportunityRespVO.class));
|
|
|
+ result);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getOpportunityCode")
|