Commit 2d9f5cc4d0992af69f4ba7971de82840a97e7c6f
1 parent
fe4b51b9
crm: 1)调整合同的 CRM 前缀;2)增加基于客户查询合同分页
Showing
34 changed files
with
311 additions
and
301 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/AuditStatusEnum.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.enums; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | |
| 4 | - | |
| 5 | -import java.util.Arrays; | |
| 6 | - | |
| 7 | -// TODO @liuhongfeng:这个状态,还是搞成专属 CrmReceivableDO 专属的 status; | |
| 8 | -/** | |
| 9 | - * 流程审批状态枚举类 | |
| 10 | - * 0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回 TODO @liuhongfeng:这一行可以删除,因为已经有枚举属性了哈; | |
| 11 | - * @author 赤焰 | |
| 12 | - */ | |
| 13 | -// TODO @liuhongfeng:可以使用 @Getter、@AllArgsConstructor 简化 get、构造方法 | |
| 14 | -public enum AuditStatusEnum implements IntArrayValuable { | |
| 15 | - | |
| 16 | - // TODO @liuhongfeng:草稿 0;10 审核中;20 审核通过;30 审核拒绝;40 已撤回;主要是留好间隙,万一每个地方要做点拓展; 然后,枚举字段的顺序调整下,审批中,一定要放两个审批通过、拒绝前面哈; | |
| 17 | - /** | |
| 18 | - * 未审批 | |
| 19 | - */ | |
| 20 | - AUDIT_NEW(0, "未审批"), | |
| 21 | - /** | |
| 22 | - * 审核通过 | |
| 23 | - */ | |
| 24 | - AUDIT_FINISH(1, "审核通过"), | |
| 25 | - /** | |
| 26 | - * 审核拒绝 | |
| 27 | - */ | |
| 28 | - AUDIT_REJECT(2, "审核拒绝"), | |
| 29 | - /** | |
| 30 | - * 审核中 | |
| 31 | - */ | |
| 32 | - AUDIT_DOING(3, "审核中"), | |
| 33 | - /** | |
| 34 | - * 已撤回 | |
| 35 | - */ | |
| 36 | - AUDIT_RETURN(4, "已撤回"); | |
| 37 | - | |
| 38 | - // TODO liuhongfeng:value 改成 status;desc 改成 name; | |
| 39 | - private final Integer value; | |
| 40 | - private final String desc; | |
| 41 | - | |
| 42 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AuditStatusEnum::getValue).toArray(); | |
| 43 | - | |
| 44 | - AuditStatusEnum(Integer value, String desc) { | |
| 45 | - this.value = value; | |
| 46 | - this.desc = desc; | |
| 47 | - } | |
| 48 | - | |
| 49 | - public Integer getValue() { | |
| 50 | - return value; | |
| 51 | - } | |
| 52 | - | |
| 53 | - public String getDesc() { | |
| 54 | - return desc; | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Override | |
| 58 | - public int[] array() { | |
| 59 | - return ARRAYS; | |
| 60 | - } | |
| 61 | -} |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
| ... | ... | @@ -11,6 +11,6 @@ public interface DictTypeConstants { |
| 11 | 11 | String CRM_CUSTOMER_INDUSTRY = "crm_customer_industry"; // CRM 客户所属行业 |
| 12 | 12 | String CRM_CUSTOMER_LEVEL = "crm_customer_level"; // CRM 客户等级 |
| 13 | 13 | String CRM_CUSTOMER_SOURCE = "crm_customer_source"; // CRM 客户来源 |
| 14 | - String CRM_RECEIVABLE_CHECK_STATUS = "crm_receivable_check_status"; // CRM 审批状态 | |
| 14 | + String CRM_AUDIT_STATUS = "crm_audit_status"; // CRM 审批状态 | |
| 15 | 15 | |
| 16 | 16 | } | ... | ... |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ReturnTypeEnum.java deleted
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmAuditStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.enums.common; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | |
| 4 | +import lombok.Getter; | |
| 5 | +import lombok.RequiredArgsConstructor; | |
| 6 | + | |
| 7 | +import java.util.Arrays; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * CRM 的审批状态 | |
| 11 | + * | |
| 12 | + * @author 赤焰 | |
| 13 | + */ | |
| 14 | +@RequiredArgsConstructor | |
| 15 | +@Getter | |
| 16 | +public enum CrmAuditStatusEnum implements IntArrayValuable { | |
| 17 | + | |
| 18 | + DRAFT(0, "未提交"), | |
| 19 | + PROCESS(10, "审批中"), | |
| 20 | + APPROVE(20, "审核通过"), | |
| 21 | + REJECT(30, "审核不通过"), | |
| 22 | + CANCEL(40, "已取消"); | |
| 23 | + | |
| 24 | + private final Integer status; | |
| 25 | + private final String name; | |
| 26 | + | |
| 27 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmAuditStatusEnum::getStatus).toArray(); | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public int[] array() { | |
| 31 | + return ARRAYS; | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmBizTypeEnum.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| ... | ... | @@ -151,7 +151,7 @@ public class CrmContactController { |
| 151 | 151 | // 1. 获取客户列表 |
| 152 | 152 | List<CrmCustomerDO> crmCustomerDOList = customerService.getCustomerList( |
| 153 | 153 | convertSet(contactList, CrmContactDO::getCustomerId)); |
| 154 | - // 2. 获取创建人、责任人列表 | |
| 154 | + // 2. 获取创建人、负责人列表 | |
| 155 | 155 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, |
| 156 | 156 | contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); |
| 157 | 157 | // 3. 直属上级 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/ContractController.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.lang.Assert; | |
| 3 | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | |
| 5 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; |
| 8 | 11 | import cn.iocoder.yudao.module.crm.convert.contract.ContractConvert; |
| 9 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 10 | -import cn.iocoder.yudao.module.crm.service.contract.ContractService; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 14 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 15 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | |
| 16 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 17 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 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,8 +27,12 @@ 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.Map; | |
| 31 | +import java.util.stream.Stream; | |
| 23 | 32 | |
| 24 | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; | |
| 35 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 25 | 36 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 26 | 37 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 27 | 38 | |
| ... | ... | @@ -29,22 +40,27 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti |
| 29 | 40 | @RestController |
| 30 | 41 | @RequestMapping("/crm/contract") |
| 31 | 42 | @Validated |
| 32 | -public class ContractController { | |
| 43 | +public class CrmContractController { | |
| 33 | 44 | |
| 34 | 45 | @Resource |
| 35 | - private ContractService contractService; | |
| 46 | + private CrmContractService contractService; | |
| 47 | + @Resource | |
| 48 | + private CrmCustomerService customerService; | |
| 49 | + | |
| 50 | + @Resource | |
| 51 | + private AdminUserApi adminUserApi; | |
| 36 | 52 | |
| 37 | 53 | @PostMapping("/create") |
| 38 | 54 | @Operation(summary = "创建合同") |
| 39 | 55 | @PreAuthorize("@ss.hasPermission('crm:contract:create')") |
| 40 | - public CommonResult<Long> createContract(@Valid @RequestBody ContractCreateReqVO createReqVO) { | |
| 56 | + public CommonResult<Long> createContract(@Valid @RequestBody CrmContractCreateReqVO createReqVO) { | |
| 41 | 57 | return success(contractService.createContract(createReqVO, getLoginUserId())); |
| 42 | 58 | } |
| 43 | 59 | |
| 44 | 60 | @PutMapping("/update") |
| 45 | 61 | @Operation(summary = "更新合同") |
| 46 | 62 | @PreAuthorize("@ss.hasPermission('crm:contract:update')") |
| 47 | - public CommonResult<Boolean> updateContract(@Valid @RequestBody ContractUpdateReqVO updateReqVO) { | |
| 63 | + public CommonResult<Boolean> updateContract(@Valid @RequestBody CrmContractUpdateReqVO updateReqVO) { | |
| 48 | 64 | contractService.updateContract(updateReqVO); |
| 49 | 65 | return success(true); |
| 50 | 66 | } |
| ... | ... | @@ -63,28 +79,56 @@ public class ContractController { |
| 63 | 79 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 64 | 80 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 65 | 81 | public CommonResult<ContractRespVO> getContract(@RequestParam("id") Long id) { |
| 66 | - ContractDO contract = contractService.getContract(id); | |
| 82 | + CrmContractDO contract = contractService.getContract(id); | |
| 67 | 83 | return success(ContractConvert.INSTANCE.convert(contract)); |
| 68 | 84 | } |
| 69 | 85 | |
| 70 | 86 | @GetMapping("/page") |
| 71 | 87 | @Operation(summary = "获得合同分页") |
| 72 | 88 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 73 | - public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid ContractPageReqVO pageVO) { | |
| 74 | - PageResult<ContractDO> pageResult = contractService.getContractPage(pageVO); | |
| 75 | - return success(ContractConvert.INSTANCE.convertPage(pageResult)); | |
| 89 | + public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) { | |
| 90 | + PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO); | |
| 91 | + return success(convertDetailContractPage(pageResult)); | |
| 92 | + } | |
| 93 | + | |
| 94 | + @GetMapping("/page-by-customer") | |
| 95 | + @Operation(summary = "获得联系人分页,基于指定客户") | |
| 96 | + public CommonResult<PageResult<ContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { | |
| 97 | + Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); | |
| 98 | + PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomer(pageVO); | |
| 99 | + return success(convertDetailContractPage(pageResult)); | |
| 76 | 100 | } |
| 77 | 101 | |
| 78 | 102 | @GetMapping("/export-excel") |
| 79 | 103 | @Operation(summary = "导出合同 Excel") |
| 80 | 104 | @PreAuthorize("@ss.hasPermission('crm:contract:export')") |
| 81 | 105 | @OperateLog(type = EXPORT) |
| 82 | - public void exportContractExcel(@Valid ContractExportReqVO exportReqVO, | |
| 106 | + public void exportContractExcel(@Valid CrmContractPageReqVO exportReqVO, | |
| 83 | 107 | HttpServletResponse response) throws IOException { |
| 84 | - List<ContractDO> list = contractService.getContractList(exportReqVO); | |
| 108 | + PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO); | |
| 85 | 109 | // 导出 Excel |
| 86 | - List<ContractExcelVO> datas = ContractConvert.INSTANCE.convertList02(list); | |
| 87 | - ExcelUtils.write(response, "合同.xls", "数据", ContractExcelVO.class, datas); | |
| 110 | + ExcelUtils.write(response, "合同.xls", "数据", CrmContractExcelVO.class, | |
| 111 | + ContractConvert.INSTANCE.convertList02(pageResult.getList())); | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 转换成详细的联系人分页,即读取关联信息 | |
| 116 | + * | |
| 117 | + * @param pageResult 联系人分页 | |
| 118 | + * @return 详细的联系人分页 | |
| 119 | + */ | |
| 120 | + private PageResult<ContractRespVO> convertDetailContractPage(PageResult<CrmContractDO> pageResult) { | |
| 121 | + List<CrmContractDO> contactList = pageResult.getList(); | |
| 122 | + if (CollUtil.isEmpty(contactList)) { | |
| 123 | + return PageResult.empty(pageResult.getTotal()); | |
| 124 | + } | |
| 125 | + // 1. 获取客户列表 | |
| 126 | + List<CrmCustomerDO> customerList = customerService.getCustomerList( | |
| 127 | + convertSet(contactList, CrmContractDO::getCustomerId)); | |
| 128 | + // 2. 获取创建人、负责人列表 | |
| 129 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, | |
| 130 | + contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); | |
| 131 | + return ContractConvert.INSTANCE.convertPage(pageResult, userMap, customerList); | |
| 88 | 132 | } |
| 89 | 133 | |
| 90 | 134 | @PutMapping("/transfer") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.contract.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 | -@Schema(description = "管理后台 - CRM 合同 Excel 导出 Request VO,参数和 ContractPageReqVO 是一致的") | |
| 12 | -@Data | |
| 13 | -public class ContractExportReqVO { | |
| 14 | - | |
| 15 | - @Schema(description = "合同名称", example = "王五") | |
| 16 | - private String name; | |
| 17 | - | |
| 18 | - @Schema(description = "客户编号", example = "18336") | |
| 19 | - private Long customerId; | |
| 20 | - | |
| 21 | - @Schema(description = "商机编号", example = "10864") | |
| 22 | - private Long businessId; | |
| 23 | - | |
| 24 | - @Schema(description = "下单日期") | |
| 25 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 26 | - private LocalDateTime[] orderDate; | |
| 27 | - | |
| 28 | - @Schema(description = "合同编号") | |
| 29 | - private String no; | |
| 30 | - | |
| 31 | - @Schema(description = "整单折扣") | |
| 32 | - private Integer discountPercent; | |
| 33 | - | |
| 34 | - @Schema(description = "产品总金额", example = "19510") | |
| 35 | - private Integer productPrice; | |
| 36 | - | |
| 37 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractRespVO.java
| ... | ... | @@ -11,7 +11,7 @@ import java.time.LocalDateTime; |
| 11 | 11 | @Data |
| 12 | 12 | @EqualsAndHashCode(callSuper = true) |
| 13 | 13 | @ToString(callSuper = true) |
| 14 | -public class ContractRespVO extends ContractBaseVO { | |
| 14 | +public class ContractRespVO extends CrmContractBaseVO { | |
| 15 | 15 | |
| 16 | 16 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 17 | 17 | private Long id; |
| ... | ... | @@ -19,4 +19,19 @@ public class ContractRespVO extends ContractBaseVO { |
| 19 | 19 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 20 | 20 | private LocalDateTime createTime; |
| 21 | 21 | |
| 22 | + @Schema(description = "创建人", example = "25682") | |
| 23 | + private String creator; | |
| 24 | + | |
| 25 | + @Schema(description = "创建人名字", example = "test") | |
| 26 | + private String creatorName; | |
| 27 | + | |
| 28 | + @Schema(description = "客户名字", example = "test") | |
| 29 | + private String customerName; | |
| 30 | + | |
| 31 | + @Schema(description = "负责人", example = "test") | |
| 32 | + private String ownerUserName; | |
| 33 | + | |
| 34 | + @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 35 | + private Integer auditStatus; | |
| 36 | + | |
| 22 | 37 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractBaseVO.java
| ... | ... | @@ -9,13 +9,12 @@ import java.time.LocalDateTime; |
| 9 | 9 | |
| 10 | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | |
| 12 | -// TODO @dhb52:所有类,带下 Crm 前缀,避免和别的模块重复 | |
| 13 | 12 | /** |
| 14 | 13 | * 合同 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 15 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 16 | 15 | */ |
| 17 | 16 | @Data |
| 18 | -public class ContractBaseVO { | |
| 17 | +public class CrmContractBaseVO { | |
| 19 | 18 | |
| 20 | 19 | // TODO @dhb52:类似 no 字段的 example 要写xia 哈; |
| 21 | 20 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractCreateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractCreateReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractExcelVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractExcelVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java
| ... | ... | @@ -5,17 +5,15 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | 8 | |
| 14 | 9 | @Schema(description = "管理后台 - CRM 合同分页 Request VO") |
| 15 | 10 | @Data |
| 16 | 11 | @EqualsAndHashCode(callSuper = true) |
| 17 | 12 | @ToString(callSuper = true) |
| 18 | -public class ContractPageReqVO extends PageParam { | |
| 13 | +public class CrmContractPageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "合同编号", example = "XYZ008") | |
| 16 | + private String no; | |
| 19 | 17 | |
| 20 | 18 | @Schema(description = "合同名称", example = "王五") |
| 21 | 19 | private String name; |
| ... | ... | @@ -26,17 +24,4 @@ public class ContractPageReqVO extends PageParam { |
| 26 | 24 | @Schema(description = "商机编号", example = "10864") |
| 27 | 25 | private Long businessId; |
| 28 | 26 | |
| 29 | - @Schema(description = "下单日期") | |
| 30 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 31 | - private LocalDateTime[] orderDate; | |
| 32 | - | |
| 33 | - @Schema(description = "合同编号") | |
| 34 | - private String no; | |
| 35 | - | |
| 36 | - @Schema(description = "整单折扣") | |
| 37 | - private Integer discountPercent; | |
| 38 | - | |
| 39 | - @Schema(description = "产品总金额", example = "19510") | |
| 40 | - private Integer productPrice; | |
| 41 | - | |
| 42 | 27 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractTransferReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 3 | 4 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 4 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 6 | import lombok.Data; |
| ... | ... | @@ -14,19 +15,12 @@ public class CrmContractTransferReqVO { |
| 14 | 15 | @NotNull(message = "联系人编号不能为空") |
| 15 | 16 | private Long id; |
| 16 | 17 | |
| 17 | - /** | |
| 18 | - * 新负责人的用户编号 | |
| 19 | - */ | |
| 20 | 18 | @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 21 | 19 | @NotNull(message = "新负责人的用户编号不能为空") |
| 22 | 20 | private Long newOwnerUserId; |
| 23 | 21 | |
| 24 | - /** | |
| 25 | - * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 26 | - * | |
| 27 | - * 关联 {@link CrmPermissionLevelEnum} | |
| 28 | - */ | |
| 29 | 22 | @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 23 | + @InEnum(value = CrmPermissionLevelEnum.class) | |
| 30 | 24 | private Integer oldOwnerPermissionLevel; |
| 31 | 25 | |
| 32 | 26 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractUpdateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractUpdateReqVO.java
| ... | ... | @@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull; |
| 11 | 11 | @Data |
| 12 | 12 | @EqualsAndHashCode(callSuper = true) |
| 13 | 13 | @ToString(callSuper = true) |
| 14 | -public class ContractUpdateReqVO extends ContractBaseVO { | |
| 14 | +public class CrmContractUpdateReqVO extends CrmContractBaseVO { | |
| 15 | 15 | |
| 16 | 16 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 17 | 17 | @NotNull(message = "合同编号不能为空") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.crm.enums.AuditStatusEnum; | |
| 4 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -34,7 +34,7 @@ public class CrmReceivableBaseVO { |
| 34 | 34 | |
| 35 | 35 | // TODO @liuhongfeng:这个字段,应该不是前端传递的噢,而是后端自己生成的 |
| 36 | 36 | @Schema(description = "审批状态", example = "1") |
| 37 | - @InEnum(AuditStatusEnum.class) | |
| 37 | + @InEnum(CrmAuditStatusEnum.class) | |
| 38 | 38 | private Integer checkStatus; |
| 39 | 39 | |
| 40 | 40 | @Schema(description = "回款日期") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExcelVO.java
| ... | ... | @@ -28,7 +28,7 @@ public class CrmReceivableExcelVO { |
| 28 | 28 | private Long contractId; |
| 29 | 29 | |
| 30 | 30 | @ExcelProperty(value = "审批状态", converter = DictConvert.class) |
| 31 | - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_RECEIVABLE_CHECK_STATUS) | |
| 31 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS) | |
| 32 | 32 | private Integer checkStatus; |
| 33 | 33 | |
| 34 | 34 | @ExcelProperty("工作流编号") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.crm.enums.AuditStatusEnum; | |
| 4 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 5 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -28,7 +28,7 @@ public class CrmReceivablePlanBaseVO { |
| 28 | 28 | private Integer status; |
| 29 | 29 | |
| 30 | 30 | @Schema(description = "审批状态", example = "1") |
| 31 | - @InEnum(AuditStatusEnum.class) | |
| 31 | + @InEnum(CrmAuditStatusEnum.class) | |
| 32 | 32 | private Integer checkStatus; |
| 33 | 33 | |
| 34 | 34 | @Schema(description = "计划回款金额", example = "29675") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanExcelVO.java
| ... | ... | @@ -31,7 +31,7 @@ public class CrmReceivablePlanExcelVO { |
| 31 | 31 | private Integer status; |
| 32 | 32 | |
| 33 | 33 | @ExcelProperty(value = "审批状态", converter = DictConvert.class) |
| 34 | - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_RECEIVABLE_CHECK_STATUS) | |
| 34 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS) | |
| 35 | 35 | private Integer checkStatus; |
| 36 | 36 | |
| 37 | 37 | //@ExcelProperty("工作流编号") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java
| ... | ... | @@ -19,6 +19,7 @@ import java.util.stream.Collectors; |
| 19 | 19 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 20 | 20 | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| 21 | 21 | |
| 22 | +// TODO 芋艿:convert 后面在梳理下,略微有点乱 | |
| 22 | 23 | /** |
| 23 | 24 | * CRM 联系人 Convert |
| 24 | 25 | * |
| ... | ... | @@ -44,6 +45,7 @@ public interface ContactConvert { |
| 44 | 45 | List<CrmContactRespVO> list = converList(pageResult.getList(), userMap, customerList, parentContactList); |
| 45 | 46 | return convertPage(pageResult).setList(list); |
| 46 | 47 | } |
| 48 | + | |
| 47 | 49 | List<CrmContactSimpleRespVO> convertAllList(List<CrmContactDO> list); |
| 48 | 50 | |
| 49 | 51 | @Mappings({ | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/ContractConvert.java
| ... | ... | @@ -2,14 +2,20 @@ package cn.iocoder.yudao.module.crm.convert.contract; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| 8 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 7 | 9 | import org.mapstruct.Mapper; |
| 8 | 10 | import org.mapstruct.Mapping; |
| 9 | 11 | import org.mapstruct.Mappings; |
| 10 | 12 | import org.mapstruct.factory.Mappers; |
| 11 | 13 | |
| 12 | 14 | import java.util.List; |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 17 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 18 | +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | |
| 13 | 19 | |
| 14 | 20 | /** |
| 15 | 21 | * 合同 Convert |
| ... | ... | @@ -21,17 +27,17 @@ public interface ContractConvert { |
| 21 | 27 | |
| 22 | 28 | ContractConvert INSTANCE = Mappers.getMapper(ContractConvert.class); |
| 23 | 29 | |
| 24 | - ContractDO convert(ContractCreateReqVO bean); | |
| 30 | + CrmContractDO convert(CrmContractCreateReqVO bean); | |
| 25 | 31 | |
| 26 | - ContractDO convert(ContractUpdateReqVO bean); | |
| 32 | + CrmContractDO convert(CrmContractUpdateReqVO bean); | |
| 27 | 33 | |
| 28 | - ContractRespVO convert(ContractDO bean); | |
| 34 | + ContractRespVO convert(CrmContractDO bean); | |
| 29 | 35 | |
| 30 | - List<ContractRespVO> convertList(List<ContractDO> list); | |
| 36 | + List<ContractRespVO> convertList(List<CrmContractDO> list); | |
| 31 | 37 | |
| 32 | - PageResult<ContractRespVO> convertPage(PageResult<ContractDO> page); | |
| 38 | + PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> page); | |
| 33 | 39 | |
| 34 | - List<ContractExcelVO> convertList02(List<ContractDO> list); | |
| 40 | + List<CrmContractExcelVO> convertList02(List<CrmContractDO> list); | |
| 35 | 41 | |
| 36 | 42 | @Mappings({ |
| 37 | 43 | @Mapping(target = "bizId", source = "reqVO.id"), |
| ... | ... | @@ -39,4 +45,25 @@ public interface ContractConvert { |
| 39 | 45 | }) |
| 40 | 46 | CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId); |
| 41 | 47 | |
| 48 | + default PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | |
| 49 | + List<CrmCustomerDO> customerList) { | |
| 50 | + return new PageResult<>(converList(pageResult.getList(), userMap, customerList), pageResult.getTotal()); | |
| 51 | + } | |
| 52 | + | |
| 53 | + default List<ContractRespVO> converList(List<CrmContractDO> contractList, Map<Long, AdminUserRespDTO> userMap, | |
| 54 | + List<CrmCustomerDO> customerList) { | |
| 55 | + List<ContractRespVO> result = convertList(contractList); | |
| 56 | + Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); | |
| 57 | + result.forEach(item -> { | |
| 58 | + setUserInfo(item, userMap); | |
| 59 | + findAndThen(customerMap, item.getCustomerId(), customer -> item.setCustomerName(customer.getName())); | |
| 60 | + }); | |
| 61 | + return result; | |
| 62 | + } | |
| 63 | + | |
| 64 | + static void setUserInfo(ContractRespVO contract, Map<Long, AdminUserRespDTO> userMap) { | |
| 65 | + findAndThen(userMap, contract.getOwnerUserId(), user -> contract.setOwnerUserName(user.getNickname())); | |
| 66 | + findAndThen(userMap, Long.parseLong(contract.getCreator()), user -> contract.setCreatorName(user.getNickname())); | |
| 67 | + } | |
| 68 | + | |
| 42 | 69 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/ContractDO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.contract; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -8,8 +9,9 @@ import lombok.*; |
| 8 | 9 | |
| 9 | 10 | import java.time.LocalDateTime; |
| 10 | 11 | |
| 12 | +// TODO 芋艿:实体的梳理 | |
| 11 | 13 | /** |
| 12 | - * 合同 DO | |
| 14 | + * CRM 合同 DO | |
| 13 | 15 | * |
| 14 | 16 | * @author dhb52 |
| 15 | 17 | */ |
| ... | ... | @@ -21,7 +23,7 @@ import java.time.LocalDateTime; |
| 21 | 23 | @Builder |
| 22 | 24 | @NoArgsConstructor |
| 23 | 25 | @AllArgsConstructor |
| 24 | -public class ContractDO extends BaseDO { | |
| 26 | +public class CrmContractDO extends BaseDO { | |
| 25 | 27 | |
| 26 | 28 | /** |
| 27 | 29 | * 合同编号 |
| ... | ... | @@ -89,4 +91,18 @@ public class ContractDO extends BaseDO { |
| 89 | 91 | */ |
| 90 | 92 | private String remark; |
| 91 | 93 | |
| 94 | + /** | |
| 95 | + * 负责人的用户编号 | |
| 96 | + * | |
| 97 | + * 关联 AdminUserDO 的 id 字段 | |
| 98 | + */ | |
| 99 | + private Long ownerUserId; | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 审批状态 | |
| 103 | + * | |
| 104 | + * 枚举 {@link CrmAuditStatusEnum} | |
| 105 | + */ | |
| 106 | + private Integer auditStatus; | |
| 107 | + | |
| 92 | 108 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.receivable; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -50,13 +51,13 @@ public class CrmReceivableDO extends BaseDO { |
| 50 | 51 | /** |
| 51 | 52 | * 合同 ID |
| 52 | 53 | * |
| 53 | - * 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO} | |
| 54 | + * 对应实体 {@link CrmContractDO} | |
| 54 | 55 | */ |
| 55 | 56 | private Long contractId; |
| 56 | 57 | // TODO @liuhongfeng:“对应字典”,参考别的模块,枚举 {@link XXXX};另外,这个字段就叫 status,整体状态,不只审批 |
| 57 | 58 | /** |
| 58 | 59 | * 审批状态 |
| 59 | - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS} | |
| 60 | + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS} | |
| 60 | 61 | */ |
| 61 | 62 | private Integer checkStatus; |
| 62 | 63 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivablePlanDO.java
| ... | ... | @@ -48,7 +48,7 @@ public class CrmReceivablePlanDO extends BaseDO { |
| 48 | 48 | /** |
| 49 | 49 | * 审批状态 |
| 50 | 50 | * |
| 51 | - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS} | |
| 51 | + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS} | |
| 52 | 52 | * // TODO @liuhongfeng:关联的枚举 |
| 53 | 53 | */ |
| 54 | 54 | private Integer checkStatus; | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
| ... | ... | @@ -30,7 +30,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> { |
| 30 | 30 | |
| 31 | 31 | default PageResult<CrmContactDO> selectPageByCustomer(CrmContactPageReqVO pageVO) { |
| 32 | 32 | return selectPage(pageVO, new LambdaQueryWrapperX<CrmContactDO>() |
| 33 | - .eq(CrmContactDO::getCustomerId, pageVO.getCustomerId()) | |
| 33 | + .eq(CrmContactDO::getCustomerId, pageVO.getCustomerId()) // 必须传递 | |
| 34 | 34 | .likeIfPresent(CrmContactDO::getName, pageVO.getName()) |
| 35 | 35 | .eqIfPresent(CrmContactDO::getMobile, pageVO.getMobile()) |
| 36 | 36 | .eqIfPresent(CrmContactDO::getTelephone, pageVO.getTelephone()) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/ContractMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.dal.mysql.contract; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 合同 Mapper | |
| 15 | - * | |
| 16 | - * @author dhb52 | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface ContractMapper extends BaseMapperX<ContractDO> { | |
| 20 | - | |
| 21 | - default PageResult<ContractDO> selectPage(ContractPageReqVO reqVO) { | |
| 22 | - return selectPage(reqVO, new LambdaQueryWrapperX<ContractDO>() | |
| 23 | - .likeIfPresent(ContractDO::getName, reqVO.getName()) | |
| 24 | - .eqIfPresent(ContractDO::getCustomerId, reqVO.getCustomerId()) | |
| 25 | - .eqIfPresent(ContractDO::getBusinessId, reqVO.getBusinessId()) | |
| 26 | - .betweenIfPresent(ContractDO::getOrderDate, reqVO.getOrderDate()) | |
| 27 | - .eqIfPresent(ContractDO::getNo, reqVO.getNo()) | |
| 28 | - .eqIfPresent(ContractDO::getDiscountPercent, reqVO.getDiscountPercent()) | |
| 29 | - .eqIfPresent(ContractDO::getProductPrice, reqVO.getProductPrice()) | |
| 30 | - .orderByDesc(ContractDO::getId)); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default List<ContractDO> selectList(ContractExportReqVO reqVO) { | |
| 34 | - return selectList(new LambdaQueryWrapperX<ContractDO>() | |
| 35 | - .likeIfPresent(ContractDO::getName, reqVO.getName()) | |
| 36 | - .eqIfPresent(ContractDO::getCustomerId, reqVO.getCustomerId()) | |
| 37 | - .eqIfPresent(ContractDO::getBusinessId, reqVO.getBusinessId()) | |
| 38 | - .betweenIfPresent(ContractDO::getOrderDate, reqVO.getOrderDate()) | |
| 39 | - .eqIfPresent(ContractDO::getNo, reqVO.getNo()) | |
| 40 | - .eqIfPresent(ContractDO::getDiscountPercent, reqVO.getDiscountPercent()) | |
| 41 | - .eqIfPresent(ContractDO::getProductPrice, reqVO.getProductPrice()) | |
| 42 | - .orderByDesc(ContractDO::getId)); | |
| 43 | - } | |
| 44 | - | |
| 45 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.contract; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * CRM 合同 Mapper | |
| 12 | + * | |
| 13 | + * @author dhb52 | |
| 14 | + */ | |
| 15 | +@Mapper | |
| 16 | +public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | |
| 17 | + | |
| 18 | + default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO reqVO) { | |
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmContractDO>() | |
| 20 | + .likeIfPresent(CrmContractDO::getNo, reqVO.getNo()) | |
| 21 | + .likeIfPresent(CrmContractDO::getName, reqVO.getName()) | |
| 22 | + .eqIfPresent(CrmContractDO::getCustomerId, reqVO.getCustomerId()) | |
| 23 | + .eqIfPresent(CrmContractDO::getBusinessId, reqVO.getBusinessId()) | |
| 24 | + .orderByDesc(CrmContractDO::getId)); | |
| 25 | + } | |
| 26 | + | |
| 27 | + default PageResult<CrmContractDO> selectPageByCustomer(CrmContractPageReqVO reqVO) { | |
| 28 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmContractDO>() | |
| 29 | + .eq(CrmContractDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 | |
| 30 | + .likeIfPresent(CrmContractDO::getNo, reqVO.getNo()) | |
| 31 | + .likeIfPresent(CrmContractDO::getName, reqVO.getName()) | |
| 32 | + .eqIfPresent(CrmContractDO::getBusinessId, reqVO.getBusinessId()) | |
| 33 | + .orderByDesc(CrmContractDO::getId)); | |
| 34 | + } | |
| 35 | + | |
| 36 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| ... | ... | @@ -61,13 +61,13 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 61 | 61 | |
| 62 | 62 | // 2. 创建数据权限 |
| 63 | 63 | crmPermissionService.createPermission(new CrmPermissionCreateReqBO().setUserId(userId) |
| 64 | - .setBizType(CrmBizTypeEnum.CRM_CONTACTS.getType()).setBizId(contact.getId()) | |
| 64 | + .setBizType(CrmBizTypeEnum.CRM_CONTACT.getType()).setBizId(contact.getId()) | |
| 65 | 65 | .setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); |
| 66 | 66 | return contact.getId(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | @Override |
| 70 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | |
| 70 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | |
| 71 | 71 | public void updateContact(CrmContactUpdateReqVO updateReqVO) { |
| 72 | 72 | // 1. 校验存在 |
| 73 | 73 | validateContactExists(updateReqVO.getId()); |
| ... | ... | @@ -98,7 +98,7 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | @Override |
| 101 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#id", level = CrmPermissionLevelEnum.WRITE) | |
| 101 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#id", level = CrmPermissionLevelEnum.WRITE) | |
| 102 | 102 | public void deleteContact(Long id) { |
| 103 | 103 | // 校验存在 |
| 104 | 104 | validateContactExists(id); |
| ... | ... | @@ -114,7 +114,7 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 114 | 114 | |
| 115 | 115 | // TODO 芋艿:是否要做数据权限的校验??? |
| 116 | 116 | @Override |
| 117 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#id", level = CrmPermissionLevelEnum.READ) | |
| 117 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#id", level = CrmPermissionLevelEnum.READ) | |
| 118 | 118 | public CrmContactDO getContact(Long id) { |
| 119 | 119 | return contactMapper.selectById(id); |
| 120 | 120 | } |
| ... | ... | @@ -134,9 +134,9 @@ public class CrmContactServiceImpl implements CrmContactService { |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | @Override |
| 137 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageVO.customerId", level = CrmPermissionLevelEnum.READ) | |
| 138 | - public PageResult<CrmContactDO> getContactPageByCustomer(CrmContactPageReqVO pageVO) { | |
| 139 | - return contactMapper.selectPageByCustomer(pageVO); | |
| 137 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ) | |
| 138 | + public PageResult<CrmContactDO> getContactPageByCustomer(CrmContactPageReqVO pageReqVO) { | |
| 139 | + return contactMapper.selectPageByCustomer(pageReqVO); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | @Override | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractService.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.contract; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 6 | 10 | |
| 7 | 11 | import javax.validation.Valid; |
| 8 | 12 | import java.util.Collection; |
| 9 | 13 | import java.util.List; |
| 10 | 14 | |
| 11 | 15 | /** |
| 12 | - * 合同 Service 接口 | |
| 16 | + * CRM 合同 Service 接口 | |
| 13 | 17 | * |
| 14 | 18 | * @author dhb52 |
| 15 | 19 | */ |
| 16 | -public interface ContractService { | |
| 20 | +public interface CrmContractService { | |
| 17 | 21 | |
| 18 | 22 | /** |
| 19 | 23 | * 创建合同 |
| ... | ... | @@ -22,14 +26,14 @@ public interface ContractService { |
| 22 | 26 | * @param userId 用户编号 |
| 23 | 27 | * @return 编号 |
| 24 | 28 | */ |
| 25 | - Long createContract(@Valid ContractCreateReqVO createReqVO, Long userId); | |
| 29 | + Long createContract(@Valid CrmContractCreateReqVO createReqVO, Long userId); | |
| 26 | 30 | |
| 27 | 31 | /** |
| 28 | 32 | * 更新合同 |
| 29 | 33 | * |
| 30 | 34 | * @param updateReqVO 更新信息 |
| 31 | 35 | */ |
| 32 | - void updateContract(@Valid ContractUpdateReqVO updateReqVO); | |
| 36 | + void updateContract(@Valid CrmContractUpdateReqVO updateReqVO); | |
| 33 | 37 | |
| 34 | 38 | /** |
| 35 | 39 | * 删除合同 |
| ... | ... | @@ -44,7 +48,7 @@ public interface ContractService { |
| 44 | 48 | * @param id 编号 |
| 45 | 49 | * @return 合同 |
| 46 | 50 | */ |
| 47 | - ContractDO getContract(Long id); | |
| 51 | + CrmContractDO getContract(Long id); | |
| 48 | 52 | |
| 49 | 53 | /** |
| 50 | 54 | * 获得合同列表 |
| ... | ... | @@ -52,23 +56,27 @@ public interface ContractService { |
| 52 | 56 | * @param ids 编号 |
| 53 | 57 | * @return 合同列表 |
| 54 | 58 | */ |
| 55 | - List<ContractDO> getContractList(Collection<Long> ids); | |
| 59 | + List<CrmContractDO> getContractList(Collection<Long> ids); | |
| 56 | 60 | |
| 57 | 61 | /** |
| 58 | 62 | * 获得合同分页 |
| 59 | 63 | * |
| 64 | + * 数据权限:基于 {@link CrmContractDO} 读取 | |
| 65 | + * | |
| 60 | 66 | * @param pageReqVO 分页查询 |
| 61 | 67 | * @return 合同分页 |
| 62 | 68 | */ |
| 63 | - PageResult<ContractDO> getContractPage(ContractPageReqVO pageReqVO); | |
| 69 | + PageResult<CrmContractDO> getContractPage(CrmContractPageReqVO pageReqVO); | |
| 64 | 70 | |
| 65 | 71 | /** |
| 66 | - * 获得合同列表, 用于 Excel 导出 | |
| 72 | + * 获得合同分页,基于指定客户 | |
| 67 | 73 | * |
| 68 | - * @param exportReqVO 查询条件 | |
| 69 | - * @return 合同列表 | |
| 74 | + * 数据权限:基于 {@link CrmCustomerDO} 读取 | |
| 75 | + * | |
| 76 | + * @param pageReqVO 分页查询 | |
| 77 | + * @return 联系人分页 | |
| 70 | 78 | */ |
| 71 | - List<ContractDO> getContractList(ContractExportReqVO exportReqVO); | |
| 79 | + PageResult<CrmContractDO> getContractPageByCustomer(CrmContractPageReqVO pageReqVO); | |
| 72 | 80 | |
| 73 | 81 | /** |
| 74 | 82 | * 合同转移 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImpl.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| ... | ... | @@ -3,13 +3,16 @@ package cn.iocoder.yudao.module.crm.service.contract; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | |
| 7 | 10 | import cn.iocoder.yudao.module.crm.convert.contract.ContractConvert; |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 9 | -import cn.iocoder.yudao.module.crm.dal.mysql.contract.ContractMapper; | |
| 10 | -import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; | |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | |
| 11 | 13 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 12 | 14 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 15 | +import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; | |
| 13 | 16 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 14 | 17 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 15 | 18 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -24,48 +27,47 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU |
| 24 | 27 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS; |
| 25 | 28 | |
| 26 | 29 | /** |
| 27 | - * 合同 Service 实现类 | |
| 30 | + * CRM 合同 Service 实现类 | |
| 28 | 31 | * |
| 29 | 32 | * @author dhb52 |
| 30 | 33 | */ |
| 31 | 34 | @Service |
| 32 | 35 | @Validated |
| 33 | -public class ContractServiceImpl implements ContractService { | |
| 36 | +public class CrmContractServiceImpl implements CrmContractService { | |
| 34 | 37 | |
| 35 | 38 | @Resource |
| 36 | - private ContractMapper contractMapper; | |
| 39 | + private CrmContractMapper contractMapper; | |
| 37 | 40 | |
| 38 | 41 | @Resource |
| 39 | 42 | private CrmPermissionService crmPermissionService; |
| 40 | 43 | |
| 41 | 44 | @Override |
| 42 | - public Long createContract(ContractCreateReqVO createReqVO, Long userId) { | |
| 45 | + public Long createContract(CrmContractCreateReqVO createReqVO, Long userId) { | |
| 43 | 46 | // 插入 |
| 44 | - ContractDO contract = ContractConvert.INSTANCE.convert(createReqVO); | |
| 47 | + CrmContractDO contract = ContractConvert.INSTANCE.convert(createReqVO); | |
| 45 | 48 | contractMapper.insert(contract); |
| 46 | 49 | |
| 47 | 50 | // 创建数据权限 |
| 48 | - crmPermissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_CONTRACT.getType()) | |
| 49 | - .setBizId(contract.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 | |
| 50 | - | |
| 51 | - // 返回 | |
| 51 | + crmPermissionService.createPermission(new CrmPermissionCreateReqBO().setUserId(userId) | |
| 52 | + .setBizType(CrmBizTypeEnum.CRM_CONTRACT.getType()).setBizId(contract.getId()) | |
| 53 | + .setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); | |
| 52 | 54 | return contract.getId(); |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | @Override |
| 56 | 58 | @Transactional(rollbackFor = Exception.class) |
| 57 | 59 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, level = CrmPermissionLevelEnum.WRITE) |
| 58 | - public void updateContract(ContractUpdateReqVO updateReqVO) { | |
| 60 | + public void updateContract(CrmContractUpdateReqVO updateReqVO) { | |
| 59 | 61 | // 校验存在 |
| 60 | 62 | validateContractExists(updateReqVO.getId()); |
| 61 | 63 | // 更新 |
| 62 | - ContractDO updateObj = ContractConvert.INSTANCE.convert(updateReqVO); | |
| 64 | + CrmContractDO updateObj = ContractConvert.INSTANCE.convert(updateReqVO); | |
| 63 | 65 | contractMapper.updateById(updateObj); |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | @Override |
| 67 | 69 | @Transactional(rollbackFor = Exception.class) |
| 68 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, level = CrmPermissionLevelEnum.WRITE) | |
| 70 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#id", level = CrmPermissionLevelEnum.WRITE) | |
| 69 | 71 | public void deleteContract(Long id) { |
| 70 | 72 | // 校验存在 |
| 71 | 73 | validateContractExists(id); |
| ... | ... | @@ -73,22 +75,23 @@ public class ContractServiceImpl implements ContractService { |
| 73 | 75 | contractMapper.deleteById(id); |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | - private ContractDO validateContractExists(Long id) { | |
| 77 | - ContractDO contract = contractMapper.selectById(id); | |
| 78 | + private CrmContractDO validateContractExists(Long id) { | |
| 79 | + CrmContractDO contract = contractMapper.selectById(id); | |
| 78 | 80 | if (contract == null) { |
| 79 | 81 | throw exception(CONTRACT_NOT_EXISTS); |
| 80 | 82 | } |
| 81 | 83 | return contract; |
| 82 | 84 | } |
| 83 | 85 | |
| 86 | + // TODO 芋艿:是否要做数据权限的校验??? | |
| 84 | 87 | @Override |
| 85 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, level = CrmPermissionLevelEnum.READ) | |
| 86 | - public ContractDO getContract(Long id) { | |
| 88 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#id", level = CrmPermissionLevelEnum.READ) | |
| 89 | + public CrmContractDO getContract(Long id) { | |
| 87 | 90 | return contractMapper.selectById(id); |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | @Override |
| 91 | - public List<ContractDO> getContractList(Collection<Long> ids) { | |
| 94 | + public List<CrmContractDO> getContractList(Collection<Long> ids) { | |
| 92 | 95 | if (CollUtil.isEmpty(ids)) { |
| 93 | 96 | return ListUtil.empty(); |
| 94 | 97 | } |
| ... | ... | @@ -96,13 +99,14 @@ public class ContractServiceImpl implements ContractService { |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | 101 | @Override |
| 99 | - public PageResult<ContractDO> getContractPage(ContractPageReqVO pageReqVO) { | |
| 102 | + public PageResult<CrmContractDO> getContractPage(CrmContractPageReqVO pageReqVO) { | |
| 100 | 103 | return contractMapper.selectPage(pageReqVO); |
| 101 | 104 | } |
| 102 | 105 | |
| 103 | 106 | @Override |
| 104 | - public List<ContractDO> getContractList(ContractExportReqVO exportReqVO) { | |
| 105 | - return contractMapper.selectList(exportReqVO); | |
| 107 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ) | |
| 108 | + public PageResult<CrmContractDO> getContractPageByCustomer(CrmContractPageReqVO pageReqVO) { | |
| 109 | + return contractMapper.selectPageByCustomer(pageReqVO); | |
| 106 | 110 | } |
| 107 | 111 | |
| 108 | 112 | @Override | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/package-info.java deleted
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
| ... | ... | @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableP |
| 10 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanPageReqVO; |
| 11 | 11 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanUpdateReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert; |
| 13 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 14 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 15 | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| 16 | 16 | import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivablePlanMapper; |
| 17 | -import cn.iocoder.yudao.module.crm.enums.AuditStatusEnum; | |
| 18 | -import cn.iocoder.yudao.module.crm.service.contract.ContractService; | |
| 17 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 18 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 19 | 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 20 | 20 | import org.springframework.stereotype.Service; |
| 21 | 21 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -40,7 +40,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { |
| 40 | 40 | @Resource |
| 41 | 41 | private CrmReceivablePlanMapper crmReceivablePlanMapper; |
| 42 | 42 | @Resource |
| 43 | - private ContractService contractService; | |
| 43 | + private CrmContractService contractService; | |
| 44 | 44 | @Resource |
| 45 | 45 | private CrmCustomerService crmCustomerService; |
| 46 | 46 | |
| ... | ... | @@ -52,7 +52,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { |
| 52 | 52 | receivablePlan.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 53 | 53 | } |
| 54 | 54 | if (ObjectUtil.isNull(receivablePlan.getCheckStatus())){ |
| 55 | - receivablePlan.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue()); | |
| 55 | + receivablePlan.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus()); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | checkReceivablePlan(receivablePlan); |
| ... | ... | @@ -68,7 +68,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { |
| 68 | 68 | throw exception(CONTRACT_NOT_EXISTS); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - ContractDO contract = contractService.getContract(receivablePlan.getContractId()); | |
| 71 | + CrmContractDO contract = contractService.getContract(receivablePlan.getContractId()); | |
| 72 | 72 | if(ObjectUtil.isNull(contract)){ |
| 73 | 73 | throw exception(CONTRACT_NOT_EXISTS); |
| 74 | 74 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
| ... | ... | @@ -10,13 +10,13 @@ import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableE |
| 10 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO; |
| 11 | 11 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert; |
| 13 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 14 | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 15 | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| 16 | 16 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| 17 | 17 | import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper; |
| 18 | -import cn.iocoder.yudao.module.crm.enums.AuditStatusEnum; | |
| 19 | -import cn.iocoder.yudao.module.crm.service.contract.ContractService; | |
| 18 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 19 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 20 | 20 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 21 | 21 | import org.springframework.stereotype.Service; |
| 22 | 22 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -41,7 +41,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 41 | 41 | @Resource |
| 42 | 42 | private CrmReceivableMapper crmReceivableMapper; |
| 43 | 43 | @Resource |
| 44 | - private ContractService contractService; | |
| 44 | + private CrmContractService contractService; | |
| 45 | 45 | @Resource |
| 46 | 46 | private CrmCustomerService crmCustomerService; |
| 47 | 47 | @Resource |
| ... | ... | @@ -57,7 +57,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 57 | 57 | receivable.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 58 | 58 | } |
| 59 | 59 | if (ObjectUtil.isNull(receivable.getCheckStatus())){ |
| 60 | - receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue()); | |
| 60 | + receivable.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus()); | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // TODO @liuhongfeng:一般来说,逻辑的写法,是要先检查,后操作 db;所以,你这个 check 应该放到 CrmReceivableDO receivable 之前; |
| ... | ... | @@ -75,7 +75,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 75 | 75 | throw exception(CONTRACT_NOT_EXISTS); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - ContractDO contract = contractService.getContract(receivable.getContractId()); | |
| 78 | + CrmContractDO contract = contractService.getContract(receivable.getContractId()); | |
| 79 | 79 | if(ObjectUtil.isNull(contract)){ |
| 80 | 80 | throw exception(CONTRACT_NOT_EXISTS); |
| 81 | 81 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImplTest.java
| ... | ... | @@ -2,12 +2,12 @@ package cn.iocoder.yudao.module.crm.service.contract; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | |
| 6 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO; | |
| 10 | -import cn.iocoder.yudao.module.crm.dal.mysql.contract.ContractMapper; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | |
| 11 | 11 | import org.junit.jupiter.api.Disabled; |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | 13 | import org.springframework.context.annotation.Import; |
| ... | ... | @@ -26,54 +26,54 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTRACT_NOT_ |
| 26 | 26 | import static org.junit.jupiter.api.Assertions.*; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * {@link ContractServiceImpl} 的单元测试类 | |
| 29 | + * {@link CrmContractServiceImpl} 的单元测试类 | |
| 30 | 30 | * |
| 31 | 31 | * @author dhb52 |
| 32 | 32 | */ |
| 33 | -@Import(ContractServiceImpl.class) | |
| 33 | +@Import(CrmContractServiceImpl.class) | |
| 34 | 34 | public class ContractServiceImplTest extends BaseDbUnitTest { |
| 35 | 35 | |
| 36 | 36 | @Resource |
| 37 | - private ContractServiceImpl contractService; | |
| 37 | + private CrmContractServiceImpl contractService; | |
| 38 | 38 | |
| 39 | 39 | @Resource |
| 40 | - private ContractMapper contractMapper; | |
| 40 | + private CrmContractMapper contractMapper; | |
| 41 | 41 | |
| 42 | 42 | @Test |
| 43 | 43 | public void testCreateContract_success() { |
| 44 | 44 | // 准备参数 |
| 45 | - ContractCreateReqVO reqVO = randomPojo(ContractCreateReqVO.class); | |
| 45 | + CrmContractCreateReqVO reqVO = randomPojo(CrmContractCreateReqVO.class); | |
| 46 | 46 | |
| 47 | 47 | // 调用 |
| 48 | 48 | Long contractId = contractService.createContract(reqVO, getLoginUserId()); |
| 49 | 49 | // 断言 |
| 50 | 50 | assertNotNull(contractId); |
| 51 | 51 | // 校验记录的属性是否正确 |
| 52 | - ContractDO contract = contractMapper.selectById(contractId); | |
| 52 | + CrmContractDO contract = contractMapper.selectById(contractId); | |
| 53 | 53 | assertPojoEquals(reqVO, contract); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | @Test |
| 57 | 57 | public void testUpdateContract_success() { |
| 58 | 58 | // mock 数据 |
| 59 | - ContractDO dbContract = randomPojo(ContractDO.class); | |
| 59 | + CrmContractDO dbContract = randomPojo(CrmContractDO.class); | |
| 60 | 60 | contractMapper.insert(dbContract);// @Sql: 先插入出一条存在的数据 |
| 61 | 61 | // 准备参数 |
| 62 | - ContractUpdateReqVO reqVO = randomPojo(ContractUpdateReqVO.class, o -> { | |
| 62 | + CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class, o -> { | |
| 63 | 63 | o.setId(dbContract.getId()); // 设置更新的 ID |
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | // 调用 |
| 67 | 67 | contractService.updateContract(reqVO); |
| 68 | 68 | // 校验是否更新正确 |
| 69 | - ContractDO contract = contractMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 69 | + CrmContractDO contract = contractMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 70 | 70 | assertPojoEquals(reqVO, contract); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | @Test |
| 74 | 74 | public void testUpdateContract_notExists() { |
| 75 | 75 | // 准备参数 |
| 76 | - ContractUpdateReqVO reqVO = randomPojo(ContractUpdateReqVO.class); | |
| 76 | + CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class); | |
| 77 | 77 | |
| 78 | 78 | // 调用, 并断言异常 |
| 79 | 79 | assertServiceException(() -> contractService.updateContract(reqVO), CONTRACT_NOT_EXISTS); |
| ... | ... | @@ -82,7 +82,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 82 | 82 | @Test |
| 83 | 83 | public void testDeleteContract_success() { |
| 84 | 84 | // mock 数据 |
| 85 | - ContractDO dbContract = randomPojo(ContractDO.class); | |
| 85 | + CrmContractDO dbContract = randomPojo(CrmContractDO.class); | |
| 86 | 86 | contractMapper.insert(dbContract);// @Sql: 先插入出一条存在的数据 |
| 87 | 87 | // 准备参数 |
| 88 | 88 | Long id = dbContract.getId(); |
| ... | ... | @@ -106,7 +106,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 106 | 106 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 107 | 107 | public void testGetContractPage() { |
| 108 | 108 | // mock 数据 |
| 109 | - ContractDO dbContract = randomPojo(ContractDO.class, o -> { // 等会查询到 | |
| 109 | + CrmContractDO dbContract = randomPojo(CrmContractDO.class, o -> { // 等会查询到 | |
| 110 | 110 | o.setName(null); |
| 111 | 111 | o.setCustomerId(null); |
| 112 | 112 | o.setBusinessId(null); |
| ... | ... | @@ -131,7 +131,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 131 | 131 | // 测试 productPrice 不匹配 |
| 132 | 132 | contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setProductPrice(null))); |
| 133 | 133 | // 准备参数 |
| 134 | - ContractPageReqVO reqVO = new ContractPageReqVO(); | |
| 134 | + CrmContractPageReqVO reqVO = new CrmContractPageReqVO(); | |
| 135 | 135 | reqVO.setName(null); |
| 136 | 136 | reqVO.setCustomerId(null); |
| 137 | 137 | reqVO.setBusinessId(null); |
| ... | ... | @@ -141,7 +141,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 141 | 141 | reqVO.setProductPrice(null); |
| 142 | 142 | |
| 143 | 143 | // 调用 |
| 144 | - PageResult<ContractDO> pageResult = contractService.getContractPage(reqVO); | |
| 144 | + PageResult<CrmContractDO> pageResult = contractService.getContractPage(reqVO); | |
| 145 | 145 | // 断言 |
| 146 | 146 | assertEquals(1, pageResult.getTotal()); |
| 147 | 147 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -152,7 +152,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 152 | 152 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 153 | 153 | public void testGetContractList() { |
| 154 | 154 | // mock 数据 |
| 155 | - ContractDO dbContract = randomPojo(ContractDO.class, o -> { // 等会查询到 | |
| 155 | + CrmContractDO dbContract = randomPojo(CrmContractDO.class, o -> { // 等会查询到 | |
| 156 | 156 | o.setName("合同名称"); |
| 157 | 157 | o.setCustomerId(null); |
| 158 | 158 | o.setBusinessId(null); |
| ... | ... | @@ -187,7 +187,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { |
| 187 | 187 | reqVO.setProductPrice(null); |
| 188 | 188 | |
| 189 | 189 | // 调用 |
| 190 | - List<ContractDO> list = contractService.getContractList(reqVO); | |
| 190 | + List<CrmContractDO> list = contractService.getContractList(reqVO); | |
| 191 | 191 | // 断言 |
| 192 | 192 | assertEquals(1, list.size()); |
| 193 | 193 | assertPojoEquals(dbContract, list.get(0)); | ... | ... |