浏览代码

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

laibulaizheli 2 天之前
父节点
当前提交
f9ce029a76

+ 164 - 179
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -2125,53 +2125,136 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         Map<String, String> stringStringMap = dataMaps.get(initTabName);
 
                         //CL08水准测量记录表(监理)
-                        if (levelingTableName.equals(initTabName)) {
-                            //设计标高
-                            String designedElevationNew = stringStringMap.get(designedElevation);
-                            HashMap<Integer, BigDecimal> designedElevationNewMap = new HashMap<>();
-                            //偏差
-                            String heightDeviationNew = stringStringMap.get(heightDeviation);
-                            HashMap<Integer, BigDecimal> heightDeviationNewMap = new HashMap<>();
-                            //实际标高
-                            String actualElevationNew = stringStringMap.get(actualElevation);
-
-                            //记录数量
-                            Integer rowMin = null;
-                            Integer rowMax = null;
-
-                            for (int i = 0; i < keys.size(); i++) {
-                                if (!Objects.equals(keys.get(i), designedElevationNew) && !Objects.equals(keys.get(i), heightDeviationNew)) {
-                                    continue;
+                        try {
+                            if (levelingTableName.equals(initTabName)) {
+                                //设计标高
+                                String designedElevationNew = stringStringMap.get(designedElevation);
+                                HashMap<Integer, BigDecimal> designedElevationNewMap = new HashMap<>();
+                                //偏差
+                                String heightDeviationNew = stringStringMap.get(heightDeviation);
+                                HashMap<Integer, BigDecimal> heightDeviationNewMap = new HashMap<>();
+                                //实际标高
+                                String actualElevationNew = stringStringMap.get(actualElevation);
+                                //记录数量
+                                Integer rowMin = null;
+                                Integer rowMax = null;
+                                for (int i = 0; i < keys.size(); i++) {
+                                    if (!Objects.equals(keys.get(i), designedElevationNew) && !Objects.equals(keys.get(i), heightDeviationNew)) {
+                                        continue;
+                                    }
+                                    String value = values.get(i);
+                                    //拆分数据
+                                    String[] split1 = value.split("☆");
+                                    List<String> heightDeviationList = new ArrayList<>();
+                                    for (String s : split1) {
+                                        String[] split2 = s.split("_\\^_");
+                                        int rowNum = Integer.parseInt(split2[1].split("_")[0]);
+                                        //获取最大行数
+                                        if (rowMax == null) {
+                                            rowMax = rowNum;
+                                        } else if (rowMax < rowNum) {
+                                            rowMax = rowNum;
+                                        }
+                                        //获取最小行数
+                                        if (rowMin == null) {
+                                            rowMin = rowNum;
+                                        } else if (rowMin > rowNum) {
+                                            rowMin = rowNum;
+                                        }
+                                        if (keys.get(i).equals(designedElevationNew)) {
+                                            //设计标高
+                                            designedElevationNewMap.put(rowNum, new BigDecimal(split2[0]));
+                                        } else if (keys.get(i).equals(heightDeviationNew)) {
+                                            if (StringUtils.isNotEmpty(split2[0])) {
+                                                double v = Double.parseDouble(split2[0]);
+                                                //随机+ - 0/1
+                                                Random random = new Random();
+                                                int adjustment = random.nextInt(2);
+                                                if (v > 0) {
+                                                    v = v - adjustment;
+                                                } else {
+                                                    v = v + adjustment;
+                                                }
+                                                //高度偏差
+                                                heightDeviationNewMap.put(rowNum, BigDecimal.valueOf(v));
+                                                heightDeviationList.add(new BigDecimal(v).setScale(0, RoundingMode.HALF_UP).intValue() + "_^_" + split2[1]);
+                                            }
+                                        }
+                                    }
+                                    //设置偏高的值
+                                    if (CollectionUtil.isNotEmpty(heightDeviationList)) {
+                                        values.set(i, String.join("☆", heightDeviationList));
+                                    }
                                 }
-
-
-                                String value = values.get(i);
-                                //拆分数据
-                                String[] split1 = value.split("☆");
-
-                                List<String> heightDeviationList = new ArrayList<>();
-                                for (String s : split1) {
-                                    String[] split2 = s.split("_\\^_");
-                                    int rowNum = Integer.parseInt(split2[1].split("_")[0]);
-                                    //获取最大行数
-                                    if (rowMax == null) {
-                                        rowMax = rowNum;
-                                    } else if (rowMax < rowNum) {
-                                        rowMax = rowNum;
+                                if (rowMin != null) {
+                                    List<String> list = new ArrayList<>();
+                                    //获取当前key对应的坐标
+                                    Set<String> strings = coordinateMap.get(initTabName);
+                                    String index = null;
+                                    for (String string : strings) {
+                                        String[] split = string.split("__");
+                                        if (Objects.equals(split[0], actualElevationNew)) {
+                                            index = split[1];
+                                        }
                                     }
-                                    //获取最小行数
-                                    if (rowMin == null) {
-                                        rowMin = rowNum;
-                                    } else if (rowMin > rowNum) {
-                                        rowMin = rowNum;
+                                    //按照最小行数来计算
+                                    for (int i = rowMin; i <= rowMax; i++) {
+                                        BigDecimal designed = designedElevationNewMap.get(i);
+                                        BigDecimal height = heightDeviationNewMap.get(i);
+                                        if (designed == null || height == null) {
+                                            continue;
+                                        }
+                                        BigDecimal v = designed.add(height.divide(new BigDecimal(1000)));
+                                        //第5列,索引为4
+                                        list.add(v.doubleValue() + "_^_" + i + "_" + index);
                                     }
-
-                                    if (keys.get(i).equals(designedElevationNew)) {
-                                        //设计标高
-                                        designedElevationNewMap.put(rowNum, new BigDecimal(split2[0]));
-                                    } else if (keys.get(i).equals(heightDeviationNew)) {
+                                    //未获取到当前key的坐标就不设置值
+                                    if (index != null) {
+                                        //设置实际标高的值
+                                        if (keys.indexOf(actualElevationNew) > -1) {
+                                            values.set(keys.indexOf(actualElevationNew), String.join("☆", list));
+                                        } else {
+                                            keys.add(actualElevationNew);
+                                            values.add(String.join("☆", list));
+                                        }
+                                    }
+                                }
+                            } else if (planePositionTableName.equals(initTabName)) {
+                                //CL10平面位置检测记录表(监理)
+                                //差值
+                                String differenceNewX = stringStringMap.get(difference + "X");
+                                HashMap<Integer, BigDecimal> differenceNewXMap = new HashMap<>();
+                                String differenceNewY = stringStringMap.get(difference + "Y");
+                                HashMap<Integer, BigDecimal> differenceNewYMap = new HashMap<>();
+                                String deviationNew = stringStringMap.get(deviation);
+                                //记录数量
+                                Integer rowMin = null;
+                                Integer rowMax = null;
+                                for (int i = 0; i < keys.size(); i++) {
+                                    if (!Objects.equals(keys.get(i), differenceNewX) && !Objects.equals(keys.get(i), differenceNewY)) {
+                                        continue;
+                                    }
+                                    String value = values.get(i);
+                                    //拆分数据
+                                    String[] split1 = value.split("☆");
+                                    List<String> list = new ArrayList<>();
+                                    for (String s : split1) {
+                                        String[] split2 = s.split("_\\^_");
+                                        int rowNum = Integer.parseInt(split2[1].split("_")[0]);
+                                        //获取最大行数
+                                        if (rowMax == null) {
+                                            rowMax = rowNum;
+                                        } else if (rowMax < rowNum) {
+                                            rowMax = rowNum;
+                                        }
+                                        //获取最小行数
+                                        if (rowMin == null) {
+                                            rowMin = rowNum;
+                                        } else if (rowMin > rowNum) {
+                                            rowMin = rowNum;
+                                        }
                                         if (StringUtils.isNotEmpty(split2[0])) {
-                                            double v = Double.parseDouble(split2[0]);
+                                            Integer v = Integer.parseInt(split2[0]);
                                             //随机+ - 0/1
                                             Random random = new Random();
                                             int adjustment = random.nextInt(2);
@@ -2180,152 +2263,54 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                             } else {
                                                 v = v + adjustment;
                                             }
-
-                                            //高度偏差
-                                            heightDeviationNewMap.put(rowNum, BigDecimal.valueOf(v));
-
-                                            heightDeviationList.add(new BigDecimal(v).setScale(0, RoundingMode.HALF_UP).intValue() + "_^_" + split2[1]);
+                                            if (keys.get(i).equals(differenceNewX)) {
+                                                //偏差X
+                                                differenceNewXMap.put(rowNum, new BigDecimal(split2[0]));
+                                            } else if (keys.get(i).equals(differenceNewY)) {
+                                                //偏差Y
+                                                differenceNewYMap.put(rowNum, BigDecimal.valueOf(v));
+                                            }
+                                            list.add(v + "_^_" + split2[1]);
                                         }
                                     }
+                                    values.set(i, String.join("☆", list));
                                 }
-                                //设置偏高的值
-                                if (CollectionUtil.isNotEmpty(heightDeviationList)) {
-                                    values.set(i, String.join("☆", heightDeviationList));
-                                }
-                            }
-                            if (rowMin != null) {
-                                List<String> list = new ArrayList<>();
-
-                                //获取当前key对应的坐标
-                                Set<String> strings = coordinateMap.get(initTabName);
-                                String index = null;
-                                for (String string : strings) {
-                                    String[] split = string.split("__");
-                                    if (Objects.equals(split[0], actualElevationNew)) {
-                                        index = split[1];
-                                    }
-                                }
-                                //按照最小行数来计算
-                                for (int i = rowMin; i <= rowMax; i++) {
-                                    BigDecimal designed = designedElevationNewMap.get(i);
-                                    BigDecimal height = heightDeviationNewMap.get(i);
-
-                                    if (designed == null || height == null) {
-                                        continue;
-                                    }
-                                    BigDecimal v = designed.add(height.divide(new BigDecimal(1000)));
-                                    //第5列,索引为4
-                                    list.add(v.doubleValue() + "_^_" + i + "_" + index);
-                                }
-                                //未获取到当前key的坐标就不设置值
-                                if (index != null) {
-                                    //设置实际标高的值
-                                    if (keys.indexOf(actualElevationNew) > -1) {
-                                        values.set(keys.indexOf(actualElevationNew), String.join("☆", list));
-                                    } else {
-                                        keys.add(actualElevationNew);
-                                        values.add(String.join("☆", list));
-                                    }
-                                }
-                            }
-
-                        } else if (planePositionTableName.equals(initTabName)) {
-                            //CL10平面位置检测记录表(监理)
-                            //差值
-                            String differenceNewX = stringStringMap.get(difference + "X");
-                            HashMap<Integer, BigDecimal> differenceNewXMap = new HashMap<>();
-
-                            String differenceNewY = stringStringMap.get(difference + "Y");
-                            HashMap<Integer, BigDecimal> differenceNewYMap = new HashMap<>();
-
-
-                            String deviationNew = stringStringMap.get(deviation);
-                            //记录数量
-                            Integer rowMin = null;
-                            Integer rowMax = null;
-                            for (int i = 0; i < keys.size(); i++) {
-                                if (!Objects.equals(keys.get(i), differenceNewX) && !Objects.equals(keys.get(i), differenceNewY)) {
-                                    continue;
-                                }
-
-                                String value = values.get(i);
-                                //拆分数据
-                                String[] split1 = value.split("☆");
-
-                                List<String> list = new ArrayList<>();
-
-                                for (String s : split1) {
-                                    String[] split2 = s.split("_\\^_");
-                                    int rowNum = Integer.parseInt(split2[1].split("_")[0]);
-                                    //获取最大行数
-                                    if (rowMax == null) {
-                                        rowMax = rowNum;
-                                    } else if (rowMax < rowNum) {
-                                        rowMax = rowNum;
+                                if (rowMin != null) {
+                                    List<String> list = new ArrayList<>();
+                                    //获取当前key对应的坐标
+                                    Set<String> strings = coordinateMap.get(initTabName);
+                                    String index = null;
+                                    for (String string : strings) {
+                                        String[] split = string.split("__");
+                                        if (Objects.equals(split[0], deviationNew)) {
+                                            index = split[1];
+                                        }
                                     }
-                                    //获取最小行数
-                                    if (rowMin == null) {
-                                        rowMin = rowNum;
-                                    } else if (rowMin > rowNum) {
-                                        rowMin = rowNum;
+                                    //按照最小行数来计算
+                                    for (int i = rowMin; i <= rowMax; i++) {
+                                        BigDecimal x = differenceNewXMap.get(i);
+                                        BigDecimal y = differenceNewYMap.get(i);
+                                        if (x == null || y == null) {
+                                            continue;
+                                        }
+                                        BigDecimal sqrt = sqrt(x.multiply(x).add(y.multiply(y)), 0);
+                                        //第9列,索引为8
+                                        list.add(sqrt.intValue() + "_^_" + i + "_" + index);
                                     }
-                                    if (StringUtils.isNotEmpty(split2[0])) {
-                                        Integer v = Integer.parseInt(split2[0]);
-                                        //随机+ - 0/1
-                                        Random random = new Random();
-                                        int adjustment = random.nextInt(2);
-                                        if (v > 0) {
-                                            v = v - adjustment;
+                                    //未获取到当前key的坐标就不设置值
+                                    if (index != null) {
+                                        //设置实际标高的值
+                                        if (keys.indexOf(deviationNew) > -1) {
+                                            values.set(keys.indexOf(deviationNew), String.join("☆", list));
                                         } else {
-                                            v = v + adjustment;
-                                        }
-                                        if (keys.get(i).equals(differenceNewX)) {
-                                            //偏差X
-                                            differenceNewXMap.put(rowNum, new BigDecimal(split2[0]));
-                                        } else if (keys.get(i).equals(differenceNewY)) {
-                                            //偏差Y
-                                            differenceNewYMap.put(rowNum, BigDecimal.valueOf(v));
+                                            keys.add(deviationNew);
+                                            values.add(String.join("☆", list));
                                         }
-                                        list.add(v + "_^_" + split2[1]);
-                                    }
-                                }
-                                values.set(i, String.join("☆", list));
-                            }
-                            if (rowMin != null) {
-                                List<String> list = new ArrayList<>();
-                                //获取当前key对应的坐标
-                                Set<String> strings = coordinateMap.get(initTabName);
-                                String index = null;
-                                for (String string : strings) {
-                                    String[] split = string.split("__");
-                                    if (Objects.equals(split[0], deviationNew)) {
-                                        index = split[1];
-                                    }
-                                }
-                                //按照最小行数来计算
-                                for (int i = rowMin; i <= rowMax; i++) {
-                                    BigDecimal x = differenceNewXMap.get(i);
-                                    BigDecimal y = differenceNewYMap.get(i);
-
-                                    if (x == null || y == null) {
-                                        continue;
-                                    }
-                                    BigDecimal sqrt = sqrt(x.multiply(x).add(y.multiply(y)), 0);
-
-                                    //第9列,索引为8
-                                    list.add(sqrt.intValue() + "_^_" + i + "_" + index);
-                                }
-                                //未获取到当前key的坐标就不设置值
-                                if (index != null) {
-                                    //设置实际标高的值
-                                    if (keys.indexOf(deviationNew) > -1) {
-                                        values.set(keys.indexOf(deviationNew), String.join("☆", list));
-                                    } else {
-                                        keys.add(deviationNew);
-                                        values.add(String.join("☆", list));
                                     }
                                 }
                             }
+                        } catch (Exception e) {
+                            throw new ServiceException("数据错误,无法计算实际值");
                         }