Commit 8fa8f2890b3bc7095ccf07bfe5b9866218ece768
1 parent
c234f5b5
CRM: 线索、联系人、回款、回款计划新增数据权限转移
Showing
24 changed files
with
274 additions
and
46 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessTransferReqVO.java
| ... | ... | @@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | 5 | import jakarta.validation.constraints.NotNull; |
| 6 | +import lombok.Data; | |
| 8 | 7 | |
| 9 | 8 | @Schema(description = "管理后台 - 商机转移 Request VO") |
| 10 | 9 | @Data |
| 11 | 10 | public class CrmBusinessTransferReqVO { |
| 12 | 11 | |
| 13 | 12 | @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 14 | - @NotNull(message = "联系人编号不能为空") | |
| 13 | + @NotNull(message = "商机编号不能为空") | |
| 15 | 14 | private Long id; |
| 16 | 15 | |
| 17 | 16 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/CrmClueController.java
| ... | ... | @@ -88,4 +88,12 @@ public class CrmClueController { |
| 88 | 88 | ExcelUtils.write(response, "线索.xls", "数据", CrmClueExcelVO.class, datas); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + @PutMapping("/transfer") | |
| 92 | + @Operation(summary = "线索转移") | |
| 93 | + @PreAuthorize("@ss.hasPermission('crm:clue:update')") | |
| 94 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmClueTransferReqVO reqVO) { | |
| 95 | + clueService.transferClue(reqVO, getLoginUserId()); | |
| 96 | + return success(true); | |
| 97 | + } | |
| 98 | + | |
| 91 | 99 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueTransferReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.clue.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 线索转移 Request VO") | |
| 9 | +@Data | |
| 10 | +public class CrmClueTransferReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "线索编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 13 | + @NotNull(message = "线索编号不能为空") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 新负责人的用户编号 | |
| 18 | + */ | |
| 19 | + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 20 | + @NotNull(message = "新负责人的用户编号不能为空") | |
| 21 | + private Long newOwnerUserId; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 25 | + * | |
| 26 | + * 关联 {@link CrmPermissionLevelEnum} | |
| 27 | + */ | |
| 28 | + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | + private Integer oldOwnerPermissionLevel; | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| ... | ... | @@ -9,7 +9,7 @@ import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 10 | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 11 | 11 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; |
| 12 | -import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert; | |
| 12 | +import cn.iocoder.yudao.module.crm.convert.contact.CrmContactConvert; | |
| 13 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 14 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 15 | 15 | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| ... | ... | @@ -100,7 +100,7 @@ public class CrmContactController { |
| 100 | 100 | // 3. 直属上级 |
| 101 | 101 | List<CrmContactDO> parentContactList = contactService.getContactList( |
| 102 | 102 | Collections.singletonList(contact.getParentId()), getLoginUserId()); |
| 103 | - return success(ContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList)); | |
| 103 | + return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList)); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | @GetMapping("/simple-all-list") |
| ... | ... | @@ -110,7 +110,7 @@ public class CrmContactController { |
| 110 | 110 | CrmContactPageReqVO pageReqVO = new CrmContactPageReqVO(); |
| 111 | 111 | pageReqVO.setPageSize(PAGE_SIZE_NONE); |
| 112 | 112 | List<CrmContactDO> list = contactService.getContactPage(pageReqVO, getLoginUserId()).getList(); |
| 113 | - return success(ContactConvert.INSTANCE.convertAllList(list)); | |
| 113 | + return success(CrmContactConvert.INSTANCE.convertAllList(list)); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | @GetMapping("/page") |
| ... | ... | @@ -161,7 +161,15 @@ public class CrmContactController { |
| 161 | 161 | // 3. 直属上级 |
| 162 | 162 | List<CrmContactDO> parentContactList = contactService.getContactList( |
| 163 | 163 | convertSet(contactList, CrmContactDO::getParentId), getLoginUserId()); |
| 164 | - return ContactConvert.INSTANCE.convertPage(pageResult, userMap, crmCustomerDOList, parentContactList); | |
| 164 | + return CrmContactConvert.INSTANCE.convertPage(pageResult, userMap, crmCustomerDOList, parentContactList); | |
| 165 | + } | |
| 166 | + | |
| 167 | + @PutMapping("/transfer") | |
| 168 | + @Operation(summary = "联系人转移") | |
| 169 | + @PreAuthorize("@ss.hasPermission('crm:contact:update')") | |
| 170 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContactTransferReqVO reqVO) { | |
| 171 | + contactService.transferContact(reqVO, getLoginUserId()); | |
| 172 | + return success(true); | |
| 165 | 173 | } |
| 166 | 174 | |
| 167 | 175 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| ... | ... | @@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; |
| 11 | -import cn.iocoder.yudao.module.crm.convert.contract.ContractConvert; | |
| 11 | +import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; | |
| 12 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 13 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 14 | 14 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| ... | ... | @@ -80,7 +80,7 @@ public class CrmContractController { |
| 80 | 80 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 81 | 81 | public CommonResult<ContractRespVO> getContract(@RequestParam("id") Long id) { |
| 82 | 82 | CrmContractDO contract = contractService.getContract(id); |
| 83 | - return success(ContractConvert.INSTANCE.convert(contract)); | |
| 83 | + return success(CrmContractConvert.INSTANCE.convert(contract)); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | @GetMapping("/page") |
| ... | ... | @@ -108,7 +108,7 @@ public class CrmContractController { |
| 108 | 108 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId()); |
| 109 | 109 | // 导出 Excel |
| 110 | 110 | ExcelUtils.write(response, "合同.xls", "数据", CrmContractExcelVO.class, |
| 111 | - ContractConvert.INSTANCE.convertList02(pageResult.getList())); | |
| 111 | + CrmContractConvert.INSTANCE.convertList02(pageResult.getList())); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| ... | ... | @@ -128,7 +128,7 @@ public class CrmContractController { |
| 128 | 128 | // 2. 获取创建人、负责人列表 |
| 129 | 129 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, |
| 130 | 130 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); |
| 131 | - return ContractConvert.INSTANCE.convertPage(pageResult, userMap, customerList); | |
| 131 | + return CrmContractConvert.INSTANCE.convertPage(pageResult, userMap, customerList); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | @PutMapping("/transfer") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java
| ... | ... | @@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | 5 | import jakarta.validation.constraints.NotNull; |
| 6 | +import lombok.Data; | |
| 8 | 7 | |
| 9 | 8 | @Schema(description = "管理后台 - CRM 客户转移 Request VO") |
| 10 | 9 | @Data |
| 11 | 10 | public class CrmCustomerTransferReqVO { |
| 12 | 11 | |
| 13 | 12 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 14 | - @NotNull(message = "联系人编号不能为空") | |
| 13 | + @NotNull(message = "客户编号不能为空") | |
| 15 | 14 | private Long id; |
| 16 | 15 | |
| 17 | 16 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
| ... | ... | @@ -7,10 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; | |
| 12 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; | |
| 13 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.*; | |
| 14 | 11 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert; |
| 15 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 16 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| ... | ... | @@ -144,4 +141,12 @@ public class CrmReceivableController { |
| 144 | 141 | return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList); |
| 145 | 142 | } |
| 146 | 143 | |
| 144 | + @PutMapping("/transfer") | |
| 145 | + @Operation(summary = "回款转移") | |
| 146 | + @PreAuthorize("@ss.hasPermission('crm:receivable:update')") | |
| 147 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmReceivableTransferReqVO reqVO) { | |
| 148 | + receivableService.transferReceivable(reqVO, getLoginUserId()); | |
| 149 | + return success(true); | |
| 150 | + } | |
| 151 | + | |
| 147 | 152 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java
| ... | ... | @@ -7,10 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | |
| 12 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; | |
| 13 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.*; | |
| 14 | 11 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert; |
| 15 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 16 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| ... | ... | @@ -151,4 +148,12 @@ public class CrmReceivablePlanController { |
| 151 | 148 | return CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList, receivableList); |
| 152 | 149 | } |
| 153 | 150 | |
| 151 | + @PutMapping("/transfer") | |
| 152 | + @Operation(summary = "回款计划转移") | |
| 153 | + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:update')") | |
| 154 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmReceivablePlanTransferReqVO reqVO) { | |
| 155 | + receivablePlanService.transferReceivablePlan(reqVO, getLoginUserId()); | |
| 156 | + return success(true); | |
| 157 | + } | |
| 158 | + | |
| 154 | 159 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 回款计划转移 Request VO") | |
| 9 | +@Data | |
| 10 | +public class CrmReceivablePlanTransferReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "回款计划编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 13 | + @NotNull(message = "回款计划编号不能为空") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 新负责人的用户编号 | |
| 18 | + */ | |
| 19 | + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 20 | + @NotNull(message = "新负责人的用户编号不能为空") | |
| 21 | + private Long newOwnerUserId; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 25 | + * | |
| 26 | + * 关联 {@link CrmPermissionLevelEnum} | |
| 27 | + */ | |
| 28 | + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | + private Integer oldOwnerPermissionLevel; | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 回款转移 Request VO") | |
| 9 | +@Data | |
| 10 | +public class CrmReceivableTransferReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "回款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 13 | + @NotNull(message = "回款编号不能为空") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 新负责人的用户编号 | |
| 18 | + */ | |
| 19 | + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | |
| 20 | + @NotNull(message = "新负责人的用户编号不能为空") | |
| 21 | + private Long newOwnerUserId; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 25 | + * | |
| 26 | + * 关联 {@link CrmPermissionLevelEnum} | |
| 27 | + */ | |
| 28 | + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | + private Integer oldOwnerPermissionLevel; | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/clue/CrmClueConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.convert.clue; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.*; |
| 10 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 6 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | |
| 7 | +import org.mapstruct.Mapper; | |
| 8 | +import org.mapstruct.Mapping; | |
| 9 | +import org.mapstruct.factory.Mappers; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * 线索 Convert |
| ... | ... | @@ -29,4 +30,7 @@ public interface CrmClueConvert { |
| 29 | 30 | |
| 30 | 31 | List<CrmClueExcelVO> convertList02(List<CrmClueDO> list); |
| 31 | 32 | |
| 33 | + @Mapping(target = "bizId", source = "reqVO.id") | |
| 34 | + CrmPermissionTransferReqBO convert(CrmClueTransferReqVO reqVO, Long userId); | |
| 35 | + | |
| 32 | 36 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java
| ... | ... | @@ -25,9 +25,9 @@ import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAnd |
| 25 | 25 | * @author 芋道源码 |
| 26 | 26 | */ |
| 27 | 27 | @Mapper |
| 28 | -public interface ContactConvert { | |
| 28 | +public interface CrmContactConvert { | |
| 29 | 29 | |
| 30 | - ContactConvert INSTANCE = Mappers.getMapper(ContactConvert.class); | |
| 30 | + CrmContactConvert INSTANCE = Mappers.getMapper(CrmContactConvert.class); | |
| 31 | 31 | |
| 32 | 32 | CrmContactDO convert(CrmContactCreateReqVO bean); |
| 33 | 33 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/CrmContractConvert.java
| ... | ... | @@ -22,9 +22,9 @@ import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAnd |
| 22 | 22 | * @author dhb52 |
| 23 | 23 | */ |
| 24 | 24 | @Mapper |
| 25 | -public interface ContractConvert { | |
| 25 | +public interface CrmContractConvert { | |
| 26 | 26 | |
| 27 | - ContractConvert INSTANCE = Mappers.getMapper(ContractConvert.class); | |
| 27 | + CrmContractConvert INSTANCE = Mappers.getMapper(CrmContractConvert.class); | |
| 28 | 28 | |
| 29 | 29 | CrmContractDO convert(CrmContractCreateReqVO bean); |
| 30 | 30 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java
| ... | ... | @@ -3,12 +3,15 @@ package cn.iocoder.yudao.module.crm.convert.receivable; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| 11 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | |
| 10 | 12 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 11 | 13 | import org.mapstruct.Mapper; |
| 14 | +import org.mapstruct.Mapping; | |
| 12 | 15 | import org.mapstruct.factory.Mappers; |
| 13 | 16 | |
| 14 | 17 | import java.util.List; |
| ... | ... | @@ -58,4 +61,7 @@ public interface CrmReceivableConvert { |
| 58 | 61 | findAndThen(userMap, Long.parseLong(receivable.getCreator()), user -> receivable.setCreatorName(user.getNickname())); |
| 59 | 62 | } |
| 60 | 63 | |
| 64 | + @Mapping(target = "bizId", source = "reqVO.id") | |
| 65 | + CrmPermissionTransferReqBO convert(CrmReceivableTransferReqVO reqVO, Long userId); | |
| 66 | + | |
| 61 | 67 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java
| ... | ... | @@ -3,13 +3,16 @@ package cn.iocoder.yudao.module.crm.convert.receivable; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| 12 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | |
| 11 | 13 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 12 | 14 | import org.mapstruct.Mapper; |
| 15 | +import org.mapstruct.Mapping; | |
| 13 | 16 | import org.mapstruct.factory.Mappers; |
| 14 | 17 | |
| 15 | 18 | import java.util.List; |
| ... | ... | @@ -63,4 +66,7 @@ public interface CrmReceivablePlanConvert { |
| 63 | 66 | findAndThen(userMap, Long.parseLong(receivablePlan.getCreator()), user -> receivablePlan.setCreatorName(user.getNickname())); |
| 64 | 67 | } |
| 65 | 68 | |
| 69 | + @Mapping(target = "bizId", source = "reqVO.id") | |
| 70 | + CrmPermissionTransferReqBO convert(CrmReceivablePlanTransferReqVO reqVO, Long userId); | |
| 71 | + | |
| 66 | 72 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueService.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.service.clue; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 8 | 9 | import jakarta.validation.Valid; |
| ... | ... | @@ -64,4 +65,12 @@ public interface CrmClueService { |
| 64 | 65 | */ |
| 65 | 66 | PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId); |
| 66 | 67 | |
| 68 | + /** | |
| 69 | + * 线索转移 | |
| 70 | + * | |
| 71 | + * @param reqVO 请求 | |
| 72 | + * @param userId 用户编号 | |
| 73 | + */ | |
| 74 | + void transferClue(CrmClueTransferReqVO reqVO, Long userId); | |
| 75 | + | |
| 67 | 76 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| ... | ... | @@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueCreateReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; | |
| 8 | 9 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueUpdateReqVO; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.convert.clue.CrmClueConvert; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| ... | ... | @@ -101,4 +102,18 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 101 | 102 | return clueMapper.selectPage(pageReqVO, userId); |
| 102 | 103 | } |
| 103 | 104 | |
| 105 | + @Override | |
| 106 | + public void transferClue(CrmClueTransferReqVO reqVO, Long userId) { | |
| 107 | + // 1 校验线索是否存在 | |
| 108 | + validateClueExists(reqVO.getId()); | |
| 109 | + | |
| 110 | + // 2.1 数据权限转移 | |
| 111 | + crmPermissionService.transferPermission( | |
| 112 | + CrmClueConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_LEADS.getType())); | |
| 113 | + // 2.2 设置新的负责人 | |
| 114 | + clueMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); | |
| 115 | + | |
| 116 | + // 3. TODO 记录转移日志 | |
| 117 | + } | |
| 118 | + | |
| 104 | 119 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.service.contact; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactPageReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| ... | ... | @@ -79,4 +80,12 @@ public interface CrmContactService { |
| 79 | 80 | */ |
| 80 | 81 | PageResult<CrmContactDO> getContactPageByCustomerId(CrmContactPageReqVO pageVO); |
| 81 | 82 | |
| 83 | + /** | |
| 84 | + * 联系人转移 | |
| 85 | + * | |
| 86 | + * @param reqVO 请求 | |
| 87 | + * @param userId 用户编号 | |
| 88 | + */ | |
| 89 | + void transferContact(CrmContactTransferReqVO reqVO, Long userId); | |
| 90 | + | |
| 82 | 91 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| ... | ... | @@ -3,11 +3,8 @@ 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; | |
| 10 | -import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; | |
| 7 | +import cn.iocoder.yudao.module.crm.convert.contact.CrmContactConvert; | |
| 11 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 12 | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.contact.CrmContactMapper; |
| 13 | 10 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| ... | ... | @@ -56,7 +53,7 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 56 | 53 | // 1.1 校验 |
| 57 | 54 | validateRelationDataExists(createReqVO); |
| 58 | 55 | // 1.2 插入 |
| 59 | - CrmContactDO contact = ContactConvert.INSTANCE.convert(createReqVO); | |
| 56 | + CrmContactDO contact = CrmContactConvert.INSTANCE.convert(createReqVO); | |
| 60 | 57 | contactMapper.insert(contact); |
| 61 | 58 | |
| 62 | 59 | // 2. 创建数据权限 |
| ... | ... | @@ -73,7 +70,7 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 73 | 70 | validateContactExists(updateReqVO.getId()); |
| 74 | 71 | validateRelationDataExists(updateReqVO); |
| 75 | 72 | // 2. 更新 |
| 76 | - CrmContactDO updateObj = ContactConvert.INSTANCE.convert(updateReqVO); | |
| 73 | + CrmContactDO updateObj = CrmContactConvert.INSTANCE.convert(updateReqVO); | |
| 77 | 74 | contactMapper.updateById(updateObj); |
| 78 | 75 | } |
| 79 | 76 | |
| ... | ... | @@ -139,4 +136,18 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 139 | 136 | return contactMapper.selectPageByCustomerId(pageVO); |
| 140 | 137 | } |
| 141 | 138 | |
| 139 | + @Override | |
| 140 | + public void transferContact(CrmContactTransferReqVO reqVO, Long userId) { | |
| 141 | + // 1 校验联系人是否存在 | |
| 142 | + validateContactExists(reqVO.getId()); | |
| 143 | + | |
| 144 | + // 2.1 数据权限转移 | |
| 145 | + crmPermissionService.transferPermission( | |
| 146 | + CrmContactConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_CONTACT.getType())); | |
| 147 | + // 2.2 设置新的负责人 | |
| 148 | + contactMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); | |
| 149 | + | |
| 150 | + // 3. TODO 记录转移日志 | |
| 151 | + } | |
| 152 | + | |
| 142 | 153 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| ... | ... | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreat |
| 7 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; |
| 10 | -import cn.iocoder.yudao.module.crm.convert.contract.ContractConvert; | |
| 10 | +import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; | |
| 11 | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 12 | 12 | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; |
| 13 | 13 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| ... | ... | @@ -44,7 +44,7 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 44 | 44 | @Override |
| 45 | 45 | public Long createContract(CrmContractCreateReqVO createReqVO, Long userId) { |
| 46 | 46 | // 插入 |
| 47 | - CrmContractDO contract = ContractConvert.INSTANCE.convert(createReqVO); | |
| 47 | + CrmContractDO contract = CrmContractConvert.INSTANCE.convert(createReqVO); | |
| 48 | 48 | contractMapper.insert(contract); |
| 49 | 49 | |
| 50 | 50 | // 创建数据权限 |
| ... | ... | @@ -61,7 +61,7 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 61 | 61 | // 校验存在 |
| 62 | 62 | validateContractExists(updateReqVO.getId()); |
| 63 | 63 | // 更新 |
| 64 | - CrmContractDO updateObj = ContractConvert.INSTANCE.convert(updateReqVO); | |
| 64 | + CrmContractDO updateObj = CrmContractConvert.INSTANCE.convert(updateReqVO); | |
| 65 | 65 | contractMapper.updateById(updateObj); |
| 66 | 66 | } |
| 67 | 67 | |
| ... | ... | @@ -118,7 +118,7 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 118 | 118 | |
| 119 | 119 | // 2.1 数据权限转移 |
| 120 | 120 | crmPermissionService.transferPermission( |
| 121 | - ContractConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_CONTRACT.getType())); | |
| 121 | + CrmContractConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_CONTRACT.getType())); | |
| 122 | 122 | // 2.2 设置负责人 |
| 123 | 123 | contractMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); |
| 124 | 124 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanService.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.service.receivable; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| ... | ... | @@ -77,4 +78,12 @@ public interface CrmReceivablePlanService { |
| 77 | 78 | */ |
| 78 | 79 | PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomerId(CrmReceivablePlanPageReqVO pageReqVO); |
| 79 | 80 | |
| 81 | + /** | |
| 82 | + * 回款计划转移 | |
| 83 | + * | |
| 84 | + * @param reqVO 请求 | |
| 85 | + * @param userId 用户编号 | |
| 86 | + */ | |
| 87 | + void transferReceivablePlan(CrmReceivablePlanTransferReqVO reqVO, Long userId); | |
| 88 | + | |
| 80 | 89 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanTransferReqVO; | |
| 9 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert; |
| 11 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| ... | ... | @@ -135,4 +136,18 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { |
| 135 | 136 | return receivablePlanMapper.selectPageByCustomerId(pageReqVO); |
| 136 | 137 | } |
| 137 | 138 | |
| 139 | + @Override | |
| 140 | + public void transferReceivablePlan(CrmReceivablePlanTransferReqVO reqVO, Long userId) { | |
| 141 | + // 1 校验回款计划是否存在 | |
| 142 | + validateReceivablePlanExists(reqVO.getId()); | |
| 143 | + | |
| 144 | + // 2.1 数据权限转移 | |
| 145 | + crmPermissionService.transferPermission( | |
| 146 | + CrmReceivablePlanConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType())); | |
| 147 | + // 2.2 设置新的负责人 | |
| 148 | + receivablePlanMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); | |
| 149 | + | |
| 150 | + // 3. TODO 记录转移日志 | |
| 151 | + } | |
| 152 | + | |
| 138 | 153 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.service.receivable; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableTransferReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| ... | ... | @@ -77,4 +78,12 @@ public interface CrmReceivableService { |
| 77 | 78 | */ |
| 78 | 79 | PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO); |
| 79 | 80 | |
| 81 | + /** | |
| 82 | + * 回款转移 | |
| 83 | + * | |
| 84 | + * @param reqVO 请求 | |
| 85 | + * @param userId 用户编号 | |
| 86 | + */ | |
| 87 | + void transferReceivable(CrmReceivableTransferReqVO reqVO, Long userId); | |
| 88 | + | |
| 80 | 89 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
| ... | ... | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableTransferReqVO; | |
| 10 | 11 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; |
| 11 | 12 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert; |
| 12 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| ... | ... | @@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 20 | 21 | import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; |
| 21 | 22 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 22 | 23 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 24 | +import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | |
| 23 | 25 | import jakarta.annotation.Resource; |
| 24 | 26 | import org.springframework.stereotype.Service; |
| 25 | 27 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -48,6 +50,8 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 48 | 50 | private CrmCustomerService customerService; |
| 49 | 51 | @Resource |
| 50 | 52 | private CrmReceivablePlanService receivablePlanService; |
| 53 | + @Resource | |
| 54 | + private CrmPermissionService crmPermissionService; | |
| 51 | 55 | |
| 52 | 56 | // TODO @liuhongfeng:创建还款后,是不是什么时候,要更新 plan? |
| 53 | 57 | @Override |
| ... | ... | @@ -70,22 +74,22 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 70 | 74 | // TODO @liuhongfeng:这里的括号要注意排版; |
| 71 | 75 | private void checkReceivable(CrmReceivableDO receivable) { |
| 72 | 76 | // TODO @liuhongfeng:这个放在参数校验合适 |
| 73 | - if(ObjectUtil.isNull(receivable.getContractId())){ | |
| 77 | + if (ObjectUtil.isNull(receivable.getContractId())) { | |
| 74 | 78 | throw exception(CONTRACT_NOT_EXISTS); |
| 75 | 79 | } |
| 76 | 80 | |
| 77 | 81 | CrmContractDO contract = contractService.getContract(receivable.getContractId()); |
| 78 | - if(ObjectUtil.isNull(contract)){ | |
| 82 | + if (ObjectUtil.isNull(contract)) { | |
| 79 | 83 | throw exception(CONTRACT_NOT_EXISTS); |
| 80 | 84 | } |
| 81 | 85 | |
| 82 | 86 | CrmCustomerDO customer = customerService.getCustomer(receivable.getCustomerId()); |
| 83 | - if(ObjectUtil.isNull(customer)){ | |
| 87 | + if (ObjectUtil.isNull(customer)) { | |
| 84 | 88 | throw exception(CUSTOMER_NOT_EXISTS); |
| 85 | 89 | } |
| 86 | 90 | |
| 87 | 91 | CrmReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(receivable.getPlanId()); |
| 88 | - if(ObjectUtil.isNull(receivablePlan)){ | |
| 92 | + if (ObjectUtil.isNull(receivablePlan)) { | |
| 89 | 93 | throw exception(RECEIVABLE_PLAN_NOT_EXISTS); |
| 90 | 94 | } |
| 91 | 95 | |
| ... | ... | @@ -140,4 +144,18 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 140 | 144 | return receivableMapper.selectPageByCustomerId(pageReqVO); |
| 141 | 145 | } |
| 142 | 146 | |
| 147 | + @Override | |
| 148 | + public void transferReceivable(CrmReceivableTransferReqVO reqVO, Long userId) { | |
| 149 | + // 1 校验回款是否存在 | |
| 150 | + validateReceivableExists(reqVO.getId()); | |
| 151 | + | |
| 152 | + // 2.1 数据权限转移 | |
| 153 | + crmPermissionService.transferPermission( | |
| 154 | + CrmReceivableConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_RECEIVABLE.getType())); | |
| 155 | + // 2.2 设置新的负责人 | |
| 156 | + receivableMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); | |
| 157 | + | |
| 158 | + // 3. TODO 记录转移日志 | |
| 159 | + } | |
| 160 | + | |
| 143 | 161 | } | ... | ... |