Commit 75afab1f86c00f4e465ea6fd94de7fbd66bb5a5b
1 parent
3f33ca2d
售后日志优化
Showing
5 changed files
with
16 additions
and
23 deletions
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleOperateTypeEnum.java
| 1 | package cn.iocoder.yudao.module.trade.enums.aftersale; | 1 | package cn.iocoder.yudao.module.trade.enums.aftersale; |
| 2 | 2 | ||
| 3 | +import lombok.Getter; | ||
| 4 | +import lombok.RequiredArgsConstructor; | ||
| 5 | + | ||
| 3 | /** | 6 | /** |
| 4 | * 售后操作类型的枚举 | 7 | * 售后操作类型的枚举 |
| 5 | * | 8 | * |
| 6 | * @author 陈賝 | 9 | * @author 陈賝 |
| 7 | * @since 2023/6/13 13:53 | 10 | * @since 2023/6/13 13:53 |
| 8 | */ | 11 | */ |
| 9 | -// TODO @chenchen:可以 lombok 简化构造方法,和 get 方法 | 12 | +@RequiredArgsConstructor |
| 13 | +@Getter | ||
| 10 | public enum AfterSaleOperateTypeEnum { | 14 | public enum AfterSaleOperateTypeEnum { |
| 11 | 15 | ||
| 12 | /** | 16 | /** |
| 13 | * 用户申请 | 17 | * 用户申请 |
| 14 | */ | 18 | */ |
| 15 | - APPLY("用户申请"), | 19 | + APPLY(0, "用户申请"), |
| 16 | ; | 20 | ; |
| 17 | 21 | ||
| 22 | + // 类型 | ||
| 23 | + private final Integer type; | ||
| 24 | + // 描述 | ||
| 18 | private final String description; | 25 | private final String description; |
| 19 | 26 | ||
| 20 | - AfterSaleOperateTypeEnum(String description) { | ||
| 21 | - this.description = description; | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | public String description() { | 27 | public String description() { |
| 25 | return description; | 28 | return description; |
| 26 | } | 29 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java
| @@ -49,7 +49,6 @@ public class TradeAfterSaleLogDO extends BaseDO { | @@ -49,7 +49,6 @@ public class TradeAfterSaleLogDO extends BaseDO { | ||
| 49 | * 关联 {@link TradeAfterSaleDO#getId()} | 49 | * 关联 {@link TradeAfterSaleDO#getId()} |
| 50 | */ | 50 | */ |
| 51 | private Long afterSaleId; | 51 | private Long afterSaleId; |
| 52 | - // todo @CHENCHEN: 改成 Integer 哈;主要未来改文案,不好洗 log 存的字段; | ||
| 53 | /** | 52 | /** |
| 54 | * 操作类型 | 53 | * 操作类型 |
| 55 | * | 54 | * |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleConfiguration.java
| @@ -4,15 +4,14 @@ import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLo | @@ -4,15 +4,14 @@ import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLo | ||
| 4 | import org.springframework.context.annotation.Bean; | 4 | import org.springframework.context.annotation.Bean; |
| 5 | import org.springframework.context.annotation.Configuration; | 5 | import org.springframework.context.annotation.Configuration; |
| 6 | 6 | ||
| 7 | -// TODO @chenchen:改成 aftersale 好点哈; | ||
| 8 | /** | 7 | /** |
| 9 | - * trade 模块的 afterSaleLog 组件的 Configuration | 8 | + * trade 模块的 afterSale 组件的 Configuration |
| 10 | * | 9 | * |
| 11 | * @author 陈賝 | 10 | * @author 陈賝 |
| 12 | * @since 2023/6/18 11:09 | 11 | * @since 2023/6/18 11:09 |
| 13 | */ | 12 | */ |
| 14 | @Configuration(proxyBeanMethods = false) | 13 | @Configuration(proxyBeanMethods = false) |
| 15 | -public class AfterSaleLogConfiguration { | 14 | +public class AfterSaleConfiguration { |
| 16 | 15 | ||
| 17 | @Bean | 16 | @Bean |
| 18 | public AfterSaleLogAspect afterSaleLogAspect() { | 17 | public AfterSaleLogAspect afterSaleLogAspect() { |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/aop/AfterSaleLogAspect.java
| @@ -31,12 +31,13 @@ import static java.util.Arrays.asList; | @@ -31,12 +31,13 @@ import static java.util.Arrays.asList; | ||
| 31 | @Aspect | 31 | @Aspect |
| 32 | public class AfterSaleLogAspect { | 32 | public class AfterSaleLogAspect { |
| 33 | 33 | ||
| 34 | + private final static String OPERATE_TYPE = "operateType"; | ||
| 35 | + private final static String ID = "id"; | ||
| 36 | + private final static String CONTENT = "content"; | ||
| 37 | + | ||
| 34 | @Resource | 38 | @Resource |
| 35 | private AfterSaleLogService afterSaleLogService; | 39 | private AfterSaleLogService afterSaleLogService; |
| 36 | 40 | ||
| 37 | - // TODO chenchen: 这个分 3 行把; | ||
| 38 | - private final static String OPERATE_TYPE = "operateType", ID = "id", CONTENT = "content"; | ||
| 39 | - | ||
| 40 | /** | 41 | /** |
| 41 | * 切面存入日志 | 42 | * 切面存入日志 |
| 42 | */ | 43 | */ |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java
| @@ -398,14 +398,6 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | @@ -398,14 +398,6 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | ||
| 398 | this.createLog(logDTO); | 398 | this.createLog(logDTO); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | - // TODO @CHENCHEN:这个注释,写在接口就好了,补充重复写哈;@date 应该是 @since | ||
| 402 | - /** | ||
| 403 | - * 日志记录 | ||
| 404 | - * | ||
| 405 | - * @param logDTO 日志记录 | ||
| 406 | - * @author 陈賝 | ||
| 407 | - * @date 2023/6/12 14:18 | ||
| 408 | - */ | ||
| 409 | @Override | 401 | @Override |
| 410 | @Async | 402 | @Async |
| 411 | public void createLog(TradeAfterSaleLogCreateReqDTO logDTO) { | 403 | public void createLog(TradeAfterSaleLogCreateReqDTO logDTO) { |
| @@ -417,8 +409,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | @@ -417,8 +409,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | ||
| 417 | .setOperateType(logDTO.getOperateType()) | 409 | .setOperateType(logDTO.getOperateType()) |
| 418 | .setContent(logDTO.getContent()); | 410 | .setContent(logDTO.getContent()); |
| 419 | tradeAfterSaleLogMapper.insert(afterSaleLog); | 411 | tradeAfterSaleLogMapper.insert(afterSaleLog); |
| 420 | - // TODO @CHENCHEN:代码排版哈;空格要正确 | ||
| 421 | - }catch (Exception exception){ | 412 | + } catch (Exception exception) { |
| 422 | log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); | 413 | log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); |
| 423 | } | 414 | } |
| 424 | } | 415 | } |