wangchangsheng пре 2 година
родитељ
комит
9588720e3a

+ 32 - 3
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;
 
 /**
@@ -217,13 +219,13 @@ public class WindpowerstationController {
 
 
     /**
-     * 查询
+     * 行政管理区域风电场列表
      * @param regionid
      * @param companyid
      * @return
      */
-    @GetMapping(value = "/getList")
-    public R getList(
+    @GetMapping(value = "/getadmList")
+    public R getadmList(
                       @RequestParam(value = "regionid",required = false) String regionid,
                       @RequestParam(value = "companyid",required = false) String companyid){
         try {
@@ -241,4 +243,31 @@ public class WindpowerstationController {
 
 
 
+    /**
+     * 场站性能分析
+     * @param station
+     * @return
+     */
+    @GetMapping(value = "/getPersis")
+    public R getPersis(
+            @RequestParam(value = "station",required = false) String station,
+            @RequestParam(value = "startdate",required = false) Date startdate,
+            @RequestParam(value = "enddate",required = false) 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("查询失败!");
+        }
+    }
+
+
+
+
 }

+ 4 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/service/auto/IWindpowerstationService.java

@@ -3,8 +3,10 @@ package com.gyee.backconfig.service.auto;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gyee.backconfig.model.auto.Windpowerstation;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.backconfig.vo.PersisVo;
 import com.gyee.backconfig.vo.WindpowerstationAdmVo;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -33,6 +35,8 @@ public interface IWindpowerstationService extends IService<Windpowerstation> {
     List<WindpowerstationAdmVo> getList(String regionid, String companyid) throws Exception;
 
 
+    List<PersisVo> getPersis(String stationDate, Date startdate, Date enddate) throws Exception;
+
 
 
 

+ 17 - 4
web/backmanagerconfig/src/main/java/com/gyee/backconfig/service/auto/impl/IndicatorsServiceImpl.java

@@ -82,10 +82,23 @@ public class IndicatorsServiceImpl extends ServiceImpl<IndicatorsMapper, Indicat
     public boolean addOrUpdate(Indicators indicators) throws Exception{
 //        boolean b =  this.saveOrUpdate(indicators);
         boolean b = false;
-        if(null==indicators.getId()){
-             b = this.save(indicators);
-        }else{
-            b= this.updateById(indicators);
+        QueryWrapper<Indicators> qw = new QueryWrapper<>();
+
+
+        if (StringUtils.isNotEmpty(indicators.getStationid())){
+            qw.eq("stationid",indicators.getStationid());
+        }
+
+        if (StringUtils.isNotEmpty(indicators.getKay())){
+            qw.eq("kay",indicators.getKay());
+        }
+        List<Indicators> list = getBaseMapper().selectList(qw);
+
+
+        if (null == list || list.size() <= 0) {
+            b = this.save(indicators);
+        } else {
+            b = this.updateById(indicators);
         }
 
         List<Windpowerstationpointnew>  stationlist = windpowerstationpointnewService.getStationpointByUniformcode(indicators.getStationid(),indicators.getKay());

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

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.backconfig.service.auto.RedisService;
 import com.gyee.backconfig.util.realtimedate.EdosUtil;
 import com.gyee.backconfig.util.realtimedate.MathUtil;
+import com.gyee.backconfig.vo.PersisVo;
 import com.gyee.backconfig.vo.WindpowerstationAdmVo;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
@@ -20,10 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * <p>
@@ -160,5 +158,26 @@ public class WindpowerstationServiceImpl extends ServiceImpl<WindpowerstationMap
 
     }
 
+    @Override
+    public List<PersisVo> getPersis(String station , Date startdate, Date enddate) throws Exception {
+
+        String wpString = redisService.get(station);
+        Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+
+        });
+        if(null !=stringMapMap){
+            String fs = stringMapMap.get("RPJFS").getCode();//日平局风速
+            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()){
+
+            }
+        }
+
+
+        return null;
+    }
+
 
 }

+ 6 - 5
web/backmanagerconfig/src/main/java/com/gyee/backconfig/util/realtimedate/EdosUtil.java

@@ -1071,7 +1071,7 @@ public class EdosUtil  implements IEdosUtil {
         JSONObject jo = new JSONObject();
         jo.put("tagName", pd.getEdnaId());
         JSONObject joo = new JSONObject();
-        joo.put("ts", pd.getPointTime()*1000);
+        joo.put("ts", pd.getPointTime());
         joo.put("status", 0);
         joo.put("doubleValue", pd.getPointValueInDouble());
         jo.put("tsData", joo);
@@ -1155,19 +1155,20 @@ public class EdosUtil  implements IEdosUtil {
     }
 
     @Override
-    public void sendSinglePoint(PointData point) throws Exception {
+    public String  sendSinglePoint(PointData point) throws Exception {
         String url = baseURL + "/latest";
 
-
+        String result;
         try {
-            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+             result = restTemplate.postForObject(url, convertPointData(point), String.class);
         } catch (HttpClientErrorException exception) {
             if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                return;
+                return null;
             } else {
                 throw exception;
             }
         }
+        return result;
     }
 
     @Override

+ 1 - 1
web/backmanagerconfig/src/main/java/com/gyee/backconfig/util/realtimedate/IEdosUtil.java

@@ -205,7 +205,7 @@ public interface IEdosUtil {
      * @param point 测点对象
      * @throws Exception
      */
-    public void sendSinglePoint(PointData point) throws Exception ;
+    public String  sendSinglePoint(PointData point) throws Exception ;
     /**
      * 批量写入实时数据
      * @param pointls 测点对象列表

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

@@ -0,0 +1,4 @@
+package com.gyee.backconfig.vo;
+
+public class PersisVo {
+}