guoyuji
2024-08-30 1c5cec37312c58cbc394778bdb649feafd2f8af3
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -232,22 +232,27 @@
            }
            Map<String,Object> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Object>>(){});
            otherColumns.values().removeIf(value -> value == null || value.equals(""));
            OrderDetails.get(i).setOtherColumns(JSON.toJSONString(otherColumns));
            int finalI = i;
            otherColumns.forEach((key, value) ->{
            if(otherColumns!=null){
                otherColumns.values().removeIf(value -> value == null || value.equals(""));
                OrderDetails.get(i).setOtherColumns(JSON.toJSONString(otherColumns));
                if(value!=null && !value.equals("") && key.contains("M")) {
                    orderOtherMoneyList.forEach(orderOtherMoney -> {
                        if (orderOtherMoney.getColumn().equals(key)) {
                            orderOtherMoney.setQuantity(
                                    orderOtherMoney.getQuantity()+(Double.parseDouble((String) value)  * OrderDetails.get(finalI).getQuantity()));
                        }
                    });
                }
                otherColumns.forEach((key, value) ->{
            });
                    if(value!=null && !value.equals("") && key.contains("M")) {
                        orderOtherMoneyList.forEach(orderOtherMoney -> {
                            if (orderOtherMoney.getColumn().equals(key)) {
                                orderOtherMoney.setQuantity(
                                        orderOtherMoney.getQuantity()+(Double.parseDouble((String) value)  * OrderDetails.get(finalI).getQuantity()));
                            }
                        });
                    }
                });
            }else{
                OrderDetails.get(i).setOtherColumns("{}");
            }
        }
@@ -383,6 +388,11 @@
            BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount());
            money+=getGrossAmount.doubleValue();
        }
        Log log = new Log();
        log.setOperator(order.getCreator());
        log.setOperatorId(order.getCreatorId());
        log.setContent(jsonObject.toString());
        log.setFunction("updateOrderMoney金额重置:"+order.getOrderId());
        orderOtherMoneyList.forEach(orderOtherMoney -> {
            if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){
@@ -396,6 +406,7 @@
        order.setOtherMoney(orderOtherMoneyMapper.selectGrossAmount(order.getOrderId()));
        orderMapper.updateMoney(order);
        orderDetailMapper.updateOrderMoney(OrderDetails);
        logService.saveLog(log);
        return false;
    }