Bladeren bron

接口调试修改

shilin 3 jaren geleden
bovenliggende
commit
3de27d8718

+ 7 - 7
src/main/java/com/gyee/SpringbootStart.java

@@ -20,12 +20,12 @@ public class SpringbootStart {
 
 
         InitialRedis initialRedis=new InitialRedis();
-        System.out.println("初始化开始!");
-        initialRedis.intialWindturbinepowercurvefitting();
-        initialRedis.intialWpScatter();
-        initialRedis.intialPjScatter();
-        initialRedis.intialLnScatter();
-        initialRedis.intialWtScatter();
-        System.out.println("初始化完成!");
+//        System.out.println("初始化开始!");
+//        initialRedis.intialWindturbinepowercurvefitting();
+//        initialRedis.intialWpScatter();
+//        initialRedis.intialPjScatter();
+//        initialRedis.intialLnScatter();
+//        initialRedis.intialWtScatter();
+//        System.out.println("初始化完成!");
     }
 }

+ 3 - 3
src/main/java/com/gyee/frame/common/spring/InitialRedis.java

@@ -117,7 +117,7 @@ public  class InitialRedis {
 
                // cal.add(Calendar.MONTH,1);
                 StringBuilder sb=new StringBuilder();
-                sb.append("scatter_").append(wpId).append("_").append(month);
+                sb.append("scatter_").append(wpId).append("_").append(j+1);
                 globalCache.set(String.valueOf(sb), JSON.toJSONString(vos));
                 System.out.println(String.valueOf(sb.append("完成")));
             }
@@ -197,7 +197,7 @@ public  class InitialRedis {
 
                 // cal.add(Calendar.MONTH,1);
                 StringBuilder sb=new StringBuilder();
-                sb.append("scatter_").append(wpId).append("_").append(month);
+                sb.append("scatter_").append(wpId).append("_").append(j+1);
                 globalCache.set(String.valueOf(sb), JSON.toJSONString(vos));
                 System.out.println(String.valueOf(sb.append("完成")));
             }
@@ -277,7 +277,7 @@ public  class InitialRedis {
 
                 // cal.add(Calendar.MONTH,1);
                 StringBuilder sb=new StringBuilder();
-                sb.append("scatter_").append(wpId).append("_").append(month);
+                sb.append("scatter_").append(wpId).append("_").append(j+1);
                 globalCache.set(String.valueOf(sb), JSON.toJSONString(vos));
                 System.out.println(String.valueOf(sb.append("完成")));
             }

+ 4 - 3
src/main/java/com/gyee/frame/common/spring/InitialRunner.java

