Commit e64e60c71178757985d1077fc6d4773ac68eb82e

Authored by 芋道源码
Committed by Gitee
2 parents cc6cb835 0c30f59e

!832 CRM: 完善一些 TODO

Merge pull request !832 from puhui999/develop
Showing 56 changed files with 642 additions and 357 deletions
yudao-module-crm/yudao-module-crm-api/pom.xml
... ... @@ -28,13 +28,6 @@
28 28 <artifactId>spring-boot-starter-validation</artifactId>
29 29 <optional>true</optional>
30 30 </dependency>
31   - <!-- TODO @puhui999:api 之间,不直接引入哈;然后,logrecord function 在微服务下,这么跑会高不起来,所以每个服务自己写 function -->
32   - <dependency>
33   - <groupId>cn.iocoder.boot</groupId>
34   - <artifactId>yudao-module-system-api</artifactId>
35   - <version>${revision}</version>
36   - <optional>true</optional>
37   - </dependency>
38 31 </dependencies>
39 32  
40 33 </project>
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
... ... @@ -13,5 +13,6 @@ public interface DictTypeConstants {
13 13 String CRM_AUDIT_STATUS = "crm_audit_status"; // CRM 审批状态
14 14 String CRM_PRODUCT_UNIT = "crm_product_unit"; // CRM 产品单位
15 15 String CRM_PRODUCT_STATUS = "crm_product_status"; // CRM 产品状态
  16 + String CRM_FOLLOW_UP_TYPE = "crm_follow_up_type"; // 跟进方式
16 17  
17 18 }
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java
1 1 package cn.iocoder.yudao.module.crm.enums;
2 2  
3   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID;
4   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
5   -
6 3 /**
7 4 * CRM 操作日志枚举
8 5 * 目的:统一管理,也减少 Service 里各种“复杂”字符串
... ... @@ -25,7 +22,7 @@ public interface LogRecordConstants {
25 22 String CRM_CUSTOMER_DELETE_SUB_TYPE = "删除客户";
26 23 String CRM_CUSTOMER_DELETE_SUCCESS = "删除了客户【{{#customerName}}】";
27 24 String CRM_CUSTOMER_TRANSFER_SUB_TYPE = "转移客户";
28   - String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#customer.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
  25 + String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{getAdminUserById{#customer.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
29 26 String CRM_CUSTOMER_LOCK_SUB_TYPE = "{{#customer.lockStatus ? '解锁客户' : '锁定客户'}}";
30 27 String CRM_CUSTOMER_LOCK_SUCCESS = "{{#customer.lockStatus ? '将客户【' + #customer.name + '】解锁' : '将客户【' + #customer.name + '】锁定'}}";
31 28 String CRM_CUSTOMER_POOL_SUB_TYPE = "客户放入公海";
... ... @@ -59,7 +56,7 @@ public interface LogRecordConstants {
59 56 String CRM_CONTACT_DELETE_SUB_TYPE = "删除联系人";
60 57 String CRM_CONTACT_DELETE_SUCCESS = "删除了联系人【{{#contactName}}】";
61 58 String CRM_CONTACT_TRANSFER_SUB_TYPE = "转移联系人";
62   - String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contact.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
  59 + String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{getAdminUserById{#contact.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
63 60  
64 61 // ======================= CRM_BUSINESS 商机 =======================
65 62  
... ... @@ -71,7 +68,7 @@ public interface LogRecordConstants {
71 68 String CRM_BUSINESS_DELETE_SUB_TYPE = "删除商机";
72 69 String CRM_BUSINESS_DELETE_SUCCESS = "删除了商机【{{#businessName}}】";
73 70 String CRM_BUSINESS_TRANSFER_SUB_TYPE = "转移商机";
74   - String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#business.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
  71 + String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{getAdminUserById{#business.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
75 72  
76 73 // ======================= CRM_CONTRACT 合同 =======================
77 74  
... ... @@ -83,7 +80,7 @@ public interface LogRecordConstants {
83 80 String CRM_CONTRACT_DELETE_SUB_TYPE = "删除合同";
84 81 String CRM_CONTRACT_DELETE_SUCCESS = "删除了合同【{{#contractName}}】";
85 82 String CRM_CONTRACT_TRANSFER_SUB_TYPE = "转移合同";
86   - String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contract.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
  83 + String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{getAdminUserById{#contract.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
87 84  
88 85 // ======================= CRM_PRODUCT 产品 =======================
89 86  
... ... @@ -109,20 +106,20 @@ public interface LogRecordConstants {
109 106  
110 107 String CRM_RECEIVABLE_TYPE = "CRM 回款";
111 108 String CRM_RECEIVABLE_CREATE_SUB_TYPE = "创建回款";
112   - String CRM_RECEIVABLE_CREATE_SUCCESS = "创建了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
  109 + String CRM_RECEIVABLE_CREATE_SUCCESS = "创建了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
113 110 String CRM_RECEIVABLE_UPDATE_SUB_TYPE = "更新回款";
114   - String CRM_RECEIVABLE_UPDATE_SUCCESS = "更新了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款: {_DIFF{#updateReqVO}}";
  111 + String CRM_RECEIVABLE_UPDATE_SUCCESS = "更新了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款: {_DIFF{#updateReqVO}}";
115 112 String CRM_RECEIVABLE_DELETE_SUB_TYPE = "删除回款";
116   - String CRM_RECEIVABLE_DELETE_SUCCESS = "删除了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
  113 + String CRM_RECEIVABLE_DELETE_SUCCESS = "删除了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
117 114  
118 115 // ======================= CRM_RECEIVABLE_PLAN 回款计划 =======================
119 116  
120 117 String CRM_RECEIVABLE_PLAN_TYPE = "CRM 回款计划";
121 118 String CRM_RECEIVABLE_PLAN_CREATE_SUB_TYPE = "创建回款计划";
122   - String CRM_RECEIVABLE_PLAN_CREATE_SUCCESS = "创建了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
  119 + String CRM_RECEIVABLE_PLAN_CREATE_SUCCESS = "创建了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
123 120 String CRM_RECEIVABLE_PLAN_UPDATE_SUB_TYPE = "更新回款计划";
124   - String CRM_RECEIVABLE_PLAN_UPDATE_SUCCESS = "更新了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划: {_DIFF{#updateReqVO}}";
  121 + String CRM_RECEIVABLE_PLAN_UPDATE_SUCCESS = "更新了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划: {_DIFF{#updateReqVO}}";
125 122 String CRM_RECEIVABLE_PLAN_DELETE_SUB_TYPE = "删除回款计划";
126   - String CRM_RECEIVABLE_PLAN_DELETE_SUCCESS = "删除了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
  123 + String CRM_RECEIVABLE_PLAN_DELETE_SUCCESS = "删除了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
127 124  
128 125 }
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/operatelog/CrmParseFunctionNameConstants.java deleted
1   -package cn.iocoder.yudao.module.crm.enums.operatelog;
2   -
3   -/**
4   - * functionName 常量枚举
5   - * 方便别的模块调用
6   - *
7   - * @author HUIHUI
8   - */
9   -// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈
10   -public interface CrmParseFunctionNameConstants {
11   -
12   - String GET_CONTACT_BY_ID = "getContactById"; // 获取联系人信息
13   - String GET_CUSTOMER_BY_ID = "getCustomerById"; // 获取客户信息
14   - String GET_CUSTOMER_INDUSTRY = "getCustomerIndustry"; // 获取客户行业信息
15   - String GET_CUSTOMER_LEVEL = "getCustomerLevel"; // 获取客户级别
16   - String GET_CUSTOMER_SOURCE = "getCustomerSource"; // 获取客户来源
17   - String GET_CONTRACT_BY_ID = "getContractById"; // 获取合同信息
18   -
19   -}
20 0 \ No newline at end of file
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
... ... @@ -3,9 +3,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.business;
3 3 import cn.hutool.core.collection.CollUtil;
4 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
7 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
8   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*;
  9 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO;
  10 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO;
  11 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO;
  12 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO;
9 13 import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert;
10 14 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
11 15 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO;
... ... @@ -31,6 +35,7 @@ import java.util.List;
31 35 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
32 36 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
33 37 import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE;
  38 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
