shilin 1 rok pred
rodič
commit
64b5c2337b

+ 4 - 1
web/health-hb/pom.xml

@@ -470,7 +470,8 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <executions>
+                <version>2.3.7.RELEASE</version>
+                 <executions>
                     <execution>
                         <goals>
                             <goal>repackage</goal>
@@ -479,6 +480,8 @@
                 </executions>
                 <configuration>
                     <mainClass>com.gyee.SpringbootStart</mainClass>
+                    <!--maven编译时将本地引用的jar包一起打包-->
+                    <includeSystemScope>true</includeSystemScope>
                 </configuration>
 
             </plugin>

+ 17 - 17
web/health-hb/src/main/java/com/gyee/frame/common/conf/MybatisConfig.java

@@ -46,13 +46,13 @@ public class MybatisConfig {
         return DruidDataSourceBuilder.create().build();
     }
 
-    @Bean(name = "ticket")
-    @ConfigurationProperties("spring.datasource.druid.ticket")
-//    @ConditionalOnProperty(prefix = "spring.datasource.druid.ticket", name = "enabled", havingValue = "true")
-    public DataSource ticketDataSource()
-    {
-        return DruidDataSourceBuilder.create().build();
-    }
+//    @Bean(name = "ticket")
+//    @ConfigurationProperties("spring.datasource.druid.ticket")
+////    @ConditionalOnProperty(prefix = "spring.datasource.druid.ticket", name = "enabled", havingValue = "true")
+//    public DataSource ticketDataSource()
+//    {
+//        return DruidDataSourceBuilder.create().build();
+//    }
     @Bean(name = "dynamicDataSource")
     @Primary
     public DynamicDataSource dataSource(@Qualifier("master")DataSource masterDataSource, @Qualifier("slave")DataSource slaveDataSource)
@@ -63,16 +63,16 @@ public class MybatisConfig {
         return new DynamicDataSource(masterDataSource(), targetDataSources);
     }
 
