mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
trade:发货逻辑,增加订单日志
This commit is contained in:
parent
53bd1b9ec1
commit
26dfbfb2ac
@ -14,7 +14,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
public enum TradeOrderOperateTypeEnum {
|
public enum TradeOrderOperateTypeEnum {
|
||||||
|
|
||||||
MEMBER_CREATE(1, "用户下单"),
|
MEMBER_CREATE(1, "用户下单"),
|
||||||
MEMBER_PAY(20, "用户付款成功"),
|
MEMBER_PAY(10, "用户付款成功"),
|
||||||
|
ADMIN_DELIVERY(20, "已发货,快递公司:{deliveryName},快递单号:{logisticsNo}"),
|
||||||
MEMBER_RECEIVE(30, "用户已收货"),
|
MEMBER_RECEIVE(30, "用户已收货"),
|
||||||
SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"),
|
SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"),
|
||||||
MEMBER_COMMENT(33, "用户评价"),
|
MEMBER_COMMENT(33, "用户评价"),
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.order;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@ -40,6 +41,7 @@ import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettle
|
|||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.CartDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.CartDO;
|
||||||
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
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.dal.dataobject.order.TradeOrderItemDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
||||||
@ -412,6 +414,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_CANCEL)
|
||||||
public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
|
public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||||
// 1.1 校验并获得交易订单(可发货)
|
// 1.1 校验并获得交易订单(可发货)
|
||||||
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
||||||
@ -423,8 +426,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
// 2. 更新订单为已发货
|
// 2. 更新订单为已发货
|
||||||
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
||||||
// 2.1 快递发货
|
// 2.1 快递发货
|
||||||
|
DeliveryExpressDO express = null;
|
||||||
if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL)) {
|
if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL)) {
|
||||||
deliveryExpressService.validateDeliveryExpress(deliveryReqVO.getLogisticsId());
|
express = deliveryExpressService.validateDeliveryExpress(deliveryReqVO.getLogisticsId());
|
||||||
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
|
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
|
||||||
} else {
|
} else {
|
||||||
// 2.2 无需发货
|
// 2.2 无需发货
|
||||||
@ -437,11 +441,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送站内信
|
// 3. 记录订单日志
|
||||||
|
TradeOrderLogUtils.setOrderInfo(order.getId(), order.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus(),
|
||||||
|
MapUtil.<String, Object>builder().put("expressName", express != null ? express.getName() : "")
|
||||||
|
.put("logisticsNo", express != null ? deliveryReqVO.getLogisticsNo() : "").build());
|
||||||
|
|
||||||
|
// 4. 发送站内信
|
||||||
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
|
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
|
||||||
.setUserId(order.getUserId()).setMessage(null));
|
.setUserId(order.getUserId()).setMessage(null));
|
||||||
|
|
||||||
// TODO 芋艿:OrderLog
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -468,6 +475,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
// 订单类类型:砍价
|
// 订单类类型:砍价
|
||||||
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
|
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
|
||||||
// 校验订单砍价是否成功
|
// 校验订单砍价是否成功
|
||||||
|
// TODO @puhui999:砍价的话,应该不用校验。因为是砍价成功后,才可以下单
|
||||||
if (!bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
if (!bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
||||||
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
|
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ spring:
|
|||||||
# Quartz 配置项,对应 QuartzProperties 配置类
|
# Quartz 配置项,对应 QuartzProperties 配置类
|
||||||
spring:
|
spring:
|
||||||
quartz:
|
quartz:
|
||||||
auto-startup: false # 本地开发环境,尽量不要开启 Job
|
auto-startup: true # 本地开发环境,尽量不要开启 Job
|
||||||
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
|
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
|
||||||
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
|
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
|
||||||
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true
|
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true
|
||||||
|
Loading…
Reference in New Issue
Block a user