Преглед на файлове

首页数据查询优化

shilin преди 1 година
родител
ревизия
d5feb24b3a

+ 4 - 1
web/monitor-web-sxjn/pom.xml

@@ -380,7 +380,6 @@
             <groupId>com.gyee</groupId>
             <artifactId>common</artifactId>
             <version>1.0-SNAPSHOT</version>
-            <scope>compile</scope>
         </dependency>
     </dependencies>
 
@@ -472,6 +471,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
+
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
@@ -481,6 +481,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.3.7.RELEASE</version>
                 <executions>
                     <execution>
                         <goals>
@@ -490,6 +491,8 @@
                 </executions>
                 <configuration>
                     <mainClass>com.gyee.SpringbootStart</mainClass>
+                    <!--maven编译时将本地引用的jar包一起打包-->
+                    <includeSystemScope>true</includeSystemScope>
                 </configuration>
 
             </plugin>

+ 8 - 8
web/monitor-web-sxjn/src/main/java/com/gyee/SpringbootStart.java

@@ -46,14 +46,14 @@ public class SpringbootStart {
 //        System.out.println("结束导出地调测点。。。。。。");
 
 
-
-        String[] arr = {"HR01_XL"};
-        System.out.println("开始导出逆变器测点。。。。。。");
-        for(String s:arr){
-            initialPointGoldenService.initalNbq(s);
-        }
-//        initialPointGoldenService.initalNbq();
-        System.out.println("结束导出逆变器测点。。。。。。");
+//
+//        String[] arr = {"HR01_XL"};
+//        System.out.println("开始导出逆变器测点。。。。。。");
+//        for(String s:arr){
+//            initialPointGoldenService.initalNbq(s);
+//        }
+////        initialPointGoldenService.initalNbq();
+//        System.out.println("结束导出逆变器测点。。。。。。");
 
 
 

+ 173 - 7
web/monitor-web-sxjn/src/main/java/com/gyee/frame/common/spring/InitialRunner.java

@@ -6,14 +6,12 @@ import com.gyee.frame.common.cache.IGlobalCache;
 import com.gyee.frame.model.auto.*;
 import com.gyee.frame.service.*;
 import com.gyee.frame.service.photovolatic.*;
+import com.gyee.frame.util.StringUtils;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -89,6 +87,9 @@ public class InitialRunner implements CommandLineRunner {
     @Resource
     private ProjectPGService projectPGService;
 
+    @Resource
+    private ProjectPlanService projectPlanService;
+
     private final String QS = "0";
     private final String FD = "-1";
     private final String GF = "-2";
@@ -194,6 +195,14 @@ public class InitialRunner implements CommandLineRunner {
     public static Map<String,Junctionbox> hlxmap = new HashMap<String, Junctionbox>();
     public static Map<String,Integer> wppointnummap=new HashMap<>();
     public static Map<String, Map<String, PhotovoltaicTestingPointNew>> phPointmap = new HashMap<String, Map<String, PhotovoltaicTestingPointNew>>();// 逆变器测点
+    
+    /*********************************************首页缓存************************************************************/
+    // 获取计划发电量信息
+    public static  Map<String, Map<String, Double>> planmap = new HashMap<>();
+    //光伏省份装机容量和台数统计
+    public static  Map<String, Double> gftjmap = new HashMap<>();
+
+    /*********************************************首页缓存************************************************************/
     /***********************************************光伏初始化*************************************************************/
 
     Map<String, Object> ycmap = new HashMap<>();
@@ -483,13 +492,13 @@ public class InitialRunner implements CommandLineRunner {
 
 
         WindpowerstationExample.Criteria cr=windpowerstationExample.createCriteria();
-        cr.andIdNotLike("%HR_GDC%");
-//        cr.andIdNotLike("%PL_GDC%");
+        cr.andIdNotLike("%PL_GDC%");
         cr.andIdNotLike("%TL_GDC%");
         cr.andIdNotLike("%TZ_GDC%");
         cr.andIdNotLike("%YG_GDC%");
         cr.andIdNotLike("%YX_GDC%");
-        cr.andIdNotLike("%YY_GDC%");
+
+        cr.andIdNotLike("%MLJ_FDC%");
 
         wpallls = windpowerstationService.selectByExample(windpowerstationExample);
         if (!wpallls.isEmpty()) {
@@ -1023,7 +1032,164 @@ public class InitialRunner implements CommandLineRunner {
         projectpgExample.createCriteria().getAllCriteria();
         projectPGs = projectPGService.selectByExample(projectpgExample);
         pjpggroupmap = projectPGs.stream().collect(Collectors.groupingBy(ProjectPG::getWindpowerstationid));
+        //计划发电量统计
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        int year = cal.get(Calendar.YEAR);
+
+        List<ProjectPlan> pjls = projectPlanService.getProjectPlanList(String.valueOf(year));
+
+        setPlanInfoByType(planmap, pjls);
+
+
+        //光伏装机统计
+        gftj();
+
+    }
+
+
+
+    private void setPlanInfoByType(Map<String, Map<String, Double>> gxkmap, List<ProjectPlan> planls) {
+
+        double yfdljh = 0.0;
+        double yfdlsj = 0.0;
+        double nfdljh = 0.0;
+        double nfdlsj = 0.0;
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        int month = cal.get(Calendar.MONTH) + 1;
+        int num = 1;
+
+
+        for (ProjectPlan plan : planls) {
+
+            double fdl = null != plan.getGeneratingcapacity() ? Double.valueOf(plan.getGeneratingcapacity()) : 0.0;
+
+            double sjfdl = null != plan.getOutagehours() ? Double.valueOf(plan.getOutagehours()) : 0.0;
+
+
+            if (gxkmap.containsKey(plan.getWindpower())) {
+
+                Map<String, Double> map = gxkmap.get(plan.getWindpower());
+                if (StringUtils.notEmp(plan.getMonth())) {
+                    int planmonth = Integer.valueOf(plan.getMonth());
+                    if (planmonth == month) {
+
+                        yfdljh = map.get("yfdljh");
+                        yfdlsj = map.get("yfdlsj");
+
+                        yfdljh = yfdljh + fdl;
+                        yfdlsj = yfdlsj + sjfdl;
+
+                        map.put("yfdljh", yfdljh);
+                        map.put("yfdlsj", yfdlsj);
+                    }
+
+                    nfdljh = map.get("nfdljh");
+                    nfdlsj = map.get("nfdlsj");
+                    nfdlsj = nfdlsj + sjfdl;
+                    nfdljh = nfdljh + Double.parseDouble(plan.getGeneratingcapacity());
+//                    nfdlsj = nfdlsj + Double.parseDouble(plan.getOutagehours());
+                    map.put("nfdljh", nfdljh);
+                    map.put("nfdlsj", nfdlsj);
+
+                }
+            } else {
+                Map<String, Double> map = new HashMap<>();
+
+                if (StringUtils.notEmp(plan.getMonth())) {
+                    int planmonth = Integer.valueOf(plan.getMonth());
+                    if (planmonth == month) {
+
+                        map.put("yfdljh", fdl);
+                        map.put("yfdlsj", sjfdl);
+                        map.put("nfdljh", 0.00);
+                        map.put("nfdlsj", 0.00);
+                    } else {
+                        map.put("nfdljh", fdl);
+                        map.put("nfdlsj", sjfdl);
+                        map.put("yfdljh", 0.00);
+                        map.put("yfdlsj", 0.00);
+                    }
+
+
+                }
+                gxkmap.put(plan.getWindpower(), map);
+            }
+
+        }
+
 
     }
+    
+    
+    private void gftj()
+    {
+
+        for(Windpowerstation wp:spls)
+        {
+            if (wp.getId().endsWith("GDC") && InitialRunner.gp_sqmap.containsKey(wp.getId())) {
+
+
+
+                List<Square> sqls = InitialRunner.gp_sqmap.get(wp.getId());
+                for (Square sq : sqls) {
+                    if (sq.getTypes().equals("ZC")) {
+                        if (StringUtils.notEmp(wp.getPhoto()) && gftjmap.containsKey(wp.getPhoto() + "_zc_zjts")) {
+
+                            double temp = gftjmap.get(wp.getPhoto() + "_zc_zjts");
+                            if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
+                                List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
+                                temp = temp + nbqls.size();
+
+                            }
+
+                            gftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
+                        } else {
+                            double temp = wp.getQuantity();
+                            gftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
+                        }
 
+
+                    } else {
+                        if (StringUtils.notEmp(wp.getPhoto()) && gftjmap.containsKey(wp.getPhoto() + "_jz_zjts")) {
+
+                            double temp = gftjmap.get(wp.getPhoto() + "_jz_zjts");
+                            if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
+                                List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
+                                temp = temp + nbqls.size();
+
+//                                        qjny_gf_jzts=qjny_gf_jzts + nbqls.size();
+//                                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
+//                                        {
+//                                            jr_gf_jzts=jr_gf_jzts + nbqls.size();
+//                                        }
+                            }
+                            gftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
+                        } else {
+                            double temp = wp.getQuantity();
+                            gftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
+                        }
+                    }
+                }
+            } else {
+
+                if (StringUtils.notEmp(wp.getPhoto()) && gftjmap.containsKey(wp.getPhoto() + "_zjts")) {
+
+                    double temp = gftjmap.get(wp.getPhoto() + "_zjts");
+                    temp = temp + wp.getQuantity();
+
+
+                    gftjmap.put(wp.getPhoto() + "_zjts", temp);
+                } else {
+                    double temp = wp.getQuantity();
+                    gftjmap.put(wp.getPhoto() + "_zjts", temp);
+                }
+
+
+            }
+        }
+       
+    }
 }

+ 2 - 2
web/monitor-web-sxjn/src/main/java/com/gyee/frame/mapper/auto/WarningRecordsMapper.java

@@ -96,6 +96,6 @@ public interface WarningRecordsMapper {
      */
     int updateByPrimaryKey(WarningRecords record);
 
-    List<SimpleVo> countWpwarnByWp();
-    List<SimpleVo> countWpwarnByPj();
+    List<SimpleVo> countWpwarnByWp(@Param("tname") String tname);
+    List<SimpleVo> countWpwarnByPj(@Param("tname") String tname);
 }

+ 124 - 32
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WarningRecordsService.java

@@ -14,6 +14,7 @@ import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -353,6 +354,73 @@ public class WarningRecordsService implements BaseService<WarningRecords, Warnin
 
 		return vo;
 	}
+//	/**
+//	 * 获取七天内各个风场报警统计
+//	 * @return
+//	 */
+//	public List<SimpleVo> countWpwarnByWp() {
+//
+//		List<SimpleVo> vos=new ArrayList<>();
+//		List<SimpleVo> ls= warningRecordsMapper.countWpwarnByWp();
+//		if(!ls.isEmpty())
+//		{
+//			Map<String,SimpleVo> map=new HashMap<>();
+//			for(SimpleVo vo:ls)
+//			{
+//				map.put(vo.getId(),vo);
+//			}
+//
+//			for(Windpowerstation wp:InitialRunner.wpls)
+//			{
+//				SimpleVo vo=new SimpleVo();
+//				vo.setId(wp.getId());
+//				vo.setName(wp.getName());
+//				vo.setValue(0);
+//				if(map.containsKey(wp.getId()))
+//				{
+//					SimpleVo votemp=map.get(wp.getId());
+//					vo.setValue(votemp.getValue());
+//				}
+//				vos.add(vo);
+//			}
+//		}
+//		return vos;
+//
+//	}
+//
+//	/**
+//	 * 获取七天内各个项目报警统计
+//	 * @return
+//	 */
+//	public List<SimpleVo> countWpwarnByPj() {
+//
+//		List<SimpleVo> vos=new ArrayList<>();
+//		List<SimpleVo> ls= warningRecordsMapper.countWpwarnByPj();
+//		if(!ls.isEmpty())
+//		{
+//			Map<String,SimpleVo> map=new HashMap<>();
+//			for(SimpleVo vo:ls)
+//			{
+//				map.put(vo.getId(),vo);
+//			}
+//
+//			for(Project pj:InitialRunner.pjls)
+//			{
+//				SimpleVo vo=new SimpleVo();
+//				vo.setId(pj.getId());
+//				vo.setName(pj.getName());
+//				vo.setValue(0);
+//				if(map.containsKey(pj.getId()))
+//				{
+//					SimpleVo votemp=map.get(pj.getId());
+//					vo.setValue(votemp.getValue());
+//				}
+//				vos.add(vo);
+//			}
+//		}
+//		return vos;
+//
+//	}
 	/**
 	 * 获取七天内各个风场报警统计
 	 * @return
@@ -360,29 +428,41 @@ public class WarningRecordsService implements BaseService<WarningRecords, Warnin
 	public List<SimpleVo> countWpwarnByWp() {
 
 		List<SimpleVo> vos=new ArrayList<>();
-		List<SimpleVo> ls= warningRecordsMapper.countWpwarnByWp();
-		if(!ls.isEmpty())
+		SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
+		Calendar cal = Calendar.getInstance();
+		Date endDate = cal.getTime();
+
+		for(Windpowerstation wp:InitialRunner.wpls)
 		{
-			Map<String,SimpleVo> map=new HashMap<>();
-			for(SimpleVo vo:ls)
-			{
-				map.put(vo.getId(),vo);
-			}
 
-			for(Windpowerstation wp:InitialRunner.wpls)
-			{
-				SimpleVo vo=new SimpleVo();
-				vo.setId(wp.getId());
-				vo.setName(wp.getName());
-				vo.setValue(0);
-				if(map.containsKey(wp.getId()))
+			if (wp.getId().endsWith("_FDC")) {
+
+				SimpleVo vo=null;
+
+				StringBuilder tablename = new StringBuilder();
+				tablename.append("alarmhistory_");
+				tablename.append(wp.getId().split("_")[0]);
+				tablename.append("_");
+				tablename.append(sdf_no_underline.format(endDate));
+				List<SimpleVo> ls= warningRecordsMapper.countWpwarnByWp(String.valueOf(tablename));
+				if(!ls.isEmpty())
 				{
-					SimpleVo votemp=map.get(wp.getId());
-					vo.setValue(votemp.getValue());
+					vo=ls.get(0);
+					vo.setName(wp.getName());
+				}else
+				{
+					vo=new SimpleVo();
+					vo.setId(wp.getId());
+					vo.setName(wp.getName());
+					vo.setValue(0);
 				}
+
 				vos.add(vo);
 			}
+
+
 		}
+
 		return vos;
 
 	}
@@ -394,30 +474,42 @@ public class WarningRecordsService implements BaseService<WarningRecords, Warnin
 	public List<SimpleVo> countWpwarnByPj() {
 
 		List<SimpleVo> vos=new ArrayList<>();
-		List<SimpleVo> ls= warningRecordsMapper.countWpwarnByPj();
-		if(!ls.isEmpty())
+		SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
+		Calendar cal = Calendar.getInstance();
+		Date endDate = cal.getTime();
+
+		for(Windpowerstation wp:InitialRunner.wpls)
 		{
-			Map<String,SimpleVo> map=new HashMap<>();
-			for(SimpleVo vo:ls)
-			{
-				map.put(vo.getId(),vo);
-			}
 
-			for(Project pj:InitialRunner.pjls)
-			{
-				SimpleVo vo=new SimpleVo();
-				vo.setId(pj.getId());
-				vo.setName(pj.getName());
-				vo.setValue(0);
-				if(map.containsKey(pj.getId()))
+			if (wp.getId().endsWith("_FDC")) {
+
+				SimpleVo vo=null;
+
+				StringBuilder tablename = new StringBuilder();
+				tablename.append("alarmhistory_");
+				tablename.append(wp.getId().split("_")[0]);
+				tablename.append("_");
+				tablename.append(sdf_no_underline.format(endDate));
+				List<SimpleVo> ls= warningRecordsMapper.countWpwarnByPj(String.valueOf(tablename));
+				if(!ls.isEmpty())
 				{
-					SimpleVo votemp=map.get(pj.getId());
-					vo.setValue(votemp.getValue());
+					vo=ls.get(0);
+					vo.setName(wp.getName());
+				}else
+				{
+					vo=new SimpleVo();
+					vo.setId(wp.getId());
+					vo.setName(wp.getName());
+					vo.setValue(0);
 				}
+
 				vos.add(vo);
 			}
+
+
 		}
 		return vos;
 
 	}
+
 }

+ 131 - 200
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java

@@ -16,7 +16,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import javax.xml.crypto.Data;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
@@ -1846,17 +1845,19 @@ public class GenreSetPushService {
                 int daynum = c.get(Calendar.DAY_OF_MONTH);
 
 /**********************************************首页电量统计**********************************************************/
-                Calendar cal = Calendar.getInstance();
-                cal.setTime(new Date());
-                int year = cal.get(Calendar.YEAR);
-
-                List<ProjectPlan> pjls = projectPlanService.getProjectPlanList(String.valueOf(year));
+//                Calendar cal = Calendar.getInstance();
+//                cal.setTime(new Date());
+//                int year = cal.get(Calendar.YEAR);
+//
+//                List<ProjectPlan> pjls = projectPlanService.getProjectPlanList(String.valueOf(year));
+//
+//                // 获取计划发电量信息
+//                Map<String, Map<String, Double>> planmap = new HashMap<>();
+//
+//                setPlanInfoByType(planmap, pjls, id);
 
                 // 获取计划发电量信息
-                Map<String, Map<String, Double>> planmap = new HashMap<>();
-
-                setPlanInfoByType(planmap, pjls, id);
-
+                Map<String, Map<String, Double>> planmap = InitialRunner.planmap;
 
                 Map<String, Double> sftjmap = new HashMap<>();//省份装机容量和台数统计
                 for (Windpowerstation wp : wplist) {
@@ -1994,95 +1995,78 @@ public class GenreSetPushService {
                         sftjmap.put(wp.getCompanyid() + "_zjrl", temp);
                     }
 
-                    if (wp.getId().endsWith("GDC") && InitialRunner.gp_sqmap.containsKey(wp.getId())) {
-//                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
-//                        {
-//                            jr_gf_zjrl=jr_gf_zjrl+wp.getCapacity();
-//                            jr_gfts=jr_gfts++;
-//                        }
-//
-//                        qjny_gf_zjrl=qjny_gf_zjrl+wp.getCapacity();
-//                        qjny_gfts=qjny_gfts++;
 
-                        List<Square> sqls = InitialRunner.gp_sqmap.get(wp.getId());
-                        for (Square sq : sqls) {
-                            if (sq.getTypes().equals(ZC)) {
-                                if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_zc_zjts")) {
 
-                                    double temp = sftjmap.get(wp.getPhoto() + "_zc_zjts");
-                                    if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
-                                        List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
-                                        temp = temp + nbqls.size();
-
-//                                        qjny_gf_zcts=qjny_gf_zcts + nbqls.size();
+//                    if (wp.getId().endsWith("GDC") && InitialRunner.gp_sqmap.containsKey(wp.getId())) {
+////                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
+////                        {
+////                            jr_gf_zjrl=jr_gf_zjrl+wp.getCapacity();
+////                            jr_gfts=jr_gfts++;
+////                        }
+////
+////                        qjny_gf_zjrl=qjny_gf_zjrl+wp.getCapacity();
+////                        qjny_gfts=qjny_gfts++;
 //
+//                        List<Square> sqls = InitialRunner.gp_sqmap.get(wp.getId());
+//                        for (Square sq : sqls) {
+//                            if (sq.getTypes().equals(ZC)) {
+//                                if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_zc_zjts")) {
 //
-//                                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
-//                                        {
-//                                            jr_gf_zcts=jr_gf_zcts + nbqls.size();
+//                                    double temp = sftjmap.get(wp.getPhoto() + "_zc_zjts");
+//                                    if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
+//                                        List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
+//                                        temp = temp + nbqls.size();
 //
-//                                         }
-                                    }
-
-                                    sftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
-                                } else {
-                                    double temp = wp.getQuantity();
-                                    sftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
-                                }
-
-
-                            } else {
-                                if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_jz_zjts")) {
-
-                                    double temp = sftjmap.get(wp.getPhoto() + "_jz_zjts");
-                                    if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
-                                        List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
-                                        temp = temp + nbqls.size();
-
-//                                        qjny_gf_jzts=qjny_gf_jzts + nbqls.size();
-//                                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
-//                                        {
-//                                            jr_gf_jzts=jr_gf_jzts + nbqls.size();
-//                                        }
-                                    }
-                                    sftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
-                                } else {
-                                    double temp = wp.getQuantity();
-                                    sftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
-                                }
-                            }
-                        }
-                    } else {
-
-                        if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_zjts")) {
-
-                            double temp = sftjmap.get(wp.getPhoto() + "_zjts");
-                            temp = temp + wp.getQuantity();
-
-
-                            sftjmap.put(wp.getPhoto() + "_zjts", temp);
-                        } else {
-                            double temp = wp.getQuantity();
-                            sftjmap.put(wp.getPhoto() + "_zjts", temp);
-                        }
-
-//                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
-//                        {
-//                            jr_fd_zjrl=jr_fd_zjrl+wp.getCapacity();
-//                            jr_fjts=jr_fjts++;
+//                                    }
+//
+//                                    sftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
+//                                } else {
+//                                    double temp = wp.getQuantity();
+//                                    sftjmap.put(wp.getPhoto() + "_zc_zjts", temp);
+//                                }
+//
+//
+//                            } else {
+//                                if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_jz_zjts")) {
+//
+//                                    double temp = sftjmap.get(wp.getPhoto() + "_jz_zjts");
+//                                    if (InitialRunner.sq_nbqmap.containsKey(sq.getId())) {
+//                                        List<Inverter> nbqls = InitialRunner.sq_nbqmap.get(sq.getId());
+//                                        temp = temp + nbqls.size();
+//
+////                                        qjny_gf_jzts=qjny_gf_jzts + nbqls.size();
+////                                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
+////                                        {
+////                                            jr_gf_jzts=jr_gf_jzts + nbqls.size();
+////                                        }
+//                                    }
+//                                    sftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
+//                                } else {
+//                                    double temp = wp.getQuantity();
+//                                    sftjmap.put(wp.getPhoto() + "_jz_zjts", temp);
+//                                }
+//                            }
 //                        }
