Cui Zhi Feng
2024-08-30 7a9f0231bd3d0e6fc40caec1b84ecf86b4ee3197
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -591,6 +591,20 @@
            throw new ValidationException("处理数量不能大于商品数量");
        }
        List<OrderItemCheck> cLs = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>()
                .ne("type", dto.getType())
                .eq("order_item_id", dto.getOrderItemId())
        );
        int otherNum = 0;
        if(cLs != null && cLs.size() > 0){
            for(OrderItemCheck c : cLs){
                otherNum += c.getNum();
            }
        }
        if(otherNum + dto.getNum() > oi.getNum()){
            throw new ValidationException("处理总数量不能大于商品数量");
        }
        BigDecimal deduct = new BigDecimal(0);
        if(Constants.CHECK_TYPE.replace.name().equals(dto.getType())){
            deduct = oi.getSupplierPrice().multiply(new BigDecimal(dto.getNum()));