diff --git a/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java b/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java index 9da5504..519361d 100644 --- a/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java +++ b/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java @@ -1,6 +1,7 @@ package com.tiesheng.web.config.operation; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; +import java.util.Date; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -100,6 +102,18 @@ public class OperationAspect { subject = (StrUtil.isEmpty(insertVal) ? "添加" : "编辑") + subject; } + for (String key : allParams.keySet()) { + Object value = allParams.get(key); + if (value == null || StrUtil.isEmpty(value.toString())) { + // 移除占位符对应的值为空或null的占位符 + String placeholder = "{" + key + "}"; + subject = subject.replace(placeholder, ""); + } else if (value instanceof Date) { + //日期格式化 + allParams.put(key, DateUtil.format((Date) value,"yyyy-MM-dd HH:mm:ss")); + } + } + // 占位符处理 subject = StrUtil.format(subject, allParams); } else {