feat:续费订单修改续期期数,并按照支付时间降序

This commit is contained in:
yangqingyuan
2024-09-15 19:07:00 +08:00
parent 12b5caf481
commit 8e5a0e0fa9
2 changed files with 6 additions and 6 deletions

View File

@@ -31,13 +31,13 @@ import com.gxwebsoft.shop.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.gxwebsoft.common.core.constants.OrderConstants.ORDER_STATUS_OVER;
import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_NO_PAY;
@@ -78,11 +78,7 @@ public class OrderPayController extends BaseController {
@GetMapping()
public ApiResult<List<OrderPay>> list(OrderPayParam param) {
PageParam<OrderPay, OrderPayParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
//return success(orderPayService.list(page.getOrderWrapper()));
List<OrderPay> orderPays = orderPayService.listRel(param);
if (null != param.getRentOrderId() && 0 != param.getRentOrderId()) {//如果是单个查询
Order order = orderService.getById(param.getRentOrderId());
if (null != order && !orderPays.isEmpty()) {
@@ -91,6 +87,10 @@ public class OrderPayController extends BaseController {
orderPay.setIsFreeze(order.getIsFreeze());
});
}
if (!CollectionUtil.isEmpty(orderPays)) {
AtomicInteger counter = new AtomicInteger(orderPays.size());
orderPays.forEach(orderPay -> orderPay.setCurrPeriods(counter.getAndDecrement())); //注意:原来的期数计算数有问题的,这里直接用这里方式
}
}
// 使用关联查询
return success(orderPays);

View File

@@ -33,7 +33,7 @@ public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPay> i
List<OrderPay> list = baseMapper.selectListRel(param);
// 排序
PageParam<OrderPay, OrderPayParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
page.setDefaultOrder("pay_time desc");
return page.sortRecords(list);
}