mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	CRM-客户:日志表达式调整
This commit is contained in:
		| @@ -1,13 +1,13 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig; | ||||
|  | ||||
| import cn.hutool.core.util.BooleanUtil; | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import jakarta.validation.constraints.AssertTrue; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | ||||
|  | ||||
| import jakarta.validation.constraints.AssertTrue; | ||||
| import java.util.Objects; | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 客户公海配置的保存 Request VO") | ||||
| @@ -16,19 +16,27 @@ import java.util.Objects; | ||||
| @ToString(callSuper = true) | ||||
| public class CrmCustomerPoolConfigSaveReqVO extends CrmCustomerPoolConfigBaseVO { | ||||
|  | ||||
|     // TODO @puhui999:AssertTrue 必须 is 开头哈;注意需要 json 忽略下,避免被序列化; | ||||
|     @AssertTrue(message = "客户公海规则设置不正确") | ||||
|     // TODO @puhui999:这个方法,是不是拆成 2 个,一个校验 contactExpireDays、一个校验 dealExpireDays; | ||||
|     public boolean poolEnableValid() { | ||||
|     @AssertTrue(message = "未成交放入公海天数不能为空") | ||||
|     @JsonIgnore | ||||
|     public boolean isDealExpireDaysValid() { | ||||
|         if (!BooleanUtil.isTrue(getEnabled())) { | ||||
|             return true; | ||||
|         } | ||||
|         return ObjectUtil.isAllNotEmpty(getContactExpireDays(), getDealExpireDays()); | ||||
|         return Objects.nonNull(getDealExpireDays()); | ||||
|     } | ||||
|  | ||||
|     @AssertTrue(message = "客户公海规则设置不正确") | ||||
|     // TODO @puhui999:这个方法,是不是改成 isNotifyDaysValid() 更好点?本质校验的是 notifyDays 是否为空 | ||||
|     public boolean notifyEnableValid() { | ||||
|     @AssertTrue(message = "未跟进放入公海天数不能为空") | ||||
|     @JsonIgnore | ||||
|     public boolean isContactExpireDaysValid() { | ||||
|         if (!BooleanUtil.isTrue(getEnabled())) { | ||||
|             return true; | ||||
|         } | ||||
|         return Objects.nonNull(getContactExpireDays()); | ||||
|     } | ||||
|  | ||||
|     @AssertTrue(message = "提前提醒天数不能为空") | ||||
|     @JsonIgnore | ||||
|     public boolean isNotifyDaysValid() { | ||||
|         if (!BooleanUtil.isTrue(getNotifyEnabled())) { | ||||
|             return true; | ||||
|         } | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.service.customer; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.hutool.extra.spring.SpringUtil; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| @@ -247,13 +248,15 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||||
|             user = adminUserApi.getUser(ownerUserId); | ||||
|         } | ||||
|         for (CrmCustomerDO customer : customers) { | ||||
|             receiveCustomerLog(customer, user == null ? null : user.getNickname()); | ||||
|             getSelf().receiveCustomerLog(customer, user == null ? null : user.getNickname()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_RECEIVE_SUB_TYPE, bizNo = "{{#customer.id}}", success = CRM_CUSTOMER_RECEIVE_SUCCESS) | ||||
|     public void receiveCustomerLog(CrmCustomerDO customer, String ownerUserName) { | ||||
|  | ||||
|         // 记录操作日志上下文 | ||||
|         LogRecordContext.putVariable("customer", customer); | ||||
|         LogRecordContext.putVariable("ownerUserName", ownerUserName); | ||||
|     } | ||||
|  | ||||
|     //======================= 查询相关 ======================= | ||||
| @@ -364,4 +367,14 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 获得自身的代理对象,解决 AOP 生效问题 | ||||
|      * | ||||
|      * @return 自己 | ||||
|      */ | ||||
|     private CrmCustomerServiceImpl getSelf() { | ||||
|         return SpringUtil.getBean(getClass()); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999