售后日志优化

This commit is contained in:
chenchen 2023-06-25 23:08:07 +08:00
parent 3f33ca2d6b
commit 75afab1f86
5 changed files with 16 additions and 23 deletions

View File

@ -1,26 +1,29 @@
package cn.iocoder.yudao.module.trade.enums.aftersale; package cn.iocoder.yudao.module.trade.enums.aftersale;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/** /**
* 售后操作类型的枚举 * 售后操作类型的枚举
* *
* @author 陈賝 * @author 陈賝
* @since 2023/6/13 13:53 * @since 2023/6/13 13:53
*/ */
// TODO @chenchen可以 lombok 简化构造方法 get 方法 @RequiredArgsConstructor
@Getter
public enum AfterSaleOperateTypeEnum { public enum AfterSaleOperateTypeEnum {
/** /**
* 用户申请 * 用户申请
*/ */
APPLY("用户申请"), APPLY(0, "用户申请"),
; ;
// 类型
private final Integer type;
// 描述
private final String description; private final String description;
AfterSaleOperateTypeEnum(String description) {
this.description = description;
}
public String description() { public String description() {
return description; return description;
} }

View File

@ -49,7 +49,6 @@ public class TradeAfterSaleLogDO extends BaseDO {
* 关联 {@link TradeAfterSaleDO#getId()} * 关联 {@link TradeAfterSaleDO#getId()}
*/ */
private Long afterSaleId; private Long afterSaleId;
// todo @CHENCHEN: 改成 Integer 主要未来改文案不好洗 log 存的字段
/** /**
* 操作类型 * 操作类型
* *

View File

@ -4,15 +4,14 @@ import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLo
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
// TODO @chenchen改成 aftersale 好点哈
/** /**
* trade 模块的 afterSaleLog 组件的 Configuration * trade 模块的 afterSale 组件的 Configuration
* *
* @author 陈賝 * @author 陈賝
* @since 2023/6/18 11:09 * @since 2023/6/18 11:09
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
public class AfterSaleLogConfiguration { public class AfterSaleConfiguration {
@Bean @Bean
public AfterSaleLogAspect afterSaleLogAspect() { public AfterSaleLogAspect afterSaleLogAspect() {

View File

@ -31,12 +31,13 @@ import static java.util.Arrays.asList;
@Aspect @Aspect
public class AfterSaleLogAspect { public class AfterSaleLogAspect {
private final static String OPERATE_TYPE = "operateType";
private final static String ID = "id";
private final static String CONTENT = "content";
@Resource @Resource
private AfterSaleLogService afterSaleLogService; private AfterSaleLogService afterSaleLogService;
// TODO chenchen: 这个分 3 行把
private final static String OPERATE_TYPE = "operateType", ID = "id", CONTENT = "content";
/** /**
* 切面存入日志 * 切面存入日志
*/ */

View File

@ -398,14 +398,6 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa
this.createLog(logDTO); this.createLog(logDTO);
} }
// TODO @CHENCHEN这个注释写在接口就好了补充重复写哈@date 应该是 @since
/**
* 日志记录
*
* @param logDTO 日志记录
* @author 陈賝
* @date 2023/6/12 14:18
*/
@Override @Override
@Async @Async
public void createLog(TradeAfterSaleLogCreateReqDTO logDTO) { public void createLog(TradeAfterSaleLogCreateReqDTO logDTO) {
@ -417,8 +409,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa
.setOperateType(logDTO.getOperateType()) .setOperateType(logDTO.getOperateType())
.setContent(logDTO.getContent()); .setContent(logDTO.getContent());
tradeAfterSaleLogMapper.insert(afterSaleLog); tradeAfterSaleLogMapper.insert(afterSaleLog);
// TODO @CHENCHEN代码排版哈空格要正确 } catch (Exception exception) {
}catch (Exception exception){
log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception);
} }
} }