| | |
| | | return ls; |
| | | } |
| | | |
| | | public List<DeliveryOrderItemDTO> getSupplierDeliveryOrderItemsByItemId(PostQueryDTO dto){ |
| | | List<String> idList = dto.getIds(); |
| | | List<DeliveryOrderItemDTO> ls = new ArrayList<>(); |
| | | if(idList != null && idList.size() > 0){ |
| | | for(String id : idList){ |
| | | DeliveryOrderItem item = deliveryOrderItemMapper.selectOne(new QueryWrapper<DeliveryOrderItem>() |
| | | .eq("order_item_id", id)); |
| | | ls.add(getSupplierDeliveryOrderItem(item)); |
| | | } |
| | | } |
| | | |
| | | return ls; |
| | | } |
| | | |
| | | public DeliveryOrderItemDTO getSupplierDeliveryOrderItem(String id) { |
| | | DeliveryOrderItem item = deliveryOrderItemMapper.selectById(id); |
| | | |
| | | return getSupplierDeliveryOrderItem(item); |
| | | } |
| | | |
| | | public DeliveryOrderItemDTO getSupplierDeliveryOrderItem(DeliveryOrderItem item) { |
| | | DeliveryOrderItemDTO dto = new DeliveryOrderItemDTO(); |
| | | |
| | | Supplier s = getCurrentSupplier(); |
| | | dto.setSupplierName(s.getName()); |
| | | |
| | | DeliveryOrderItem item = deliveryOrderItemMapper.selectById(id); |
| | | |
| | | Order d = orderMapper.selectById(item.getOrderId()); |
| | | dto.setOrderNo(d.getOrderNo()); |
| | | dto.setWarehouseName(d.getWarehouseName()); |
| | |
| | | } |
| | | deduct = deductAmount.multiply(new BigDecimal(dto.getNum())); |
| | | BigDecimal dt = realPrice.multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > dt.doubleValue() |
| | | || (oi.getRealTotal() != null && deduct.doubleValue() > oi.getRealTotal().doubleValue())){ |
| | | if(deduct.compareTo(dt) > 0 |
| | | || (oi.getRealTotal() != null && deduct.compareTo(oi.getRealTotal()) > 0)){ |
| | | throw new ValidationException("降级金额不能大于商品处理数量的支付的金额"); |
| | | } |
| | | BigDecimal st = oi.getSupplierPrice().multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > st.doubleValue()){ |
| | | if(deduct.compareTo(st) > 0){ |
| | | throw new ValidationException("降级金额不能大于商品处理数量的供应商的金额"); |
| | | } |
| | | } |