瀏覽代碼

质检系统----资料填报- CL08数据处理(待测试)

LHB 1 月之前
父節點
當前提交
1e32d8374f

+ 61 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -1823,34 +1823,80 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                         //CL08水准测量记录表(监理)
                         if(levelingTableName.equals(initTabName)){
+                            //设计标高
                             String designedElevationNew = stringStringMap.get(designedElevation);
                             HashMap<Integer, Double> designedElevationNewMap = new HashMap<>();
-
+                            //偏差
                             String heightDeviationNew = stringStringMap.get(heightDeviation);
                             HashMap<Integer, Double> heightDeviationNewMap = new HashMap<>();
 
-                            String actualElevationNew = stringStringMap.get(actualElevation);
-                            HashMap<Integer, Double> actualElevationNewMap = new HashMap<>();
+                            //记录数量
+                            Integer rowMin = null;
+                            Integer rowMax = null;
 
+                            for (int i = 0; i < keys.size(); i++) {
+                                if(!Objects.equals(keys.get(i),designedElevation) || !Objects.equals(keys.get(i),heightDeviation)){
+                                    continue;
+                                }
 
 
-                            String[] split = designedElevationNew.split("_");
-                            String index = split[1];
-                            String key = keys.get(Integer.parseInt(index));
-                            if(designedElevationNew.equals(key)){
-                                String value = values.get(Integer.parseInt(index));
+                                String value = values.get(i);
                                 //拆分数据
                                 String[] split1 = value.split("☆");
+
+                                List<String> heightDeviationList = new ArrayList<>();
                                 for (String s : split1) {
-                                    String[] split2 = s.split("_");
-                                    designedElevationNewMap.put(Integer.parseInt(split2[0]),Double.parseDouble(split2[2]));
+                                    String[] split2 = s.split("_\\^_");
+                                    int rowNum = Integer.parseInt(split2[1].split("_")[0]);
+                                    //获取最大行数
+                                    if(rowMax == null){
+                                        rowMax = rowNum;
+                                    }else if(rowMax < rowNum){
+                                        rowMax = rowNum;
+                                    }
+                                    //获取最小行数
+                                    if(rowMax == null){
+                                        rowMin = rowNum;
+                                    }else if(rowMin > rowNum){
+                                        rowMin = rowNum;
+                                    }
+
+                                    if (keys.get(i).equals(designedElevationNew)) {
+                                        //设计标高
+                                        designedElevationNewMap.put(rowNum, Double.parseDouble(split2[0]));
+                                    } else if (keys.get(i).equals(heightDeviationNew)){
+                                        double v = Double.parseDouble(split2[0]);
+                                        //高度偏差
+                                        heightDeviationNewMap.put(rowNum, v);
+
+                                        Random random = new Random();
+                                        int adjustment = random.nextInt(2);
+                                        if(v > 0){
+                                            v = v - adjustment;
+                                        }else{
+                                            v = v + adjustment;
+                                        }
+                                        heightDeviationList.add(v + "_^_"+ split2[1]);
+                                    }
+                                }
+                                if(CollectionUtil.isNotEmpty(heightDeviationList)){
+                                    values.set(i, String.join("☆",heightDeviationList));
                                 }
                             }
-
-
-
-
-
+                            List<String> list = new ArrayList<>();
+                            //按照最小行数来计算
+                            for (int i = rowMin; i <= rowMax; i++) {
+                                Double designed = designedElevationNewMap.get(i);
+                                Double height = heightDeviationNewMap.get(i);
+                                if(designed == null || height == null){
+                                    continue;
+                                }
+                                double v = designed + (height / 100);
+                                //第5列,索引为4
+                                list.add(v + "_^_"+ i + "_4");
+                            }
+                            //设置值
+                            values.set(keys.indexOf(actualElevation), String.join("☆",list));
                         }else if(planePositionTableName.equals(initTabName)){
                             //CL10平面位置检测记录表(监理)