From 91dd61edc0c7a8b9db590892e8ee60a06096f731 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 1 Nov 2023 10:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20review=20=E6=8F=90?= =?UTF-8?q?=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/business/CrmBusinessController.java | 3 +- ...qVO.java => CrmBusinessTransferReqVO.java} | 4 +- .../admin/contact/ContactController.java | 2 +- .../contact/vo/CrmContactTransferReqVO.java | 38 +++++++++++++++++++ .../contact/vo/CrmTransferContactReqVO.java | 28 -------------- .../admin/contract/ContractController.java | 2 +- .../contract/vo/CrmContractTransferReqVO.java | 38 +++++++++++++++++++ .../contract/vo/CrmTransferContractReqVO.java | 29 -------------- .../admin/customer/CrmCustomerController.java | 2 +- .../customer/vo/CrmCustomerTransferReqVO.java | 38 +++++++++++++++++++ .../customer/vo/CrmTransferCustomerReqVO.java | 28 -------------- .../convert/business/CrmBusinessConvert.java | 2 +- .../crm/convert/contact/ContactConvert.java | 2 +- .../crm/convert/contract/ContractConvert.java | 2 +- .../convert/customer/CrmCustomerConvert.java | 2 +- .../permission/CrmPermissionDO.java | 2 + .../mysql/permission/CrmPermissionMapper.java | 13 +++++++ .../core/aop/CrmPermissionAspect.java | 4 +- .../service/business/CrmBusinessService.java | 2 +- .../business/CrmBusinessServiceImpl.java | 2 +- .../crm/service/contact/ContactService.java | 2 +- .../service/contact/ContactServiceImpl.java | 2 +- .../crm/service/contract/ContractService.java | 2 +- .../service/contract/ContractServiceImpl.java | 2 +- .../service/customer/CrmCustomerService.java | 2 +- .../customer/CrmCustomerServiceImpl.java | 2 +- .../permission/CrmPermissionService.java | 10 ++++- .../permission/CrmPermissionServiceImpl.java | 5 +++ 28 files changed, 164 insertions(+), 106 deletions(-) rename yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/{CrmTransferBusinessReqVO.java => CrmBusinessTransferReqVO.java} (88%) create mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java delete mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmTransferContactReqVO.java create mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java delete mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmTransferContractReqVO.java create mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java delete mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmTransferCustomerReqVO.java diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java index efff25372..eb83fa743 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java @@ -91,9 +91,10 @@ public class CrmBusinessController { @PutMapping("/transfer") @Operation(summary = "商机转移") @PreAuthorize("@ss.hasPermission('crm:business:update')") - public CommonResult transfer(@Valid @RequestBody CrmTransferBusinessReqVO reqVO) { + public CommonResult transfer(@Valid @RequestBody CrmBusinessTransferReqVO reqVO) { businessService.transferBusiness(reqVO, getLoginUserId()); return success(true); } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmTransferBusinessReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessTransferReqVO.java similarity index 88% rename from yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmTransferBusinessReqVO.java rename to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessTransferReqVO.java index 0d45718ff..aa85404a7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmTransferBusinessReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessTransferReqVO.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; @Schema(description = "管理后台 - 商机转移 Request VO") @Data -public class CrmTransferBusinessReqVO { +public class CrmBusinessTransferReqVO { @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") @NotNull(message = "联系人编号不能为空") @@ -18,7 +18,7 @@ public class CrmTransferBusinessReqVO { * 新负责人的用户编号 */ @NotNull(message = "新负责人的用户编号不能为空") - @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") private Long newOwnerUserId; /** diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java index cda6b29b9..5d92abc45 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java @@ -100,7 +100,7 @@ public class ContactController { @PutMapping("/transfer") @Operation(summary = "联系人转移") @PreAuthorize("@ss.hasPermission('crm:contact:update')") - public CommonResult transfer(@Valid @RequestBody CrmTransferContactReqVO reqVO) { + public CommonResult transfer(@Valid @RequestBody CrmContactTransferReqVO reqVO) { contactService.transferContact(reqVO, getLoginUserId()); return success(true); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java new file mode 100644 index 000000000..fa8940ea3 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; + +import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - CRM 联系人转移 Request VO") +@Data +public class CrmContactTransferReqVO { + + @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + @NotNull(message = "联系人编号不能为空") + private Long id; + + /** + * 新负责人的用户编号 + */ + @NotNull(message = "新负责人的用户编号不能为空") + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + private Long newOwnerUserId; + + /** + * 老负责人是否加入团队,是/否 + */ + @Schema(description = "老负责人是否加入团队", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + @NotNull(message = "老负责人是否加入团队不能为空") + private Boolean joinTeam; + + /** + * 老负责人加入团队后的权限级别。如果 {@link #joinTeam} 为 false, permissionLevel 为 null + * 关联 {@link CrmPermissionLevelEnum} + */ + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer permissionLevel; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmTransferContactReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmTransferContactReqVO.java deleted file mode 100644 index 1e16d2d20..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmTransferContactReqVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -@Schema(description = "管理后台 - CRM 联系人转移 Request VO") -@Data -public class CrmTransferContactReqVO { - - @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "联系人编号不能为空") - private Long id; - - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "新负责人的用户编号不能为空") - private Long ownerUserId; - - @Schema(description = "原负责人移除方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "原负责人移除方式不能为空") - private Integer transferType; - - @Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "权限类型不能为空") - private Integer permissionType; - -} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java index d875b21e3..1028929db 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java @@ -90,7 +90,7 @@ public class ContractController { @PutMapping("/transfer") @Operation(summary = "合同转移") @PreAuthorize("@ss.hasPermission('crm:contract:update')") - public CommonResult transfer(@Valid @RequestBody CrmTransferContractReqVO reqVO) { + public CommonResult transfer(@Valid @RequestBody CrmContractTransferReqVO reqVO) { contractService.transferContract(reqVO, getLoginUserId()); return success(true); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java new file mode 100644 index 000000000..cf3e0effe --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; + +import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - CRM 合同转移 Request VO") +@Data +public class CrmContractTransferReqVO { + + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + @NotNull(message = "联系人编号不能为空") + private Long id; + + /** + * 新负责人的用户编号 + */ + @NotNull(message = "新负责人的用户编号不能为空") + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + private Long newOwnerUserId; + + /** + * 老负责人是否加入团队,是/否 + */ + @Schema(description = "老负责人是否加入团队", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + @NotNull(message = "老负责人是否加入团队不能为空") + private Boolean joinTeam; + + /** + * 老负责人加入团队后的权限级别。如果 {@link #joinTeam} 为 false, permissionLevel 为 null + * 关联 {@link CrmPermissionLevelEnum} + */ + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer permissionLevel; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmTransferContractReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmTransferContractReqVO.java deleted file mode 100644 index a987c9f89..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmTransferContractReqVO.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -// TODO @puhui999:CrmContractTransferReqVO,模块名字要放前面;看看还有没其它类似的 -@Schema(description = "管理后台 - CRM 合同转移 Request VO") -@Data -public class CrmTransferContractReqVO { - - @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "合同编号不能为空") - private Long id; - - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "新负责人的用户编号不能为空") - private Long ownerUserId; - - @Schema(description = "原负责人移除方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "原负责人移除方式不能为空") - private Integer transferType; - - @Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "权限类型不能为空") - private Integer permissionType; - -} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java index ff144ffbf..c44c12b70 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java @@ -90,7 +90,7 @@ public class CrmCustomerController { @PutMapping("/transfer") @Operation(summary = "客户转移") @PreAuthorize("@ss.hasPermission('crm:customer:update')") - public CommonResult transfer(@Valid @RequestBody CrmTransferCustomerReqVO reqVO) { + public CommonResult transfer(@Valid @RequestBody CrmCustomerTransferReqVO reqVO) { customerService.transferCustomer(reqVO, getLoginUserId()); return success(true); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java new file mode 100644 index 000000000..20f895197 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; + +import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - CRM 客户转移 Request VO") +@Data +public class CrmCustomerTransferReqVO { + + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + @NotNull(message = "联系人编号不能为空") + private Long id; + + /** + * 新负责人的用户编号 + */ + @NotNull(message = "新负责人的用户编号不能为空") + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") + private Long newOwnerUserId; + + /** + * 老负责人是否加入团队,是/否 + */ + @Schema(description = "老负责人是否加入团队", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + @NotNull(message = "老负责人是否加入团队不能为空") + private Boolean joinTeam; + + /** + * 老负责人加入团队后的权限级别。如果 {@link #joinTeam} 为 false, permissionLevel 为 null + * 关联 {@link CrmPermissionLevelEnum} + */ + @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer permissionLevel; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmTransferCustomerReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmTransferCustomerReqVO.java deleted file mode 100644 index 78ca15aca..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmTransferCustomerReqVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -@Schema(description = "管理后台 - CRM 客户转移 Request VO") -@Data -public class CrmTransferCustomerReqVO { - - @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "客户编号不能为空") - private Long id; - - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "新负责人的用户编号不能为空") - private Long ownerUserId; - - @Schema(description = "原负责人移除方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "原负责人移除方式不能为空") - private Integer transferType; - - @Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "权限类型不能为空") - private Integer permissionType; - -} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java index 6fa7e016e..3c27c0ce3 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java @@ -35,6 +35,6 @@ public interface CrmBusinessConvert { @Mapping(target = "bizId", source = "reqVO.id"), @Mapping(target = "newOwnerUserId", source = "reqVO.id") }) - CrmTransferPermissionReqBO convert(CrmTransferBusinessReqVO reqVO, Long userId); + CrmTransferPermissionReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java index d866de34f..b4cc69963 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java @@ -37,6 +37,6 @@ public interface ContactConvert { @Mapping(target = "bizId", source = "reqVO.id"), @Mapping(target = "newOwnerUserId", source = "reqVO.id") }) - CrmTransferPermissionReqBO convert(CrmTransferContactReqVO reqVO, Long userId); + CrmTransferPermissionReqBO convert(CrmContactTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java index b81aed452..7f629ef8c 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java @@ -37,6 +37,6 @@ public interface ContractConvert { @Mapping(target = "bizId", source = "reqVO.id"), @Mapping(target = "newOwnerUserId", source = "reqVO.id") }) - CrmTransferPermissionReqBO convert(CrmTransferContractReqVO reqVO, Long userId); + CrmTransferPermissionReqBO convert(CrmContractTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java index 0112cd20e..6aa86218c 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java @@ -35,6 +35,6 @@ public interface CrmCustomerConvert { @Mapping(target = "bizId", source = "reqVO.id"), @Mapping(target = "newOwnerUserId", source = "reqVO.id") }) - CrmTransferPermissionReqBO convert(CrmTransferCustomerReqVO reqVO, Long userId); + CrmTransferPermissionReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java index b9dfabfd5..2601b5d09 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java @@ -42,6 +42,8 @@ public class CrmPermissionDO extends BaseDO { private Long userId; /** * 权限级别,关联 {@link CrmPermissionLevelEnum} + * 如果为公海数据的话会干掉此数据的负责人,领取人则上位负责人 + * 例:客户放入公海后会干掉团队成员中的负责人,而其他团队成员则不受影响 */ private Integer permissionLevel; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java index 00640b4ba..c2db6acbf 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java @@ -44,4 +44,17 @@ public interface CrmPermissionMapper extends BaseMapperX { .eq(CrmPermissionDO::getBizId, bizId)); } + /** + * 获取数据权限列表通过 数据类型 x 用户编号。如果 + * + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} + * @param userId + * @return Crm 数据权限列表 + */ + default List selectByBizTypeAndUserId(Integer bizType, Long userId) { + return selectList(new LambdaQueryWrapperX() + .eq(CrmPermissionDO::getBizType, bizType) + .eq(CrmPermissionDO::getUserId, userId)); + } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/core/aop/CrmPermissionAspect.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/core/aop/CrmPermissionAspect.java index 7635d6333..ee921d2c7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/core/aop/CrmPermissionAspect.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/core/aop/CrmPermissionAspect.java @@ -80,8 +80,8 @@ public class CrmPermissionAspect { return; } if (isRead(permissionLevel)) { // 读权限 - // 如果没有数据权限或没有负责人则表示此记录为公海数据所有人都有只读权限 - if (!CollUtil.anyMatch(bizPermissions, item -> isOwner(item.getPermissionLevel()))) { + // 如果没有数据权限或没有负责人则表示此记录为公海数据所有人都有只读权限可以领取成为负责人(团队成员领取的) + if (CollUtil.isEmpty(bizPermissions) || !CollUtil.anyMatch(bizPermissions, item -> isOwner(item.getPermissionLevel()))) { return; } if (isRead(userPermission.getPermissionLevel())) { // 校验当前用户是否有读权限 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java index 63baad383..aeee4b426 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java @@ -76,6 +76,6 @@ public interface CrmBusinessService { * @param reqVO 请求 * @param userId 用户编号 */ - void transferBusiness(CrmTransferBusinessReqVO reqVO, Long userId); + void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java index c3a262253..b3e1b9790 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java @@ -109,7 +109,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { @Override @Transactional(rollbackFor = Exception.class) - public void transferBusiness(CrmTransferBusinessReqVO reqVO, Long userId) { + public void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId) { // 1 校验商机是否存在 validateBusinessExists(reqVO.getId()); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactService.java index 6da77138e..ecb6fd577 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactService.java @@ -76,6 +76,6 @@ public interface ContactService { * @param reqVO 请求 * @param userId 用户编号 */ - void transferContact(CrmTransferContactReqVO reqVO, Long userId); + void transferContact(CrmContactTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java index b1ca89e78..550829fbe 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java @@ -110,7 +110,7 @@ public class ContactServiceImpl implements ContactService { } @Override - public void transferContact(CrmTransferContactReqVO reqVO, Long userId) { + public void transferContact(CrmContactTransferReqVO reqVO, Long userId) { // 1 校验联系人是否存在 validateContactExists(reqVO.getId()); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractService.java index 8cf41c152..201684bd8 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractService.java @@ -76,6 +76,6 @@ public interface ContractService { * @param reqVO 请求 * @param userId 用户编号 */ - void transferContract(CrmTransferContractReqVO reqVO, Long userId); + void transferContract(CrmContractTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java index f053821b0..c4b144462 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java @@ -108,7 +108,7 @@ public class ContractServiceImpl implements ContractService { @Override @Transactional(rollbackFor = Exception.class) - public void transferContract(CrmTransferContractReqVO reqVO, Long userId) { + public void transferContract(CrmContractTransferReqVO reqVO, Long userId) { // 1 校验合同是否存在 validateContractExists(reqVO.getId()); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java index 576a9bcbc..5f64142b2 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java @@ -84,6 +84,6 @@ public interface CrmCustomerService { * @param reqVO 请求 * @param userId 用户编号 */ - void transferCustomer(CrmTransferCustomerReqVO reqVO, Long userId); + void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index 7e23d4de6..87d23a25f 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -131,7 +131,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @Override @Transactional(rollbackFor = Exception.class) - public void transferCustomer(CrmTransferCustomerReqVO reqVO, Long userId) { + public void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId) { // 1. 校验合同是否存在 validateCustomer(reqVO.getId()); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java index e85c8c1b5..5e2daef08 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java @@ -17,7 +17,6 @@ import java.util.List; */ public interface CrmPermissionService { - // TODO @puhui999:方法名上,不用 Crm /** * 创建数据权限 * @@ -59,6 +58,15 @@ public interface CrmPermissionService { */ List getPermissionByBizTypeAndBizId(Integer bizType, Long bizId); + /** + * 获取数据权限列表,通过 数据类型 x 用户编号 + * + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} + * @param userId 用户编号 + * @return Crm 数据权限列表 + */ + List getPermissionByBizTypeAndUserId(Integer bizType, Long userId); + /** * 数据权限转移 * diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java index b962bcdda..8d4047741 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java @@ -73,6 +73,11 @@ public class CrmPermissionServiceImpl implements CrmPermissionService { return crmPermissionMapper.selectByBizTypeAndBizId(bizType, bizId); } + @Override + public List getPermissionByBizTypeAndUserId(Integer bizType, Long userId) { + return crmPermissionMapper.selectByBizTypeAndUserId(bizType, userId); + } + private void validateCrmPermissionExists(Long id) { if (crmPermissionMapper.selectById(id) == null) { throw exception(CRM_PERMISSION_NOT_EXISTS);