|
@@ -1,316 +0,0 @@
|
|
|
-package com.gyee.backconfig.service.auto;
|
|
|
-
|
|
|
-
|
|
|
-import com.gyee.backconfig.model.auto.*;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * 生成测点服务类
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class PointGenerateService {
|
|
|
- private static Logger logger = LoggerFactory.getLogger(PointGenerateService.class);
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IProBasicEnergyGroupService proBasicEnergyGroupService;//集团
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IProBasicRegionService proBasicRegionService;//区域
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IProBasicCompanyService proBasicCompanyService;//公司
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IProBasicPowerstationService proBasicWindpowerstationService;//场站
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IProBasicProjectService proBasicProjectService;//期次
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IProBasicLineService proBasicLineService;//线路
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IProBasicEquipmentService proBasicWindturbineService;//风机
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IProBasicPowerstationPointService proBasicWppointService;//场站测点
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IProBasicEquipmentPointService proBasicEquipmentPointService;//设备测点
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IStandardpointService standardpointService;
|
|
|
-
|
|
|
- public int addGeneratePoint(String[] points) {
|
|
|
- int num = 0;
|
|
|
-
|
|
|
- List<Standardpoint> pointList = standardpointService.list(points);
|
|
|
- List<ProBasicEnergyGroup> EnergyList = proBasicEnergyGroupService.getCompanysByidAndRid("");
|
|
|
-// List<ProBasicRegion> RegionList = proBasicRegionService.getRegionByidAndRid("");
|
|
|
-
|
|
|
- for (Standardpoint p : pointList) {
|
|
|
-
|
|
|
- if ("czjs".equals(p.getType())) {
|
|
|
-
|
|
|
- List<ProBasicPowerstationPoint> staionList = fjd(p, EnergyList);
|
|
|
- for (ProBasicPowerstationPoint i : staionList) {
|
|
|
- boolean b = proBasicWppointService.addOrUpdate(i);
|
|
|
- if (!b) {
|
|
|
- logger.error(i.getNemCode() + "测点插入失败");
|
|
|
- num++;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- //fjjs
|
|
|
- //fjjcd
|
|
|
-
|
|
|
- for (ProBasicEnergyGroup c : EnergyList) {
|
|
|
- List<ProBasicCompany> CompanyList = proBasicCompanyService.getCompanycode(c.getCapacityUnit());
|
|
|
- for (ProBasicCompany r : CompanyList) {
|
|
|
- List<ProBasicPowerstation> windpowerstationList = proBasicWindpowerstationService.getList(r.getId());
|
|
|
- List<ProBasicEquipmentPoint> testingList = czd(p, windpowerstationList, r);
|
|
|
- for (ProBasicEquipmentPoint i : testingList) {
|
|
|
- boolean b = proBasicEquipmentPointService.addOrUpdate(i);
|
|
|
- if (!b) {
|
|
|
- logger.error(i.getNemCode() + "测点插入失败");
|
|
|
- num++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return num;
|
|
|
- }
|
|
|
- private List<ProBasicPowerstationPoint> fjd(Standardpoint p, List<ProBasicEnergyGroup> companysList) {
|
|
|
- List<ProBasicPowerstationPoint> stationList = new ArrayList<>();
|
|
|
-
|
|
|
- ProBasicPowerstationPoint stationpoint = null;
|
|
|
-
|
|
|
- List<String> gflist = new ArrayList<>();
|
|
|
- gflist.add("G");
|
|
|
- gflist.add("F");
|
|
|
-
|
|
|
- for (ProBasicEnergyGroup c : companysList) {
|
|
|
- StringBuilder gssb = null;
|
|
|
- List<ProBasicPowerstationPoint> list1 = proBasicWppointService.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("_");
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- stationpoint.setNemCode(gssb.toString() + "XXXX_XX_XX_XX_XXX_" + p.getPoint());
|
|
|
- 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<ProBasicPowerstationPoint> list1df = proBasicWppointService.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.getPoint());
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- stationpoint.setNemCode(gsgfsb.toString());
|
|
|
- stationpoint.setName(c.getName() + p.getName());
|
|
|
- stationpoint.setUniformCode(p.getUniformcode());
|
|
|
- stationpoint.setWindpowerstationId(c.getId() + "_" + gf);
|
|
|
- stationpoint.setRealtimeId("JSFW");
|
|
|
- stationList.add(stationpoint);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<ProBasicCompany> CompanyList = proBasicCompanyService.getCompanycode(c.getCapacityUnit());
|
|
|
-
|
|
|
-
|
|
|
- for (ProBasicCompany r : CompanyList) {
|
|
|
-
|
|
|
-
|
|
|
- StringBuilder qusb = new StringBuilder();
|
|
|
- List<ProBasicPowerstationPoint> list2 = proBasicWppointService.getStationpointByUniformcode(r.getId(), p.getUniformcode());
|
|
|
- if (null == list2 || list2.size() <= 0) {
|
|
|
- //"JSFW.SX_JN_XXXX_XX_XX_XX_XXX_CI0144" "山西限电停机台数(明细)"
|
|
|
-
|
|
|
- qusb.append("JSFW.").append(c.getId()).append("_");
|
|
|
- qusb.append(r.getId()).append("_");
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- stationpoint.setNemCode(gssb.toString() + "XX_XX_XX_XXX_" + p.getPoint());
|
|
|
- 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<ProBasicPowerstationPoint> list2df = proBasicWppointService.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(gf)
|
|
|
- .append("_XX_XX_XX_XXX_")
|
|
|
- .append(p.getPoint());
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- stationpoint.setNemCode(qugfsb.toString());
|
|
|
- stationpoint.setName(c.getName() + p.getName());
|
|
|
- stationpoint.setUniformCode(p.getUniformcode());
|
|
|
- stationpoint.setWindpowerstationId(r.getId() + "_" + gf);
|
|
|
- stationpoint.setRealtimeId("JSFW");
|
|
|
- stationList.add(stationpoint);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- List<ProBasicPowerstation> windpowerstationList = proBasicWindpowerstationService.getList(r.getId());
|
|
|
- for (ProBasicPowerstation station : windpowerstationList) {
|
|
|
- List<ProBasicPowerstationPoint> list3 = proBasicWppointService.getStationpointByUniformcode(station.getId(), p.getUniformcode());
|
|
|
- if (null != list3 && list3.size() > 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- //BHBFCJSFW.SX_JN_BHBF_JS_XX_XX_XXX_CI0079
|
|
|
- //SYGCJSFW.SX_JN_SYG_JS_XX_XX_XXX_CI0001
|
|
|
- //HSMFCJSFW.SX_JN_HSMF_JS_XX_XX_XXX_AI0002
|
|
|
-
|
|
|
- //场站测点
|
|
|
- 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(c.getId()).append("_").append(r.getId()).append("_").append(substaion);
|
|
|
- stationsb.append(station.getId().endsWith("_FDC") ? "F" : "G").append("_");
|
|
|
-
|
|
|
- stationpoint.setNemCode(stationsb.toString() + "XX_XX_XXX_" + p.getPoint());
|
|
|
- stationpoint.setName(station.getName() + p.getName());
|
|
|
- stationpoint.setUniformCode(p.getUniformcode());
|
|
|
- stationpoint.setWindpowerstationId(station.getId());
|
|
|
- stationpoint.setRealtimeId(substaion + (station.getId().endsWith("_FDC") ? "FCJSFW" : "GCJSFW"));
|
|
|
- stationList.add(stationpoint);
|
|
|
-
|
|
|
- List<ProBasicProject> projectList = proBasicProjectService.getList(station.getId());
|
|
|
- for (ProBasicProject project : projectList) {
|
|
|
- List<ProBasicPowerstationPoint> list4 = proBasicWppointService.getStationpointByUniformcode(project.getId(), p.getUniformcode());
|
|
|
- if (null != list4 && list4.size() > 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- //期次测点
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- StringBuilder projectsb = new StringBuilder(stationsb);
|
|
|
- Integer pnum = Integer.valueOf(project.getId().substring(substaion.length(), project.getId().indexOf("_"))) * 1;
|
|
|
- projectsb.append("P")
|
|
|
- .append(pnum);
|
|
|
-
|
|
|
- stationpoint.setNemCode(projectsb.toString() + "_XX_XXX_" + p.getPoint());
|
|
|
- stationpoint.setName(project.getName() + p.getName());
|
|
|
- stationpoint.setUniformCode(p.getUniformcode());
|
|
|
- stationpoint.setWindpowerstationId(project.getId());
|
|
|
- stationpoint.setRealtimeId(substaion + (station.getId().endsWith("_FDC") ? "FCJSFW" : "GCJSFW"));
|
|
|
- stationList.add(stationpoint);
|
|
|
-
|
|
|
- List<ProBasicLine> lineList = proBasicLineService.getList(project.getId());
|
|
|
- for (ProBasicLine l : lineList) {
|
|
|
-
|
|
|
- List<ProBasicPowerstationPoint> list5 = proBasicWppointService.getStationpointByUniformcode(l.getId(), p.getUniformcode());
|
|
|
- if (null != list5 && list5.size() > 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- stationpoint = new ProBasicPowerstationPoint();
|
|
|
- //线路测点
|
|
|
- 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.getPoint());
|
|
|
-
|
|
|
- stationpoint.setNemCode(linesb.toString());
|
|
|
- stationpoint.setName(l.getName() + p.getName());
|
|
|
- stationpoint.setUniformCode(p.getUniformcode());
|
|
|
- stationpoint.setWindpowerstationId(l.getId());
|
|
|
- stationpoint.setRealtimeId(substaion + (station.getId().endsWith("_FDC") ? "FCJSFW" : "GCJSFW"));
|
|
|
- stationList.add(stationpoint);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return stationList;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * @param p
|
|
|
- * @param windpowerstationList
|
|
|
- * @param company
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<ProBasicEquipmentPoint> czd(Standardpoint p, List<ProBasicPowerstation> windpowerstationList, ProBasicCompany company) {
|
|
|
- ProBasicEquipmentPoint testing = null;
|
|
|
- List<ProBasicEquipmentPoint> testingList = new ArrayList<>();
|
|
|
- for (ProBasicPowerstation station : windpowerstationList) {
|
|
|
-
|
|
|
-
|
|
|
- List<ProBasicEquipment> windturbineList = proBasicWindturbineService.getWindturbineGyLine(station.getId(), "", "");
|
|
|
- for (ProBasicEquipment w : windturbineList) {
|
|
|
- List<ProBasicEquipmentPoint> list = proBasicEquipmentPointService.list(w.getId(), p.getUniformcode());
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- testing = new ProBasicEquipmentPoint();
|
|
|
- //fjjs
|
|
|
- //fjjcd
|
|
|
- String substaion = station.getId().substring(0, station.getId().indexOf("_"));
|
|
|
- if ("fjjs".equals(p.getType())) {
|
|
|
- StringBuilder stationsb = new StringBuilder();
|
|
|
- stationsb.append(substaion).append(station.getId().endsWith("_FDC") ? "FJJSFW." : "GFJSFW.");
|
|
|
- stationsb.append(company.getGroupId()).append("_").append(company.getId()).append("_").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);
|
|
|
- String wnum = w.getId().substring(w.getId().indexOf("_") + 1, w.getId().length());
|
|
|
- stationsb.append("_").append(wnum).append("_");
|
|
|
-
|
|
|
- //BHB3FJJSFW.SX_JN_BHB3F_JS_P1_L30_001_CI0060
|
|
|
- //SYGFJSFW.SX_JN_SYG_JS_P2_L3_NBQ0061_CI0174
|
|
|
- testing.setNemCode(stationsb.toString() + p.getPoint());
|
|
|
- testing.setRealtimeId(substaion + (station.getId().endsWith("_FDC") ? "FJJSFW" : "GFJSFW"));
|
|
|
- } else if ("fjjcd".equals(p.getType())) {
|
|
|
- testing.setNemCode("INITIAL");
|
|
|
- testing.setRealtimeId(substaion + (station.getId().endsWith("_FDC") ? "FJ" : "GF"));
|
|
|
- }
|
|
|
-
|
|
|
- testing.setName(w.getName() + p.getName());
|
|
|
- testing.setUniformCode(p.getUniformcode());
|
|
|
- testing.setWindpowerstationId(w.getId());
|
|
|
- testingList.add(testing);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return testingList;
|
|
|
-
|
|
|
- }
|
|
|
-}
|