-//                        qjny_fjts=qjny_fjts++;
-//                        qjny_fd_zjrl=qjny_fd_zjrl+wp.getCapacity();
+//                    } else {
 //
-//                        qjny_fj_ts=qjny_fj_ts + wp.getQuantity();
-//                        if(AccessConfig.getWpmap().containsKey(wp.getId()))
-//                        {
-//                            jr_fj_ts=jr_fj_ts + wp.getQuantity();
+//                        if (StringUtils.notEmp(wp.getPhoto()) && sftjmap.containsKey(wp.getPhoto() + "_zjts")) {
+//
+//                            double temp = sftjmap.get(wp.getPhoto() + "_zjts");
+//                            temp = temp + wp.getQuantity();
+//
+//
+//                            sftjmap.put(wp.getPhoto() + "_zjts", temp);
+//                        } else {
+//                            double temp = wp.getQuantity();
+//                            sftjmap.put(wp.getPhoto() + "_zjts", temp);
 //                        }
-                    }
+//
+//
+//                    }
 
                 }
 
+                sftjmap.putAll(InitialRunner.gftjmap);
 
                 Map<String, Double> newpointmap = new HashMap<>();
 
@@ -2522,14 +2506,24 @@ public class GenreSetPushService {
 
 /*************************************************风场指标*************************************************************/
 
-            Map<String, Object> tqmap = weatherService.getWeatherRealInfo(id);
+//            Map<String, Object> tqmap = weatherService.getWeatherRealInfo(id);
+//            map.put("tqmap", tqmap);
+//
+//
+//            Map<String, Object> weathermap = weatherDay5Service.getWeatherRealDay5Info(id);
+//            map.put("tqmap5", weathermap);
+//            Map<String, Object> xtmap = tooltipAjax();
+//            map.put("xtmap", xtmap);
+
+            Map<String, Object> tqmap = new HashMap();
             map.put("tqmap", tqmap);
 
 
-            Map<String, Object> weathermap = weatherDay5Service.getWeatherRealDay5Info(id);
+            Map<String, Object> weathermap =  new HashMap();
             map.put("tqmap5", weathermap);
             Map<String, Object> xtmap = tooltipAjax();
             map.put("xtmap", xtmap);
+
 /*************************************************基础指标*************************************************************/
             Map<String, Object> jczbmap = new HashMap<>();
 
@@ -2635,20 +2629,42 @@ public class GenreSetPushService {
 
             }
 
-
+            List<String> pointid=new ArrayList<>();
 //            if (id.equals(QY+QS)) {
             // 减排二氧化碳
+            double jpeyht = 0.0;
             Windpowerstationpointnew temppoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_JPEYHT);
