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