浏览代码

质检系统----资料填报-监理同步后测量数据需变动 CL10监理 同步失败,找不到k19

LHB 3 周之前
父节点
当前提交
ef6daa0d9e

+ 215 - 210
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -1831,201 +1831,206 @@ 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;
-//                                }
-//
-//
-//                                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));
-//                                }
-//                            }
-//                            if(rowMin==null){
-//                                continue;
-//                            }
-//                            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){
-//                                continue;
-//                            }
-//                            //设置实际标高的值
-//                            values.set(keys.indexOf(actualElevationNew), 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])){
-//                                        Integer v = Integer.parseInt(split2[0]);
-//                                        //随机+ - 0/1
-//                                        Random random = new Random();
-//                                        int adjustment = random.nextInt(2);
-//                                        if(v > 0){
-//                                            v = v - adjustment;
-//                                        }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));
-//                                        }
-//                                        list.add(v + "_^_"+ split2[1]);
-//                                    }
-//                                }
-//                                values.set(i, String.join("☆",list));
-//                            }
-//                            if(rowMin==null){
-//                                continue;
-//                            }
-//                            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){
-//                                continue;
-//                            }
-//                            //设置实际标高的值
-//                            values.set(keys.indexOf(deviationNew), String.join("☆",list));
-//                        }
+                        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));
+                                }
+                            }
+                            if(rowMin==null){
+                                continue;
+                            }
+                            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){
+                                continue;
+                            }
+                            //设置实际标高的值
+                            values.set(keys.indexOf(actualElevationNew), 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])){
+                                        Integer v = Integer.parseInt(split2[0]);
+                                        //随机+ - 0/1
+                                        Random random = new Random();
+                                        int adjustment = random.nextInt(2);
+                                        if(v > 0){
+                                            v = v - adjustment;
+                                        }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));
+                                        }
+                                        list.add(v + "_^_"+ split2[1]);
+                                    }
+                                }
+                                values.set(i, String.join("☆",list));
+                            }
+                            if(rowMin==null){
+                                continue;
+                            }
+                            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){
+                                continue;
+                            }
+                            //设置实际标高的值
+                            if(keys.indexOf(deviationNew) > -1){
+                                values.set(keys.indexOf(deviationNew), String.join("☆",list));
+                            }else{
+                                keys.add(deviationNew);
+                                values.add(String.join("☆",list));
+                            }
+                        }
 
 
 
@@ -2188,21 +2193,21 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 //表的代码名称相同,就复制数据,例如:G10=G10
                 if (nodeNameRe.equals(nodeNameReJL)) {
                     String htmlStringJL = this.getHtmlString(pKeyIdJL);
-//
-//                    //解析html坐标,生成key与keyName的映射关系
-//                    if (StringUtils.isNotEmpty(htmlStringJL)) {
-//                        Document doc = Jsoup.parse(htmlStringJL);
-//                        Elements select = doc.select("[id]");
-//                        HashSet<String> strings = new HashSet<>();
-//                        for (Element element : select) {
-//                            String id = element.id();
-//                            String[] split1 = id.split("__");
-//                            String s = split1[1].split("_")[1];
-//
-//                            strings.add(split1[0] + "__" + s);
-//                        }
-//                        coordinateMap.put(initTabNameJL, strings);
-//                    }
+
+                    //解析html坐标,生成key与keyName的映射关系
+                    if (StringUtils.isNotEmpty(htmlStringJL)) {
+                        Document doc = Jsoup.parse(htmlStringJL);
+                        Elements select = doc.select("[id]");
+                        HashSet<String> strings = new HashSet<>();
+                        for (Element element : select) {
+                            String id = element.id();
+                            String[] split1 = id.split("__");
+                            String s = split1[1].split("_")[1];
+
+                            strings.add(split1[0] + "__" + s);
+                        }
+                        coordinateMap.put(initTabNameJL, strings);
+                    }
 
                     //获取质检实体表对应数据
                     List<Map<String, Object>> mapsList = jdbcTemplate.queryForList("select * from " + initTabName + " where p_key_id = " + pKeyId);