-            double jpeyht = (realApiUtil.getRealData(temppoint).getPointValueInDouble());
+            pointid.add(temppoint.getCode());
+
             // 节约标煤
+            double jybm = 0.0;
             temppoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_JYBM);
-            double jybm = (realApiUtil.getRealData(temppoint).getPointValueInDouble());
+
+            pointid.add(temppoint.getCode());
             // 减排二氧化硫
+            double jpeyhl =0.0;
             temppoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_JPEYHL);
-            double jpeyhl = (realApiUtil.getRealData(temppoint).getPointValueInDouble());
+
+            pointid.add(temppoint.getCode());
             // 节约水
+            double jys =0.0;
             temppoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_JYS);
-            double jys = (realApiUtil.getRealData(temppoint).getPointValueInDouble());
+
+            pointid.add(temppoint.getCode());
+
+            // 安全天数
+            double aqts = 0.0;
+            temppoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_AQTS);
+            pointid.add(temppoint.getCode());
+            List<PointData> pointidlist = realApiUtil.getRealData(pointid);
+
+            if (!pointidlist.isEmpty() && pointidlist.size() == pointid.size()) {
+                jpeyht = (pointidlist.get(0).getPointValueInDouble());
+                jybm = (pointidlist.get(1).getPointValueInDouble());
+                jpeyhl = (pointidlist.get(2).getPointValueInDouble());
+                jys = (pointidlist.get(3).getPointValueInDouble());
+                aqts = (pointidlist.get(4).getPointValueInDouble());
+            }
 
 //                Double gfsjgl = realApiUtil.getRealData(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(GF, Constant.TPOINT_WP_SJGL)).getPointValueInDouble();
 //