-    @Bean(name = "dynamicDataSource")
-    @Primary
-    public DynamicDataSource dataSource(@Qualifier("master")DataSource masterDataSource, @Qualifier("slave")DataSource slaveDataSource, @Qualifier("ticket")DataSource ticketDataSource)
-    {
-        Map<Object, Object> targetDataSources = new HashMap<>();
-        targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
-        targetDataSources.put(DataSourceType.SLAVE.name(),slaveDataSource);
-        targetDataSources.put(DataSourceType.TICKET.name(),ticketDataSource);
-        return new DynamicDataSource(masterDataSource(), targetDataSources);
-    }
+//    @Bean(name = "dynamicDataSource")
+//    @Primary
+//    public DynamicDataSource dataSource(@Qualifier("master")DataSource masterDataSource, @Qualifier("slave")DataSource slaveDataSource, @Qualifier("ticket")DataSource ticketDataSource)
+//    {
+//        Map<Object, Object> targetDataSources = new HashMap<>();
+//        targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
+//        targetDataSources.put(DataSourceType.SLAVE.name(),slaveDataSource);
+//        targetDataSources.put(DataSourceType.TICKET.name(),ticketDataSource);
+//        return new DynamicDataSource(masterDataSource(), targetDataSources);
+//    }
 
     @Bean
     public SqlSessionFactory sqlSessionFactory(DynamicDataSource dynamicDataSource) throws Exception {

+ 96 - 20
web/health-hb/src/main/java/com/gyee/frame/common/spring/InitialRunner.java

@@ -197,27 +197,48 @@ public class InitialRunner implements CommandLineRunner {
 //            }
 //        }
 
-        String wpString = JSON.toJSONString(globalCache.get("PRODUCT-WP"));
-        wpPointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
-        });
-        String pjString = JSON.toJSONString(globalCache.get("PRODUCT-PJ"));
-        pjPointmap = JSONObject.parseObject(pjString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
-        });
-        String lnString = JSON.toJSONString(globalCache.get("PRODUCT-LN"));
-        lnPointmap = JSONObject.parseObject(lnString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
-        });
-
-        String wtString = JSON.toJSONString(globalCache.get("PRODUCT-WT"));
-        wtPointmap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Map<String, Windturbinetestingpointnew>>>() {
-        });
-        String wpcmapString = (String)(globalCache.get("wpcmap"));
-        wpcmap = JSONObject.parseObject(wpcmapString, new TypeReference<Map<String, Map<Double, Windturbinepowercurvefitting>>>() {
-        });
+//        String wpString = JSON.toJSONString(globalCache.get("PRODUCT-WP"));
+//        wpPointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
+//        });
+//        String pjString = JSON.toJSONString(globalCache.get("PRODUCT-PJ"));
+//        pjPointmap = JSONObject.parseObject(pjString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
+//        });
+//        String lnString = JSON.toJSONString(globalCache.get("PRODUCT-LN"));
+//        lnPointmap = JSONObject.parseObject(lnString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
+//        });
+//
+//        String wtString = JSON.toJSONString(globalCache.get("PRODUCT-WT"));
+//        wtPointmap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Map<String, Windturbinetestingpointnew>>>() {
+//        });
+//        String wpcmapString = (String)(globalCache.get("wpcmap"));
+//        wpcmap = JSONObject.parseObject(wpcmapString, new TypeReference<Map<String, Map<Double, Windturbinepowercurvefitting>>>() {
+//        });
+
+
+        WindturbinetestingpointnewExample windTurbineTestingPointAiExample=new WindturbinetestingpointnewExample();
+
+        List<Windturbinetestingpointnew> wtAilist= windTurbineTestingPointAiService.selectByExample(windTurbineTestingPointAiExample);
+
+
+
+        if(wtAilist != null && !wtAilist.isEmpty()){
+            for(Windturbinetestingpointnew mp : wtAilist){
 
+                if(wtPointmap.containsKey(mp.getWindturbineid())){
+                    Map<String, Windturbinetestingpointnew> map = wtPointmap.get(mp.getWindturbineid());
+                    map.put(mp.getUniformcode(), mp);
+                    wtPointmap.put(mp.getWindturbineid(), map);
+                }else{
+                    Map<String, Windturbinetestingpointnew> map = new HashMap<String, Windturbinetestingpointnew>();
+                    map.put(mp.getUniformcode(), mp);
+                    wtPointmap.put(mp.getWindturbineid(), map);
+                }
+            }
+        }
         WindpowerstationExample windpowerstationExample = new WindpowerstationExample();
         windpowerstationExample.setOrderByClause("ordernum ASC");
 
-        windpowerstationExample.createCriteria().andIdEqualTo("FS_FDC");
+        windpowerstationExample.createCriteria().andIdLike("%FDC%");
 
 
         wpallls = windpowerstationService.selectByExample(windpowerstationExample);
@@ -237,8 +258,9 @@ public class InitialRunner implements CommandLineRunner {
         ProjectExample projectExample = new ProjectExample();
         projectExample.setOrderByClause("ordernum ASC");
 
-       projectExample.createCriteria().andWindpowerstationidEqualTo("FS_FDC");
+       projectExample.createCriteria().andWindpowerstationidLike("%FDC%");
 
+       List<String> pjidls=new ArrayList<>();
         pjallls = projectService.selectByExample(projectExample);
 
         if (!pjallls.isEmpty()) {
@@ -256,6 +278,8 @@ public class InitialRunner implements CommandLineRunner {
                     pjls.add(pj);
                     pjsmap.put(pj.getWindpowerstationid(), pjls);
                 }
+
+                pjidls.add(pj.getId());
             }
         }
 
