guoyuji
2024-09-24 2f9b500fb9f81fb4d74d7156097f72bae7f6b0cb
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -217,9 +217,12 @@
    //插入其他副表数据,被其他方法引用
    public void insertOtherDetail(String orderId,List<OrderDetail> OrderDetails,List<OrderOtherMoney> orderOtherMoneyList) {
        //先把其他金额副表的金额与数量置0
        orderOtherMoneyList.forEach(orderOtherMoney -> {
            orderOtherMoney.setQuantity(0.0);
        });
        if(orderOtherMoneyList!=null){
            orderOtherMoneyList.forEach(orderOtherMoney -> {
                orderOtherMoney.setQuantity(0.0);
            });
        }
        //循环给订单明细表字段添加序号和周长
        for (int i = 0; i < OrderDetails.size(); i++) {
@@ -271,14 +274,17 @@
        orderDetailMapper.insertBatch(OrderDetails);
        //往小片表传入产品数据
        orderGlassDetailMapper.insertOrderGlassDetail(orderId);
        orderOtherMoneyList.forEach(orderOtherMoney ->{
            orderOtherMoney.setId(null);
            orderOtherMoney.setOrderId(orderId);
            if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){
                orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice()));
            }
            orderOtherMoneyMapper.insert(orderOtherMoney);
        });
        if(orderOtherMoneyList!=null){
            orderOtherMoneyList.forEach(orderOtherMoney ->{
                orderOtherMoney.setId(null);
                orderOtherMoney.setOrderId(orderId);
                if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){
                    orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice()));
                }
                orderOtherMoneyMapper.insert(orderOtherMoney);
            });
        }
        //修改订单主表面积与周长以及重量
        orderMapper.updateOrderParameter(orderId);
@@ -688,12 +694,33 @@
        JSONObject orderJson = new JSONObject(map);
        String oldOrderId = orderJson.getString("oldOrderId");
        String newOrderId = orderJson.getString("newOrderId");
        String orderIdType = orderJson.getString("orderIdType");
        Log log = new Log();
        log.setContent(map.toString());
        log.setFunction("updateOrderId修改订单号");
        log.setOperator(orderJson.getString("creator"));
        if(!Objects.equals(newOrderId, oldOrderId)){
            if(newOrderId.length()!=10){
                return "false4";
            }
            if(!newOrderId.substring(2, 10).matches("\\d+")){
                return "false5";
            }
            if(Objects.equals(orderIdType, "day")){
                if(orderMapper.selectOrderIdDay(oldOrderId)==1){
                    return "false6";
                }
            }else if(Objects.equals(orderIdType, "month")){
                if(orderMapper.selectOrderIdMonth(oldOrderId)==1){
                    return "false6";
                }
            }else if(Objects.equals(orderIdType, "year")){
                if(orderMapper.selectOrderIdYear(oldOrderId)==1){
                    return "false6";
                }
            }
            String substring = newOrderId.substring(1, 3);
            Integer substringInt = Integer.parseInt(newOrderId.substring(2, 10));
@@ -707,6 +734,7 @@
            if(count1>0 && count2==0){
                orderMapper.updateOrderId(oldOrderId,newOrderId);
                saveState= "true";
                logService.saveLog(log);
            }else if(count1==0){
                saveState= "false1";
                ;