src/main/java/com/mzl/flower/dto/response/payment/OrderItemListDTO.java
@@ -68,4 +68,10 @@ @ApiModelProperty(value = "缺货数量") private Integer lackNum; @ApiModelProperty(value = "优惠券总金额") private BigDecimal couponAmountTotal; @ApiModelProperty(value = "真实成交总价格") private BigDecimal realTotal; } src/main/java/com/mzl/flower/dto/response/payment/OrderItemSalesNewDTO.java
@@ -37,4 +37,13 @@ @ApiModelProperty(value = "下单时间") private LocalDateTime orderTime; @ApiModelProperty(value = "降级数量") private Integer reduceNum; @ApiModelProperty(value = "降级金额") private BigDecimal reduceAmount; @ApiModelProperty(value = "补货数量") private Integer replaceNum; } src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -573,7 +573,7 @@ orderItemSettlementService.saveItemSettlementInfo(oi, SecurityUtils.getUserId(), Constants.S_TYPE.CHECK); } private BigDecimal calculateOrderItemDeduct(String id){ public BigDecimal calculateOrderItemDeduct(String id){ List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() .eq("order_item_id", id) .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) @@ -696,7 +696,11 @@ BigDecimal dt = realPrice.multiply(new BigDecimal(dto.getNum())); if(deduct.doubleValue() > dt.doubleValue() || (oi.getRealTotal() != null && deduct.doubleValue() > oi.getRealTotal().doubleValue())){ throw new ValidationException("降级金额不能大于商品处理数量金额"); throw new ValidationException("降级金额不能大于商品处理数量的支付的金额"); } BigDecimal st = oi.getSupplierPrice().multiply(new BigDecimal(dto.getNum())); if(deduct.doubleValue() > st.doubleValue()){ throw new ValidationException("降级金额不能大于商品处理数量的供应商的金额"); } } src/main/java/com/mzl/flower/service/payment/OrderItemSalesService.java
@@ -67,6 +67,9 @@ @Autowired private OrderItemCheckMapper orderItemCheckMapper; @Autowired private DeliveryOrderService deliveryOrderService; public String createSales(OrderItemSalesCreateDTO dto){ Integer num = dto.getNum(); if(num == null || num == 0){ @@ -295,6 +298,27 @@ rr.setStationName(s.getName()); } List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() .eq("order_item_id", oi.getId()) .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) ); int reduceNum = 0; BigDecimal reduceAmount = new BigDecimal(0); int replaceNum = 0; if(cLs != null && cLs.size() > 0){ for(OrderItemCheck c : cLs){ if(Constants.CHECK_TYPE.reduce.name().equals(c.getType())){ reduceNum += c.getNum(); reduceAmount = reduceAmount.add(c.getDeductAmount()); } else if(Constants.CHECK_TYPE.replace.name().equals(c.getType())){ replaceNum += c.getNum(); } } } rr.setReduceNum(reduceNum); rr.setReduceAmount(reduceAmount); rr.setReplaceNum(replaceNum); return rr; } @@ -313,6 +337,11 @@ } BigDecimal feeSupplier = getAmount(dto.getFeeSupplier()); BigDecimal supplierTotal = oi.getSupplierPrice().multiply(new BigDecimal(sl.getNum())); if(feeSupplier.doubleValue() > supplierTotal.doubleValue()){ throw new ValidationException("供应商扣款金额不能大于商品申请数量的供应商售价"); } BigDecimal feePartner = getAmount(dto.getFeePartner()); BigDecimal feePlatform = getAmount(dto.getFeePlatform()); BigDecimal feePlatformPack = getAmount(dto.getFeePlatformPack()); @@ -342,6 +371,12 @@ throw new ValidationException("退款总金额不能大于商品总价"); } BigDecimal deduct = deliveryOrderService.calculateOrderItemDeduct(sl.getOrderItemId());//质检已扣款金额 preFee = preFee.add(deduct); if(preFee.doubleValue() > oi.getRealTotal().doubleValue()){ throw new ValidationException("退款总金额(包含质检退款)不能大于商品总价"); } sl.setRemarks(dto.getRemarks()); sl.setFeeSupplier(feeSupplier); sl.setFeePartner(feePartner); src/main/resources/mapper/payment/OrderMapper.xml
@@ -133,6 +133,7 @@ and (oi.status = 'reduce' or oi.status = 'abnormal') ) and q.transfer_id is null and q.status in ('COLLECTION', 'SEND') </if> <if test="condition.billId != null and condition.billId != ''"> AND q.bill_id = #{condition.billId}