Commit 53badfc3673d97beb6ee7dafa7bdc78659e202ca
1 parent
6a63f2f0
CRM-CONTRACT: 完善合同编辑回显
Showing
10 changed files
with
70 additions
and
40 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| @@ -166,10 +166,10 @@ public class CrmBusinessController { | @@ -166,10 +166,10 @@ public class CrmBusinessController { | ||
| 166 | return CrmBusinessConvert.INSTANCE.convertPage(pageResult, customerList, statusTypeList, statusList); | 166 | return CrmBusinessConvert.INSTANCE.convertPage(pageResult, customerList, statusTypeList, statusList); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | - @PutMapping("/transfer") | 169 | + @PutMapping("/transfer-business") |
| 170 | @Operation(summary = "商机转移") | 170 | @Operation(summary = "商机转移") |
| 171 | @PreAuthorize("@ss.hasPermission('crm:business:update')") | 171 | @PreAuthorize("@ss.hasPermission('crm:business:update')") |
| 172 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmBusinessTransferReqVO reqVO) { | 172 | + public CommonResult<Boolean> transferBusiness(@Valid @RequestBody CrmBusinessTransferReqVO reqVO) { |
| 173 | businessService.transferBusiness(reqVO, getLoginUserId()); | 173 | businessService.transferBusiness(reqVO, getLoginUserId()); |
| 174 | return success(true); | 174 | return success(true); |
| 175 | } | 175 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/CrmClueController.java
| @@ -88,10 +88,10 @@ public class CrmClueController { | @@ -88,10 +88,10 @@ public class CrmClueController { | ||
| 88 | ExcelUtils.write(response, "线索.xls", "数据", CrmClueRespVO.class, datas); | 88 | ExcelUtils.write(response, "线索.xls", "数据", CrmClueRespVO.class, datas); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | - @PutMapping("/transfer") | 91 | + @PutMapping("/transfer-clue") |
| 92 | @Operation(summary = "线索转移") | 92 | @Operation(summary = "线索转移") |
| 93 | @PreAuthorize("@ss.hasPermission('crm:clue:update')") | 93 | @PreAuthorize("@ss.hasPermission('crm:clue:update')") |
| 94 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmClueTransferReqVO reqVO) { | 94 | + public CommonResult<Boolean> transferClue(@Valid @RequestBody CrmClueTransferReqVO reqVO) { |
| 95 | clueService.transferClue(reqVO, getLoginUserId()); | 95 | clueService.transferClue(reqVO, getLoginUserId()); |
| 96 | return success(true); | 96 | return success(true); |
| 97 | } | 97 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| @@ -102,7 +102,7 @@ public class CrmContactController { | @@ -102,7 +102,7 @@ public class CrmContactController { | ||
| 102 | List<CrmCustomerDO> customerList = customerService.getCustomerList( | 102 | List<CrmCustomerDO> customerList = customerService.getCustomerList( |
| 103 | Collections.singletonList(contact.getCustomerId())); | 103 | Collections.singletonList(contact.getCustomerId())); |
| 104 | // 3. 直属上级 | 104 | // 3. 直属上级 |
| 105 | - List<CrmContactDO> parentContactList = contactService.getContactList( | 105 | + List<CrmContactDO> parentContactList = contactService.getContactListByIds( |
| 106 | Collections.singletonList(contact.getParentId()), getLoginUserId()); | 106 | Collections.singletonList(contact.getParentId()), getLoginUserId()); |
| 107 | return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList)); | 107 | return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList)); |
| 108 | } | 108 | } |
| @@ -112,7 +112,7 @@ public class CrmContactController { | @@ -112,7 +112,7 @@ public class CrmContactController { | ||
| 112 | @Parameter(name = "ids", description = "编号", required = true, example = "[1024]") | 112 | @Parameter(name = "ids", description = "编号", required = true, example = "[1024]") |
| 113 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") | 113 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| 114 | public CommonResult<List<CrmContactRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) { | 114 | public CommonResult<List<CrmContactRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) { |
| 115 | - return success(BeanUtils.toBean(contactService.getContactList(ids, getLoginUserId()), CrmContactRespVO.class)); | 115 | + return success(BeanUtils.toBean(contactService.getContactListByIds(ids, getLoginUserId()), CrmContactRespVO.class)); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | @GetMapping("/simple-all-list") | 118 | @GetMapping("/simple-all-list") |
| @@ -170,15 +170,15 @@ public class CrmContactController { | @@ -170,15 +170,15 @@ public class CrmContactController { | ||
| 170 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, | 170 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, |
| 171 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); | 171 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); |
| 172 | // 3. 直属上级 | 172 | // 3. 直属上级 |
| 173 | - List<CrmContactDO> parentContactList = contactService.getContactList( | 173 | + List<CrmContactDO> parentContactList = contactService.getContactListByIds( |
| 174 | convertSet(contactList, CrmContactDO::getParentId), getLoginUserId()); | 174 | convertSet(contactList, CrmContactDO::getParentId), getLoginUserId()); |
| 175 | return CrmContactConvert.INSTANCE.convertPage(pageResult, userMap, crmCustomerDOList, parentContactList); | 175 | return CrmContactConvert.INSTANCE.convertPage(pageResult, userMap, crmCustomerDOList, parentContactList); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | - @PutMapping("/transfer") | 178 | + @PutMapping("/transfer-contact") |
| 179 | @Operation(summary = "联系人转移") | 179 | @Operation(summary = "联系人转移") |
| 180 | @PreAuthorize("@ss.hasPermission('crm:contact:update')") | 180 | @PreAuthorize("@ss.hasPermission('crm:contact:update')") |
| 181 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContactTransferReqVO reqVO) { | 181 | + public CommonResult<Boolean> transferContact(@Valid @RequestBody CrmContactTransferReqVO reqVO) { |
| 182 | contactService.transferContact(reqVO, getLoginUserId()); | 182 | contactService.transferContact(reqVO, getLoginUserId()); |
| 183 | return success(true); | 183 | return success(true); |
| 184 | } | 184 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| @@ -10,11 +10,15 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | @@ -10,11 +10,15 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 11 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; | 11 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; |
| 12 | import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; | 12 | import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | ||
| 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; |
| 15 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | ||
| 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 16 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 17 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 16 | import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | 18 | import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; |
| 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessProductService; | 19 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessProductService; |
| 20 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | ||
| 21 | +import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; | ||
| 18 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | 22 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | 23 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 20 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; | 24 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; |
| @@ -26,11 +30,13 @@ import io.swagger.v3.oas.annotations.tags.Tag; | @@ -26,11 +30,13 @@ import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 26 | import jakarta.annotation.Resource; | 30 | import jakarta.annotation.Resource; |
| 27 | import jakarta.servlet.http.HttpServletResponse; | 31 | import jakarta.servlet.http.HttpServletResponse; |
| 28 | import jakarta.validation.Valid; | 32 | import jakarta.validation.Valid; |
| 33 | +import org.springframework.context.annotation.Lazy; | ||
| 29 | import org.springframework.security.access.prepost.PreAuthorize; | 34 | import org.springframework.security.access.prepost.PreAuthorize; |
| 30 | import org.springframework.validation.annotation.Validated; | 35 | import org.springframework.validation.annotation.Validated; |
| 31 | import org.springframework.web.bind.annotation.*; | 36 | import org.springframework.web.bind.annotation.*; |
| 32 | 37 | ||
| 33 | import java.io.IOException; | 38 | import java.io.IOException; |
| 39 | +import java.util.Collections; | ||
| 34 | import java.util.List; | 40 | import java.util.List; |
| 35 | import java.util.Map; | 41 | import java.util.Map; |
| 36 | import java.util.stream.Stream; | 42 | import java.util.stream.Stream; |
| @@ -52,6 +58,11 @@ public class CrmContractController { | @@ -52,6 +58,11 @@ public class CrmContractController { | ||
| 52 | @Resource | 58 | @Resource |
| 53 | private CrmCustomerService customerService; | 59 | private CrmCustomerService customerService; |
| 54 | @Resource | 60 | @Resource |
| 61 | + private CrmContactService contactService; | ||
| 62 | + @Resource | ||
| 63 | + private CrmBusinessService businessService; | ||
| 64 | + @Resource | ||
| 65 | + @Lazy | ||
| 55 | private CrmBusinessProductService businessProductService; | 66 | private CrmBusinessProductService businessProductService; |
| 56 | @Resource | 67 | @Resource |
| 57 | private CrmProductService productService; | 68 | private CrmProductService productService; |
| @@ -89,7 +100,8 @@ public class CrmContractController { | @@ -89,7 +100,8 @@ public class CrmContractController { | ||
| 89 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") | 100 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 90 | public CommonResult<CrmContractRespVO> getContract(@RequestParam("id") Long id) { | 101 | public CommonResult<CrmContractRespVO> getContract(@RequestParam("id") Long id) { |
| 91 | CrmContractDO contract = contractService.getContract(id); | 102 | CrmContractDO contract = contractService.getContract(id); |
| 92 | - CrmContractRespVO respVO = BeanUtils.toBean(contract, CrmContractRespVO.class); | 103 | + List<CrmContractRespVO> respVOList = buildContractDetail(Collections.singletonList(contract)); |
| 104 | + CrmContractRespVO respVO = respVOList.getFirst(); | ||
| 93 | List<CrmBusinessProductDO> businessProductList = businessProductService.getBusinessProductListByContractId(id); | 105 | List<CrmBusinessProductDO> businessProductList = businessProductService.getBusinessProductListByContractId(id); |
| 94 | Map<Long, CrmBusinessProductDO> businessProductMap = convertMap(businessProductList, CrmBusinessProductDO::getProductId); | 106 | Map<Long, CrmBusinessProductDO> businessProductMap = convertMap(businessProductList, CrmBusinessProductDO::getProductId); |
| 95 | List<CrmProductDO> productList = productService.getProductListByIds(convertSet(businessProductList, CrmBusinessProductDO::getProductId)); | 107 | List<CrmProductDO> productList = productService.getProductListByIds(convertSet(businessProductList, CrmBusinessProductDO::getProductId)); |
| @@ -108,15 +120,15 @@ public class CrmContractController { | @@ -108,15 +120,15 @@ public class CrmContractController { | ||
| 108 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") | 120 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 109 | public CommonResult<PageResult<CrmContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) { | 121 | public CommonResult<PageResult<CrmContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) { |
| 110 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO, getLoginUserId()); | 122 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO, getLoginUserId()); |
| 111 | - return success(buildContractDetailPage(pageResult)); | 123 | + return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetail(pageResult.getList()))); |
| 112 | } | 124 | } |
| 113 | 125 | ||
| 114 | @GetMapping("/page-by-customer") | 126 | @GetMapping("/page-by-customer") |
| 115 | - @Operation(summary = "获得联系人分页,基于指定客户") | 127 | + @Operation(summary = "获得合同分页,基于指定客户") |
| 116 | public CommonResult<PageResult<CrmContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { | 128 | public CommonResult<PageResult<CrmContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { |
| 117 | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); | 129 | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); |
| 118 | PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO); | 130 | PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO); |
| 119 | - return success(buildContractDetailPage(pageResult)); | 131 | + return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetail(pageResult.getList()))); |
| 120 | } | 132 | } |
| 121 | 133 | ||
| 122 | @GetMapping("/export-excel") | 134 | @GetMapping("/export-excel") |
| @@ -132,23 +144,28 @@ public class CrmContractController { | @@ -132,23 +144,28 @@ public class CrmContractController { | ||
| 132 | } | 144 | } |
| 133 | 145 | ||
| 134 | /** | 146 | /** |
| 135 | - * 构建详细的合同分页结果 | 147 | + * 构建详细的合同结果 |
| 136 | * | 148 | * |
| 137 | - * @param pageResult 简单的合同分页结果 | ||
| 138 | - * @return 详细的合同分页结果 | 149 | + * @param contractList 原始合同信息 |
| 150 | + * @return 细的合同结果 | ||
| 139 | */ | 151 | */ |
| 140 | - private PageResult<CrmContractRespVO> buildContractDetailPage(PageResult<CrmContractDO> pageResult) { | ||
| 141 | - List<CrmContractDO> contactList = pageResult.getList(); | ||
| 142 | - if (CollUtil.isEmpty(contactList)) { | ||
| 143 | - return PageResult.empty(pageResult.getTotal()); | 152 | + private List<CrmContractRespVO> buildContractDetail(List<CrmContractDO> contractList) { |
| 153 | + if (CollUtil.isEmpty(contractList)) { | ||
| 154 | + return Collections.emptyList(); | ||
| 144 | } | 155 | } |
| 145 | // 1. 获取客户列表 | 156 | // 1. 获取客户列表 |
| 146 | List<CrmCustomerDO> customerList = customerService.getCustomerList( | 157 | List<CrmCustomerDO> customerList = customerService.getCustomerList( |
| 147 | - convertSet(contactList, CrmContractDO::getCustomerId)); | 158 | + convertSet(contractList, CrmContractDO::getCustomerId)); |
| 148 | // 2. 获取创建人、负责人列表 | 159 | // 2. 获取创建人、负责人列表 |
| 149 | - Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, | 160 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contractList, |
| 150 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); | 161 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); |
| 151 | - return CrmContractConvert.INSTANCE.convertPage(pageResult, userMap, customerList); | 162 | + // 3. 获取联系人 |
| 163 | + Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactListByIds(convertSet(contractList, | ||
| 164 | + CrmContractDO::getContactId)), CrmContactDO::getId); | ||
| 165 | + // 4. 获取商机 | ||
| 166 | + Map<Long, CrmBusinessDO> businessMap = convertMap(businessService.getBusinessList(convertSet(contractList, | ||
| 167 | + CrmContractDO::getBusinessId)), CrmBusinessDO::getId); | ||
| 168 | + return CrmContractConvert.INSTANCE.convertList(contractList, userMap, customerList, contactMap, businessMap); | ||
| 152 | } | 169 | } |
| 153 | 170 | ||
| 154 | @PutMapping("/transfer-contract") | 171 | @PutMapping("/transfer-contract") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractRespVO.java
| @@ -29,10 +29,16 @@ public class CrmContractRespVO { | @@ -29,10 +29,16 @@ public class CrmContractRespVO { | ||
| 29 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") | 29 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") |
| 30 | @ExcelProperty("客户编号") | 30 | @ExcelProperty("客户编号") |
| 31 | private Long customerId; | 31 | private Long customerId; |
| 32 | + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") | ||
| 33 | + @ExcelProperty("客户名称") | ||
| 34 | + private String customerName; | ||
| 32 | 35 | ||
| 33 | @Schema(description = "商机编号", example = "10864") | 36 | @Schema(description = "商机编号", example = "10864") |
| 34 | @ExcelProperty("商机编号") | 37 | @ExcelProperty("商机编号") |
| 35 | private Long businessId; | 38 | private Long businessId; |
| 39 | + @Schema(description = "商机名称", example = "10864") | ||
| 40 | + @ExcelProperty("商机名称") | ||
| 41 | + private String businessName; | ||
| 36 | 42 | ||
| 37 | @Schema(description = "工作流编号", example = "1043") | 43 | @Schema(description = "工作流编号", example = "1043") |
| 38 | @ExcelProperty("工作流编号") | 44 | @ExcelProperty("工作流编号") |
| @@ -77,10 +83,16 @@ public class CrmContractRespVO { | @@ -77,10 +83,16 @@ public class CrmContractRespVO { | ||
| 77 | @Schema(description = "联系人编号", example = "18546") | 83 | @Schema(description = "联系人编号", example = "18546") |
| 78 | @ExcelProperty("联系人编号") | 84 | @ExcelProperty("联系人编号") |
| 79 | private Long contactId; | 85 | private Long contactId; |
| 86 | + @Schema(description = "联系人编号", example = "18546") | ||
| 87 | + @ExcelProperty("联系人编号") | ||
| 88 | + private String contactName; | ||
| 80 | 89 | ||
| 81 | @Schema(description = "公司签约人", example = "14036") | 90 | @Schema(description = "公司签约人", example = "14036") |
| 82 | @ExcelProperty("公司签约人") | 91 | @ExcelProperty("公司签约人") |
| 83 | private Long signUserId; | 92 | private Long signUserId; |
| 93 | + @Schema(description = "公司签约人", example = "14036") | ||
| 94 | + @ExcelProperty("公司签约人") | ||
| 95 | + private String signUserName; | ||
| 84 | 96 | ||
| 85 | @Schema(description = "最后跟进时间") | 97 | @Schema(description = "最后跟进时间") |
| 86 | @ExcelProperty("最后跟进时间") | 98 | @ExcelProperty("最后跟进时间") |
| @@ -104,10 +116,6 @@ public class CrmContractRespVO { | @@ -104,10 +116,6 @@ public class CrmContractRespVO { | ||
| 104 | @ExcelProperty("创建人名字") | 116 | @ExcelProperty("创建人名字") |
| 105 | private String creatorName; | 117 | private String creatorName; |
| 106 | 118 | ||
| 107 | - @Schema(description = "客户名字", example = "test") | ||
| 108 | - @ExcelProperty("客户名字") | ||
| 109 | - private String customerName; | ||
| 110 | - | ||
| 111 | @Schema(description = "负责人", example = "test") | 119 | @Schema(description = "负责人", example = "test") |
| 112 | @ExcelProperty("负责人") | 120 | @ExcelProperty("负责人") |
| 113 | private String ownerUserName; | 121 | private String ownerUserName; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| @@ -232,10 +232,10 @@ public class CrmCustomerController { | @@ -232,10 +232,10 @@ public class CrmCustomerController { | ||
| 232 | return success(customerService.importCustomerList(list, updateSupport, getLoginUserId())); | 232 | return success(customerService.importCustomerList(list, updateSupport, getLoginUserId())); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | - @PutMapping("/transfer") | 235 | + @PutMapping("/transfer-customer") |
| 236 | @Operation(summary = "转移客户") | 236 | @Operation(summary = "转移客户") |
| 237 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") | 237 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") |
| 238 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmCustomerTransferReqVO reqVO) { | 238 | + public CommonResult<Boolean> transferCustomer(@Valid @RequestBody CrmCustomerTransferReqVO reqVO) { |
| 239 | customerService.transferCustomer(reqVO, getLoginUserId()); | 239 | customerService.transferCustomer(reqVO, getLoginUserId()); |
| 240 | return success(true); | 240 | return success(true); |
| 241 | } | 241 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java
| @@ -75,7 +75,7 @@ public class CrmFollowUpRecordController { | @@ -75,7 +75,7 @@ public class CrmFollowUpRecordController { | ||
| 75 | public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) { | 75 | public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) { |
| 76 | PageResult<CrmFollowUpRecordDO> pageResult = followUpRecordService.getFollowUpRecordPage(pageReqVO); | 76 | PageResult<CrmFollowUpRecordDO> pageResult = followUpRecordService.getFollowUpRecordPage(pageReqVO); |
| 77 | /// 拼接数据 | 77 | /// 拼接数据 |
| 78 | - Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactList( | 78 | + Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactListByIds( |
| 79 | convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream())), CrmContactDO::getId); | 79 | convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream())), CrmContactDO::getId); |
| 80 | Map<Long, CrmBusinessDO> businessMap = convertMap(businessService.getBusinessList( | 80 | Map<Long, CrmBusinessDO> businessMap = convertMap(businessService.getBusinessList( |
| 81 | convertSetByFlatMap(pageResult.getList(), item -> item.getBusinessIds().stream())), CrmBusinessDO::getId); | 81 | convertSetByFlatMap(pageResult.getList(), item -> item.getBusinessIds().stream())), CrmBusinessDO::getId); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/CrmContractConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.contract; | 1 | package cn.iocoder.yudao.module.crm.convert.contract; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 3 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractRespVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractRespVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | ||
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 10 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| @@ -31,17 +32,21 @@ public interface CrmContractConvert { | @@ -31,17 +32,21 @@ public interface CrmContractConvert { | ||
| 31 | @Mapping(target = "bizId", source = "reqVO.id") | 32 | @Mapping(target = "bizId", source = "reqVO.id") |
| 32 | CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId); | 33 | CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId); |
| 33 | 34 | ||
| 34 | - default PageResult<CrmContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | ||
| 35 | - List<CrmCustomerDO> customerList) { | ||
| 36 | - PageResult<CrmContractRespVO> voPageResult = BeanUtils.toBean(pageResult, CrmContractRespVO.class); | 35 | + default List<CrmContractRespVO> convertList(List<CrmContractDO> contractList, Map<Long, AdminUserRespDTO> userMap, |
| 36 | + List<CrmCustomerDO> customerList, Map<Long, CrmContactDO> contactMap, | ||
| 37 | + Map<Long, CrmBusinessDO> businessMap) { | ||
| 38 | + List<CrmContractRespVO> respVOList = BeanUtils.toBean(contractList, CrmContractRespVO.class); | ||
| 37 | // 拼接关联字段 | 39 | // 拼接关联字段 |
| 38 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); | 40 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); |
| 39 | - voPageResult.getList().forEach(contract -> { | 41 | + respVOList.forEach(contract -> { |
| 40 | findAndThen(userMap, contract.getOwnerUserId(), user -> contract.setOwnerUserName(user.getNickname())); | 42 | findAndThen(userMap, contract.getOwnerUserId(), user -> contract.setOwnerUserName(user.getNickname())); |
| 41 | findAndThen(userMap, Long.parseLong(contract.getCreator()), user -> contract.setCreatorName(user.getNickname())); | 43 | findAndThen(userMap, Long.parseLong(contract.getCreator()), user -> contract.setCreatorName(user.getNickname())); |
| 44 | + findAndThen(userMap, contract.getSignUserId(), user -> contract.setSignUserName(user.getNickname())); | ||
| 42 | findAndThen(customerMap, contract.getCustomerId(), customer -> contract.setCustomerName(customer.getName())); | 45 | findAndThen(customerMap, contract.getCustomerId(), customer -> contract.setCustomerName(customer.getName())); |
| 46 | + findAndThen(contactMap, contract.getContactId(), contact -> contract.setContactName(contact.getName())); | ||
| 47 | + findAndThen(businessMap, contract.getBusinessId(), business -> contract.setBusinessName(business.getName())); | ||
| 43 | }); | 48 | }); |
| 44 | - return voPageResult; | 49 | + return respVOList; |
| 45 | } | 50 | } |
| 46 | 51 | ||
| 47 | } | 52 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| @@ -80,7 +80,7 @@ public interface CrmContactService { | @@ -80,7 +80,7 @@ public interface CrmContactService { | ||
| 80 | * @param userId 用户编号 | 80 | * @param userId 用户编号 |
| 81 | * @return 联系人列表 | 81 | * @return 联系人列表 |
| 82 | */ | 82 | */ |
| 83 | - List<CrmContactDO> getContactList(Collection<Long> ids, Long userId); | 83 | + List<CrmContactDO> getContactListByIds(Collection<Long> ids, Long userId); |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * 获得联系人列表 | 86 | * 获得联系人列表 |
| @@ -88,7 +88,7 @@ public interface CrmContactService { | @@ -88,7 +88,7 @@ public interface CrmContactService { | ||
| 88 | * @param ids 编号 | 88 | * @param ids 编号 |
| 89 | * @return 联系人列表 | 89 | * @return 联系人列表 |
| 90 | */ | 90 | */ |
| 91 | - List<CrmContactDO> getContactList(Collection<Long> ids); | 91 | + List<CrmContactDO> getContactListByIds(Collection<Long> ids); |
| 92 | 92 | ||
| 93 | /** | 93 | /** |
| 94 | * 获得联系人列表 | 94 | * 获得联系人列表 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -210,7 +210,7 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -210,7 +210,7 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | @Override | 212 | @Override |
| 213 | - public List<CrmContactDO> getContactList(Collection<Long> ids, Long userId) { | 213 | + public List<CrmContactDO> getContactListByIds(Collection<Long> ids, Long userId) { |
| 214 | if (CollUtil.isEmpty(ids)) { | 214 | if (CollUtil.isEmpty(ids)) { |
| 215 | return ListUtil.empty(); | 215 | return ListUtil.empty(); |
| 216 | } | 216 | } |
| @@ -218,7 +218,7 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -218,7 +218,7 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | @Override | 220 | @Override |
| 221 | - public List<CrmContactDO> getContactList(Collection<Long> ids) { | 221 | + public List<CrmContactDO> getContactListByIds(Collection<Long> ids) { |
| 222 | if (CollUtil.isEmpty(ids)) { | 222 | if (CollUtil.isEmpty(ids)) { |
| 223 | return ListUtil.empty(); | 223 | return ListUtil.empty(); |
| 224 | } | 224 | } |