mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
售后日志添加售前售后状态
This commit is contained in:
parent
3e4b1c0552
commit
73f1636daa
3
sql/mysql/optional/mall_trade_log.sql
Normal file
3
sql/mysql/optional/mall_trade_log.sql
Normal file
@ -0,0 +1,3 @@
|
||||
ALTER TABLE `ruoyi-vue-pro`.`trade_after_sale_log`
|
||||
ADD COLUMN `before_status` int NOT NULL COMMENT '售前状态' AFTER `id`,
|
||||
ADD COLUMN `after_status` int NOT NULL COMMENT '售后状态' AFTER `before_status`;
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||
|
@ -8,8 +8,10 @@ import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSa
|
||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
|
||||
import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleOperateTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
|
||||
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.annotations.AfterSaleLog;
|
||||
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.util.AfterSaleLogUtils;
|
||||
import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -71,6 +73,8 @@ public class AppTradeAfterSaleController {
|
||||
@Operation(summary = "申请售后")
|
||||
@AfterSaleLog(id = "#info.data", content = "'申请售后:售后编号['+#info.data+'],订单编号['+#createReqVO.orderItemId+'], '", operateType = AfterSaleOperateTypeEnum.APPLY)
|
||||
public CommonResult<Long> createAfterSale(@RequestBody AppTradeAfterSaleCreateReqVO createReqVO) {
|
||||
AfterSaleLogUtils.setBeforeStatus(0);
|
||||
AfterSaleLogUtils.setAfterStatus(TradeAfterSaleStatusEnum.APPLY.getStatus());
|
||||
return success(afterSaleService.createAfterSale(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.spring.SpringExpressionUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog;
|
||||
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.annotations.AfterSaleLog;
|
||||
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO;
|
||||
@ -33,9 +34,26 @@ public class AfterSaleLogAspect {
|
||||
|
||||
@Resource
|
||||
private AfterSaleLogService afterSaleLogService;
|
||||
|
||||
// TODO chenchen: 这个分 3 行把;
|
||||
private final static String OPERATE_TYPE = "operateType", ID = "id", CONTENT = "content";
|
||||
/**
|
||||
* 售前状态
|
||||
*/
|
||||
private static final ThreadLocal<Integer> BEFORE_STATUS = new ThreadLocal<>();
|
||||
/**
|
||||
* 售后状态
|
||||
*/
|
||||
private static final ThreadLocal<Integer> AFTER_STATUS = new ThreadLocal<>();
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
private final static String OPERATE_TYPE = "operateType";
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private final static String ID = "id";
|
||||
/**
|
||||
* 操作明细
|
||||
*/
|
||||
private final static String CONTENT = "content";
|
||||
|
||||
/**
|
||||
* 切面存入日志
|
||||
@ -52,11 +70,15 @@ public class AfterSaleLogAspect {
|
||||
.setUserType(userType)
|
||||
.setAfterSaleId(MapUtil.getLong(formatObj, ID))
|
||||
.setOperateType(MapUtil.getStr(formatObj, OPERATE_TYPE))
|
||||
.setBeforeStatus(BEFORE_STATUS.get())
|
||||
.setAfterStatus(AFTER_STATUS.get())
|
||||
.setContent(MapUtil.getStr(formatObj, CONTENT));
|
||||
// 异步存入数据库
|
||||
afterSaleLogService.createLog(dto);
|
||||
} catch (Exception exception) {
|
||||
log.error("[doAfterReturning][afterSaleLog({}) 日志记录错误]", toJsonString(afterSaleLog), exception);
|
||||
}finally {
|
||||
clearThreadLocal();
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,4 +107,17 @@ public class AfterSaleLogAspect {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void setBeforeStatus(Integer beforestatus) {
|
||||
BEFORE_STATUS.set(beforestatus);
|
||||
}
|
||||
|
||||
public static void setAfterStatus(Integer afterStatus) {
|
||||
AFTER_STATUS.set(afterStatus);
|
||||
}
|
||||
|
||||
private static void clearThreadLocal() {
|
||||
AFTER_STATUS.remove();
|
||||
BEFORE_STATUS.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,5 +42,13 @@ public class TradeAfterSaleLogCreateReqDTO {
|
||||
* 操作明细
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 售前状态
|
||||
*/
|
||||
private Integer beforeStatus;
|
||||
/**
|
||||
* 售后状态
|
||||
*/
|
||||
private Integer afterStatus;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.util;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLogAspect;
|
||||
|
||||
/**
|
||||
* 操作日志工具类
|
||||
* 目前主要的作用,是提供给业务代码,记录操作明细和拓展字段
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class AfterSaleLogUtils {
|
||||
|
||||
public static void setBeforeStatus(Integer status) {
|
||||
AfterSaleLogAspect.setBeforeStatus(status);
|
||||
}
|
||||
|
||||
public static void setAfterStatus(Integer status) {
|
||||
AfterSaleLogAspect.setAfterStatus(status);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user