订单查询接口返回内容补充

This commit is contained in:
donqi 2022-10-07 02:23:12 +08:00
parent bcaec8cee6
commit 1133ed0d20
4 changed files with 102 additions and 10 deletions

View File

@ -30,8 +30,10 @@ import com.ghy.order.service.IAfterServiceRecordService;
import com.ghy.order.service.OrderDetailService; import com.ghy.order.service.OrderDetailService;
import com.ghy.order.service.OrderGoodsService; import com.ghy.order.service.OrderGoodsService;
import com.ghy.order.service.OrderMasterService; import com.ghy.order.service.OrderMasterService;
import com.ghy.payment.domain.FinancialChangeRecord;
import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.domain.FinancialDetail;
import com.ghy.payment.domain.OrderTimeoutRecord; import com.ghy.payment.domain.OrderTimeoutRecord;
import com.ghy.payment.service.FinancialChangeRecordService;
import com.ghy.payment.service.FinancialDetailService; import com.ghy.payment.service.FinancialDetailService;
import com.ghy.payment.service.OrderFineRecordService; import com.ghy.payment.service.OrderFineRecordService;
import com.ghy.system.domain.SysArea; import com.ghy.system.domain.SysArea;
@ -40,8 +42,11 @@ import com.ghy.web.pojo.vo.OrderChangePriceRequest;
import com.ghy.web.pojo.vo.OrderListResponse; import com.ghy.web.pojo.vo.OrderListResponse;
import com.ghy.web.pojo.vo.OrderStandard; import com.ghy.web.pojo.vo.OrderStandard;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.worker.service.WorkerService; import com.ghy.worker.service.WorkerService;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.util.Assert; import org.apache.shiro.util.Assert;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -53,6 +58,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -93,6 +99,10 @@ public class OrderDetailController extends BaseController {
private OrderFineRecordService orderFineRecordService; private OrderFineRecordService orderFineRecordService;
@Autowired @Autowired
private IAfterServiceRecordService afterServiceRecordService; private IAfterServiceRecordService afterServiceRecordService;
@Autowired
private FinancialChangeRecordService financialChangeRecordService;
@Autowired
private IWorkerCertificationService workerCertificationService;
@RequiresPermissions("order:detail:view") @RequiresPermissions("order:detail:view")
@GetMapping() @GetMapping()
@ -123,6 +133,22 @@ public class OrderDetailController extends BaseController {
// 师傅信息 // 师傅信息
Worker worker = workerService.selectById(detail.getWorkerId()); Worker worker = workerService.selectById(detail.getWorkerId());
WorkerCertification workerRealInfo = null;
String workerName = "";
String masterWorkerName = "";
if (worker != null) {
// 师傅实名信息
workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId());
workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName();
}
workerRealInfo = null;
// 大师傅信息
Worker masterWorker = workerService.selectById(orderMaster.getWorkerId());
if (masterWorker != null) {
// 大师傅实名信息
workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId());
masterWorkerName = workerRealInfo == null ? masterWorker.getName() : workerRealInfo.getName();
}
// 消费者信息 // 消费者信息
// Customer customer = customerService.selectByCustomerId(detail.getCustomerId()); // Customer customer = customerService.selectByCustomerId(detail.getCustomerId());
@ -137,6 +163,14 @@ public class OrderDetailController extends BaseController {
// 财务信息 // 财务信息
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId()); FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
BigDecimal detailPayMoney = financialDetail.getPayMoney();
// 查询子单加价记录
FinancialChangeRecord changeRecordQry = new FinancialChangeRecord();
changeRecordQry.setOrderDetailId(detail.getId());
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
detailPayMoney = detailPayMoney.add(financialChangeRecords.get(0).getChangeMoney());
}
// 地址信息 // 地址信息
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId());
@ -172,9 +206,11 @@ public class OrderDetailController extends BaseController {
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl()); orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney()); orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney());
orderListResponse.setTotalMoney(financialDetail.getTotalMoney()); orderListResponse.setTotalMoney(financialDetail.getTotalMoney());
orderListResponse.setPayMoney(financialDetail.getPayMoney()); orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setWorkerName(worker.getName()); orderListResponse.setWorkerName(workerName);
orderListResponse.setWorkerPhone(worker.getPhone()); orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone());
orderListResponse.setMasterWorkerName(masterWorkerName);
orderListResponse.setMasterWorkerPhone(masterWorker == null ? "" : masterWorker.getPhone());
orderListResponse.setCustomerName(customerAddress.getName()); orderListResponse.setCustomerName(customerAddress.getName());
orderListResponse.setCustomerPhone(customerAddress.getPhone()); orderListResponse.setCustomerPhone(customerAddress.getPhone());
orderListResponse.setOrderStatus(detail.getOrderStatus()); orderListResponse.setOrderStatus(detail.getOrderStatus());
@ -218,6 +254,13 @@ public class OrderDetailController extends BaseController {
// 师傅信息 // 师傅信息
Worker worker = workerService.selectById(detail.getWorkerId()); Worker worker = workerService.selectById(detail.getWorkerId());
WorkerCertification workerRealInfo = null;
String workerName = "";
if (worker != null) {
// 师傅实名信息
workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId());
workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName();
}
// 消费者信息 // 消费者信息
// Customer customer = customerService.selectByCustomerId(detail.getCustomerId()); // Customer customer = customerService.selectByCustomerId(detail.getCustomerId());
@ -232,6 +275,14 @@ public class OrderDetailController extends BaseController {
// 财务信息 // 财务信息
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId()); FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
BigDecimal detailPayMoney = financialDetail.getPayMoney();
// 查询子单加价记录
FinancialChangeRecord changeRecordQry = new FinancialChangeRecord();
changeRecordQry.setOrderDetailId(detail.getId());
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
detailPayMoney = detailPayMoney.add(financialChangeRecords.get(0).getChangeMoney());
}
// 地址信息 // 地址信息
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId());
@ -261,9 +312,9 @@ public class OrderDetailController extends BaseController {
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl()); orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney()); orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney());
orderListResponse.setTotalMoney(financialDetail.getTotalMoney()); orderListResponse.setTotalMoney(financialDetail.getTotalMoney());
orderListResponse.setPayMoney(financialDetail.getPayMoney()); orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setWorkerName(worker.getName()); orderListResponse.setWorkerName(workerName);
orderListResponse.setWorkerPhone(worker.getPhone()); orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone());
orderListResponse.setCustomerName(customerAddress.getName()); orderListResponse.setCustomerName(customerAddress.getName());
orderListResponse.setCustomerPhone(customerAddress.getPhone()); orderListResponse.setCustomerPhone(customerAddress.getPhone());
orderListResponse.setOrderStatus(detail.getOrderStatus()); orderListResponse.setOrderStatus(detail.getOrderStatus());
@ -315,6 +366,13 @@ public class OrderDetailController extends BaseController {
// 师傅信息 // 师傅信息
Worker worker = workerService.selectById(detail.getWorkerId()); Worker worker = workerService.selectById(detail.getWorkerId());
WorkerCertification workerRealInfo = null;
String workerName = "";
if (worker != null) {
// 师傅实名信息
workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId());
workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName();
}
// 消费者信息 // 消费者信息
// Customer customer = customerService.selectByCustomerId(detail.getCustomerId()); // Customer customer = customerService.selectByCustomerId(detail.getCustomerId());
@ -329,6 +387,14 @@ public class OrderDetailController extends BaseController {
// 财务信息 // 财务信息
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId()); FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
BigDecimal detailPayMoney = financialDetail.getPayMoney();
// 查询子单加价记录
FinancialChangeRecord changeRecordQry = new FinancialChangeRecord();
changeRecordQry.setOrderDetailId(detail.getId());
List<FinancialChangeRecord> financialChangeRecords = financialChangeRecordService.selectFinancialChangeRecordList(changeRecordQry);
if (CollectionUtils.isNotEmpty(financialChangeRecords)) {
detailPayMoney = detailPayMoney.add(financialChangeRecords.get(0).getChangeMoney());
}
// 地址信息 // 地址信息
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId());
@ -358,9 +424,9 @@ public class OrderDetailController extends BaseController {
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl()); orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney()); orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney());
orderListResponse.setTotalMoney(financialDetail.getTotalMoney()); orderListResponse.setTotalMoney(financialDetail.getTotalMoney());
orderListResponse.setPayMoney(financialDetail.getPayMoney()); orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setWorkerName(worker.getName()); orderListResponse.setWorkerName(workerName);
orderListResponse.setWorkerPhone(worker.getPhone()); orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone());
orderListResponse.setCustomerName(customerAddress.getName()); orderListResponse.setCustomerName(customerAddress.getName());
orderListResponse.setCustomerPhone(customerAddress.getPhone()); orderListResponse.setCustomerPhone(customerAddress.getPhone());
orderListResponse.setOrderStatus(detail.getOrderStatus()); orderListResponse.setOrderStatus(detail.getOrderStatus());

