Kaynağa Gözat

代码优化

wangchangsheng 2 yıl önce
ebeveyn
işleme
01a7c10be9

+ 3 - 0
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/config/CacheContext.java

@@ -90,6 +90,7 @@ public class CacheContext implements CommandLineRunner {
     //期次
     public static Map<String, ProBasicProject> promap = new HashMap<>();
     public static List<ProBasicProject> prols = new ArrayList<>();
+    public static Map<String, List<ProBasicProject>> popromap = new HashMap<>();
 
     //线路
     public static Map<String, ProBasicLine> linemap = new HashMap<>();
@@ -264,10 +265,12 @@ public class CacheContext implements CommandLineRunner {
         //请立集合数据
         prols.clear();
         promap.clear();
+        popromap.clear();
         prols = proBasicProjectService.list();
         prols.stream().forEach(Project -> {
             promap.put(Project.getId(), Project);
         });
+        popromap = prols.stream().collect(Collectors.groupingBy(ProBasicProject::getWindpowerstationId));
     }
 
     /**

+ 16 - 4
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/impl/ProEconTestingPointServiceImpl.java

@@ -135,6 +135,9 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
             }
 
             //获取场站下的阵区
+            if (null == CacheContext.poSquareMap || CacheContext.poSquareMap.size() <= 0) {
+                continue;
+            }
             List<ProBasicSquare> squaare = CacheContext.poSquareMap.get(postation.getId()).stream().filter(i -> i.getTypes().equals("jz")).collect(Collectors.toList());
             //循环阵区生成测点code
             for (ProBasicSquare ss : squaare) {
@@ -483,7 +486,7 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
                         temp = null;
                         temp = wt.getProjectId().substring(0, wt.getProjectId().lastIndexOf("_"));
                         sb.append("P").append(Integer.valueOf(temp.substring(temp.length() - 2))).append("_");
-                        temp = wt.getLineId().substring(0, wt.getProjectId().lastIndexOf("_"));
+                        temp = wt.getLineId().substring(0, wt.getLineId().lastIndexOf("_"));
                         sb.append("L").append(Integer.valueOf(temp.substring(temp.length() - 2))).append("_");
 
                         temp = wt.getId().substring(wt.getId().lastIndexOf("_") - 4, wt.getId().lastIndexOf("_"));
@@ -975,9 +978,13 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
                 ls = gfpointls;
 
             }
+
+            List<ProEconTestingPoint>  lns = CacheContext.tpls.stream()
+                    .filter(i -> i.getTypeId().equals("ln")).collect(Collectors.toList());
+            lns.addAll(ls);
             createWpPoints(wp, ls, allpoints);
             createPjPoints(wp, ls, allpoints);
-            createLnPoints(wp, ls, allpoints);
+            createLnPoints(wp, lns, allpoints);
 
         }
         return allpoints;
@@ -1192,8 +1199,13 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
 
                         StringBuilder sbtable = new StringBuilder();
 
-                        sbtable.append(sba).append("JSFW.");
-                        sbtable.append(sb);
+                        if("ln".equals(stp.getTypeId())){
+                            sbtable.append("INITIAL");
+                        }else {
+                            sbtable.append(sba).append("JSFW.");
+                            sbtable.append(sb);
+                        }
+
 
                         ProBasicPowerstationPoint po = new ProBasicPowerstationPoint();
                         po.setId(StringUtils.getUUID());