From 37befabb49b9ce7f5b71b413ed0ea4a7a084c175 Mon Sep 17 00:00:00 2001 From: donqi Date: Thu, 6 Oct 2022 03:04:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=A2=9E=E5=8A=A0=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E6=A0=A1=E9=AA=8C=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E6=92=A4=E9=94=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/AfterServiceRecordController.java | 13 ++++++++++--- .../web/controller/order/OrderMasterController.java | 9 +++++++++ .../com/ghy/web/pojo/vo/OrderStandardDetail.java | 3 +++ .../mapper/order/AfterServiceRecordMapper.xml | 6 +++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/AfterServiceRecordController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/AfterServiceRecordController.java index 4550f246..da6bdfd3 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/AfterServiceRecordController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/AfterServiceRecordController.java @@ -1,9 +1,11 @@ package com.ghy.web.controller.order; +import java.math.BigDecimal; import java.util.List; import java.util.stream.Collectors; -import com.ghy.order.service.OrderDetailService; +import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.service.FinancialDetailService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -34,7 +36,7 @@ public class AfterServiceRecordController extends BaseController private IAfterServiceRecordService afterServiceRecordService; @Autowired - private OrderDetailService orderDetailService; + private FinancialDetailService financialDetailService; @RequiresPermissions("worker:record:view") @GetMapping() @@ -111,6 +113,11 @@ public class AfterServiceRecordController extends BaseController @ResponseBody public AjaxResult addSave(@RequestBody AfterServiceRecord afterServiceRecord) { + FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(afterServiceRecord.getOrderDetailId()); + if ((afterServiceRecord.getRefund() != null && afterServiceRecord.getRefund().compareTo(financialDetail.getPayMoney()) > 0) + || (afterServiceRecord.getAgreedRefund() != null && afterServiceRecord.getAgreedRefund().compareTo(financialDetail.getPayMoney()) > 0)) { + return AjaxResult.error("退款金额超出子单最大可退金额"); + } return toAjax(afterServiceRecordService.insertAfterServiceRecord(afterServiceRecord)); } @@ -140,7 +147,7 @@ public class AfterServiceRecordController extends BaseController /** * 删除售后记录 */ - @RequiresPermissions("worker:record:remove") +// @RequiresPermissions("worker:record:remove") @Log(title = "售后记录", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java index c4972ad2..062cd542 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java @@ -29,8 +29,10 @@ import com.ghy.order.service.IAfterServiceRecordService; 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.domain.OrderTimeoutRecord; +import com.ghy.payment.service.FinancialDetailService; import com.ghy.payment.service.FinancialMasterService; import com.ghy.payment.service.OrderFineRecordService; import com.ghy.system.domain.SysArea; @@ -52,6 +54,7 @@ import org.springframework.ui.ModelMap; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -88,6 +91,8 @@ public class OrderMasterController extends BaseController { @Autowired private FinancialMasterService financialMasterService; @Autowired + private FinancialDetailService financialDetailService; + @Autowired private GoodsStandardService goodsStandardService; @Autowired private OrderFineRecordService orderFineRecordService; @@ -614,11 +619,15 @@ public class OrderMasterController extends BaseController { workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName(); } + // 查询子财务单金额 + FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId()); + OrderStandardDetail detailRes = new OrderStandardDetail(); detailRes.setOrderDetailId(detail.getId()); detailRes.setOrderDetailCode(detail.getCode()); detailRes.setWorkerName(workerName); detailRes.setRemark(workerName + "(" + detail.getCode() + ")"); + detailRes.setPayMoney(financialDetail != null ? financialDetail.getPayMoney() : new BigDecimal(0)); orderStandardDetails.add(detailRes); }); return AjaxResult.success(orderStandardDetails); diff --git a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderStandardDetail.java b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderStandardDetail.java index 505c0728..dc018a6f 100644 --- a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderStandardDetail.java +++ b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderStandardDetail.java @@ -3,6 +3,7 @@ package com.ghy.web.pojo.vo; import com.ghy.order.domain.AfterServiceRecord; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -27,6 +28,8 @@ public class OrderStandardDetail { private Date workFinishTime; + private BigDecimal payMoney; + private String remark; private List orderStandardList; diff --git a/ghy-order/src/main/resources/mapper/order/AfterServiceRecordMapper.xml b/ghy-order/src/main/resources/mapper/order/AfterServiceRecordMapper.xml index 93472abb..b01e3322 100644 --- a/ghy-order/src/main/resources/mapper/order/AfterServiceRecordMapper.xml +++ b/ghy-order/src/main/resources/mapper/order/AfterServiceRecordMapper.xml @@ -109,14 +109,14 @@ - delete from after_service_record where id = #{id} + delete from after_service_record where customer_final_check != 1 and id = #{id} - delete from after_service_record where id in + delete from after_service_record where customer_final_check != 1 and id in #{id} - \ No newline at end of file +