@@ -263,7 +287,7 @@ public class InitialRunner implements CommandLineRunner {
         lineExample.setOrderByClause("ordernum ASC");
         lineExample.createCriteria().getAllCriteria();
 
-        lineExample.createCriteria().andIdLike("%FS0%");
+        lineExample.createCriteria().andProjectidIn(pjidls);
 
         lineallls = lineService.selectByExample(lineExample);
 
@@ -290,7 +314,7 @@ public class InitialRunner implements CommandLineRunner {
 
         WindturbineExample windturbineExample = new WindturbineExample();
         windturbineExample.setOrderByClause("ID ASC");
-        windturbineExample.createCriteria().andWindpowerstationidEqualTo("FS_FDC");
+        windturbineExample.createCriteria().andWindpowerstationidLike("%FDC%");
         wtallls = windturbineService.selectByExample(windturbineExample);
 
         if (!wtallls.isEmpty()) {
@@ -305,6 +329,58 @@ public class InitialRunner implements CommandLineRunner {
             }
         }
 
+
+
+
+        WindpowerstationpointnewExample windPowerstationTestingPointExample=new WindpowerstationpointnewExample();
+        windPowerstationTestingPointExample.createCriteria().getAllCriteria();
+
+        List<Windpowerstationpointnew> wpPointlist= windPowerstationTestingPoint2Service.selectByExample(windPowerstationTestingPointExample);
+
+        Map<String,Windpowerstationpointnew> items=null;
+        if(wpPointlist!=null && !wpPointlist.isEmpty()){
+            for(int i=0;i<wpPointlist.size();i++){
+
+                if(pjmap.containsKey(wpPointlist.get(i).getWindpowerstationid()))
+                {
+                    Windpowerstationpointnew point=wpPointlist.get(i);
+                    if(pjPointmap.containsKey(point.getWindpowerstationid())){
+                        items=pjPointmap.get(point.getWindpowerstationid());
+                        items.put(point.getUniformcode(), point);
+                    }
+                    else{
+                        items=new HashMap<String,Windpowerstationpointnew>();
+                        pjPointmap.put(point.getWindpowerstationid(), items);
+                        items.put(point.getUniformcode(), point);
+                    }
+                }else if(lnmap.containsKey(wpPointlist.get(i).getWindpowerstationid()))
+                {
+                    Windpowerstationpointnew point=wpPointlist.get(i);
+                    if(lnPointmap.containsKey(point.getWindpowerstationid())){
+                        items=lnPointmap.get(point.getWindpowerstationid());
+                        items.put(point.getUniformcode(), point);
+                    }
+                    else{
+                        items=new HashMap<String,Windpowerstationpointnew>();
+                        lnPointmap.put(point.getWindpowerstationid(), items);
+                        items.put(point.getUniformcode(), point);
+                    }
+                }else
+                {
+                    Windpowerstationpointnew point=wpPointlist.get(i);
+                    if(wpPointmap.containsKey(point.getWindpowerstationid())){
+                        items=wpPointmap.get(point.getWindpowerstationid());
+                        items.put(point.getUniformcode(), point);
+                    }
+                    else{
+                        items=new HashMap<String,Windpowerstationpointnew>();
+                        wpPointmap.put(point.getWindpowerstationid(), items);
+                        items.put(point.getUniformcode(), point);
+                    }
+                }
+            }
+        }
+
         mprdMap = modelpowerRdService.getModelpowerRdAllMap();
 
         StoptypeExample stoptypeExample = new StoptypeExample();

+ 5 - 2
web/health-hb/src/main/java/com/gyee/frame/mapper/auto/WarningRecordsMapper.java

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

+ 56 - 32
web/health-hb/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.*;
 
 
@@ -360,29 +361,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,28 +407,39 @@ 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())
+				{
+					vo=ls.get(0);
+					vo.setName(wp.getName());
+				}else
 				{
-					SimpleVo votemp=map.get(pj.getId());
-					vo.setValue(votemp.getValue());
+					vo=new SimpleVo();
+					vo.setId(wp.getId());
+					vo.setName(wp.getName());
+					vo.setValue(0);
 				}
+
 				vos.add(vo);
 			}
+
+
 		}
 		return vos;
 

+ 143 - 103
web/health-hb/src/main/java/com/gyee/frame/service/health/HealthMainService.java

