mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	mall + order:review 售后日志
This commit is contained in:
		@@ -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;
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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<String, String> result = Maps.newHashMapWithExpectedSize(2);
 | 
			
		||||
        Map<String, Object> 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);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ public class TradeAfterSaleLogCreateReqDTO {
 | 
			
		||||
    private Long id;
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户编号
 | 
			
		||||
     * <p>
 | 
			
		||||
     *
 | 
			
		||||
     * 关联 1:AdminUserDO 的 id 字段
 | 
			
		||||
     * 关联 2:MemberUserDO 的 id 字段
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user