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