@@ -2659,13 +2675,13 @@ public class GenreSetPushService {
             jczbmap.put("jybm", StringUtils.round(jybm, 2));
             jczbmap.put("jpeyhl", StringUtils.round(jpeyhl, 2));
             jczbmap.put("jys", StringUtils.round(jys, 2));
+            jczbmap.put("aqts", StringUtils.round(aqts, 2));
 
 //            }
 
-            // 安全天数
-            Windpowerstationpointnew temppoint1 = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_AQTS);
-            Double aqts = realApiUtil.getRealData(temppoint1).getPointValueInDouble();
-            jczbmap.put("aqts", StringUtils.round(aqts, 2));
+
+
+
             if (bzgl == 0.0) {
                 bzgl = 1.0;
             }
@@ -4251,115 +4267,30 @@ public class GenreSetPushService {
                 Map<String, Windpowerstationpointnew> map;
 
 
-//                WindPowerStationTestingPoint2 yxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_YXTS);
-//                WindPowerStationTestingPoint2 djts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_DJTS);
-//                WindPowerStationTestingPoint2 jxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_WHTJ);
-//                WindPowerStationTestingPoint2 tjts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_GZTJ);
-//                WindPowerStationTestingPoint2 lxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_TXZD);
-//
-//                PointData ptValue = realApiUtil.getRealData(yxts);
-//                retValue.put("yxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                ptValue = realApiUtil.getRealData(djts);
-//                retValue.put("djts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                ptValue = realApiUtil.getRealData(jxts);
-//                retValue.put("jxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                ptValue = realApiUtil.getRealData(tjts);
-//                retValue.put("tjts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                ptValue = realApiUtil.getRealData(lxts);
-//                retValue.put("lxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                if (wpId.endsWith("GDC")) {
-//                    WindPowerStationTestingPoint2 wd = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_FCCFTWD);
-//
-//                    if (StringUtils.notEmp(wd)) {
-//                        ptValue = realApiUtil.getRealData(wd);
-//                        retValue.put("cftwd", StringUtils.round(ptValue.getPointValueInDouble(), 2));
-//                    } else {
-//                        retValue.put("cftwd", 0.0);
-//                    }
-//
-//                }
                 PointData ptValue = null;
-                Windpowerstationpointnew wd = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_FCCFTWD);
-                ptValue = realApiUtil.getRealData(wd);
-                retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-                Windpowerstationpointnew fs = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SSFS);
-                ptValue = realApiUtil.getRealData(fs);
-                retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
 
