Commit eaa8e4be964564e0106e3e26edf99529e067ce01
1 parent
1b87b8a4
操作日志字段解析方法调整
Showing
25 changed files
with
289 additions
and
108 deletions
yudao-module-crm/yudao-module-crm-api/pom.xml
| @@ -28,13 +28,6 @@ | @@ -28,13 +28,6 @@ | ||
| 28 | <artifactId>spring-boot-starter-validation</artifactId> | 28 | <artifactId>spring-boot-starter-validation</artifactId> |
| 29 | <optional>true</optional> | 29 | <optional>true</optional> |
| 30 | </dependency> | 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 | </dependencies> | 31 | </dependencies> |
| 39 | 32 | ||
| 40 | </project> | 33 | </project> |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java
| 1 | package cn.iocoder.yudao.module.crm.enums; | 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 | * CRM 操作日志枚举 | 4 | * CRM 操作日志枚举 |
| 8 | * 目的:统一管理,也减少 Service 里各种“复杂”字符串 | 5 | * 目的:统一管理,也减少 Service 里各种“复杂”字符串 |
| @@ -25,7 +22,7 @@ public interface LogRecordConstants { | @@ -25,7 +22,7 @@ public interface LogRecordConstants { | ||
| 25 | String CRM_CUSTOMER_DELETE_SUB_TYPE = "删除客户"; | 22 | String CRM_CUSTOMER_DELETE_SUB_TYPE = "删除客户"; |
| 26 | String CRM_CUSTOMER_DELETE_SUCCESS = "删除了客户【{{#customerName}}】"; | 23 | String CRM_CUSTOMER_DELETE_SUCCESS = "删除了客户【{{#customerName}}】"; |
| 27 | String CRM_CUSTOMER_TRANSFER_SUB_TYPE = "转移客户"; | 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 | String CRM_CUSTOMER_LOCK_SUB_TYPE = "{{#customer.lockStatus ? '解锁客户' : '锁定客户'}}"; | 26 | String CRM_CUSTOMER_LOCK_SUB_TYPE = "{{#customer.lockStatus ? '解锁客户' : '锁定客户'}}"; |
| 30 | String CRM_CUSTOMER_LOCK_SUCCESS = "{{#customer.lockStatus ? '将客户【' + #customer.name + '】解锁' : '将客户【' + #customer.name + '】锁定'}}"; | 27 | String CRM_CUSTOMER_LOCK_SUCCESS = "{{#customer.lockStatus ? '将客户【' + #customer.name + '】解锁' : '将客户【' + #customer.name + '】锁定'}}"; |
| 31 | String CRM_CUSTOMER_POOL_SUB_TYPE = "客户放入公海"; | 28 | String CRM_CUSTOMER_POOL_SUB_TYPE = "客户放入公海"; |
| @@ -59,7 +56,7 @@ public interface LogRecordConstants { | @@ -59,7 +56,7 @@ public interface LogRecordConstants { | ||
| 59 | String CRM_CONTACT_DELETE_SUB_TYPE = "删除联系人"; | 56 | String CRM_CONTACT_DELETE_SUB_TYPE = "删除联系人"; |
| 60 | String CRM_CONTACT_DELETE_SUCCESS = "删除了联系人【{{#contactName}}】"; | 57 | String CRM_CONTACT_DELETE_SUCCESS = "删除了联系人【{{#contactName}}】"; |
| 61 | String CRM_CONTACT_TRANSFER_SUB_TYPE = "转移联系人"; | 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 | // ======================= CRM_BUSINESS 商机 ======================= | 61 | // ======================= CRM_BUSINESS 商机 ======================= |
| 65 | 62 | ||
| @@ -71,7 +68,7 @@ public interface LogRecordConstants { | @@ -71,7 +68,7 @@ public interface LogRecordConstants { | ||
| 71 | String CRM_BUSINESS_DELETE_SUB_TYPE = "删除商机"; | 68 | String CRM_BUSINESS_DELETE_SUB_TYPE = "删除商机"; |
| 72 | String CRM_BUSINESS_DELETE_SUCCESS = "删除了商机【{{#businessName}}】"; | 69 | String CRM_BUSINESS_DELETE_SUCCESS = "删除了商机【{{#businessName}}】"; |
| 73 | String CRM_BUSINESS_TRANSFER_SUB_TYPE = "转移商机"; | 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 | // ======================= CRM_CONTRACT 合同 ======================= | 73 | // ======================= CRM_CONTRACT 合同 ======================= |
| 77 | 74 | ||
| @@ -83,7 +80,7 @@ public interface LogRecordConstants { | @@ -83,7 +80,7 @@ public interface LogRecordConstants { | ||
| 83 | String CRM_CONTRACT_DELETE_SUB_TYPE = "删除合同"; | 80 | String CRM_CONTRACT_DELETE_SUB_TYPE = "删除合同"; |
| 84 | String CRM_CONTRACT_DELETE_SUCCESS = "删除了合同【{{#contractName}}】"; | 81 | String CRM_CONTRACT_DELETE_SUCCESS = "删除了合同【{{#contractName}}】"; |
| 85 | String CRM_CONTRACT_TRANSFER_SUB_TYPE = "转移合同"; | 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 | // ======================= CRM_PRODUCT 产品 ======================= | 85 | // ======================= CRM_PRODUCT 产品 ======================= |
| 89 | 86 | ||
| @@ -109,20 +106,20 @@ public interface LogRecordConstants { | @@ -109,20 +106,20 @@ public interface LogRecordConstants { | ||
| 109 | 106 | ||
| 110 | String CRM_RECEIVABLE_TYPE = "CRM 回款"; | 107 | String CRM_RECEIVABLE_TYPE = "CRM 回款"; |
| 111 | String CRM_RECEIVABLE_CREATE_SUB_TYPE = "创建回款"; | 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 | String CRM_RECEIVABLE_UPDATE_SUB_TYPE = "更新回款"; | 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 | String CRM_RECEIVABLE_DELETE_SUB_TYPE = "删除回款"; | 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 | // ======================= CRM_RECEIVABLE_PLAN 回款计划 ======================= | 115 | // ======================= CRM_RECEIVABLE_PLAN 回款计划 ======================= |
| 119 | 116 | ||
| 120 | String CRM_RECEIVABLE_PLAN_TYPE = "CRM 回款计划"; | 117 | String CRM_RECEIVABLE_PLAN_TYPE = "CRM 回款计划"; |
| 121 | String CRM_RECEIVABLE_PLAN_CREATE_SUB_TYPE = "创建回款计划"; | 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 | String CRM_RECEIVABLE_PLAN_UPDATE_SUB_TYPE = "更新回款计划"; | 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 | String CRM_RECEIVABLE_PLAN_DELETE_SUB_TYPE = "删除回款计划"; | 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 | \ No newline at end of file | 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,6 +3,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.business; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.business; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 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.*; |
| @@ -85,6 +86,14 @@ public class CrmBusinessController { | @@ -85,6 +86,14 @@ public class CrmBusinessController { | ||
| 85 | return success(CrmBusinessConvert.INSTANCE.convert(business)); | 86 | return success(CrmBusinessConvert.INSTANCE.convert(business)); |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 89 | + @GetMapping("/list-by-ids") | ||
| 90 | + @Operation(summary = "获得商机列表") | ||
| 91 | + @Parameter(name = "ids", description = "编号", required = true, example = "[1024]") | ||
| 92 | + @PreAuthorize("@ss.hasPermission('crm:business:query')") | ||
| 93 | + public CommonResult<List<CrmBusinessRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) { | ||
| 94 | + return success(BeanUtils.toBean(businessService.getBusinessList(ids, getLoginUserId()), CrmBusinessRespVO.class)); | ||
| 95 | + } | ||
| 96 | + | ||
| 88 | @GetMapping("/page") | 97 | @GetMapping("/page") |
| 89 | @Operation(summary = "获得商机分页") | 98 | @Operation(summary = "获得商机分页") |
| 90 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 99 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| @@ -113,6 +113,14 @@ public class CrmContactController { | @@ -113,6 +113,14 @@ public class CrmContactController { | ||
| 113 | return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList)); | 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 | @GetMapping("/simple-all-list") | 124 | @GetMapping("/simple-all-list") |
| 117 | @Operation(summary = "获得联系人的精简列表") | 125 | @Operation(summary = "获得联系人的精简列表") |
| 118 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") | 126 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| @@ -153,7 +161,7 @@ public class CrmContactController { | @@ -153,7 +161,7 @@ public class CrmContactController { | ||
| 153 | @GetMapping("/operate-log-page") | 161 | @GetMapping("/operate-log-page") |
| 154 | @Operation(summary = "获得客户操作日志") | 162 | @Operation(summary = "获得客户操作日志") |
| 155 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") | 163 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") |
| 156 | - public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId")Long bizId) { | 164 | + public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId") Long bizId) { |
| 157 | OperateLogV2PageReqDTO reqVO = new OperateLogV2PageReqDTO(); | 165 | OperateLogV2PageReqDTO reqVO = new OperateLogV2PageReqDTO(); |
| 158 | reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | 166 | reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 |
| 159 | reqVO.setBizType(CRM_CONTACT_TYPE); | 167 | 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,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.validation.Mobile; | 3 | import cn.iocoder.yudao.framework.common.validation.Mobile; |
| 4 | import cn.iocoder.yudao.framework.common.validation.Telephone; | 4 | import cn.iocoder.yudao.framework.common.validation.Telephone; |
| 5 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.*; | ||
| 5 | import com.mzt.logapi.starter.annotation.DiffLogField; | 6 | import com.mzt.logapi.starter.annotation.DiffLogField; |
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | import jakarta.validation.constraints.Email; | 8 | import jakarta.validation.constraints.Email; |
| @@ -13,9 +14,6 @@ import java.time.LocalDateTime; | @@ -13,9 +14,6 @@ import java.time.LocalDateTime; | ||
| 13 | 14 | ||
| 14 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | 15 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| 15 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 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 | @Schema(description = "管理后台 - CRM 联系人创建/更新 Request VO") | 18 | @Schema(description = "管理后台 - CRM 联系人创建/更新 Request VO") |
| 21 | @Data | 19 | @Data |
| @@ -30,11 +28,11 @@ public class CrmContactSaveReqVO { | @@ -30,11 +28,11 @@ public class CrmContactSaveReqVO { | ||
| 30 | private String name; | 28 | private String name; |
| 31 | 29 | ||
| 32 | @Schema(description = "客户编号", example = "10795") | 30 | @Schema(description = "客户编号", example = "10795") |
| 33 | - @DiffLogField(name = "姓名", function = GET_CUSTOMER_BY_ID) | 31 | + @DiffLogField(name = "姓名", function = CrmCustomerParseFunction.NAME) |
| 34 | private Long customerId; | 32 | private Long customerId; |
| 35 | 33 | ||
| 36 | @Schema(description = "性别") | 34 | @Schema(description = "性别") |
| 37 | - @DiffLogField(name = "性别", function = GET_SEX) | 35 | + @DiffLogField(name = "性别", function = SysSexParseFunction.NAME) |
| 38 | private Integer sex; | 36 | private Integer sex; |
| 39 | 37 | ||
| 40 | @Schema(description = "职位") | 38 | @Schema(description = "职位") |
| @@ -42,11 +40,11 @@ public class CrmContactSaveReqVO { | @@ -42,11 +40,11 @@ public class CrmContactSaveReqVO { | ||
| 42 | private String post; | 40 | private String post; |
| 43 | 41 | ||
| 44 | @Schema(description = "是否关键决策人") | 42 | @Schema(description = "是否关键决策人") |
| 45 | - @DiffLogField(name = "关键决策人", function = GET_BOOLEAN) | 43 | + @DiffLogField(name = "关键决策人", function = SysBooleanParseFunction.NAME) |
| 46 | private Boolean master; | 44 | private Boolean master; |
| 47 | 45 | ||
| 48 | @Schema(description = "直属上级", example = "23457") | 46 | @Schema(description = "直属上级", example = "23457") |
| 49 | - @DiffLogField(name = "直属上级", function = GET_CONTACT_BY_ID) | 47 | + @DiffLogField(name = "直属上级", function = CrmContactParseFunction.NAME) |
| 50 | private Long parentId; | 48 | private Long parentId; |
| 51 | 49 | ||
| 52 | @Schema(description = "手机号", example = "1387171766") | 50 | @Schema(description = "手机号", example = "1387171766") |
| @@ -73,7 +71,7 @@ public class CrmContactSaveReqVO { | @@ -73,7 +71,7 @@ public class CrmContactSaveReqVO { | ||
| 73 | private String email; | 71 | private String email; |
| 74 | 72 | ||
| 75 | @Schema(description = "地区编号", example = "20158") | 73 | @Schema(description = "地区编号", example = "20158") |
| 76 | - @DiffLogField(name = "所在地", function = GET_AREA) | 74 | + @DiffLogField(name = "所在地", function = SysAreaParseFunction.NAME) |
| 77 | private Integer areaId; | 75 | private Integer areaId; |
| 78 | 76 | ||
| 79 | @Schema(description = "地址") | 77 | @Schema(description = "地址") |
| @@ -86,7 +84,7 @@ public class CrmContactSaveReqVO { | @@ -86,7 +84,7 @@ public class CrmContactSaveReqVO { | ||
| 86 | 84 | ||
| 87 | @Schema(description = "负责人用户编号", example = "14334") | 85 | @Schema(description = "负责人用户编号", example = "14334") |
| 88 | @NotNull(message = "负责人不能为空") | 86 | @NotNull(message = "负责人不能为空") |
| 89 | - @DiffLogField(name = "负责人", function = GET_ADMIN_USER_BY_ID) | 87 | + @DiffLogField(name = "负责人", function = SysAdminUserParseFunction.NAME) |
| 90 | private Long ownerUserId; | 88 | private Long ownerUserId; |
| 91 | 89 | ||
| 92 | @Schema(description = "最后跟进时间") | 90 | @Schema(description = "最后跟进时间") |
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,6 +5,10 @@ import cn.iocoder.yudao.framework.common.validation.Mobile; | ||
| 5 | import cn.iocoder.yudao.framework.common.validation.Telephone; | 5 | import cn.iocoder.yudao.framework.common.validation.Telephone; |
| 6 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 6 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 7 | import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum; | 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 | import com.mzt.logapi.starter.annotation.DiffLogField; | 12 | import com.mzt.logapi.starter.annotation.DiffLogField; |
| 9 | import io.swagger.v3.oas.annotations.media.Schema; | 13 | import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | import jakarta.validation.constraints.Email; | 14 | import jakarta.validation.constraints.Email; |
| @@ -17,8 +21,6 @@ import java.time.LocalDateTime; | @@ -17,8 +21,6 @@ import java.time.LocalDateTime; | ||
| 17 | 21 | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 22 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 19 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; | 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 | @Schema(description = "管理后台 - CRM 客户新增/修改 Request VO") | 25 | @Schema(description = "管理后台 - CRM 客户新增/修改 Request VO") |
| 24 | @Data | 26 | @Data |
| @@ -33,17 +35,17 @@ public class CrmCustomerSaveReqVO { | @@ -33,17 +35,17 @@ public class CrmCustomerSaveReqVO { | ||
| 33 | private String name; | 35 | private String name; |
| 34 | 36 | ||
| 35 | @Schema(description = "所属行业", example = "1") | 37 | @Schema(description = "所属行业", example = "1") |
| 36 | - @DiffLogField(name = "所属行业", function = GET_CUSTOMER_INDUSTRY) | 38 | + @DiffLogField(name = "所属行业", function = CrmCustomerIndustryParseFunction.NAME) |
| 37 | @DictFormat(CRM_CUSTOMER_INDUSTRY) | 39 | @DictFormat(CRM_CUSTOMER_INDUSTRY) |
| 38 | private Integer industryId; | 40 | private Integer industryId; |
| 39 | 41 | ||
| 40 | @Schema(description = "客户等级", example = "2") | 42 | @Schema(description = "客户等级", example = "2") |
| 41 | - @DiffLogField(name = "客户等级", function = GET_CUSTOMER_LEVEL) | 43 | + @DiffLogField(name = "客户等级", function = CrmCustomerLevelParseFunction.NAME) |
| 42 | @InEnum(CrmCustomerLevelEnum.class) | 44 | @InEnum(CrmCustomerLevelEnum.class) |
| 43 | private Integer level; | 45 | private Integer level; |
| 44 | 46 | ||
| 45 | @Schema(description = "客户来源", example = "3") | 47 | @Schema(description = "客户来源", example = "3") |
| 46 | - @DiffLogField(name = "客户来源", function = GET_CUSTOMER_SOURCE) | 48 | + @DiffLogField(name = "客户来源", function = CrmCustomerSourceParseFunction.NAME) |
| 47 | private Integer source; | 49 | private Integer source; |
| 48 | 50 | ||
| 49 | @Schema(description = "手机", example = "18000000000") | 51 | @Schema(description = "手机", example = "18000000000") |
| @@ -86,7 +88,7 @@ public class CrmCustomerSaveReqVO { | @@ -86,7 +88,7 @@ public class CrmCustomerSaveReqVO { | ||
| 86 | private String remark; | 88 | private String remark; |
| 87 | 89 | ||
| 88 | @Schema(description = "地区编号", example = "20158") | 90 | @Schema(description = "地区编号", example = "20158") |
| 89 | - @DiffLogField(name = "地区编号", function = GET_AREA) | 91 | + @DiffLogField(name = "地区编号", function = SysAreaParseFunction.NAME) |
| 90 | private Integer areaId; | 92 | private Integer areaId; |
| 91 | 93 | ||
| 92 | @Schema(description = "详细地址", example = "北京市海淀区") | 94 | @Schema(description = "详细地址", example = "北京市海淀区") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig; | 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 | import com.mzt.logapi.starter.annotation.DiffLogField; | 5 | import com.mzt.logapi.starter.annotation.DiffLogField; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import jakarta.validation.constraints.NotNull; | 7 | import jakarta.validation.constraints.NotNull; |
| @@ -7,9 +9,6 @@ import lombok.Data; | @@ -7,9 +9,6 @@ import lombok.Data; | ||
| 7 | 9 | ||
| 8 | import java.util.List; | 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 | @Schema(description = "管理后台 - 客户限制配置创建/更新 Request VO") | 12 | @Schema(description = "管理后台 - 客户限制配置创建/更新 Request VO") |
| 14 | @Data | 13 | @Data |
| 15 | public class CrmCustomerLimitConfigSaveReqVO { | 14 | public class CrmCustomerLimitConfigSaveReqVO { |
| @@ -23,11 +22,11 @@ public class CrmCustomerLimitConfigSaveReqVO { | @@ -23,11 +22,11 @@ public class CrmCustomerLimitConfigSaveReqVO { | ||
| 23 | private Integer type; | 22 | private Integer type; |
| 24 | 23 | ||
| 25 | @Schema(description = "规则适用人群") | 24 | @Schema(description = "规则适用人群") |
| 26 | - @DiffLogField(name = "规则适用人群", function = GET_ADMIN_USER_BY_ID) | 25 | + @DiffLogField(name = "规则适用人群", function = SysAdminUserParseFunction.NAME) |
| 27 | private List<Long> userIds; | 26 | private List<Long> userIds; |
| 28 | 27 | ||
| 29 | @Schema(description = "规则适用部门") | 28 | @Schema(description = "规则适用部门") |
| 30 | - @DiffLogField(name = "规则适用部门", function = GET_DEPT_BY_ID) | 29 | + @DiffLogField(name = "规则适用部门", function = SysDeptParseFunction.NAME) |
| 31 | private List<Long> deptIds; | 30 | private List<Long> deptIds; |
| 32 | 31 | ||
| 33 | @Schema(description = "数量上限", requiredMode = Schema.RequiredMode.REQUIRED, example = "28384") | 32 | @Schema(description = "数量上限", requiredMode = Schema.RequiredMode.REQUIRED, example = "28384") |
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 +8,6 @@ import jakarta.annotation.Resource; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Component; | 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 | * CRM 联系人的 {@link IParseFunction} 实现类 | 12 | * CRM 联系人的 {@link IParseFunction} 实现类 |
| 15 | * | 13 | * |
| @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | ||
| 19 | @Slf4j | 17 | @Slf4j |
| 20 | public class CrmContactParseFunction implements IParseFunction { | 18 | public class CrmContactParseFunction implements IParseFunction { |
| 21 | 19 | ||
| 20 | + public static final String NAME = "getContactById"; | ||
| 21 | + | ||
| 22 | @Resource | 22 | @Resource |
| 23 | private CrmContactService contactService; | 23 | private CrmContactService contactService; |
| 24 | 24 | ||
| @@ -29,7 +29,7 @@ public class CrmContactParseFunction implements IParseFunction { | @@ -29,7 +29,7 @@ public class CrmContactParseFunction implements IParseFunction { | ||
| 29 | 29 | ||
| 30 | @Override | 30 | @Override |
| 31 | public String functionName() { | 31 | public String functionName() { |
| 32 | - return GET_CONTACT_BY_ID; | 32 | + return NAME; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @Override | 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 +8,6 @@ import jakarta.annotation.Resource; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Component; | 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 | * CRM 合同的 {@link IParseFunction} 实现类 | 12 | * CRM 合同的 {@link IParseFunction} 实现类 |
| 15 | * | 13 | * |
| @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | ||
| 19 | @Slf4j | 17 | @Slf4j |
| 20 | public class CrmContractParseFunction implements IParseFunction { | 18 | public class CrmContractParseFunction implements IParseFunction { |
| 21 | 19 | ||
| 20 | + public static final String NAME = "getContractById"; | ||
| 21 | + | ||
| 22 | @Resource | 22 | @Resource |
| 23 | private CrmContractService contractService; | 23 | private CrmContractService contractService; |
| 24 | 24 | ||
| @@ -29,7 +29,7 @@ public class CrmContractParseFunction implements IParseFunction { | @@ -29,7 +29,7 @@ public class CrmContractParseFunction implements IParseFunction { | ||
| 29 | 29 | ||
| 30 | @Override | 30 | @Override |
| 31 | public String functionName() { | 31 | public String functionName() { |
| 32 | - return GET_CONTRACT_BY_ID; | 32 | + return NAME; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @Override | 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 +7,6 @@ import lombok.extern.slf4j.Slf4j; | ||
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | ||
| 9 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; | 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 | * 行业的 {@link IParseFunction} 实现类 | 12 | * 行业的 {@link IParseFunction} 实现类 |
| @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | ||
| 18 | @Slf4j | 17 | @Slf4j |
| 19 | public class CrmCustomerIndustryParseFunction implements IParseFunction { | 18 | public class CrmCustomerIndustryParseFunction implements IParseFunction { |
| 20 | 19 | ||
| 20 | + public static final String NAME = "getCustomerIndustry"; | ||
| 21 | + | ||
| 21 | @Override | 22 | @Override |
| 22 | public boolean executeBefore() { | 23 | public boolean executeBefore() { |
| 23 | return true; // 先转换值后对比 | 24 | return true; // 先转换值后对比 |
| @@ -25,7 +26,7 @@ public class CrmCustomerIndustryParseFunction implements IParseFunction { | @@ -25,7 +26,7 @@ public class CrmCustomerIndustryParseFunction implements IParseFunction { | ||
| 25 | 26 | ||
| 26 | @Override | 27 | @Override |
| 27 | public String functionName() { | 28 | public String functionName() { |
| 28 | - return GET_CUSTOMER_INDUSTRY; | 29 | + return NAME; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | @Override | 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 +7,6 @@ import lombok.extern.slf4j.Slf4j; | ||
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | ||
| 9 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL; | 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 | * 客户等级的 {@link IParseFunction} 实现类 | 12 | * 客户等级的 {@link IParseFunction} 实现类 |
| @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | @@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | ||
| 18 | @Slf4j | 17 | @Slf4j |
| 19 | public class CrmCustomerLevelParseFunction implements IParseFunction { | 18 | public class CrmCustomerLevelParseFunction implements IParseFunction { |
| 20 | 19 | ||
| 20 | + public static final String NAME = "getCustomerLevel"; | ||
| 21 | + | ||
| 21 | @Override | 22 | @Override |
| 22 | public boolean executeBefore() { | 23 | public boolean executeBefore() { |
| 23 | return true; // 先转换值后对比 | 24 | return true; // 先转换值后对比 |
| @@ -25,7 +26,7 @@ public class CrmCustomerLevelParseFunction implements IParseFunction { | @@ -25,7 +26,7 @@ public class CrmCustomerLevelParseFunction implements IParseFunction { | ||
| 25 | 26 | ||
| 26 | @Override | 27 | @Override |
| 27 | public String functionName() { | 28 | public String functionName() { |
| 28 | - return GET_CUSTOMER_LEVEL; | 29 | + return NAME; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | @Override | 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 +8,6 @@ import jakarta.annotation.Resource; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Component; | 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 | * CRM 客户的 {@link IParseFunction} 实现类 | 12 | * CRM 客户的 {@link IParseFunction} 实现类 |
| 15 | * | 13 | * |
| @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | @@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC | ||
| 19 | @Slf4j | 17 | @Slf4j |
| 20 | public class CrmCustomerParseFunction implements IParseFunction { | 18 | public class CrmCustomerParseFunction implements IParseFunction { |
| 21 | 19 | ||
| 20 | + public static final String NAME = "getCustomerById"; | ||
| 21 | + | ||
| 22 | @Resource | 22 | @Resource |
| 23 | private CrmCustomerService customerService; | 23 | private CrmCustomerService customerService; |
| 24 | 24 | ||
| @@ -29,7 +29,7 @@ public class CrmCustomerParseFunction implements IParseFunction { | @@ -29,7 +29,7 @@ public class CrmCustomerParseFunction implements IParseFunction { | ||
| 29 | 29 | ||
| 30 | @Override | 30 | @Override |
| 31 | public String functionName() { | 31 | public String functionName() { |
| 32 | - return GET_CUSTOMER_BY_ID; | 32 | + return NAME; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @Override | 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 +7,6 @@ import lombok.extern.slf4j.Slf4j; | ||
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | ||
| 9 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE; | 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 | * CRM 客户来源的 {@link IParseFunction} 实现类 | 12 | * CRM 客户来源的 {@link IParseFunction} 实现类 |
| @@ -27,7 +26,7 @@ public class CrmCustomerSourceParseFunction implements IParseFunction { | @@ -27,7 +26,7 @@ public class CrmCustomerSourceParseFunction implements IParseFunction { | ||
| 27 | 26 | ||
| 28 | @Override | 27 | @Override |
| 29 | public String functionName() { | 28 | public String functionName() { |
| 30 | - return GET_CUSTOMER_SOURCE; | 29 | + return NAME; |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | @Override | 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-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 +8,6 @@ import jakarta.annotation.Resource; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Component; | 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 | * 管理员名字的 {@link IParseFunction} 实现类 | 12 | * 管理员名字的 {@link IParseFunction} 实现类 |
| 15 | * | 13 | * |
| @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | ||
| 19 | @Component | 17 | @Component |
| 20 | public class AdminUserParseFunction implements IParseFunction { | 18 | public class AdminUserParseFunction implements IParseFunction { |
| 21 | 19 | ||
| 20 | + public static final String NAME = "getAdminUserById"; | ||
| 21 | + | ||
| 22 | @Resource | 22 | @Resource |
| 23 | private AdminUserApi adminUserApi; | 23 | private AdminUserApi adminUserApi; |
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
| 26 | public String functionName() { | 26 | public String functionName() { |
| 27 | - return GET_ADMIN_USER_BY_ID; | 27 | + return NAME; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | @Override | 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,8 +6,6 @@ import com.mzt.logapi.service.IParseFunction; | ||
| 6 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| 7 | import org.springframework.stereotype.Component; | 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 | * 地名的 {@link IParseFunction} 实现类 | 10 | * 地名的 {@link IParseFunction} 实现类 |
| 13 | * | 11 | * |
| @@ -17,6 +15,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | @@ -17,6 +15,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | ||
| 17 | @Component | 15 | @Component |
| 18 | public class AreaParseFunction implements IParseFunction { | 16 | public class AreaParseFunction implements IParseFunction { |
| 19 | 17 | ||
| 18 | + public static final String NAME = "getArea"; | ||
| 19 | + | ||
| 20 | @Override | 20 | @Override |
| 21 | public boolean executeBefore() { | 21 | public boolean executeBefore() { |
| 22 | return true; // 先转换值后对比 | 22 | return true; // 先转换值后对比 |
| @@ -24,7 +24,7 @@ public class AreaParseFunction implements IParseFunction { | @@ -24,7 +24,7 @@ public class AreaParseFunction implements IParseFunction { | ||
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
| 26 | public String functionName() { | 26 | public String functionName() { |
| 27 | - return GET_AREA; | 27 | + return NAME; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | @Override | 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,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction; | ||
| 7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 8 | import org.springframework.stereotype.Component; | 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 | * 是否类型的 {@link IParseFunction} 实现类 | 11 | * 是否类型的 {@link IParseFunction} 实现类 |
| 14 | * | 12 | * |
| @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | ||
| 18 | @Slf4j | 16 | @Slf4j |
| 19 | public class BooleanParseFunction implements IParseFunction { | 17 | public class BooleanParseFunction implements IParseFunction { |
| 20 | 18 | ||
| 19 | + public static final String NAME = "getBoolean"; | ||
| 20 | + | ||
| 21 | @Override | 21 | @Override |
| 22 | public boolean executeBefore() { | 22 | public boolean executeBefore() { |
| 23 | return true; // 先转换值后对比 | 23 | return true; // 先转换值后对比 |
| @@ -25,7 +25,7 @@ public class BooleanParseFunction implements IParseFunction { | @@ -25,7 +25,7 @@ public class BooleanParseFunction implements IParseFunction { | ||
| 25 | 25 | ||
| 26 | @Override | 26 | @Override |
| 27 | public String functionName() { | 27 | public String functionName() { |
| 28 | - return GET_BOOLEAN; | 28 | + return NAME; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | @Override | 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 +8,6 @@ import jakarta.annotation.Resource; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Component; | 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 | * 管理员名字的 {@link IParseFunction} 实现类 | 12 | * 管理员名字的 {@link IParseFunction} 实现类 |
| 15 | * | 13 | * |
| @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | @@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | ||
| 19 | @Component | 17 | @Component |
| 20 | public class DeptParseFunction implements IParseFunction { | 18 | public class DeptParseFunction implements IParseFunction { |
| 21 | 19 | ||
| 20 | + public static final String NAME = "getDeptById"; | ||
| 21 | + | ||
| 22 | @Resource | 22 | @Resource |
| 23 | private DeptApi deptApi; | 23 | private DeptApi deptApi; |
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
| 26 | public String functionName() { | 26 | public String functionName() { |
| 27 | - return GET_DEPT_BY_ID; | 27 | + return NAME; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | @Override | 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,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction; | ||
| 7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 8 | import org.springframework.stereotype.Component; | 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 | * 行业的 {@link IParseFunction} 实现类 | 11 | * 行业的 {@link IParseFunction} 实现类 |
| 14 | * | 12 | * |
| @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | @@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa | ||
| 18 | @Slf4j | 16 | @Slf4j |
| 19 | public class SexParseFunction implements IParseFunction { | 17 | public class SexParseFunction implements IParseFunction { |
| 20 | 18 | ||
| 19 | + public static final String NAME = "getSex"; | ||
| 20 | + | ||
| 21 | @Override | 21 | @Override |
| 22 | public boolean executeBefore() { | 22 | public boolean executeBefore() { |
| 23 | return true; // 先转换值后对比 | 23 | return true; // 先转换值后对比 |
| @@ -25,7 +25,7 @@ public class SexParseFunction implements IParseFunction { | @@ -25,7 +25,7 @@ public class SexParseFunction implements IParseFunction { | ||
| 25 | 25 | ||
| 26 | @Override | 26 | @Override |
| 27 | public String functionName() { | 27 | public String functionName() { |
| 28 | - return GET_SEX; | 28 | + return NAME; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | @Override | 31 | @Override |