34 39 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
35 40 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
36 41 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
... ... @@ -51,18 +56,17 @@ public class CrmBusinessController {
51 56 @Resource
52 57 private CrmBusinessStatusService businessStatusService;
53 58  
54   - // TODO @商机待定:CrmBusinessCreateReqVO、CrmBusinessUpdateReqVO、CrmBusinessRespVO 按照新的 VO 规范
55 59 @PostMapping("/create")
56 60 @Operation(summary = "创建商机")
57 61 @PreAuthorize("@ss.hasPermission('crm:business:create')")
58   - public CommonResult<Long> createBusiness(@Valid @RequestBody CrmBusinessCreateReqVO createReqVO) {
  62 + public CommonResult<Long> createBusiness(@Valid @RequestBody CrmBusinessSaveReqVO createReqVO) {
59 63 return success(businessService.createBusiness(createReqVO, getLoginUserId()));
60 64 }
61 65  
62 66 @PutMapping("/update")
63 67 @Operation(summary = "更新商机")
64 68 @PreAuthorize("@ss.hasPermission('crm:business:update')")
65   - public CommonResult<Boolean> updateBusiness(@Valid @RequestBody CrmBusinessUpdateReqVO updateReqVO) {
  69 + public CommonResult<Boolean> updateBusiness(@Valid @RequestBody CrmBusinessSaveReqVO updateReqVO) {
66 70 businessService.updateBusiness(updateReqVO);
67 71 return success(true);
68 72 }
... ... @@ -82,7 +86,26 @@ public class CrmBusinessController {
82 86 @PreAuthorize("@ss.hasPermission('crm:business:query')")
83 87 public CommonResult<CrmBusinessRespVO> getBusiness(@RequestParam("id") Long id) {
84 88 CrmBusinessDO business = businessService.getBusiness(id);
85   - return success(CrmBusinessConvert.INSTANCE.convert(business));
  89 + return success(BeanUtils.toBean(business, CrmBusinessRespVO.class));
  90 + }
  91 +
  92 + @GetMapping("/list-by-ids")
  93 + @Operation(summary = "获得商机列表")
  94 + @Parameter(name = "ids", description = "编号", required = true, example = "[1024]")
  95 + @PreAuthorize("@ss.hasPermission('crm:business:query')")
  96 + public CommonResult<List<CrmBusinessRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) {
  97 + return success(BeanUtils.toBean(businessService.getBusinessList(ids, getLoginUserId()), CrmBusinessRespVO.class));
  98 + }
  99 +
  100 + @GetMapping("/simple-all-list")
  101 + @Operation(summary = "获得联系人的精简列表")
  102 + @PreAuthorize("@ss.hasPermission('crm:contact:query')")
  103 + public CommonResult<List<CrmBusinessRespVO>> getSimpleContactList() {
  104 + CrmBusinessPageReqVO reqVO = new CrmBusinessPageReqVO();
  105 + reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页
  106 + PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(reqVO, getLoginUserId());
  107 + return success(convertList(pageResult.getList(), business -> // 只返回 id、name 字段
  108 + new CrmBusinessRespVO().setId(business.getId()).setName(business.getName())));
86 109 }
87 110  
88 111 @GetMapping("/page")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessCreateReqVO.java deleted
1   -package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business;
2   -
3   -import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.Data;
5   -import lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7   -
8   -@Schema(description = "管理后台 - 商机创建 Request VO")
9   -@Data
10   -@EqualsAndHashCode(callSuper = true)
11   -@ToString(callSuper = true)
12   -public class CrmBusinessCreateReqVO extends CrmBusinessBaseVO {
13   -
14   - // TODO @ljileo:新建的时候,应该可以传递添加的产品;
15   -
16   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.*;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +import org.springframework.format.annotation.DateTimeFormat;
  7 +
  8 +import java.math.BigDecimal;
5 9 import java.time.LocalDateTime;
6 10  
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
7 13 @Schema(description = "管理后台 - 商机 Response VO")
8 14 @Data
9   -@EqualsAndHashCode(callSuper = true)
10   -@ToString(callSuper = true)
11   -public class CrmBusinessRespVO extends CrmBusinessBaseVO {
  15 +public class CrmBusinessRespVO {
12 16  
13 17 @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129")
14 18 private Long id;
15 19  
  20 + @Schema(description = "商机名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
  21 + @NotNull(message = "商机名称不能为空")
  22 + private String name;
  23 +
  24 + @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714")
  25 + @NotNull(message = "商机状态类型不能为空")
  26 + private Long statusTypeId;
  27 +
  28 + @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320")
  29 + @NotNull(message = "商机状态不能为空")
  30 + private Long statusId;
  31 +
  32 + @Schema(description = "下次联系时间")
  33 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  34 + private LocalDateTime contactNextTime;
  35 +
  36 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10299")
  37 + @NotNull(message = "客户不能为空")
  38 + private Long customerId;
  39 +
  40 + @Schema(description = "预计成交日期")
  41 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  42 + private LocalDateTime dealTime;
  43 +
  44 + @Schema(description = "商机金额", example = "12371")
  45 + private Integer price;
  46 +
  47 + // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题
  48 + @Schema(description = "整单折扣")
  49 + private Integer discountPercent;
  50 +
  51 + @Schema(description = "产品总金额", example = "12025")
  52 + private BigDecimal productPrice;
  53 +
  54 + @Schema(description = "备注", example = "随便")
  55 + private String remark;
  56 +
16 57 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 58 private LocalDateTime createTime;
18 59  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business;
2 2  
  3 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction;
  4 +import com.mzt.logapi.starter.annotation.DiffLogField;
3 5 import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
4 7 import lombok.Data;
5 8 import org.springframework.format.annotation.DateTimeFormat;
6 9  
7   -import jakarta.validation.constraints.NotNull;
8 10 import java.math.BigDecimal;
9 11 import java.time.LocalDateTime;
10 12  
11 13 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
12 14  
13   -/**
14   - * 商机 Base VO,提供给添加、修改、详细的子 VO 使用
15   - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
16   - */
  15 +// TODO @ljileo:DiffLogField function 完善一下
  16 +@Schema(description = "管理后台 - CRM 商机创建/更新 Request VO")
17 17 @Data
18   -public class CrmBusinessBaseVO {
  18 +public class CrmBusinessSaveReqVO {
  19 +
  20 + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129")
  21 + private Long id;
19 22  
20 23 @Schema(description = "商机名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
  24 + @DiffLogField(name = "商机名称")
21 25 @NotNull(message = "商机名称不能为空")
22 26 private String name;
23 27  
24 28 @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714")
  29 + @DiffLogField(name = "商机状态")
25 30 @NotNull(message = "商机状态类型不能为空")
26 31 private Long statusTypeId;
27 32  
28 33 @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320")
  34 + @DiffLogField(name = "商机状态")
29 35 @NotNull(message = "商机状态不能为空")
30 36 private Long statusId;
31 37  
32 38 @Schema(description = "下次联系时间")
  39 + @DiffLogField(name = "下次联系时间")
33 40 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
34 41 private LocalDateTime contactNextTime;
35 42  
36 43 @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10299")
  44 + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME)
37 45 @NotNull(message = "客户不能为空")
38 46 private Long customerId;
39 47  
40 48 @Schema(description = "预计成交日期")
  49 + @DiffLogField(name = "预计成交日期")
41 50 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
42 51 private LocalDateTime dealTime;
43 52  
44 53 @Schema(description = "商机金额", example = "12371")
  54 + @DiffLogField(name = "商机金额")
45 55 private Integer price;
46 56  
47 57 // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题
48 58 @Schema(description = "整单折扣")
  59 + @DiffLogField(name = "整单折扣")
49 60 private Integer discountPercent;
50 61  
51 62 @Schema(description = "产品总金额", example = "12025")
  63 + @DiffLogField(name = "产品总金额")
52 64 private BigDecimal productPrice;
53 65  
54 66 @Schema(description = "备注", example = "随便")
  67 + @DiffLogField(name = "备注")
55 68 private String remark;
56 69  
  70 + // TODO @ljileo:修改的时候,应该可以传递添加的产品;
  71 +
57 72 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessUpdateReqVO.java deleted
1   -package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business;
2   -
3   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessBaseVO;
4   -import io.swagger.v3.oas.annotations.media.Schema;
5   -import lombok.Data;
6   -import lombok.EqualsAndHashCode;
7   -import lombok.ToString;
8   -
9   -import jakarta.validation.constraints.NotNull;
10   -
11   -@Schema(description = "管理后台 - 商机更新 Request VO")
12   -@Data
13   -@EqualsAndHashCode(callSuper = true)
14   -@ToString(callSuper = true)
15   -public class CrmBusinessUpdateReqVO extends CrmBusinessBaseVO {
16   -
17   - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129")
18   - @NotNull(message = "主键不能为空")
19   - private Long id;
20   -
21   - // TODO @ljileo:修改的时候,应该可以传递添加的产品;
22   -
23   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
... ... @@ -113,12 +113,22 @@ public class CrmContactController {
113 113 return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList));
114 114 }
115 115  
  116 + @GetMapping("/list-by-ids")
  117 + @Operation(summary = "获得联系人列表")
  118 + @Parameter(name = "ids", description = "编号", required = true, example = "[1024]")
  119 + @PreAuthorize("@ss.hasPermission('crm:contact:query')")
  120 + public CommonResult<List<CrmContactRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) {
  121 + return success(BeanUtils.toBean(contactService.getContactList(ids, getLoginUserId()), CrmContactRespVO.class));
  122 + }
  123 +
116 124 @GetMapping("/simple-all-list")
117 125 @Operation(summary = "获得联系人的精简列表")
118 126 @PreAuthorize("@ss.hasPermission('crm:contact:query')")
119 127 public CommonResult<List<CrmContactRespVO>> getSimpleContactList() {
120   - List<CrmContactDO> list = contactService.getContactList();
121   - return success(convertList(list, contact -> // 只返回 id、name 字段
  128 + CrmContactPageReqVO reqVO = new CrmContactPageReqVO();
  129 + reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页
  130 + PageResult<CrmContactDO> pageResult = contactService.getContactPage(reqVO, getLoginUserId());
  131 + return success(convertList(pageResult.getList(), contact -> // 只返回 id、name 字段
122 132 new CrmContactRespVO().setId(contact.getId()).setName(contact.getName())));
123 133 }
124 134  
... ... @@ -153,7 +163,7 @@ public class CrmContactController {
153 163 @GetMapping("/operate-log-page")
154 164 @Operation(summary = "获得客户操作日志")
155 165 @PreAuthorize("@ss.hasPermission('crm:customer:query')")
156   - public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId")Long bizId) {
  166 + public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId") Long bizId) {
157 167 OperateLogV2PageReqDTO reqVO = new OperateLogV2PageReqDTO();
158 168 reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页
159 169 reqVO.setBizType(CRM_CONTACT_TYPE);
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactSaveReqVO.java
... ... @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
2 2  
3 3 import cn.iocoder.yudao.framework.common.validation.Mobile;
4 4 import cn.iocoder.yudao.framework.common.validation.Telephone;
  5 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.*;
5 6 import com.mzt.logapi.starter.annotation.DiffLogField;
6 7 import io.swagger.v3.oas.annotations.media.Schema;
7 8 import jakarta.validation.constraints.Email;
... ... @@ -13,9 +14,6 @@ import java.time.LocalDateTime;
13 14  
14 15 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
15 16 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
16   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTACT_BY_ID;
17   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_BY_ID;
18   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.*;
19 17  
20 18 @Schema(description = "管理后台 - CRM 联系人创建/更新 Request VO")
21 19 @Data
... ... @@ -30,11 +28,11 @@ public class CrmContactSaveReqVO {
30 28 private String name;
31 29  
32 30 @Schema(description = "客户编号", example = "10795")
33   - @DiffLogField(name = "姓名", function = GET_CUSTOMER_BY_ID)
  31 + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME)
34 32 private Long customerId;
35 33  
36 34 @Schema(description = "性别")
37   - @DiffLogField(name = "性别", function = GET_SEX)
  35 + @DiffLogField(name = "性别", function = SysSexParseFunction.NAME)
38 36 private Integer sex;
39 37  
40 38 @Schema(description = "职位")
... ... @@ -42,11 +40,11 @@ public class CrmContactSaveReqVO {
42 40 private String post;
43 41  
44 42 @Schema(description = "是否关键决策人")
45   - @DiffLogField(name = "关键决策人", function = GET_BOOLEAN)
  43 + @DiffLogField(name = "关键决策人", function = SysBooleanParseFunction.NAME)
46 44 private Boolean master;
47 45  
48 46 @Schema(description = "直属上级", example = "23457")
49   - @DiffLogField(name = "直属上级", function = GET_CONTACT_BY_ID)
  47 + @DiffLogField(name = "直属上级", function = CrmContactParseFunction.NAME)
50 48 private Long parentId;
51 49  
52 50 @Schema(description = "手机号", example = "1387171766")
... ... @@ -73,7 +71,7 @@ public class CrmContactSaveReqVO {
73 71 private String email;
74 72  
75 73 @Schema(description = "地区编号", example = "20158")
76   - @DiffLogField(name = "所在地", function = GET_AREA)
  74 + @DiffLogField(name = "所在地", function = SysAreaParseFunction.NAME)
77 75 private Integer areaId;
78 76  
79 77 @Schema(description = "地址")
... ... @@ -86,7 +84,7 @@ public class CrmContactSaveReqVO {
86 84  
87 85 @Schema(description = "负责人用户编号", example = "14334")
88 86 @NotNull(message = "负责人不能为空")
89   - @DiffLogField(name = "负责人", function = GET_ADMIN_USER_BY_ID)
  87 + @DiffLogField(name = "负责人", function = SysAdminUserParseFunction.NAME)
90 88 private Long ownerUserId;
91 89  
92 90 @Schema(description = "最后跟进时间")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
... ... @@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
5 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
6 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 7 import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
8 9 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
9 10 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
10 11 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*;
... ... @@ -53,14 +54,14 @@ public class CrmContractController {
53 54 @PostMapping("/create")
54 55 @Operation(summary = "创建合同")
55 56 @PreAuthorize("@ss.hasPermission('crm:contract:create')")
56   - public CommonResult<Long> createContract(@Valid @RequestBody CrmContractCreateReqVO createReqVO) {
  57 + public CommonResult<Long> createContract(@Valid @RequestBody CrmContractSaveReqVO createReqVO) {
57 58 return success(contractService.createContract(createReqVO, getLoginUserId()));
58 59 }
59 60  
60 61 @PutMapping("/update")
61 62 @Operation(summary = "更新合同")
62 63 @PreAuthorize("@ss.hasPermission('crm:contract:update')")
63   - public CommonResult<Boolean> updateContract(@Valid @RequestBody CrmContractUpdateReqVO updateReqVO) {
  64 + public CommonResult<Boolean> updateContract(@Valid @RequestBody CrmContractSaveReqVO updateReqVO) {
64 65 contractService.updateContract(updateReqVO);
65 66 return success(true);
66 67 }
... ... @@ -78,22 +79,22 @@ public class CrmContractController {
78 79 @Operation(summary = "获得合同")
79 80 @Parameter(name = "id", description = "编号", required = true, example = "1024")
80 81 @PreAuthorize("@ss.hasPermission('crm:contract:query')")
81   - public CommonResult<ContractRespVO> getContract(@RequestParam("id") Long id) {
  82 + public CommonResult<CrmContractRespVO> getContract(@RequestParam("id") Long id) {
82 83 CrmContractDO contract = contractService.getContract(id);
83   - return success(CrmContractConvert.INSTANCE.convert(contract));
  84 + return success(BeanUtils.toBean(contract, CrmContractRespVO.class));
84 85 }
85 86  
86 87 @GetMapping("/page")
87 88 @Operation(summary = "获得合同分页")
88 89 @PreAuthorize("@ss.hasPermission('crm:contract:query')")
89   - public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) {
  90 + public CommonResult<PageResult<CrmContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) {
90 91 PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO, getLoginUserId());
91 92 return success(buildContractDetailPage(pageResult));
92 93 }
93 94  
94 95 @GetMapping("/page-by-customer")
95 96 @Operation(summary = "获得联系人分页,基于指定客户")
96   - public CommonResult<PageResult<ContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) {
  97 + public CommonResult<PageResult<CrmContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) {
97 98 Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空");
98 99 PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO);
99 100 return success(buildContractDetailPage(pageResult));
... ... @@ -108,7 +109,7 @@ public class CrmContractController {
108 109 PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId());
109 110 // 导出 Excel
110 111 ExcelUtils.write(response, "合同.xls", "数据", CrmContractExcelVO.class,
111   - CrmContractConvert.INSTANCE.convertList02(pageResult.getList()));
  112 + BeanUtils.toBean(pageResult.getList(), CrmContractExcelVO.class));
112 113 }
113 114  
114 115 /**
... ... @@ -117,7 +118,7 @@ public class CrmContractController {
117 118 * @param pageResult 简单的合同分页结果
118 119 * @return 详细的合同分页结果
119 120 */
120   - private PageResult<ContractRespVO> buildContractDetailPage(PageResult<CrmContractDO> pageResult) {
  121 + private PageResult<CrmContractRespVO> buildContractDetailPage(PageResult<CrmContractDO> pageResult) {
121 122 List<CrmContractDO> contactList = pageResult.getList();
122 123 if (CollUtil.isEmpty(contactList)) {
123 124 return PageResult.empty(pageResult.getTotal());
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractCreateReqVO.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 lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7   -
8   -@Schema(description = "管理后台 - CRM 合同创建 Request VO")
9   -@Data
10   -@EqualsAndHashCode(callSuper = true)
11   -@ToString(callSuper = true)
12   -public class CrmContractCreateReqVO extends CrmContractBaseVO {
13   -
14   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractRespVO.java
... ... @@ -2,20 +2,65 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
5   -import lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7 5  
8 6 import java.time.LocalDateTime;
9 7  
10 8 @Schema(description = "管理后台 - CRM 合同 Response VO")
11 9 @Data
12   -@EqualsAndHashCode(callSuper = true)
13   -@ToString(callSuper = true)
14   -public class ContractRespVO extends CrmContractBaseVO {
  10 +public class CrmContractRespVO {
15 11  
16 12 @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
17 13 private Long id;
18 14  
  15 + @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
  16 + private String name;
  17 +
  18 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336")
  19 + private Long customerId;
  20 +
  21 + @Schema(description = "商机编号", example = "10864")
  22 + private Long businessId;
  23 +
  24 + @Schema(description = "工作流编号", example = "1043")
  25 + private Long processInstanceId;
  26 +
  27 + @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED)
  28 + private LocalDateTime orderDate;
  29 +
  30 + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144")
  31 + private Long ownerUserId;
  32 +
  33 + // TODO @芋艿:未来应该支持自动生成;
  34 + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101")
  35 + private String no;
  36 +
  37 + @Schema(description = "开始时间")
  38 + private LocalDateTime startTime;
  39 +
  40 + @Schema(description = "结束时间")
  41 + private LocalDateTime endTime;
  42 +
  43 + @Schema(description = "合同金额", example = "5617")
  44 + private Integer price;
  45 +
  46 + @Schema(description = "整单折扣")
  47 + private Integer discountPercent;
  48 +
  49 + @Schema(description = "产品总金额", example = "19510")
  50 + private Integer productPrice;
  51 +
  52 + @Schema(description = "联系人编号", example = "18546")
  53 + private Long contactId;
  54 +
  55 + @Schema(description = "公司签约人", example = "14036")
  56 + private Long signUserId;
  57 +
  58 + @Schema(description = "最后跟进时间")
  59 + private LocalDateTime contactLastTime;
  60 +
  61 + @Schema(description = "备注", example = "你猜")
  62 + private String remark;
  63 +
19 64 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
20 65 private LocalDateTime createTime;
21 66  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractSaveReqVO.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.contract.vo;
2 2  
  3 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmBusinessParseFunction;
  4 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmContactParseFunction;
  5 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction;
  6 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAdminUserParseFunction;
  7 +import com.mzt.logapi.starter.annotation.DiffLogField;
3 8 import io.swagger.v3.oas.annotations.media.Schema;
  9 +import jakarta.validation.constraints.NotNull;
4 10 import lombok.Data;
5 11 import org.springframework.format.annotation.DateTimeFormat;
6 12  
7   -import jakarta.validation.constraints.NotNull;
8 13 import java.time.LocalDateTime;
9 14  
10 15 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
11 16  
12   -/**
13   - * 合同 Base VO,提供给添加、修改、详细的子 VO 使用
14   - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
15   - */
  17 +@Schema(description = "管理后台 - CRM 合同创建/更新 Request VO")
16 18 @Data
17   -public class CrmContractBaseVO {
  19 +public class CrmContractSaveReqVO {
18 20  
19   - // TODO @dhb52:类似 no 字段的 example 要写xia 哈;
  21 + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
  22 + private Long id;
20 23  
21 24 @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
  25 + @DiffLogField(name = "合同名称")
22 26 @NotNull(message = "合同名称不能为空")
23 27 private String name;
24 28  
25   - // TODO @dhb52:这个必须传递
26   - @Schema(description = "客户编号", example = "18336")
  29 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336")
  30 + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME)
  31 + @NotNull(message = "客户编号不能为空")
27 32 private Long customerId;
28 33  
29 34 @Schema(description = "商机编号", example = "10864")
  35 + @DiffLogField(name = "商机", function = CrmBusinessParseFunction.NAME)
30 36 private Long businessId;
31 37  
32 38 @Schema(description = "工作流编号", example = "1043")
  39 + @DiffLogField(name = "工作流编号")
33 40 private Long processInstanceId;
34 41  
35   - // TODO @dhb52:这个必须传递
36   - @Schema(description = "下单日期")
  42 + @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED)
  43 + @DiffLogField(name = "下单日期")
37 44 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  45 + @NotNull(message = "下单日期不能为空")
38 46 private LocalDateTime orderDate;
39 47  
40   - // TODO @dhb52:这个必须传递
41   - @Schema(description = "负责人的用户编号", example = "17144")
  48 + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144")
  49 + @DiffLogField(name = "负责人", function = SysAdminUserParseFunction.NAME)
  50 + @NotNull(message = "负责人不能为空")
42 51 private Long ownerUserId;
43 52  
44 53 // TODO @芋艿:未来应该支持自动生成;
45   - // TODO @dhb52:这个必须传递;
46   - @Schema(description = "合同编号")
  54 + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101")
  55 + @DiffLogField(name = "合同编号")
  56 + @NotNull(message = "合同编号不能为空")
47 57 private String no;
48 58  
49 59 @Schema(description = "开始时间")
  60 + @DiffLogField(name = "开始时间")
50 61 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
51 62 private LocalDateTime startTime;
52 63  
53 64 @Schema(description = "结束时间")
  65 + @DiffLogField(name = "结束时间")
54 66 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
55 67 private LocalDateTime endTime;
56 68  
57 69 @Schema(description = "合同金额", example = "5617")
  70 + @DiffLogField(name = "合同金额")
58 71 private Integer price;
59 72  
60 73 @Schema(description = "整单折扣")
  74 + @DiffLogField(name = "整单折扣")
61 75 private Integer discountPercent;
62 76  
63 77 @Schema(description = "产品总金额", example = "19510")
  78 + @DiffLogField(name = "产品总金额")
64 79 private Integer productPrice;
65 80  
66 81 @Schema(description = "联系人编号", example = "18546")
  82 + @DiffLogField(name = "联系人", function = CrmContactParseFunction.NAME)
67 83 private Long contactId;
68 84  
69 85 @Schema(description = "公司签约人", example = "14036")
  86 + @DiffLogField(name = "公司签约人", function = SysAdminUserParseFunction.NAME)
70 87 private Long signUserId;
71 88  
72 89 @Schema(description = "最后跟进时间")
  90 + @DiffLogField(name = "最后跟进时间")
73 91 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
74 92 private LocalDateTime contactLastTime;
75 93  
76 94 @Schema(description = "备注", example = "你猜")
  95 + @DiffLogField(name = "备注")
77 96 private String remark;
78 97  
79 98 // TODO @dhb52:增加一个 status 字段:具体有哪些值,你来枚举下;主要页面上有个【草稿】【提交审核】的流程,可以看看。然后要对接工作流,这块也可以看看,不确定的地方问我。
80 99  
  100 +
81 101 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractUpdateReqVO.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 lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7   -
8   -import jakarta.validation.constraints.NotNull;
9   -
10   -@Schema(description = "管理后台 - CRM 合同更新 Request VO")
11   -@Data
12   -@EqualsAndHashCode(callSuper = true)
13   -@ToString(callSuper = true)
14   -public class CrmContractUpdateReqVO extends CrmContractBaseVO {
15   -
16   - @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
17   - @NotNull(message = "合同编号不能为空")
18   - private Long id;
19   -
20   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerSaveReqVO.java
... ... @@ -5,6 +5,10 @@ import cn.iocoder.yudao.framework.common.validation.Mobile;
5 5 import cn.iocoder.yudao.framework.common.validation.Telephone;
6 6 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
7 7 import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum;
  8 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerIndustryParseFunction;
  9 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerLevelParseFunction;
  10 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerSourceParseFunction;
  11 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAreaParseFunction;
8 12 import com.mzt.logapi.starter.annotation.DiffLogField;
9 13 import io.swagger.v3.oas.annotations.media.Schema;
10 14 import jakarta.validation.constraints.Email;
... ... @@ -17,8 +21,6 @@ import java.time.LocalDateTime;
17 21  
18 22 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
19 23 import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY;
20   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.*;
21   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_AREA;
22 24  
23 25 @Schema(description = "管理后台 - CRM 客户新增/修改 Request VO")
24 26 @Data
... ... @@ -33,17 +35,17 @@ public class CrmCustomerSaveReqVO {
33 35 private String name;
34 36  
35 37 @Schema(description = "所属行业", example = "1")
36   - @DiffLogField(name = "所属行业", function = GET_CUSTOMER_INDUSTRY)
  38 + @DiffLogField(name = "所属行业", function = CrmCustomerIndustryParseFunction.NAME)
37 39 @DictFormat(CRM_CUSTOMER_INDUSTRY)
38 40 private Integer industryId;
39 41  
40 42 @Schema(description = "客户等级", example = "2")
41   - @DiffLogField(name = "客户等级", function = GET_CUSTOMER_LEVEL)
  43 + @DiffLogField(name = "客户等级", function = CrmCustomerLevelParseFunction.NAME)
42 44 @InEnum(CrmCustomerLevelEnum.class)
43 45 private Integer level;
44 46  
45 47 @Schema(description = "客户来源", example = "3")
46   - @DiffLogField(name = "客户来源", function = GET_CUSTOMER_SOURCE)
  48 + @DiffLogField(name = "客户来源", function = CrmCustomerSourceParseFunction.NAME)
47 49 private Integer source;
48 50  
49 51 @Schema(description = "手机", example = "18000000000")
... ... @@ -86,7 +88,7 @@ public class CrmCustomerSaveReqVO {
86 88 private String remark;
87 89  
88 90 @Schema(description = "地区编号", example = "20158")
89   - @DiffLogField(name = "地区编号", function = GET_AREA)
  91 + @DiffLogField(name = "地区编号", function = SysAreaParseFunction.NAME)
90 92 private Integer areaId;
91 93  
92 94 @Schema(description = "详细地址", example = "北京市海淀区")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java
... ... @@ -28,6 +28,4 @@ public class CrmCustomerTransferReqVO {
28 28 @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
29 29 private Integer oldOwnerPermissionLevel;
30 30  
31   - // TODO @puhui999:联系人、商机、合同的转移
32   -
33 31 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigSaveReqVO.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig;
2 2  
  3 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAdminUserParseFunction;
  4 +import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysDeptParseFunction;
3 5 import com.mzt.logapi.starter.annotation.DiffLogField;
4 6 import io.swagger.v3.oas.annotations.media.Schema;
5 7 import jakarta.validation.constraints.NotNull;
... ... @@ -7,9 +9,6 @@ import lombok.Data;
7 9  
8 10 import java.util.List;
9 11  
10   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
11   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_DEPT_BY_ID;
12   -
13 12 @Schema(description = "管理后台 - 客户限制配置创建/更新 Request VO")
14 13 @Data
15 14 public class CrmCustomerLimitConfigSaveReqVO {
... ... @@ -23,11 +22,11 @@ public class CrmCustomerLimitConfigSaveReqVO {
23 22 private Integer type;
24 23  
25 24 @Schema(description = "规则适用人群")
26   - @DiffLogField(name = "规则适用人群", function = GET_ADMIN_USER_BY_ID)
  25 + @DiffLogField(name = "规则适用人群", function = SysAdminUserParseFunction.NAME)
27 26 private List<Long> userIds;
28 27  
29 28 @Schema(description = "规则适用部门")
30   - @DiffLogField(name = "规则适用部门", function = GET_DEPT_BY_ID)
  29 + @DiffLogField(name = "规则适用部门", function = SysDeptParseFunction.NAME)
31 30 private List<Long> deptIds;
32 31  
33 32 @Schema(description = "数量上限", requiredMode = Schema.RequiredMode.REQUIRED, example = "28384")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.followup;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4   -import cn.iocoder.yudao.framework.common.pojo.PageParam;
5 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
6 6 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7   -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
8   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
9 7 import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO;
10 8 import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordRespVO;
11 9 import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO;
  10 +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
  11 +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
12 12 import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO;
  13 +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
  14 +import cn.iocoder.yudao.module.crm.service.contact.CrmContactService;
13 15 import cn.iocoder.yudao.module.crm.service.followup.CrmFollowUpRecordService;
14 16 import io.swagger.v3.oas.annotations.Operation;
15 17 import io.swagger.v3.oas.annotations.Parameter;
16 18 import io.swagger.v3.oas.annotations.tags.Tag;
17 19 import jakarta.annotation.Resource;
18   -import jakarta.servlet.http.HttpServletResponse;
19 20 import jakarta.validation.Valid;
20 21 import org.springframework.security.access.prepost.PreAuthorize;
21 22 import org.springframework.validation.annotation.Validated;
22 23 import org.springframework.web.bind.annotation.*;
23 24  
24   -import java.io.IOException;
  25 +import java.util.ArrayList;
25 26 import java.util.List;
  27 +import java.util.Map;
  28 +import java.util.Set;
26 29  
27 30 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
28   -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  31 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
  32 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap;
29 33  
30 34  
31 35 @Tag(name = "管理后台 - 跟进记录")
... ... @@ -36,6 +40,10 @@ public class CrmFollowUpRecordController {
36 40  
37 41 @Resource
38 42 private CrmFollowUpRecordService crmFollowUpRecordService;
  43 + @Resource
  44 + private CrmContactService contactService;
  45 + @Resource
  46 + private CrmBusinessService businessService;
39 47  
40 48 @PostMapping("/create")
41 49 @Operation(summary = "创建跟进记录")
... ... @@ -75,20 +83,32 @@ public class CrmFollowUpRecordController {
75 83 @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')")
76 84 public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) {
77 85 PageResult<CrmFollowUpRecordDO> pageResult = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO);
78   - return success(BeanUtils.toBean(pageResult, CrmFollowUpRecordRespVO.class));
  86 + Set<Long> contactIds = convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream());
  87 + Set<Long> businessIds = convertSetByFlatMap(pageResult.getList(), item -> item.getBusinessIds().stream());
  88 + Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactList(contactIds), CrmContactDO::getId);
  89 + Map<Long, CrmBusinessDO> businessMap = convertMap(businessService.getBusinessList(businessIds), CrmBusinessDO::getId);
  90 + PageResult<CrmFollowUpRecordRespVO> result = BeanUtils.toBean(pageResult, CrmFollowUpRecordRespVO.class);
  91 + result.getList().forEach(item -> {
  92 + setContactNames(item, contactMap);
  93 + setBusinessNames(item, businessMap);
  94 + });
  95 + return success(result);
  96 + }
  97 +
  98 + private static void setContactNames(CrmFollowUpRecordRespVO vo, Map<Long, CrmContactDO> contactMap) {
  99 + List<String> names = new ArrayList<>();
  100 + vo.getContactIds().forEach(id -> {
  101 + MapUtils.findAndThen(contactMap, id, contactDO -> names.add(contactDO.getName()));
  102 + });
  103 + vo.setContactNames(names);
79 104 }
80 105  
81   - @GetMapping("/export-excel")
82   - @Operation(summary = "导出跟进记录 Excel")
83   - @PreAuthorize("@ss.hasPermission('crm:follow-up-record:export')")
84   - @OperateLog(type = EXPORT)
85   - public void exportFollowUpRecordExcel(@Valid CrmFollowUpRecordPageReqVO pageReqVO,
86   - HttpServletResponse response) throws IOException {
87   - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
88   - List<CrmFollowUpRecordDO> list = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO).getList();
89   - // 导出 Excel
90   - ExcelUtils.write(response, "跟进记录.xls", "数据", CrmFollowUpRecordRespVO.class,
91   - BeanUtils.toBean(list, CrmFollowUpRecordRespVO.class));
  106 + private static void setBusinessNames(CrmFollowUpRecordRespVO vo, Map<Long, CrmBusinessDO> businessMap) {
  107 + List<String> names = new ArrayList<>();
  108 + vo.getContactIds().forEach(id -> {
  109 + MapUtils.findAndThen(businessMap, id, businessDO -> names.add(businessDO.getName()));
  110 + });
  111 + vo.setBusinessNames(names);
92 112 }
93 113  
94 114 }
95 115 \ No newline at end of file
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordPageReqVO.java
... ... @@ -5,11 +5,6 @@ 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 = "管理后台 - 跟进记录分页 Request VO")
15 10 @Data
... ... @@ -23,15 +18,4 @@ public class CrmFollowUpRecordPageReqVO extends PageParam {
23 18 @Schema(description = "数据编号", example = "5564")
24 19 private Long bizId;
25 20  
26   - @Schema(description = "跟进类型", example = "2")
27   - private Integer type;
28   -
29   - @Schema(description = "下次联系时间")
30   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
31   - private LocalDateTime[] nextTime;
32   -
33   - @Schema(description = "创建时间")
34   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
35   - private LocalDateTime[] createTime;
36   -
37 21 }
38 22 \ No newline at end of file
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordRespVO.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.followup.vo;
2 2  
3 3 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
4   -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
5 4 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
6   -import com.alibaba.excel.annotation.ExcelProperty;
7 5 import io.swagger.v3.oas.annotations.media.Schema;
8 6 import lombok.Data;
9 7  
10 8 import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_FOLLOW_UP_TYPE;
11 12  
12 13 @Schema(description = "管理后台 - 跟进记录 Response VO")
13 14 @Data
... ... @@ -15,40 +16,35 @@ import java.time.LocalDateTime;
15 16 public class CrmFollowUpRecordRespVO {
16 17  
17 18 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28800")
18   - @ExcelProperty("编号")
19 19 private Long id;
20 20  
21 21 @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
22   - @ExcelProperty("数据类型")
23 22 private Integer bizType;
24 23  
25 24 @Schema(description = "数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5564")
26   - @ExcelProperty("数据编号")
27 25 private Long bizId;
28 26  
29 27 @Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
30   - @ExcelProperty(value = "跟进类型", converter = DictConvert.class)
31   - @DictFormat("crm_follow_up_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
  28 + @DictFormat(CRM_FOLLOW_UP_TYPE)
32 29 private Integer type;
33 30  
34 31 @Schema(description = "跟进内容", requiredMode = Schema.RequiredMode.REQUIRED)
35   - @ExcelProperty("跟进内容")
36 32 private String content;
37 33  
38 34 @Schema(description = "下次联系时间", requiredMode = Schema.RequiredMode.REQUIRED)
39   - @ExcelProperty("下次联系时间")
40 35 private LocalDateTime nextTime;
41 36  
42 37 @Schema(description = "关联的商机编号数组")
43   - @ExcelProperty("关联的商机编号数组")
44   - private String businessIds;
  38 + private List<Long> businessIds;
  39 + @Schema(description = "关联的商机名称数组")
  40 + private List<String> businessNames;
45 41  
46 42 @Schema(description = "关联的联系人编号数组")
47   - @ExcelProperty("关联的联系人编号数组")
48   - private String contactIds;
  43 + private List<Long> contactIds;
  44 + @Schema(description = "关联的联系人名称数组")
  45 + private List<String> contactNames;
49 46  
50 47 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
51   - @ExcelProperty("创建时间")
52 48 private LocalDateTime createTime;
53 49  
54 50 }
55 51 \ No newline at end of file
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java
... ... @@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotNull;
6 6 import lombok.Data;
7 7  
8 8 import java.time.LocalDateTime;
  9 +import java.util.List;
9 10  
10 11 @Schema(description = "管理后台 - 跟进记录新增/修改 Request VO")
11 12 @Data
... ... @@ -35,9 +36,9 @@ public class CrmFollowUpRecordSaveReqVO {
35 36 private LocalDateTime nextTime;
36 37  
37 38 @Schema(description = "关联的商机编号数组")
38   - private String businessIds;
  39 + private List<Long> businessIds;
39 40  
40 41 @Schema(description = "关联的联系人编号数组")
41   - private String contactIds;
  42 + private List<Long> contactIds;
42 43  
43 44 }
44 45 \ No newline at end of file
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
... ... @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.crm.convert.business;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO;
6 7 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
7 8 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO;
8 9 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO;
... ... @@ -27,15 +28,6 @@ public interface CrmBusinessConvert {
27 28  
28 29 CrmBusinessConvert INSTANCE = Mappers.getMapper(CrmBusinessConvert.class);
29 30  
30   - CrmBusinessDO convert(CrmBusinessCreateReqVO bean);
31   -
32   - CrmBusinessDO convert(CrmBusinessUpdateReqVO bean);
33   -
34   - CrmBusinessRespVO convert(CrmBusinessDO bean);
35   - List<CrmBusinessRespVO> convert(List<CrmBusinessDO> bean);
36   -
37   - List<CrmBusinessExcelVO> convertList02(List<CrmBusinessDO> list);
38   -
39 31 @Mapping(target = "bizId", source = "reqVO.id")
40 32 CrmPermissionTransferReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId);
41 33  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java
... ... @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatus;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusRespVO;
5   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO;
6 5 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO;
7 6 import org.mapstruct.Mapper;
8 7 import org.mapstruct.factory.Mappers;
... ... @@ -19,10 +18,6 @@ public interface CrmBusinessStatusConvert {
19 18  
20 19 CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class);
21 20  
22   - CrmBusinessStatusDO convert(CrmBusinessStatusSaveReqVO bean);
23   -
24   - CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean);
25   -
26 21 List<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list);
27 22  
28 23 PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page);
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
... ... @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatustype;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeRespVO;
5   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO;
6 5 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO;
7 6 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO;
8 7 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
... ... @@ -25,7 +24,6 @@ public interface CrmBusinessStatusTypeConvert {
25 24  
26 25 CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class);
27 26  
28   - CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeSaveReqVO bean);
29 27  
30 28 CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean);
31 29  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java
... ... @@ -4,7 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
5 5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 6 import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
7   -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
  7 +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactRespVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO;
8 9 import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
9 10 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
10 11 import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO;
... ... @@ -31,10 +32,6 @@ public interface CrmContactConvert {
31 32  
32 33 CrmContactRespVO convert(CrmContactDO bean);
33 34  
34   - List<CrmContactRespVO> convertList(List<CrmContactDO> list);
35   -
36   - PageResult<CrmContactRespVO> convertPage(PageResult<CrmContactDO> page);
37   -
38 35 @Mapping(target = "bizId", source = "reqVO.id")
39 36 CrmPermissionTransferReqBO convert(CrmContactTransferReqVO reqVO, Long userId);
40 37  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/CrmContractConvert.java
... ... @@ -2,7 +2,8 @@ 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.framework.common.util.object.BeanUtils;
5   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractRespVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
6 7 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
7 8 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
8 9 import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO;
... ... @@ -27,24 +28,12 @@ public interface CrmContractConvert {
27 28  
28 29 CrmContractConvert INSTANCE = Mappers.getMapper(CrmContractConvert.class);
29 30  
30   - CrmContractDO convert(CrmContractCreateReqVO bean);
31   -
32   - CrmContractDO convert(CrmContractUpdateReqVO bean);
33   -
34   - ContractRespVO convert(CrmContractDO bean);
35   -
36   - List<ContractRespVO> convertList(List<CrmContractDO> list);
37   -
38   - PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> page);
39   -
40   - List<CrmContractExcelVO> convertList02(List<CrmContractDO> list);
41   -
42 31 @Mapping(target = "bizId", source = "reqVO.id")
43 32 CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId);
44 33  
45   - default PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
46   - List<CrmCustomerDO> customerList) {
47   - PageResult<ContractRespVO> voPageResult = BeanUtils.toBean(pageResult, ContractRespVO.class);
  34 + default PageResult<CrmContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
  35 + List<CrmCustomerDO> customerList) {
  36 + PageResult<CrmContractRespVO> voPageResult = BeanUtils.toBean(pageResult, CrmContractRespVO.class);
48 37 // 拼接关联字段
49 38 Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId);
50 39 voPageResult.getList().forEach(contract -> {
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java
... ... @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 4 import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
5 5 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
6 6 import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
  7 +import cn.iocoder.yudao.module.crm.enums.DictTypeConstants;
7 8 import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
8 9 import com.baomidou.mybatisplus.annotation.KeySequence;
9 10 import com.baomidou.mybatisplus.annotation.TableField;
... ... @@ -14,8 +15,6 @@ import lombok.*;
14 15 import java.time.LocalDateTime;
15 16 import java.util.List;
16 17  
17   -// TODO @puhui999:界面:做成一个 list 列表,字段是 id、跟进人、跟进方式、跟进时间、跟进内容、下次联系时间、关联联系人、关联商机
18   -// TODO @puhui999:界面:记录时,弹窗,表单字段是跟进方式、跟进内容、下次联系时间、关联联系人、关联商机;其中关联联系人、关联商机,要做成对应的组件列。
19 18 /**
20 19 * 跟进记录 DO
21 20 *
... ... @@ -53,9 +52,8 @@ public class CrmFollowUpRecordDO extends BaseDO {
53 52 private Long bizId;
54 53  
55 54 /**
56   - * 跟进类型
  55 + * 跟进类型,关联字典{@link DictTypeConstants#CRM_FOLLOW_UP_TYPE}
57 56 *
58   - * TODO @puhui999:可以搞个数据字典,打电话、发短信、上门拜访、微信、邮箱、QQ
59 57 */
60 58 private Integer type;
61 59 /**
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/followup/CrmFollowUpRecordMapper.java
... ... @@ -19,9 +19,6 @@ public interface CrmFollowUpRecordMapper extends BaseMapperX&lt;CrmFollowUpRecordDO
19 19 return selectPage(reqVO, new LambdaQueryWrapperX<CrmFollowUpRecordDO>()
20 20 .eqIfPresent(CrmFollowUpRecordDO::getBizType, reqVO.getBizType())
21 21 .eqIfPresent(CrmFollowUpRecordDO::getBizId, reqVO.getBizId())
22   - .eqIfPresent(CrmFollowUpRecordDO::getType, reqVO.getType())
23   - .betweenIfPresent(CrmFollowUpRecordDO::getNextTime, reqVO.getNextTime())
24   - .betweenIfPresent(CrmFollowUpRecordDO::getCreateTime, reqVO.getCreateTime())
25 22 .orderByDesc(CrmFollowUpRecordDO::getId));
26 23 }
27 24  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmBusinessParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
  5 +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
  6 +import com.mzt.logapi.service.IParseFunction;
  7 +import jakarta.annotation.Resource;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +/**
  12 + * CRM 商机的 {@link IParseFunction} 实现类
  13 + *
  14 + * @author HUIHUI
  15 + */
  16 +@Component
  17 +@Slf4j
  18 +public class CrmBusinessParseFunction implements IParseFunction {
  19 +
  20 + public static final String NAME = "getBusinessById";
  21 +
  22 + @Resource
  23 + private CrmBusinessService businessService;
  24 +
  25 + @Override
  26 + public boolean executeBefore() {
  27 + return true; // 先转换值后对比
  28 + }
  29 +
  30 + @Override
  31 + public String functionName() {
  32 + return NAME;
  33 + }
  34 +
  35 + @Override
  36 + public String apply(Object value) {
  37 + if (StrUtil.isEmptyIfStr(value)) {
  38 + return "";
  39 + }
  40 + CrmBusinessDO businessDO = businessService.getBusiness(Long.parseLong(value.toString()));
  41 + return businessDO == null ? "" : businessDO.getName();
  42 + }
  43 +
  44 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContactParseFunction.java
... ... @@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
8 8 import lombok.extern.slf4j.Slf4j;
9 9 import org.springframework.stereotype.Component;
10 10  
11   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTACT_BY_ID;
12   -
13 11 /**
14 12 * CRM 联系人的 {@link IParseFunction} 实现类
15 13 *
... ... @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
19 17 @Slf4j
20 18 public class CrmContactParseFunction implements IParseFunction {
21 19  
  20 + public static final String NAME = "getContactById";
  21 +
22 22 @Resource
23 23 private CrmContactService contactService;
24 24  
... ... @@ -29,7 +29,7 @@ public class CrmContactParseFunction implements IParseFunction {
29 29  
30 30 @Override
31 31 public String functionName() {
32   - return GET_CONTACT_BY_ID;
  32 + return NAME;
33 33 }
34 34  
35 35 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
... ... @@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
8 8 import lombok.extern.slf4j.Slf4j;
9 9 import org.springframework.stereotype.Component;
10 10  
11   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID;
12   -
13 11 /**
14 12 * CRM 合同的 {@link IParseFunction} 实现类
15 13 *
... ... @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
19 17 @Slf4j
20 18 public class CrmContractParseFunction implements IParseFunction {
21 19  
  20 + public static final String NAME = "getContractById";
  21 +
22 22 @Resource
23 23 private CrmContractService contractService;
24 24  
... ... @@ -29,7 +29,7 @@ public class CrmContractParseFunction implements IParseFunction {
29 29  
30 30 @Override
31 31 public String functionName() {
32   - return GET_CONTRACT_BY_ID;
  32 + return NAME;
33 33 }
34 34  
35 35 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerIndustryParseFunction.java
... ... @@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
7 7 import org.springframework.stereotype.Component;
8 8  
9 9 import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY;
10   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_INDUSTRY;
11 10  
12 11 /**
13 12 * 行业的 {@link IParseFunction} 实现类
... ... @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
18 17 @Slf4j
19 18 public class CrmCustomerIndustryParseFunction implements IParseFunction {
20 19  
  20 + public static final String NAME = "getCustomerIndustry";
  21 +
21 22 @Override
22 23 public boolean executeBefore() {
23 24 return true; // 先转换值后对比
... ... @@ -25,7 +26,7 @@ public class CrmCustomerIndustryParseFunction implements IParseFunction {
25 26  
26 27 @Override
27 28 public String functionName() {
28   - return GET_CUSTOMER_INDUSTRY;
  29 + return NAME;
29 30 }
30 31  
31 32 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerLevelParseFunction.java
... ... @@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
7 7 import org.springframework.stereotype.Component;
8 8  
9 9 import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL;
10   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_LEVEL;
11 10  
12 11 /**
13 12 * 客户等级的 {@link IParseFunction} 实现类
... ... @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
18 17 @Slf4j
19 18 public class CrmCustomerLevelParseFunction implements IParseFunction {
20 19  
  20 + public static final String NAME = "getCustomerLevel";
  21 +
21 22 @Override
22 23 public boolean executeBefore() {
23 24 return true; // 先转换值后对比
... ... @@ -25,7 +26,7 @@ public class CrmCustomerLevelParseFunction implements IParseFunction {
25 26  
26 27 @Override
27 28 public String functionName() {
28   - return GET_CUSTOMER_LEVEL;
  29 + return NAME;
29 30 }
30 31  
31 32 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerParseFunction.java
... ... @@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
8 8 import lombok.extern.slf4j.Slf4j;
9 9 import org.springframework.stereotype.Component;
10 10  
11   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_BY_ID;
12   -
13 11 /**
14 12 * CRM 客户的 {@link IParseFunction} 实现类
15 13 *
... ... @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
19 17 @Slf4j
20 18 public class CrmCustomerParseFunction implements IParseFunction {
21 19  
  20 + public static final String NAME = "getCustomerById";
  21 +
22 22 @Resource
23 23 private CrmCustomerService customerService;
24 24  
... ... @@ -29,7 +29,7 @@ public class CrmCustomerParseFunction implements IParseFunction {
29 29  
30 30 @Override
31 31 public String functionName() {
32   - return GET_CUSTOMER_BY_ID;
  32 + return NAME;
33 33 }
34 34  
35 35 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerSourceParseFunction.java
... ... @@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
7 7 import org.springframework.stereotype.Component;
8 8  
9 9 import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE;
10   -import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_SOURCE;
11 10  
12 11 /**
13 12 * CRM 客户来源的 {@link IParseFunction} 实现类
... ... @@ -27,7 +26,7 @@ public class CrmCustomerSourceParseFunction implements IParseFunction {
27 26  
28 27 @Override
29 28 public String functionName() {
30   - return GET_CUSTOMER_SOURCE;
  29 + return NAME;
31 30 }
32 31  
33 32 @Override
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAdminUserParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  5 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  6 +import com.mzt.logapi.service.IParseFunction;
  7 +import jakarta.annotation.Resource;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +/**
  12 + * 管理员名字的 {@link IParseFunction} 实现类
  13 + *
  14 + * @author HUIHUI
  15 + */
  16 +@Slf4j
  17 +@Component
  18 +public class SysAdminUserParseFunction implements IParseFunction {
  19 +
  20 + public static final String NAME = "getAdminUserById";
  21 +
  22 + @Resource
  23 + private AdminUserApi adminUserApi;
  24 +
  25 + @Override
  26 + public String functionName() {
  27 + return NAME;
  28 + }
  29 +
  30 + @Override
  31 + public String apply(Object value) {
  32 + if (StrUtil.isEmptyIfStr(value)) {
  33 + return "";
  34 + }
  35 +
  36 + // 获取用户信息
  37 + AdminUserRespDTO user = adminUserApi.getUser(Long.parseLong(value.toString()));
  38 + if (user == null) {
  39 + log.warn("[apply][获取用户{{}}为空", value);
  40 + return "";
  41 + }
  42 + // 返回格式 芋道源码(13888888888)
  43 + String nickname = user.getNickname();
  44 + if (StrUtil.isEmpty(user.getMobile())) {
  45 + return nickname;
  46 + }
  47 + return StrUtil.format("{}({})", nickname, user.getMobile());
  48 + }
  49 +
  50 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAreaParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
  5 +import com.mzt.logapi.service.IParseFunction;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 地名的 {@link IParseFunction} 实现类
  11 + *
  12 + * @author HUIHUI
  13 + */
  14 +@Slf4j
  15 +@Component
  16 +public class SysAreaParseFunction implements IParseFunction {
  17 +
  18 + public static final String NAME = "getArea";
  19 +
  20 + @Override
  21 + public boolean executeBefore() {
  22 + return true; // 先转换值后对比
  23 + }
  24 +
  25 + @Override
  26 + public String functionName() {
  27 + return NAME;
  28 + }
  29 +
  30 + @Override
  31 + public String apply(Object value) {
  32 + if (StrUtil.isEmptyIfStr(value)) {
  33 + return "";
  34 + }
  35 + return AreaUtils.format(Integer.parseInt(value.toString()));
  36 + }
  37 +
  38 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysBooleanParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
  5 +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
  6 +import com.mzt.logapi.service.IParseFunction;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +/**
  11 + * 是否类型的 {@link IParseFunction} 实现类
  12 + *
  13 + * @author HUIHUI
  14 + */
  15 +@Component
  16 +@Slf4j
  17 +public class SysBooleanParseFunction implements IParseFunction {
  18 +
  19 + public static final String NAME = "getBoolean";
  20 +
  21 + @Override
  22 + public boolean executeBefore() {
  23 + return true; // 先转换值后对比
  24 + }
  25 +
  26 + @Override
  27 + public String functionName() {
  28 + return NAME;
  29 + }
  30 +
  31 + @Override
  32 + public String apply(Object value) {
  33 + if (StrUtil.isEmptyIfStr(value)) {
  34 + return "";
  35 + }
  36 + return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.BOOLEAN_STRING, value.toString());
  37 + }
  38 +
  39 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysDeptParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.module.system.api.dept.DeptApi;
  5 +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
  6 +import com.mzt.logapi.service.IParseFunction;
  7 +import jakarta.annotation.Resource;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +/**
  12 + * 管理员名字的 {@link IParseFunction} 实现类
  13 + *
  14 + * @author HUIHUI
  15 + */
  16 +@Slf4j
  17 +@Component
  18 +public class SysDeptParseFunction implements IParseFunction {
  19 +
  20 + public static final String NAME = "getDeptById";
  21 +
  22 + @Resource
  23 + private DeptApi deptApi;
  24 +
  25 + @Override
  26 + public String functionName() {
  27 + return NAME;
  28 + }
  29 +
  30 + @Override
  31 + public String apply(Object value) {
  32 + if (StrUtil.isEmptyIfStr(value)) {
  33 + return "";
  34 + }
  35 +
  36 + // 获取部门信息
  37 + DeptRespDTO dept = deptApi.getDept(Long.parseLong(value.toString()));
  38 + if (dept == null) {
  39 + log.warn("[apply][获取部门{{}}为空", value);
  40 + return "";
  41 + }
  42 + return dept.getName();
  43 + }
  44 +
  45 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysSexParseFunction.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.framework.operatelog.core;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
  5 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.mzt.logapi.service.IParseFunction;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +/**
  11 + * 行业的 {@link IParseFunction} 实现类
  12 + *
  13 + * @author HUIHUI
  14 + */
  15 +@Component
  16 +@Slf4j
  17 +public class SysSexParseFunction implements IParseFunction {
  18 +
  19 + public static final String NAME = "getSex";
  20 +
  21 + @Override
  22 + public boolean executeBefore() {
  23 + return true; // 先转换值后对比
  24 + }
  25 +
  26 + @Override
  27 + public String functionName() {
  28 + return NAME;
  29 + }
  30 +
  31 + @Override
  32 + public String apply(Object value) {
  33 + if (StrUtil.isEmptyIfStr(value)) {
  34 + return "";
  35 + }
  36 + return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.USER_SEX, value.toString());
  37 + }
  38 +
  39 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
1 1 package cn.iocoder.yudao.module.crm.service.business;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO;
5 4 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO;
6 6 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO;
7   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO;
8 7 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
9 8 import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
10 9 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
... ... @@ -27,14 +26,14 @@ public interface CrmBusinessService {
27 26 * @param userId 用户编号
28 27 * @return 编号
29 28 */
30   - Long createBusiness(@Valid CrmBusinessCreateReqVO createReqVO, Long userId);
  29 + Long createBusiness(@Valid CrmBusinessSaveReqVO createReqVO, Long userId);
31 30  
32 31 /**
33 32 * 更新商机
34 33 *
35 34 * @param updateReqVO 更新信息
36 35 */
37   - void updateBusiness(@Valid CrmBusinessUpdateReqVO updateReqVO);
  36 + void updateBusiness(@Valid CrmBusinessSaveReqVO updateReqVO);
38 37  
39 38 /**
40 39 * 删除商机
... ... @@ -60,6 +59,14 @@ public interface CrmBusinessService {
60 59 List<CrmBusinessDO> getBusinessList(Collection<Long> ids, Long userId);
61 60  
62 61 /**
  62 + * 获得商机列表
  63 + *
  64 + * @param ids 编号
  65 + * @return 商机列表
  66 + */
  67 + List<CrmBusinessDO> getBusinessList(Collection<Long> ids);
  68 +
  69 + /**
63 70 * 获得商机分页
64 71 *
65 72 * 数据权限:基于 {@link CrmBusinessDO}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
... ... @@ -4,10 +4,9 @@ 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 6 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO;
8 7 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO;
9 9 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO;
10   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO;
11 10 import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert;
12 11 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
13 12 import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO;
... ... @@ -55,9 +54,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
55 54 @Transactional(rollbackFor = Exception.class)
56 55 @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_CREATE_SUB_TYPE, bizNo = "{{#business.id}}",
57 56 success = CRM_BUSINESS_CREATE_SUCCESS)
58   - public Long createBusiness(CrmBusinessCreateReqVO createReqVO, Long userId) {
  57 + public Long createBusiness(CrmBusinessSaveReqVO createReqVO, Long userId) {
  58 + createReqVO.setId(null);
59 59 // 1. 插入商机
60   - CrmBusinessDO business = CrmBusinessConvert.INSTANCE.convert(createReqVO);
  60 + CrmBusinessDO business = BeanUtils.toBean(createReqVO, CrmBusinessDO.class)
  61 + .setOwnerUserId(userId);
61 62 businessMapper.insert(business);
62 63 // TODO 商机待定:插入商机与产品的关联表;校验商品存在
63 64  
... ... @@ -77,18 +78,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
77 78 @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
78 79 success = CRM_BUSINESS_UPDATE_SUCCESS)
79 80 @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
80   - public void updateBusiness(CrmBusinessUpdateReqVO updateReqVO) {
  81 + public void updateBusiness(CrmBusinessSaveReqVO updateReqVO) {
81 82 // 1. 校验存在
82 83 CrmBusinessDO oldBusiness = validateBusinessExists(updateReqVO.getId());
83 84  
84 85 // 2. 更新商机
85   - CrmBusinessDO updateObj = CrmBusinessConvert.INSTANCE.convert(updateReqVO);
  86 + CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class);
86 87 businessMapper.updateById(updateObj);
87 88 // TODO 商机待定:插入商机与产品的关联表;校验商品存在
88 89  
89 90 // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表
90 91 // 3. 记录操作日志上下文
91   - LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldBusiness, CrmBusinessUpdateReqVO.class));
  92 + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldBusiness, CrmBusinessSaveReqVO.class));
92 93 LogRecordContext.putVariable("businessName", oldBusiness.getName());
93 94 }
94 95  
... ... @@ -156,6 +157,14 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
156 157 }
157 158  
158 159 @Override
  160 + public List<CrmBusinessDO> getBusinessList(Collection<Long> ids) {
  161 + if (CollUtil.isEmpty(ids)) {
  162 + return ListUtil.empty();
  163 + }
  164 + return businessMapper.selectBatchIds(ids);
  165 + }
  166 +
  167 + @Override
159 168 public PageResult<CrmBusinessDO> getBusinessPage(CrmBusinessPageReqVO pageReqVO, Long userId) {
160 169 return businessMapper.selectPage(pageReqVO, userId);
161 170 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
... ... @@ -77,6 +77,14 @@ public interface CrmContactService {
77 77 /**
78 78 * 获得联系人列表
79 79 *
  80 + * @param ids 编号
  81 + * @return 联系人列表
  82 + */
  83 + List<CrmContactDO> getContactList(Collection<Long> ids);
  84 +
  85 + /**
  86 + * 获得联系人列表
  87 + *
80 88 * @return 联系人列表
81 89 */
82 90 List<CrmContactDO> getContactList();
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
... ... @@ -68,6 +68,7 @@ public class CrmContactServiceImpl implements CrmContactService {
68 68 @LogRecord(type = CRM_CONTACT_TYPE, subType = CRM_CONTACT_CREATE_SUB_TYPE, bizNo = "{{#contact.id}}",
69 69 success = CRM_CONTACT_CREATE_SUCCESS)
70 70 public Long createContact(CrmContactSaveReqVO createReqVO, Long userId) {
  71 + createReqVO.setId(null);
71 72 // 1. 校验
72 73 validateRelationDataExists(createReqVO);
73 74  
... ... @@ -208,6 +209,14 @@ public class CrmContactServiceImpl implements CrmContactService {
208 209 }
209 210  
210 211 @Override
  212 + public List<CrmContactDO> getContactList(Collection<Long> ids) {
  213 + if (CollUtil.isEmpty(ids)) {
  214 + return ListUtil.empty();
  215 + }
  216 + return contactMapper.selectBatchIds(ids);
  217 + }
  218 +
  219 + @Override
211 220 public List<CrmContactDO> getContactList() {
212 221 return contactMapper.selectList();
213 222 }
... ...
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.CrmContractCreateReqVO;
5 4 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
6 6 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
7   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO;
8 7 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
9 8 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
10 9 import jakarta.validation.Valid;
... ... @@ -26,14 +25,14 @@ public interface CrmContractService {
26 25 * @param userId 用户编号
27 26 * @return 编号
28 27 */
29   - Long createContract(@Valid CrmContractCreateReqVO createReqVO, Long userId);
  28 + Long createContract(@Valid CrmContractSaveReqVO createReqVO, Long userId);
30 29  
31 30 /**
32 31 * 更新合同
33 32 *
34 33 * @param updateReqVO 更新信息
35 34 */
36   - void updateContract(@Valid CrmContractUpdateReqVO updateReqVO);
  35 + void updateContract(@Valid CrmContractSaveReqVO updateReqVO);
37 36  
38 37 /**
39 38 * 删除合同
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
... ... @@ -4,10 +4,9 @@ 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 6 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO;
8 7 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
9 9 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
10   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO;
11 10 import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert;
12 11 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
13 12 import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper;
... ... @@ -50,10 +49,11 @@ public class CrmContractServiceImpl implements CrmContractService {
50 49 @Transactional(rollbackFor = Exception.class)
51 50 @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_CREATE_SUB_TYPE, bizNo = "{{#contract.id}}",
52 51 success = CRM_CONTRACT_CREATE_SUCCESS)
53   - public Long createContract(CrmContractCreateReqVO createReqVO, Long userId) {
  52 + public Long createContract(CrmContractSaveReqVO createReqVO, Long userId) {
  53 + createReqVO.setId(null);
54 54 // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO
55 55 // 插入合同
56   - CrmContractDO contract = CrmContractConvert.INSTANCE.convert(createReqVO);
  56 + CrmContractDO contract = BeanUtils.toBean(createReqVO, CrmContractDO.class);
57 57 contractMapper.insert(contract);
58 58  
59 59 // 创建数据权限
... ... @@ -71,17 +71,17 @@ public class CrmContractServiceImpl implements CrmContractService {
71 71 @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
72 72 success = CRM_CONTRACT_UPDATE_SUCCESS)
73 73 @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
74   - public void updateContract(CrmContractUpdateReqVO updateReqVO) {
  74 + public void updateContract(CrmContractSaveReqVO updateReqVO) {
75 75 // TODO @合同待定:只有草稿、审批中,可以编辑;
76 76 // 校验存在
77 77 CrmContractDO oldContract = validateContractExists(updateReqVO.getId());
78 78 // 更新合同
79   - CrmContractDO updateObj = CrmContractConvert.INSTANCE.convert(updateReqVO);
  79 + CrmContractDO updateObj = BeanUtils.toBean(updateReqVO, CrmContractDO.class);
80 80 contractMapper.updateById(updateObj);
81 81 // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO
82 82  
83 83 // 3. 记录操作日志上下文
84   - LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldContract, CrmContractUpdateReqVO.class));
  84 + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldContract, CrmContractSaveReqVO.class));
85 85 LogRecordContext.putVariable("contractName", oldContract.getName());
86 86 }
87 87  
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
1 1 package cn.iocoder.yudao.module.crm.service.business;
2 2  
3 3 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
4   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO;
5   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO;
  4 +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO;
6 5 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
7 6 import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper;
  7 +import jakarta.annotation.Resource;
8 8 import org.junit.jupiter.api.Disabled;
9 9 import org.junit.jupiter.api.Test;
10 10 import org.springframework.context.annotation.Import;
11 11  
12   -import jakarta.annotation.Resource;
13   -
14 12 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
15 13 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
16 14 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
... ... @@ -39,7 +37,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest {
39 37 @Test
40 38 public void testCreateBusiness_success() {
41 39 // 准备参数
42   - CrmBusinessCreateReqVO reqVO = randomPojo(CrmBusinessCreateReqVO.class);
  40 + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class);
43 41  
44 42 // 调用
45 43 Long businessId = businessService.createBusiness(reqVO, getLoginUserId());
... ... @@ -56,7 +54,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest {
56 54 CrmBusinessDO dbBusiness = randomPojo(CrmBusinessDO.class);
57 55 businessMapper.insert(dbBusiness);// @Sql: 先插入出一条存在的数据
58 56 // 准备参数
59   - CrmBusinessUpdateReqVO reqVO = randomPojo(CrmBusinessUpdateReqVO.class, o -> {
  57 + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class, o -> {
60 58 o.setId(dbBusiness.getId()); // 设置更新的 ID
61 59 });
62 60  
... ... @@ -70,7 +68,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest {
70 68 @Test
71 69 public void testUpdateBusiness_notExists() {
72 70 // 准备参数
73   - CrmBusinessUpdateReqVO reqVO = randomPojo(CrmBusinessUpdateReqVO.class);
  71 + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class);
74 72  
75 73 // 调用, 并断言异常
76 74 assertServiceException(() -> businessService.updateBusiness(reqVO), BUSINESS_NOT_EXISTS);
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImplTest.java
... ... @@ -2,9 +2,8 @@ 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.CrmContractCreateReqVO;
6 5 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
7   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
8 7 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
9 8 import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper;
10 9 import jakarta.annotation.Resource;
... ... @@ -38,7 +37,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
38 37 @Test
39 38 public void testCreateContract_success() {
40 39 // 准备参数
41   - CrmContractCreateReqVO reqVO = randomPojo(CrmContractCreateReqVO.class);
  40 + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class);
42 41  
43 42 // 调用
44 43 Long contractId = contractService.createContract(reqVO, getLoginUserId());
... ... @@ -55,7 +54,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
55 54 CrmContractDO dbContract = randomPojo(CrmContractDO.class);
56 55 contractMapper.insert(dbContract);// @Sql: 先插入出一条存在的数据
57 56 // 准备参数
58   - CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class, o -> {
  57 + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class, o -> {
59 58 o.setId(dbContract.getId()); // 设置更新的 ID
60 59 });
61 60  
... ... @@ -69,7 +68,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
69 68 @Test
70 69 public void testUpdateContract_notExists() {
71 70 // 准备参数
72   - CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class);
  71 + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class);
73 72  
74 73 // 调用, 并断言异常
75 74 assertServiceException(() -> contractService.updateContract(reqVO), CONTRACT_NOT_EXISTS);
... ...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/operatelog/SysParseFunctionNameConstants.java deleted
1   -package cn.iocoder.yudao.module.system.enums.operatelog;
2   -
3   -/**
4   - * functionName 常量枚举
5   - * 方便别的模块调用
6   - *
7   - * @author HUIHUI
8   - */
9   -// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈
10   -public interface SysParseFunctionNameConstants {
11   -
12   - String GET_ADMIN_USER_BY_ID = "getAdminUserById"; // 获取用户信息
13   - String GET_DEPT_BY_ID = "getDeptById"; // 获取部门信息
14   - String GET_AREA = "getArea"; // 获取区域信息
15   - String GET_SEX = "getSex"; // 获取性别
16   - String GET_BOOLEAN = "getBoolean"; // 获取是否
17   -
18   -}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/operatelog/core/AdminUserParseFunction.java
... ... @@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
8 8 import lombok.extern.slf4j.Slf4j;
9 9 import org.springframework.stereotype.Component;
10 10  
11   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
12   -
13 11 /**
14 12 * 管理员名字的 {@link IParseFunction} 实现类
15 13 *
... ... @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
19 17 @Component
20 18 public class AdminUserParseFunction implements IParseFunction {
21 19  
  20 + public static final String NAME = "getAdminUserById";
  21 +
22 22 @Resource
23 23 private AdminUserApi adminUserApi;
24 24  
25 25 @Override
26 26 public String functionName() {
27   - return GET_ADMIN_USER_BY_ID;
  27 + return NAME;
28 28 }
29 29  
30 30 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/operatelog/core/AreaParseFunction.java
... ... @@ -6,8 +6,6 @@ import com.mzt.logapi.service.IParseFunction;
6 6 import lombok.extern.slf4j.Slf4j;
7 7 import org.springframework.stereotype.Component;
8 8  
9   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_AREA;
10   -
11 9 /**
12 10 * 地名的 {@link IParseFunction} 实现类
13 11 *
... ... @@ -17,6 +15,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
17 15 @Component
18 16 public class AreaParseFunction implements IParseFunction {
19 17  
  18 + public static final String NAME = "getArea";
  19 +
20 20 @Override
21 21 public boolean executeBefore() {
22 22 return true; // 先转换值后对比
... ... @@ -24,7 +24,7 @@ public class AreaParseFunction implements IParseFunction {
24 24  
25 25 @Override
26 26 public String functionName() {
27   - return GET_AREA;
  27 + return NAME;
28 28 }
29 29  
30 30 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/operatelog/core/BooleanParseFunction.java
... ... @@ -7,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction;
7 7 import lombok.extern.slf4j.Slf4j;
8 8 import org.springframework.stereotype.Component;
9 9  
10   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_BOOLEAN;
11   -
12 10 /**
13 11 * 是否类型的 {@link IParseFunction} 实现类
14 12 *
... ... @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
18 16 @Slf4j
19 17 public class BooleanParseFunction implements IParseFunction {
20 18  
  19 + public static final String NAME = "getBoolean";
  20 +
21 21 @Override
22 22 public boolean executeBefore() {
23 23 return true; // 先转换值后对比
... ... @@ -25,7 +25,7 @@ public class BooleanParseFunction implements IParseFunction {
25 25  
26 26 @Override
27 27 public String functionName() {
28   - return GET_BOOLEAN;
  28 + return NAME;
29 29 }
30 30  
31 31 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/operatelog/core/DeptParseFunction.java
... ... @@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
8 8 import lombok.extern.slf4j.Slf4j;
9 9 import org.springframework.stereotype.Component;
10 10  
11   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_DEPT_BY_ID;
12   -
13 11 /**
14 12 * 管理员名字的 {@link IParseFunction} 实现类
15 13 *
... ... @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
19 17 @Component
20 18 public class DeptParseFunction implements IParseFunction {
21 19  
  20 + public static final String NAME = "getDeptById";
  21 +
22 22 @Resource
23 23 private DeptApi deptApi;
24 24  
25 25 @Override
26 26 public String functionName() {
27   - return GET_DEPT_BY_ID;
  27 + return NAME;
28 28 }
29 29  
30 30 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/operatelog/core/SexParseFunction.java
... ... @@ -7,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction;
7 7 import lombok.extern.slf4j.Slf4j;
8 8 import org.springframework.stereotype.Component;
9 9  
10   -import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_SEX;
11   -
12 10 /**
13 11 * 行业的 {@link IParseFunction} 实现类
14 12 *
... ... @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
18 16 @Slf4j
19 17 public class SexParseFunction implements IParseFunction {
20 18  
  19 + public static final String NAME = "getSex";
  20 +
21 21 @Override
22 22 public boolean executeBefore() {
23 23 return true; // 先转换值后对比
... ... @@ -25,7 +25,7 @@ public class SexParseFunction implements IParseFunction {
25 25  
26 26 @Override
27 27 public String functionName() {
28   - return GET_SEX;
  28 + return NAME;
29 29 }
30 30  
31 31 @Override
... ...