+                List<String> pointid=new ArrayList<>();
 
                 if (V2Config.getHbmaps().containsKey(wpId + "_KEY")) {
                     retValue.put("hb", V2Config.getHbmaps().get(wpId + "_KEY"));
                 }
-//                if (wpId.equals(WpEnum.MHS_FDC.name())) {
-//
-//
-//                    retValue.put("hb", 1893.0);
-//
-//                } else if (wpId.equals(WpEnum.NSS_FDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.NSSWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1810.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.NSSPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.QS_FDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.QSWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1573.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.QSPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//
-//                } else if (wpId.equals(WpEnum.SBQ_FDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.SBQFGL_AI000305);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1357.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.JSFW_SBSSFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.DWK_GDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.DWKWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1100.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.DWKPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.PL_GDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.PLWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1080.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.PLPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.MCH_GDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.MCHWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1360.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.MCHPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.XH_GDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.XHWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1385.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.XHPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                }  else if (wpId.equals(WpEnum.HZJ_GDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.HZJWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 1385.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.HZJPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                } else if (wpId.equals(WpEnum.XS_FDC.name())) {
-//                    ptValue = realApiUtil.getRealData(ConstantTR.XSWD);
-//                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                    retValue.put("hb", 2210.0);
-//                    ptValue = realApiUtil.getRealData(ConstantTR.XSPJFS);
-//                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
-//                }
+
+                Windpowerstationpointnew wd = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_FCCFTWD);
+                pointid.add(wd.getCode());
+
+                Windpowerstationpointnew fs = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SSFS);
+                pointid.add(fs.getCode());
 
                 Windpowerstationpointnew glpoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SJGL);
-                ptValue = realApiUtil.getRealData(glpoint.getCode());
-                retValue.put("gl", StringUtils.round(ptValue.getPointValueInDouble(), 0));
+                pointid.add(glpoint.getCode());
+
+                List<PointData> wxsslist = realApiUtil.getRealData(pointid);
+
+                if (!wxsslist.isEmpty() && wxsslist.size() == pointid.size()) {
+                    retValue.put("dqwd", StringUtils.round(wxsslist.get(0).getPointValueInDouble(), 0));
+                    retValue.put("ssfs", StringUtils.round(wxsslist.get(1).getPointValueInDouble(), 0));
+                    retValue.put("gl", StringUtils.round(wxsslist.get(2).getPointValueInDouble(), 0));
+                }
             }
             resultmap.put(wpId, retValue);
         }

+ 18 - 0
web/monitor-web-sxjn/src/main/resources/application-jn.properties

@@ -0,0 +1,18 @@
+#\u5185\u5D4C\u7684web\u670D\u52A1\u5668\u7AEF\u53E3
+server.port=8171
+
+#\u670D\u52A1\u540D\u79F0
+spring.application.name=monitor-hb-provider
+spring.cloud.nacos.discovery.server-addr=192.168.1.103:8870
+#spring.cloud.nacos.discovery.server-addr=10.81.3.155:8848
+
+
+#nacos\u7684\u7528\u6237\u540D\u548C\u5BC6\u7801
+spring.cloud.nacos.username=nacos
+spring.cloud.nacos.password=nacos
+
+#spring boot actuator \u76D1\u63A7\u548C\u5065\u5EB7\u68C0\u67E5\u529F\u80FD
+management.endpoints.jmx.exposure.include=*
+management.endpoints.web.exposure.include=*
+management.endpoint.health.show-details=always
+