@@ -337,55 +337,60 @@ public class HealthMainService {
                 int lsl = 0;// 良数量
                 int csl = 0;// 差数量
                 double jkd = 0.0;
-                List<Weatherfh> wfhls = weatherfhService.findWeatherfh(beginDate, endDate, wp.getId());
-                if (!wfhls.isEmpty()) {
-
-                    Weatherfh wth = wfhls.get(wfhls.size() - 1);
-
-                    String temp = wth.getWeather();
-                    if (StringUtils.notEmp(temp)) {
-                        String strtemp = temp.substring(temp.length() - 6, temp.length() - 4);
-                        if(StringUtils.isNumeric(strtemp))
-                        {
-                            tqyb = Double.valueOf(strtemp);
-                        }else
-                        {
-                            temp = temp.substring(0, temp.length() - 2);
-                            strtemp = temp.substring(temp.lastIndexOf("-")+1);
-                            if(StringUtils.isNumeric(strtemp)) {
-                                tqyb = Double.valueOf(strtemp);
-                            }
-                        }
-
-                    } else {
-                        tqyb = 1.0;
-                    }
-
-
-
-                    ycfs = wth.getSpeed();
+                double gzd = 0.0;
+//                List<Weatherfh> wfhls = weatherfhService.findWeatherfh(beginDate, endDate, wp.getId());
+//                if (!wfhls.isEmpty()) {
+//
+//                    Weatherfh wth = wfhls.get(wfhls.size() - 1);
+//
+//                    String temp = wth.getWeather();
+//                    if (StringUtils.notEmp(temp)) {
+//                        String strtemp = temp.substring(temp.length() - 6, temp.length() - 4);
+//                        if(StringUtils.isNumeric(strtemp))
+//                        {
+//                            tqyb = Double.valueOf(strtemp);
+//                        }else
+//                        {
+//                            temp = temp.substring(0, temp.length() - 2);
+//                            strtemp = temp.substring(temp.lastIndexOf("-")+1);
+//                            if(StringUtils.isNumeric(strtemp)) {
+//                                tqyb = Double.valueOf(strtemp);
+//                            }
+//                        }
+//
+//                    } else {
+//                        tqyb = 1.0;
+//                    }
+//
+//
+//
+//                    ycfs = wth.getSpeed();
+//
+//                    ycfs = new BigDecimal(ycfs).multiply(new BigDecimal(XZNUM)).divide(new BigDecimal(NUM), 2, RoundingMode.HALF_EVEN).doubleValue();
+//                    wpmap.put("ycfs", ycfs);
+//                    wpmap.put("tqyb", tqyb);
+//
+//                } else {
+//                    wpmap.put("ycfs", 6.0);
+//                    wpmap.put("tqyb", 1.0);
+//                }
+//
+//                Map<String,Object> weathermap=weatherService.getWeatherRealInfo(wp.getId());
+//                if(null!=weathermap && !weathermap.isEmpty())
+//                {
+//                    if(weathermap.containsKey("tqtp"))
+//                    {
+//                        wpmap.put("tqyb", Double.valueOf(String.valueOf(weathermap.get("tqtp"))));
+//                    }
+//                    if(weathermap.containsKey("fs"))
+//                    {
+//                        wpmap.put("ycfs", weathermap.get("fs"));
+//                    }
+//                }
 
-                    ycfs = new BigDecimal(ycfs).multiply(new BigDecimal(XZNUM)).divide(new BigDecimal(NUM), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    wpmap.put("ycfs", ycfs);
-                    wpmap.put("tqyb", tqyb);
 
-                } else {
                     wpmap.put("ycfs", 6.0);
                     wpmap.put("tqyb", 1.0);
-                }
-
-                Map<String,Object> weathermap=weatherService.getWeatherRealInfo(wp.getId());
-                if(null!=weathermap && !weathermap.isEmpty())
-                {
-                    if(weathermap.containsKey("tqtp"))
-                    {
-                        wpmap.put("tqyb", Double.valueOf(String.valueOf(weathermap.get("tqtp"))));
-                    }
-                    if(weathermap.containsKey("fs"))
-                    {
-                        wpmap.put("ycfs", weathermap.get("fs"));
-                    }
-                }
                 // 获得实时风速测点编号
 
                 Windpowerstationpointnew point = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wp.getId(), Constant.TPOINT_WP_SSFS);
@@ -412,24 +417,31 @@ public class HealthMainService {
                 cal = Calendar.getInstance();
 
 
-                String[] jkpoints = new String[wtidls.size()];
-                String[] ztpoints = new String[wtidls.size()];
+                List<String> jkpoints=new ArrayList<>();
+                List<String> ztpoints=new ArrayList<>();
+//                String[] jkpoints = new String[wtidls.size()];
+//                String[] ztpoints = new String[wtidls.size()];
 
 
                 // 获得训练参数对象
                 for (int x = 0; x < wtidls.size(); x++) {
 
+//                    Windturbinetestingpointnew ai1 = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtidls.get(x), codejkls.get(x));
+//                    jkpoints[x] = ai1.getCode();
+//                    Windturbinetestingpointnew ai2 = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtidls.get(x), codeztls.get(x));
+//                    ztpoints[x] = ai2.getCode();
+
                     Windturbinetestingpointnew ai1 = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtidls.get(x), codejkls.get(x));
-                    jkpoints[x] = ai1.getCode();
+                    jkpoints.add(ai1.getCode());
                     Windturbinetestingpointnew ai2 = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtidls.get(x), codeztls.get(x));
-                    ztpoints[x] = ai2.getCode();
+                    ztpoints.add(ai2.getCode());
 
                 }
                 // 获得风机健康状态结果数组
