修复无法支付问题

This commit is contained in:
2025-04-01 13:00:13 +08:00
parent df3ae32eb7
commit aecfea75f2

View File

@@ -78,7 +78,7 @@ public class OrderPayController extends BaseController {
@GetMapping() @GetMapping()
public ApiResult<List<OrderPay>> list(OrderPayParam param) { public ApiResult<List<OrderPay>> list(OrderPayParam param) {
List<OrderPay> orderPays = orderPayService.listRel(param); List<OrderPay> orderPays = orderPayService.listRel(param);
if (null != param.getRentOrderId() && 0 != param.getRentOrderId()) {//如果是单个查询 if (null != param.getRentOrderId() && 0 != param.getRentOrderId()) {//如果是单个查询
Order order = orderService.getById(param.getRentOrderId()); Order order = orderService.getById(param.getRentOrderId());
if (null != order && !orderPays.isEmpty()) { if (null != order && !orderPays.isEmpty()) {
@@ -98,26 +98,28 @@ public class OrderPayController extends BaseController {
@GetMapping("/{id}") @GetMapping("/{id}")
public ApiResult<OrderPay> get(@PathVariable("id") Integer id) { public ApiResult<OrderPay> get(@PathVariable("id") Integer id) {
final OrderPay orderPay = orderPayService.getById(id); final OrderPay orderPay = orderPayService.getById(id);
final BigDecimal rent = orderPay.getBatteryRent(); final BigDecimal rent = orderPay.getBatteryRent();
final OrderPay one = orderPayService.getOne(new LambdaQueryWrapper<OrderPay>() final OrderPay one = orderPayService.getOne(new LambdaQueryWrapper<OrderPay>()
.eq(OrderPay::getRentOrderId, orderPay.getRentOrderId()) .eq(OrderPay::getRentOrderId, orderPay.getRentOrderId())
.eq(OrderPay::getUserId, orderPay.getUserId()) .eq(OrderPay::getUserId, orderPay.getUserId())
.eq(OrderPay::getPayStatus, PAY_STATUS_SUCCESS) .eq(OrderPay::getPayStatus, PAY_STATUS_SUCCESS)
.orderByDesc(OrderPay::getId) .orderByDesc(OrderPay::getId)
.last("limit 1") .last("limit 1")
); );
final Integer goodsId = orderPay.getGoodsId(); final Integer goodsId = orderPay.getGoodsId();
final EquipmentGoods goods = equipmentGoodsService.getByIdRel(goodsId); final EquipmentGoods goods = equipmentGoodsService.getByIdRel(goodsId);
final BigDecimal batteryRent = goods.getBatteryRent(); final BigDecimal batteryRent = goods.getBatteryRent();
// 按新的续费价格 // 按新的续费价格
orderPay.setTotalPrice(batteryRent); orderPay.setTotalPrice(batteryRent);
final long between = DateUtil.between(new Date(), one.getExpirationTime(), DateUnit.DAY, false); if (one != null) {
if(between < 0){ final long between = DateUtil.between(new Date(), one.getExpirationTime(), DateUnit.DAY, false);
// 有逾期的订单不能享受折扣 if (between < 0) {
orderPay.setTotalPrice(rent); // 有逾期的订单不能享受折扣
} orderPay.setTotalPrice(rent);
return success(orderPay); }
}
return success(orderPay);
} }
@GetMapping("/change-order-no") @GetMapping("/change-order-no")