|
@@ -80,7 +80,6 @@ import static cn.newfeifan.mall.framework.common.util.date.LocalDateTimeUtils.mi
|
|
|
import static cn.newfeifan.mall.framework.common.util.servlet.ServletUtils.getClientIP;
|
|
|
import static cn.newfeifan.mall.framework.web.core.util.WebFrameworkUtils.getTerminal;
|
|
|
import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.*;
|
|
|
-import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.NOT_SUFFICIENT_FUNDS;
|
|
|
|
|
|
/**
|
|
|
* 交易订单【写】Service 实现类
|
|
@@ -353,12 +352,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_DELIVERY)
|
|
|
public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
|
|
|
+ //校验发货信息不能都为空
|
|
|
+ if(deliveryReqVO.getLogisticsNo() == null && deliveryReqVO.getDeliveryRemark() == null){
|
|
|
+ throw exception(ORDER_DELIVERY_DETAILS_IS_NULL);
|
|
|
+ }
|
|
|
+
|
|
|
// 1.1 校验并获得交易订单(可发货)
|
|
|
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
|
|
order.setLogisticsId(deliveryReqVO.getLogisticsId());
|
|
|
order.setLogisticsNo(deliveryReqVO.getLogisticsNo());
|
|
|
+ order.setAttachment(deliveryReqVO.getAttachment());
|
|
|
+ order.setDeliveryRemark(deliveryReqVO.getDeliveryRemark());
|
|
|
// 1.2 校验 deliveryType 是否为快递,是快递才可以发货
|
|
|
- if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType())) {
|
|
|
+ if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType()) || ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.VIRTUAL_PRODUCT.getType())) {
|
|
|
throw exception(ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS);
|
|
|
}
|
|
|
|
|
@@ -366,7 +372,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
|
|
// 2.1 快递发货
|
|
|
DeliveryExpressDO express = null;
|
|
|
- if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL)) {
|
|
|
+ if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL) && deliveryReqVO.getLogisticsId() != null) {
|
|
|
express = deliveryExpressService.validateDeliveryExpress(deliveryReqVO.getLogisticsId());
|
|
|
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
|
|
|
} else {
|
|
@@ -376,7 +382,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
|
|
|
try {
|
|
|
//发送订单订阅
|
|
|
- subscribe(order);
|
|
|
+ if (deliveryReqVO.getLogisticsId() != null && deliveryReqVO.getLogisticsNo() != null) {
|
|
|
+ subscribe(order);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|