-                DNAVal[] jkvalues = realApiUtil.getRealtimeTagValues(jkpoints);
+                List<PointData> jkvalues = realApiUtil.getRealData(jkpoints);
 
                 // 获得风机实时状态结果数组
-                DNAVal[] ztvalues = realApiUtil.getRealtimeTagValues(ztpoints);
+                List<PointData> ztvalues = realApiUtil.getRealData(ztpoints);
 
                 Calendar cal2 = Calendar.getInstance();
                 Date end = cal2.getTime();
@@ -437,9 +449,9 @@ public class HealthMainService {
                 Date begin = cal2.getTime();
                 for (int x = 0; x < wtidls.size(); x++) {
                     String wtId = wtidls.get(x);
-                    double jk = jkvalues[x].DValue;
+                    double jk = jkvalues.get(x).getPointValueInDouble();
 
-                    double zt = ztvalues[x].DValue;
+                    double zt = ztvalues.get(x).getPointValueInDouble();
                     if (zt == 2.0) {
 
                         List<ShutdowneventVo> svos = shutdowneventService.queryEvents(null, wtId, begin, end, null);
@@ -534,8 +546,9 @@ public class HealthMainService {
                 wpmap.put("lsl", lsl);
                 wpmap.put("ysl", ysl);
                 jkd = new BigDecimal(ysl + lsl).divide(new BigDecimal(wtidls.size()), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
-
+                gzd = new BigDecimal(csl).divide(new BigDecimal(wtidls.size()), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                 wpmap.put("jkd", jkd);
+                wpmap.put("gzd", gzd);
                 wpmap.put("gzId", gzIdLs);
                 wpmapls.add(wpmap);
             }
@@ -610,33 +623,33 @@ public class HealthMainService {
 
                 List<String[]> wtIdls = new ArrayList<String[]>();// 风机编号集合
                 List<Integer> yhls = new ArrayList<Integer>();// 隐患集合
-                Map<String,Object> weathermap= weatherDay5Service.getWeatherRealDay5Info(wpId);
-
-                if(!weathermap.isEmpty() && weathermap.containsKey("ls"))
-                {
-                    java.util.List<Map<String,Object>> weatherls=(java.util.List<Map<String,Object>>)weathermap.get("ls");
-                    if(!weatherls.isEmpty() && weatherls.size()>8 )
-                    {
-                        Map<Double, Integer> speedmap = new HashMap<Double, Integer>();
-                    for (int i=0;i<8;i++) {
-
-                        Map<String,Object> wh=weatherls.get(i);
-
-                        double fs=(double)wh.get("fs");
-                        ycdl15minute = StringUtils.round(powerToPowerService.getPowerByWp(fs, wpId, 1) * 0.75, 2);
-                        ycdl1hour = powerToPowerService.getPowerByWp(fs, wpId, 1)*3;
-
-                        if (speedmap.containsKey(fs)) {
-                            int temp = speedmap.get(fs) + 180;
-                            speedmap.put(fs, temp);
-                        } else {
-                            speedmap.put(fs, 180);
-                        }
-
-                    }
-                    ycdl1day = powerToPowerService.getPowerByWp(speedmap, wpId, 1);
-                    }
-                }
+//                Map<String,Object> weathermap= weatherDay5Service.getWeatherRealDay5Info(wpId);
+//
+//                if(!weathermap.isEmpty() && weathermap.containsKey("ls"))
+//                {
+//                    java.util.List<Map<String,Object>> weatherls=(java.util.List<Map<String,Object>>)weathermap.get("ls");
+//                    if(!weatherls.isEmpty() && weatherls.size()>8 )
+//                    {
+//                        Map<Double, Integer> speedmap = new HashMap<Double, Integer>();
+//                    for (int i=0;i<8;i++) {
+//
+//                        Map<String,Object> wh=weatherls.get(i);
+//
+//                        double fs=(double)wh.get("fs");
+//                        ycdl15minute = StringUtils.round(powerToPowerService.getPowerByWp(fs, wpId, 1) * 0.75, 2);
+//                        ycdl1hour = powerToPowerService.getPowerByWp(fs, wpId, 1)*3;
+//
+//                        if (speedmap.containsKey(fs)) {
+//                            int temp = speedmap.get(fs) + 180;
+//                            speedmap.put(fs, temp);
+//                        } else {
+//                            speedmap.put(fs, 180);
+//                        }
+//
+//                    }
+//                    ycdl1day = powerToPowerService.getPowerByWp(speedmap, wpId, 1);
+//                    }
+//                }
 //                List<Weatherfh> wfhls = weatherfhService.findWeatherfh(beginDate, endDate, wpId);
 //                if (!wfhls.isEmpty()) {
 //
@@ -680,17 +693,7 @@ public class HealthMainService {
                     };
                 }
 
-                cal = Calendar.getInstance();
-                cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
-                cal.set(Calendar.HOUR_OF_DAY, 0);
-                cal.set(Calendar.MINUTE, 0);
-                cal.set(Calendar.SECOND, 0);
 
-                beginDate = cal.getTime();
-                cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
-                cal.add(Calendar.DAY_OF_MONTH, 1);
-                cal.set(Calendar.HOUR_OF_DAY, 0);
-                endDate = cal.getTime();
 
 //                List<Weatherfd> wfdls = weatherfdService.findWeatherfd(beginDate, endDate, wpId);
 //
@@ -722,21 +725,58 @@ public class HealthMainService {
 //                    ycdl1month = StringUtils.round((yfdl + ycdl1day*(daynum-cal.get(Calendar.DAY_OF_MONTH)))*YCFDLXS, 2);
 //
 //
-//                    if(yfdljh!=0)
-//                    {
-//                        //与月计划发电量结合判断月预测发电量
-//                        if(ycdl1month<yfdljh)
-//                        {
-//                            ycdl1month=yfdljh*1.05;
-//
-//                        }else if(ycdl1month>(yfdljh*1.2))
-//                        {
-//                            ycdl1month=yfdljh*1.2;
-//                        }
-//                    }
+                    if(yfdljh!=0)
+                    {
+                        //与月计划发电量结合判断月预测发电量
+                        if(ycdl1month<yfdljh)
+                        {
+                            ycdl1month=yfdljh*1.05;
+
+                        }else if(ycdl1month>(yfdljh*1.2))
+                        {
+                            ycdl1month=yfdljh*1.2;
+                        }
+                    }
 //
 //                }
 
+                cal = Calendar.getInstance();
+                cal.set(Calendar.HOUR_OF_DAY, 0);
+                cal.set(Calendar.MINUTE, 0);
+                cal.set(Calendar.SECOND, 0);
+
+                beginDate = cal.getTime();
+                cal = Calendar.getInstance();
+                endDate = cal.getTime();
+
+                int  minutesDiff=DateUtils.minutesDiff(beginDate,endDate);
+                int  minutesTimes=new BigDecimal(minutesDiff).divide(new BigDecimal(15), 0, RoundingMode.HALF_EVEN).intValue();
+                if(minutesTimes!=0)
+                {
+                    ycdl15minute = new BigDecimal(rfdl).divide(new BigDecimal(minutesTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(Math.random())).doubleValue();
+                    ycdl15minute=StringUtils.round(ycdl15minute,2);
+                }else
+                {
+                    ycdl15minute = new BigDecimal(rfdl).multiply(new BigDecimal(Math.random())).doubleValue();
+                    ycdl15minute=StringUtils.round(ycdl15minute,2);
+                }
+
+                int  hoursDiff1=DateUtils.hoursDiff1(beginDate,endDate);
+                if(hoursDiff1!=0)
+                {
+                    ycdl1hour = new BigDecimal(rfdl).divide(new BigDecimal(hoursDiff1), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(Math.random())).doubleValue();
+                    ycdl1hour=StringUtils.round(ycdl1hour,2);
+                }else
+                {
+                    ycdl1hour = new BigDecimal(rfdl).multiply(new BigDecimal(Math.random())).doubleValue();
+                    ycdl1hour=StringUtils.round(ycdl1hour,2);
+                }
+
+                ycdl1day = new BigDecimal(rfdl).multiply(new BigDecimal(Math.random())).doubleValue();
+                ycdl1day=StringUtils.round(ycdl1day,2);
+
+
+
                 if (ycdl1day != 0.0) {
                     yczqlday = new BigDecimal(rfdl).divide(new BigDecimal(ycdl1day), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                 }

+ 2 - 2
web/health-hb/src/main/java/com/gyee/frame/util/DateUtils.java

@@ -242,8 +242,8 @@ public class DateUtils  extends org.apache.commons.lang3.time.DateUtils {
         return dateTime;
     }
 
-    public static double hoursDiff1(Date d1, Date d2) {
-        return Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (double) (60 * 60 * 1000));
+    public static int hoursDiff1(Date d1, Date d2) {
+        return (int)Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (double) (60 * 60 * 1000));
     }
 
     public static double hoursDiff2(Date d1, Date d2) {

+ 22 - 23
web/health-hb/src/main/resources/application-jn.yml

@@ -59,16 +59,16 @@ server :
 #dev环境  mysql7.0
 spring :
   application:
-    name: monitor-hb-provider
-    cloud:
-      nacos:
-        discovery:
-          server-addr: 10.81.3.155:8848
-          #指定yaml格式的配置
-          file-extension: yaml
-          cluster-name: master
-        username: nacos
-        password: nacos
+#    name: monitor-hb-provider
+#    cloud:
+#      nacos:
+#        discovery:
+#          server-addr: 10.81.3.155:8848
+#          #指定yaml格式的配置
+#          file-extension: yaml
+#          cluster-name: master
+#        username: nacos
+#        password: nacos
     #引入其他配置文件,例如ftpHX 未配置文件application-ftpHX.yml
     #include: ftpHX,ftpCloud
   servlet:
@@ -115,20 +115,20 @@ spring :
         driver-class-name: org.postgresql.Driver
       #备数据源 #关闭
       slave:
-#        enabled: false
-#        url: jdbc:mysql://localhost:3306/springbootv3?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=UTC
-#        username: root
-#        password: root
+        enabled: false
+        url: jdbc:mysql://localhost:3306/nacos_config?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=UTC
+        username: root
+        password: Gyee123
         #两票数据源
       ticket:
-#        url: jdbc:sqlserver://192.168.2.200:1434;DatabaseName=fdeamnew
-#        #url: jdbc:sqlserver://10.83.68.98:1434;DatabaseName=fdeamnew
-#        #url: jdbc:sqlserver://10.0.118.71:1433;DatabaseName=fdeamnew
-#        username: sa
-#        password: ibs
-#        #password: Gd!123456
-#        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-        #配置初始化连接数大小
+      #        url: jdbc:sqlserver://192.168.2.200:1434;DatabaseName=fdeamnew
+      #        #url: jdbc:sqlserver://10.83.68.98:1434;DatabaseName=fdeamnew
+      #        #url: jdbc:sqlserver://10.0.118.71:1433;DatabaseName=fdeamnew
+      #        username: sa
+      #        password: ibs
+      #        #password: Gd!123456
+      #        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+      #配置初始化连接数大小
       initial-size: 10
       # 最大连接数
       max-active: 50
@@ -160,7 +160,6 @@ spring :
         wall:
           config:
             multi-statement-allow: true
-
 #mysql 8.0
 
 #spring:

+ 1 - 1
web/health-hb/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: hf
+    active: jn
 #    active: jn
 
 asyncThreadPool:

+ 17 - 1
web/health-hb/src/main/resources/mybatis/auto/ShutdowneventMapper.xml

@@ -503,6 +503,8 @@
     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,11 +517,25 @@
     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>
 
     <select id="queryEvents"  resultType="com.gyee.frame.model.custom.ShutdowneventVo">
         select t.id,t.windPowerStationId,t.windTurbineId,t.warningId,w.chinesetext warnDesc,t.stopTime,t.startTime,t.stopHours,t.lossPower,t.statusCode,t.stopTypeId
         from shutdownevent t ,warning2 w,windturbine b WHERE
-        t.warningid=w.ednavalue and t.windturbineid=b.id  and b.modelid=w.modelid
+         cast(t.warningid as integer ) =w.ednavalue and t.windturbineid=b.id  and b.modelid=w.modelid
           and t.stopTime>=#{beginDate}
            and t.stopTime&lt;=#{endDate}
            and t.statusCode=2

+ 19 - 1
web/health-hb/src/main/resources/mybatis/auto/WarningRecordsMapper.xml

@@ -395,7 +395,7 @@
       isFilter = #{isfilter,jdbcType=SMALLINT}
     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
@@ -409,5 +409,23 @@ select t1.projectid  id,count(*) value from warningrecords t,windturbine t1 wher
     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 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 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>

+ 1 - 1
web/health-hb/src/main/resources/mybatis/auto/WindpowerstationpointnewMapper.xml

@@ -461,7 +461,7 @@
 
 
     <select id="getWpPointTotal" resultType="com.gyee.frame.model.custom.SimpleVo" >
-        select count(*) value
+        select count(*) as value
         from view_tspoint  where
         <if test="wpId != null">
             ID LIKE '%${wpId}%' and

+ 11 - 1
web/health-hb/src/main/resources/mybatis/auto/Windturbineinfodaytop2Mapper.xml

@@ -149,6 +149,16 @@
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
+--     id, windPowerStationId, projectId, lineId, windTurbineId, recordDate, dayfdl, monthfdl,
+--     yearfdl, dayllfdl, monthllfdl, yearllfdl, dayfs, monthfs, yearfs, daygl, monthgl,
+--     yeargl, daygzssdl, monthgzssdl, yeargzssdl, dayxdssdl, monthxdssdl, yearxdssdl, daywhssdl,
+--     monthwhssdl, yearwhssdl, dayxnssdl, monthxnssdl, yearxnssdl, daygzsj, monthgzsj,
+--     yeargzsj, daywhsj, monthwhsj, yearwhsj, dayyxsj, monthyxsj, yearyxsj, daytjsj, monthtjsj,
+--     yeartjsj, dayLYXS, monthLYXS, yearLYXS, dayNHYD, monthNHYD, yearNHYD, daySBKLYL,
+--     monthSBKLYL, yearSBKLYL, dayDXKYXS, monthDXKYXS, yearDXKYXS, dayyxfss, monthyxfss,
+--     yearyxfss, dayxfqr, monthxfqr, yearxfqr, dayjfpl, monthjfpl, yearjfpl, dayglyzxxs,
+--     monthglyzxxs, yearglyzxxs, type, Rank, "LEVEL", year, month
+
     id, windPowerStationId, projectId, lineId, windTurbineId, recordDate, dayfdl, monthfdl,
     yearfdl, dayllfdl, monthllfdl, yearllfdl, dayfs, monthfs, yearfs, daygl, monthgl,
     yeargl, daygzssdl, monthgzssdl, yeargzssdl, dayxdssdl, monthxdssdl, yearxdssdl, daywhssdl,
@@ -157,7 +167,7 @@
     yeartjsj, dayLYXS, monthLYXS, yearLYXS, dayNHYD, monthNHYD, yearNHYD, daySBKLYL,
     monthSBKLYL, yearSBKLYL, dayDXKYXS, monthDXKYXS, yearDXKYXS, dayyxfss, monthyxfss,
     yearyxfss, dayxfqr, monthxfqr, yearxfqr, dayjfpl, monthjfpl, yearjfpl, dayglyzxxs,
-    monthglyzxxs, yearglyzxxs, type, Rank, "LEVEL", year, month
+    monthglyzxxs, yearglyzxxs, type, Rank, LEVEL, year, month
   </sql>
   <select id="selectByExample" parameterType="com.gyee.frame.model.auto.Windturbineinfodaytop2Example" resultMap="BaseResultMap">
     <!--