update 占桩订单优化

This commit is contained in:
Guoqs
2024-07-25 17:22:12 +08:00
parent 64f9797f82
commit ed7c0f5e5c
5 changed files with 69 additions and 2 deletions

View File

@@ -66,6 +66,8 @@ public interface OrderPileOccupyService{
void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy);
int retryCalculateOccupyPileOrderAmount(String occupyCode);
/**
* 通过memberid查询挂起状态订单
* @param memberId

View File

@@ -282,6 +282,26 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
orderPileOccupyMapper.updateByPrimaryKeySelective(orderPileOccupy);
}
@Override
public int retryCalculateOccupyPileOrderAmount(String occupyCode) {
OrderPileOccupy orderPileOccupy = queryByOccupyCode(occupyCode);
// 计算金额
BigDecimal orderAmount = calculateOccupyPileOrderAmount(orderPileOccupy);
if (orderAmount.compareTo(BigDecimal.ZERO) > 0) {
// 需要支付金额,订单挂起
orderPileOccupy.setStatus(Constants.TWO); // 2-订单挂起
} else {
// 订单金额为0
orderPileOccupy.setPayStatus(Constants.TWO); // 2-无需支付
orderPileOccupy.setStatus(Constants.ONE); // 1-订单完成
}
orderPileOccupy.setOrderAmount(orderAmount);
// 更新数据库
int i = orderPileOccupyMapper.updateByPrimaryKeySelective(orderPileOccupy);
return i;
}
/**
* 计算占桩订单金额
* calculateTheAmountOfTheOccupancyOrder