Commit 8434a8cd6864fa31b7e6cfa292adb564ce12c2bf
1 parent
a36fe8c4
crm联系人商机功能修改
Showing
19 changed files
with
181 additions
and
183 deletions
sql/mysql/optinal/crm.sql
| 1 | 1 | -- `ruoyi-vue-pro`.crm_contact_business_link definition |
| 2 | 2 | |
| 3 | -CREATE TABLE `crm_contact_business_link` ( | |
| 3 | +CREATE TABLE `crm_contact_business` ( | |
| 4 | 4 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| 5 | 5 | `contact_id` int(11) DEFAULT NULL COMMENT '联系人id', |
| 6 | 6 | `business_id` int(11) DEFAULT NULL COMMENT '商机id', |
| ... | ... | @@ -10,6 +10,5 @@ CREATE TABLE `crm_contact_business_link` ( |
| 10 | 10 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 11 | 11 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 12 | 12 | `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', |
| 13 | - PRIMARY KEY (`id`), | |
| 14 | - UNIQUE KEY `crm_contact_business_link_un` (`contact_id`,`business_id`,`deleted`,`tenant_id`) | |
| 13 | + PRIMARY KEY (`id`) | |
| 15 | 14 | ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='联系人商机关联表'; |
| 16 | 15 | \ No newline at end of file | ... | ... |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| ... | ... | @@ -24,7 +24,7 @@ public interface ErrorCodeConstants { |
| 24 | 24 | // ========== 联系人管理 1-020-003-000 ========== |
| 25 | 25 | ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); |
| 26 | 26 | ErrorCode CONTACT_BUSINESS_LINK_NOT_EXISTS = new ErrorCode( 1_020_003_001, "联系人商机关联不存在"); |
| 27 | - | |
| 27 | + ErrorCode CONTACT_BUSINESS_LINK_CREATE_EMPTY = new ErrorCode( 1_020_003_002, "联系人商机关联参数为空"); | |
| 28 | 28 | // ========== 回款 1-020-004-000 ========== |
| 29 | 29 | ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款不存在"); |
| 30 | 30 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| ... | ... | @@ -4,11 +4,13 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 7 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; |
| 11 | 12 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; |
| 13 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 12 | 14 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 13 | 15 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 14 | 16 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| ... | ... | @@ -31,6 +33,7 @@ import javax.servlet.http.HttpServletResponse; |
| 31 | 33 | import javax.validation.Valid; |
| 32 | 34 | import java.io.IOException; |
| 33 | 35 | import java.util.List; |
| 36 | +import java.util.Map; | |
| 34 | 37 | import java.util.Objects; |
| 35 | 38 | import java.util.Set; |
| 36 | 39 | import java.util.stream.Collectors; |
| ... | ... | @@ -170,5 +173,34 @@ public class CrmBusinessController { |
| 170 | 173 | businessService.transferBusiness(reqVO, getLoginUserId()); |
| 171 | 174 | return success(true); |
| 172 | 175 | } |
| 173 | - | |
| 176 | + @GetMapping("/page-by-contact") | |
| 177 | + @Operation(summary = "获得联系人的商机分页") | |
| 178 | + @PreAuthorize("@ss.hasPermission('crm:business:query')") | |
| 179 | + public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessContactPage(@Valid CrmContactBusinessLinkPageReqVO pageVO) { | |
| 180 | + PageResult<CrmBusinessRespVO> pageResult = businessService.getBusinessPageByContact(pageVO); | |
| 181 | + // 处理商机状态类型名称回显 | |
| 182 | + Set<Long> statusTypeIds = pageResult.getList().stream() | |
| 183 | + .map(CrmBusinessRespVO::getStatusTypeId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 184 | + CrmBusinessStatusTypeQueryVO queryStatusTypeVO = new CrmBusinessStatusTypeQueryVO(); | |
| 185 | + queryStatusTypeVO.setIdList(statusTypeIds); | |
| 186 | + List<CrmBusinessStatusTypeDO> statusTypeList = businessStatusTypeService.selectList(queryStatusTypeVO); | |
| 187 | + Map<Long,String> statusTypeMap = CollectionUtils.convertMap(statusTypeList,CrmBusinessStatusTypeDO::getId,CrmBusinessStatusTypeDO::getName); | |
| 188 | + // 处理商机状态名称回显 | |
| 189 | + Set<Long> statusIds = pageResult.getList().stream() | |
| 190 | + .map(CrmBusinessRespVO::getStatusId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 191 | + CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | |
| 192 | + queryVO.setIdList(statusIds); | |
| 193 | + List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | |
| 194 | + Map<Long,String> statusMap = CollectionUtils.convertMap(statusList,CrmBusinessStatusDO::getId,CrmBusinessStatusDO::getName); | |
| 195 | + // 处理客户名称回显 | |
| 196 | + Set<Long> customerIds = CollectionUtils.convertSet(pageResult.getList(),CrmBusinessRespVO::getCustomerId); | |
| 197 | + List<CrmCustomerDO> customerList = customerService.getCustomerList(customerIds); | |
| 198 | + Map<Long,String> customerMap = CollectionUtils.convertMap(customerList,CrmCustomerDO::getId,CrmCustomerDO::getName); | |
| 199 | + pageResult.getList().forEach(item -> { | |
| 200 | + item.setStatusTypeName(statusTypeMap.get(item.getStatusTypeId())); | |
| 201 | + item.setStatusName(statusMap.get(item.getStatusId())); | |
| 202 | + item.setCustomerName(customerMap.get(item.getCustomerId())); | |
| 203 | + }); | |
| 204 | + return success(pageResult); | |
| 205 | + } | |
| 174 | 206 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
| ... | ... | @@ -25,4 +25,6 @@ public class CrmBusinessRespVO extends CrmBusinessBaseVO { |
| 25 | 25 | @Schema(description = "状态名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "跟进中") |
| 26 | 26 | private String statusName; |
| 27 | 27 | |
| 28 | + @Schema(description = "联系人商机关联ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | |
| 29 | + private Long businessContactId; | |
| 28 | 30 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| ... | ... | @@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert; |
| 14 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 15 | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 16 | 16 | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| 17 | +import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessLinkService; | |
| 17 | 18 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| 18 | 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 19 | 20 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| ... | ... | @@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.*; |
| 30 | 31 | import javax.annotation.Resource; |
| 31 | 32 | import javax.servlet.http.HttpServletResponse; |
| 32 | 33 | import javax.validation.Valid; |
| 34 | +import javax.validation.constraints.NotEmpty; | |
| 33 | 35 | import java.io.IOException; |
| 34 | 36 | import java.util.Collections; |
| 35 | 37 | import java.util.List; |
| ... | ... | @@ -54,10 +56,12 @@ public class CrmContactController { |
| 54 | 56 | private CrmContactService contactService; |
| 55 | 57 | @Resource |
| 56 | 58 | private CrmCustomerService customerService; |
| 57 | - | |
| 58 | 59 | @Resource |
| 59 | 60 | private AdminUserApi adminUserApi; |
| 60 | 61 | |
| 62 | + @Resource | |
| 63 | + private CrmContactBusinessLinkService contactBusinessLinkService; | |
| 64 | + | |
| 61 | 65 | @PostMapping("/create") |
| 62 | 66 | @Operation(summary = "创建联系人") |
| 63 | 67 | @PreAuthorize("@ss.hasPermission('crm:contact:create')") |
| ... | ... | @@ -137,6 +141,23 @@ public class CrmContactController { |
| 137 | 141 | convertDetailContactPage(pageResult).getList()); |
| 138 | 142 | } |
| 139 | 143 | |
| 144 | + @DeleteMapping("/delete-batch-business") | |
| 145 | + @Operation(summary = "批量删除联系人商机关联") | |
| 146 | + @PreAuthorize("@ss.hasPermission('crm:contact-business-link:delete')") | |
| 147 | + public CommonResult<Boolean> deleteContactBusinessLinkBatch(@Valid @RequestBody List<Long> businessContactIds) { | |
| 148 | + contactBusinessLinkService.deleteContactBusinessLink(businessContactIds); | |
| 149 | + return success(true); | |
| 150 | + } | |
| 151 | + | |
| 152 | + @PostMapping("/create-batch-business") | |
| 153 | + @Operation(summary = "创建联系人商机关联") | |
| 154 | + @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") | |
| 155 | + public CommonResult<Boolean> createContactBusinessLinkBatch( | |
| 156 | + @Valid @NotEmpty @RequestBody List<CrmContactBusinessLinkSaveReqVO> createReqVO) { | |
| 157 | + contactBusinessLinkService.createContactBusinessLinkBatch(createReqVO); | |
| 158 | + return success(true); | |
| 159 | + } | |
| 160 | + | |
| 140 | 161 | /** |
| 141 | 162 | * 转换成详细的联系人分页,即读取关联信息 |
| 142 | 163 | * | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusinessLinkPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusinessLinkRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusinessLinkSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkRespVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 10 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 11 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 12 | -import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | |
| 13 | -import cn.iocoder.yudao.module.crm.service.contactbusinesslink.CrmContactBusinessLinkService; | |
| 14 | -import io.swagger.v3.oas.annotations.Operation; | |
| 15 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 18 | -import org.springframework.transaction.annotation.Transactional; | |
| 19 | -import org.springframework.validation.annotation.Validated; | |
| 20 | -import org.springframework.web.bind.annotation.*; | |
| 21 | - | |
| 22 | -import javax.annotation.Resource; | |
| 23 | -import javax.validation.Valid; | |
| 24 | -import java.util.List; | |
| 25 | - | |
| 26 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 27 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 28 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; | |
| 29 | - | |
| 30 | -@Tag(name = "管理后台 - CRM 联系人商机关联") | |
| 31 | -@RestController | |
| 32 | -@RequestMapping("/crm/contact-business-link") | |
| 33 | -@Validated | |
| 34 | -public class CrmContactBusinessLinkController { | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - private CrmContactBusinessLinkService contactBusinessLinkService; | |
| 38 | - @Resource | |
| 39 | - private CrmBusinessService crmBusinessService; | |
| 40 | - | |
| 41 | - // TODO @zyna:createContactBusinessLink 和 createContactBusinessLinkBatch 是不是合并成一个接口?contactId、List<businessId> | |
| 42 | - @PostMapping("/create") | |
| 43 | - @Operation(summary = "创建联系人商机关联") | |
| 44 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") | |
| 45 | - public CommonResult<Long> createContactBusinessLink(@Valid @RequestBody CrmContactBusinessLinkSaveReqVO createReqVO) { | |
| 46 | - return success(contactBusinessLinkService.createContactBusinessLink(createReqVO)); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @PostMapping("/create-batch") | |
| 50 | - @Operation(summary = "创建联系人商机关联") | |
| 51 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") | |
| 52 | - @Transactional(rollbackFor = Exception.class) | |
| 53 | - public CommonResult<Boolean> createContactBusinessLinkBatch( | |
| 54 | - @Valid @RequestBody List<CrmContactBusinessLinkSaveReqVO> createReqVO) { | |
| 55 | - createReqVO.stream().forEach(item -> { | |
| 56 | - CrmBusinessDO crmBusinessDO = crmBusinessService.getBusiness(item.getBusinessId()); | |
| 57 | - if(crmBusinessDO == null){ | |
| 58 | - throw exception(BUSINESS_NOT_EXISTS); | |
| 59 | - } | |
| 60 | - }); | |
| 61 | - contactBusinessLinkService.createContactBusinessLinkBatch(createReqVO); | |
| 62 | - return success(true); | |
| 63 | - } | |
| 64 | - | |
| 65 | - // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在更新。 | |
| 66 | - @PutMapping("/update") | |
| 67 | - @Operation(summary = "更新联系人商机关联") | |
| 68 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:update')") | |
| 69 | - public CommonResult<Boolean> updateContactBusinessLink(@Valid @RequestBody CrmContactBusinessLinkSaveReqVO updateReqVO) { | |
| 70 | - contactBusinessLinkService.updateContactBusinessLink(updateReqVO); | |
| 71 | - return success(true); | |
| 72 | - } | |
| 73 | - | |
| 74 | - // TODO @zyna:删除,是不是传递 ids? | |
| 75 | - @DeleteMapping("/delete-batch") | |
| 76 | - @Operation(summary = "批量删除联系人商机关联") | |
| 77 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:delete')") | |
| 78 | - public CommonResult<Boolean> deleteContactBusinessLinkBatch(@Valid @RequestBody List<CrmContactBusinessLinkSaveReqVO> deleteList) { | |
| 79 | - contactBusinessLinkService.deleteContactBusinessLink(deleteList); | |
| 80 | - return success(true); | |
| 81 | - } | |
| 82 | - | |
| 83 | - // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在单个读取; | |
| 84 | - @GetMapping("/get") | |
| 85 | - @Operation(summary = "获得联系人商机关联") | |
| 86 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 87 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") | |
| 88 | - public CommonResult<CrmContactBusinessLinkRespVO> getContactBusinessLink(@RequestParam("id") Long id) { | |
| 89 | - CrmContactBusinessLinkDO contactBusinessLink = contactBusinessLinkService.getContactBusinessLink(id); | |
| 90 | - return success(BeanUtils.toBean(contactBusinessLink, CrmContactBusinessLinkRespVO.class)); | |
| 91 | - } | |
| 92 | - | |
| 93 | - // TODO @zyna:这个可以转化下,使用客户编号去查询,就是使用 CrmBusinessController 的 getBusinessPageByCustomer 接口;目的是:复用 | |
| 94 | - @GetMapping("/page-by-contact") | |
| 95 | - @Operation(summary = "获得联系人商机关联") | |
| 96 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") | |
| 97 | - public CommonResult<PageResult<CrmBusinessRespVO>> getContactBusinessLinkByContact( | |
| 98 | - @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 99 | - PageResult<CrmBusinessRespVO> contactBusinessLink = contactBusinessLinkService.getContactBusinessLinkPageByContact(pageReqVO); | |
| 100 | - return success(contactBusinessLink); | |
| 101 | - } | |
| 102 | - | |
| 103 | - // TODO @zyna:这个优化下,搞到 CrmBusinessController 里去,加一个 CrmBusinessController 的 getBusinessPageByContact 接口;目的是: | |
| 104 | - @GetMapping("/page") | |
| 105 | - @Operation(summary = "获得联系人商机关联分页") | |
| 106 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") | |
| 107 | - public CommonResult<PageResult<CrmContactBusinessLinkRespVO>> getContactBusinessLinkPage( | |
| 108 | - @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 109 | - PageResult<CrmContactBusinessLinkDO> pageResult = contactBusinessLinkService.getContactBusinessLinkPage(pageReqVO); | |
| 110 | - return success(BeanUtils.toBean(pageResult, CrmContactBusinessLinkRespVO.class)); | |
| 111 | - } | |
| 112 | - | |
| 113 | - // TODO @zyna:最终梳理完后,应该就 2 个接口,要不直接合并到 CrmContactController 中,不作为独立模块,就关联、接触关联。其实和 user 设置它有哪些岗位、部门是类似的。 | |
| 114 | - | |
| 115 | -} | |
| 116 | 0 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java
| ... | ... | @@ -80,12 +80,12 @@ public interface ContactConvert { |
| 80 | 80 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); |
| 81 | 81 | result.forEach(item -> { |
| 82 | 82 | setUserInfo(item, userMap); |
| 83 | - findAndThen(customerMap, item.getCustomerId(), customer -> { // TODO @zyna:这里的 { 可以去掉 | |
| 84 | - item.setCustomerName(customer.getName()); | |
| 85 | - }); | |
| 86 | - findAndThen(parentContactMap, item.getParentId(), contactDO -> { // TODO @zyna:这里的 { 可以去掉 | |
| 87 | - item.setParentName(contactDO.getName()); | |
| 88 | - }); | |
| 83 | + findAndThen(customerMap, item.getCustomerId(), customer -> | |
| 84 | + item.setCustomerName(customer.getName()) | |
| 85 | + ); | |
| 86 | + findAndThen(parentContactMap, item.getParentId(), contactDO -> | |
| 87 | + item.setParentName(contactDO.getName()) | |
| 88 | + ); | |
| 89 | 89 | }); |
| 90 | 90 | return result; |
| 91 | 91 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contactbusinessslink/CrmContactBusinessLinkConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.convert.contactbusinessslink; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 4 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 5 | -import org.mapstruct.Mapper; | |
| 6 | -import org.mapstruct.factory.Mappers; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -// TODO @zyna:使用 BeanUtils 慢慢替代现有的 mapstruct 哈 | |
| 11 | -@Mapper | |
| 12 | -public interface CrmContactBusinessLinkConvert { | |
| 13 | - CrmContactBusinessLinkConvert INSTANCE = Mappers.getMapper(CrmContactBusinessLinkConvert.class); | |
| 14 | - CrmContactBusinessLinkDO convert(CrmContactBusinessLinkSaveReqVO bean); | |
| 15 | - List<CrmContactBusinessLinkDO> convert(List<CrmContactBusinessLinkSaveReqVO> bean); | |
| 16 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/CrmContactBusinessLinkDO.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink; | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.contact; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| ... | ... | @@ -8,14 +8,13 @@ import com.baomidou.mybatisplus.annotation.TableId; |
| 8 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| 9 | 9 | import lombok.*; |
| 10 | 10 | |
| 11 | -// TODO @zyna:可以放到 contact 包下 | |
| 12 | 11 | /** |
| 13 | 12 | * CRM 联系人商机关联 DO |
| 14 | 13 | * |
| 15 | 14 | * @author 芋道源码 |
| 16 | 15 | */ |
| 17 | -@TableName("crm_contact_business_link") | |
| 18 | -@KeySequence("crm_contact_business_link_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 16 | +@TableName("crm_contact_business") | |
| 17 | +@KeySequence("crm_contact_business_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | 18 | @Data |
| 20 | 19 | @EqualsAndHashCode(callSuper = true) |
| 21 | 20 | @ToString(callSuper = true) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | 10 | /** |
| ... | ... | @@ -21,7 +21,7 @@ public interface CrmContactBusinessLinkMapper extends BaseMapperX<CrmContactBusi |
| 21 | 21 | .eqIfPresent(CrmContactBusinessLinkDO::getBusinessId, reqVO.getBusinessId()) |
| 22 | 22 | .betweenIfPresent(CrmContactBusinessLinkDO::getCreateTime, reqVO.getCreateTime()) |
| 23 | 23 | .orderByDesc(CrmContactBusinessLinkDO::getId)); |
| 24 | - } // TODO @zyna:方法和方法之间要有空行 | |
| 24 | + } | |
| 25 | 25 | default PageResult<CrmContactBusinessLinkDO> selectPageByContact(CrmContactBusinessLinkPageReqVO reqVO) { |
| 26 | 26 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmContactBusinessLinkDO>() |
| 27 | 27 | .eqIfPresent(CrmContactBusinessLinkDO::getContactId, reqVO.getContactId()) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 8 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 9 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 10 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| ... | ... | @@ -88,4 +86,10 @@ public interface CrmBusinessService { |
| 88 | 86 | */ |
| 89 | 87 | void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId); |
| 90 | 88 | |
| 89 | + /** | |
| 90 | + * 获取联系人商机列表 | |
| 91 | + * @param pageReqVO 分页参数 | |
| 92 | + * @return 联系人商机 | |
| 93 | + */ | |
| 94 | + PageResult<CrmBusinessRespVO> getBusinessPageByContact(CrmContactBusinessLinkPageReqVO pageReqVO); | |
| 91 | 95 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| ... | ... | @@ -3,15 +3,20 @@ package cn.iocoder.yudao.module.crm.service.business; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 7 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 8 | 11 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 9 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 10 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; |
| 11 | 15 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; |
| 12 | 16 | import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; |
| 13 | 17 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 14 | 18 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 19 | +import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; | |
| 15 | 20 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 16 | 21 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 17 | 22 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -21,6 +26,7 @@ import org.springframework.validation.annotation.Validated; |
| 21 | 26 | import javax.annotation.Resource; |
| 22 | 27 | import java.util.Collection; |
| 23 | 28 | import java.util.List; |
| 29 | +import java.util.Map; | |
| 24 | 30 | import java.util.Set; |
| 25 | 31 | |
| 26 | 32 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -42,6 +48,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { |
| 42 | 48 | @Resource |
| 43 | 49 | private CrmPermissionService crmPermissionService; |
| 44 | 50 | |
| 51 | + @Resource | |
| 52 | + private CrmContactService crmContactService; | |
| 53 | + | |
| 45 | 54 | @Override |
| 46 | 55 | @Transactional(rollbackFor = Exception.class) |
| 47 | 56 | public Long createBusiness(CrmBusinessCreateReqVO createReqVO, Long userId) { |
| ... | ... | @@ -134,5 +143,29 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { |
| 134 | 143 | |
| 135 | 144 | // 3. TODO 记录转移日志 |
| 136 | 145 | } |
| 146 | + @Override | |
| 147 | + public PageResult<CrmBusinessRespVO> getBusinessPageByContact(CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 148 | + CrmContactBusinessLinkPageReqVO crmContactBusinessLinkPageReqVO = new CrmContactBusinessLinkPageReqVO(); | |
| 149 | + crmContactBusinessLinkPageReqVO.setContactId(pageReqVO.getContactId()); | |
| 150 | + PageResult<CrmContactBusinessLinkDO> businessLinkDOS = crmContactService.selectBusinessPageByContact(crmContactBusinessLinkPageReqVO); | |
| 151 | + if (CollUtil.isEmpty(businessLinkDOS.getList())){ | |
| 152 | + return PageResult.empty(); | |
| 153 | + } | |
| 154 | + List<CrmBusinessDO> businessList = this.getBusinessList(CollectionUtils.convertList(businessLinkDOS.getList(), | |
| 155 | + CrmContactBusinessLinkDO::getBusinessId)); | |
| 156 | + if (CollUtil.isEmpty(businessList)){ | |
| 157 | + return PageResult.empty(); | |
| 158 | + } | |
| 159 | + PageResult<CrmBusinessRespVO> pageResult = new PageResult<CrmBusinessRespVO>(); | |
| 160 | + List<CrmBusinessRespVO> respVOList = BeanUtils.toBean(businessList,CrmBusinessRespVO.class); | |
| 161 | + Map<Long,Long> businessContactMap = CollectionUtils.convertMap(businessLinkDOS.getList(), | |
| 162 | + CrmContactBusinessLinkDO::getBusinessId,CrmContactBusinessLinkDO::getId); | |
| 163 | + respVOList.forEach(item -> { | |
| 164 | + item.setBusinessContactId(businessContactMap.get(item.getId())); | |
| 165 | + }); | |
| 166 | + pageResult.setList(respVOList); | |
| 167 | + pageResult.setTotal(businessLinkDOS.getTotal()); | |
| 168 | + return pageResult; | |
| 137 | 169 | |
| 170 | + } | |
| 138 | 171 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessLinkService.java
| 1 | -package cn.iocoder.yudao.module.crm.service.contactbusinesslink; | |
| 1 | +package cn.iocoder.yudao.module.crm.service.contact; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkSaveReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 8 | 8 | |
| 9 | 9 | import javax.validation.Valid; |
| 10 | 10 | import java.util.List; |
| ... | ... | @@ -41,9 +41,9 @@ public interface CrmContactBusinessLinkService { |
| 41 | 41 | /** |
| 42 | 42 | * 删除联系人商机关联 |
| 43 | 43 | * |
| 44 | - * @param createReqVO 删除列表 | |
| 44 | + * @param businessContactIds 删除列表 | |
| 45 | 45 | */ |
| 46 | - void deleteContactBusinessLink(@Valid List<CrmContactBusinessLinkSaveReqVO> createReqVO); | |
| 46 | + void deleteContactBusinessLink(@Valid List<Long> businessContactIds); | |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * 获得联系人商机关联 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessLinkServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.crm.service.contactbusinesslink; | |
| 1 | +package cn.iocoder.yudao.module.crm.service.contact; | |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.lang.Assert; | |
| 3 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | 8 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | 9 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkSaveReqVO; | |
| 10 | 12 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 11 | -import cn.iocoder.yudao.module.crm.convert.contactbusinessslink.CrmContactBusinessLinkConvert; | |
| 12 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 13 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 14 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 15 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 14 | 16 | import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; |
| 17 | +import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; | |
| 15 | 18 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 19 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 16 | 20 | import org.springframework.stereotype.Service; |
| 17 | 21 | import org.springframework.validation.annotation.Validated; |
| 18 | 22 | |
| 19 | 23 | import javax.annotation.Resource; |
| 24 | +import java.util.ArrayList; | |
| 20 | 25 | import java.util.List; |
| 21 | 26 | |
| 22 | 27 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 28 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; | |
| 23 | 29 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTACT_BUSINESS_LINK_NOT_EXISTS; |
| 24 | 30 | |
| 25 | 31 | // TODO @puhui999:数据权限的校验;每个操作; |
| ... | ... | @@ -37,6 +43,9 @@ public class CrmContactBusinessLinkServiceImpl implements CrmContactBusinessLink |
| 37 | 43 | @Resource |
| 38 | 44 | private CrmBusinessService crmBusinessService; |
| 39 | 45 | |
| 46 | + @Resource | |
| 47 | + private CrmContactService crmContactService; | |
| 48 | + | |
| 40 | 49 | @Override |
| 41 | 50 | public Long createContactBusinessLink(CrmContactBusinessLinkSaveReqVO createReqVO) { |
| 42 | 51 | CrmContactBusinessLinkDO contactBusinessLink = BeanUtils.toBean(createReqVO, CrmContactBusinessLinkDO.class); |
| ... | ... | @@ -47,9 +56,22 @@ public class CrmContactBusinessLinkServiceImpl implements CrmContactBusinessLink |
| 47 | 56 | @Override |
| 48 | 57 | public void createContactBusinessLinkBatch(List<CrmContactBusinessLinkSaveReqVO> createReqVOList) { |
| 49 | 58 | // 插入 |
| 50 | - // TODO @zyna:如果已经关联过,不用重复插入; | |
| 51 | - // TODO @zyna:contact 和 business 存在校验,挪到这里,Controller 不用 @Transactional 注解,添加到这里哈。尽量业务都在 Service; | |
| 52 | - List<CrmContactBusinessLinkDO> saveDoList = CrmContactBusinessLinkConvert.INSTANCE.convert(createReqVOList); | |
| 59 | + CrmContactDO contactDO = crmContactService.getContact(createReqVOList.stream().findFirst().get().getContactId()); | |
| 60 | + Assert.notNull(contactDO,ErrorCodeConstants.CONTACT_NOT_EXISTS.getMsg()); | |
| 61 | + List<CrmContactBusinessLinkDO> saveDoList = new ArrayList<CrmContactBusinessLinkDO>(); | |
| 62 | + createReqVOList.forEach(item -> { | |
| 63 | + CrmBusinessDO crmBusinessDO = crmBusinessService.getBusiness(item.getBusinessId()); | |
| 64 | + if(crmBusinessDO == null){ | |
| 65 | + throw exception(BUSINESS_NOT_EXISTS); | |
| 66 | + } | |
| 67 | + // 判重 | |
| 68 | + CrmContactBusinessLinkDO crmContactBusinessLinkDO = contactBusinessLinkMapper.selectOne(new LambdaQueryWrapper<CrmContactBusinessLinkDO>() | |
| 69 | + .eq(CrmContactBusinessLinkDO::getBusinessId,item.getBusinessId()) | |
| 70 | + .eq(CrmContactBusinessLinkDO::getContactId,item.getContactId())); | |
| 71 | + if(crmContactBusinessLinkDO == null){ | |
| 72 | + saveDoList.add(BeanUtils.toBean(item,CrmContactBusinessLinkDO.class)); | |
| 73 | + } | |
| 74 | + }); | |
| 53 | 75 | contactBusinessLinkMapper.insertBatch(saveDoList); |
| 54 | 76 | } |
| 55 | 77 | |
| ... | ... | @@ -63,14 +85,9 @@ public class CrmContactBusinessLinkServiceImpl implements CrmContactBusinessLink |
| 63 | 85 | } |
| 64 | 86 | |
| 65 | 87 | @Override |
| 66 | - public void deleteContactBusinessLink(List<CrmContactBusinessLinkSaveReqVO> createReqVO) { | |
| 88 | + public void deleteContactBusinessLink(List<Long> businessContactIds) { | |
| 67 | 89 | // 删除 |
| 68 | - createReqVO.forEach(item -> { | |
| 69 | - contactBusinessLinkMapper.delete(new LambdaQueryWrapperX<CrmContactBusinessLinkDO>() | |
| 70 | - .eq(CrmContactBusinessLinkDO::getBusinessId,item.getBusinessId()) | |
| 71 | - .eq(CrmContactBusinessLinkDO::getContactId,item.getContactId()) | |
| 72 | - .eq(CrmContactBusinessLinkDO::getDeleted,0)); | |
| 73 | - }); | |
| 90 | + contactBusinessLinkMapper.deleteBatchIds(businessContactIds); | |
| 74 | 91 | } |
| 75 | 92 | |
| 76 | 93 | private void validateContactBusinessLinkExists(Long id) { | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.contact; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessLinkPageReqVO; | |
| 4 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactCreateReqVO; |
| 5 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactPageReqVO; |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactUpdateReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 7 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 8 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | 11 | |
| ... | ... | @@ -84,4 +86,12 @@ public interface CrmContactService { |
| 84 | 86 | */ |
| 85 | 87 | List<CrmContactDO> getContactList(); |
| 86 | 88 | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 获取联系人商机关联分页列表 | |
| 92 | + * @param reqVO 联系人 | |
| 93 | + * @return 商机联系人关联列表 | |
| 94 | + */ | |
| 95 | + PageResult<CrmContactBusinessLinkDO> selectBusinessPageByContact(CrmContactBusinessLinkPageReqVO reqVO); | |
| 96 | + | |
| 87 | 97 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| ... | ... | @@ -3,13 +3,16 @@ package cn.iocoder.yudao.module.crm.service.contact; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBaseVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactCreateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; | |
| 9 | +import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | |
| 10 | 10 | import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert; |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessLinkDO; | |
| 11 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 12 | 14 | import cn.iocoder.yudao.module.crm.dal.mysql.contact.CrmContactMapper; |
| 15 | +import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; | |
| 13 | 16 | import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; |
| 14 | 17 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 15 | 18 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| ... | ... | @@ -46,10 +49,12 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 46 | 49 | private CrmCustomerService customerService; |
| 47 | 50 | @Resource |
| 48 | 51 | private CrmPermissionService crmPermissionService; |
| 49 | - | |
| 50 | 52 | @Resource |
| 51 | 53 | private AdminUserApi adminUserApi; |
| 52 | 54 | |
| 55 | + @Resource | |
| 56 | + private CrmContactBusinessLinkMapper contactBusinessLinkMapper; | |
| 57 | + | |
| 53 | 58 | @Override |
| 54 | 59 | @Transactional(rollbackFor = Exception.class) |
| 55 | 60 | public Long createContact(CrmContactCreateReqVO createReqVO, Long userId) { |
| ... | ... | @@ -144,4 +149,11 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 144 | 149 | return contactMapper.selectList(); |
| 145 | 150 | } |
| 146 | 151 | |
| 152 | + @Override | |
| 153 | + public PageResult<CrmContactBusinessLinkDO> selectBusinessPageByContact(CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 154 | + CrmContactBusinessLinkPageReqVO crmContactBusinessLinkPageReqVO = new CrmContactBusinessLinkPageReqVO(); | |
| 155 | + crmContactBusinessLinkPageReqVO.setContactId(pageReqVO.getContactId()); | |
| 156 | + return contactBusinessLinkMapper.selectPageByContact(crmContactBusinessLinkPageReqVO); | |
| 157 | + | |
| 158 | + } | |
| 147 | 159 | } | ... | ... |