条件判定语句顺序调整

This commit is contained in:
Chopper 2021-06-29 10:25:45 +08:00
parent 6a9ba13fc0
commit 5a415ffc77
2 changed files with 4 additions and 5 deletions

View File

@ -59,7 +59,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
//如果订单状态不为空
if (orderDetailVO != null) {
Map<String, String> params = new HashMap<>();
switch (orderMessage.getNewStatus()){
switch (orderMessage.getNewStatus()) {
//如果订单新的状态为已取消 则发送取消订单站内信
case CANCELLED:
params.put(NoticeMessageParameterEnum.CANCEL_REASON.getType(), orderDetailVO.getOrder().getCancelReason());
@ -82,7 +82,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
break;
//如果是拼团订单发送拼团成功消息
case UNDELIVERED:
if(orderDetailVO.getOrder().getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())){
if (OrderPromotionTypeEnum.PINTUAN.name().equals(orderDetailVO.getOrder().getOrderPromotionType())) {
//拼团成功消息
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.PINTUAN_SUCCESS);
}

View File

@ -203,8 +203,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public Order cancel(String orderSn, String reason) {
Order order = OperationalJudgment.judgment(this.getBySn(orderSn));
//如果订单促销类型不为空&&订单是拼团订单并且订单未成团则抛出异常
if (StringUtils.isNotEmpty(order.getOrderPromotionType())
&& order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())
if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType())
&& !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) {
throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL);
}
@ -286,7 +285,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
Order order = this.getBySn(orderSn);
//判断是否为拼团订单进行特殊处理
//判断订单类型进行不同的订单确认操作
if (order.getOrderPromotionType() != null && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())) {
if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType())) {
this.checkPintuanOrder(order.getPromotionId(), order.getParentOrderSn());
} else {
//判断订单类型