From dc1067c6f1369db2c92ce697f2e24777e9d1dab3 Mon Sep 17 00:00:00 2001 From: "kuang.yifei@iwhalecloud.com" Date: Thu, 9 Jun 2022 17:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=88=E5=82=85=E9=82=A3=E8=BE=B9=E7=BB=86?= =?UTF-8?q?=E5=8D=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/OrderDetailController.java | 103 ++++++++++++++++++ .../payment/mapper/FinancialDetailMapper.java | 6 + .../service/FinancialDetailService.java | 7 +- .../impl/FinancialDetailServiceImpl.java | 5 + .../financial/FinancialDetailMapper.xml | 6 + 5 files changed, 126 insertions(+), 1 deletion(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java index b9a69ddc..c037d996 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java @@ -7,15 +7,36 @@ import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.enums.BusinessType; import com.ghy.common.utils.poi.ExcelUtil; +import com.ghy.customer.domain.Customer; +import com.ghy.customer.domain.CustomerAddress; +import com.ghy.customer.service.CustomerAddressService; +import com.ghy.customer.service.CustomerService; +import com.ghy.goods.domain.Goods; +import com.ghy.goods.domain.GoodsStandard; +import com.ghy.goods.service.GoodsService; +import com.ghy.goods.service.GoodsStandardService; import com.ghy.order.domain.OrderDetail; +import com.ghy.order.domain.OrderGoods; +import com.ghy.order.domain.OrderMaster; import com.ghy.order.service.OrderDetailService; +import com.ghy.order.service.OrderGoodsService; +import com.ghy.order.service.OrderMasterService; +import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.domain.FinancialMaster; +import com.ghy.payment.service.FinancialDetailService; +import com.ghy.web.pojo.vo.OrderListResponse; +import com.ghy.web.pojo.vo.OrderStandard; +import com.ghy.worker.domain.Worker; +import com.ghy.worker.service.WorkerService; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -31,6 +52,22 @@ public class OrderDetailController extends BaseController { @Resource private OrderDetailService orderDetailService; + @Autowired + private OrderMasterService orderMasterService; + @Autowired + private CustomerService customerService; + @Autowired + private WorkerService workerService; + @Autowired + private OrderGoodsService orderGoodsService; + @Autowired + private CustomerAddressService addressService; + @Autowired + private GoodsService goodsService; + @Autowired + private GoodsStandardService goodsStandardService; + @Autowired + private FinancialDetailService financialDetailService; @RequiresPermissions("order:detail:view") @GetMapping() @@ -47,6 +84,72 @@ public class OrderDetailController extends BaseController { return getDataTable(orderDetailList); } + @PostMapping("/app/list") + @ResponseBody + public TableDataInfo appList(OrderDetail orderDetail){ + + startPage(); + List orderListResponses = new ArrayList<>(); + List list = orderDetailService.selectOrderDetailList(orderDetail); + list.forEach(detail->{ + + // 主单信息 + OrderMaster orderMaster = orderMasterService.selectById(detail.getOrderMasterId()); + // 初始化属性 + OrderListResponse orderListResponse = new OrderListResponse(); + List standardList = new ArrayList<>(); + + // 师傅信息 + Worker worker = workerService.selectById(detail.getWorkerId()); + + // 消费者信息 + Customer customer = customerService.selectByCustomerId(detail.getCustomerId()); + + // 商品规格及信息 + List orderStandardList = orderGoodsService.selectByOrderMasterId(detail.getId()); + + // 商品信息 + GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId()); + + Goods goods = goodsService.selectById(goodsStandard.getGoodsId()); + + // 财务信息 + FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId()); + + // 地址信息 + CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); + + for(OrderGoods orderGoods : orderStandardList){ + OrderStandard orderStandard = new OrderStandard(); + orderStandard.setStandardName(orderGoods.getGoodsName()); + orderStandard.setStandardNum(orderGoods.getGoodsNum()); + standardList.add(orderStandard); + } + + // 编辑返回属性 + orderListResponse.setOrderMasterId(detail.getId()); + orderListResponse.setGoodsName(goods.getGoodsName()); + orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl()); + orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney()); + orderListResponse.setTotalMoney(financialDetail.getTotalMoney()); + orderListResponse.setPayMoney(financialDetail.getPayMoney()); + orderListResponse.setWorkerName(worker.getName()); + orderListResponse.setWorkerPhone(worker.getPhone()); + orderListResponse.setCustomerName(customer.getName()); + orderListResponse.setCustomerPhone(customer.getPhone()); + orderListResponse.setServerTime(detail.getWorkBeginTime()); + orderListResponse.setOrderStatus(detail.getOrderStatus()); + orderListResponse.setPayStatus(orderMaster.getPayStatus()); + orderListResponse.setPayType(orderMaster.getPayType()); + orderListResponse.setOrderMasterCode(detail.getCode()); + orderListResponse.setStandardList(standardList); + orderListResponse.setAddress(customerAddress.getAddress()); + orderListResponses.add(orderListResponse); + + }); + return voDataTable(orderListResponses, list); + } + @Log(title = "详细订单管理", businessType = BusinessType.EXPORT) @RequiresPermissions("order:detail:export") @PostMapping("/export") diff --git a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java index 0c4a87bb..f972ed00 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java +++ b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java @@ -18,6 +18,12 @@ public interface FinancialDetailMapper { */ List count(FinancialCountResponse response); + /** + * @param orderDetailId 细单id + * @return 细单关联财务单 + */ + FinancialDetail selectByOrderDetailId(@Param("orderDetailId") Long orderDetailId); + /** * @param financialDetail 财务细单属性 * @return 成功条数 diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java index ddd3babf..2e410989 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java @@ -15,11 +15,16 @@ public interface FinancialDetailService { /** * @param countTime 是否查询准确时间 - * @param flag 0收入 1支出 * @return 月份集合 */ List count(String countTime); + /** + * @param orderDetailId 细单id + * @return 细单关联财务单 + */ + FinancialDetail selectByOrderDetailId(Long orderDetailId); + /** * @param financialDetail 财务细单属性 * @return 成功条数 diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java index 74c794f9..a3fab1b2 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java @@ -57,6 +57,11 @@ public class FinancialDetailServiceImpl implements FinancialDetailService { } + @Override + public FinancialDetail selectByOrderDetailId(Long orderDetailId) { + return financialDetailMapper.selectByOrderDetailId(orderDetailId); + } + @Override public int insertFinancialDetail(FinancialDetail financialDetail) { return financialDetailMapper.insertFinancialDetail(financialDetail); diff --git a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml index 69dabbbd..21586253 100644 --- a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml +++ b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml @@ -107,6 +107,12 @@ pay_status = 1 WHERE reverse_id = #{reverseId} + +