Browse Source

计算服务修改

shilin 1 year ago
parent
commit
fca023c707

+ 35 - 33
web/health-hb/src/main/java/com/gyee/frame/controller/health/ReliabilityAnalysisController.java

@@ -4,7 +4,7 @@ package com.gyee.frame.controller.health;
 import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.feign.RemoteServiceBuilder;
-import com.gyee.frame.mapper.auto.WindturbineMapper;
+import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Windturbine;
 import com.gyee.frame.model.auto.Windturbinetestingpointnew;
 import com.gyee.frame.model.custom.export.TsPointData;
@@ -15,7 +15,6 @@ import com.gyee.frame.service.health.MetricsService;
 import com.gyee.frame.service.health.MetricsUniformCodeService;
 import com.gyee.frame.util.StringUtils;
 import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -42,8 +41,6 @@ public class ReliabilityAnalysisController {
     private WindTurbineTestingPointAiService windAIService;
     @Resource
     private WindTurbineTestingPointDiService windDIService;
-    @Autowired
-    private WindturbineMapper windturbineMapper;
 
 
     /**
@@ -65,33 +62,36 @@ public class ReliabilityAnalysisController {
             @RequestParam(name = "interval", required = false) Integer interval){
 
         List<Object> list = new ArrayList<>();
-        Windturbine wtmid = windturbineMapper.selectByPrimaryKey(wtId);
 
-        if(StringUtils.notEmp(wtmid))
+        if(StringUtils.notEmp(wtId) && InitialRunner.wtmap.containsKey(wtId))
         {
-
-            List<String> codes = alertrule2ervice.getUniformCodeByNameAndStation(name, station, wtmid.getModelId());
-            if (codes == null || codes.size() == 0)
-                return AjaxResult.successData(AjaxStatus.success.code, list);
-
-            for (String code : codes){
-                Map<String, Object> map = new HashMap<>();
-                if (code.startsWith("AI")){
-                    Windturbinetestingpointnew windAI = windAIService.getWindTurbineTestingPointAi2(wtId, code);
-                    List<TsPointData> data = null;
-                    if (null !=interval)
-                    {
-                        //System.out.println(windAI.getCode());
-                        data = remoteService.ShardingService().getHistorySnap(windAI.getCode(), startTs, endTs, interval);
-                    }
-                    else{
-                        data = remoteService.ShardingService().getHistoryRaw(windAI.getCode(), startTs, endTs);
-                    }
-
-
-                    // 查询点的单位和描述属性
-                    String unit = "--";
-                    String desc = "----";
+            Windturbine wtmid = InitialRunner.wtmap.get(wtId);
+
+            if(StringUtils.notEmp(wtmid))
+            {
+
+                List<String> codes = alertrule2ervice.getUniformCodeByNameAndStation(name, station, wtmid.getModelId());
+                if (codes == null || codes.size() == 0)
+                    return AjaxResult.successData(AjaxStatus.success.code, list);
+
+                for (String code : codes){
+                    Map<String, Object> map = new HashMap<>();
+                    if (code.startsWith("AI")){
+                        Windturbinetestingpointnew windAI = windAIService.getWindTurbineTestingPointAi2(wtId, code);
+                        List<TsPointData> data = null;
+                        if (null !=interval)
+                        {
+                            //System.out.println(windAI.getCode());
+                            data = remoteService.ShardingService().getHistorySnap(windAI.getCode(), startTs, endTs, interval);
+                        }
+                        else{
+                            data = remoteService.ShardingService().getHistoryRaw(windAI.getCode(), startTs, endTs);
+                        }
+
+
+                        // 查询点的单位和描述属性
+                        String unit = "--";
+                        String desc = "----";
                 /*List<MetricsUniformCode> metricsList = uniformCodeService.getListByStationAndUniforCode(station, windAI.getUniformcode());
                 if (metricsList != null && metricsList.size() > 0) {
                     MetricsUniformCode metricsUniformCode = metricsList.get(0);
@@ -103,16 +103,18 @@ public class ReliabilityAnalysisController {
                 }*/
 //                    MetricsCode metrics=uniformCodeService.getListName(wtId,windAI.getUniformcode());
 //                    String nm = metrics==null?"":metrics.getName();
-                    map.put("unit", unit);
-                    map.put("name", name);
-                    map.put("data", data);
+                        map.put("unit", unit);
+                        map.put("name", name);
+                        map.put("data", data);
 
-                    list.add(map);
+                        list.add(map);
+                    }
                 }
             }
         }
 
 
+
         return AjaxResult.successData(AjaxStatus.success.code, list);
     }