|
@@ -3,6 +3,8 @@ package com.gyee.backconfig.service;
|
|
|
|
|
|
import com.gyee.backconfig.model.auto.*;
|
|
|
import com.gyee.backconfig.service.auto.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -16,7 +18,7 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class PointGenerateService {
|
|
|
|
|
|
-
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(PointGenerateService.class);
|
|
|
@Resource
|
|
|
private ICompanysService companysService;//公司
|
|
|
|
|
@@ -46,18 +48,23 @@ public class PointGenerateService {
|
|
|
private IStandardpointService standardpointService;
|
|
|
|
|
|
|
|
|
-
|
|
|
public int addGeneratePoint(String[] points) {
|
|
|
+ int num = 0;
|
|
|
|
|
|
- List<Standardpoint> pointList = standardpointService.list(points);
|
|
|
+ List<Standardpoint> pointList = standardpointService.list(points);
|
|
|
List<Companys> companysList = companysService.getCompanysByidAndRid("");
|
|
|
+
|
|
|
for (Standardpoint p : pointList) {
|
|
|
|
|
|
if ("czjs".equals(p.getType())) {
|
|
|
|
|
|
List<Windpowerstationpointnew> staionList = fjd(p, companysList);
|
|
|
for (Windpowerstationpointnew i : staionList) {
|
|
|
-// boolean b = windpowerstationpointnewService.addOrUpdate(i);
|
|
|
+ boolean b = windpowerstationpointnewService.addOrUpdate(i);
|
|
|
+ if (!b){
|
|
|
+ logger.error( i.getCode()+"测点插入失败");
|
|
|
+ num++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -70,7 +77,11 @@ public class PointGenerateService {
|
|
|
List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
|
|
|
List<Windturbinetestingpointnew> testingList = czd(p, windpowerstationList);
|
|
|
for (Windturbinetestingpointnew i : testingList) {
|
|
|
-// boolean b = windturbinetestingpointnewService.addOrUpdate(i);
|
|
|
+ boolean b = windturbinetestingpointnewService.addOrUpdate(i);
|
|
|
+ if (!b){
|
|
|
+ logger.error( i.getCode()+"测点插入失败");
|
|
|
+ num++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -79,39 +90,150 @@ public class PointGenerateService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- return 0;
|
|
|
+ return num;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String codeRules(){
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private List<Windpowerstationpointnew> fjd(Standardpoint p, List<Companys> companysList) {
|
|
|
List<Windpowerstationpointnew> stationList = new ArrayList<>();
|
|
|
|
|
|
Windpowerstationpointnew stationpoint = null;
|
|
|
|
|
|
+ List<String> gflist = new ArrayList<>();
|
|
|
+ gflist.add("G");
|
|
|
+ gflist.add("F");
|
|
|
+
|
|
|
for (Companys c : companysList) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ StringBuilder gssb = null;
|
|
|
+ List<Windpowerstationpointnew> list1 = windpowerstationpointnewService.getStationpointByUniformcode(c.getId(), p.getUniformcode());
|
|
|
+ if (null == list1 || list1.size() <= 0) {
|
|
|
+ //"JSFW.QY_JN_XXXX_XX_XX_XX_XXX_CI0144" "区域限电停机台数(明细)"
|
|
|
+ gssb = new StringBuilder();
|
|
|
+ gssb.append("JSFW.").append(c.getId()).append("_JN_");
|
|
|
+ stationpoint = new Windpowerstationpointnew();
|
|
|
+ stationpoint.setCode(gssb.toString() + "XXXX_XX_XX_XX_XXX_" + p.getUniformcode());
|
|
|
+ stationpoint.setName(c.getName() + p.getName());
|
|
|
+ stationpoint.setUniformcode(p.getUniformcode());
|
|
|
+ stationpoint.setWindpowerstationid(c.getId());
|
|
|
+ stationpoint.setRealtimeid("JSFW");
|
|
|
+ stationList.add(stationpoint);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (String gf: gflist){
|
|
|
+ List<Windpowerstationpointnew> list1df = windpowerstationpointnewService.getStationpointByUniformcode(c.getId()+"_"+gf, p.getUniformcode());
|
|
|
+ if (null == list1df || list1df.size() <= 0) {
|
|
|
+ //"JSFW.QY_JN_QYG_XX_XX_XX_XXX_CI0144" "区域光伏限电停机台数(明细)"
|
|
|
+ //"JSFW.QY_JN_QYF_XX_XX_XX_XXX_CI0144" "区域风场限电停机台数(明细)"
|
|
|
+ StringBuilder gsgfsb = new StringBuilder(gssb);
|
|
|
+ gsgfsb.append(c.getId()).append(gf)
|
|
|
+ .append("_XX_XX_XX_XXX_")
|
|
|
+ .append(p.getUniformcode());
|
|
|
+ stationpoint = new Windpowerstationpointnew();
|
|
|
+ stationpoint.setCode(gsgfsb.toString());
|
|
|
+ stationpoint.setName(c.getName() + p.getName());
|
|
|
+ stationpoint.setUniformcode(p.getUniformcode());
|
|
|
+ stationpoint.setWindpowerstationid(c.getId()+"_"+gf);
|
|
|
+ stationpoint.setRealtimeid("JSFW");
|
|
|
+ stationList.add(stationpoint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<Region> regionList = regionService.getReginBycode(c.getCapacityunit());
|
|
|
+
|
|
|
+
|
|
|
for (Region r : regionList) {
|
|
|
- List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
|
|
|
|
|
|
|
|
|
+ StringBuilder qusb = new StringBuilder();
|
|
|
+ List<Windpowerstationpointnew> list2 = windpowerstationpointnewService.getStationpointByUniformcode( r.getId(), p.getUniformcode());
|
|
|
+ if (null == list2 || list2.size() <= 0) {
|
|
|
+ //"JSFW.SX_JN_XXXX_XX_XX_XX_XXX_CI0144" "山西限电停机台数(明细)"
|
|
|
+
|
|
|
+ qusb.append("JSFW.").append(r.getId()).append("_JN_");
|
|
|
+ stationpoint = new Windpowerstationpointnew();
|
|
|
+ stationpoint.setCode(gssb.toString() + "XXXX_XX_XX_XX_XXX_" + p.getUniformcode());
|
|
|
+ stationpoint.setName(c.getName() + p.getName());
|
|
|
+ stationpoint.setUniformcode(p.getUniformcode());
|
|
|
+ stationpoint.setWindpowerstationid(r.getId());
|
|
|
+ stationpoint.setRealtimeid("JSFW");
|
|
|
+ stationList.add(stationpoint);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String gf: gflist) {
|
|
|
+ List<Windpowerstationpointnew> list2df = windpowerstationpointnewService.getStationpointByUniformcode(r.getId() + "_" + gf, p.getUniformcode());
|
|
|
+ if (null == list2df || list2df.size() <= 0) {
|
|
|
+ //"JSFW.SX_JN_SXG_XX_XX_XX_XXX_CI0144" "山西光伏限电停机台数(明细)"
|
|
|
+ //"JSFW.SX_JN_SXF_XX_XX_XX_XXX_CI0144" "山西风场限电停机台数(明细)"
|
|
|
+ StringBuilder qugfsb = new StringBuilder(qusb);
|
|
|
+ qugfsb.append(r.getId()).append(gf)
|
|
|
+ .append("_XX_XX_XX_XXX_")
|
|
|
+ .append(p.getUniformcode());
|
|
|
+ stationpoint = new Windpowerstationpointnew();
|
|
|
+ stationpoint.setCode(qugfsb.toString());
|
|
|
+ stationpoint.setName(c.getName() + p.getName());
|
|
|
+ stationpoint.setUniformcode(p.getUniformcode());
|
|
|
+ stationpoint.setWindpowerstationid(r.getId());
|
|
|
+ stationpoint.setRealtimeid("JSFW");
|
|
|
+ stationList.add(stationpoint);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
|
|
|
for (Windpowerstation station : windpowerstationList) {
|
|
|
- List<Windpowerstationpointnew> list1 = windpowerstationpointnewService.getStationpointByUniformcode(station.getId(), p.getUniformcode());
|
|
|
- if (null != list1 && list1.size() > 0) {
|
|
|
+ List<Windpowerstationpointnew> list3 = windpowerstationpointnewService.getStationpointByUniformcode(station.getId(), p.getUniformcode());
|
|
|
+ if (null != list3 && list3.size() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
stationpoint = new Windpowerstationpointnew();
|
|
|
- stationpoint.setCode("");
|
|
|
+ //BHBFCJSFW.SX_JN_BHBF_JS_XX_XX_XXX_CI0079
|
|
|
+ //SYGCJSFW.SX_JN_SYG_JS_XX_XX_XXX_CI0001
|
|
|
+
|
|
|
+ StringBuilder stationsb = new StringBuilder();
|
|
|
+ String substaion = station.getId().substring(0, station.getId().indexOf("_"));
|
|
|
+ stationsb.append(substaion).append(station.getId().endsWith("_FDC") ? "FCJSFW." : "GCJSFW.");
|
|
|
+ stationsb.append("SX_JN_").append(substaion);
|
|
|
+ stationsb.append(station.getId().endsWith("_FDC") ? "F" : "G").append("_JS_");
|
|
|
+
|
|
|
+ stationpoint.setCode(stationsb.toString() + "XX_XX_XXX_" + p.getUniformcode());
|
|
|
stationpoint.setName(station.getName() + p.getName());
|
|
|
stationpoint.setUniformcode(p.getUniformcode());
|
|
|
stationList.add(stationpoint);
|
|
|
|
|
|
List<Project> projectList = projectService.getList(station.getId());
|
|
|
for (Project project : projectList) {
|
|
|
- List<Windpowerstationpointnew> list2 = windpowerstationpointnewService.getStationpointByUniformcode(project.getId(), p.getUniformcode());
|
|
|
- if (null != list2 && list2.size() > 0) {
|
|
|
+ List<Windpowerstationpointnew> list4 = windpowerstationpointnewService.getStationpointByUniformcode(project.getId(), p.getUniformcode());
|
|
|
+ if (null != list4 && list4.size() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
stationpoint = new Windpowerstationpointnew();
|
|
|
- stationpoint.setCode("");
|
|
|
+ //BHBFCJSFW.SX_JN_BHBF_JS_P1_XX_XXX_CI0079
|
|
|
+ //SYGCJSFW.SX_JN_SYG_JS_P1_XX_XXX_CI0001
|
|
|
+ StringBuilder projectsb = new StringBuilder(stationsb);
|
|
|
+
|
|
|
+
|
|
|
+ Integer pnum = Integer.valueOf(project.getId().substring(substaion.length(), project.getId().indexOf("_"))) * 1;
|
|
|
+ projectsb.append("P")
|
|
|
+ .append(pnum);
|
|
|
+
|
|
|
+ stationpoint.setCode(projectsb.toString()+"_XX_XXX_"+p.getUniformcode());
|
|
|
stationpoint.setName(project.getName() + p.getName());
|
|
|
stationpoint.setUniformcode(p.getUniformcode());
|
|
|
stationList.add(stationpoint);
|
|
@@ -119,12 +241,20 @@ public class PointGenerateService {
|
|
|
List<Line> lineList = lineService.getList(project.getId());
|
|
|
for (Line l : lineList) {
|
|
|
|
|
|
- List<Windpowerstationpointnew> list3 = windpowerstationpointnewService.getStationpointByUniformcode(l.getId(), p.getUniformcode());
|
|
|
- if (null != list3 && list3.size() > 0) {
|
|
|
+ List<Windpowerstationpointnew> list5 = windpowerstationpointnewService.getStationpointByUniformcode(l.getId(), p.getUniformcode());
|
|
|
+ if (null != list5 && list5.size() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
stationpoint = new Windpowerstationpointnew();
|
|
|
- stationpoint.setCode("");
|
|
|
+ //BHBFCJSFW.SX_JN_BHBF_JS_P1_L3_XXX_CI0079
|
|
|
+ //SYGCJSFW.SX_JN_SYG_JS_P1_L1_XXX_CI0001
|
|
|
+ StringBuilder linesb = new StringBuilder(projectsb);
|
|
|
+
|
|
|
+ Integer lnum = Integer.valueOf(l.getId().substring(substaion.length(), project.getId().indexOf("_"))) * 1;
|
|
|
+ linesb.append("_L").append(lnum)
|
|
|
+ .append("_XXX_").append(p.getUniformcode());
|
|
|
+
|
|
|
+ stationpoint.setCode(stationsb.toString());
|
|
|
stationpoint.setName(l.getName() + p.getName());
|
|
|
stationpoint.setUniformcode(p.getUniformcode());
|
|
|
stationList.add(stationpoint);
|
|
@@ -148,17 +278,38 @@ public class PointGenerateService {
|
|
|
private List<Windturbinetestingpointnew> czd(Standardpoint p, List<Windpowerstation> windpowerstationList) {
|
|
|
Windturbinetestingpointnew testing = null;
|
|
|
List<Windturbinetestingpointnew> testingList = new ArrayList<>();
|
|
|
- for (Windpowerstation staion : windpowerstationList) {
|
|
|
+ for (Windpowerstation station : windpowerstationList) {
|
|
|
|
|
|
- List<Windturbine> windturbineList = windturbineService.getWindturbineGyLine(staion.getId(), "", "");
|
|
|
+
|
|
|
+ List<Windturbine> windturbineList = windturbineService.getWindturbineGyLine(station.getId(), "", "");
|
|
|
for (Windturbine w : windturbineList) {
|
|
|
List<Windturbinetestingpointnew> list = windturbinetestingpointnewService.list(w.getId(), p.getUniformcode());
|
|
|
if (null != list && list.size() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
testing = new Windturbinetestingpointnew();
|
|
|
+ //fjjs
|
|
|
+ //fjjcd
|
|
|
+ if ("fjjs".equals(p.getType())) {
|
|
|
+ StringBuilder stationsb = new StringBuilder();
|
|
|
+ String substaion = station.getId().substring(0, station.getId().indexOf("_"));
|
|
|
+ stationsb.append(substaion).append(station.getId().endsWith("_FDC") ? "FJJSFW." : "GFJSFW.");
|
|
|
+ stationsb.append("SX_JN_").append(substaion);
|
|
|
+ stationsb.append(station.getId().endsWith("_FDC") ? "F" : "G").append("_JS_");
|
|
|
+ Integer pnum = Integer.valueOf(w.getProjectid().substring(substaion.length(), w.getProjectid().indexOf("_"))) * 1;
|
|
|
+ stationsb.append("P").append(pnum);
|
|
|
+ Integer lnum = Integer.valueOf(w.getLineid().substring(substaion.length(), w.getLineid().indexOf("_"))) * 1;
|
|
|
+ stationsb.append("_L").append(lnum);
|
|
|
+ Integer wnum = Integer.valueOf(w.getId().substring(w.getId().indexOf("_") + 1, w.getId().length()));
|
|
|
+ stationsb.append("_").append(wnum);
|
|
|
+
|
|
|
+ //BHB3FJJSFW.SX_JN_BHB3F_JS_P1_L30_001_CI0060
|
|
|
+ //SYGFJSFW.SX_JN_SYG_JS_P2_L3_NBQ0061_CI0174
|
|
|
+ testing.setCode(stationsb.toString() + p.getUniformcode());
|
|
|
+ } else if ("fjjcd".equals(p.getType())) {
|
|
|
+ testing.setCode("INITIAL");
|
|
|
+ }
|
|
|
|
|
|
- testing.setCode("fjjs".equals(p.getType()) ? "INITIAL" : "");
|
|
|
testing.setName(w.getName() + p.getName());
|
|
|
testing.setUniformcode(p.getUniformcode());
|
|
|
testing.setWindpowerstationid(w.getWindpowerstationid());
|
|
@@ -170,4 +321,5 @@ public class PointGenerateService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|