退款最大值计算问题修复;主订单列表及详情返回加价记录
This commit is contained in:
parent
0785a887d8
commit
63abbbf21f
|
|
@ -34,6 +34,7 @@ import com.ghy.payment.domain.FinancialDetail;
|
||||||
import com.ghy.payment.domain.FinancialMaster;
|
import com.ghy.payment.domain.FinancialMaster;
|
||||||
import com.ghy.payment.domain.OrderTimeoutRecord;
|
import com.ghy.payment.domain.OrderTimeoutRecord;
|
||||||
import com.ghy.payment.service.FinancialChangeRecordService;
|
import com.ghy.payment.service.FinancialChangeRecordService;
|
||||||
|
import com.ghy.payment.service.FinancialDetailService;
|
||||||
import com.ghy.payment.service.FinancialMasterService;
|
import com.ghy.payment.service.FinancialMasterService;
|
||||||
import com.ghy.payment.service.OrderFineRecordService;
|
import com.ghy.payment.service.OrderFineRecordService;
|
||||||
import com.ghy.system.domain.SysArea;
|
import com.ghy.system.domain.SysArea;
|
||||||
|
|
@ -93,6 +94,8 @@ public class OrderMasterController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FinancialMasterService financialMasterService;
|
private FinancialMasterService financialMasterService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private FinancialDetailService financialDetailService;
|
||||||
|
@Autowired
|
||||||
private GoodsStandardService goodsStandardService;
|
private GoodsStandardService goodsStandardService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderFineRecordService orderFineRecordService;
|
private OrderFineRecordService orderFineRecordService;
|
||||||
|
|
@ -117,6 +120,9 @@ public class OrderMasterController extends BaseController {
|
||||||
List<OrderListResponse> orderListResponses = new ArrayList<>();
|
List<OrderListResponse> orderListResponses = new ArrayList<>();
|
||||||
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
|
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
|
||||||
list.forEach(master -> {
|
list.forEach(master -> {
|
||||||
|
//子单
|
||||||
|
List<OrderDetail> detailList = orderDetailService.selectByOrderMasterId(master.getId());
|
||||||
|
|
||||||
// 初始化属性
|
// 初始化属性
|
||||||
OrderListResponse orderListResponse = new OrderListResponse();
|
OrderListResponse orderListResponse = new OrderListResponse();
|
||||||
List<OrderStandard> standardList = new ArrayList<>();
|
List<OrderStandard> standardList = new ArrayList<>();
|
||||||
|
|
@ -137,6 +143,18 @@ public class OrderMasterController extends BaseController {
|
||||||
|
|
||||||
// 财务信息
|
// 财务信息
|
||||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
||||||
|
BigDecimal totalPayMoney = financialMaster.getPayMoney();
|
||||||
|
BigDecimal totalChangeMoney = new BigDecimal(0);
|
||||||
|
for (OrderDetail detail: detailList) {
|
||||||
|
// 查询子单加价记录
|
||||||
|
FinancialChangeRecord changeRecordQry = new FinancialChangeRecord();
|
||||||
|
changeRecordQry.setOrderDetailId(detail.getId());
|
||||||
|
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
|
||||||
|
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
|
||||||
|
totalChangeMoney = totalChangeMoney.add(financialChangeRecords.get(0).getChangeMoney());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalPayMoney = totalPayMoney.add(totalChangeMoney);
|
||||||
|
|
||||||
// 地址信息
|
// 地址信息
|
||||||
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId());
|
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId());
|
||||||
|
|
@ -166,7 +184,8 @@ public class OrderMasterController extends BaseController {
|
||||||
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
|
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
|
||||||
orderListResponse.setDiscountMoney(financialMaster.getDiscountMoney());
|
orderListResponse.setDiscountMoney(financialMaster.getDiscountMoney());
|
||||||
orderListResponse.setTotalMoney(financialMaster.getTotalMoney());
|
orderListResponse.setTotalMoney(financialMaster.getTotalMoney());
|
||||||
orderListResponse.setPayMoney(financialMaster.getPayMoney());
|
orderListResponse.setPayMoney(totalPayMoney);
|
||||||
|
orderListResponse.setChangeMoney(totalChangeMoney);
|
||||||
orderListResponse.setWorkerName(worker == null ? "" : worker.getName());
|
orderListResponse.setWorkerName(worker == null ? "" : worker.getName());
|
||||||
orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone());
|
orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone());
|
||||||
orderListResponse.setCustomerName(customerAddress.getName());
|
orderListResponse.setCustomerName(customerAddress.getName());
|
||||||
|
|
@ -363,6 +382,18 @@ public class OrderMasterController extends BaseController {
|
||||||
finishImgList = goodsImgs.stream().map(GoodsImgs::getImgUrl).collect(Collectors.toList());
|
finishImgList = goodsImgs.stream().map(GoodsImgs::getImgUrl).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(orderDetail.getId());
|
||||||
|
BigDecimal totalPayMoney = financialDetail.getPayMoney();
|
||||||
|
FinancialChangeRecord financialChangeRecord = null;
|
||||||
|
// 查询子单加价记录
|
||||||
|
FinancialChangeRecord changeRecordQry = new FinancialChangeRecord();
|
||||||
|
changeRecordQry.setOrderDetailId(orderDetail.getId());
|
||||||
|
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
|
||||||
|
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
|
||||||
|
financialChangeRecord = financialChangeRecords.get(0);
|
||||||
|
totalPayMoney = totalPayMoney.add(financialChangeRecord.getChangeMoney());
|
||||||
|
}
|
||||||
|
|
||||||
OrderStandardDetail orderStandardDetail = new OrderStandardDetail();
|
OrderStandardDetail orderStandardDetail = new OrderStandardDetail();
|
||||||
orderStandardDetail.setOrderDetailId(orderDetail.getId());
|
orderStandardDetail.setOrderDetailId(orderDetail.getId());
|
||||||
orderStandardDetail.setOrderDetailCode(orderDetail.getCode());
|
orderStandardDetail.setOrderDetailCode(orderDetail.getCode());
|
||||||
|
|
@ -376,6 +407,8 @@ public class OrderMasterController extends BaseController {
|
||||||
orderStandardDetail.setOrderStandardList(standardList);
|
orderStandardDetail.setOrderStandardList(standardList);
|
||||||
orderStandardDetail.setFinishImgList(finishImgList);
|
orderStandardDetail.setFinishImgList(finishImgList);
|
||||||
orderStandardDetail.setRemark(orderDetail.getRemark());
|
orderStandardDetail.setRemark(orderDetail.getRemark());
|
||||||
|
orderStandardDetail.setPayMoney(totalPayMoney);
|
||||||
|
orderStandardDetail.setFinancialChangeRecord(financialChangeRecord);
|
||||||
|
|
||||||
AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
|
AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
|
||||||
afterServiceRecord.setOrderDetailId(orderDetail.getId());
|
afterServiceRecord.setOrderDetailId(orderDetail.getId());
|
||||||
|
|
@ -629,7 +662,7 @@ public class OrderMasterController extends BaseController {
|
||||||
changeRecordQry.setOrderDetailId(detail.getId());
|
changeRecordQry.setOrderDetailId(detail.getId());
|
||||||
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
|
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
|
||||||
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
|
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
|
||||||
totalMoney.add(financialChangeRecords.get(0).getChangeMoney());
|
totalMoney = totalMoney.add(financialChangeRecords.get(0).getChangeMoney());
|
||||||
}
|
}
|
||||||
|
|
||||||
OrderStandardDetail detailRes = new OrderStandardDetail();
|
OrderStandardDetail detailRes = new OrderStandardDetail();
|
||||||
|
|
@ -640,9 +673,9 @@ public class OrderMasterController extends BaseController {
|
||||||
orderStandardDetails.add(detailRes);
|
orderStandardDetails.add(detailRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
orderStandardDetails.stream().forEach(detail -> {
|
for (OrderStandardDetail orderStandardDetail: orderStandardDetails) {
|
||||||
detail.setPayMoney(totalMoney);
|
orderStandardDetail.setPayMoney(totalMoney);
|
||||||
});
|
}
|
||||||
|
|
||||||
return AjaxResult.success(orderStandardDetails);
|
return AjaxResult.success(orderStandardDetails);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ public class OrderListResponse {
|
||||||
|
|
||||||
private BigDecimal payMoney;
|
private BigDecimal payMoney;
|
||||||
|
|
||||||
|
private BigDecimal changeMoney;
|
||||||
|
|
||||||
private BigDecimal discountMoney;
|
private BigDecimal discountMoney;
|
||||||
|
|
||||||
private String goodsLogoUrl;
|
private String goodsLogoUrl;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ghy.web.pojo.vo;
|
package com.ghy.web.pojo.vo;
|
||||||
|
|
||||||
import com.ghy.order.domain.AfterServiceRecord;
|
import com.ghy.order.domain.AfterServiceRecord;
|
||||||
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -30,6 +31,8 @@ public class OrderStandardDetail {
|
||||||
|
|
||||||
private BigDecimal payMoney;
|
private BigDecimal payMoney;
|
||||||
|
|
||||||
|
private FinancialChangeRecord financialChangeRecord;
|
||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
private List<OrderStandard> orderStandardList;
|
private List<OrderStandard> orderStandardList;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue