Browse Source

测点生成代码提交

wangchangsheng 2 năm trước cách đây
mục cha
commit
d4479b4a26

+ 1 - 1
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/PointGenerateController.java

@@ -44,7 +44,7 @@ public class PointGenerateController {
                            @RequestParam(value = "type", required = false) String type){
 
 
-        pointGenerateService.addGeneratePoint(regioncompanyid, id, stationId, projectId, lineId, pointList);
+        pointGenerateService.addGeneratePoint(pointList);
 
 
 

+ 52 - 202
web/backmanagerconfig/src/main/java/com/gyee/backconfig/service/PointGenerateService.java

@@ -3,7 +3,6 @@ package com.gyee.backconfig.service;
 
 import com.gyee.backconfig.model.auto.*;
 import com.gyee.backconfig.service.auto.*;
-import com.gyee.common.model.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -44,190 +43,33 @@ public class PointGenerateService {
     private IWindturbinetestingpointnewService windturbinetestingpointnewService;
 
 
-    public int addGeneratePoint(String regioncompanyid, String id, String stationId, String projectId, String lineId, List<Standardpoint> pointList) {
 
+    public int addGeneratePoint(List<Standardpoint> pointList) {
 
-        int tag = 0;
-        //区域
-        List<Region> regionList = regionService.getReginBycode(regioncompanyid);
-
-        //判断公司是否为空
-        if (null != id && id.length() > 0) {
-            //不为空
-            for (Region r : regionList) {
-                List<Companys> companysList = companysService.getCompanysByidAndRid(r.getCompanyid());
-
-                //判断是否有匹配的的公司
-                if (null != companysList && companysList.size() > 0) {
-                    for (Companys c : companysList) {
-
-
-                    }
-                }
-            }
-        }
-
-        if (StringUtils.isNotNull(regioncompanyid) && StringUtils.isNotNull(id)
-                && StringUtils.isNotNull(stationId) && StringUtils.isNotNull(projectId) && StringUtils.isNotNull(lineId)) {
-            tag = 1;
-        }
-
-        if (StringUtils.isNotNull(regioncompanyid) && StringUtils.isNotNull(id)
-                && StringUtils.isNotNull(stationId) && StringUtils.isNotNull(projectId)) {
-            tag = 2;
-        }
-
-        if (StringUtils.isNotNull(regioncompanyid) && StringUtils.isNotNull(id) && StringUtils.isNotNull(stationId)) {
-            tag = 3;
-        }
-        if (StringUtils.isNotNull(regioncompanyid) && StringUtils.isNotNull(id)) {
-            tag = 4;
-        }
-
-        if (StringUtils.isNotNull(regioncompanyid)) {
-            tag = 5;
-        }
-
-        switch (tag) {
-            case 1:
-                addPoint(regioncompanyid, id, stationId, projectId, lineId, pointList);
-                break;
-            case 2:
-                addPoint(regioncompanyid, id, stationId, projectId, pointList);
-                break;
-            case 3:
-                addPoint(regioncompanyid, id, stationId, pointList);
-                break;
-            case 4:
-                addPoint(regioncompanyid, id, pointList);
-                break;
-
-            case 5:
-                addPoint(regioncompanyid, pointList);
-                break;
-            default:
-                addPoint(pointList);
-                break;
-
-        }
-
-
-        return 0;
-    }
-
-
-    int addPoint(String regioncompanyid, String id, String stationId, String projectId, String lineId, List<Standardpoint> pointList) {
-
-
-        List<Windpowerstationpointnew> stationList = new ArrayList<>();
-        List<Windturbinetestingpointnew> testingList = new ArrayList<>();
-
-        List<Windturbine> windturbineList = windturbineService.getWindturbineGyLine("", "", lineId);
-
+        List<Companys> companysList = companysService.getCompanysByidAndRid("");
         for (Standardpoint p : pointList) {
 
-            if ("1".equals(p.getType())) {
-
-                Windpowerstationpointnew station = new Windpowerstationpointnew();
-
-                station.setCode("");
-                station.setName(stationId + p.getName());
-                station.setModel("");
-                station.setValueunit("");
-                station.setEnglishname("");
-                station.setTypeid("");
-                station.setModelid("");
-                station.setMaxval(null);
-                station.setMinval(null);
-                station.setReasonablemaxval(null);
-                station.setReasonableminval(null);
-                station.setUniformcode(p.getUniformcode());
-                station.setShortid("");
-                station.setLongid("");
-                station.setWindpowerstationid("");
-                station.setRealtimeid("");
-                stationList.add(station);
+            if ("czjs".equals(p.getType())) {
 
-            } else {
-                for (Windturbine w : windturbineList) {
-
-                    Windturbinetestingpointnew testing = new Windturbinetestingpointnew();
-                    testing.setCode("2".equals(p.getType()) ? "INITIAL" : "");
-                    testing.setName(w.getName() + p.getName());
-//                    testing.setModel("");
-//                    testing.setValueunit("");
-//                    testing.setEnglishname("");
-//                    testing.setTypeid("");
-//                    testing.setModelid("");
-//                    testing.setMaxval(null);
-//                    testing.setMinval(null);
-//                    testing.setReasonablemaxval(null);
-//                    testing.setReasonableminval(null);
-                    testing.setUniformcode(p.getUniformcode());
-//                    testing.setShortid("");
-//                    testing.setLongid("");
-                    testing.setWindpowerstationid(w.getWindpowerstationid());
-//                    testing.setRealtimeid("");
-                    testingList.add(testing);
+                List<Windpowerstationpointnew> staionList = fjd(p, companysList);
+                for (Windpowerstationpointnew i : staionList) {
+//                    boolean b = windpowerstationpointnewService.addOrUpdate(i);
                 }
-            }
-        }
-
-        return 0;
-
-    }
-
-    int addPoint(String regioncompanyid, String id, String stationId, String projectId, List<Standardpoint> uniformcodes) {
-
-        return 0;
-    }
-
-
-    int addPoint(String regioncompanyid, String id, String stationId, List<Standardpoint> uniformcodes) {
-
-        return 0;
-    }
-
-    int addPoint(String regioncompanyid, String id, List<Standardpoint> uniformcodes) {
-
-        return 0;
-    }
-
-    int addPoint(String regioncompanyid, List<Standardpoint> uniformcodes) {
-
-        return 0;
-    }
-
-    int addPoint(List<Standardpoint> uniformcodes) {
-
-        List<Companys> companysList = companysService.getCompanysByidAndRid("");
-        for (Companys c : companysList) {
-            List<Region> regionList = regionService.getReginBycode(c.getCapacityunit());
-            for (Region r : regionList) {
-                List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
-                for (Standardpoint p : uniformcodes) {
 
-                    if ("czjs".equals(p.getType())) {
-
-                        List<Windpowerstationpointnew> staionList=  fjd(p, windpowerstationList);
-                        for (Windpowerstationpointnew i : staionList){
-                            boolean b = windpowerstationpointnewService.addOrUpdate(i);
-                        }
-
-                    } else {
-                        //fjjs
-                        //fjjcd
+            } else {
+                //fjjs
+                //fjjcd
 
+                for (Companys c : companysList) {
+                    List<Region> regionList = regionService.getReginBycode(c.getCapacityunit());
+                    for (Region r : regionList) {
+                        List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
                         List<Windturbinetestingpointnew> testingList = czd(p, windpowerstationList);
-                        for (Windturbinetestingpointnew i: testingList){
-                            boolean b = windturbinetestingpointnewService.addOrUpdate(i);
+                        for (Windturbinetestingpointnew i : testingList) {
+//                            boolean b = windturbinetestingpointnewService.addOrUpdate(i);
                         }
-
                     }
-
                 }
-
-
             }
 
         }
@@ -236,47 +78,55 @@ public class PointGenerateService {
         return 0;
     }
 
-    private List<Windpowerstationpointnew> fjd(Standardpoint p, List<Windpowerstation> windpowerstationList) {
+    private List<Windpowerstationpointnew> fjd(Standardpoint p, List<Companys> companysList) {
         List<Windpowerstationpointnew> stationList = new ArrayList<>();
 
         Windpowerstationpointnew stationpoint = null;
 
-        for (Windpowerstation station : windpowerstationList) {
-            List<Windpowerstationpointnew> list1 = windpowerstationpointnewService.getStationpointByUniformcode(station.getId(), p.getUniformcode());
-            if (null != list1 && list1.size() > 0) {
-                continue;
-            }
-            stationpoint = new Windpowerstationpointnew();
-            stationpoint.setCode("");
-            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) {
-                    continue;
-                }
-                stationpoint = new Windpowerstationpointnew();
-                stationpoint.setCode("");
-                stationpoint.setName(project.getName() + p.getName());
-                stationpoint.setUniformcode(p.getUniformcode());
-                stationList.add(stationpoint);
+        for (Companys c : companysList) {
+            List<Region> regionList = regionService.getReginBycode(c.getCapacityunit());
+            for (Region r : regionList) {
+                List<Windpowerstation> windpowerstationList = windpowerstationService.getList(r.getCompanyid());
 
-                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) {
+                for (Windpowerstation station : windpowerstationList) {
+                    List<Windpowerstationpointnew> list1 = windpowerstationpointnewService.getStationpointByUniformcode(station.getId(), p.getUniformcode());
+                    if (null != list1 && list1.size() > 0) {
                         continue;
                     }
                     stationpoint = new Windpowerstationpointnew();
                     stationpoint.setCode("");
-                    stationpoint.setName(l.getName() + p.getName());
+                    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) {
+                            continue;
+                        }
+                        stationpoint = new Windpowerstationpointnew();
+                        stationpoint.setCode("");
+                        stationpoint.setName(project.getName() + p.getName());
+                        stationpoint.setUniformcode(p.getUniformcode());
+                        stationList.add(stationpoint);
+
+                        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) {
+                                continue;
+                            }
+                            stationpoint = new Windpowerstationpointnew();
+                            stationpoint.setCode("");
+                            stationpoint.setName(l.getName() + p.getName());
+                            stationpoint.setUniformcode(p.getUniformcode());
+                            stationList.add(stationpoint);
+
+                        }
+                    }
                 }
             }
         }
@@ -303,13 +153,13 @@ public class PointGenerateService {
                     continue;
                 }
                 testing = new Windturbinetestingpointnew();
+
                 testing.setCode("fjjs".equals(p.getType()) ? "INITIAL" : "");
                 testing.setName(w.getName() + p.getName());
                 testing.setUniformcode(p.getUniformcode());
                 testing.setWindpowerstationid(w.getWindpowerstationid());
                 testingList.add(testing);
             }
-
         }
 
         return testingList;