+ 15 - 0
web/monitor-web-sxjn/src/main/resources/mybatis/auto/ShutdowneventMapper.xml

@@ -503,6 +503,7 @@
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
+  <!--
   <select id="countStopByWp"  resultType="com.gyee.frame.model.custom.SimpleVo">
     select t.windpowerstationid id,count(*) value from shutdownevent t
     where  instr(t.windpowerstationid,'_FDC')>0 and t.statuscode=2
@@ -515,4 +516,18 @@
     and t.stoptime >= (select max(stoptime)-7 from shutdownevent)
     and t.stoptime &lt;= (select max(stoptime) from shutdownevent) and t.windturbineid = t1.id group by t1.projectid  order by t1.projectid
   </select>
+  -->
+
+  <select id="countStopByWp"  resultType="com.gyee.frame.model.custom.SimpleVo">
+    select b.windpowerstationid id, count(*) filter(where a.stoptime between (SELECT current_date - interval '7 day') and current_date) as
+        value from shutdownevent a,windturbine b
+    where  a.windturbineid = b.id and a.statuscode=2   group by b.windpowerstationid
+
+  </select>
+
+  <select id="countStopByPj"  resultType="com.gyee.frame.model.custom.SimpleVo">
+    select b.projectid id, count(*) filter(where a.stoptime between (SELECT current_date - interval '7 day') and current_date) as
+        value from shutdownevent a,windturbine b
+    where  a.windturbineid = b.id and a.statuscode=2   group by b.projectid
+  </select>
 </mapper>

