mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
操作日志字段解析方法调整
This commit is contained in:
parent
1b87b8a42f
commit
eaa8e4be96
@ -28,13 +28,6 @@
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- TODO @puhui999:api 之间,不直接引入哈;然后,logrecord function 在微服务下,这么跑会高不起来,所以每个服务自己写 function -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,8 +1,5 @@
|
||||
package cn.iocoder.yudao.module.crm.enums;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID;
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
|
||||
|
||||
/**
|
||||
* CRM 操作日志枚举
|
||||
* 目的:统一管理,也减少 Service 里各种“复杂”字符串
|
||||
@ -25,7 +22,7 @@ public interface LogRecordConstants {
|
||||
String CRM_CUSTOMER_DELETE_SUB_TYPE = "删除客户";
|
||||
String CRM_CUSTOMER_DELETE_SUCCESS = "删除了客户【{{#customerName}}】";
|
||||
String CRM_CUSTOMER_TRANSFER_SUB_TYPE = "转移客户";
|
||||
String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#customer.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
|
||||
String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{getAdminUserById{#customer.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
|
||||
String CRM_CUSTOMER_LOCK_SUB_TYPE = "{{#customer.lockStatus ? '解锁客户' : '锁定客户'}}";
|
||||
String CRM_CUSTOMER_LOCK_SUCCESS = "{{#customer.lockStatus ? '将客户【' + #customer.name + '】解锁' : '将客户【' + #customer.name + '】锁定'}}";
|
||||
String CRM_CUSTOMER_POOL_SUB_TYPE = "客户放入公海";
|
||||
@ -59,7 +56,7 @@ public interface LogRecordConstants {
|
||||
String CRM_CONTACT_DELETE_SUB_TYPE = "删除联系人";
|
||||
String CRM_CONTACT_DELETE_SUCCESS = "删除了联系人【{{#contactName}}】";
|
||||
String CRM_CONTACT_TRANSFER_SUB_TYPE = "转移联系人";
|
||||
String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contact.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
|
||||
String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{getAdminUserById{#contact.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
|
||||
|
||||
// ======================= CRM_BUSINESS 商机 =======================
|
||||
|
||||
@ -71,7 +68,7 @@ public interface LogRecordConstants {
|
||||
String CRM_BUSINESS_DELETE_SUB_TYPE = "删除商机";
|
||||
String CRM_BUSINESS_DELETE_SUCCESS = "删除了商机【{{#businessName}}】";
|
||||
String CRM_BUSINESS_TRANSFER_SUB_TYPE = "转移商机";
|
||||
String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#business.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
|
||||
String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{getAdminUserById{#business.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
|
||||
|
||||
// ======================= CRM_CONTRACT 合同 =======================
|
||||
|
||||
@ -83,7 +80,7 @@ public interface LogRecordConstants {
|
||||
String CRM_CONTRACT_DELETE_SUB_TYPE = "删除合同";
|
||||
String CRM_CONTRACT_DELETE_SUCCESS = "删除了合同【{{#contractName}}】";
|
||||
String CRM_CONTRACT_TRANSFER_SUB_TYPE = "转移合同";
|
||||
String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contract.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】";
|
||||
String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{getAdminUserById{#contract.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
|
||||
|
||||
// ======================= CRM_PRODUCT 产品 =======================
|
||||
|
||||
@ -109,20 +106,20 @@ public interface LogRecordConstants {
|
||||
|
||||
String CRM_RECEIVABLE_TYPE = "CRM 回款";
|
||||
String CRM_RECEIVABLE_CREATE_SUB_TYPE = "创建回款";
|
||||
String CRM_RECEIVABLE_CREATE_SUCCESS = "创建了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
|
||||
String CRM_RECEIVABLE_CREATE_SUCCESS = "创建了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
|
||||
String CRM_RECEIVABLE_UPDATE_SUB_TYPE = "更新回款";
|
||||
String CRM_RECEIVABLE_UPDATE_SUCCESS = "更新了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款: {_DIFF{#updateReqVO}}";
|
||||
String CRM_RECEIVABLE_UPDATE_SUCCESS = "更新了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款: {_DIFF{#updateReqVO}}";
|
||||
String CRM_RECEIVABLE_DELETE_SUB_TYPE = "删除回款";
|
||||
String CRM_RECEIVABLE_DELETE_SUCCESS = "删除了合同【{" + GET_CONTRACT_BY_ID + "{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
|
||||
String CRM_RECEIVABLE_DELETE_SUCCESS = "删除了合同【{getContractById{#receivable.contractId}}】的第【{{#receivable.period}}】期回款";
|
||||
|
||||
// ======================= CRM_RECEIVABLE_PLAN 回款计划 =======================
|
||||
|
||||
String CRM_RECEIVABLE_PLAN_TYPE = "CRM 回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_CREATE_SUB_TYPE = "创建回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_CREATE_SUCCESS = "创建了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_CREATE_SUCCESS = "创建了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_UPDATE_SUB_TYPE = "更新回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_UPDATE_SUCCESS = "更新了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划: {_DIFF{#updateReqVO}}";
|
||||
String CRM_RECEIVABLE_PLAN_UPDATE_SUCCESS = "更新了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划: {_DIFF{#updateReqVO}}";
|
||||
String CRM_RECEIVABLE_PLAN_DELETE_SUB_TYPE = "删除回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_DELETE_SUCCESS = "删除了合同【{" + GET_CONTRACT_BY_ID + "{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
|
||||
String CRM_RECEIVABLE_PLAN_DELETE_SUCCESS = "删除了合同【{getContractById{#receivablePlan.contractId}}】的第【{{#receivablePlan.period}}】期回款计划";
|
||||
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package cn.iocoder.yudao.module.crm.enums.operatelog;
|
||||
|
||||
/**
|
||||
* functionName 常量枚举
|
||||
* 方便别的模块调用
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈
|
||||
public interface CrmParseFunctionNameConstants {
|
||||
|
||||
String GET_CONTACT_BY_ID = "getContactById"; // 获取联系人信息
|
||||
String GET_CUSTOMER_BY_ID = "getCustomerById"; // 获取客户信息
|
||||
String GET_CUSTOMER_INDUSTRY = "getCustomerIndustry"; // 获取客户行业信息
|
||||
String GET_CUSTOMER_LEVEL = "getCustomerLevel"; // 获取客户级别
|
||||
String GET_CUSTOMER_SOURCE = "getCustomerSource"; // 获取客户来源
|
||||
String GET_CONTRACT_BY_ID = "getContractById"; // 获取合同信息
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.business;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*;
|
||||
@ -85,6 +86,14 @@ public class CrmBusinessController {
|
||||
return success(CrmBusinessConvert.INSTANCE.convert(business));
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-ids")
|
||||
@Operation(summary = "获得商机列表")
|
||||
@Parameter(name = "ids", description = "编号", required = true, example = "[1024]")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business:query')")
|
||||
public CommonResult<List<CrmBusinessRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) {
|
||||
return success(BeanUtils.toBean(businessService.getBusinessList(ids, getLoginUserId()), CrmBusinessRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得商机分页")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business:query')")
|
||||
|
@ -113,6 +113,14 @@ public class CrmContactController {
|
||||
return success(CrmContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList));
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-ids")
|
||||
@Operation(summary = "获得联系人列表")
|
||||
@Parameter(name = "ids", description = "编号", required = true, example = "[1024]")
|
||||
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
||||
public CommonResult<List<CrmContactRespVO>> getContactListByIds(@RequestParam("ids") List<Long> ids) {
|
||||
return success(BeanUtils.toBean(contactService.getContactList(ids, getLoginUserId()), CrmContactRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/simple-all-list")
|
||||
@Operation(summary = "获得联系人的精简列表")
|
||||
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
||||
@ -153,7 +161,7 @@ public class CrmContactController {
|
||||
@GetMapping("/operate-log-page")
|
||||
@Operation(summary = "获得客户操作日志")
|
||||
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
||||
public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId")Long bizId) {
|
||||
public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("bizId") Long bizId) {
|
||||
OperateLogV2PageReqDTO reqVO = new OperateLogV2PageReqDTO();
|
||||
reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页
|
||||
reqVO.setBizType(CRM_CONTACT_TYPE);
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import cn.iocoder.yudao.framework.common.validation.Telephone;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.*;
|
||||
import com.mzt.logapi.starter.annotation.DiffLogField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
@ -13,9 +14,6 @@ import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTACT_BY_ID;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_BY_ID;
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.*;
|
||||
|
||||
@Schema(description = "管理后台 - CRM 联系人创建/更新 Request VO")
|
||||
@Data
|
||||
@ -30,11 +28,11 @@ public class CrmContactSaveReqVO {
|
||||
private String name;
|
||||
|
||||
@Schema(description = "客户编号", example = "10795")
|
||||
@DiffLogField(name = "姓名", function = GET_CUSTOMER_BY_ID)
|
||||
@DiffLogField(name = "姓名", function = CrmCustomerParseFunction.NAME)
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "性别")
|
||||
@DiffLogField(name = "性别", function = GET_SEX)
|
||||
@DiffLogField(name = "性别", function = SysSexParseFunction.NAME)
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "职位")
|
||||
@ -42,11 +40,11 @@ public class CrmContactSaveReqVO {
|
||||
private String post;
|
||||
|
||||
@Schema(description = "是否关键决策人")
|
||||
@DiffLogField(name = "关键决策人", function = GET_BOOLEAN)
|
||||
@DiffLogField(name = "关键决策人", function = SysBooleanParseFunction.NAME)
|
||||
private Boolean master;
|
||||
|
||||
@Schema(description = "直属上级", example = "23457")
|
||||
@DiffLogField(name = "直属上级", function = GET_CONTACT_BY_ID)
|
||||
@DiffLogField(name = "直属上级", function = CrmContactParseFunction.NAME)
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "手机号", example = "1387171766")
|
||||
@ -73,7 +71,7 @@ public class CrmContactSaveReqVO {
|
||||
private String email;
|
||||
|
||||
@Schema(description = "地区编号", example = "20158")
|
||||
@DiffLogField(name = "所在地", function = GET_AREA)
|
||||
@DiffLogField(name = "所在地", function = SysAreaParseFunction.NAME)
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "地址")
|
||||
@ -86,7 +84,7 @@ public class CrmContactSaveReqVO {
|
||||
|
||||
@Schema(description = "负责人用户编号", example = "14334")
|
||||
@NotNull(message = "负责人不能为空")
|
||||
@DiffLogField(name = "负责人", function = GET_ADMIN_USER_BY_ID)
|
||||
@DiffLogField(name = "负责人", function = SysAdminUserParseFunction.NAME)
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "最后跟进时间")
|
||||
|
@ -5,6 +5,10 @@ import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import cn.iocoder.yudao.framework.common.validation.Telephone;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerIndustryParseFunction;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerLevelParseFunction;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerSourceParseFunction;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAreaParseFunction;
|
||||
import com.mzt.logapi.starter.annotation.DiffLogField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
@ -17,8 +21,6 @@ import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_AREA;
|
||||
|
||||
@Schema(description = "管理后台 - CRM 客户新增/修改 Request VO")
|
||||
@Data
|
||||
@ -33,17 +35,17 @@ public class CrmCustomerSaveReqVO {
|
||||
private String name;
|
||||
|
||||
@Schema(description = "所属行业", example = "1")
|
||||
@DiffLogField(name = "所属行业", function = GET_CUSTOMER_INDUSTRY)
|
||||
@DiffLogField(name = "所属行业", function = CrmCustomerIndustryParseFunction.NAME)
|
||||
@DictFormat(CRM_CUSTOMER_INDUSTRY)
|
||||
private Integer industryId;
|
||||
|
||||
@Schema(description = "客户等级", example = "2")
|
||||
@DiffLogField(name = "客户等级", function = GET_CUSTOMER_LEVEL)
|
||||
@DiffLogField(name = "客户等级", function = CrmCustomerLevelParseFunction.NAME)
|
||||
@InEnum(CrmCustomerLevelEnum.class)
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "客户来源", example = "3")
|
||||
@DiffLogField(name = "客户来源", function = GET_CUSTOMER_SOURCE)
|
||||
@DiffLogField(name = "客户来源", function = CrmCustomerSourceParseFunction.NAME)
|
||||
private Integer source;
|
||||
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
@ -86,7 +88,7 @@ public class CrmCustomerSaveReqVO {
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "地区编号", example = "20158")
|
||||
@DiffLogField(name = "地区编号", function = GET_AREA)
|
||||
@DiffLogField(name = "地区编号", function = SysAreaParseFunction.NAME)
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "详细地址", example = "北京市海淀区")
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig;
|
||||
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAdminUserParseFunction;
|
||||
import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysDeptParseFunction;
|
||||
import com.mzt.logapi.starter.annotation.DiffLogField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@ -7,9 +9,6 @@ import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_DEPT_BY_ID;
|
||||
|
||||
@Schema(description = "管理后台 - 客户限制配置创建/更新 Request VO")
|
||||
@Data
|
||||
public class CrmCustomerLimitConfigSaveReqVO {
|
||||
@ -23,11 +22,11 @@ public class CrmCustomerLimitConfigSaveReqVO {
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "规则适用人群")
|
||||
@DiffLogField(name = "规则适用人群", function = GET_ADMIN_USER_BY_ID)
|
||||
@DiffLogField(name = "规则适用人群", function = SysAdminUserParseFunction.NAME)
|
||||
private List<Long> userIds;
|
||||
|
||||
@Schema(description = "规则适用部门")
|
||||
@DiffLogField(name = "规则适用部门", function = GET_DEPT_BY_ID)
|
||||
@DiffLogField(name = "规则适用部门", function = SysDeptParseFunction.NAME)
|
||||
private List<Long> deptIds;
|
||||
|
||||
@Schema(description = "数量上限", requiredMode = Schema.RequiredMode.REQUIRED, example = "28384")
|
||||
|
@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTACT_BY_ID;
|
||||
|
||||
/**
|
||||
* CRM 联系人的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
|
||||
@Slf4j
|
||||
public class CrmContactParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getContactById";
|
||||
|
||||
@Resource
|
||||
private CrmContactService contactService;
|
||||
|
||||
@ -29,7 +29,7 @@ public class CrmContactParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CONTACT_BY_ID;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID;
|
||||
|
||||
/**
|
||||
* CRM 合同的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
|
||||
@Slf4j
|
||||
public class CrmContractParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getContractById";
|
||||
|
||||
@Resource
|
||||
private CrmContractService contractService;
|
||||
|
||||
@ -29,7 +29,7 @@ public class CrmContractParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CONTRACT_BY_ID;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_INDUSTRY;
|
||||
|
||||
/**
|
||||
* 行业的 {@link IParseFunction} 实现类
|
||||
@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
|
||||
@Slf4j
|
||||
public class CrmCustomerIndustryParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getCustomerIndustry";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
@ -25,7 +26,7 @@ public class CrmCustomerIndustryParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CUSTOMER_INDUSTRY;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_LEVEL;
|
||||
|
||||
/**
|
||||
* 客户等级的 {@link IParseFunction} 实现类
|
||||
@ -18,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
|
||||
@Slf4j
|
||||
public class CrmCustomerLevelParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getCustomerLevel";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
@ -25,7 +26,7 @@ public class CrmCustomerLevelParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CUSTOMER_LEVEL;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_BY_ID;
|
||||
|
||||
/**
|
||||
* CRM 客户的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -19,6 +17,8 @@ import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameC
|
||||
@Slf4j
|
||||
public class CrmCustomerParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getCustomerById";
|
||||
|
||||
@Resource
|
||||
private CrmCustomerService customerService;
|
||||
|
||||
@ -29,7 +29,7 @@ public class CrmCustomerParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CUSTOMER_BY_ID;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE;
|
||||
import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CUSTOMER_SOURCE;
|
||||
|
||||
/**
|
||||
* CRM 客户来源的 {@link IParseFunction} 实现类
|
||||
@ -27,7 +26,7 @@ public class CrmCustomerSourceParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_CUSTOMER_SOURCE;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.mzt.logapi.service.IParseFunction;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 管理员名字的 {@link IParseFunction} 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysAdminUserParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getAdminUserById";
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) {
|
||||
if (StrUtil.isEmptyIfStr(value)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
AdminUserRespDTO user = adminUserApi.getUser(Long.parseLong(value.toString()));
|
||||
if (user == null) {
|
||||
log.warn("[apply][获取用户{{}}为空", value);
|
||||
return "";
|
||||
}
|
||||
// 返回格式 芋道源码(13888888888)
|
||||
String nickname = user.getNickname();
|
||||
if (StrUtil.isEmpty(user.getMobile())) {
|
||||
return nickname;
|
||||
}
|
||||
return StrUtil.format("{}({})", nickname, user.getMobile());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 地名的 {@link IParseFunction} 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysAreaParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getArea";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
}
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) {
|
||||
if (StrUtil.isEmptyIfStr(value)) {
|
||||
return "";
|
||||
}
|
||||
return AreaUtils.format(Integer.parseInt(value.toString()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
|
||||
import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 是否类型的 {@link IParseFunction} 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SysBooleanParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getBoolean";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
}
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) {
|
||||
if (StrUtil.isEmptyIfStr(value)) {
|
||||
return "";
|
||||
}
|
||||
return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.BOOLEAN_STRING, value.toString());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.mzt.logapi.service.IParseFunction;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 管理员名字的 {@link IParseFunction} 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysDeptParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getDeptById";
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) {
|
||||
if (StrUtil.isEmptyIfStr(value)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 获取部门信息
|
||||
DeptRespDTO dept = deptApi.getDept(Long.parseLong(value.toString()));
|
||||
if (dept == null) {
|
||||
log.warn("[apply][获取部门{{}}为空", value);
|
||||
return "";
|
||||
}
|
||||
return dept.getName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 行业的 {@link IParseFunction} 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SysSexParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getSex";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
}
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) {
|
||||
if (StrUtil.isEmptyIfStr(value)) {
|
||||
return "";
|
||||
}
|
||||
return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.USER_SEX, value.toString());
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.system.enums.operatelog;
|
||||
|
||||
/**
|
||||
* functionName 常量枚举
|
||||
* 方便别的模块调用
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈
|
||||
public interface SysParseFunctionNameConstants {
|
||||
|
||||
String GET_ADMIN_USER_BY_ID = "getAdminUserById"; // 获取用户信息
|
||||
String GET_DEPT_BY_ID = "getDeptById"; // 获取部门信息
|
||||
String GET_AREA = "getArea"; // 获取区域信息
|
||||
String GET_SEX = "getSex"; // 获取性别
|
||||
String GET_BOOLEAN = "getBoolean"; // 获取是否
|
||||
|
||||
}
|
@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID;
|
||||
|
||||
/**
|
||||
* 管理员名字的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
|
||||
@Component
|
||||
public class AdminUserParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getAdminUserById";
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_ADMIN_USER_BY_ID;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,8 +6,6 @@ import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_AREA;
|
||||
|
||||
/**
|
||||
* 地名的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -17,6 +15,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
|
||||
@Component
|
||||
public class AreaParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getArea";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
@ -24,7 +24,7 @@ public class AreaParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_AREA;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_BOOLEAN;
|
||||
|
||||
/**
|
||||
* 是否类型的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
|
||||
@Slf4j
|
||||
public class BooleanParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getBoolean";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
@ -25,7 +25,7 @@ public class BooleanParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_BOOLEAN;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,8 +8,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_DEPT_BY_ID;
|
||||
|
||||
/**
|
||||
* 管理员名字的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -19,12 +17,14 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
|
||||
@Component
|
||||
public class DeptParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getDeptById";
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_DEPT_BY_ID;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,8 +7,6 @@ import com.mzt.logapi.service.IParseFunction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_SEX;
|
||||
|
||||
/**
|
||||
* 行业的 {@link IParseFunction} 实现类
|
||||
*
|
||||
@ -18,6 +16,8 @@ import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNa
|
||||
@Slf4j
|
||||
public class SexParseFunction implements IParseFunction {
|
||||
|
||||
public static final String NAME = "getSex";
|
||||
|
||||
@Override
|
||||
public boolean executeBefore() {
|
||||
return true; // 先转换值后对比
|
||||
@ -25,7 +25,7 @@ public class SexParseFunction implements IParseFunction {
|
||||
|
||||
@Override
|
||||
public String functionName() {
|
||||
return GET_SEX;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user