| | |
| | | } |
| | | |
| | | BigDecimal feeSupplier = getAmount(dto.getFeeSupplier()); |
| | | BigDecimal supplierTotal = oi.getSupplierPrice().multiply(new BigDecimal(sl.getNum()));//申请数量的供应商价格 |
| | | BigDecimal supplierTotal = getAmount(oi.getSupplierPrice()).multiply(new BigDecimal(sl.getNum()));//申请数量的供应商价格 |
| | | log.info(">>>>>>feeSupplier: " + feeSupplier.doubleValue()); |
| | | log.info(">>>>>>supplierTotal: " + supplierTotal.doubleValue()); |
| | | log.info(">>>>>>sl.getNum(): " + sl.getNum()); |
| | | //1.输入不能大于商品申请数量"供应商上架价格 |
| | | if(feeSupplier.doubleValue() > supplierTotal.doubleValue()){ |
| | | if(feeSupplier.compareTo(supplierTotal) > 0){ |
| | | throw new ValidationException("供应商扣款金额不能大于商品申请数量的供应商售价"); |
| | | } |
| | | |
| | | BigDecimal feePartner = getAmount(dto.getFeePartner()); |
| | | //合伙人输入框限制: |
| | | //1.输入金额不能大于输入金额申请数量"加价 |
| | | BigDecimal partnerTotal = oi.getMarkupPartner().multiply(new BigDecimal(sl.getNum()));//申请数量的合伙人加价 |
| | | if(feePartner.doubleValue() > partnerTotal.doubleValue()){ |
| | | BigDecimal partnerTotal = getAmount(oi.getMarkupPartner()).multiply(new BigDecimal(sl.getNum()));//申请数量的合伙人加价 |
| | | if(feePartner.compareTo(partnerTotal) > 0){ |
| | | throw new ValidationException("合伙人扣款金额不能大于商品申请数量的合伙人加价"); |
| | | } |
| | | |
| | |
| | | BigDecimal feePackingTransport = getAmount(dto.getFeePackingTransport()); |
| | | |
| | | BigDecimal totalFee = feeSupplier.add(feePartner).add(feePlatform).add(feePlatformPack) |
| | | .add(feePlatformCheck).add(feePlatformTransport).add(feePackingTransport); |
| | | .add(feePlatformCheck).add(feePlatformTransport); |
| | | |
| | | BigDecimal totalFeeWithPacking = totalFee.add(feePackingTransport); |
| | | |
| | | List<OrderItemSales> ls = orderItemSalesMapper.selectList(new QueryWrapper<OrderItemSales>() |
| | | .eq("order_item_id", oi.getId()) |
| | |
| | | int preNum = 0; |
| | | if(ls != null && ls.size() > 0){ |
| | | for(OrderItemSales s : ls){ |
| | | preFee = preFee.add(s.getTotalFee()); |
| | | preFee = preFee.add(s.getTotalFee()).subtract(s.getFeePackingTransport()); |
| | | preFeeSupplier = preFeeSupplier.add(s.getFeeSupplier()); |
| | | preNum += s.getNum(); |
| | | preFeePackingTransport = preFeePackingTransport.add(s.getFeePackingTransport()); |
| | |
| | | //打包运费限制不能超过订单的运费和打包费 |
| | | Order o = orderMapper.selectById(oi.getOrderId()); |
| | | BigDecimal packingTransport = getAmount(o.getPackingFee()).add(getAmount(o.getTransportFee())); |
| | | if(preFeePackingTransport.doubleValue() > packingTransport.doubleValue()){ |
| | | if(preFeePackingTransport.compareTo(packingTransport) > 0){ |
| | | throw new ValidationException("打包运费不能超过订单的运费和打包费"); |
| | | } |
| | | |
| | |
| | | if(sl.getNum() == leftNum){//剩下的所有的商品都售后时用减法计算 |
| | | st = oi.getRealTotal().subtract(oi.getRealPrice().multiply(new BigDecimal(usedNum))); |
| | | } |
| | | if(totalFee.doubleValue() > st.doubleValue()){ |
| | | if(totalFee.compareTo(st) > 0){ |
| | | throw new ValidationException("退款金额不能大于商品申请数量的售价"); |
| | | } |
| | | |
| | |
| | | .add(ois.getLackFeeSupplier()) |
| | | .add(ois.getReplaceFee()); |
| | | //2.不能大于商品购买数量"花材底价-质检总扣款-第一次售后全额扣供应商的全额 |
| | | if(preFeeSupplier.doubleValue() > supplierTotal.doubleValue()){ |
| | | if(preFeeSupplier.compareTo(supplierTotal) > 0){ |
| | | throw new ValidationException("供应商总扣款金额不能大于商品购买数量的供应商售价"); |
| | | } |
| | | |
| | |
| | | BigDecimal deduct = deliveryOrderService.calculateOrderItemDeduct(sl.getOrderItemId());//质检已扣款金额 |
| | | preFee = preFee.add(deduct); |
| | | //券后总金额-未申请售后的数量(商品购买数量-申请数量)券后单价 |
| | | if(preFee.doubleValue() > oi.getRealTotal().doubleValue()){ |
| | | if(preFee.compareTo(oi.getRealTotal()) > 0){ |
| | | throw new ValidationException("退款总金额(包含质检退款)不能大于商品总价"); |
| | | } |
| | | |
| | |
| | | sl.setFeePlatformCheck(feePlatformCheck); |
| | | sl.setFeePlatformTransport(feePlatformTransport); |
| | | sl.setFeePackingTransport(feePackingTransport); |
| | | sl.setTotalFee(totalFee); |
| | | sl.setTotalFee(totalFeeWithPacking); |
| | | sl.setStatus(status); |
| | | sl.setAuditTime(LocalDateTime.now()); |
| | | sl.update(SecurityUtils.getUserId()); |
| | | |
| | | if(Constants.ORDER_SALES_STATUS.AGREED.name().equals(sl.getStatus())){ |
| | | if(totalFee.doubleValue() > 0) { |
| | | String refundId = paymentV3Service.refundOrderSub(o, totalFee); |
| | | if(totalFeeWithPacking.doubleValue() > 0) { |
| | | String refundId = paymentV3Service.refundOrderSub(o, totalFeeWithPacking); |
| | | sl.setRefundId(refundId); |
| | | } |
| | | } |