@@ -81,6 +81,7 @@ public class InitialRunner implements CommandLineRunner {
 
     public static Map<String, Map<String, List<Warning2>>> warnmodelmap = new HashMap<>();// 按照型号划分报警MAP集合 <型号,<报警类型,报警集合>>
     public static Map<String, List<Warning2>> warnmap = new HashMap<>();// 按照型号划分报警MAP集合 <型号,报警集合>
+    public static List<WarningClassify> warningClassls = new ArrayList<WarningClassify>(); //报警类型列表
     public static Map<String, WarningClassify> warningClassifymap = new HashMap<String, WarningClassify>();
     public static Map<String, Manufacturer> manufacturermap = new HashMap<String, Manufacturer>();
 
@@ -423,9 +424,9 @@ public class InitialRunner implements CommandLineRunner {
         }
 
         WarningClassifyExample wcexample = new WarningClassifyExample();
-        List<WarningClassify> wcls = warningClassifyService.selectByExample(wcexample);
-        if (!wcls.isEmpty()) {
-            for (WarningClassify model : wcls) {
+        warningClassls = warningClassifyService.selectByExample(wcexample);
+        if (!warningClassls.isEmpty()) {
+            for (WarningClassify model : warningClassls) {
                 warningClassifymap.put(model.getId(), model);
             }
         }

+ 23 - 0
src/main/java/com/gyee/frame/controller/powercompare/PowerCompareController.java

@@ -33,6 +33,29 @@ public class PowerCompareController {
     @Resource
     private Windturbineinfoday3Service windturbineinfoday3Service;
 
+    /**
+     * 报警类型列表
+     * @return
+     */
+    @GetMapping("/warningClassAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "查询报警类型列表", notes = "查询报警类型列表")
+    public AjaxResult warningClassAjax() {
+
+        List<WarningClassify> vos = new ArrayList<WarningClassify>();
+        if(!InitialRunner.warningClassls.isEmpty())
+        {
+            vos=InitialRunner.warningClassls;
+        }
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
 
     /**
      * 风场下拉接口

+ 46 - 18
src/main/java/com/gyee/frame/service/health/HealthMainService.java

@@ -5,6 +5,7 @@ import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.*;
 import com.gyee.frame.model.custom.*;
 import com.gyee.frame.service.*;
+import com.gyee.frame.service.weather.WeatherDay5Service;
 import com.gyee.frame.service.weather.WeatherService;
 import com.gyee.frame.util.*;
 import org.springframework.stereotype.Service;
@@ -29,7 +30,8 @@ public class HealthMainService {
     private WindPowerstationTestingPointService windPowerstationTestingPointService;
     @Resource
     private WeatherService weatherService;
-
+    @Resource
+    private WeatherDay5Service weatherDay5Service;
 
     private final int digit = 2;
     private final double NUM = 3.6;
@@ -594,32 +596,58 @@ public class HealthMainService {
 
                 List<String[]> wtIdls = new ArrayList<String[]>();// 风机编号集合
                 List<Integer> yhls = new ArrayList<Integer>();// 隐患集合
+                Map<String,Object> weathermap= weatherDay5Service.getWeatherRealDay5Info(wpId);
 
-                List<Weatherfh> wfhls = weatherfhService.findWeatherfh(beginDate, endDate, wpId);
-                if (!wfhls.isEmpty()) {
+                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<Double, Integer> speedmap = new HashMap<Double, Integer>();
-                    for (Weatherfh wh : wfhls) {
-                        cal.setTime(wh.getRecodedata());
-                        int hourtemp = cal.get(Calendar.HOUR_OF_DAY);
-                        if (hourtemp == hour) {
-                            ycdl15minute = StringUtils.round(getPowerByWp(wh.getSpeed(), wpId, 1) * 0.25, 2);
-                        }
-                        if (hourtemp == hour + 1) {
-                            ycdl1hour = getPowerByWp(wh.getSpeed(), wpId, 1);
-                        }
+                        Map<String,Object> wh=weatherls.get(i);
+
+                        double fs=(double)wh.get("fs");
+                        ycdl15minute = StringUtils.round(getPowerByWp(fs, wpId, 1) * 0.25, 2);
+                        ycdl1hour = getPowerByWp(fs, wpId, 1);
 
-                        if (speedmap.containsKey(wh.getSpeed())) {
-                            int temp = speedmap.get(wh.getSpeed()) + 1;
-                            speedmap.put(wh.getSpeed(), temp);
+                        if (speedmap.containsKey(fs)) {
+                            int temp = speedmap.get(fs) + 1;
+                            speedmap.put(fs, temp);
                         } else {
-                            speedmap.put(wh.getSpeed(), 1);
+                            speedmap.put(fs, 1);
                         }
 
                     }
                     ycdl1day = getPowerByWp(speedmap, wpId, 1);
-
+                    }
                 }
+//                List<Weatherfh> wfhls = weatherfhService.findWeatherfh(beginDate, endDate, wpId);
+//                if (!wfhls.isEmpty()) {
+//
+//                    Map<Double, Integer> speedmap = new HashMap<Double, Integer>();
+//                    for (Weatherfh wh : wfhls) {
+//                        cal.setTime(wh.getRecodedata());
+//                        int hourtemp = cal.get(Calendar.HOUR_OF_DAY);
+//                        if (hourtemp == hour) {
+//                            ycdl15minute = StringUtils.round(getPowerByWp(wh.getSpeed(), wpId, 1) * 0.25, 2);
+//                        }
+//                        if (hourtemp == hour + 1) {
+//                            ycdl1hour = getPowerByWp(wh.getSpeed(), wpId, 1);
+//                        }
+//
+//                        if (speedmap.containsKey(wh.getSpeed())) {
+//                            int temp = speedmap.get(wh.getSpeed()) + 1;
+//                            speedmap.put(wh.getSpeed(), temp);
+//                        } else {
+//                            speedmap.put(wh.getSpeed(), 1);
+//                        }
+//
+//                    }
+//                    ycdl1day = getPowerByWp(speedmap, wpId, 1);
+//
+//                }
                 cal = Calendar.getInstance();
                 cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
                 cal.set(Calendar.HOUR_OF_DAY, 0);

+ 39 - 13
src/main/java/com/gyee/frame/service/health/HealthSubService.java

@@ -657,14 +657,15 @@ public class HealthSubService {
         Double[] sjglarr = new Double[length];
         Double[] llglarr = new Double[length];
         Double[] sjfsarr = new Double[length];
-
+        Long[] timearr = new Long[length];
         WindTurbineTestingPointAi2 sjgl = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.TPOINT_WT_FJGL);
 
         List<PointData> sjglls = realApiUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 24 * 3600L);
 
         if (!sjglls.isEmpty()) {
             for (int i = 0; i < sjglls.size() - 1; i++) {
-                sjglarr[i] = sjglls.get(i).getPointValueInDouble();
+                timearr[i]=sjglls.get(i).getPointTime();
+                sjglarr[i] = MathUtil.twoBit(sjglls.get(i).getPointValueInDouble());
             }
         }
         WindTurbineTestingPointAi2 llgl = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId, Constant.TPOINT_WT_LLGL);
@@ -673,7 +674,7 @@ public class HealthSubService {
 
         if (!llglls.isEmpty()) {
             for (int i = 0; i < llglls.size() - 1; i++) {
-                llglarr[i] = llglls.get(i).getPointValueInDouble();
+                llglarr[i] = MathUtil.twoBit(llglls.get(i).getPointValueInDouble());
             }
         }
 
@@ -683,20 +684,44 @@ public class HealthSubService {
 
         if (!ssfsls.isEmpty()) {
             for (int i = 0; i < ssfsls.size() - 1; i++) {
-                sjfsarr[i] = ssfsls.get(i).getPointValueInDouble();
+                sjfsarr[i] = MathUtil.twoBit(ssfsls.get(i).getPointValueInDouble());
             }
         }
 
         resultmap.put("sjgl", sjglarr);
         resultmap.put("llgl", llglarr);
         resultmap.put("ssfs", sjfsarr);
-
+        resultmap.put("timearr", timearr);
         resultmap.put("begin", begin);
         resultmap.put("end", end);
 
         return resultmap;
     }
 
+    private String selectCol(String value)
+    {
+        String col="#05bb4c";
+
+        switch (value) {
+            case "1.0":
+                col="#05bb4c";
+                break;
+            case "2.0":
+                col="#4b55ae";
+                break;
+            case "3.0":
+                col="#edbf03";
+                break;
+            case "4.0":
+                col="#e17e23";
+                break;
+
+            default:
+                break;
+        }
+
+        return col;
+    }
     /**
      * 数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量
      * @param wtId
@@ -732,15 +757,16 @@ public class HealthSubService {
 
         DNAVal[] ssjkvalues = realApiUtil.getRealtimeTagValues(jkpoints);
 
-        clxstrs[0] = String.valueOf(ssjkvalues[0].DValue);
-        fdjstrs[0] = String.valueOf(ssjkvalues[1].DValue);
-        bjstrs[0] = String.valueOf(ssjkvalues[2].DValue);
-        zkstrs[0] = String.valueOf(ssjkvalues[3].DValue);
 
-        zzstrs[0] = "1.0";
-        phstrs[0] = "1.0";
-        jcstrs[0] = "1.0";
-        bpqstrs[0] = "1.0";
+        clxstrs[0] = selectCol(String.valueOf(ssjkvalues[0].DValue));
+        fdjstrs[0] = selectCol(String.valueOf(ssjkvalues[1].DValue));
+        bjstrs[0] = selectCol(String.valueOf(ssjkvalues[2].DValue));
+        zkstrs[0] = selectCol(String.valueOf(ssjkvalues[3].DValue));
+
+        zzstrs[0] = selectCol(String.valueOf(1.0));;
+        phstrs[0] = selectCol(String.valueOf(1.0));;
+        jcstrs[0] = selectCol(String.valueOf(1.0));;
+        bpqstrs[0] =selectCol(String.valueOf(1.0));;
 
         StringBuilder clxsb = new StringBuilder();
         StringBuilder fdjsb = new StringBuilder();

+ 2 - 1
src/main/java/com/gyee/frame/service/report/WtHealthReport3Service.java

@@ -69,8 +69,9 @@ public class WtHealthReport3Service {
                 Windturbine wt = InitialRunner.wtmap.get(wtId);
 
 
+                //List<Wttragetreport3> wtreportls = wttragetreport3Service.findWttragetreport3(wtId, year, month);
 
-                List<Wttragetreport3> wtreportls = wttragetreport3Service.findWttragetreport3(wtId, year, month);
+                List<Wttragetreport3> wtreportls = wttragetreport3Service.findWttragetreport3(wtId,recorddate);
 
                 if (!wtreportls.isEmpty()) {
                     //获得健康报告主表信息

+ 26 - 1
src/main/java/com/gyee/frame/service/report/Wttragetreport3Service.java

@@ -5,11 +5,13 @@ import com.gyee.frame.common.support.Convert;
 import com.gyee.frame.mapper.auto.Wttragetreport3Mapper;
 import com.gyee.frame.model.auto.Wttragetreport3;
 import com.gyee.frame.model.auto.Wttragetreport3Example;
+import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -102,7 +104,7 @@ public class Wttragetreport3Service implements BaseService<Wttragetreport3, Wttr
 
 		List<Wttragetreport3> list=new ArrayList<>();
 
-		if(StringUtils.notEmp(wtId) && StringUtils.notEmp(wtId) && StringUtils.notEmp(wtId))
+		if(StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
 		{
 			Wttragetreport3Example example=new Wttragetreport3Example();
 			example.setOrderByClause("recodedate asc");
@@ -121,4 +123,27 @@ public class Wttragetreport3Service implements BaseService<Wttragetreport3, Wttr
 
 	}
 
+
+	public List<Wttragetreport3> findWttragetreport3(String wtId,  Date recorddate) {
+
+
+		List<Wttragetreport3> list=new ArrayList<>();
+
+		if(StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate) )
+		{
+			Wttragetreport3Example example=new Wttragetreport3Example();
+			example.setOrderByClause("recodedate asc");
+
+			Wttragetreport3Example.Criteria criteria =example.createCriteria();
+
+
+			criteria.andRecodedateGreaterThanOrEqualTo(recorddate).andRecodedateLessThan(DateUtils.addDays(recorddate,1));
+			list= wttragetreport3Mapper.selectByExample(example);
+		}
+
+
+		return list;
+
+	}
+
 }

+ 1 - 1
src/main/resources/application.yml

@@ -33,7 +33,7 @@ gyee:
   digit: 2
 #tomcat config
 server :
-  port : 8777
+  port : 8082
   session:
     timeout: 7200
   ##项目名字配置

+ 20 - 18
src/test/java/test/GoodnessTest.java

@@ -1,17 +1,19 @@
 package test;
 
-import com.github.pagehelper.PageInfo;
 import com.gyee.SpringbootStart;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.controller.goodness.WindturbineDetailLineChartController;
-import com.gyee.frame.model.auto.Brownoutsevent2;
+import com.gyee.frame.controller.goodness.WindturbineGoodnessDetailController;
+import com.gyee.frame.controller.goodness.WindturbinegoodnessController;
+import com.gyee.frame.model.custom.DataVo;
 import com.gyee.frame.model.custom.Tablepar;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 public class GoodnessTest {
 
@@ -36,9 +38,9 @@ public class GoodnessTest {
         String wpid = "MHS_FDC";
         String wtid = "MG01_02";
 
-//        WindturbinegoodnessController windturbinegoodnessController= SpringUtils.getBean("windturbinegoodnessController");
+        WindturbinegoodnessController windturbinegoodnessController= SpringUtils.getBean("windturbinegoodnessController");
         WindturbineDetailLineChartController windturbineDetailLineChartController = SpringUtils.getBean("windturbineDetailLineChartController");
-
+        WindturbineGoodnessDetailController windturbineGoodnessDetailController= SpringUtils.getBean("windturbineGoodnessDetailController");
 ////
 //
 //        AjaxResult ajaxResult = dayBenchmarkingController.gadaylist(wpid,"2021-01-01");
@@ -95,25 +97,25 @@ public class GoodnessTest {
 //            System.out.println(wtd.getWarnDesc()+"----------------"+wtd.getStartTime()+"----------------"+wtd.getStopTime());
 //        }
 //
-        AjaxResult ajaxResult3 =windturbineDetailLineChartController.xdjllist(tablepar,"MG01_07","2021-07-10");
-
-        PageInfo<Brownoutsevent2> test3=(PageInfo<Brownoutsevent2>)ajaxResult3.get("data");
-
-        for(Brownoutsevent2 wtd:test3.getList())
-        {
-            System.out.println(wtd.getLimitload()+"----------------"+wtd.getStoptime()+"----------------"+wtd.getLosspower());
-        }
+//        AjaxResult ajaxResult3 =windturbineDetailLineChartController.xdjllist(tablepar,"MG01_07","2021-07-10");
 //
+//        PageInfo<Brownoutsevent2> test3=(PageInfo<Brownoutsevent2>)ajaxResult3.get("data");
 //
+//        for(Brownoutsevent2 wtd:test3.getList())
+//        {
+//            System.out.println(wtd.getLimitload()+"----------------"+wtd.getStoptime()+"----------------"+wtd.getLosspower());
+//        }
 //
-//        AjaxResult ajaxResult4 =windturbineGoodnessDetailController.glchat(wtid,"2021-01-01");
 //
-//        List<DataVo> test4=(List<DataVo> )ajaxResult4.get("data");
 //
-//        for(DataVo wtd:test4)
-//        {
-//            System.out.println(wtd.getValue1()+"----------------"+wtd.getName()+"----------------"+wtd.getName());
-//        }
+        AjaxResult ajaxResult4 =windturbineGoodnessDetailController.glchat(wtid,"2021-07-01");
+
+        List<DataVo> test4=(List<DataVo> )ajaxResult4.get("data");
+
+        for(DataVo wtd:test4)
+        {
+            System.out.println(wtd.getValue1()+"----------------"+wtd.getName()+"----------------"+wtd.getName());
+        }
 //
 //        AjaxResult ajaxResult5 =windturbineGoodnessDetailController.fjfzy(wtid,"2021-01-01");
 //

+ 8 - 8
src/test/java/test/HealthTest.java

@@ -1,7 +1,6 @@
 package test;
 
 import com.gyee.SpringbootStart;
-import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.controller.health.HealthMainController;
 import com.gyee.frame.controller.health.HealthSubController;
@@ -11,6 +10,7 @@ import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Map;
 
 public class HealthTest {
 
@@ -44,10 +44,10 @@ public class HealthTest {
 //        System.out.println(map);
 //
 //        Map<String, Object> map1 =healthMainController.findWpMap("MHS_FDC");
-
-//        Map<String, Object> map =healthMainController.findHealthMatrixMap();
 //
-//       System.out.println(map);
+////        Map<String, Object> map =healthMainController.findHealthMatrixMap();
+////
+//       System.out.println(map1);
 //
 //
 //        Map<String, Object> map =healthMainController.findWpMap("MHS_FDC");
@@ -86,12 +86,12 @@ public class HealthTest {
 //        System.out.println(map1.size());
 
 
-//        Map<String, Object> map1 =healthSubController.findWtHealthInfo(wtid);
-//        System.out.println(map1.size());
+        Map<String, Object> map1 =healthSubController.getWtMttrandMtbfByBj(wtid);
+        System.out.println(map1.size());
 
 
-        AjaxResult ajax=windTurbineHealthListController.windTurbineHealthList("MHS_FDC");
-        System.out.println(ajax.size());
+//        AjaxResult ajax=windTurbineHealthListController.windTurbineHealthList("MHS_FDC");
+//        System.out.println(ajax.size());
         System.out.println("***************************************************************************************");