xieshengjie 2 лет назад
Родитель
Сommit
1a469773c0

+ 67 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/AnemometerTowerController.java

@@ -0,0 +1,67 @@
+package com.gyee.runeconomy.controller.monitor;/*
+@author   谢生杰
+@date   2023/5/11-9:25
+*/
+
+import com.gyee.common.model.StringUtils;
+import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.model.auto.ProBasicWeatherStation;
+import com.gyee.runeconomy.service.monitor.AnemometerTowerService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/tower")
+@Api(value = "测风塔",tags =  "测风塔")
+public class AnemometerTowerController {
+    @Resource
+    private AnemometerTowerService anemometerTowerService;
+
+
+    /**
+     * 测风塔数据
+     * @return
+     */
+    @GetMapping("/info")
+    @ResponseBody
+    @ApiOperation(value = "数据信息", notes = "数据信息")
+    public R info(@RequestParam(value = "weatherid",required = true) String weatherid) throws Exception {
+
+        Map<String,Double> resultMap = anemometerTowerService.info(weatherid);
+        if (StringUtils.isNotNull(resultMap)) {
+            return R.data(ResultMsg.ok(resultMap));
+        }else{
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+    /**
+     * 根据场站查询测风塔
+     * @return
+     */
+    @GetMapping("/towerByWp")
+    @ResponseBody
+    @ApiOperation(value = "根据场站查询测风塔", notes = "根据场站查询测风塔")
+    public R towerByWp(@RequestParam(value = "wpid",required = true) String wpid) throws Exception {
+
+        List<ProBasicWeatherStation> resultList = anemometerTowerService.towerByWp(wpid);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        }else{
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+}

+ 26 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/TowerVo.java

@@ -0,0 +1,26 @@
+package com.gyee.runeconomy.model.vo;
+/*
+@author   谢生杰
+@date   2023/5/11-9:29
+*/
+
+import lombok.Data;
+
+@Data
+public class TowerVo {
+
+    private String wpid;
+    private String wpname;
+    private Double kqmd;
+    private Double yq;
+    private Double fs10;
+    private Double fx10;
+    private Double fs30;
+    private Double fx30;
+    private Double fs50;
+    private Double fx50;
+    private Double fs70;
+    private Double fx70;
+    private Double wd;
+    private Double sd;
+}

+ 86 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/AnemometerTowerService.java

@@ -0,0 +1,86 @@
+package com.gyee.runeconomy.service.monitor;
+
+/*
+@author   谢生杰
+@date   2023/5/11-9:27
+*/
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.util.DoubleUtils;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
+import com.gyee.runeconomy.model.auto.ProBasicWeatherStation;
+import com.gyee.runeconomy.util.StringUtils;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class AnemometerTowerService {
+    @Resource
+    private IEdosUtil edosUtil;
+
+
+    public Map<String,Double> info(String weatherid) throws Exception {
+
+        Map<String,Double> resultMap = new HashMap<>();
+
+        List<ProBasicWeatherStation> weawpls = CacheContext.weawpls;
+        Map<String, Map<String, ProBasicPowerstationPoint>> weatherwppointmap = CacheContext.weatherwppointmap;
+        List<String> weapoints = new ArrayList<>();
+        Map<String, ProBasicPowerstationPoint> powerstationPointMap = weatherwppointmap.get(weatherid);
+        ProBasicPowerstationPoint wdpoint = powerstationPointMap.get(ContantXk.FCCFTWD);
+        weapoints.add(wdpoint.getNemCode());
+        ProBasicPowerstationPoint sdpoint = powerstationPointMap.get(ContantXk.FCCFTSD);
+        weapoints.add(sdpoint.getNemCode());
+        ProBasicPowerstationPoint kqmdpoint = powerstationPointMap.get(ContantXk.KQMD);
+        weapoints.add(kqmdpoint.getNemCode());
+        ProBasicPowerstationPoint yqpoint = powerstationPointMap.get(ContantXk.FCCFTYQ);
+        weapoints.add(yqpoint.getNemCode());
+        ProBasicPowerstationPoint fs10point = powerstationPointMap.get(ContantXk.FCCFTFS10);
+        weapoints.add(fs10point.getNemCode());
+        ProBasicPowerstationPoint fx10point = powerstationPointMap.get(ContantXk.FCCFTFX10);
+        weapoints.add(fx10point.getNemCode());
+        ProBasicPowerstationPoint fs30point = powerstationPointMap.get(ContantXk.FCCFTFS30);
+        weapoints.add(fs30point.getNemCode());
+        ProBasicPowerstationPoint fx30point = powerstationPointMap.get(ContantXk.FCCFTFX30);
+        weapoints.add(fx30point.getNemCode());
+        ProBasicPowerstationPoint fs50point = powerstationPointMap.get(ContantXk.FCCFTFS50);
+        weapoints.add(fs50point.getNemCode());
+        ProBasicPowerstationPoint fx50point = powerstationPointMap.get(ContantXk.FCCFTFX50);
+        weapoints.add(fx50point.getNemCode());
+        ProBasicPowerstationPoint fs70point = powerstationPointMap.get(ContantXk.FCCFTFS70);
+        weapoints.add(fs70point.getNemCode());
+        ProBasicPowerstationPoint fx70point = powerstationPointMap.get(ContantXk.FCCFTFX70);
+        weapoints.add(fx70point.getNemCode());
+
+        List<PointData> realData = edosUtil.getRealData(weapoints);
+        if (StringUtils.isNotEmpty(realData)){
+            resultMap.put("wd", DoubleUtils.keepPrecision(realData.get(0).getPointValueInDouble(),2));
+            resultMap.put("sd", DoubleUtils.keepPrecision(realData.get(1).getPointValueInDouble(),2));
+            resultMap.put("kqmd", DoubleUtils.keepPrecision(realData.get(2).getPointValueInDouble(),2));
+            resultMap.put("yq", DoubleUtils.keepPrecision(realData.get(3).getPointValueInDouble(),2));
+            resultMap.put("fs10", DoubleUtils.keepPrecision(realData.get(4).getPointValueInDouble(),2));
+            resultMap.put("fx10", DoubleUtils.keepPrecision(realData.get(5).getPointValueInDouble(),2));
+            resultMap.put("fs30", DoubleUtils.keepPrecision(realData.get(6).getPointValueInDouble(),2));
+            resultMap.put("fx30", DoubleUtils.keepPrecision(realData.get(7).getPointValueInDouble(),2));
+            resultMap.put("fs50", DoubleUtils.keepPrecision(realData.get(8).getPointValueInDouble(),2));
+            resultMap.put("fx50", DoubleUtils.keepPrecision(realData.get(9).getPointValueInDouble(),2));
+            resultMap.put("fs70", DoubleUtils.keepPrecision(realData.get(10).getPointValueInDouble(),2));
+            resultMap.put("fx70", DoubleUtils.keepPrecision(realData.get(11).getPointValueInDouble(),2));
+        }
+        return resultMap;
+    }
+
+    public List<ProBasicWeatherStation> towerByWp(String wpid) {
+        List<ProBasicWeatherStation> weawpls = CacheContext.weawpls;
+        return weawpls.stream().filter(wea->wea.getWindpowerstationId().equals(wpid)).collect(Collectors.toList());
+    }
+}