+ 25 - 7
web/monitor-web-sxjn/src/main/resources/mybatis/auto/WarningRecordsMapper.xml

@@ -396,18 +396,36 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
 
+  <!--
+    <select id="countWpwarnByWp"  resultType="com.gyee.frame.model.custom.SimpleVo">
+
+      select t.windpowerstationid id,count(*) value from warningrecords t
+      where  instr(t.windpowerstationid,'_FDC')>0
+      and t.warningtime >= (select max(warningtime)-7 from warningrecords)
+      and t.warningtime &lt;= (select max(warningtime) from warningrecords)  group by t.windpowerstationid
+    </select>
+
+    <select id="countWpwarnByPj"  resultType="com.gyee.frame.model.custom.SimpleVo">
+  select t1.projectid  id,count(*) value from warningrecords t,windturbine t1 where  instr(t.windpowerstationid,'_FDC')>0
+      and t.warningtime >= (select max(warningtime)-7 from warningrecords)
+      and t.warningtime &lt;= (select max(warningtime) from warningrecords) and t.windturbineid = t1.id group by t1.projectid  order by t1.projectid
+
+    </select>-->
+
   <select id="countWpwarnByWp"  resultType="com.gyee.frame.model.custom.SimpleVo">
 
-    select t.windpowerstationid id,count(*) value from warningrecords t
-    where  instr(t.windpowerstationid,'_FDC')>0
-    and t.warningtime >= (select max(warningtime)-7 from warningrecords)
-    and t.warningtime &lt;= (select max(warningtime) from warningrecords)  group by t.windpowerstationid
+    select b.stationid id, count(*) filter(where a.alerttime between (SELECT current_date - interval '7 day') and current_date) as
+        value   from ${tname} a,alarmsnap b
+    where a.snapid = b.id and category1='windturbine' and b.category2 is not null
+      and b.category2!='other' group by b.stationid
+
   </select>
 
   <select id="countWpwarnByPj"  resultType="com.gyee.frame.model.custom.SimpleVo">
-select t1.projectid  id,count(*) value from warningrecords t,windturbine t1 where  instr(t.windpowerstationid,'_FDC')>0
-    and t.warningtime >= (select max(warningtime)-7 from warningrecords)
-    and t.warningtime &lt;= (select max(warningtime) from warningrecords) and t.windturbineid = t1.id group by t1.projectid  order by t1.projectid
+    select b.projectid id, count(*) filter(where a.alerttime between (SELECT current_date - interval '7 day') and current_date) as
+        value   from ${tname} a,alarmsnap b
+    where a.snapid = b.id and category1='windturbine' and b.category2 is not null
+      and b.category2!='other' group by b.projectid
 
   </select>
 </mapper>