Commit c2fd8179891a061e2b9080ec1198871d145571f5
1 parent
e6eaa3a2
完善 CRM-客户 数据权限校验
Showing
23 changed files
with
129 additions
and
70 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| @@ -92,7 +92,7 @@ public class CrmBusinessController { | @@ -92,7 +92,7 @@ public class CrmBusinessController { | ||
| 92 | @Operation(summary = "商机转移") | 92 | @Operation(summary = "商机转移") |
| 93 | @PreAuthorize("@ss.hasPermission('crm:business:update')") | 93 | @PreAuthorize("@ss.hasPermission('crm:business:update')") |
| 94 | public CommonResult<Boolean> transfer(@Valid @RequestBody CrmTransferBusinessReqVO reqVO) { | 94 | public CommonResult<Boolean> transfer(@Valid @RequestBody CrmTransferBusinessReqVO reqVO) { |
| 95 | - businessService.businessTransfer(reqVO, getLoginUserId()); | 95 | + businessService.transferBusiness(reqVO, getLoginUserId()); |
| 96 | return success(true); | 96 | return success(true); |
| 97 | } | 97 | } |
| 98 | 98 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java
| @@ -100,8 +100,8 @@ public class ContactController { | @@ -100,8 +100,8 @@ public class ContactController { | ||
| 100 | @PutMapping("/transfer") | 100 | @PutMapping("/transfer") |
| 101 | @Operation(summary = "联系人转移") | 101 | @Operation(summary = "联系人转移") |
| 102 | @PreAuthorize("@ss.hasPermission('crm:contact:update')") | 102 | @PreAuthorize("@ss.hasPermission('crm:contact:update')") |
| 103 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContactTransferReqVO reqVO) { | ||
| 104 | - contactService.contactTransfer(reqVO, getLoginUserId()); | 103 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmTransferContactReqVO reqVO) { |
| 104 | + contactService.transferContact(reqVO, getLoginUserId()); | ||
| 105 | return success(true); | 105 | return success(true); |
| 106 | } | 106 | } |
| 107 | 107 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmTransferContactReqVO.java
| @@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull; | @@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull; | ||
| 7 | 7 | ||
| 8 | @Schema(description = "管理后台 - 联系人转移 Request VO") | 8 | @Schema(description = "管理后台 - 联系人转移 Request VO") |
| 9 | @Data | 9 | @Data |
| 10 | -public class CrmContactTransferReqVO { | 10 | +public class CrmTransferContactReqVO { |
| 11 | 11 | ||
| 12 | @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 12 | @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 13 | @NotNull(message = "联系人编号不能为空") | 13 | @NotNull(message = "联系人编号不能为空") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java
| @@ -90,8 +90,8 @@ public class ContractController { | @@ -90,8 +90,8 @@ public class ContractController { | ||
| 90 | @PutMapping("/transfer") | 90 | @PutMapping("/transfer") |
| 91 | @Operation(summary = "合同转移") | 91 | @Operation(summary = "合同转移") |
| 92 | @PreAuthorize("@ss.hasPermission('crm:contract:update')") | 92 | @PreAuthorize("@ss.hasPermission('crm:contract:update')") |
| 93 | - public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContractTransferReqVO reqVO) { | ||
| 94 | - contractService.contractTransfer(reqVO, getLoginUserId()); | 93 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmTransferContractReqVO reqVO) { |
| 94 | + contractService.transferContract(reqVO, getLoginUserId()); | ||
| 95 | return success(true); | 95 | return success(true); |
| 96 | } | 96 | } |
| 97 | 97 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmTransferContractReqVO.java
| @@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull; | @@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull; | ||
| 7 | 7 | ||
| 8 | @Schema(description = "管理后台 - 合同转移 Request VO") | 8 | @Schema(description = "管理后台 - 合同转移 Request VO") |
| 9 | @Data | 9 | @Data |
| 10 | -public class CrmContractTransferReqVO { | 10 | +public class CrmTransferContractReqVO { |
| 11 | 11 | ||
| 12 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 12 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 13 | @NotNull(message = "合同编号不能为空") | 13 | @NotNull(message = "合同编号不能为空") |
| @@ -17,4 +17,12 @@ public class CrmContractTransferReqVO { | @@ -17,4 +17,12 @@ public class CrmContractTransferReqVO { | ||
| 17 | @NotNull(message = "新负责人的用户编号不能为空") | 17 | @NotNull(message = "新负责人的用户编号不能为空") |
| 18 | private Long ownerUserId; | 18 | private Long ownerUserId; |
| 19 | 19 | ||
| 20 | + @Schema(description = "原负责人移除方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 21 | + @NotNull(message = "原负责人移除方式不能为空") | ||
| 22 | + private Integer transferType; | ||
| 23 | + | ||
| 24 | + @Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 25 | + @NotNull(message = "权限类型不能为空") | ||
| 26 | + private Integer permissionType; | ||
| 27 | + | ||
| 20 | } | 28 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| @@ -23,6 +23,7 @@ import java.util.List; | @@ -23,6 +23,7 @@ import java.util.List; | ||
| 23 | 23 | ||
| 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 25 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 25 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 26 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 26 | 27 | ||
| 27 | @Tag(name = "管理后台 - 客户") | 28 | @Tag(name = "管理后台 - 客户") |
| 28 | @RestController | 29 | @RestController |
| @@ -37,7 +38,7 @@ public class CrmCustomerController { | @@ -37,7 +38,7 @@ public class CrmCustomerController { | ||
| 37 | @Operation(summary = "创建客户") | 38 | @Operation(summary = "创建客户") |
| 38 | @PreAuthorize("@ss.hasPermission('crm:customer:create')") | 39 | @PreAuthorize("@ss.hasPermission('crm:customer:create')") |
| 39 | public CommonResult<Long> createCustomer(@Valid @RequestBody CrmCustomerCreateReqVO createReqVO) { | 40 | public CommonResult<Long> createCustomer(@Valid @RequestBody CrmCustomerCreateReqVO createReqVO) { |
| 40 | - return success(customerService.createCustomer(createReqVO)); | 41 | + return success(customerService.createCustomer(createReqVO, getLoginUserId())); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | @PutMapping("/update") | 44 | @PutMapping("/update") |
| @@ -86,4 +87,12 @@ public class CrmCustomerController { | @@ -86,4 +87,12 @@ public class CrmCustomerController { | ||
| 86 | ExcelUtils.write(response, "客户.xls", "数据", CrmCustomerExcelVO.class, datas); | 87 | ExcelUtils.write(response, "客户.xls", "数据", CrmCustomerExcelVO.class, datas); |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 90 | + @PutMapping("/transfer") | ||
| 91 | + @Operation(summary = "客户转移") | ||
| 92 | + @PreAuthorize("@ss.hasPermission('crm:customer:update')") | ||
| 93 | + public CommonResult<Boolean> transfer(@Valid @RequestBody CrmTransferCustomerReqVO reqVO) { | ||
| 94 | + customerService.transferCustomer(reqVO, getLoginUserId()); | ||
| 95 | + return success(true); | ||
| 96 | + } | ||
| 97 | + | ||
| 89 | } | 98 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmTransferCustomerReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 客户转移 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class CrmTransferCustomerReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 13 | + @NotNull(message = "客户编号不能为空") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 17 | + @NotNull(message = "新负责人的用户编号不能为空") | ||
| 18 | + private Long ownerUserId; | ||
| 19 | + | ||
| 20 | + @Schema(description = "原负责人移除方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 21 | + @NotNull(message = "原负责人移除方式不能为空") | ||
| 22 | + private Integer transferType; | ||
| 23 | + | ||
| 24 | + @Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 25 | + @NotNull(message = "权限类型不能为空") | ||
| 26 | + private Integer permissionType; | ||
| 27 | + | ||
| 28 | +} |
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 { | @@ -37,6 +37,6 @@ public interface ContactConvert { | ||
| 37 | @Mapping(target = "userId", source = "userId"), | 37 | @Mapping(target = "userId", source = "userId"), |
| 38 | @Mapping(target = "crmDataId", source = "reqVO.id") | 38 | @Mapping(target = "crmDataId", source = "reqVO.id") |
| 39 | }) | 39 | }) |
| 40 | - TransferCrmPermissionBO convert(CrmContactTransferReqVO reqVO, Long userId); | 40 | + TransferCrmPermissionBO convert(CrmTransferContactReqVO reqVO, Long userId); |
| 41 | 41 | ||
| 42 | } | 42 | } |
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 { | @@ -37,6 +37,6 @@ public interface ContractConvert { | ||
| 37 | @Mapping(target = "userId", source = "userId"), | 37 | @Mapping(target = "userId", source = "userId"), |
| 38 | @Mapping(target = "crmDataId", source = "reqVO.id") | 38 | @Mapping(target = "crmDataId", source = "reqVO.id") |
| 39 | }) | 39 | }) |
| 40 | - TransferCrmPermissionBO convert(CrmContractTransferReqVO reqVO, Long userId); | 40 | + TransferCrmPermissionBO convert(CrmTransferContractReqVO reqVO, Long userId); |
| 41 | 41 | ||
| 42 | } | 42 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.customer; | 1 | package cn.iocoder.yudao.module.crm.convert.customer; |
| 2 | 2 | ||
| 3 | -import java.util.*; | ||
| 4 | - | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | ||
| 7 | -import org.mapstruct.Mapper; | ||
| 8 | -import org.mapstruct.factory.Mappers; | ||
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 6 | +import cn.iocoder.yudao.module.crm.service.permission.bo.TransferCrmPermissionBO; | ||
| 7 | +import org.mapstruct.Mapper; | ||
| 8 | +import org.mapstruct.Mapping; | ||
| 9 | +import org.mapstruct.Mappings; | ||
| 10 | +import org.mapstruct.factory.Mappers; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 11 | 13 | ||
| 12 | /** | 14 | /** |
| 13 | * 客户 Convert | 15 | * 客户 Convert |
| @@ -29,4 +31,10 @@ public interface CrmCustomerConvert { | @@ -29,4 +31,10 @@ public interface CrmCustomerConvert { | ||
| 29 | 31 | ||
| 30 | List<CrmCustomerExcelVO> convertList02(List<CrmCustomerDO> list); | 32 | List<CrmCustomerExcelVO> convertList02(List<CrmCustomerDO> list); |
| 31 | 33 | ||
| 34 | + @Mappings({ | ||
| 35 | + @Mapping(target = "userId", source = "userId"), | ||
| 36 | + @Mapping(target = "crmDataId", source = "reqVO.id") | ||
| 37 | + }) | ||
| 38 | + TransferCrmPermissionBO convert(CrmTransferCustomerReqVO reqVO, Long userId); | ||
| 39 | + | ||
| 32 | } | 40 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
| 1 | package cn.iocoder.yudao.module.crm.dal.mysql.clue; | 1 | package cn.iocoder.yudao.module.crm.dal.mysql.clue; |
| 2 | 2 | ||
| 3 | -import java.util.*; | ||
| 4 | - | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.*; | 10 | + |
| 11 | +import java.util.List; | ||
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * 线索 Mapper | 14 | * 线索 Mapper |
| @@ -35,7 +36,6 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { | @@ -35,7 +36,6 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { | ||
| 35 | .likeIfPresent(CrmClueDO::getTelephone, reqVO.getTelephone()) | 36 | .likeIfPresent(CrmClueDO::getTelephone, reqVO.getTelephone()) |
| 36 | .likeIfPresent(CrmClueDO::getMobile, reqVO.getMobile()) | 37 | .likeIfPresent(CrmClueDO::getMobile, reqVO.getMobile()) |
| 37 | .likeIfPresent(CrmClueDO::getAddress, reqVO.getAddress()) | 38 | .likeIfPresent(CrmClueDO::getAddress, reqVO.getAddress()) |
| 38 | - .eqIfPresent(CrmClueDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 39 | .betweenIfPresent(CrmClueDO::getContactLastTime, reqVO.getContactLastTime()) | 39 | .betweenIfPresent(CrmClueDO::getContactLastTime, reqVO.getContactLastTime()) |
| 40 | .betweenIfPresent(CrmClueDO::getCreateTime, reqVO.getCreateTime()) | 40 | .betweenIfPresent(CrmClueDO::getCreateTime, reqVO.getCreateTime()) |
| 41 | .orderByDesc(CrmClueDO::getId)); | 41 | .orderByDesc(CrmClueDO::getId)); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/ContactMapper.java
| 1 | package cn.iocoder.yudao.module.crm.dal.mysql.contact; | 1 | package cn.iocoder.yudao.module.crm.dal.mysql.contact; |
| 2 | 2 | ||
| 3 | -import java.util.*; | ||
| 4 | - | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactPageReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; | 10 | + |
| 11 | +import java.util.List; | ||
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * crm联系人 Mapper | 14 | * crm联系人 Mapper |
| @@ -28,7 +29,6 @@ public interface ContactMapper extends BaseMapperX<ContactDO> { | @@ -28,7 +29,6 @@ public interface ContactMapper extends BaseMapperX<ContactDO> { | ||
| 28 | .eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId()) | 29 | .eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId()) |
| 29 | .eqIfPresent(ContactDO::getAddress, reqVO.getAddress()) | 30 | .eqIfPresent(ContactDO::getAddress, reqVO.getAddress()) |
| 30 | .eqIfPresent(ContactDO::getRemark, reqVO.getRemark()) | 31 | .eqIfPresent(ContactDO::getRemark, reqVO.getRemark()) |
| 31 | - .eqIfPresent(ContactDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 32 | .betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime()) | 32 | .betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime()) |
| 33 | .betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime()) | 33 | .betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime()) |
| 34 | .orderByDesc(ContactDO::getId)); | 34 | .orderByDesc(ContactDO::getId)); |
| @@ -45,7 +45,6 @@ public interface ContactMapper extends BaseMapperX<ContactDO> { | @@ -45,7 +45,6 @@ public interface ContactMapper extends BaseMapperX<ContactDO> { | ||
| 45 | .eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId()) | 45 | .eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId()) |
| 46 | .eqIfPresent(ContactDO::getAddress, reqVO.getAddress()) | 46 | .eqIfPresent(ContactDO::getAddress, reqVO.getAddress()) |
| 47 | .eqIfPresent(ContactDO::getRemark, reqVO.getRemark()) | 47 | .eqIfPresent(ContactDO::getRemark, reqVO.getRemark()) |
| 48 | - .eqIfPresent(ContactDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 49 | .betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime()) | 48 | .betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime()) |
| 50 | .betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime()) | 49 | .betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime()) |
| 51 | .orderByDesc(ContactDO::getId)); | 50 | .orderByDesc(ContactDO::getId)); |
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 { | @@ -76,6 +76,6 @@ public interface CrmBusinessService { | ||
| 76 | * @param reqVO 请求 | 76 | * @param reqVO 请求 |
| 77 | * @param userId 用户编号 | 77 | * @param userId 用户编号 |
| 78 | */ | 78 | */ |
| 79 | - void businessTransfer(CrmTransferBusinessReqVO reqVO, Long userId); | 79 | + void transferBusiness(CrmTransferBusinessReqVO reqVO, Long userId); |
| 80 | 80 | ||
| 81 | } | 81 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -12,7 +12,6 @@ import cn.iocoder.yudao.module.crm.framework.enums.CrmEnum; | @@ -12,7 +12,6 @@ import cn.iocoder.yudao.module.crm.framework.enums.CrmEnum; | ||
| 12 | import cn.iocoder.yudao.module.crm.framework.enums.OperationTypeEnum; | 12 | import cn.iocoder.yudao.module.crm.framework.enums.OperationTypeEnum; |
| 13 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 13 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 14 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateBO; | 14 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateBO; |
| 15 | -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 16 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
| 18 | import org.springframework.validation.annotation.Validated; | 17 | import org.springframework.validation.annotation.Validated; |
| @@ -37,8 +36,6 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -37,8 +36,6 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 37 | private CrmBusinessMapper businessMapper; | 36 | private CrmBusinessMapper businessMapper; |
| 38 | 37 | ||
| 39 | @Resource | 38 | @Resource |
| 40 | - private AdminUserApi adminUserApi; | ||
| 41 | - @Resource | ||
| 42 | private CrmPermissionService crmPermissionService; | 39 | private CrmPermissionService crmPermissionService; |
| 43 | 40 | ||
| 44 | @Override | 41 | @Override |
| @@ -111,7 +108,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -111,7 +108,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 111 | 108 | ||
| 112 | @Override | 109 | @Override |
| 113 | @Transactional(rollbackFor = Exception.class) | 110 | @Transactional(rollbackFor = Exception.class) |
| 114 | - public void businessTransfer(CrmTransferBusinessReqVO reqVO, Long userId) { | 111 | + public void transferBusiness(CrmTransferBusinessReqVO reqVO, Long userId) { |
| 115 | // 1 校验商机是否存在 | 112 | // 1 校验商机是否存在 |
| 116 | validateBusinessExists(reqVO.getId()); | 113 | validateBusinessExists(reqVO.getId()); |
| 117 | 114 |
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 { | @@ -76,6 +76,6 @@ public interface ContactService { | ||
| 76 | * @param reqVO 请求 | 76 | * @param reqVO 请求 |
| 77 | * @param userId 用户编号 | 77 | * @param userId 用户编号 |
| 78 | */ | 78 | */ |
| 79 | - void contactTransfer(CrmContactTransferReqVO reqVO, Long userId); | 79 | + void transferContact(CrmTransferContactReqVO reqVO, Long userId); |
| 80 | 80 | ||
| 81 | } | 81 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java
| @@ -109,7 +109,7 @@ public class ContactServiceImpl implements ContactService { | @@ -109,7 +109,7 @@ public class ContactServiceImpl implements ContactService { | ||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | @Override | 111 | @Override |
| 112 | - public void contactTransfer(CrmContactTransferReqVO reqVO, Long userId) { | 112 | + public void transferContact(CrmTransferContactReqVO reqVO, Long userId) { |
| 113 | // 1 校验联系人是否存在 | 113 | // 1 校验联系人是否存在 |
| 114 | validateContactExists(reqVO.getId()); | 114 | validateContactExists(reqVO.getId()); |
| 115 | 115 |
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 { | @@ -76,6 +76,6 @@ public interface ContractService { | ||
| 76 | * @param reqVO 请求 | 76 | * @param reqVO 请求 |
| 77 | * @param userId 用户编号 | 77 | * @param userId 用户编号 |
| 78 | */ | 78 | */ |
| 79 | - void contractTransfer(CrmContractTransferReqVO reqVO, Long userId); | 79 | + void transferContract(CrmTransferContractReqVO reqVO, Long userId); |
| 80 | 80 | ||
| 81 | } | 81 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java
| @@ -107,7 +107,7 @@ public class ContractServiceImpl implements ContractService { | @@ -107,7 +107,7 @@ public class ContractServiceImpl implements ContractService { | ||
| 107 | 107 | ||
| 108 | @Override | 108 | @Override |
| 109 | @Transactional(rollbackFor = Exception.class) | 109 | @Transactional(rollbackFor = Exception.class) |
| 110 | - public void contractTransfer(CrmContractTransferReqVO reqVO, Long userId) { | 110 | + public void transferContract(CrmTransferContractReqVO reqVO, Long userId) { |
| 111 | // 1 校验合同是否存在 | 111 | // 1 校验合同是否存在 |
| 112 | validateContractExists(reqVO.getId()); | 112 | validateContractExists(reqVO.getId()); |
| 113 | 113 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
| 1 | package cn.iocoder.yudao.module.crm.service.customer; | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | 6 | ||
| 10 | import javax.validation.Valid; | 7 | import javax.validation.Valid; |
| @@ -22,9 +19,10 @@ public interface CrmCustomerService { | @@ -22,9 +19,10 @@ public interface CrmCustomerService { | ||
| 22 | * 创建客户 | 19 | * 创建客户 |
| 23 | * | 20 | * |
| 24 | * @param createReqVO 创建信息 | 21 | * @param createReqVO 创建信息 |
| 22 | + * @param userId 用户编号 | ||
| 25 | * @return 编号 | 23 | * @return 编号 |
| 26 | */ | 24 | */ |
| 27 | - Long createCustomer(@Valid CrmCustomerCreateReqVO createReqVO); | 25 | + Long createCustomer(@Valid CrmCustomerCreateReqVO createReqVO, Long userId); |
| 28 | 26 | ||
| 29 | /** | 27 | /** |
| 30 | * 更新客户 | 28 | * 更新客户 |
| @@ -80,4 +78,12 @@ public interface CrmCustomerService { | @@ -80,4 +78,12 @@ public interface CrmCustomerService { | ||
| 80 | */ | 78 | */ |
| 81 | CrmCustomerDO validateCustomer(Long customerId); | 79 | CrmCustomerDO validateCustomer(Long customerId); |
| 82 | 80 | ||
| 81 | + /** | ||
| 82 | + * 客户转移 | ||
| 83 | + * | ||
| 84 | + * @param reqVO 请求 | ||
| 85 | + * @param userId 用户编号 | ||
| 86 | + */ | ||
| 87 | + void transferCustomer(CrmTransferCustomerReqVO reqVO, Long userId); | ||
| 88 | + | ||
| 83 | } | 89 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| @@ -3,15 +3,18 @@ package cn.iocoder.yudao.module.crm.service.customer; | @@ -3,15 +3,18 @@ package cn.iocoder.yudao.module.crm.service.customer; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.collection.ListUtil; | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | ||
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 10 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | 7 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; |
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 12 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; |
| 10 | +import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; | ||
| 11 | +import cn.iocoder.yudao.module.crm.framework.enums.CrmEnum; | ||
| 12 | +import cn.iocoder.yudao.module.crm.framework.enums.OperationTypeEnum; | ||
| 13 | +import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | ||
| 14 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateBO; | ||
| 13 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; | 15 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| 14 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 17 | +import org.springframework.transaction.annotation.Transactional; | ||
| 15 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
| 16 | 19 | ||
| 17 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
| @@ -35,17 +38,26 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -35,17 +38,26 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 35 | private CrmCustomerMapper customerMapper; | 38 | private CrmCustomerMapper customerMapper; |
| 36 | @Resource | 39 | @Resource |
| 37 | private DeptApi deptApi; // TODO @wanwan:拼接数据,可以放到 controller;所以这里的引入,可以考虑放到 controller 哈; | 40 | private DeptApi deptApi; // TODO @wanwan:拼接数据,可以放到 controller;所以这里的引入,可以考虑放到 controller 哈; |
| 41 | + @Resource | ||
| 42 | + private CrmPermissionService crmPermissionService; | ||
| 38 | 43 | ||
| 39 | @Override | 44 | @Override |
| 40 | - public Long createCustomer(CrmCustomerCreateReqVO createReqVO) { | 45 | + public Long createCustomer(CrmCustomerCreateReqVO createReqVO, Long userId) { |
| 41 | // 插入 | 46 | // 插入 |
| 42 | CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO); | 47 | CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO); |
| 43 | customerMapper.insert(customer); | 48 | customerMapper.insert(customer); |
| 49 | + | ||
| 50 | + // 创建数据权限 | ||
| 51 | + crmPermissionService.createCrmPermission(new CrmPermissionCreateBO().setCrmType(CrmEnum.CRM_CUSTOMER.getType()) | ||
| 52 | + .setCrmDataId(customer.getId()).setOwnerUserId(userId)); // 设置当前操作的人为负责人 | ||
| 53 | + | ||
| 44 | // 返回 | 54 | // 返回 |
| 45 | return customer.getId(); | 55 | return customer.getId(); |
| 46 | } | 56 | } |
| 47 | 57 | ||
| 48 | @Override | 58 | @Override |
| 59 | + @Transactional(rollbackFor = Exception.class) | ||
| 60 | + @CrmPermission(crmType = CrmEnum.CRM_CUSTOMER, operationType = OperationTypeEnum.UPDATE) | ||
| 49 | public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) { | 61 | public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) { |
| 50 | // 校验存在 | 62 | // 校验存在 |
| 51 | validateCustomerExists(updateReqVO.getId()); | 63 | validateCustomerExists(updateReqVO.getId()); |
| @@ -57,6 +69,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -57,6 +69,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 57 | } | 69 | } |
| 58 | 70 | ||
| 59 | @Override | 71 | @Override |
| 72 | + @Transactional(rollbackFor = Exception.class) | ||
| 73 | + @CrmPermission(crmType = CrmEnum.CRM_CUSTOMER, operationType = OperationTypeEnum.DELETE) | ||
| 60 | public void deleteCustomer(Long id) { | 74 | public void deleteCustomer(Long id) { |
| 61 | // 校验存在 | 75 | // 校验存在 |
| 62 | validateCustomerExists(id); | 76 | validateCustomerExists(id); |
| @@ -73,6 +87,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -73,6 +87,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 73 | } | 87 | } |
| 74 | 88 | ||
| 75 | @Override | 89 | @Override |
| 90 | + @CrmPermission(crmType = CrmEnum.CRM_CUSTOMER, operationType = OperationTypeEnum.READ) | ||
| 76 | public CrmCustomerDO getCustomer(Long id) { | 91 | public CrmCustomerDO getCustomer(Long id) { |
| 77 | return customerMapper.selectById(id); | 92 | return customerMapper.selectById(id); |
| 78 | } | 93 | } |
| @@ -112,4 +127,15 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -112,4 +127,15 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 112 | return customer; | 127 | return customer; |
| 113 | } | 128 | } |
| 114 | 129 | ||
| 130 | + @Override | ||
| 131 | + @Transactional(rollbackFor = Exception.class) | ||
| 132 | + public void transferCustomer(CrmTransferCustomerReqVO reqVO, Long userId) { | ||
| 133 | + // 1 校验合同是否存在 | ||
| 134 | + validateCustomer(reqVO.getId()); | ||
| 135 | + | ||
| 136 | + // 2. 数据权限转移 | ||
| 137 | + crmPermissionService.transferCrmPermission( | ||
| 138 | + CrmCustomerConvert.INSTANCE.convert(reqVO, userId).setCrmType(CrmEnum.CRM_CUSTOMER.getType())); | ||
| 139 | + } | ||
| 140 | + | ||
| 115 | } | 141 | } |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
| @@ -115,10 +115,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -115,10 +115,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 115 | o.setDiscountPercent(null); | 115 | o.setDiscountPercent(null); |
| 116 | o.setProductPrice(null); | 116 | o.setProductPrice(null); |
| 117 | o.setRemark(null); | 117 | o.setRemark(null); |
| 118 | - o.setOwnerUserId(null); | ||
| 119 | o.setCreateTime(null); | 118 | o.setCreateTime(null); |
| 120 | - o.setRoUserIds(null); | ||
| 121 | - o.setRwUserIds(null); | ||
| 122 | o.setEndStatus(null); | 119 | o.setEndStatus(null); |
| 123 | o.setEndRemark(null); | 120 | o.setEndRemark(null); |
| 124 | o.setContactLastTime(null); | 121 | o.setContactLastTime(null); |
| @@ -145,14 +142,8 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -145,14 +142,8 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 145 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null))); | 142 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null))); |
| 146 | // 测试 remark 不匹配 | 143 | // 测试 remark 不匹配 |
| 147 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null))); | 144 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null))); |
| 148 | - // 测试 ownerUserId 不匹配 | ||
| 149 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setOwnerUserId(null))); | ||
| 150 | // 测试 createTime 不匹配 | 145 | // 测试 createTime 不匹配 |
| 151 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null))); | 146 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null))); |
| 152 | - // 测试 roUserIds 不匹配 | ||
| 153 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRoUserIds(null))); | ||
| 154 | - // 测试 rwUserIds 不匹配 | ||
| 155 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRwUserIds(null))); | ||
| 156 | // 测试 endStatus 不匹配 | 147 | // 测试 endStatus 不匹配 |
| 157 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null))); | 148 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null))); |
| 158 | // 测试 endRemark 不匹配 | 149 | // 测试 endRemark 不匹配 |
| @@ -205,10 +196,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -205,10 +196,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 205 | o.setDiscountPercent(null); | 196 | o.setDiscountPercent(null); |
| 206 | o.setProductPrice(null); | 197 | o.setProductPrice(null); |
| 207 | o.setRemark(null); | 198 | o.setRemark(null); |
| 208 | - o.setOwnerUserId(null); | ||
| 209 | o.setCreateTime(null); | 199 | o.setCreateTime(null); |
| 210 | - o.setRoUserIds(null); | ||
| 211 | - o.setRwUserIds(null); | ||
| 212 | o.setEndStatus(null); | 200 | o.setEndStatus(null); |
| 213 | o.setEndRemark(null); | 201 | o.setEndRemark(null); |
| 214 | o.setContactLastTime(null); | 202 | o.setContactLastTime(null); |
| @@ -235,14 +223,8 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -235,14 +223,8 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 235 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null))); | 223 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null))); |
| 236 | // 测试 remark 不匹配 | 224 | // 测试 remark 不匹配 |
| 237 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null))); | 225 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null))); |
| 238 | - // 测试 ownerUserId 不匹配 | ||
| 239 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setOwnerUserId(null))); | ||
| 240 | // 测试 createTime 不匹配 | 226 | // 测试 createTime 不匹配 |
| 241 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null))); | 227 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null))); |
| 242 | - // 测试 roUserIds 不匹配 | ||
| 243 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRoUserIds(null))); | ||
| 244 | - // 测试 rwUserIds 不匹配 | ||
| 245 | - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRwUserIds(null))); | ||
| 246 | // 测试 endStatus 不匹配 | 228 | // 测试 endStatus 不匹配 |
| 247 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null))); | 229 | businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null))); |
| 248 | // 测试 endRemark 不匹配 | 230 | // 测试 endRemark 不匹配 |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImplTest.java
| @@ -115,7 +115,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | @@ -115,7 +115,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | ||
| 115 | o.setTelephone(null); | 115 | o.setTelephone(null); |
| 116 | o.setMobile(null); | 116 | o.setMobile(null); |
| 117 | o.setAddress(null); | 117 | o.setAddress(null); |
| 118 | - o.setOwnerUserId(null); | ||
| 119 | o.setContactLastTime(null); | 118 | o.setContactLastTime(null); |
| 120 | o.setCreateTime(null); | 119 | o.setCreateTime(null); |
| 121 | }); | 120 | }); |
| @@ -136,8 +135,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | @@ -136,8 +135,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | ||
| 136 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setMobile(null))); | 135 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setMobile(null))); |
| 137 | // 测试 address 不匹配 | 136 | // 测试 address 不匹配 |
| 138 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setAddress(null))); | 137 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setAddress(null))); |
| 139 | - // 测试 ownerUserId 不匹配 | ||
| 140 | - clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setOwnerUserId(null))); | ||
| 141 | // 测试 contactLastTime 不匹配 | 138 | // 测试 contactLastTime 不匹配 |
| 142 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setContactLastTime(null))); | 139 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setContactLastTime(null))); |
| 143 | // 测试 createTime 不匹配 | 140 | // 测试 createTime 不匹配 |
| @@ -169,7 +166,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | @@ -169,7 +166,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | ||
| 169 | o.setTelephone(null); | 166 | o.setTelephone(null); |
| 170 | o.setMobile(null); | 167 | o.setMobile(null); |
| 171 | o.setAddress(null); | 168 | o.setAddress(null); |
| 172 | - o.setOwnerUserId(null); | ||
| 173 | o.setContactLastTime(null); | 169 | o.setContactLastTime(null); |
| 174 | o.setCreateTime(null); | 170 | o.setCreateTime(null); |
| 175 | }); | 171 | }); |
| @@ -190,8 +186,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | @@ -190,8 +186,6 @@ public class CrmClueServiceImplTest extends BaseDbUnitTest { | ||
| 190 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setMobile(null))); | 186 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setMobile(null))); |
| 191 | // 测试 address 不匹配 | 187 | // 测试 address 不匹配 |
| 192 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setAddress(null))); | 188 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setAddress(null))); |
| 193 | - // 测试 ownerUserId 不匹配 | ||
| 194 | - clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setOwnerUserId(null))); | ||
| 195 | // 测试 contactLastTime 不匹配 | 189 | // 测试 contactLastTime 不匹配 |
| 196 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setContactLastTime(null))); | 190 | clueMapper.insert(cloneIgnoreId(dbClue, o -> o.setContactLastTime(null))); |
| 197 | // 测试 createTime 不匹配 | 191 | // 测试 createTime 不匹配 |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImplTest.java
| @@ -16,6 +16,7 @@ import javax.annotation.Resource; | @@ -16,6 +16,7 @@ import javax.annotation.Resource; | ||
| 16 | import java.util.List; | 16 | import java.util.List; |
| 17 | 17 | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 18 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| 19 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 19 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 20 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 20 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 21 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 21 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | 22 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; |
| @@ -24,6 +25,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_ | @@ -24,6 +25,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_ | ||
| 24 | import static org.junit.jupiter.api.Assertions.*; | 25 | import static org.junit.jupiter.api.Assertions.*; |
| 25 | 26 | ||
| 26 | // TODO 芋艿:单测后续补 | 27 | // TODO 芋艿:单测后续补 |
| 28 | + | ||
| 27 | /** | 29 | /** |
| 28 | * {@link CrmCustomerServiceImpl} 的单元测试类 | 30 | * {@link CrmCustomerServiceImpl} 的单元测试类 |
| 29 | * | 31 | * |
| @@ -44,7 +46,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | @@ -44,7 +46,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | ||
| 44 | CrmCustomerCreateReqVO reqVO = randomPojo(CrmCustomerCreateReqVO.class); | 46 | CrmCustomerCreateReqVO reqVO = randomPojo(CrmCustomerCreateReqVO.class); |
| 45 | 47 | ||
| 46 | // 调用 | 48 | // 调用 |
| 47 | - Long customerId = customerService.createCustomer(reqVO); | 49 | + Long customerId = customerService.createCustomer(reqVO, getLoginUserId()); |
| 48 | // 断言 | 50 | // 断言 |
| 49 | assertNotNull(customerId); | 51 | assertNotNull(customerId); |
| 50 | // 校验记录的属性是否正确 | 52 | // 校验记录的属性是否正确 |