Commit f87d73724b97bfce4513da4c2b74d1b238261991
Merge remote-tracking branch 'yudao/feature/crm' into feature/crm
# Conflicts: # yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java # yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/BusinessStatusTypeServiceImplTest.java
Showing
60 changed files
with
384 additions
and
188 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| @@ -66,4 +66,7 @@ public interface ErrorCodeConstants { | @@ -66,4 +66,7 @@ public interface ErrorCodeConstants { | ||
| 66 | // ========== 商机状态 1_020_011_000 ========== | 66 | // ========== 商机状态 1_020_011_000 ========== |
| 67 | ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_011_000, "商机状态不存在"); | 67 | ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_011_000, "商机状态不存在"); |
| 68 | 68 | ||
| 69 | + // ========== 客户公海规则设置 1_020_011_000 ========== | ||
| 70 | + ErrorCode CUSTOMER_LIMIT_CONFIG_NOT_EXISTS = new ErrorCode(1_020_012_000, "客户限制配置不存在"); | ||
| 71 | + | ||
| 69 | } | 72 | } |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLimitConfigTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.enums.customer; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * CRM 客户限制配置规则类型 | ||
| 11 | + * | ||
| 12 | + * @author Wanwan | ||
| 13 | + */ | ||
| 14 | +@Getter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public enum CrmCustomerLimitConfigTypeEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 拥有客户数限制 | ||
| 20 | + */ | ||
| 21 | + CUSTOMER_QUANTITY_LIMIT(1, "拥有客户数限制"), | ||
| 22 | + /** | ||
| 23 | + * 锁定客户数限制 | ||
| 24 | + */ | ||
| 25 | + CUSTOMER_LOCK_LIMIT(2, "锁定客户数限制"), | ||
| 26 | + ; | ||
| 27 | + | ||
| 28 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmCustomerLimitConfigTypeEnum::getCode).toArray(); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 状态 | ||
| 32 | + */ | ||
| 33 | + private final Integer code; | ||
| 34 | + /** | ||
| 35 | + * 状态名 | ||
| 36 | + */ | ||
| 37 | + private final String name; | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public int[] array() { | ||
| 41 | + return ARRAYS; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; | 8 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | 11 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 13 | -import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | ||
| 14 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | 16 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 15 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; | 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; |
| 16 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusTypeService; | 18 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusTypeService; |
| @@ -91,17 +93,21 @@ public class CrmBusinessController { | @@ -91,17 +93,21 @@ public class CrmBusinessController { | ||
| 91 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 93 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 92 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { | 94 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { |
| 93 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO, getLoginUserId()); | 95 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO, getLoginUserId()); |
| 94 | - //处理客户名称回显 | 96 | + if (CollUtil.isEmpty(pageResult.getList())) { |
| 97 | + return success(PageResult.empty(pageResult.getTotal())); | ||
| 98 | + } | ||
| 99 | + // 处理客户名称回显 | ||
| 100 | + // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | ||
| 95 | Set<Long> customerIds = pageResult.getList().stream() | 101 | Set<Long> customerIds = pageResult.getList().stream() |
| 96 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); | 102 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 97 | List<CrmCustomerDO> customerList = customerService.getCustomerList(customerIds); | 103 | List<CrmCustomerDO> customerList = customerService.getCustomerList(customerIds); |
| 98 | - //处理商机状态类型名称回显 | 104 | + // 处理商机状态类型名称回显 |
| 99 | Set<Long> statusTypeIds = pageResult.getList().stream() | 105 | Set<Long> statusTypeIds = pageResult.getList().stream() |
| 100 | .map(CrmBusinessDO::getStatusTypeId).filter(Objects::nonNull).collect(Collectors.toSet()); | 106 | .map(CrmBusinessDO::getStatusTypeId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 101 | CrmBusinessStatusTypeQueryVO queryStatusTypeVO = new CrmBusinessStatusTypeQueryVO(); | 107 | CrmBusinessStatusTypeQueryVO queryStatusTypeVO = new CrmBusinessStatusTypeQueryVO(); |
| 102 | queryStatusTypeVO.setIdList(statusTypeIds); | 108 | queryStatusTypeVO.setIdList(statusTypeIds); |
| 103 | List<CrmBusinessStatusTypeDO> statusTypeList = businessStatusTypeService.selectList(queryStatusTypeVO); | 109 | List<CrmBusinessStatusTypeDO> statusTypeList = businessStatusTypeService.selectList(queryStatusTypeVO); |
| 104 | - //处理商机状态名称回显 | 110 | + // 处理商机状态名称回显 |
| 105 | Set<Long> statusIds = pageResult.getList().stream() | 111 | Set<Long> statusIds = pageResult.getList().stream() |
| 106 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); | 112 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 107 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | 113 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusTypeController.java
| @@ -7,7 +7,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -7,7 +7,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; | 10 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; |
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusRespVO; | ||
| 12 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypePageReqVO; | ||
| 13 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; | ||
| 14 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeRespVO; | ||
| 15 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 11 | import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | 16 | import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; |
| 12 | import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | 17 | import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; |
| 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 18 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| @@ -81,7 +86,8 @@ public class CrmBusinessStatusTypeController { | @@ -81,7 +86,8 @@ public class CrmBusinessStatusTypeController { | ||
| 81 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | 86 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 82 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | 87 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 83 | CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); | 88 | CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); |
| 84 | - //处理状态回显 | 89 | + // 处理状态回显 |
| 90 | + // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | ||
| 85 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | 91 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); |
| 86 | queryVO.setTypeId(id); | 92 | queryVO.setTypeId(id); |
| 87 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | 93 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); |
| @@ -93,7 +99,8 @@ public class CrmBusinessStatusTypeController { | @@ -93,7 +99,8 @@ public class CrmBusinessStatusTypeController { | ||
| 93 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | 99 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 94 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { | 100 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { |
| 95 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); | 101 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); |
| 96 | - //处理部门回显 | 102 | + // 处理部门回显 |
| 103 | + // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | ||
| 97 | Set<Long> deptIds = pageResult.getList().stream() | 104 | Set<Long> deptIds = pageResult.getList().stream() |
| 98 | .map(CrmBusinessStatusTypeDO::getDeptIds) | 105 | .map(CrmBusinessStatusTypeDO::getDeptIds) |
| 99 | .filter(Objects::nonNull) | 106 | .filter(Objects::nonNull) |
| @@ -126,6 +133,7 @@ public class CrmBusinessStatusTypeController { | @@ -126,6 +133,7 @@ public class CrmBusinessStatusTypeController { | ||
| 126 | return success(BeanUtils.toBean(list, CrmBusinessStatusTypeRespVO.class)); | 133 | return success(BeanUtils.toBean(list, CrmBusinessStatusTypeRespVO.class)); |
| 127 | } | 134 | } |
| 128 | 135 | ||
| 136 | + // TODO @ljlleo 这个接口,是不是可以和 getBusinessStatusTypeList 合并成一个? | ||
| 129 | @GetMapping("/get-status-list") | 137 | @GetMapping("/get-status-list") |
| 130 | @Operation(summary = "获得商机状态列表") | 138 | @Operation(summary = "获得商机状态列表") |
| 131 | @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | 139 | @PreAuthorize("@ss.hasPermission('crm:business-status:query')") |
| @@ -135,4 +143,5 @@ public class CrmBusinessStatusTypeController { | @@ -135,4 +143,5 @@ public class CrmBusinessStatusTypeController { | ||
| 135 | List<CrmBusinessStatusDO> list = businessStatusService.selectList(queryVO); | 143 | List<CrmBusinessStatusDO> list = businessStatusService.selectList(queryVO); |
| 136 | return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | 144 | return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); |
| 137 | } | 145 | } |
| 146 | + | ||
| 138 | } | 147 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/package-info.java deleted
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessBaseVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessCreateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessCreateReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessExcelVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessExcelVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import com.alibaba.excel.annotation.ExcelProperty; | 3 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessExportReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessExportReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.*; | 4 | import lombok.*; |
| @@ -16,13 +16,13 @@ public class CrmBusinessRespVO extends CrmBusinessBaseVO { | @@ -16,13 +16,13 @@ public class CrmBusinessRespVO extends CrmBusinessBaseVO { | ||
| 16 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 16 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 17 | private LocalDateTime createTime; | 17 | private LocalDateTime createTime; |
| 18 | 18 | ||
| 19 | - @Schema(description = "客户名称") | 19 | + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
| 20 | private String customerName; | 20 | private String customerName; |
| 21 | 21 | ||
| 22 | - @Schema(description = "状态类型名称") | 22 | + @Schema(description = "状态类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "进行中") |
| 23 | private String statusTypeName; | 23 | private String statusTypeName; |
| 24 | 24 | ||
| 25 | - @Schema(description = "状态名称") | 25 | + @Schema(description = "状态名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "跟进中") |
| 26 | private String statusName; | 26 | private String statusName; |
| 27 | 27 | ||
| 28 | } | 28 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessTransferReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessTransferReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; | 3 | import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessUpdateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessUpdateReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessBaseVO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.status; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusQueryVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusQueryVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.status; |
| 2 | 2 | ||
| 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | import com.alibaba.excel.annotation.ExcelProperty; | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| @@ -26,7 +26,7 @@ public class CrmBusinessStatusRespVO { | @@ -26,7 +26,7 @@ public class CrmBusinessStatusRespVO { | ||
| 26 | @ExcelProperty("赢单率") | 26 | @ExcelProperty("赢单率") |
| 27 | private String percent; | 27 | private String percent; |
| 28 | 28 | ||
| 29 | - @Schema(description = "排序") | 29 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 30 | @ExcelProperty("排序") | 30 | @ExcelProperty("排序") |
| 31 | private Integer sort; | 31 | private Integer sort; |
| 32 | 32 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusSaveReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.status; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -21,9 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | @@ -21,9 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | ||
| 21 | @NotEmpty(message = "状态名不能为空") | 21 | @NotEmpty(message = "状态名不能为空") |
| 22 | private String name; | 22 | private String name; |
| 23 | 23 | ||
| 24 | + // TODO @lilleo:percent 应该是 Integer; | ||
| 24 | @Schema(description = "赢单率") | 25 | @Schema(description = "赢单率") |
| 25 | private String percent; | 26 | private String percent; |
| 26 | 27 | ||
| 28 | + // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | ||
| 27 | @Schema(description = "排序") | 29 | @Schema(description = "排序") |
| 28 | private Integer sort; | 30 | private Integer sort; |
| 29 | 31 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypePageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypePageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.type; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeQueryVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypeQueryVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypeRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.type; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 3 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 4 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 4 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| @@ -22,13 +22,12 @@ public class CrmBusinessStatusTypeRespVO { | @@ -22,13 +22,12 @@ public class CrmBusinessStatusTypeRespVO { | ||
| 22 | @ExcelProperty("状态类型名") | 22 | @ExcelProperty("状态类型名") |
| 23 | private String name; | 23 | private String name; |
| 24 | 24 | ||
| 25 | - @Schema(description = "使用的部门名称", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 26 | - @ExcelProperty("使用的部门名称") | ||
| 27 | - private List<String> deptNames; | ||
| 28 | - | ||
| 29 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | 25 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 30 | @ExcelProperty("使用的部门编号") | 26 | @ExcelProperty("使用的部门编号") |
| 31 | private List<Long> deptIds; | 27 | private List<Long> deptIds; |
| 28 | + @Schema(description = "使用的部门名称", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 29 | + @ExcelProperty("使用的部门名称") | ||
| 30 | + private List<String> deptNames; | ||
| 32 | 31 | ||
| 33 | @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED) | 32 | @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED) |
| 34 | @ExcelProperty("创建人") | 33 | @ExcelProperty("创建人") |
| @@ -38,6 +37,7 @@ public class CrmBusinessStatusTypeRespVO { | @@ -38,6 +37,7 @@ public class CrmBusinessStatusTypeRespVO { | ||
| 38 | @ExcelProperty("创建时间") | 37 | @ExcelProperty("创建时间") |
| 39 | private LocalDateTime createTime; | 38 | private LocalDateTime createTime; |
| 40 | 39 | ||
| 40 | + // TODO @ljlleo 字段后缀改成 statuses,保持和 deptIds 风格一致;CrmBusinessStatusDO 改成 VO 哈;一般不使用 do 直接返回 | ||
| 41 | @Schema(description = "状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | 41 | @Schema(description = "状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 42 | private List<CrmBusinessStatusDO> statusList; | 42 | private List<CrmBusinessStatusDO> statusList; |
| 43 | 43 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeSaveReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypeSaveReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.type; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | ||
| 3 | import com.google.common.collect.Lists; | 4 | import com.google.common.collect.Lists; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| @@ -21,6 +22,7 @@ public class CrmBusinessStatusTypeSaveReqVO { | @@ -21,6 +22,7 @@ public class CrmBusinessStatusTypeSaveReqVO { | ||
| 21 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | 22 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 22 | private List<Long> deptIds = Lists.newArrayList(); | 23 | private List<Long> deptIds = Lists.newArrayList(); |
| 23 | 24 | ||
| 25 | + // TODO @ljlleo VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | ||
| 24 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 25 | private List<CrmBusinessStatusSaveReqVO> statusList = Lists.newArrayList(); | 27 | private List<CrmBusinessStatusSaveReqVO> statusList = Lists.newArrayList(); |
| 26 | 28 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerLimitConfigController.java
| @@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; | @@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 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.CrmCustomerLimitConfigCreateReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigPageReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigRespVO; | ||
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigUpdateReqVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigCreateReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigRespVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; | ||
| 10 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert; | 10 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert; |
| 11 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | ||
| 12 | -import cn.iocoder.yudao.module.crm.service.customerlimitconfig.CrmCustomerLimitConfigService; | 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; |
| 12 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerLimitConfigService; | ||
| 13 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; | 13 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| 14 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 14 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| 15 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 15 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| @@ -29,7 +29,7 @@ import java.util.Map; | @@ -29,7 +29,7 @@ import java.util.Map; | ||
| 29 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 29 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 30 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | 30 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; |
| 31 | 31 | ||
| 32 | -@Tag(name = "管理后台 - 客户限制配置") | 32 | +@Tag(name = "管理后台 - CRM 客户限制配置") |
| 33 | @RestController | 33 | @RestController |
| 34 | @RequestMapping("/crm/customer-limit-config") | 34 | @RequestMapping("/crm/customer-limit-config") |
| 35 | @Validated | 35 | @Validated |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigRespVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | 6 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; |
| 8 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService; | 8 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService; |
| @@ -34,12 +34,11 @@ public class CrmCustomerPoolConfigController { | @@ -34,12 +34,11 @@ public class CrmCustomerPoolConfigController { | ||
| 34 | return success(CrmCustomerConvert.INSTANCE.convert(customerPoolConfig)); | 34 | return success(CrmCustomerConvert.INSTANCE.convert(customerPoolConfig)); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | - // TODO @wanwan:这个请求,搞成 save 哈; | ||
| 38 | - @PutMapping("/update") | 37 | + @PutMapping("/save") |
| 39 | @Operation(summary = "更新客户公海规则设置") | 38 | @Operation(summary = "更新客户公海规则设置") |
| 40 | @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:update')") | 39 | @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:update')") |
| 41 | - public CommonResult<Boolean> updateCustomerPoolConfig(@Valid @RequestBody CrmCustomerPoolConfigUpdateReqVO updateReqVO) { | ||
| 42 | - customerPoolConfigService.updateCustomerPoolConfig(updateReqVO); | 40 | + public CommonResult<Boolean> saveCustomerPoolConfig(@Valid @RequestBody CrmCustomerPoolConfigSaveReqVO updateReqVO) { |
| 41 | + customerPoolConfigService.saveCustomerPoolConfig(updateReqVO); | ||
| 43 | return success(true); | 42 | return success(true); |
| 44 | } | 43 | } |
| 45 | 44 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigUpdateReqVO.java deleted
| 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 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | - | ||
| 8 | -@Schema(description = "管理后台 - CRM 客户更新 Request VO") | ||
| 9 | -@Data | ||
| 10 | -@EqualsAndHashCode(callSuper = true) | ||
| 11 | -@ToString(callSuper = true) | ||
| 12 | -public class CrmCustomerPoolConfigUpdateReqVO extends CrmCustomerPoolConfigBaseVO { | ||
| 13 | - | ||
| 14 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerLimitConfigBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigBaseVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -6,7 +6,6 @@ import lombok.Data; | @@ -6,7 +6,6 @@ import lombok.Data; | ||
| 6 | import javax.validation.constraints.NotNull; | 6 | import javax.validation.constraints.NotNull; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | 8 | ||
| 9 | -// TODO @wanwan:vo 下,可以新建一个 limitconfig,放它的 vo; | ||
| 10 | /** | 9 | /** |
| 11 | * 客户限制配置 Base VO,提供给添加、修改、详细的子 VO 使用 | 10 | * 客户限制配置 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 12 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 11 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerLimitConfigCreateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigCreateReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerLimitConfigPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerLimitConfigRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | ||
| 4 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 7 | import lombok.EqualsAndHashCode; |
| @@ -18,10 +20,10 @@ public class CrmCustomerLimitConfigRespVO extends CrmCustomerLimitConfigBaseVO { | @@ -18,10 +20,10 @@ public class CrmCustomerLimitConfigRespVO extends CrmCustomerLimitConfigBaseVO { | ||
| 18 | private Long id; | 20 | private Long id; |
| 19 | 21 | ||
| 20 | @Schema(description = "规则适用人群名称") | 22 | @Schema(description = "规则适用人群名称") |
| 21 | - private String userNames; | 23 | + private List<AdminUserRespDTO> users; |
| 22 | 24 | ||
| 23 | @Schema(description = "规则适用部门名称") | 25 | @Schema(description = "规则适用部门名称") |
| 24 | - private String deptNames; | 26 | + private List<DeptRespDTO> depts; |
| 25 | 27 | ||
| 26 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 28 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 27 | private LocalDateTime createTime; | 29 | private LocalDateTime createTime; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerLimitConfigUpdateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigUpdateReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigBaseVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -12,7 +12,6 @@ import javax.validation.constraints.NotNull; | @@ -12,7 +12,6 @@ import javax.validation.constraints.NotNull; | ||
| 12 | @Data | 12 | @Data |
| 13 | public class CrmCustomerPoolConfigBaseVO { | 13 | public class CrmCustomerPoolConfigBaseVO { |
| 14 | 14 | ||
| 15 | - // TODO @wanwan:参数校验 | ||
| 16 | @Schema(description = "是否启用客户公海", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | 15 | @Schema(description = "是否启用客户公海", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") |
| 17 | @NotNull(message = "是否启用客户公海不能为空") | 16 | @NotNull(message = "是否启用客户公海不能为空") |
| 18 | private Boolean enabled; | 17 | private Boolean enabled; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 5 | import lombok.EqualsAndHashCode; |
| 6 | import lombok.ToString; | 6 | import lombok.ToString; |
| 7 | 7 | ||
| 8 | -// TODO @wanwan:vo 下,可以新建一个 poolconfig,放它的 vo; | ||
| 9 | @Schema(description = "管理后台 - CRM 客户公海规则 Response VO") | 8 | @Schema(description = "管理后台 - CRM 客户公海规则 Response VO") |
| 10 | @Data | 9 | @Data |
| 11 | @EqualsAndHashCode(callSuper = true) | 10 | @EqualsAndHashCode(callSuper = true) |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.BooleanUtil; | ||
| 4 | +import cn.hutool.core.util.ObjectUtil; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | +import lombok.ToString; | ||
| 9 | + | ||
| 10 | +import javax.validation.constraints.AssertTrue; | ||
| 11 | +import java.util.Objects; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - CRM 客户公海配置的保存 Request VO") | ||
| 14 | +@Data | ||
| 15 | +@EqualsAndHashCode(callSuper = true) | ||
| 16 | +@ToString(callSuper = true) | ||
| 17 | +public class CrmCustomerPoolConfigSaveReqVO extends CrmCustomerPoolConfigBaseVO { | ||
| 18 | + | ||
| 19 | + // TODO @wanwan:AssertTrue 必须 is 开头哈;注意需要 json 忽略下,避免被序列化; | ||
| 20 | + @AssertTrue(message = "客户公海规则设置不正确") | ||
| 21 | + // TODO @wanwan:这个方法,是不是拆成 2 个,一个校验 contactExpireDays、一个校验 dealExpireDays; | ||
| 22 | + public boolean poolEnableValid() { | ||
| 23 | + if (!BooleanUtil.isTrue(getEnabled())) { | ||
| 24 | + return true; | ||
| 25 | + } | ||
| 26 | + return ObjectUtil.isAllNotEmpty(getContactExpireDays(), getDealExpireDays()); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @AssertTrue(message = "客户公海规则设置不正确") | ||
| 30 | + // TODO @wanwan:这个方法,是不是改成 isNotifyDaysValid() 更好点?本质校验的是 notifyDays 是否为空 | ||
| 31 | + public boolean notifyEnableValid() { | ||
| 32 | + if (!BooleanUtil.isTrue(getNotifyEnabled())) { | ||
| 33 | + return true; | ||
| 34 | + } | ||
| 35 | + return Objects.nonNull(getNotifyDays()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.business; | 1 | package cn.iocoder.yudao.module.crm.convert.business; |
| 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.business.vo.*; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| @@ -46,14 +46,14 @@ public interface CrmBusinessConvert { | @@ -46,14 +46,14 @@ public interface CrmBusinessConvert { | ||
| 46 | default PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page, List<CrmCustomerDO> customerList, | 46 | default PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page, List<CrmCustomerDO> customerList, |
| 47 | List<CrmBusinessStatusTypeDO> statusTypeList, List<CrmBusinessStatusDO> statusList) { | 47 | List<CrmBusinessStatusTypeDO> statusTypeList, List<CrmBusinessStatusDO> statusList) { |
| 48 | PageResult<CrmBusinessRespVO> result = convertPage(page); | 48 | PageResult<CrmBusinessRespVO> result = convertPage(page); |
| 49 | + // 拼接关联字段 | ||
| 49 | Map<Long, String> customerMap = convertMap(customerList, CrmCustomerDO::getId, CrmCustomerDO::getName); | 50 | Map<Long, String> customerMap = convertMap(customerList, CrmCustomerDO::getId, CrmCustomerDO::getName); |
| 50 | Map<Long, String> statusTypeMap = convertMap(statusTypeList, CrmBusinessStatusTypeDO::getId, CrmBusinessStatusTypeDO::getName); | 51 | Map<Long, String> statusTypeMap = convertMap(statusTypeList, CrmBusinessStatusTypeDO::getId, CrmBusinessStatusTypeDO::getName); |
| 51 | Map<Long, String> statusMap = convertMap(statusList, CrmBusinessStatusDO::getId, CrmBusinessStatusDO::getName); | 52 | Map<Long, String> statusMap = convertMap(statusList, CrmBusinessStatusDO::getId, CrmBusinessStatusDO::getName); |
| 52 | - result.getList().stream().forEach(t -> { | ||
| 53 | - t.setCustomerName(customerMap.get(t.getCustomerId())); | ||
| 54 | - t.setStatusTypeName(statusTypeMap.get(t.getStatusTypeId())); | ||
| 55 | - t.setStatusName(statusMap.get(t.getStatusId())); | ||
| 56 | - }); | 53 | + result.getList().forEach(type -> type |
| 54 | + .setCustomerName(customerMap.get(type.getCustomerId())) | ||
| 55 | + .setStatusTypeName(statusTypeMap.get(type.getStatusTypeId())) | ||
| 56 | + .setStatusName(statusMap.get(type.getStatusId()))); | ||
| 57 | return result; | 57 | return result; |
| 58 | } | 58 | } |
| 59 | 59 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.businessstatus; | 1 | package cn.iocoder.yudao.module.crm.convert.businessstatus; |
| 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.business.vo.CrmBusinessStatusRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusSaveReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusRespVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | import org.mapstruct.Mapper; | 7 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 8 | import org.mapstruct.factory.Mappers; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.businessstatustype; | 1 | package cn.iocoder.yudao.module.crm.convert.businessstatustype; |
| 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.business.vo.CrmBusinessStatusTypeRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeSaveReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeRespVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| @@ -33,18 +33,17 @@ public interface CrmBusinessStatusTypeConvert { | @@ -33,18 +33,17 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 33 | 33 | ||
| 34 | default PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page, List<DeptRespDTO> deptList) { | 34 | default PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page, List<DeptRespDTO> deptList) { |
| 35 | PageResult<CrmBusinessStatusTypeRespVO> pageResult = convertPage(page); | 35 | PageResult<CrmBusinessStatusTypeRespVO> pageResult = convertPage(page); |
| 36 | + // 拼接关联字段 | ||
| 36 | Map<Long, String> deptMap = convertMap(deptList, DeptRespDTO::getId, DeptRespDTO::getName); | 37 | Map<Long, String> deptMap = convertMap(deptList, DeptRespDTO::getId, DeptRespDTO::getName); |
| 37 | - pageResult.getList().stream().forEach(r -> { | ||
| 38 | - r.setDeptNames(convertList(r.getDeptIds(), deptMap::get)); | ||
| 39 | - }); | 38 | + pageResult.getList().forEach(type -> type.setDeptNames(convertList(type.getDeptIds(), deptMap::get))); |
| 40 | return pageResult; | 39 | return pageResult; |
| 41 | } | 40 | } |
| 42 | 41 | ||
| 43 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { | 42 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { |
| 43 | + // TODO @ljlleo 可以链式赋值,简化成一行; | ||
| 44 | CrmBusinessStatusTypeRespVO result = convert(bean); | 44 | CrmBusinessStatusTypeRespVO result = convert(bean); |
| 45 | result.setStatusList(statusList); | 45 | result.setStatusList(statusList); |
| 46 | return result; | 46 | return result; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | - | ||
| 50 | } | 49 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.crm.convert.customer; | @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.crm.convert.customer; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 4 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; |
| 8 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 10 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| @@ -78,6 +80,6 @@ public interface CrmCustomerConvert { | @@ -78,6 +80,6 @@ public interface CrmCustomerConvert { | ||
| 78 | 80 | ||
| 79 | CrmCustomerPoolConfigRespVO convert(CrmCustomerPoolConfigDO customerPoolConfig); | 81 | CrmCustomerPoolConfigRespVO convert(CrmCustomerPoolConfigDO customerPoolConfig); |
| 80 | 82 | ||
| 81 | - CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigUpdateReqVO updateReqVO); | 83 | + CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigSaveReqVO updateReqVO); |
| 82 | 84 | ||
| 83 | } | 85 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerLimitConfigConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.customer; | 1 | package cn.iocoder.yudao.module.crm.convert.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.CrmCustomerLimitConfigCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigUpdateReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | 4 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigCreateReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | ||
| 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 9 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| 9 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 10 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 10 | import org.mapstruct.Mapper; | 11 | import org.mapstruct.Mapper; |
| @@ -12,8 +13,6 @@ import org.mapstruct.factory.Mappers; | @@ -12,8 +13,6 @@ import org.mapstruct.factory.Mappers; | ||
| 12 | 13 | ||
| 13 | import java.util.List; | 14 | import java.util.List; |
| 14 | import java.util.Map; | 15 | import java.util.Map; |
| 15 | -import java.util.Objects; | ||
| 16 | -import java.util.stream.Collectors; | ||
| 17 | 16 | ||
| 18 | /** | 17 | /** |
| 19 | * 客户限制配置 Convert | 18 | * 客户限制配置 Convert |
| @@ -54,14 +53,11 @@ public interface CrmCustomerLimitConfigConvert { | @@ -54,14 +53,11 @@ public interface CrmCustomerLimitConfigConvert { | ||
| 54 | * | 53 | * |
| 55 | * @param userMap 用户映射 | 54 | * @param userMap 用户映射 |
| 56 | * @param deptMap 部门映射 | 55 | * @param deptMap 部门映射 |
| 57 | - * @param respVo 响应实体 | 56 | + * @param respVo 响应实体 |
| 58 | */ | 57 | */ |
| 59 | static void fillNameField(Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap, CrmCustomerLimitConfigRespVO respVo) { | 58 | static void fillNameField(Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap, CrmCustomerLimitConfigRespVO respVo) { |
| 60 | - // TODO wanwan:返回 list,具体怎么拼接叫给前端; | ||
| 61 | - respVo.setUserNames(respVo.getUserIds().stream().map(userMap::get) | ||
| 62 | - .filter(Objects::nonNull).map(AdminUserRespDTO::getNickname).collect(Collectors.joining(","))); | ||
| 63 | - respVo.setDeptNames(respVo.getDeptIds().stream().map(deptMap::get) | ||
| 64 | - .filter(Objects::nonNull).map(DeptRespDTO::getName).collect(Collectors.joining(","))); | 59 | + respVo.setUsers(CollectionUtils.convertList(respVo.getUserIds(), userMap::get)); |
| 60 | + respVo.setDepts(CollectionUtils.convertList(respVo.getDeptIds(), deptMap::get)); | ||
| 65 | } | 61 | } |
| 66 | 62 | ||
| 67 | } | 63 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| @@ -69,8 +69,7 @@ public class CrmBusinessDO extends BaseDO { | @@ -69,8 +69,7 @@ public class CrmBusinessDO extends BaseDO { | ||
| 69 | */ | 69 | */ |
| 70 | private Integer discountPercent; | 70 | private Integer discountPercent; |
| 71 | /** | 71 | /** |
| 72 | - * 产品总金额 | ||
| 73 | - * | 72 | + * 产品总金额,单位:分 |
| 74 | */ | 73 | */ |
| 75 | private Integer productPrice; | 74 | private Integer productPrice; |
| 76 | /** | 75 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java
| @@ -26,6 +26,8 @@ public class CrmBusinessStatusDO { | @@ -26,6 +26,8 @@ public class CrmBusinessStatusDO { | ||
| 26 | private Long id; | 26 | private Long id; |
| 27 | /** | 27 | /** |
| 28 | * 状态类型编号 | 28 | * 状态类型编号 |
| 29 | + * | ||
| 30 | + * 关联 {@link CrmBusinessStatusTypeDO#getId()} | ||
| 29 | */ | 31 | */ |
| 30 | private Long typeId; | 32 | private Long typeId; |
| 31 | /** | 33 | /** |
| @@ -34,6 +36,8 @@ public class CrmBusinessStatusDO { | @@ -34,6 +36,8 @@ public class CrmBusinessStatusDO { | ||
| 34 | private String name; | 36 | private String name; |
| 35 | /** | 37 | /** |
| 36 | * 赢单率 | 38 | * 赢单率 |
| 39 | + * | ||
| 40 | + * TODO 这里是不是改成 Integer 存储,百分比 * 100 ; | ||
| 37 | */ | 41 | */ |
| 38 | private String percent; | 42 | private String percent; |
| 39 | /** | 43 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java
| @@ -41,6 +41,8 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | @@ -41,6 +41,8 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | ||
| 41 | private List<Long> deptIds; | 41 | private List<Long> deptIds; |
| 42 | /** | 42 | /** |
| 43 | * 开启状态 | 43 | * 开启状态 |
| 44 | + * | ||
| 45 | + * TODO 改成 Integer,关联 CommonStatus | ||
| 44 | */ | 46 | */ |
| 45 | private Boolean status; | 47 | private Boolean status; |
| 46 | 48 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customerlimitconfig/CrmCustomerLimitConfigDO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerLimitConfigDO.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig; | 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.customer; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | 4 | import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; |
| 5 | +import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLimitConfigTypeEnum; | ||
| 5 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | import com.baomidou.mybatisplus.annotation.TableField; | 7 | import com.baomidou.mybatisplus.annotation.TableField; |
| 7 | import com.baomidou.mybatisplus.annotation.TableId; | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -32,8 +33,8 @@ public class CrmCustomerLimitConfigDO extends BaseDO { | @@ -32,8 +33,8 @@ public class CrmCustomerLimitConfigDO extends BaseDO { | ||
| 32 | private Long id; | 33 | private Long id; |
| 33 | /** | 34 | /** |
| 34 | * 规则类型 | 35 | * 规则类型 |
| 35 | - * | ||
| 36 | - * TODO @wanwan:搞个枚举哈; | 36 | + * <p> |
| 37 | + * 枚举 {@link CrmCustomerLimitConfigTypeEnum} | ||
| 37 | */ | 38 | */ |
| 38 | private Integer type; | 39 | private Integer type; |
| 39 | /** | 40 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerPoolConfigDO.java
| 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.customer; | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.customer; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | 4 | +import com.baomidou.mybatisplus.annotation.*; |
| 7 | import lombok.*; | 5 | import lombok.*; |
| 8 | 6 | ||
| 9 | /** | 7 | /** |
| @@ -33,18 +31,22 @@ public class CrmCustomerPoolConfigDO extends BaseDO { | @@ -33,18 +31,22 @@ public class CrmCustomerPoolConfigDO extends BaseDO { | ||
| 33 | /** | 31 | /** |
| 34 | * 未跟进放入公海天数 | 32 | * 未跟进放入公海天数 |
| 35 | */ | 33 | */ |
| 34 | + @TableField(updateStrategy = FieldStrategy.ALWAYS) | ||
| 36 | private Integer contactExpireDays; | 35 | private Integer contactExpireDays; |
| 37 | /** | 36 | /** |
| 38 | * 未成交放入公海天数 | 37 | * 未成交放入公海天数 |
| 39 | */ | 38 | */ |
| 39 | + @TableField(updateStrategy = FieldStrategy.ALWAYS) | ||
| 40 | private Integer dealExpireDays; | 40 | private Integer dealExpireDays; |
| 41 | /** | 41 | /** |
| 42 | * 是否开启提前提醒 | 42 | * 是否开启提前提醒 |
| 43 | */ | 43 | */ |
| 44 | + @TableField(updateStrategy = FieldStrategy.ALWAYS) | ||
| 44 | private Boolean notifyEnabled; | 45 | private Boolean notifyEnabled; |
| 45 | /** | 46 | /** |
| 46 | * 提前提醒天数 | 47 | * 提前提醒天数 |
| 47 | */ | 48 | */ |
| 49 | + @TableField(updateStrategy = FieldStrategy.ALWAYS) | ||
| 48 | private Integer notifyDays; | 50 | private Integer notifyDays; |
| 49 | 51 | ||
| 50 | } | 52 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessExportReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessPageReqVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessExportReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusMapper.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusQueryVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusPageReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| @@ -31,8 +31,7 @@ public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO | @@ -31,8 +31,7 @@ public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | default int delete(Long typeId) { | 33 | default int delete(Long typeId) { |
| 34 | - return delete(new LambdaQueryWrapperX<CrmBusinessStatusDO>() | ||
| 35 | - .eq(CrmBusinessStatusDO::getTypeId, typeId)); | 34 | + return delete(CrmBusinessStatusDO::getTypeId, typeId); |
| 36 | } | 35 | } |
| 37 | 36 | ||
| 38 | } | 37 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.business; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypePageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeQueryVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypePageReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customerlimitconfig/CrmCustomerLimitConfigMapper.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | ||
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 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.business.vo.*; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 6 | 6 | ||
| 7 | import javax.validation.Valid; | 7 | import javax.validation.Valid; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.crm.service.business; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.crm.service.business; | ||
| 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.business.vo.*; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; |
| 7 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | 7 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusService.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 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.business.vo.CrmBusinessStatusPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusQueryVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusSaveReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusPageReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | ||
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 8 | 8 | ||
| 9 | import javax.validation.Valid; | 9 | import javax.validation.Valid; |
| @@ -54,6 +54,8 @@ public interface CrmBusinessStatusService { | @@ -54,6 +54,8 @@ public interface CrmBusinessStatusService { | ||
| 54 | */ | 54 | */ |
| 55 | PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); | 55 | PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); |
| 56 | 56 | ||
| 57 | + // TODO @ljlleo 常用的 ids 之类的查询,可以封装单独的方法,不用走类似 QueryVO,用起来更方便。 | ||
| 58 | + // TODO @ljlleo 方法名用 getBusinessStatusList | ||
| 57 | /** | 59 | /** |
| 58 | * 获得商机状态分页 | 60 | * 获得商机状态分页 |
| 59 | * | 61 | * |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusServiceImpl.java
| @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.crm.service.business; | @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.crm.service.business; | ||
| 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.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusQueryVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusSaveReqVO; | 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusPageReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusQueryVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; |
| 10 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| @@ -51,6 +51,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | @@ -51,6 +51,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 51 | public void deleteBusinessStatus(Long id) { | 51 | public void deleteBusinessStatus(Long id) { |
| 52 | // 校验存在 | 52 | // 校验存在 |
| 53 | validateBusinessStatusExists(id); | 53 | validateBusinessStatusExists(id); |
| 54 | + // TODO @ljlleo 这里可以考虑,如果有商机在使用,不允许删除 | ||
| 54 | // 删除 | 55 | // 删除 |
| 55 | businessStatusMapper.deleteById(id); | 56 | businessStatusMapper.deleteById(id); |
| 56 | } | 57 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusTypeService.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 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.business.vo.CrmBusinessStatusTypePageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeQueryVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeSaveReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypePageReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 8 | 8 | ||
| 9 | import javax.validation.Valid; | 9 | import javax.validation.Valid; |
| @@ -54,6 +54,7 @@ public interface CrmBusinessStatusTypeService { | @@ -54,6 +54,7 @@ public interface CrmBusinessStatusTypeService { | ||
| 54 | */ | 54 | */ |
| 55 | PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); | 55 | PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); |
| 56 | 56 | ||
| 57 | + // TODO @ljlleo 常用的 ids 之类的查询,可以封装单独的方法,不用走类似 QueryVO,用起来更方便。 | ||
| 57 | /** | 58 | /** |
| 58 | * 获得商机状态类型列表 | 59 | * 获得商机状态类型列表 |
| 59 | * | 60 | * |
| @@ -61,4 +62,5 @@ public interface CrmBusinessStatusTypeService { | @@ -61,4 +62,5 @@ public interface CrmBusinessStatusTypeService { | ||
| 61 | * @return 商机状态类型列表 | 62 | * @return 商机状态类型列表 |
| 62 | */ | 63 | */ |
| 63 | List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO); | 64 | List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO); |
| 65 | + | ||
| 64 | } | 66 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusTypeServiceImpl.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypePageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeQueryVO; | ||
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeSaveReqVO; | 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypePageReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeQueryVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 11 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; | 12 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; |
| @@ -42,15 +43,14 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | @@ -42,15 +43,14 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | ||
| 42 | public Long createBusinessStatusType(CrmBusinessStatusTypeSaveReqVO createReqVO) { | 43 | public Long createBusinessStatusType(CrmBusinessStatusTypeSaveReqVO createReqVO) { |
| 43 | //检验名称是否存在 | 44 | //检验名称是否存在 |
| 44 | validateBusinessStatusTypeExists(createReqVO.getName(), null); | 45 | validateBusinessStatusTypeExists(createReqVO.getName(), null); |
| 45 | - // 插入 | 46 | + // 插入类型 |
| 46 | CrmBusinessStatusTypeDO businessStatusType = BeanUtils.toBean(createReqVO, CrmBusinessStatusTypeDO.class); | 47 | CrmBusinessStatusTypeDO businessStatusType = BeanUtils.toBean(createReqVO, CrmBusinessStatusTypeDO.class); |
| 47 | businessStatusTypeMapper.insert(businessStatusType); | 48 | businessStatusTypeMapper.insert(businessStatusType); |
| 48 | - createReqVO.getStatusList().stream().forEach(status -> { | ||
| 49 | - status.setTypeId(businessStatusType.getId()); | ||
| 50 | - }); | ||
| 51 | - //插入状态 | ||
| 52 | - businessStatusMapper.insertBatch(BeanUtils.toBean(createReqVO.getStatusList(), CrmBusinessStatusDO.class)); | ||
| 53 | - // 返回 | 49 | + // 插入状态 |
| 50 | + if (CollUtil.isNotEmpty(createReqVO.getStatusList())) { | ||
| 51 | + createReqVO.getStatusList().forEach(status -> status.setTypeId(businessStatusType.getId())); | ||
| 52 | + businessStatusMapper.insertBatch(BeanUtils.toBean(createReqVO.getStatusList(), CrmBusinessStatusDO.class)); | ||
| 53 | + } | ||
| 54 | return businessStatusType.getId(); | 54 | return businessStatusType.getId(); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| @@ -61,29 +61,27 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | @@ -61,29 +61,27 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | ||
| 61 | validateBusinessStatusTypeExists(updateReqVO.getId()); | 61 | validateBusinessStatusTypeExists(updateReqVO.getId()); |
| 62 | // 校验名称是否存在 | 62 | // 校验名称是否存在 |
| 63 | validateBusinessStatusTypeExists(updateReqVO.getName(), updateReqVO.getId()); | 63 | validateBusinessStatusTypeExists(updateReqVO.getName(), updateReqVO.getId()); |
| 64 | - // 更新 | 64 | + // 更新类型 |
| 65 | CrmBusinessStatusTypeDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessStatusTypeDO.class); | 65 | CrmBusinessStatusTypeDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessStatusTypeDO.class); |
| 66 | businessStatusTypeMapper.updateById(updateObj); | 66 | businessStatusTypeMapper.updateById(updateObj); |
| 67 | - //删除状态 | 67 | + // 更新状态(删除 + 更新) |
| 68 | + // TODO @ljlleo 可以参考 DeliveryExpressTemplateServiceImpl 的 updateExpressTemplateFree 方法;主要没变化的,还是不删除了哈。 | ||
| 68 | businessStatusMapper.delete(updateReqVO.getId()); | 69 | businessStatusMapper.delete(updateReqVO.getId()); |
| 69 | - //插入状态 | ||
| 70 | - updateReqVO.getStatusList().stream().forEach(status -> { | ||
| 71 | - status.setTypeId(updateReqVO.getId()); | ||
| 72 | - }); | 70 | + updateReqVO.getStatusList().forEach(status -> status.setTypeId(updateReqVO.getId())); |
| 73 | businessStatusMapper.insertBatch(BeanUtils.toBean(updateReqVO.getStatusList(), CrmBusinessStatusDO.class)); | 71 | businessStatusMapper.insertBatch(BeanUtils.toBean(updateReqVO.getStatusList(), CrmBusinessStatusDO.class)); |
| 74 | } | 72 | } |
| 75 | 73 | ||
| 76 | @Override | 74 | @Override |
| 77 | @Transactional(rollbackFor = Exception.class) | 75 | @Transactional(rollbackFor = Exception.class) |
| 78 | public void deleteBusinessStatusType(Long id) { | 76 | public void deleteBusinessStatusType(Long id) { |
| 79 | - //TODO 待添加被引用校验 | 77 | + // TODO 待添加被引用校验 |
| 80 | //... | 78 | //... |
| 81 | 79 | ||
| 82 | // 校验存在 | 80 | // 校验存在 |
| 83 | validateBusinessStatusTypeExists(id); | 81 | validateBusinessStatusTypeExists(id); |
| 84 | - // 删除 | 82 | + // 删除类型 |
| 85 | businessStatusTypeMapper.deleteById(id); | 83 | businessStatusTypeMapper.deleteById(id); |
| 86 | - //删除状态 | 84 | + // 删除状态 |
| 87 | businessStatusMapper.delete(id); | 85 | businessStatusMapper.delete(id); |
| 88 | } | 86 | } |
| 89 | 87 | ||
| @@ -93,6 +91,7 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | @@ -93,6 +91,7 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | ||
| 93 | } | 91 | } |
| 94 | } | 92 | } |
| 95 | 93 | ||
| 94 | + // TODO @ljlleo 这个方法,这个参考 validateDeptNameUnique 实现。 | ||
| 96 | private void validateBusinessStatusTypeExists(String name, Long id) { | 95 | private void validateBusinessStatusTypeExists(String name, Long id) { |
| 97 | LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); | 96 | LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); |
| 98 | if(null != id) { | 97 | if(null != id) { |
| @@ -118,4 +117,5 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | @@ -118,4 +117,5 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | ||
| 118 | public List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO) { | 117 | public List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO) { |
| 119 | return businessStatusTypeMapper.selectList(queryVO); | 118 | return businessStatusTypeMapper.selectList(queryVO); |
| 120 | } | 119 | } |
| 120 | + | ||
| 121 | } | 121 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customerlimitconfig/CrmCustomerLimitConfigService.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigService.java
| 1 | -package cn.iocoder.yudao.module.crm.service.customerlimitconfig; | 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.CrmCustomerLimitConfigCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigUpdateReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigCreateReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | ||
| 8 | 8 | ||
| 9 | import javax.validation.Valid; | 9 | import javax.validation.Valid; |
| 10 | 10 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customerlimitconfig/CrmCustomerLimitConfigServiceImpl.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.crm.service.customerlimitconfig; | 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.CrmCustomerLimitConfigCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigCreateReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; | ||
| 7 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert; | 7 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert; |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper; | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper; |
| 10 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; | 10 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| 11 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 11 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigService.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.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | 3 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; |
| 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; |
| 5 | 5 | ||
| 6 | import javax.validation.Valid; | 6 | import javax.validation.Valid; |
| @@ -24,6 +24,6 @@ public interface CrmCustomerPoolConfigService { | @@ -24,6 +24,6 @@ public interface CrmCustomerPoolConfigService { | ||
| 24 | * | 24 | * |
| 25 | * @param saveReqVO 更新信息 | 25 | * @param saveReqVO 更新信息 |
| 26 | */ | 26 | */ |
| 27 | - void updateCustomerPoolConfig(@Valid CrmCustomerPoolConfigUpdateReqVO saveReqVO); | 27 | + void saveCustomerPoolConfig(@Valid CrmCustomerPoolConfigSaveReqVO saveReqVO); |
| 28 | 28 | ||
| 29 | } | 29 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigServiceImpl.java
| 1 | package cn.iocoder.yudao.module.crm.service.customer; | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.BooleanUtil; | ||
| 4 | -import cn.hutool.core.util.ObjectUtil; | ||
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | 5 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper; | 7 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper; |
| @@ -13,9 +11,6 @@ import org.springframework.validation.annotation.Validated; | @@ -13,9 +11,6 @@ import org.springframework.validation.annotation.Validated; | ||
| 13 | import javax.annotation.Resource; | 11 | import javax.annotation.Resource; |
| 14 | import java.util.Objects; | 12 | import java.util.Objects; |
| 15 | 13 | ||
| 16 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 17 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_POOL_CONFIG_ERROR; | ||
| 18 | - | ||
| 19 | /** | 14 | /** |
| 20 | * 客户公海配置 Service 实现类 | 15 | * 客户公海配置 Service 实现类 |
| 21 | * | 16 | * |
| @@ -43,15 +38,7 @@ public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigSe | @@ -43,15 +38,7 @@ public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigSe | ||
| 43 | * @param saveReqVO 更新信息 | 38 | * @param saveReqVO 更新信息 |
| 44 | */ | 39 | */ |
| 45 | @Override | 40 | @Override |
| 46 | - public void updateCustomerPoolConfig(CrmCustomerPoolConfigUpdateReqVO saveReqVO) { | ||
| 47 | - // TODO @wanwan:看下 @AssertTrue 的逻辑; | ||
| 48 | - if (BooleanUtil.isTrue(saveReqVO.getEnabled()) && (ObjectUtil.hasNull(saveReqVO.getContactExpireDays(), saveReqVO.getDealExpireDays()))) { | ||
| 49 | - throw exception(CUSTOMER_POOL_CONFIG_ERROR); | ||
| 50 | - } | ||
| 51 | - if (BooleanUtil.isTrue(saveReqVO.getNotifyEnabled()) && (Objects.isNull(saveReqVO.getNotifyDays()))) { | ||
| 52 | - throw exception(CUSTOMER_POOL_CONFIG_ERROR); | ||
| 53 | - } | ||
| 54 | - | 41 | + public void saveCustomerPoolConfig(CrmCustomerPoolConfigSaveReqVO saveReqVO) { |
| 55 | // 存在,则进行更新 | 42 | // 存在,则进行更新 |
| 56 | CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); | 43 | CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); |
| 57 | if (Objects.nonNull(dbConfig)) { | 44 | if (Objects.nonNull(dbConfig)) { |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/package-info.java deleted
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/BusinessStatusTypeServiceImplTest.java
| 1 | +package cn.iocoder.yudao.module.crm.service.business; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusTypeMapper; | ||
| 9 | +import org.junit.jupiter.api.Disabled; | ||
| 10 | +import org.junit.jupiter.api.Test; | ||
| 11 | +import org.springframework.context.annotation.Import; | ||
| 12 | + | ||
| 13 | +import javax.annotation.Resource; | ||
| 14 | + | ||
| 15 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 16 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | ||
| 17 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | ||
| 18 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 19 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; | ||
| 20 | +import static org.junit.jupiter.api.Assertions.*; | ||
| 21 | + | ||
| 22 | +// TODO 芋艿:后续再 review | ||
| 23 | +/** | ||
| 24 | + * {@link CrmBusinessStatusTypeServiceImpl} 的单元测试类 | ||
| 25 | + * | ||
| 26 | + * @author ljlleo | ||
| 27 | + */ | ||
| 28 | +@Import(CrmBusinessStatusTypeServiceImpl.class) | ||
| 29 | +public class BusinessStatusTypeServiceImplTest extends BaseDbUnitTest { | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private CrmBusinessStatusTypeServiceImpl businessStatusTypeService; | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | ||
| 36 | + | ||
| 37 | + @Test | ||
| 38 | + public void testCreateBusinessStatusType_success() { | ||
| 39 | + // 准备参数 | ||
| 40 | + CrmBusinessStatusTypeSaveReqVO createReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class).setId(null); | ||
| 41 | + | ||
| 42 | + // 调用 | ||
| 43 | + Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(createReqVO); | ||
| 44 | + // 断言 | ||
| 45 | + assertNotNull(businessStatusTypeId); | ||
| 46 | + // 校验记录的属性是否正确 | ||
| 47 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | ||
| 48 | + assertPojoEquals(createReqVO, businessStatusType, "id"); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @Test | ||
| 52 | + public void testUpdateBusinessStatusType_success() { | ||
| 53 | + // mock 数据 | ||
| 54 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | ||
| 55 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | ||
| 56 | + // 准备参数 | ||
| 57 | + CrmBusinessStatusTypeSaveReqVO updateReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class, o -> { | ||
| 58 | + o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID | ||
| 59 | + }); | ||
| 60 | + | ||
| 61 | + // 调用 | ||
| 62 | + businessStatusTypeService.updateBusinessStatusType(updateReqVO); | ||
| 63 | + // 校验是否更新正确 | ||
| 64 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(updateReqVO.getId()); // 获取最新的 | ||
| 65 | + assertPojoEquals(updateReqVO, businessStatusType); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Test | ||
| 69 | + public void testUpdateBusinessStatusType_notExists() { | ||
| 70 | + // 准备参数 | ||
| 71 | + CrmBusinessStatusTypeSaveReqVO updateReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class); | ||
| 72 | + | ||
| 73 | + // 调用, 并断言异常 | ||
| 74 | + assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(updateReqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Test | ||
| 78 | + public void testDeleteBusinessStatusType_success() { | ||
| 79 | + // mock 数据 | ||
| 80 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | ||
| 81 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | ||
| 82 | + // 准备参数 | ||
| 83 | + Long id = dbBusinessStatusType.getId(); | ||
| 84 | + | ||
| 85 | + // 调用 | ||
| 86 | + businessStatusTypeService.deleteBusinessStatusType(id); | ||
| 87 | + // 校验数据不存在了 | ||
| 88 | + assertNull(businessStatusTypeMapper.selectById(id)); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @Test | ||
| 92 | + public void testDeleteBusinessStatusType_notExists() { | ||
| 93 | + // 准备参数 | ||
| 94 | + Long id = randomLongId(); | ||
| 95 | + | ||
| 96 | + // 调用, 并断言异常 | ||
| 97 | + assertServiceException(() -> businessStatusTypeService.deleteBusinessStatusType(id), BUSINESS_STATUS_TYPE_NOT_EXISTS); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Test | ||
| 101 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 102 | + public void testGetBusinessStatusTypePage() { | ||
| 103 | + // mock 数据 | ||
| 104 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | ||
| 105 | + }); | ||
| 106 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | ||
| 107 | + // 准备参数 | ||
| 108 | + CrmBusinessStatusTypePageReqVO reqVO = new CrmBusinessStatusTypePageReqVO(); | ||
| 109 | + | ||
| 110 | + // 调用 | ||
| 111 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | ||
| 112 | + // 断言 | ||
| 113 | + assertEquals(1, pageResult.getTotal()); | ||
| 114 | + assertEquals(1, pageResult.getList().size()); | ||
| 115 | + assertPojoEquals(dbBusinessStatusType, pageResult.getList().get(0)); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | +} |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessExportReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO; | ||
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; | 8 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; |
| 9 | import org.junit.jupiter.api.Disabled; | 9 | import org.junit.jupiter.api.Disabled; |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customerlimitconfig/CrmCustomerLimitConfigServiceImplTest.java
| @@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.crm.service.customerlimitconfig; | @@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.crm.service.customerlimitconfig; | ||
| 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.framework.test.core.ut.BaseDbUnitTest; | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigCreateReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLimitConfigUpdateReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customerlimitconfig.CrmCustomerLimitConfigDO; | 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigCreateReqVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | ||
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper; | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper; |
| 10 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerLimitConfigServiceImpl; | ||
| 10 | import org.junit.jupiter.api.Disabled; | 11 | import org.junit.jupiter.api.Disabled; |
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |