Commit 63f9bcb0a3f451a73996bacbe4b0da7ff7b35a36
1 parent
3e9eb59d
crm:code review 商机类型、状态
Showing
36 changed files
with
136 additions
and
111 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 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 | 11 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 9 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 10 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 11 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 12 | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 13 | -import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 14 | 16 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 15 | 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; |
| 16 | 18 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusTypeService; |
| ... | ... | @@ -91,17 +93,21 @@ public class CrmBusinessController { |
| 91 | 93 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 92 | 94 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { |
| 93 | 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 | 101 | Set<Long> customerIds = pageResult.getList().stream() |
| 96 | 102 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 97 | 103 | List<CrmCustomerDO> customerList = customerService.getCustomerList(customerIds); |
| 98 | - //处理商机状态类型名称回显 | |
| 104 | + // 处理商机状态类型名称回显 | |
| 99 | 105 | Set<Long> statusTypeIds = pageResult.getList().stream() |
| 100 | 106 | .map(CrmBusinessDO::getStatusTypeId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 101 | 107 | CrmBusinessStatusTypeQueryVO queryStatusTypeVO = new CrmBusinessStatusTypeQueryVO(); |
| 102 | 108 | queryStatusTypeVO.setIdList(statusTypeIds); |
| 103 | 109 | List<CrmBusinessStatusTypeDO> statusTypeList = businessStatusTypeService.selectList(queryStatusTypeVO); |
| 104 | - //处理商机状态名称回显 | |
| 110 | + // 处理商机状态名称回显 | |
| 105 | 111 | Set<Long> statusIds = pageResult.getList().stream() |
| 106 | 112 | .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| 107 | 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 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.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 | 16 | import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; |
| 12 | 17 | import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; |
| 13 | 18 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| ... | ... | @@ -81,7 +86,8 @@ public class CrmBusinessStatusTypeController { |
| 81 | 86 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 82 | 87 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 83 | 88 | CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); |
| 84 | - //处理状态回显 | |
| 89 | + // 处理状态回显 | |
| 90 | + // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | |
| 85 | 91 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); |
| 86 | 92 | queryVO.setTypeId(id); |
| 87 | 93 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); |
| ... | ... | @@ -93,7 +99,8 @@ public class CrmBusinessStatusTypeController { |
| 93 | 99 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 94 | 100 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { |
| 95 | 101 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); |
| 96 | - //处理部门回显 | |
| 102 | + // 处理部门回显 | |
| 103 | + // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | |
| 97 | 104 | Set<Long> deptIds = pageResult.getList().stream() |
| 98 | 105 | .map(CrmBusinessStatusTypeDO::getDeptIds) |
| 99 | 106 | .filter(Objects::nonNull) |
| ... | ... | @@ -126,6 +133,7 @@ public class CrmBusinessStatusTypeController { |
| 126 | 133 | return success(BeanUtils.toBean(list, CrmBusinessStatusTypeRespVO.class)); |
| 127 | 134 | } |
| 128 | 135 | |
| 136 | + // TODO @ljlleo 这个接口,是不是可以和 getBusinessStatusTypeList 合并成一个? | |
| 129 | 137 | @GetMapping("/get-status-list") |
| 130 | 138 | @Operation(summary = "获得商机状态列表") |
| 131 | 139 | @PreAuthorize("@ss.hasPermission('crm:business-status:query')") |
| ... | ... | @@ -135,4 +143,5 @@ public class CrmBusinessStatusTypeController { |
| 135 | 143 | List<CrmBusinessStatusDO> list = businessStatusService.selectList(queryVO); |
| 136 | 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
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
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
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
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
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 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.*; |
| ... | ... | @@ -16,13 +16,13 @@ public class CrmBusinessRespVO extends CrmBusinessBaseVO { |
| 16 | 16 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 17 | 17 | private LocalDateTime createTime; |
| 18 | 18 | |
| 19 | - @Schema(description = "客户名称") | |
| 19 | + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 20 | 20 | private String customerName; |
| 21 | 21 | |
| 22 | - @Schema(description = "状态类型名称") | |
| 22 | + @Schema(description = "状态类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "进行中") | |
| 23 | 23 | private String statusTypeName; |
| 24 | 24 | |
| 25 | - @Schema(description = "状态名称") | |
| 25 | + @Schema(description = "状态名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "跟进中") | |
| 26 | 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
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 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 5 | import lombok.Data; |
| 5 | 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
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 | 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| ... | ... | @@ -26,7 +26,7 @@ public class CrmBusinessStatusRespVO { |
| 26 | 26 | @ExcelProperty("赢单率") |
| 27 | 27 | private String percent; |
| 28 | 28 | |
| 29 | - @Schema(description = "排序") | |
| 29 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 30 | 30 | @ExcelProperty("排序") |
| 31 | 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 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| ... | ... | @@ -21,9 +21,11 @@ public class CrmBusinessStatusSaveReqVO { |
| 21 | 21 | @NotEmpty(message = "状态名不能为空") |
| 22 | 22 | private String name; |
| 23 | 23 | |
| 24 | + // TODO @lilleo:percent 应该是 Integer; | |
| 24 | 25 | @Schema(description = "赢单率") |
| 25 | 26 | private String percent; |
| 26 | 27 | |
| 28 | + // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | |
| 27 | 29 | @Schema(description = "排序") |
| 28 | 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
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 | 3 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 4 | 4 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| ... | ... | @@ -22,13 +22,12 @@ public class CrmBusinessStatusTypeRespVO { |
| 22 | 22 | @ExcelProperty("状态类型名") |
| 23 | 23 | private String name; |
| 24 | 24 | |
| 25 | - @Schema(description = "使用的部门名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | - @ExcelProperty("使用的部门名称") | |
| 27 | - private List<String> deptNames; | |
| 28 | - | |
| 29 | 25 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 30 | 26 | @ExcelProperty("使用的部门编号") |
| 31 | 27 | private List<Long> deptIds; |
| 28 | + @Schema(description = "使用的部门名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 29 | + @ExcelProperty("使用的部门名称") | |
| 30 | + private List<String> deptNames; | |
| 32 | 31 | |
| 33 | 32 | @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED) |
| 34 | 33 | @ExcelProperty("创建人") |
| ... | ... | @@ -38,6 +37,7 @@ public class CrmBusinessStatusTypeRespVO { |
| 38 | 37 | @ExcelProperty("创建时间") |
| 39 | 38 | private LocalDateTime createTime; |
| 40 | 39 | |
| 40 | + // TODO @ljlleo 字段后缀改成 statuses,保持和 deptIds 风格一致;CrmBusinessStatusDO 改成 VO 哈;一般不使用 do 直接返回 | |
| 41 | 41 | @Schema(description = "状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 42 | 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 | 4 | import com.google.common.collect.Lists; |
| 4 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 6 | import lombok.Data; |
| ... | ... | @@ -21,6 +22,7 @@ public class CrmBusinessStatusTypeSaveReqVO { |
| 21 | 22 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 22 | 23 | private List<Long> deptIds = Lists.newArrayList(); |
| 23 | 24 | |
| 25 | + // TODO @ljlleo VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | |
| 24 | 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 25 | 27 | private List<CrmBusinessStatusSaveReqVO> statusList = Lists.newArrayList(); |
| 26 | 28 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.convert.business; |
| 2 | 2 | |
| 3 | 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 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 6 | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| ... | ... | @@ -46,14 +46,14 @@ public interface CrmBusinessConvert { |
| 46 | 46 | default PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page, List<CrmCustomerDO> customerList, |
| 47 | 47 | List<CrmBusinessStatusTypeDO> statusTypeList, List<CrmBusinessStatusDO> statusList) { |
| 48 | 48 | PageResult<CrmBusinessRespVO> result = convertPage(page); |
| 49 | + // 拼接关联字段 | |
| 49 | 50 | Map<Long, String> customerMap = convertMap(customerList, CrmCustomerDO::getId, CrmCustomerDO::getName); |
| 50 | 51 | Map<Long, String> statusTypeMap = convertMap(statusTypeList, CrmBusinessStatusTypeDO::getId, CrmBusinessStatusTypeDO::getName); |
| 51 | 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 | 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 | 1 | package cn.iocoder.yudao.module.crm.convert.businessstatus; |
| 2 | 2 | |
| 3 | 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 | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | 7 | import org.mapstruct.Mapper; |
| 8 | 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 | 1 | package cn.iocoder.yudao.module.crm.convert.businessstatustype; |
| 2 | 2 | |
| 3 | 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 | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 8 | 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| ... | ... | @@ -33,18 +33,17 @@ public interface CrmBusinessStatusTypeConvert { |
| 33 | 33 | |
| 34 | 34 | default PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page, List<DeptRespDTO> deptList) { |
| 35 | 35 | PageResult<CrmBusinessStatusTypeRespVO> pageResult = convertPage(page); |
| 36 | + // 拼接关联字段 | |
| 36 | 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 | 39 | return pageResult; |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | 42 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { |
| 43 | + // TODO @ljlleo 可以链式赋值,简化成一行; | |
| 44 | 44 | CrmBusinessStatusTypeRespVO result = convert(bean); |
| 45 | 45 | result.setStatusList(statusList); |
| 46 | 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/dal/dataobject/business/CrmBusinessDO.java
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 | 26 | private Long id; |
| 27 | 27 | /** |
| 28 | 28 | * 状态类型编号 |
| 29 | + * | |
| 30 | + * 关联 {@link CrmBusinessStatusTypeDO#getId()} | |
| 29 | 31 | */ |
| 30 | 32 | private Long typeId; |
| 31 | 33 | /** |
| ... | ... | @@ -34,6 +36,8 @@ public class CrmBusinessStatusDO { |
| 34 | 36 | private String name; |
| 35 | 37 | /** |
| 36 | 38 | * 赢单率 |
| 39 | + * | |
| 40 | + * TODO 这里是不是改成 Integer 存储,百分比 * 100 ; | |
| 37 | 41 | */ |
| 38 | 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
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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.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 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 9 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.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 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| ... | ... | @@ -31,8 +31,7 @@ public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.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 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | |
| 5 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 6 | 6 | |
| 7 | 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 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | |
| 7 | 7 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 9 | 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 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.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 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 8 | 8 | |
| 9 | 9 | import javax.validation.Valid; |
| ... | ... | @@ -54,6 +54,8 @@ public interface CrmBusinessStatusService { |
| 54 | 54 | */ |
| 55 | 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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 9 | 9 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; |
| 10 | 10 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -51,6 +51,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { |
| 51 | 51 | public void deleteBusinessStatus(Long id) { |
| 52 | 52 | // 校验存在 |
| 53 | 53 | validateBusinessStatusExists(id); |
| 54 | + // TODO @ljlleo 这里可以考虑,如果有商机在使用,不允许删除 | |
| 54 | 55 | // 删除 |
| 55 | 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 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.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 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 8 | 8 | |
| 9 | 9 | import javax.validation.Valid; |
| ... | ... | @@ -54,6 +54,7 @@ public interface CrmBusinessStatusTypeService { |
| 54 | 54 | */ |
| 55 | 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 | 62 | * @return 商机状态类型列表 |
| 62 | 63 | */ |
| 63 | 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 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | 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 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 11 | 12 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; |
| ... | ... | @@ -42,15 +43,14 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 42 | 43 | public Long createBusinessStatusType(CrmBusinessStatusTypeSaveReqVO createReqVO) { |
| 43 | 44 | //检验名称是否存在 |
| 44 | 45 | validateBusinessStatusTypeExists(createReqVO.getName(), null); |
| 45 | - // 插入 | |
| 46 | + // 插入类型 | |
| 46 | 47 | CrmBusinessStatusTypeDO businessStatusType = BeanUtils.toBean(createReqVO, CrmBusinessStatusTypeDO.class); |
| 47 | 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 | 54 | return businessStatusType.getId(); |
| 55 | 55 | } |
| 56 | 56 | |
| ... | ... | @@ -61,29 +61,27 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 61 | 61 | validateBusinessStatusTypeExists(updateReqVO.getId()); |
| 62 | 62 | // 校验名称是否存在 |
| 63 | 63 | validateBusinessStatusTypeExists(updateReqVO.getName(), updateReqVO.getId()); |
| 64 | - // 更新 | |
| 64 | + // 更新类型 | |
| 65 | 65 | CrmBusinessStatusTypeDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessStatusTypeDO.class); |
| 66 | 66 | businessStatusTypeMapper.updateById(updateObj); |
| 67 | - //删除状态 | |
| 67 | + // 更新状态(删除 + 更新) | |
| 68 | + // TODO @ljlleo 可以参考 DeliveryExpressTemplateServiceImpl 的 updateExpressTemplateFree 方法;主要没变化的,还是不删除了哈。 | |
| 68 | 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 | 71 | businessStatusMapper.insertBatch(BeanUtils.toBean(updateReqVO.getStatusList(), CrmBusinessStatusDO.class)); |
| 74 | 72 | } |
| 75 | 73 | |
| 76 | 74 | @Override |
| 77 | 75 | @Transactional(rollbackFor = Exception.class) |
| 78 | 76 | public void deleteBusinessStatusType(Long id) { |
| 79 | - //TODO 待添加被引用校验 | |
| 77 | + // TODO 待添加被引用校验 | |
| 80 | 78 | //... |
| 81 | 79 | |
| 82 | 80 | // 校验存在 |
| 83 | 81 | validateBusinessStatusTypeExists(id); |
| 84 | - // 删除 | |
| 82 | + // 删除类型 | |
| 85 | 83 | businessStatusTypeMapper.deleteById(id); |
| 86 | - //删除状态 | |
| 84 | + // 删除状态 | |
| 87 | 85 | businessStatusMapper.delete(id); |
| 88 | 86 | } |
| 89 | 87 | |
| ... | ... | @@ -93,6 +91,7 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 93 | 91 | } |
| 94 | 92 | } |
| 95 | 93 | |
| 94 | + // TODO @ljlleo 这个方法,这个参考 validateDeptNameUnique 实现。 | |
| 96 | 95 | private void validateBusinessStatusTypeExists(String name, Long id) { |
| 97 | 96 | LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); |
| 98 | 97 | if(null != id) { |
| ... | ... | @@ -118,4 +117,5 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 118 | 117 | public List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO) { |
| 119 | 118 | return businessStatusTypeMapper.selectList(queryVO); |
| 120 | 119 | } |
| 120 | + | |
| 121 | 121 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/BusinessStatusTypeServiceImplTest.java
| ... | ... | @@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.BusinessStatusTypePageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.BusinessStatusTypeSaveReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.BusinessStatusTypeDO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.mysql.business.BusinessStatusTypeMapper; | |
| 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 | 9 | import org.junit.jupiter.api.Disabled; |
| 10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | 11 | import org.springframework.context.annotation.Import; |
| ... | ... | @@ -19,55 +19,56 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 19 | 19 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; |
| 20 | 20 | import static org.junit.jupiter.api.Assertions.*; |
| 21 | 21 | |
| 22 | +// TODO 芋艿:后续再 review | |
| 22 | 23 | /** |
| 23 | - * {@link BusinessStatusTypeServiceImpl} 的单元测试类 | |
| 24 | + * {@link CrmBusinessStatusTypeServiceImpl} 的单元测试类 | |
| 24 | 25 | * |
| 25 | 26 | * @author ljlleo |
| 26 | 27 | */ |
| 27 | -@Import(BusinessStatusTypeServiceImpl.class) | |
| 28 | +@Import(CrmBusinessStatusTypeServiceImpl.class) | |
| 28 | 29 | public class BusinessStatusTypeServiceImplTest extends BaseDbUnitTest { |
| 29 | 30 | |
| 30 | 31 | @Resource |
| 31 | - private BusinessStatusTypeServiceImpl businessStatusTypeService; | |
| 32 | + private CrmBusinessStatusTypeServiceImpl businessStatusTypeService; | |
| 32 | 33 | |
| 33 | 34 | @Resource |
| 34 | - private BusinessStatusTypeMapper businessStatusTypeMapper; | |
| 35 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | |
| 35 | 36 | |
| 36 | 37 | @Test |
| 37 | 38 | public void testCreateBusinessStatusType_success() { |
| 38 | 39 | // 准备参数 |
| 39 | - BusinessStatusTypeSaveReqVO createReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class).setId(null); | |
| 40 | + CrmBusinessStatusTypeSaveReqVO createReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class).setId(null); | |
| 40 | 41 | |
| 41 | 42 | // 调用 |
| 42 | 43 | Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(createReqVO); |
| 43 | 44 | // 断言 |
| 44 | 45 | assertNotNull(businessStatusTypeId); |
| 45 | 46 | // 校验记录的属性是否正确 |
| 46 | - BusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | |
| 47 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | |
| 47 | 48 | assertPojoEquals(createReqVO, businessStatusType, "id"); |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | @Test |
| 51 | 52 | public void testUpdateBusinessStatusType_success() { |
| 52 | 53 | // mock 数据 |
| 53 | - BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class); | |
| 54 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | |
| 54 | 55 | businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 |
| 55 | 56 | // 准备参数 |
| 56 | - BusinessStatusTypeSaveReqVO updateReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class, o -> { | |
| 57 | + CrmBusinessStatusTypeSaveReqVO updateReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class, o -> { | |
| 57 | 58 | o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID |
| 58 | 59 | }); |
| 59 | 60 | |
| 60 | 61 | // 调用 |
| 61 | 62 | businessStatusTypeService.updateBusinessStatusType(updateReqVO); |
| 62 | 63 | // 校验是否更新正确 |
| 63 | - BusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(updateReqVO.getId()); // 获取最新的 | |
| 64 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(updateReqVO.getId()); // 获取最新的 | |
| 64 | 65 | assertPojoEquals(updateReqVO, businessStatusType); |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | @Test |
| 68 | 69 | public void testUpdateBusinessStatusType_notExists() { |
| 69 | 70 | // 准备参数 |
| 70 | - BusinessStatusTypeSaveReqVO updateReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class); | |
| 71 | + CrmBusinessStatusTypeSaveReqVO updateReqVO = randomPojo(CrmBusinessStatusTypeSaveReqVO.class); | |
| 71 | 72 | |
| 72 | 73 | // 调用, 并断言异常 |
| 73 | 74 | assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(updateReqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); |
| ... | ... | @@ -76,7 +77,7 @@ public class BusinessStatusTypeServiceImplTest extends BaseDbUnitTest { |
| 76 | 77 | @Test |
| 77 | 78 | public void testDeleteBusinessStatusType_success() { |
| 78 | 79 | // mock 数据 |
| 79 | - BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class); | |
| 80 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | |
| 80 | 81 | businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 |
| 81 | 82 | // 准备参数 |
| 82 | 83 | Long id = dbBusinessStatusType.getId(); |
| ... | ... | @@ -100,14 +101,14 @@ public class BusinessStatusTypeServiceImplTest extends BaseDbUnitTest { |
| 100 | 101 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 101 | 102 | public void testGetBusinessStatusTypePage() { |
| 102 | 103 | // mock 数据 |
| 103 | - BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class, o -> { // 等会查询到 | |
| 104 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | |
| 104 | 105 | }); |
| 105 | 106 | businessStatusTypeMapper.insert(dbBusinessStatusType); |
| 106 | 107 | // 准备参数 |
| 107 | - BusinessStatusTypePageReqVO reqVO = new BusinessStatusTypePageReqVO(); | |
| 108 | + CrmBusinessStatusTypePageReqVO reqVO = new CrmBusinessStatusTypePageReqVO(); | |
| 108 | 109 | |
| 109 | 110 | // 调用 |
| 110 | - PageResult<BusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | |
| 111 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | |
| 111 | 112 | // 断言 |
| 112 | 113 | assertEquals(1, pageResult.getTotal()); |
| 113 | 114 | assertEquals(1, pageResult.getList().size()); | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | |
| 3 | 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 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; |
| 9 | 9 | import org.junit.jupiter.api.Disabled; | ... | ... |