feat:续费订单修改续期期数,并按照支付时间降序
This commit is contained in:
@@ -31,13 +31,13 @@ import com.gxwebsoft.shop.service.OrderService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
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.ORDER_STATUS_OVER;
|
||||||
import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_NO_PAY;
|
import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_NO_PAY;
|
||||||
@@ -78,11 +78,7 @@ public class OrderPayController extends BaseController {
|
|||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<OrderPay>> list(OrderPayParam param) {
|
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);
|
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()) {
|
||||||
@@ -91,6 +87,10 @@ public class OrderPayController extends BaseController {
|
|||||||
orderPay.setIsFreeze(order.getIsFreeze());
|
orderPay.setIsFreeze(order.getIsFreeze());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!CollectionUtil.isEmpty(orderPays)) {
|
||||||
|
AtomicInteger counter = new AtomicInteger(orderPays.size());
|
||||||
|
orderPays.forEach(orderPay -> orderPay.setCurrPeriods(counter.getAndDecrement())); //注意:原来的期数计算数有问题的,这里直接用这里方式
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(orderPays);
|
return success(orderPays);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPay> i
|
|||||||
List<OrderPay> list = baseMapper.selectListRel(param);
|
List<OrderPay> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<OrderPay, OrderPayParam> page = new PageParam<>();
|
PageParam<OrderPay, OrderPayParam> page = new PageParam<>();
|
||||||
//page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("pay_time desc");
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user