소스 검색

修正功率曲线

shilin 3 년 전
부모
커밋
4a53661725

+ 20 - 0
src/main/java/com/gyee/frame/controller/monitor/GenreSetPushController.java

@@ -83,6 +83,26 @@ public class GenreSetPushController {
 
     }
 
+    @PostMapping("/findPowerInfo")
+    @ResponseBody
+    @ApiOperation(value = "获取驾驶舱功率曲线图和电量柱状图信息", notes = "获取驾驶舱功率曲线图和电量柱状图信息")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "对象编号", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult findPowerInfo(String id) throws Exception {
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        if(StringUtils.notEmp(id))
+        {
+            map=genreSetPushService.findPowerInfo(id);
+        }
+
+        if (null!=map){
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
 
     @PostMapping("/findDayInfo")
     @ResponseBody

+ 83 - 0
src/main/java/com/gyee/frame/controller/warn/WeatherAnalysisController.java

@@ -0,0 +1,83 @@
+package com.gyee.frame.controller.warn;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.DataVo;
+import com.gyee.frame.service.weather.WeatherService;
+import com.gyee.frame.service.websocket.RealPowerPushService;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/weather")
+@Api(value = "天气预测", tags = "天气预测")
+public class WeatherAnalysisController {
+
+    private static final String format = "yyyy-MM-dd HH:mm";
+    @Resource
+    private WeatherService weatherService;
+    @Resource
+    private RealPowerPushService realPowerPushService;
+
+    @PostMapping("/weatherInfo")
+    @ResponseBody
+    @ApiOperation(value = "天气分析信息", notes = "天气分析信息")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult weatherInfo(String wpId) throws Exception {
+
+        Map<String, Object> map = new HashMap<>();
+        if (StringUtils.notEmp(wpId)) {
+
+            map = weatherService.getWeatherRealInfo(wpId);
+
+        }
+        if (null != map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        }
+
+    }
+
+    @PostMapping("/weatherChart")
+    @ResponseBody
+    @ApiOperation(value = "天气图表", notes = "天气图表")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult weatherChart(String wpId) throws Exception {
+
+        List<DataVo> glvos = new ArrayList<>();
+
+        if (StringUtils.notEmp(wpId)) {
+
+
+            glvos = realPowerPushService.findRealPower(wpId);
+        }
+
+        if (null != glvos) {
+            return AjaxResult.successData(AjaxStatus.success.code, glvos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, glvos);
+        }
+
+    }
+
+}

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

@@ -5,7 +5,6 @@ import com.gyee.frame.common.support.Convert;
 import com.gyee.frame.mapper.auto.StopAnalysisDetailVoMapper;
 import com.gyee.frame.model.auto.StopAnalysisDetailVo;
 import com.gyee.frame.model.auto.StopAnalysisDetailVoExample;
-import com.gyee.frame.util.SnowflakeIdWorker;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -52,7 +51,7 @@ public class StopAnalysisDetailVoService implements BaseService<StopAnalysisDeta
 	public int insertSelective(StopAnalysisDetailVo record) {
 				
 		//添加雪花主键id
-		record.setId(SnowflakeIdWorker.getUUID());
+//		record.setId(SnowflakeIdWorker.getUUID());
 			
 				
 		return stopAnalysisDetailVoMapper.insertSelective(record);

+ 22 - 4
src/main/java/com/gyee/frame/service/weather/WeatherService.java

@@ -8,12 +8,13 @@ import com.gyee.frame.model.auto.Line;
 import com.gyee.frame.model.auto.Project;
 import com.gyee.frame.model.auto.Windpowerstation;
 import com.gyee.frame.model.custom.weather.*;
-import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.MathUtil;
 import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -118,13 +119,17 @@ public class WeatherService  {
 				if(null!=weatherReal)
 				{
 					double qxd=weatherReal.getVisibility();
+					//清晰度
 					map.put("qxd", MathUtil.twoBit(qxd/1000));
 
 					if(null!=weatherReal.getMain())
 					{
 						Main main=weatherReal.getMain();
+						//温度
 						map.put("wd",main.getTemp());
+						//大气压强
 						map.put("dqyl",main.getPressure());
+						//湿度
 						map.put("sd",main.getHumidity());
 
 					}
@@ -132,14 +137,16 @@ public class WeatherService  {
 					if(null!=weatherReal.getCoord())
 					{
 						Coord coord=weatherReal.getCoord();
+						//经度
 						map.put("jingdu",coord.getLon());
+						//维度
 						map.put("weidu",coord.getLat());
 					}
 
 					if(null!=weatherReal.getClouds())
 					{
 						Clouds clouds=weatherReal.getClouds();
-
+						//云量
 						map.put("yunliang",clouds.getAll());
 					}
 
@@ -148,17 +155,25 @@ public class WeatherService  {
 						Sys sys=weatherReal.getSys();
 						if(StringUtils.notEmp(sys.getSunrise()))
 						{
-							map.put("richushijian", DateUtils.utcToLocal(String.valueOf(sys.getSunrise())));
+							Date date=new Date(sys.getSunrise()*1000);
+							SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
+							//日出时间
+							map.put("richushijian", sdf.format(date));
+
 						}
 						if(StringUtils.notEmp(sys.getSunset()))
 						{
-							map.put("riluoshijian",DateUtils.utcToLocal(String.valueOf(sys.getSunset())));
+							Date date=new Date(sys.getSunset()*1000);
+							SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
+							//日落时间
+							map.put("riluoshijian", sdf.format(date));
 						}
 					}
 
 					if(null!=weatherReal.getWind())
 					{
 						Wind wind=weatherReal.getWind();
+						//风速
 						map.put("fs",wind.getSpeed());
 
 						if(StringUtils.notEmp(wind.getDeg()))
@@ -166,6 +181,7 @@ public class WeatherService  {
 							double fx=wind.getDeg();
 							if(fx>= 11.25 && fx<= 348.76)
 							{
+								//风向
 								map.put("fx","北");
 							}else if(fx>= 33.76 && fx<= 56.25)
 							{
@@ -204,7 +220,9 @@ public class WeatherService  {
 						{
 							if(icon.equals("01d") || icon.equals("01n"))
 							{
+								//天气说明
 								map.put("tqmc","晴");
+								//天气图片编号
 								map.put("tqtp","01");
 							}else if(icon.equals("02d") || icon.equals("02n"))
 							{

+ 30 - 6
src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java

@@ -436,10 +436,10 @@ public class GenreSetPushService {
                         double fs=(double)wh.get("fs");
 
                         if (speedmap.containsKey(fs)) {
-                            int temp = speedmap.get(fs) + 6;
+                            int temp = speedmap.get(fs) + 10;
                             speedmap.put(fs, temp);
                         } else {
-                            speedmap.put(fs, 6);
+                            speedmap.put(fs, 10);
                         }
 
                     }
@@ -941,14 +941,14 @@ public class GenreSetPushService {
 /****************************************************五项损失************************************************************/
 /****************************************************日功率曲线**********************************************************/
 
-            List<DataVo> glvos = realPowerPushService.findRealPower(id);
-            map.put("glvos", glvos);
+//            List<DataVo> glvos = realPowerPushService.findRealPower(id);
+//            map.put("glvos", glvos);
 /*************************************************日功率曲线*************************************************************/
 
 /****************************************************日电量历史**********************************************************/
 
-            List<DataVo> rdlvos = findPowerWpBar(id);
-            map.put("rdlvos", rdlvos);
+//            List<DataVo> rdlvos = findPowerWpBar(id);
+//            map.put("rdlvos", rdlvos);
 /*************************************************日电量历史*************************************************************/
 
 /*************************************************悬停指标*************************************************************/
@@ -1035,6 +1035,30 @@ public class GenreSetPushService {
         return map;
     }
 
+
+
+    public Map<String, Object> findPowerInfo(String id) throws Exception {
+        Map<String, Object> map = new HashMap<String, Object>();
+        if (StringUtils.notEmp(id)) {
+
+
+/****************************************************日功率曲线**********************************************************/
+
+            List<DataVo> glvos = realPowerPushService.findRealPower(id);
+            map.put("glvos", glvos);
+/*************************************************日功率曲线*************************************************************/
+
+/****************************************************日电量历史**********************************************************/
+
+            List<DataVo> rdlvos = findPowerWpBar(id);
+            map.put("rdlvos", rdlvos);
+/*************************************************日电量历史*************************************************************/
+
+        }
+/*************************************************关系库指标**************************************************************/
+
+        return map;
+    }
     private List<DataVo> findPowerWpBar(String wpId) throws Exception {
         List<DataVo> vos = new ArrayList<DataVo>();
         if (StringUtils.empty(wpId)) {

+ 29 - 29
src/main/java/com/gyee/frame/service/websocket/RealPowerPushService.java

@@ -125,8 +125,8 @@ public class RealPowerPushService {
             for (int i = 0; i < length; i++) {
 
                 DataVo vo = new DataVo();
-                vo.setTime(c.getTime().getTime());
 
+//                vo.setTime(c.getTime().getTime());
 //                vo.setValue1(0.0);// 应发功率
 //                vo.setValue2(0.0);// 实发功率
 //                vo.setValue3(0.0);// 理论功率
@@ -138,7 +138,7 @@ public class RealPowerPushService {
 //                vo.setValue9(0.0);// 最优功率律
 
                 vos.add(vo);
-                c.add(Calendar.HOUR_OF_DAY,1);
+//                c.add(Calendar.HOUR_OF_DAY,1);
             }
 
             if (id.equals(QS) || id.equals(FD) || id.equals(GF)) {
@@ -184,7 +184,7 @@ public class RealPowerPushService {
 
                                         for (int j = 0; j < datas.size(); j++) {
 
-//                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
                                             vos.get(j).setValue4(StringUtils.round(datas.get(j).getPointValueInDouble() + qs3_datas.get(j).getPointValueInDouble(), 2));
                                             if (j == datas.size() - 1) {
                                                 cal.setTime(new Date(datas.get(j).getPointTime() * 1000));
@@ -196,7 +196,7 @@ public class RealPowerPushService {
                                 } else {
                                     for (int j = 0; j < datas.size(); j++) {
 
-//                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
 
                                         double ycgl = (vos.get(j).getValue4() == null ? 0.0 : vos.get(j).getValue4()) + (datas.get(j) == null ? 0.0 : datas.get(j).getPointValueInDouble());
 
@@ -281,7 +281,7 @@ public class RealPowerPushService {
 
                                         for (int j = 0; j < datas.size(); j++) {
 
-//                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
                                             vos.get(j).setValue7(StringUtils.round(datas.get(j).getPointValueInDouble() + qs3_datas.get(j).getPointValueInDouble(), 2));
                                             if (j == datas.size() - 1) {
                                                 cal.setTime(new Date(datas.get(j).getPointTime() * 1000));
@@ -293,7 +293,7 @@ public class RealPowerPushService {
                                 } else {
                                     for (int j = 0; j < datas.size(); j++) {
 
-//                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
 
                                         double ycgl = (vos.get(j).getValue7() == null ? 0.0 : vos.get(j).getValue7()) + (datas.get(j) == null ? 0.0 : datas.get(j).getPointValueInDouble());
 
@@ -320,7 +320,7 @@ public class RealPowerPushService {
                                             String[] ycPoints3 = (String[]) ycmap.get("dq2");
                                             for (int i = 0; i < subresult; i++) {
                                                 cal.add(Calendar.HOUR_OF_DAY, 1);
-                                                //vos.get(datas.size() + i).setTime(cal.getTime().getTime());
+                                                vos.get(datas.size() + i).setTime(cal.getTime().getTime());
                                                 String qs3_ycgl = ycPoints3[i];
                                                 WindPowerStationTestingPoint2 ycglpoint = windPowerstationTestingPointService.getWindPowerStationTestingPoint2(station.getId(), ycDqPoints2[i]);
 
@@ -332,7 +332,7 @@ public class RealPowerPushService {
                                     } else {
                                         for (int i = 0; i < subresult; i++) {
                                             cal.add(Calendar.HOUR_OF_DAY, 1);
-                                            //vos.get(datas.size() + i).setTime(cal.getTime().getTime());
+                                            vos.get(datas.size() + i).setTime(cal.getTime().getTime());
 
                                             WindPowerStationTestingPoint2 ycglpoint = windPowerstationTestingPointService.getWindPowerStationTestingPoint2(station.getId(), ycDqPoints2[i]);
 
@@ -345,15 +345,15 @@ public class RealPowerPushService {
                                     }
 
 
-//                                    total = datas.size() + subresult;
-//                                    subresult = length - (total);
-//
-//                                    if (subresult > 0)
-//                                        for (int i = 0; i < subresult; i++) {
-//                                            cal.add(Calendar.HOUR_OF_DAY, 1);
-//                                            vos.get(total + i).setTime(cal.getTime().getTime());
-//                                            vos.get(total + i).setValue4(null);
-//                                        }
+                                    total = datas.size() + subresult;
+                                    subresult = length - (total);
+
+                                    if (subresult > 0)
+                                        for (int i = 0; i < subresult; i++) {
+                                            cal.add(Calendar.HOUR_OF_DAY, 1);
+                                            vos.get(total + i).setTime(cal.getTime().getTime());
+                                            vos.get(total + i).setValue7(null);
+                                        }
                                 }
 
                             }
@@ -694,7 +694,7 @@ public class RealPowerPushService {
 
                                         for (int j = 0; j < datas.size(); j++) {
 
-//                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                            vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
                                             vos.get(j).setValue7(StringUtils.round(datas.get(j).getPointValueInDouble() + qs3_datas.get(j).getPointValueInDouble(), 2));
                                             if (j == datas.size() - 1) {
                                                 cal.setTime(new Date(datas.get(j).getPointTime() * 1000));
@@ -705,7 +705,7 @@ public class RealPowerPushService {
                                 } else {
                                     for (int j = 0; j < datas.size(); j++) {
 
-//                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
+                                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
 
                                         double ycgl = (vos.get(j).getValue7() == null ? 0.0 : vos.get(j).getValue7()) + (datas.get(j) == null ? 0.0 : datas.get(j).getPointValueInDouble());
 
@@ -756,16 +756,16 @@ public class RealPowerPushService {
                                         }
                                     }
 
-//
-//                                    total = datas.size() + subresult;
-//                                    subresult = length - (total);
-//
-//                                    if (subresult > 0)
-//                                        for (int i = 0; i < subresult; i++) {
-//                                            cal.add(Calendar.HOUR_OF_DAY, 1);
-//                                            vos.get(total + i).setTime(cal.getTime().getTime());
-//                                            vos.get(total + i).setValue7(null);
-//                                        }
+
+                                    total = datas.size() + subresult;
+                                    subresult = length - (total);
+
+                                    if (subresult > 0)
+                                        for (int i = 0; i < subresult; i++) {
+                                            cal.add(Calendar.HOUR_OF_DAY, 1);
+                                            vos.get(total + i).setTime(cal.getTime().getTime());
+                                            vos.get(total + i).setValue7(null);
+                                        }
                                 }
 
                             }

+ 1 - 0
src/main/java/com/gyee/frame/util/DateUtils.java

@@ -338,6 +338,7 @@ public class DateUtils  extends org.apache.commons.lang3.time.DateUtils {
         try {
             Date date = getUTCSDF().parse(utcTimeStr);
             return getLocalSDF().format(date);
+
         } catch (ParseException e) {
             e.printStackTrace();
         }