退款增加金额校验,增加售后撤销功能

This commit is contained in:
donqi 2022-10-06 03:04:41 +08:00
parent 2c6e0c788a
commit 37befabb49
4 changed files with 25 additions and 6 deletions

View File

@ -1,9 +1,11 @@
package com.ghy.web.controller.order; package com.ghy.web.controller.order;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; 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.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -34,7 +36,7 @@ public class AfterServiceRecordController extends BaseController
private IAfterServiceRecordService afterServiceRecordService; private IAfterServiceRecordService afterServiceRecordService;
@Autowired @Autowired
private OrderDetailService orderDetailService; private FinancialDetailService financialDetailService;
@RequiresPermissions("worker:record:view") @RequiresPermissions("worker:record:view")
@GetMapping() @GetMapping()
@ -111,6 +113,11 @@ public class AfterServiceRecordController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult addSave(@RequestBody AfterServiceRecord afterServiceRecord) 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)); 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) @Log(title = "售后记录", businessType = BusinessType.DELETE)
@PostMapping( "/remove") @PostMapping( "/remove")
@ResponseBody @ResponseBody

View File

@ -29,8 +29,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.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.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;
@ -52,6 +54,7 @@ import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -88,6 +91,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;
@ -614,11 +619,15 @@ public class OrderMasterController extends BaseController {
workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName(); workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getName();
} }
// 查询子财务单金额
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
OrderStandardDetail detailRes = new OrderStandardDetail(); OrderStandardDetail detailRes = new OrderStandardDetail();
detailRes.setOrderDetailId(detail.getId()); detailRes.setOrderDetailId(detail.getId());
detailRes.setOrderDetailCode(detail.getCode()); detailRes.setOrderDetailCode(detail.getCode());
detailRes.setWorkerName(workerName); detailRes.setWorkerName(workerName);
detailRes.setRemark(workerName + "(" + detail.getCode() + ")"); detailRes.setRemark(workerName + "(" + detail.getCode() + ")");
detailRes.setPayMoney(financialDetail != null ? financialDetail.getPayMoney() : new BigDecimal(0));
orderStandardDetails.add(detailRes); orderStandardDetails.add(detailRes);
}); });
return AjaxResult.success(orderStandardDetails); return AjaxResult.success(orderStandardDetails);

View File

@ -3,6 +3,7 @@ package com.ghy.web.pojo.vo;
import com.ghy.order.domain.AfterServiceRecord; import com.ghy.order.domain.AfterServiceRecord;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -27,6 +28,8 @@ public class OrderStandardDetail {
private Date workFinishTime; private Date workFinishTime;
private BigDecimal payMoney;
private String remark; private String remark;
private List<OrderStandard> orderStandardList; private List<OrderStandard> orderStandardList;

View File

@ -109,11 +109,11 @@
</update> </update>
<delete id="deleteAfterServiceRecordById" parameterType="String"> <delete id="deleteAfterServiceRecordById" parameterType="String">
delete from after_service_record where id = #{id} delete from after_service_record where customer_final_check != 1 and id = #{id}
</delete> </delete>
<delete id="deleteAfterServiceRecordByIds" parameterType="String"> <delete id="deleteAfterServiceRecordByIds" parameterType="String">
delete from after_service_record where id in delete from after_service_record where customer_final_check != 1 and id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>