Commit d1579499f4f77239e537af8d7b67719ed8689c3c
Merge remote-tracking branch 'ljlleo/feature/crm' into feature/crm
# Conflicts: # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
Showing
39 changed files
with
550 additions
and
588 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| ... | ... | @@ -20,8 +20,6 @@ public interface ErrorCodeConstants { |
| 20 | 20 | |
| 21 | 21 | // TODO @lilleo:商机状态、商机类型,都单独错误码段 |
| 22 | 22 | |
| 23 | - ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_002_001, "商机状态类型不存在"); | |
| 24 | - ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_002_002, "商机状态不存在"); | |
| 25 | 23 | |
| 26 | 24 | // ========== 联系人管理 1-020-003-000 ========== |
| 27 | 25 | ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); |
| ... | ... | @@ -61,4 +59,11 @@ public interface ErrorCodeConstants { |
| 61 | 59 | // ========== 产品分类 1_020_009_000 ========== |
| 62 | 60 | ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1_020_009_000, "产品分类不存在"); |
| 63 | 61 | |
| 62 | + // ========== 商机状态类型 1_020_010_000 ========== | |
| 63 | + ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_010_000, "商机状态类型不存在"); | |
| 64 | + ErrorCode BUSINESS_STATUS_TYPE_NAME_EXISTS = new ErrorCode(1_020_010_001, "商机状态类型名称已存在"); | |
| 65 | + | |
| 66 | + // ========== 商机状态 1_020_011_000 ========== | |
| 67 | + ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_011_000, "商机状态不存在"); | |
| 68 | + | |
| 64 | 69 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| ... | ... | @@ -7,7 +7,14 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 9 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 10 | 14 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 15 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; | |
| 16 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusTypeService; | |
| 17 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | |
| 11 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 12 | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| 13 | 20 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -20,6 +27,9 @@ import javax.servlet.http.HttpServletResponse; |
| 20 | 27 | import javax.validation.Valid; |
| 21 | 28 | import java.io.IOException; |
| 22 | 29 | import java.util.List; |
| 30 | +import java.util.Objects; | |
| 31 | +import java.util.Set; | |
| 32 | +import java.util.stream.Collectors; | |
| 23 | 33 | |
| 24 | 34 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 25 | 35 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| ... | ... | @@ -34,6 +44,15 @@ public class CrmBusinessController { |
| 34 | 44 | @Resource |
| 35 | 45 | private CrmBusinessService businessService; |
| 36 | 46 | |
| 47 | + @Resource | |
| 48 | + private CrmCustomerService customerService; | |
| 49 | + | |
| 50 | + @Resource | |
| 51 | + private CrmBusinessStatusTypeService businessStatusTypeService; | |
| 52 | + | |
| 53 | + @Resource | |
| 54 | + private CrmBusinessStatusService businessStatusService; | |
| 55 | + | |
| 37 | 56 | @PostMapping("/create") |
| 38 | 57 | @Operation(summary = "创建商机") |
| 39 | 58 | @PreAuthorize("@ss.hasPermission('crm:business:create')") |
| ... | ... | @@ -72,7 +91,23 @@ public class CrmBusinessController { |
| 72 | 91 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 73 | 92 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { |
| 74 | 93 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO, getLoginUserId()); |
| 75 | - return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult)); | |
| 94 | + //处理客户名称回显 | |
| 95 | + Set<Long> customerIds = pageResult.getList().stream() | |
| 96 | + .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 97 | + List<CrmCustomerDO> customerList = customerService.getCustomerList(customerIds); | |
| 98 | + //处理商机状态类型名称回显 | |
| 99 | + Set<Long> statusTypeIds = pageResult.getList().stream() | |
| 100 | + .map(CrmBusinessDO::getStatusTypeId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 101 | + CrmBusinessStatusTypeQueryVO queryStatusTypeVO = new CrmBusinessStatusTypeQueryVO(); | |
| 102 | + queryStatusTypeVO.setIdList(statusTypeIds); | |
| 103 | + List<CrmBusinessStatusTypeDO> statusTypeList = businessStatusTypeService.selectList(queryStatusTypeVO); | |
| 104 | + //处理商机状态名称回显 | |
| 105 | + Set<Long> statusIds = pageResult.getList().stream() | |
| 106 | + .map(CrmBusinessDO::getCustomerId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 107 | + CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | |
| 108 | + queryVO.setIdList(statusIds); | |
| 109 | + List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | |
| 110 | + return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult, customerList, statusTypeList, statusList)); | |
| 76 | 111 | } |
| 77 | 112 | |
| 78 | 113 | @GetMapping("/pool-page") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusTypeController.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype; | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 5 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; | |
| 11 | +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | |
| 9 | 12 | import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; |
| 10 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 11 | -import cn.iocoder.yudao.module.crm.service.businessstatustype.CrmBusinessStatusTypeService; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 14 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 15 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; | |
| 16 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusTypeService; | |
| 17 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 18 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 12 | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 14 | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -22,11 +29,13 @@ import javax.validation.Valid; |
| 22 | 29 | import java.io.IOException; |
| 23 | 30 | import java.util.Collection; |
| 24 | 31 | import java.util.List; |
| 32 | +import java.util.Objects; | |
| 33 | +import java.util.Set; | |
| 34 | +import java.util.stream.Collectors; | |
| 25 | 35 | |
| 26 | 36 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | 37 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 28 | 38 | |
| 29 | -// TODO @lilleo:这个模块,可以挪到 business 下;这样我打开 business 包下,就知道,噢~原来里面有 business 商机、有 type 状态类型、status 具体状态; | |
| 30 | 39 | @Tag(name = "管理后台 - 商机状态类型") |
| 31 | 40 | @RestController |
| 32 | 41 | @RequestMapping("/crm/business-status-type") |
| ... | ... | @@ -36,17 +45,23 @@ public class CrmBusinessStatusTypeController { |
| 36 | 45 | @Resource |
| 37 | 46 | private CrmBusinessStatusTypeService businessStatusTypeService; |
| 38 | 47 | |
| 48 | + @Resource | |
| 49 | + private CrmBusinessStatusService businessStatusService; | |
| 50 | + | |
| 51 | + @Resource | |
| 52 | + private DeptApi deptApi; | |
| 53 | + | |
| 39 | 54 | @PostMapping("/create") |
| 40 | 55 | @Operation(summary = "创建商机状态类型") |
| 41 | 56 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:create')") |
| 42 | - public CommonResult<Long> createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeCreateReqVO createReqVO) { | |
| 57 | + public CommonResult<Long> createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeSaveReqVO createReqVO) { | |
| 43 | 58 | return success(businessStatusTypeService.createBusinessStatusType(createReqVO)); |
| 44 | 59 | } |
| 45 | 60 | |
| 46 | 61 | @PutMapping("/update") |
| 47 | 62 | @Operation(summary = "更新商机状态类型") |
| 48 | 63 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:update')") |
| 49 | - public CommonResult<Boolean> updateBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | |
| 64 | + public CommonResult<Boolean> updateBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeSaveReqVO updateReqVO) { | |
| 50 | 65 | businessStatusTypeService.updateBusinessStatusType(updateReqVO); |
| 51 | 66 | return success(true); |
| 52 | 67 | } |
| ... | ... | @@ -66,45 +81,58 @@ public class CrmBusinessStatusTypeController { |
| 66 | 81 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 67 | 82 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 68 | 83 | CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); |
| 69 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType)); | |
| 70 | - } | |
| 71 | - | |
| 72 | - // TODO @lilleo:这个接口,暂时用不到,可以考虑先删除掉 | |
| 73 | - @GetMapping("/list") | |
| 74 | - @Operation(summary = "获得商机状态类型列表") | |
| 75 | - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 76 | - @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | |
| 77 | - public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList(@RequestParam("ids") Collection<Long> ids) { | |
| 78 | - List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(ids); | |
| 79 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | |
| 84 | + //处理状态回显 | |
| 85 | + CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | |
| 86 | + queryVO.setTypeId(id); | |
| 87 | + List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | |
| 88 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType, statusList)); | |
| 80 | 89 | } |
| 81 | 90 | |
| 82 | 91 | @GetMapping("/page") |
| 83 | 92 | @Operation(summary = "获得商机状态类型分页") |
| 84 | 93 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 85 | - public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageVO) { | |
| 86 | - PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageVO); | |
| 87 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult)); | |
| 94 | + public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { | |
| 95 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); | |
| 96 | + //处理部门回显 | |
| 97 | + Set<Long> deptIds = pageResult.getList().stream() | |
| 98 | + .map(CrmBusinessStatusTypeDO::getDeptIds) | |
| 99 | + .filter(Objects::nonNull) | |
| 100 | + .flatMap(Collection::stream) | |
| 101 | + .collect(Collectors.toSet()); | |
| 102 | + List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds); | |
| 103 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult, deptList)); | |
| 88 | 104 | } |
| 89 | 105 | |
| 90 | 106 | @GetMapping("/export-excel") |
| 91 | 107 | @Operation(summary = "导出商机状态类型 Excel") |
| 92 | 108 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:export')") |
| 93 | 109 | @OperateLog(type = EXPORT) |
| 94 | - public void exportBusinessStatusTypeExcel(@Valid CrmBusinessStatusTypeExportReqVO exportReqVO, | |
| 110 | + public void exportBusinessStatusTypeExcel(@Valid CrmBusinessStatusTypePageReqVO pageReqVO, | |
| 95 | 111 | HttpServletResponse response) throws IOException { |
| 96 | - List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(exportReqVO); | |
| 112 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 113 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO).getList(); | |
| 97 | 114 | // 导出 Excel |
| 98 | - List<CrmBusinessStatusTypeExcelVO> datas = CrmBusinessStatusTypeConvert.INSTANCE.convertList02(list); | |
| 99 | - ExcelUtils.write(response, "商机状态类型.xls", "数据", CrmBusinessStatusTypeExcelVO.class, datas); | |
| 115 | + ExcelUtils.write(response, "商机状态类型.xls", "数据", CrmBusinessStatusTypeRespVO.class, | |
| 116 | + BeanUtils.toBean(list, CrmBusinessStatusTypeRespVO.class)); | |
| 100 | 117 | } |
| 101 | 118 | |
| 102 | 119 | @GetMapping("/get-simple-list") |
| 103 | 120 | @Operation(summary = "获得商机状态类型列表") |
| 104 | 121 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 105 | 122 | public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList() { |
| 106 | - List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 107 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | |
| 123 | + CrmBusinessStatusTypeQueryVO queryVO = new CrmBusinessStatusTypeQueryVO(); | |
| 124 | + queryVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 125 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.selectList(queryVO); | |
| 126 | + return success(BeanUtils.toBean(list, CrmBusinessStatusTypeRespVO.class)); | |
| 108 | 127 | } |
| 109 | 128 | |
| 129 | + @GetMapping("/get-status-list") | |
| 130 | + @Operation(summary = "获得商机状态列表") | |
| 131 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 132 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusListByTypeId(@RequestParam("typeId") Long typeId) { | |
| 133 | + CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | |
| 134 | + queryVO.setTypeId(typeId); | |
| 135 | + List<CrmBusinessStatusDO> list = businessStatusService.selectList(queryVO); | |
| 136 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 137 | + } | |
| 110 | 138 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessRespVO.java
| ... | ... | @@ -16,4 +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 = "客户名称") | |
| 20 | + private String customerName; | |
| 21 | + | |
| 22 | + @Schema(description = "状态类型名称") | |
| 23 | + private String statusTypeName; | |
| 24 | + | |
| 25 | + @Schema(description = "状态名称") | |
| 26 | + private String statusName; | |
| 27 | + | |
| 19 | 28 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -12,7 +12,4 @@ import lombok.ToString; |
| 12 | 12 | @ToString(callSuper = true) |
| 13 | 13 | public class CrmBusinessStatusPageReqVO extends PageParam { |
| 14 | 14 | |
| 15 | - @Schema(description = "状态类型编号", example = "22882") | |
| 16 | - private Long typeId; | |
| 17 | - | |
| 18 | 15 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusQueryVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +import java.util.Collection; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 商机状态 Query VO") | |
| 10 | +@Data | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmBusinessStatusQueryVO { | |
| 13 | + | |
| 14 | + @Schema(description = "主键集合") | |
| 15 | + private Collection<Long> idList; | |
| 16 | + | |
| 17 | + @Schema(description = "状态类型编号") | |
| 18 | + private Long typeId; | |
| 19 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | 2 | |
| 3 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | |
| 3 | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | 6 | import lombok.Data; |
| 5 | 7 | |
| 6 | -// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 7 | -/** | |
| 8 | - * 商机状态 Excel VO | |
| 9 | - * | |
| 10 | - * @author ljlleo | |
| 11 | - */ | |
| 8 | +@Schema(description = "管理后台 - 商机状态 Response VO") | |
| 12 | 9 | @Data |
| 13 | -public class CrmBusinessStatusExcelVO { | |
| 10 | +@ExcelIgnoreUnannotated | |
| 11 | +public class CrmBusinessStatusRespVO { | |
| 14 | 12 | |
| 13 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23899") | |
| 15 | 14 | @ExcelProperty("主键") |
| 16 | 15 | private Long id; |
| 17 | 16 | |
| 17 | + @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7139") | |
| 18 | 18 | @ExcelProperty("状态类型编号") |
| 19 | 19 | private Long typeId; |
| 20 | 20 | |
| 21 | + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | |
| 21 | 22 | @ExcelProperty("状态名") |
| 22 | 23 | private String name; |
| 23 | 24 | |
| 25 | + @Schema(description = "赢单率") | |
| 24 | 26 | @ExcelProperty("赢单率") |
| 25 | 27 | private String percent; |
| 26 | 28 | |
| 29 | + @Schema(description = "排序") | |
| 27 | 30 | @ExcelProperty("排序") |
| 28 | 31 | private Integer sort; |
| 29 | 32 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusSaveReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | +import javax.validation.constraints.NotEmpty; | |
| 6 | 7 | import javax.validation.constraints.NotNull; |
| 7 | 8 | |
| 8 | -/** | |
| 9 | - * 商机状态 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | - */ | |
| 9 | +@Schema(description = "管理后台 - 商机状态新增/修改 Request VO") | |
| 12 | 10 | @Data |
| 13 | -public class CrmBusinessStatusBaseVO { | |
| 11 | +public class CrmBusinessStatusSaveReqVO { | |
| 14 | 12 | |
| 15 | - // TODO @lilleo:example 要写下 | |
| 13 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23899") | |
| 14 | + private Long id; | |
| 16 | 15 | |
| 17 | - @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22882") | |
| 16 | + @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7139") | |
| 18 | 17 | @NotNull(message = "状态类型编号不能为空") |
| 19 | 18 | private Long typeId; |
| 20 | 19 | |
| 21 | - @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 22 | - @NotNull(message = "状态名不能为空") | |
| 20 | + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | |
| 21 | + @NotEmpty(message = "状态名不能为空") | |
| 23 | 22 | private String name; |
| 24 | 23 | |
| 25 | - // TODO @lilleo:percent 应该是 Integer; | |
| 26 | 24 | @Schema(description = "赢单率") |
| 27 | 25 | private String percent; |
| 28 | 26 | |
| 29 | - // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | |
| 30 | 27 | @Schema(description = "排序") |
| 31 | 28 | private Integer sort; |
| 32 | 29 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypePageReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -12,10 +12,4 @@ import lombok.ToString; |
| 12 | 12 | @ToString(callSuper = true) |
| 13 | 13 | public class CrmBusinessStatusTypePageReqVO extends PageParam { |
| 14 | 14 | |
| 15 | - @Schema(description = "状态类型名", example = "芋艿") | |
| 16 | - private String name; | |
| 17 | - | |
| 18 | - @Schema(description = "开启状态", example = "1") | |
| 19 | - private Boolean status; | |
| 20 | - | |
| 21 | 15 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeQueryVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +import java.util.Collection; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 商机状态类型 Query VO") | |
| 10 | +@Data | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmBusinessStatusTypeQueryVO { | |
| 13 | + | |
| 14 | + @Schema(description = "主键集合") | |
| 15 | + private Collection<Long> idList; | |
| 16 | + | |
| 17 | + @Schema(description = "状态") | |
| 18 | + private Integer status; | |
| 19 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 4 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | |
| 5 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 商机状态类型 Response VO") | |
| 13 | +@Data | |
| 14 | +@ExcelIgnoreUnannotated | |
| 15 | +public class CrmBusinessStatusTypeRespVO { | |
| 16 | + | |
| 17 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2934") | |
| 18 | + @ExcelProperty("主键") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 22 | + @ExcelProperty("状态类型名") | |
| 23 | + private String name; | |
| 24 | + | |
| 25 | + @Schema(description = "使用的部门名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | + @ExcelProperty("使用的部门名称") | |
| 27 | + private List<String> deptNames; | |
| 28 | + | |
| 29 | + @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | + @ExcelProperty("使用的部门编号") | |
| 31 | + private List<Long> deptIds; | |
| 32 | + | |
| 33 | + @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @ExcelProperty("创建人") | |
| 35 | + private String creator; | |
| 36 | + | |
| 37 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 38 | + @ExcelProperty("创建时间") | |
| 39 | + private LocalDateTime createTime; | |
| 40 | + | |
| 41 | + @Schema(description = "状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 42 | + private List<CrmBusinessStatusDO> statusList; | |
| 43 | + | |
| 44 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessStatusTypeSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo; | |
| 2 | + | |
| 3 | +import com.google.common.collect.Lists; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import javax.validation.constraints.NotEmpty; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 商机状态类型新增/修改 Request VO") | |
| 11 | +@Data | |
| 12 | +public class CrmBusinessStatusTypeSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2934") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 18 | + @NotEmpty(message = "状态类型名不能为空") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | + @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 22 | + private List<Long> deptIds = Lists.newArrayList(); | |
| 23 | + | |
| 24 | + @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 25 | + private List<CrmBusinessStatusSaveReqVO> statusList = Lists.newArrayList(); | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 6 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | |
| 8 | -import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | |
| 9 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 10 | -import cn.iocoder.yudao.module.crm.service.businessstatus.CrmBusinessStatusService; | |
| 11 | -import io.swagger.v3.oas.annotations.Operation; | |
| 12 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | -import org.springframework.validation.annotation.Validated; | |
| 16 | -import org.springframework.web.bind.annotation.*; | |
| 17 | - | |
| 18 | -import javax.annotation.Resource; | |
| 19 | -import javax.servlet.http.HttpServletResponse; | |
| 20 | -import javax.validation.Valid; | |
| 21 | -import java.io.IOException; | |
| 22 | -import java.util.Collection; | |
| 23 | -import java.util.List; | |
| 24 | - | |
| 25 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 26 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 27 | - | |
| 28 | -// TODO @lilleo:这个模块,可以挪到 business 下;这样我打开 business 包下,就知道,噢~原来里面有 business 商机、有 type 状态类型、status 具体状态; | |
| 29 | -@Tag(name = "管理后台 - 商机状态") | |
| 30 | -@RestController | |
| 31 | -@RequestMapping("/crm/business-status") | |
| 32 | -@Validated | |
| 33 | -public class CrmBusinessStatusController { | |
| 34 | - | |
| 35 | - @Resource | |
| 36 | - private CrmBusinessStatusService businessStatusService; | |
| 37 | - | |
| 38 | - @PostMapping("/create") | |
| 39 | - @Operation(summary = "创建商机状态") | |
| 40 | - @PreAuthorize("@ss.hasPermission('crm:business-status:create')") | |
| 41 | - public CommonResult<Long> createBusinessStatus(@Valid @RequestBody CrmBusinessStatusCreateReqVO createReqVO) { | |
| 42 | - return success(businessStatusService.createBusinessStatus(createReqVO)); | |
| 43 | - } | |
| 44 | - | |
| 45 | - @PutMapping("/update") | |
| 46 | - @Operation(summary = "更新商机状态") | |
| 47 | - @PreAuthorize("@ss.hasPermission('crm:business-status:update')") | |
| 48 | - public CommonResult<Boolean> updateBusinessStatus(@Valid @RequestBody CrmBusinessStatusUpdateReqVO updateReqVO) { | |
| 49 | - businessStatusService.updateBusinessStatus(updateReqVO); | |
| 50 | - return success(true); | |
| 51 | - } | |
| 52 | - | |
| 53 | - @DeleteMapping("/delete") | |
| 54 | - @Operation(summary = "删除商机状态") | |
| 55 | - @Parameter(name = "id", description = "编号", required = true) | |
| 56 | - @PreAuthorize("@ss.hasPermission('crm:business-status:delete')") | |
| 57 | - public CommonResult<Boolean> deleteBusinessStatus(@RequestParam("id") Long id) { | |
| 58 | - businessStatusService.deleteBusinessStatus(id); | |
| 59 | - return success(true); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @GetMapping("/get") | |
| 63 | - @Operation(summary = "获得商机状态") | |
| 64 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 65 | - @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 66 | - public CommonResult<CrmBusinessStatusRespVO> getBusinessStatus(@RequestParam("id") Long id) { | |
| 67 | - CrmBusinessStatusDO businessStatus = businessStatusService.getBusinessStatus(id); | |
| 68 | - return success(CrmBusinessStatusConvert.INSTANCE.convert(businessStatus)); | |
| 69 | - } | |
| 70 | - | |
| 71 | - // TODO @lilleo:这个接口,暂时用不到,可以考虑先删除掉 | |
| 72 | - @GetMapping("/list") | |
| 73 | - @Operation(summary = "获得商机状态列表") | |
| 74 | - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 75 | - @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 76 | - public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList(@RequestParam("ids") Collection<Long> ids) { | |
| 77 | - List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(ids); | |
| 78 | - return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 79 | - } | |
| 80 | - | |
| 81 | - @GetMapping("/page") | |
| 82 | - @Operation(summary = "获得商机状态分页") | |
| 83 | - @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 84 | - public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusPage(@Valid CrmBusinessStatusPageReqVO pageVO) { | |
| 85 | - PageResult<CrmBusinessStatusDO> pageResult = businessStatusService.getBusinessStatusPage(pageVO); | |
| 86 | - return success(CrmBusinessStatusConvert.INSTANCE.convertPage(pageResult)); | |
| 87 | - } | |
| 88 | - | |
| 89 | - @GetMapping("/export-excel") | |
| 90 | - @Operation(summary = "导出商机状态 Excel") | |
| 91 | - @PreAuthorize("@ss.hasPermission('crm:business-status:export')") | |
| 92 | - @OperateLog(type = EXPORT) | |
| 93 | - public void exportBusinessStatusExcel(@Valid CrmBusinessStatusExportReqVO exportReqVO, | |
| 94 | - HttpServletResponse response) throws IOException { | |
| 95 | - List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(exportReqVO); | |
| 96 | - // 导出 Excel | |
| 97 | - List<CrmBusinessStatusExcelVO> datas = CrmBusinessStatusConvert.INSTANCE.convertList02(list); | |
| 98 | - ExcelUtils.write(response, "商机状态.xls", "数据", CrmBusinessStatusExcelVO.class, datas); | |
| 99 | - } | |
| 100 | - | |
| 101 | - // TODO 芋艿:后续再看看 | |
| 102 | - @GetMapping("/get-simple-list") | |
| 103 | - @Operation(summary = "获得商机状态列表") | |
| 104 | - @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 105 | - public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusListByTypeId(@RequestParam("typeId") Integer typeId) { | |
| 106 | - List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusListByTypeId(typeId); | |
| 107 | - return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 108 | - } | |
| 109 | - | |
| 110 | - // TODO 芋艿:后续再看看 | |
| 111 | - @GetMapping("/get-all-list") | |
| 112 | - @Operation(summary = "获得商机状态列表") | |
| 113 | - @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 114 | - public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList() { | |
| 115 | - List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(); | |
| 116 | - return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 117 | - } | |
| 118 | - | |
| 119 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 商机状态创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class CrmBusinessStatusCreateReqVO extends CrmBusinessStatusBaseVO { | |
| 13 | - | |
| 14 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 7 | -@Schema(description = "管理后台 - 商机状态 Excel 导出 Request VO,参数和 CrmBusinessStatusPageReqVO 是一致的") | |
| 8 | -@Data | |
| 9 | -public class CrmBusinessStatusExportReqVO { | |
| 10 | - | |
| 11 | - @Schema(description = "状态类型编号", example = "22882") | |
| 12 | - private Long typeId; | |
| 13 | - | |
| 14 | - @Schema(description = "状态名", example = "李四") | |
| 15 | - private String name; | |
| 16 | - | |
| 17 | - @Schema(description = "赢单率") | |
| 18 | - private String percent; | |
| 19 | - | |
| 20 | - @Schema(description = "排序") | |
| 21 | - private Integer sort; | |
| 22 | - | |
| 23 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | - | |
| 6 | -@Schema(description = "管理后台 - 商机状态 Response VO") | |
| 7 | -@Data | |
| 8 | -@EqualsAndHashCode(callSuper = true) | |
| 9 | -@ToString(callSuper = true) | |
| 10 | -public class CrmBusinessStatusRespVO extends CrmBusinessStatusBaseVO { | |
| 11 | - | |
| 12 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.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 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 商机状态更新 Request VO") | |
| 11 | -@Data | |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class CrmBusinessStatusUpdateReqVO extends CrmBusinessStatusBaseVO { | |
| 15 | - | |
| 16 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | |
| 17 | - @NotNull(message = "编号不能为空") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import javax.validation.constraints.NotNull; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 商机状态类型 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -public class CrmBusinessStatusTypeBaseVO { | |
| 14 | - | |
| 15 | - @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 16 | - @NotNull(message = "状态类型名不能为空") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 20 | - @NotNull(message = "使用的部门编号不能为空") | |
| 21 | - private String deptIds; | |
| 22 | - | |
| 23 | - @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | - @NotNull(message = "开启状态不能为空") | |
| 25 | - private Boolean status; | |
| 26 | - | |
| 27 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.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 | -// TODO 状态类型和状态添加,是在一个请求里,所以需要把 CrmBusinessStatusCreateReqVO 融合进来; | |
| 9 | -@Schema(description = "管理后台 - 商机状态类型创建 Request VO") | |
| 10 | -@Data | |
| 11 | -@EqualsAndHashCode(callSuper = true) | |
| 12 | -@ToString(callSuper = true) | |
| 13 | -public class CrmBusinessStatusTypeCreateReqVO extends CrmBusinessStatusTypeBaseVO { | |
| 14 | - | |
| 15 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | - | |
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | - | |
| 8 | -// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 9 | -/** | |
| 10 | - * 商机状态类型 Excel VO | |
| 11 | - * | |
| 12 | - * @author ljlleo | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -public class CrmBusinessStatusTypeExcelVO { | |
| 16 | - | |
| 17 | - @ExcelProperty("主键") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | - @ExcelProperty("状态类型名") | |
| 21 | - private String name; | |
| 22 | - | |
| 23 | - @ExcelProperty("使用的部门编号") | |
| 24 | - private String deptIds; | |
| 25 | - | |
| 26 | - @ExcelProperty("开启状态") | |
| 27 | - private Boolean status; | |
| 28 | - | |
| 29 | - @ExcelProperty("创建时间") | |
| 30 | - private LocalDateTime createTime; | |
| 31 | - | |
| 32 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | - | |
| 11 | -// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 12 | -@Schema(description = "管理后台 - 商机状态类型 Excel 导出 Request VO,参数和 CrmBusinessStatusTypePageReqVO 是一致的") | |
| 13 | -@Data | |
| 14 | -public class CrmBusinessStatusTypeExportReqVO { | |
| 15 | - | |
| 16 | - @Schema(description = "状态类型名", example = "芋艿") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "使用的部门编号") | |
| 20 | - private String deptIds; | |
| 21 | - | |
| 22 | - @Schema(description = "开启状态", example = "1") | |
| 23 | - private Boolean status; | |
| 24 | - | |
| 25 | - @Schema(description = "创建时间") | |
| 26 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | - private LocalDateTime[] createTime; | |
| 28 | - | |
| 29 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 商机状态类型 Response VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class CrmBusinessStatusTypeRespVO extends CrmBusinessStatusTypeBaseVO { | |
| 12 | - | |
| 13 | - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 17 | - private LocalDateTime createTime; | |
| 18 | - | |
| 19 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.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 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -// TODO 状态类型和状态添加,是在一个请求里,所以需要把 CrmBusinessStatusUpdateReqVO 融合进来; | |
| 11 | -@Schema(description = "管理后台 - 商机状态类型更新 Request VO") | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -@ToString(callSuper = true) | |
| 15 | -public class CrmBusinessStatusTypeUpdateReqVO extends CrmBusinessStatusTypeBaseVO { | |
| 16 | - | |
| 17 | - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | |
| 18 | - @NotNull(message = "主键不能为空") | |
| 19 | - private Long id; | |
| 20 | - | |
| 21 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
| ... | ... | @@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.crm.convert.business; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 6 | 9 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| 7 | 10 | import org.mapstruct.Mapper; |
| 8 | 11 | import org.mapstruct.Mapping; |
| ... | ... | @@ -10,6 +13,9 @@ import org.mapstruct.Mappings; |
| 10 | 13 | import org.mapstruct.factory.Mappers; |
| 11 | 14 | |
| 12 | 15 | import java.util.List; |
| 16 | +import java.util.Map; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 13 | 19 | |
| 14 | 20 | /** |
| 15 | 21 | * 商机 Convert |
| ... | ... | @@ -37,4 +43,18 @@ public interface CrmBusinessConvert { |
| 37 | 43 | }) |
| 38 | 44 | CrmPermissionTransferReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId); |
| 39 | 45 | |
| 46 | + default PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page, List<CrmCustomerDO> customerList, | |
| 47 | + List<CrmBusinessStatusTypeDO> statusTypeList, List<CrmBusinessStatusDO> statusList) { | |
| 48 | + PageResult<CrmBusinessRespVO> result = convertPage(page); | |
| 49 | + 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> 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 | + }); | |
| 57 | + return result; | |
| 58 | + } | |
| 59 | + | |
| 40 | 60 | } | ... | ... |
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 | -import java.util.*; | |
| 4 | - | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusRespVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 7 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 商机状态 Convert |
| ... | ... | @@ -19,9 +19,7 @@ public interface CrmBusinessStatusConvert { |
| 19 | 19 | |
| 20 | 20 | CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); |
| 21 | 21 | |
| 22 | - CrmBusinessStatusDO convert(CrmBusinessStatusCreateReqVO bean); | |
| 23 | - | |
| 24 | - CrmBusinessStatusDO convert(CrmBusinessStatusUpdateReqVO bean); | |
| 22 | + CrmBusinessStatusDO convert(CrmBusinessStatusSaveReqVO bean); | |
| 25 | 23 | |
| 26 | 24 | CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean); |
| 27 | 25 | |
| ... | ... | @@ -29,6 +27,4 @@ public interface CrmBusinessStatusConvert { |
| 29 | 27 | |
| 30 | 28 | PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page); |
| 31 | 29 | |
| 32 | - List<CrmBusinessStatusExcelVO> convertList02(List<CrmBusinessStatusDO> list); | |
| 33 | - | |
| 34 | 30 | } | ... | ... |
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 | -import java.util.*; | |
| 4 | - | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeRespVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 8 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 7 | 9 | import org.mapstruct.Mapper; |
| 8 | 10 | import org.mapstruct.factory.Mappers; |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 16 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 11 | 17 | |
| 12 | 18 | /** |
| 13 | 19 | * 商机状态类型 Convert |
| ... | ... | @@ -19,16 +25,26 @@ public interface CrmBusinessStatusTypeConvert { |
| 19 | 25 | |
| 20 | 26 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); |
| 21 | 27 | |
| 22 | - CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeCreateReqVO bean); | |
| 23 | - | |
| 24 | - CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeUpdateReqVO bean); | |
| 28 | + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeSaveReqVO bean); | |
| 25 | 29 | |
| 26 | 30 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); |
| 27 | 31 | |
| 28 | - List<CrmBusinessStatusTypeRespVO> convertList(List<CrmBusinessStatusTypeDO> list); | |
| 29 | - | |
| 30 | 32 | PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); |
| 31 | 33 | |
| 32 | - List<CrmBusinessStatusTypeExcelVO> convertList02(List<CrmBusinessStatusTypeDO> list); | |
| 34 | + default PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page, List<DeptRespDTO> deptList) { | |
| 35 | + PageResult<CrmBusinessStatusTypeRespVO> pageResult = convertPage(page); | |
| 36 | + 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 | + }); | |
| 40 | + return pageResult; | |
| 41 | + } | |
| 42 | + | |
| 43 | + default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { | |
| 44 | + CrmBusinessStatusTypeRespVO result = convert(bean); | |
| 45 | + result.setStatusList(statusList); | |
| 46 | + return result; | |
| 47 | + } | |
| 48 | + | |
| 33 | 49 | |
| 34 | 50 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 6 | 4 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 7 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 8 | 6 | import com.baomidou.mybatisplus.annotation.TableName; | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus; | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.business; | |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 4 | 4 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -26,8 +26,6 @@ public class CrmBusinessStatusDO { |
| 26 | 26 | private Long id; |
| 27 | 27 | /** |
| 28 | 28 | * 状态类型编号 |
| 29 | - * | |
| 30 | - * // TODO @ljlleo:要写下关联字段噢 | |
| 31 | 29 | */ |
| 32 | 30 | private Long typeId; |
| 33 | 31 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype; | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.business; | |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 3 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 4 | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 5 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| 6 | 9 | import lombok.*; |
| 7 | 10 | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 8 | 13 | /** |
| 9 | 14 | * 商机状态类型 DO |
| 10 | 15 | * |
| 11 | 16 | * @author ljlleo |
| 12 | 17 | */ |
| 13 | -@TableName("crm_business_status_type") | |
| 18 | +@TableName(value = "crm_business_status_type", autoResultMap = true) | |
| 14 | 19 | @KeySequence("crm_business_status_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 15 | 20 | @Data |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 16 | 22 | @ToString(callSuper = true) |
| 17 | 23 | @Builder |
| 18 | 24 | @NoArgsConstructor |
| 19 | 25 | @AllArgsConstructor |
| 20 | -public class CrmBusinessStatusTypeDO { | |
| 26 | +public class CrmBusinessStatusTypeDO extends BaseDO { | |
| 21 | 27 | |
| 22 | 28 | /** |
| 23 | 29 | * 主键 |
| ... | ... | @@ -28,15 +34,14 @@ public class CrmBusinessStatusTypeDO { |
| 28 | 34 | * 状态类型名 |
| 29 | 35 | */ |
| 30 | 36 | private String name; |
| 31 | - // TODO @ljlleo:List 存储哈 | |
| 32 | 37 | /** |
| 33 | 38 | * 使用的部门编号 |
| 34 | 39 | */ |
| 35 | - private String deptIds; | |
| 40 | + @TableField(typeHandler = LongListTypeHandler.class) | |
| 41 | + private List<Long> deptIds; | |
| 36 | 42 | /** |
| 37 | 43 | * 开启状态 |
| 38 | 44 | */ |
| 39 | - // TODO @ljlleo:这个字段,使用 Integer,对应 CommonStatus | |
| 40 | 45 | private Boolean status; |
| 41 | 46 | |
| 42 | 47 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusMapper.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.mysql.businessstatus; | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.business; | |
| 2 | 2 | |
| 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.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusQueryVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -20,21 +20,19 @@ public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO |
| 20 | 20 | |
| 21 | 21 | default PageResult<CrmBusinessStatusDO> selectPage(CrmBusinessStatusPageReqVO reqVO) { |
| 22 | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusDO>() |
| 23 | - .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | |
| 24 | 23 | .orderByDesc(CrmBusinessStatusDO::getId)); |
| 25 | 24 | } |
| 26 | 25 | |
| 27 | - default List<CrmBusinessStatusDO> selectList(CrmBusinessStatusExportReqVO reqVO) { | |
| 26 | + default List<CrmBusinessStatusDO> selectList(CrmBusinessStatusQueryVO queryVO) { | |
| 28 | 27 | return selectList(new LambdaQueryWrapperX<CrmBusinessStatusDO>() |
| 29 | - .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | |
| 30 | - .likeIfPresent(CrmBusinessStatusDO::getName, reqVO.getName()) | |
| 31 | - .eqIfPresent(CrmBusinessStatusDO::getPercent, reqVO.getPercent()) | |
| 32 | - .eqIfPresent(CrmBusinessStatusDO::getSort, reqVO.getSort()) | |
| 28 | + .eqIfPresent(CrmBusinessStatusDO::getTypeId, queryVO.getTypeId()) | |
| 29 | + .inIfPresent(CrmBusinessStatusDO::getId, queryVO.getIdList()) | |
| 33 | 30 | .orderByDesc(CrmBusinessStatusDO::getId)); |
| 34 | 31 | } |
| 35 | 32 | |
| 36 | - default List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | |
| 37 | - return selectList(CrmBusinessStatusDO::getTypeId, typeId); | |
| 33 | + default int delete(Long typeId) { | |
| 34 | + return delete(new LambdaQueryWrapperX<CrmBusinessStatusDO>() | |
| 35 | + .eq(CrmBusinessStatusDO::getTypeId, typeId)); | |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | 38 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype; | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.business; | |
| 2 | 2 | |
| 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.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 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.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -20,22 +20,12 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat |
| 20 | 20 | |
| 21 | 21 | default PageResult<CrmBusinessStatusTypeDO> selectPage(CrmBusinessStatusTypePageReqVO reqVO) { |
| 22 | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() |
| 23 | - .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | |
| 24 | -// .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) TODO 报错,临时注释掉 | |
| 25 | - .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | |
| 26 | 23 | .orderByDesc(CrmBusinessStatusTypeDO::getId)); |
| 27 | 24 | } |
| 28 | 25 | |
| 29 | - default List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeExportReqVO reqVO) { | |
| 26 | + default List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO) { | |
| 30 | 27 | return selectList(new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() |
| 31 | - .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | |
| 32 | - .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) | |
| 33 | - .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | |
| 34 | - .orderByDesc(CrmBusinessStatusTypeDO::getId)); | |
| 35 | - } | |
| 36 | - | |
| 37 | - default List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | |
| 38 | - return selectList(CrmBusinessStatusTypeDO::getStatus, status.byteValue()); | |
| 28 | + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, queryVO.getStatus()) | |
| 29 | + .inIfPresent(CrmBusinessStatusTypeDO::getId, queryVO.getIdList())); | |
| 39 | 30 | } |
| 40 | - | |
| 41 | 31 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| ... | ... | @@ -14,6 +14,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 14 | 14 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 15 | 15 | import org.apache.ibatis.annotations.Mapper; |
| 16 | 16 | |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 17 | 20 | /** |
| 18 | 21 | * 客户 Mapper |
| 19 | 22 | * |
| ... | ... | @@ -114,4 +117,9 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 114 | 117 | .isNull(CrmCustomerDO::getOwnerUserId)); |
| 115 | 118 | } |
| 116 | 119 | |
| 120 | + default List<CrmCustomerDO> selectList(Collection<Long> ids) { | |
| 121 | + return selectList(new LambdaQueryWrapperX<CrmCustomerDO>() | |
| 122 | + .inIfPresent(CrmCustomerDO::getId, ids)); | |
| 123 | + } | |
| 124 | + | |
| 117 | 125 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java renamed to 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.businessstatus; | |
| 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.businessstatus.vo.CrmBusinessStatusCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 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; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 9 | 8 | |
| 10 | 9 | import javax.validation.Valid; |
| 11 | -import java.util.Collection; | |
| 12 | 10 | import java.util.List; |
| 13 | 11 | |
| 14 | 12 | /** |
| ... | ... | @@ -24,14 +22,14 @@ public interface CrmBusinessStatusService { |
| 24 | 22 | * @param createReqVO 创建信息 |
| 25 | 23 | * @return 编号 |
| 26 | 24 | */ |
| 27 | - Long createBusinessStatus(@Valid CrmBusinessStatusCreateReqVO createReqVO); | |
| 25 | + Long createBusinessStatus(@Valid CrmBusinessStatusSaveReqVO createReqVO); | |
| 28 | 26 | |
| 29 | 27 | /** |
| 30 | 28 | * 更新商机状态 |
| 31 | 29 | * |
| 32 | 30 | * @param updateReqVO 更新信息 |
| 33 | 31 | */ |
| 34 | - void updateBusinessStatus(@Valid CrmBusinessStatusUpdateReqVO updateReqVO); | |
| 32 | + void updateBusinessStatus(@Valid CrmBusinessStatusSaveReqVO updateReqVO); | |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * 删除商机状态 |
| ... | ... | @@ -49,14 +47,6 @@ public interface CrmBusinessStatusService { |
| 49 | 47 | CrmBusinessStatusDO getBusinessStatus(Long id); |
| 50 | 48 | |
| 51 | 49 | /** |
| 52 | - * 获得商机状态列表 | |
| 53 | - * | |
| 54 | - * @param ids 编号 | |
| 55 | - * @return 商机状态列表 | |
| 56 | - */ | |
| 57 | - List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids); | |
| 58 | - | |
| 59 | - /** | |
| 60 | 50 | * 获得商机状态分页 |
| 61 | 51 | * |
| 62 | 52 | * @param pageReqVO 分页查询 |
| ... | ... | @@ -65,26 +55,11 @@ public interface CrmBusinessStatusService { |
| 65 | 55 | PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); |
| 66 | 56 | |
| 67 | 57 | /** |
| 68 | - * 获得商机状态列表, 用于 Excel 导出 | |
| 69 | - * | |
| 70 | - * @param exportReqVO 查询条件 | |
| 71 | - * @return 商机状态列表 | |
| 72 | - */ | |
| 73 | - List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 根据类型 ID 获得商机状态列表 | |
| 77 | - * | |
| 78 | - * @param typeId 商机状态类型 ID | |
| 79 | - * @return 商机状态列表 | |
| 80 | - */ | |
| 81 | - List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId); | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 获得商机状态列表 | |
| 58 | + * 获得商机状态分页 | |
| 85 | 59 | * |
| 86 | - * @return 商机状态列表 | |
| 60 | + * @param queryVO 查询参数 | |
| 61 | + * @return 商机状态分页 | |
| 87 | 62 | */ |
| 88 | - List<CrmBusinessStatusDO> getBusinessStatusList(); | |
| 63 | + List<CrmBusinessStatusDO> selectList(CrmBusinessStatusQueryVO queryVO); | |
| 89 | 64 | |
| 90 | 65 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.crm.service.businessstatus; | |
| 1 | +package cn.iocoder.yudao.module.crm.service.business; | |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | |
| 10 | -import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | |
| 11 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 12 | -import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; | |
| 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; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusMapper; | |
| 13 | 10 | import org.springframework.stereotype.Service; |
| 14 | 11 | import org.springframework.validation.annotation.Validated; |
| 15 | 12 | |
| 16 | 13 | import javax.annotation.Resource; |
| 17 | -import java.util.Collection; | |
| 14 | + | |
| 18 | 15 | import java.util.List; |
| 19 | 16 | |
| 20 | 17 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -33,20 +30,20 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { |
| 33 | 30 | private CrmBusinessStatusMapper businessStatusMapper; |
| 34 | 31 | |
| 35 | 32 | @Override |
| 36 | - public Long createBusinessStatus(CrmBusinessStatusCreateReqVO createReqVO) { | |
| 33 | + public Long createBusinessStatus(CrmBusinessStatusSaveReqVO createReqVO) { | |
| 37 | 34 | // 插入 |
| 38 | - CrmBusinessStatusDO businessStatus = CrmBusinessStatusConvert.INSTANCE.convert(createReqVO); | |
| 35 | + CrmBusinessStatusDO businessStatus = BeanUtils.toBean(createReqVO, CrmBusinessStatusDO.class); | |
| 39 | 36 | businessStatusMapper.insert(businessStatus); |
| 40 | 37 | // 返回 |
| 41 | 38 | return businessStatus.getId(); |
| 42 | 39 | } |
| 43 | 40 | |
| 44 | 41 | @Override |
| 45 | - public void updateBusinessStatus(CrmBusinessStatusUpdateReqVO updateReqVO) { | |
| 42 | + public void updateBusinessStatus(CrmBusinessStatusSaveReqVO updateReqVO) { | |
| 46 | 43 | // 校验存在 |
| 47 | 44 | validateBusinessStatusExists(updateReqVO.getId()); |
| 48 | 45 | // 更新 |
| 49 | - CrmBusinessStatusDO updateObj = CrmBusinessStatusConvert.INSTANCE.convert(updateReqVO); | |
| 46 | + CrmBusinessStatusDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessStatusDO.class); | |
| 50 | 47 | businessStatusMapper.updateById(updateObj); |
| 51 | 48 | } |
| 52 | 49 | |
| ... | ... | @@ -70,30 +67,13 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { |
| 70 | 67 | } |
| 71 | 68 | |
| 72 | 69 | @Override |
| 73 | - public List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids) { | |
| 74 | - if (CollUtil.isEmpty(ids)) { | |
| 75 | - return ListUtil.empty(); | |
| 76 | - } | |
| 77 | - return businessStatusMapper.selectBatchIds(ids); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | 70 | public PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO) { |
| 82 | 71 | return businessStatusMapper.selectPage(pageReqVO); |
| 83 | 72 | } |
| 84 | 73 | |
| 85 | 74 | @Override |
| 86 | - public List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO) { | |
| 87 | - return businessStatusMapper.selectList(exportReqVO); | |
| 75 | + public List<CrmBusinessStatusDO> selectList(CrmBusinessStatusQueryVO queryVO) { | |
| 76 | + return businessStatusMapper.selectList(queryVO); | |
| 88 | 77 | } |
| 89 | 78 | |
| 90 | - @Override | |
| 91 | - public List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | |
| 92 | - return businessStatusMapper.getBusinessStatusListByTypeId(typeId); | |
| 93 | - } | |
| 94 | - | |
| 95 | - @Override | |
| 96 | - public List<CrmBusinessStatusDO> getBusinessStatusList() { | |
| 97 | - return businessStatusMapper.selectList(); | |
| 98 | - } | |
| 99 | 79 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java renamed to 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.businessstatustype; | |
| 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.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 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; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 9 | 8 | |
| 10 | 9 | import javax.validation.Valid; |
| 11 | -import java.util.Collection; | |
| 12 | 10 | import java.util.List; |
| 13 | 11 | |
| 14 | 12 | /** |
| ... | ... | @@ -24,14 +22,14 @@ public interface CrmBusinessStatusTypeService { |
| 24 | 22 | * @param createReqVO 创建信息 |
| 25 | 23 | * @return 编号 |
| 26 | 24 | */ |
| 27 | - Long createBusinessStatusType(@Valid CrmBusinessStatusTypeCreateReqVO createReqVO); | |
| 25 | + Long createBusinessStatusType(@Valid CrmBusinessStatusTypeSaveReqVO createReqVO); | |
| 28 | 26 | |
| 29 | 27 | /** |
| 30 | 28 | * 更新商机状态类型 |
| 31 | 29 | * |
| 32 | 30 | * @param updateReqVO 更新信息 |
| 33 | 31 | */ |
| 34 | - void updateBusinessStatusType(@Valid CrmBusinessStatusTypeUpdateReqVO updateReqVO); | |
| 32 | + void updateBusinessStatusType(@Valid CrmBusinessStatusTypeSaveReqVO updateReqVO); | |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * 删除商机状态类型 |
| ... | ... | @@ -49,14 +47,6 @@ public interface CrmBusinessStatusTypeService { |
| 49 | 47 | CrmBusinessStatusTypeDO getBusinessStatusType(Long id); |
| 50 | 48 | |
| 51 | 49 | /** |
| 52 | - * 获得商机状态类型列表 | |
| 53 | - * | |
| 54 | - * @param ids 编号 | |
| 55 | - * @return 商机状态类型列表 | |
| 56 | - */ | |
| 57 | - List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids); | |
| 58 | - | |
| 59 | - /** | |
| 60 | 50 | * 获得商机状态类型分页 |
| 61 | 51 | * |
| 62 | 52 | * @param pageReqVO 分页查询 |
| ... | ... | @@ -65,19 +55,10 @@ public interface CrmBusinessStatusTypeService { |
| 65 | 55 | PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); |
| 66 | 56 | |
| 67 | 57 | /** |
| 68 | - * 获得商机状态类型列表, 用于 Excel 导出 | |
| 69 | - * | |
| 70 | - * @param exportReqVO 查询条件 | |
| 71 | - * @return 商机状态类型列表 | |
| 72 | - */ | |
| 73 | - List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO); | |
| 74 | - | |
| 75 | - /** | |
| 76 | 58 | * 获得商机状态类型列表 |
| 77 | 59 | * |
| 78 | - * @param status 状态 | |
| 60 | + * @param queryVO 查询参数 | |
| 79 | 61 | * @return 商机状态类型列表 |
| 80 | 62 | */ |
| 81 | - List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status); | |
| 82 | - | |
| 63 | + List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO); | |
| 83 | 64 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java renamed to 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.businessstatustype; | |
| 1 | +package cn.iocoder.yudao.module.crm.service.business; | |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | |
| 10 | -import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | |
| 11 | -import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 12 | -import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; | |
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 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; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessStatusTypeSaveReqVO; | |
| 9 | +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.mysql.business.CrmBusinessStatusMapper; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessStatusTypeMapper; | |
| 13 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 13 | 14 | import org.springframework.stereotype.Service; |
| 15 | +import org.springframework.transaction.annotation.Transactional; | |
| 14 | 16 | import org.springframework.validation.annotation.Validated; |
| 15 | 17 | |
| 16 | 18 | import javax.annotation.Resource; |
| 17 | -import java.util.Collection; | |
| 18 | 19 | import java.util.List; |
| 19 | 20 | |
| 20 | 21 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 21 | 22 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; |
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NAME_EXISTS; | |
| 22 | 24 | |
| 23 | 25 | /** |
| 24 | 26 | * 商机状态类型 Service 实现类 |
| ... | ... | @@ -32,33 +34,57 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 32 | 34 | @Resource |
| 33 | 35 | private CrmBusinessStatusTypeMapper businessStatusTypeMapper; |
| 34 | 36 | |
| 37 | + @Resource | |
| 38 | + private CrmBusinessStatusMapper businessStatusMapper; | |
| 39 | + | |
| 35 | 40 | @Override |
| 36 | - public Long createBusinessStatusType(CrmBusinessStatusTypeCreateReqVO createReqVO) { | |
| 37 | - // TODO ljlleo:name 应该需要唯一哈; | |
| 41 | + @Transactional(rollbackFor = Exception.class) | |
| 42 | + public Long createBusinessStatusType(CrmBusinessStatusTypeSaveReqVO createReqVO) { | |
| 43 | + //检验名称是否存在 | |
| 44 | + validateBusinessStatusTypeExists(createReqVO.getName(), null); | |
| 38 | 45 | // 插入 |
| 39 | - CrmBusinessStatusTypeDO businessStatusType = CrmBusinessStatusTypeConvert.INSTANCE.convert(createReqVO); | |
| 46 | + CrmBusinessStatusTypeDO businessStatusType = BeanUtils.toBean(createReqVO, CrmBusinessStatusTypeDO.class); | |
| 40 | 47 | 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)); | |
| 41 | 53 | // 返回 |
| 42 | 54 | return businessStatusType.getId(); |
| 43 | 55 | } |
| 44 | 56 | |
| 45 | 57 | @Override |
| 46 | - public void updateBusinessStatusType(CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | |
| 47 | - // TODO ljlleo:name 应该需要唯一哈; | |
| 58 | + @Transactional(rollbackFor = Exception.class) | |
| 59 | + public void updateBusinessStatusType(CrmBusinessStatusTypeSaveReqVO updateReqVO) { | |
| 48 | 60 | // 校验存在 |
| 49 | 61 | validateBusinessStatusTypeExists(updateReqVO.getId()); |
| 62 | + // 校验名称是否存在 | |
| 63 | + validateBusinessStatusTypeExists(updateReqVO.getName(), updateReqVO.getId()); | |
| 50 | 64 | // 更新 |
| 51 | - CrmBusinessStatusTypeDO updateObj = CrmBusinessStatusTypeConvert.INSTANCE.convert(updateReqVO); | |
| 65 | + CrmBusinessStatusTypeDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessStatusTypeDO.class); | |
| 52 | 66 | businessStatusTypeMapper.updateById(updateObj); |
| 67 | + //删除状态 | |
| 68 | + businessStatusMapper.delete(updateReqVO.getId()); | |
| 69 | + //插入状态 | |
| 70 | + updateReqVO.getStatusList().stream().forEach(status -> { | |
| 71 | + status.setTypeId(updateReqVO.getId()); | |
| 72 | + }); | |
| 73 | + businessStatusMapper.insertBatch(BeanUtils.toBean(updateReqVO.getStatusList(), CrmBusinessStatusDO.class)); | |
| 53 | 74 | } |
| 54 | 75 | |
| 55 | 76 | @Override |
| 77 | + @Transactional(rollbackFor = Exception.class) | |
| 56 | 78 | public void deleteBusinessStatusType(Long id) { |
| 79 | + //TODO 待添加被引用校验 | |
| 80 | + //... | |
| 81 | + | |
| 57 | 82 | // 校验存在 |
| 58 | 83 | validateBusinessStatusTypeExists(id); |
| 59 | - // TODO 艿艿:这里在看看,是不是要校验业务是否在使用; | |
| 60 | 84 | // 删除 |
| 61 | 85 | businessStatusTypeMapper.deleteById(id); |
| 86 | + //删除状态 | |
| 87 | + businessStatusMapper.delete(id); | |
| 62 | 88 | } |
| 63 | 89 | |
| 64 | 90 | private void validateBusinessStatusTypeExists(Long id) { |
| ... | ... | @@ -67,17 +93,20 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 67 | 93 | } |
| 68 | 94 | } |
| 69 | 95 | |
| 70 | - @Override | |
| 71 | - public CrmBusinessStatusTypeDO getBusinessStatusType(Long id) { | |
| 72 | - return businessStatusTypeMapper.selectById(id); | |
| 96 | + private void validateBusinessStatusTypeExists(String name, Long id) { | |
| 97 | + LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); | |
| 98 | + if(null != id) { | |
| 99 | + wrapper.ne(CrmBusinessStatusTypeDO::getId, id); | |
| 100 | + } | |
| 101 | + long cnt = businessStatusTypeMapper.selectCount(wrapper.eq(CrmBusinessStatusTypeDO::getName, name)); | |
| 102 | + if (cnt > 0) { | |
| 103 | + throw exception(BUSINESS_STATUS_TYPE_NAME_EXISTS); | |
| 104 | + } | |
| 73 | 105 | } |
| 74 | 106 | |
| 75 | 107 | @Override |
| 76 | - public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids) { | |
| 77 | - if (CollUtil.isEmpty(ids)) { | |
| 78 | - return ListUtil.empty(); | |
| 79 | - } | |
| 80 | - return businessStatusTypeMapper.selectBatchIds(ids); | |
| 108 | + public CrmBusinessStatusTypeDO getBusinessStatusType(Long id) { | |
| 109 | + return businessStatusTypeMapper.selectById(id); | |
| 81 | 110 | } |
| 82 | 111 | |
| 83 | 112 | @Override |
| ... | ... | @@ -86,13 +115,7 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe |
| 86 | 115 | } |
| 87 | 116 | |
| 88 | 117 | @Override |
| 89 | - public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO) { | |
| 90 | - return businessStatusTypeMapper.selectList(exportReqVO); | |
| 118 | + public List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeQueryVO queryVO) { | |
| 119 | + return businessStatusTypeMapper.selectList(queryVO); | |
| 91 | 120 | } |
| 92 | - | |
| 93 | - @Override | |
| 94 | - public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | |
| 95 | - return businessStatusTypeMapper.getBusinessStatusTypeListByStatus(status); | |
| 96 | - } | |
| 97 | - | |
| 98 | 121 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
| ... | ... | @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 6 | 6 | |
| 7 | 7 | import javax.validation.Valid; |
| 8 | +import java.util.Collection; | |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| 10 | 11 | /** |
| ... | ... | @@ -116,4 +117,12 @@ public interface CrmCustomerService { |
| 116 | 117 | */ |
| 117 | 118 | void putPool(Long id); |
| 118 | 119 | |
| 120 | + /** | |
| 121 | + * 根据客户ID集合查询客户集合 | |
| 122 | + * @param ids | |
| 123 | + * @author ljlleo | |
| 124 | + * @return | |
| 125 | + */ | |
| 126 | + List<CrmCustomerDO> getCustomerList(Collection<Long> ids); | |
| 127 | + | |
| 119 | 128 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| ... | ... | @@ -249,4 +249,9 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { |
| 249 | 249 | CrmPermissionLevelEnum.OWNER.getLevel()); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | + @Override | |
| 253 | + public List<CrmCustomerDO> getCustomerList(Collection<Long> ids) { | |
| 254 | + return customerMapper.selectList(ids); | |
| 255 | + } | |
| 256 | + | |
| 252 | 257 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/BusinessStatusTypeServiceImplTest.java
0 → 100644
| 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.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; | |
| 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 | +/** | |
| 23 | + * {@link BusinessStatusTypeServiceImpl} 的单元测试类 | |
| 24 | + * | |
| 25 | + * @author ljlleo | |
| 26 | + */ | |
| 27 | +@Import(BusinessStatusTypeServiceImpl.class) | |
| 28 | +public class BusinessStatusTypeServiceImplTest extends BaseDbUnitTest { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private BusinessStatusTypeServiceImpl businessStatusTypeService; | |
| 32 | + | |
| 33 | + @Resource | |
| 34 | + private BusinessStatusTypeMapper businessStatusTypeMapper; | |
| 35 | + | |
| 36 | + @Test | |
| 37 | + public void testCreateBusinessStatusType_success() { | |
| 38 | + // 准备参数 | |
| 39 | + BusinessStatusTypeSaveReqVO createReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class).setId(null); | |
| 40 | + | |
| 41 | + // 调用 | |
| 42 | + Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(createReqVO); | |
| 43 | + // 断言 | |
| 44 | + assertNotNull(businessStatusTypeId); | |
| 45 | + // 校验记录的属性是否正确 | |
| 46 | + BusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | |
| 47 | + assertPojoEquals(createReqVO, businessStatusType, "id"); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Test | |
| 51 | + public void testUpdateBusinessStatusType_success() { | |
| 52 | + // mock 数据 | |
| 53 | + BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class); | |
| 54 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | |
| 55 | + // 准备参数 | |
| 56 | + BusinessStatusTypeSaveReqVO updateReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class, o -> { | |
| 57 | + o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID | |
| 58 | + }); | |
| 59 | + | |
| 60 | + // 调用 | |
| 61 | + businessStatusTypeService.updateBusinessStatusType(updateReqVO); | |
| 62 | + // 校验是否更新正确 | |
| 63 | + BusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(updateReqVO.getId()); // 获取最新的 | |
| 64 | + assertPojoEquals(updateReqVO, businessStatusType); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Test | |
| 68 | + public void testUpdateBusinessStatusType_notExists() { | |
| 69 | + // 准备参数 | |
| 70 | + BusinessStatusTypeSaveReqVO updateReqVO = randomPojo(BusinessStatusTypeSaveReqVO.class); | |
| 71 | + | |
| 72 | + // 调用, 并断言异常 | |
| 73 | + assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(updateReqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Test | |
| 77 | + public void testDeleteBusinessStatusType_success() { | |
| 78 | + // mock 数据 | |
| 79 | + BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class); | |
| 80 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | |
| 81 | + // 准备参数 | |
| 82 | + Long id = dbBusinessStatusType.getId(); | |
| 83 | + | |
| 84 | + // 调用 | |
| 85 | + businessStatusTypeService.deleteBusinessStatusType(id); | |
| 86 | + // 校验数据不存在了 | |
| 87 | + assertNull(businessStatusTypeMapper.selectById(id)); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Test | |
| 91 | + public void testDeleteBusinessStatusType_notExists() { | |
| 92 | + // 准备参数 | |
| 93 | + Long id = randomLongId(); | |
| 94 | + | |
| 95 | + // 调用, 并断言异常 | |
| 96 | + assertServiceException(() -> businessStatusTypeService.deleteBusinessStatusType(id), BUSINESS_STATUS_TYPE_NOT_EXISTS); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Test | |
| 100 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 101 | + public void testGetBusinessStatusTypePage() { | |
| 102 | + // mock 数据 | |
| 103 | + BusinessStatusTypeDO dbBusinessStatusType = randomPojo(BusinessStatusTypeDO.class, o -> { // 等会查询到 | |
| 104 | + }); | |
| 105 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | |
| 106 | + // 准备参数 | |
| 107 | + BusinessStatusTypePageReqVO reqVO = new BusinessStatusTypePageReqVO(); | |
| 108 | + | |
| 109 | + // 调用 | |
| 110 | + PageResult<BusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | |
| 111 | + // 断言 | |
| 112 | + assertEquals(1, pageResult.getTotal()); | |
| 113 | + assertEquals(1, pageResult.getList().size()); | |
| 114 | + assertPojoEquals(dbBusinessStatusType, pageResult.getList().get(0)); | |
| 115 | + } | |
| 116 | + | |
| 117 | +} | ... | ... |