|
@@ -55,6 +55,119 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void generateSubStationPoint(String Substation, String[] points) {
|
|
|
+ List<ProBasicPowerstationPoint> subStationPoint = initalSbs(Substation,points);
|
|
|
+
|
|
|
+// subStationPoint.stream().forEach(i->{
|
|
|
+// System.out.println(i.getId()+"="+i.getNemCode()+"="+i.getWindpowerstationId()+"="+i.getUniformCode());
|
|
|
+// });
|
|
|
+ proBasicPowerstationPointService.batchAddPowerstationPoints(subStationPoint);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<ProBasicPowerstationPoint> initalSbs(String station,String[] setpoints) {
|
|
|
+ List<ProBasicPowerstationPoint> allpoints = new ArrayList<>();
|
|
|
+
|
|
|
+ List<ProEconTestingPoint> fcs = proEconTestingPointService.list().stream().filter(i -> i.getTypeId().equals("agc") || i.getTypeId().equals("agcjsfw") || i.getTypeId().equals("cft")).collect(Collectors.toList());
|
|
|
+ List<ProEconTestingPoint> gcs = proEconTestingPointService.list().stream().filter(i -> i.getTypeId().equals("agc") || i.getTypeId().equals("agcjsfw")).collect(Collectors.toList());
|
|
|
+ //获取场站
|
|
|
+ for (ProBasicPowerstation postation : CacheContext.wpls) {
|
|
|
+ if (null != station && !"".equals(station) && !station.equals(postation.getId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconTestingPoint> ls = null;
|
|
|
+ if (postation.getId().indexOf("FDC") >= 0) {
|
|
|
+ ls = fcs;
|
|
|
+ } else {
|
|
|
+ ls = gcs;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取场站下的变电所
|
|
|
+ List<ProBasicSubStation> subStations = CacheContext.poSubStationMap.get(postation.getId());
|
|
|
+ //循环变电所生成测点code
|
|
|
+ for (ProBasicSubStation sub : subStations) {
|
|
|
+ List<ProBasicPowerstationPoint> points = new ArrayList<>();
|
|
|
+
|
|
|
+ for (ProEconTestingPoint p : ls) {
|
|
|
+ if (null != setpoints && setpoints.length > 0 && StringUtils.join(setpoints, "|").indexOf(p.getUniformCode()) < 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String temp = sub.getId().substring(0, sub.getId().lastIndexOf("_"));
|
|
|
+// temp = temp.substring(0, temp.lastIndexOf("_"));
|
|
|
+// temp = temp.substring(temp.lastIndexOf("_") + 1);
|
|
|
+ if (sub.getWindpowerstationId().indexOf("FDC") >= 0) {
|
|
|
+ sb.append(temp).append("_F_");
|
|
|
+ } else {
|
|
|
+ sb.append(temp).append("_G_");
|
|
|
+ }
|
|
|
+
|
|
|
+ sb.append("XX_XX_XXXX_");
|
|
|
+ if (p.getUniformCode().indexOf("AI") >= 0) {
|
|
|
+ sb.append("AI");
|
|
|
+
|
|
|
+ } else if (p.getUniformCode().indexOf("DI") >= 0) {
|
|
|
+ sb.append("DI");
|
|
|
+
|
|
|
+ } else {
|
|
|
+ sb.append("CI");
|
|
|
+ }
|
|
|
+ sb.append(p.getNemCode());
|
|
|
+
|
|
|
+
|
|
|
+ StringBuilder sba = new StringBuilder();
|
|
|
+
|
|
|
+ String temp2 = postation.getCompanyId().substring(0, postation.getCompanyId().lastIndexOf("_"));
|
|
|
+ temp2 = temp2.substring(temp2.indexOf("_") + 1);
|
|
|
+
|
|
|
+ String temp3 = postation.getId().substring(0, postation.getId().lastIndexOf("_"));
|
|
|
+ temp3 = temp3.substring(0, temp3.lastIndexOf("_"));
|
|
|
+ temp3 = temp3.substring(temp3.lastIndexOf("_") + 1);
|
|
|
+ if (postation.getId().indexOf("FDC") >= 0) {
|
|
|
+ sba.append(temp2).append(temp3).append("FC");
|
|
|
+ } else if (postation.getId().indexOf("GDC") >= 0) {
|
|
|
+ sba.append(temp2).append(temp3).append("GC");
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuilder sbtable = new StringBuilder();
|
|
|
+
|
|
|
+
|
|
|
+ if (p.getTypeId().indexOf("agcjsfw") >= 0 ) {
|
|
|
+ sbtable.append(sba).append("JSFW.");
|
|
|
+ sbtable.append(sb);
|
|
|
+ } else {
|
|
|
+ sbtable.append(sba).append(".");
|
|
|
+ sbtable.append(sb);
|
|
|
+ }
|
|
|
+ ProBasicPowerstationPoint po = new ProBasicPowerstationPoint();
|
|
|
+ po.setId(StringUtils.getUUID());
|
|
|
+ if (p.getTypeId().indexOf("agcjsfw") >= 0 ) {
|
|
|
+ po.setNemCode(String.valueOf(sbtable));
|
|
|
+ } else {
|
|
|
+ po.setNemCode("INITIAL");
|
|
|
+ }
|
|
|
+ sb = new StringBuilder();
|
|
|
+ sb.append(sub.getName()).append(p.getName());
|
|
|
+ po.setName(String.valueOf(sb));
|
|
|
+ po.setWindpowerstationId(sub.getId());
|
|
|
+ po.setUniformCode(p.getUniformCode());
|
|
|
+
|
|
|
+ sb = new StringBuilder();
|
|
|
+ sb.append(sbtable.toString().substring(0, sbtable.toString().lastIndexOf(".")));
|
|
|
+ po.setRealtimeId(String.valueOf(sb));
|
|
|
+
|
|
|
+
|
|
|
+ points.add(po);
|
|
|
+ }
|
|
|
+ allpoints.addAll(points);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return allpoints;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public List<ProBasicEquipmentPoint> initalFj(String station,String[] setpoints) {
|
|
|
|
|
@@ -817,4 +930,6 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|