|
@@ -2,10 +2,14 @@ package com.gyee.runeconomy.service.auto.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.gyee.runeconomy.config.GyeeConfig;
|
|
|
+import com.gyee.runeconomy.dto.AlarmDataParser;
|
|
|
import com.gyee.runeconomy.dto.FiveLoss.AnnotationTool;
|
|
|
import com.gyee.runeconomy.dto.FiveLoss.FixedVo;
|
|
|
import com.gyee.runeconomy.dto.FiveLoss.TableTitle;
|
|
|
+import com.gyee.runeconomy.dto.fitting.Alarm;
|
|
|
+import com.gyee.runeconomy.dto.fitting.AlarmDataVo;
|
|
|
import com.gyee.runeconomy.dto.result.PowerPointData;
|
|
|
import com.gyee.runeconomy.dto.speed.WindDirectionALG;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
@@ -13,16 +17,22 @@ import com.gyee.runeconomy.model.LineCurveFitting;
|
|
|
import com.gyee.runeconomy.model.PowerFittingALG;
|
|
|
import com.gyee.runeconomy.model.PowerFittingData;
|
|
|
import com.gyee.runeconomy.model.PowerProcessALG;
|
|
|
+import com.gyee.runeconomy.model.auto.ProBasicEquipment;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicEquipmentPoint;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicModelPower;
|
|
|
import com.gyee.runeconomy.model.auto.ProEconPowerFittingAnalySis;
|
|
|
import com.gyee.runeconomy.model.vo.PointVo;
|
|
|
+import com.gyee.runeconomy.model.vo.PoliceVo;
|
|
|
+import com.gyee.runeconomy.model.vo.ResultItem;
|
|
|
+import com.gyee.runeconomy.model.vo.alarmWtVo;
|
|
|
import com.gyee.runeconomy.service.DBSCANPointALG;
|
|
|
import com.gyee.runeconomy.service.DataScanService;
|
|
|
+import com.gyee.runeconomy.service.EarlyWarning.ApiClient;
|
|
|
import com.gyee.runeconomy.service.WindDirection.Point;
|
|
|
import com.gyee.runeconomy.util.FileUtil;
|
|
|
import com.gyee.runeconomy.util.realtimesource.feign.RemoteServiceBuilder;
|
|
|
import com.gyee.runeconomy.util.realtimesource.feign.TsDoubleData;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import lombok.val;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -30,8 +40,11 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
@@ -661,22 +674,167 @@ public class NewDataFittingService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ * @param table
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<AlarmDataVo> getDataAlarms(String table, List<Alarm> alarmList) {
|
|
|
+
|
|
|
+ ApiClient client = new ApiClient();
|
|
|
+
|
|
|
+ List<AlarmDataVo> list1 = new ArrayList<>();
|
|
|
+ if (table.equals("alarmWt")) {
|
|
|
+ for (Alarm alarm : alarmList) {
|
|
|
+
|
|
|
+ List<ProBasicEquipment> equipments = CacheContext.wtls.stream()
|
|
|
+ .filter(a -> alarm.getWtId().equals(a.getAname())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ String modelId = equipments.get(0).getModelId();
|
|
|
+ String wtid = equipments.get(0).getId();
|
|
|
+ String station = equipments.get(0).getWindpowerstationId();
|
|
|
+ String begin = alarm.getTime();
|
|
|
+
|
|
|
+
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+
|
|
|
+ LocalDateTime parsedTime = LocalDateTime.parse(begin, formatter);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ LocalDateTime endTime = parsedTime.plusDays(1);
|
|
|
+
|
|
|
+
|
|
|
+ String end = endTime.format(formatter);
|
|
|
+
|
|
|
+ String result = client.getglqxgzFromApi(
|
|
|
+ station,
|
|
|
+ wtid,
|
|
|
+ modelId,
|
|
|
+ "",
|
|
|
+ begin,
|
|
|
+ end,
|
|
|
+ "1",
|
|
|
+ "20",
|
|
|
+ "gz"
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ String json = result;
|
|
|
+
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ try {
|
|
|
+ alarmWtVo response = mapper.readValue(json, alarmWtVo.class);
|
|
|
+
|
|
|
+
|
|
|
+ for (ResultItem item : response.getData().getResult()) {
|
|
|
+
|
|
|
+ AlarmDataVo vo = new AlarmDataVo();
|
|
|
+ vo.setWtid(equipments.get(0).getAname());
|
|
|
+ vo.setTime(begin);
|
|
|
+ vo.setBj("故障");
|
|
|
+ vo.setTx("自定义");
|
|
|
+ vo.setAlarmname(item.getFaultView());
|
|
|
+ list1.add(vo);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ return list1;
|
|
|
+
|
|
|
+ } else if (table.equals("alarmCt")) {
|
|
|
+
|
|
|
+ for (Alarm alarm : alarmList) {
|
|
|
+
|
|
|
+ List<ProBasicEquipment> equipments = CacheContext.wtls.stream()
|
|
|
+ .filter(a -> alarm.getWtId().equals(a.getAname())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ String modelId = equipments.get(0).getModelId();
|
|
|
+ String wtid = equipments.get(0).getId();
|
|
|
+ String begin = alarm.getTime();
|
|
|
+
|
|
|
+
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+
|
|
|
+ LocalDateTime parsedTime = LocalDateTime.parse(begin, formatter);
|
|
|
+
|
|
|
+
|
|
|
+ LocalDateTime endTime = parsedTime.plusMinutes(1);
|
|
|
+
|
|
|
+
|
|
|
+ String end = endTime.format(formatter);
|
|
|
+
|
|
|
+ String result = client.getDataFromApi(
|
|
|
+ begin,
|
|
|
+ end,
|
|
|
+ wtid,
|
|
|
+ modelId,
|
|
|
+ "windturbine",
|
|
|
+ "",
|
|
|
+ "s"
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List response = AlarmDataParser.parseResponse(result);
|
|
|
+
|
|
|
+ if (response != null) {
|
|
|
+ for (Object resc : response) {
|
|
|
+ AlarmDataParser.AlarmData alarmData = (AlarmDataParser.AlarmData) resc;
|
|
|
+
|
|
|
+ String alertText = alarmData.getAlertText();
|
|
|
+ String relateType = alarmData.getRelatePartsText();
|
|
|
+ AlarmDataVo vo = new AlarmDataVo();
|
|
|
+ vo.setWtid(equipments.get(0).getAname());
|
|
|
+ vo.setTime(begin);
|
|
|
+ vo.setBj(relateType);
|
|
|
+ vo.setTx("自定义");
|
|
|
+ vo.setAlarmname(alertText);
|
|
|
+ list1.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return list1;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|