| | |
| | | |
| | | BigDecimal feeSupplier = getAmount(dto.getFeeSupplier()); |
| | | BigDecimal supplierTotal = getAmount(oi.getSupplierPrice()).multiply(new BigDecimal(sl.getNum()));//申请数量的供应商价格 |
| | | log.info(">>>>>>feeSupplier: " + feeSupplier); |
| | | log.info(">>>>>>supplierTotal: " + supplierTotal); |
| | | 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("供应商扣款金额不能大于商品申请数量的供应商售价"); |
| | | } |
| | | |
| | |
| | | //合伙人输入框限制: |
| | | //1.输入金额不能大于输入金额申请数量"加价 |
| | | BigDecimal partnerTotal = getAmount(oi.getMarkupPartner()).multiply(new BigDecimal(sl.getNum()));//申请数量的合伙人加价 |
| | | if(feePartner.doubleValue() > partnerTotal.doubleValue()){ |
| | | if(feePartner.compareTo(partnerTotal) > 0){ |
| | | throw new ValidationException("合伙人扣款金额不能大于商品申请数量的合伙人加价"); |
| | | } |
| | | |
| | |
| | | //打包运费限制不能超过订单的运费和打包费 |
| | | 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("退款总金额(包含质检退款)不能大于商品总价"); |
| | | } |
| | | |