瀏覽代碼

场站性能分析

wangchangsheng 2 年之前
父節點
當前提交
bd1bc2a209

+ 24 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/WindpowerstationController.java

@@ -7,12 +7,14 @@ import com.gyee.backconfig.config.R;
 import com.gyee.backconfig.model.auto.Windpowerstation;
 import com.gyee.backconfig.service.BackConfigService;
 import com.gyee.backconfig.service.auto.IWindpowerstationService;
+import com.gyee.backconfig.vo.PersisVo;
 import com.gyee.backconfig.vo.WindpowerstationAdmVo;
 import com.gyee.backconfig.vo.Windpowerstationvo;
 import com.gyee.common.model.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -239,6 +241,28 @@ public class WindpowerstationController {
         }
     }
 
+    /**
+     * 场站性能分析
+     * @param station
+     * @param startdate
+     * @param enddate
+     */
+    @GetMapping(value = "/getPersis")
+    public R  getPersis(String station , Date startdate, Date enddate){
+        try {
+            List<PersisVo> list =   windpowerstationService.getPersis(station,startdate,enddate);
+
+            if (null != list){
+                return R.ok().data(list);
+            }else {
+                return R.error().data("查询失败!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error().data("查询失败!");
+        }
+    }
+
 
 
 }

+ 16 - 8
web/backmanagerconfig/src/main/java/com/gyee/backconfig/service/auto/impl/WindpowerstationServiceImpl.java

@@ -159,24 +159,32 @@ public class WindpowerstationServiceImpl extends ServiceImpl<WindpowerstationMap
     }
 
     @Override
-    public List<PersisVo> getPersis(String station , Date startdate, Date enddate) throws Exception {
+    public List<PersisVo> getPersis(String station, Date startdate, Date enddate) throws Exception {
 
+
+        List<PersisVo> list = new ArrayList<>();
         String wpString = redisService.get(station);
         Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
 
         });
-        if(null !=stringMapMap){
+        if (null != stringMapMap) {
             String fs = stringMapMap.get("RPJFS").getCode();//日平局风速
-            List<PointData> fss =   goldenUtil.getHistoryDatasSnap(fs,startdate.getTime()*1000,enddate.getTime()*1000,null,30L);
+            List<PointData> fss = goldenUtil.getHistoryDatasSnap(fs, startdate.getTime() * 1000, enddate.getTime() * 1000, null, 30L);
             String gl = stringMapMap.get("SSZGL").getCode();//功率
-            List<PointData> gls =   goldenUtil.getHistoryDatasSnap(gl,startdate.getTime()*1000,enddate.getTime()*1000,null,30L);
-            if(!fss.isEmpty() && !gls.isEmpty()){
-
+            List<PointData> gls = goldenUtil.getHistoryDatasSnap(gl, startdate.getTime() * 1000, enddate.getTime() * 1000, null, 30L);
+            if (!fss.isEmpty() && !gls.isEmpty()) {
+
+                for (int i = 0; i <= fss.size(); i++) {
+                    PersisVo vo = new PersisVo();
+                    vo.setDatatime(fss.get(i).getPointTime());
+                    vo.setRpjfs(fss.get(i).getPointValueInDouble());
+                    vo.setSszgl(gls.get(i).getPointValueInDouble());
+                    list.add(vo);
+                }
             }
         }
 
-
-        return null;
+        return list;
     }
 
 

+ 8 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/vo/PersisVo.java

@@ -1,4 +1,12 @@
 package com.gyee.backconfig.vo;
 
+
+import lombok.Data;
+
+@Data
 public class PersisVo {
+
+    private long datatime;//时间戳
+    private double rpjfs;//风速
+    private double sszgl;//功率
 }