| | |
| | | @Autowired |
| | | private OrderItemCheckMapper orderItemCheckMapper; |
| | | |
| | | @Autowired |
| | | private DeliveryOrderService deliveryOrderService; |
| | | |
| | | public String createSales(OrderItemSalesCreateDTO dto){ |
| | | Integer num = dto.getNum(); |
| | | if(num == null || num == 0){ |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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()); |
| | |
| | | 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); |