View File

@ -261,6 +261,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<>();
@ -281,6 +284,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());
@ -310,7 +325,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());
@ -418,6 +434,7 @@ public class OrderMasterController extends BaseController {
orderStandardDetail.setRemark(orderDetail.getRemark()); orderStandardDetail.setRemark(orderDetail.getRemark());
orderStandardDetail.setPayMoney(detailPayMoney); orderStandardDetail.setPayMoney(detailPayMoney);
orderStandardDetail.setFinancialChangeRecord(financialChangeRecord); orderStandardDetail.setFinancialChangeRecord(financialChangeRecord);
orderStandardDetail.setOrderStatus(orderDetail.getOrderStatus());
AfterServiceRecord afterServiceRecord = new AfterServiceRecord(); AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
afterServiceRecord.setOrderDetailId(orderDetail.getId()); afterServiceRecord.setOrderDetailId(orderDetail.getId());

View File

@ -25,6 +25,10 @@ public class OrderListResponse {
private String workerPhone; private String workerPhone;
private String masterWorkerName;
private String masterWorkerPhone;
private String customerName; private String customerName;
private String customerPhone; private String customerPhone;

View File

@ -1,5 +1,6 @@
package com.ghy.web.pojo.vo; package com.ghy.web.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ghy.order.domain.AfterServiceRecord; import com.ghy.order.domain.AfterServiceRecord;
import com.ghy.payment.domain.FinancialChangeRecord; import com.ghy.payment.domain.FinancialChangeRecord;
import lombok.Data; import lombok.Data;
@ -21,8 +22,10 @@ public class OrderStandardDetail {
private Date revTime; private Date revTime;
@JsonFormat(pattern = "YYYY-MM-dd HH:mm")
private Date expectTimeStart; private Date expectTimeStart;
@JsonFormat(pattern = "HH:mm")
private Date expectTimeEnd; private Date expectTimeEnd;
private Date workBeginTime; private Date workBeginTime;
@ -41,4 +44,6 @@ public class OrderStandardDetail {
private List<AfterServiceRecord> afterServiceRecordList; private List<AfterServiceRecord> afterServiceRecordList;
private Integer orderStatus;
} }