guoyuji
2024-04-22 d6eec4bedc26fd823be5afed844d48ac0ecb3cf5
空指针问题
1个文件已修改
19 ■■■■■ 已修改文件
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -116,19 +116,22 @@
            OrderDetails.get(i).setWeight(1.0);
            Map<String,Double> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Double>>(){});
            int finalI = i;
            otherColumns.forEach((key, value) ->{
                orderOtherMoneyList.forEach(orderOtherMoney ->{
                    if(orderOtherMoney.getColumn().equals(key)){
                        orderOtherMoney.setQuantity (orderOtherMoney.getQuantity()==null?0:orderOtherMoney.getQuantity());
                        orderOtherMoney.setQuantity(((value==null?0:value)*OrderDetails.get(finalI).getQuantity()));
                    }
                });
            if(otherColumns!=null){
                otherColumns.forEach((key, value) ->{
                    orderOtherMoneyList.forEach(orderOtherMoney ->{
                        if(orderOtherMoney.getColumn().equals(key)){
                            orderOtherMoney.setQuantity (orderOtherMoney.getQuantity()==null?0:orderOtherMoney.getQuantity());
                            orderOtherMoney.setQuantity(((value==null?0:value)*OrderDetails.get(finalI).getQuantity()));
                        }
                    });
            });
                });
            }
        }
        //往明细表插数据
        orderDetailMapper.insertBatch(OrderDetails);
        //往小片表传入产品数据