diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java index d706767b9..5e82d5e3b 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java @@ -97,6 +97,7 @@ public class SpringExpressionUtils { * @author 陈賝 * @since 2023/6/18 11:20 */ + // TODO @chenchen: 这个方法,和 parseExpressions 比较接近,是不是可以合并下; public static Map parseExpression(JoinPoint joinPoint, Object info, List expressionStrings) { // 如果为空,则不进行解析 if (CollUtil.isEmpty(expressionStrings)) { @@ -115,7 +116,7 @@ public class SpringExpressionUtils { //获取方法参数值 Object[] args = joinPoint.getArgs(); for (int i = 0; i < args.length; i++) { - //替换spel里的变量值为实际值, 比如 #user --> user对象 + // 替换 SP EL 里的变量值为实际值, 比如 #user --> user对象 context.setVariable(parameterNames[i], args[i]); } context.setVariable("info", info); diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleOperateTypeEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleOperateTypeEnum.java index 93cc0b5cd..da41c2b93 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleOperateTypeEnum.java +++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleOperateTypeEnum.java @@ -6,6 +6,7 @@ package cn.iocoder.yudao.module.trade.enums.aftersale; * @author 陈賝 * @since 2023/6/13 13:53 */ +// TODO @chenchen:可以 lombok 简化构造方法,和 get 方法 public enum AfterSaleOperateTypeEnum { /** diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java index 0887e765b..56a0f0f32 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java @@ -2,9 +2,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.aftersale; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; -import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; -import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleStatusEnum; +import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleOperateTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -51,8 +49,11 @@ public class TradeAfterSaleLogDO extends BaseDO { * 关联 {@link TradeAfterSaleDO#getId()} */ private Long afterSaleId; + // todo @CHENCHEN: 改成 Integer 哈;主要未来改文案,不好洗 log 存的字段; /** - * 操作类型 {@link TradeAfterSaleStatusEnum} + * 操作类型 + * + * 枚举 {@link AfterSaleOperateTypeEnum} */ private String operateType; /** diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java index 901621d79..1c382d24f 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLo import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +// TODO @chenchen:改成 aftersale 好点哈; /** * trade 模块的 afterSaleLog 组件的 Configuration * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java index d1f26d7a5..ebfdd7522 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java @@ -5,10 +5,13 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleOperateTypeEnum; import java.lang.annotation.*; /** - * 售后日志 + * 售后日志的注解 + * + * 写在方法上时,会自动记录售后日志 * * @author 陈賝 * @since 2023/6/8 17:04 + * @see cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLogAspect */ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/aop/AfterSaleLogAspect.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/aop/AfterSaleLogAspect.java index 16a98a574..93186edf1 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/aop/AfterSaleLogAspect.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/aop/AfterSaleLogAspect.java @@ -30,9 +30,11 @@ import static java.util.Arrays.asList; @Slf4j @Aspect public class AfterSaleLogAspect { - @Resource - private AfterSaleLogService saleLogService; + @Resource + private AfterSaleLogService afterSaleLogService; + + // TODO chenchen: 这个分 3 行把; private final static String OPERATE_TYPE = "operateType", ID = "id", CONTENT = "content"; /** @@ -52,9 +54,9 @@ public class AfterSaleLogAspect { .setOperateType(MapUtil.getStr(formatObj, OPERATE_TYPE)) .setContent(MapUtil.getStr(formatObj, CONTENT)); // 异步存入数据库 - saleLogService.createLog(dto); + afterSaleLogService.createLog(dto); } catch (Exception exception) { - log.error("[afterSaleLog({}) 日志记录错误]", toJsonString(afterSaleLog), exception); + log.error("[doAfterReturning][afterSaleLog({}) 日志记录错误]", toJsonString(afterSaleLog), exception); } } @@ -67,6 +69,7 @@ public class AfterSaleLogAspect { HashMap result = Maps.newHashMapWithExpectedSize(2); Map spelMap = SpringExpressionUtils.parseExpression(joinPoint, info, asList(afterSaleLogPoint.id(), afterSaleLogPoint.content())); + // TODO @chenchen:是不是抽成 3 个方法好点;毕竟 map 太抽象了;; // 售后ID String id = MapUtil.getStr(spelMap, afterSaleLogPoint.id()); result.put(ID, id); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogCreateReqDTO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogCreateReqDTO.java index a6f29e4ce..7beac68cf 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogCreateReqDTO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogCreateReqDTO.java @@ -21,7 +21,7 @@ public class TradeAfterSaleLogCreateReqDTO { private Long id; /** * 用户编号 - *

+ * * 关联 1:AdminUserDO 的 id 字段 * 关联 2:MemberUserDO 的 id 字段 */ diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java index 73e8f085e..fc86f230a 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java @@ -398,6 +398,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa this.createLog(logDTO); } + // TODO @CHENCHEN:这个注释,写在接口就好了,补充重复写哈;@date 应该是 @since /** * 日志记录 * @@ -416,8 +417,9 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa .setOperateType(logDTO.getOperateType()) .setContent(logDTO.getContent()); tradeAfterSaleLogMapper.insert(afterSaleLog); + // TODO @CHENCHEN:代码排版哈;空格要正确 }catch (Exception exception){ - log.error("[request({}) 日志记录错误]", toJsonString(logDTO), exception); + log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); } } }