对交易状态的判定问题处理

This commit is contained in:
Chopper 2022-01-21 12:07:16 +08:00
parent 007d69a887
commit 96e779eb28
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package cn.lili.modules.order.order.entity.dos; package cn.lili.modules.order.order.entity.dos;
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
import cn.lili.mybatis.BaseEntity; import cn.lili.mybatis.BaseEntity;
import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
@ -82,6 +83,7 @@ public class Trade extends BaseEntity {
} }
BeanUtil.copyProperties(tradeDTO, this); BeanUtil.copyProperties(tradeDTO, this);
BeanUtil.copyProperties(tradeDTO.getPriceDetailDTO(), this); BeanUtil.copyProperties(tradeDTO.getPriceDetailDTO(), this);
this.setPayStatus(PayStatusEnum.UNPAID.name());
this.setId(originId); this.setId(originId);
} }
} }

View File

@ -642,7 +642,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public Double getPaymentTotal(String orderSn) { public Double getPaymentTotal(String orderSn) {
Order order = this.getBySn(orderSn); Order order = this.getBySn(orderSn);
Trade trade = tradeService.getBySn(order.getTradeSn()); Trade trade = tradeService.getBySn(order.getTradeSn());
if (trade.getPayStatus().equals(PayStatusEnum.PAID.name())) { //如果交易不为空则返回交易的金额否则返回订单金额
if (StringUtils.isNotEmpty(trade.getPayStatus())
&& trade.getPayStatus().equals(PayStatusEnum.PAID.name())) {
return trade.getFlowPrice(); return trade.getFlowPrice();
} }
return order.getFlowPrice(); return order.getFlowPrice();