|
@@ -3,7 +3,7 @@ package com.ruoyi.web.controller;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.ruoyi.ucp.entity.*;
|
|
@@ -12,7 +12,6 @@ import com.ruoyi.ucp.service.IHistoryPredictService;
|
|
|
import com.ruoyi.ucp.service.IPointInfoService;
|
|
|
import com.ruoyi.ucp.service.IRealtimePredictService;
|
|
|
import com.ruoyi.ucp.service.IStationInfoMinService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -43,7 +42,7 @@ public class PredictController {
|
|
|
private Map<String, PointInfo> tbInfos = new ConcurrentHashMap<>();
|
|
|
|
|
|
@GetMapping("/stbs")
|
|
|
- public Map<String, List<Integer>> stbs(){
|
|
|
+ public Map<String, List<Integer>> stbs() {
|
|
|
QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
|
|
|
.in(PointInfo::getUniformCode, "AI114");
|
|
@@ -52,19 +51,21 @@ public class PredictController {
|
|
|
.replaceFirst("_FDC_STA", ""), Collectors.mapping(pi -> Integer.parseInt(pi.getTurbineId()
|
|
|
.replaceFirst("GJNY_SXGS_.+_F_WT_", "").replaceFirst("_EQ", "")), Collectors.toList())));
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/stb")
|
|
|
- public Map<String, List<String>> stb(){
|
|
|
+ public Map<String, List<String>> stb() {
|
|
|
QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
|
|
|
.in(PointInfo::getUniformCode, "AI114");
|
|
|
List<PointInfo> list = pointInfoService.list(wrapper);
|
|
|
return list.stream().collect(Collectors.groupingBy(pi -> pi.getStationId(), Collectors.mapping(pi -> pi.getTurbineId(), Collectors.toList())));
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/snap")
|
|
|
- public Map<String, Collection<GlycSj>> haha(@RequestParam(value = "stationId",required = false) String stationId,
|
|
|
- @RequestParam(value = "beginTime",required = false) String beginTime,
|
|
|
- @RequestParam(value = "endTime",required = false) String endTime,
|
|
|
- @RequestParam(value = "interval",required = false) Integer interval) {
|
|
|
+ public Map<String, Collection<GlycSj>> haha(@RequestParam(value = "stationId", required = false) String stationId,
|
|
|
+ @RequestParam(value = "beginTime", required = false) String beginTime,
|
|
|
+ @RequestParam(value = "endTime", required = false) String endTime,
|
|
|
+ @RequestParam(value = "interval", required = false) Integer interval) {
|
|
|
//2024-10-15 00:00:00,15,2024-10-15 00:15:00
|
|
|
DateTime start = DateUtil.parse(beginTime);
|
|
|
DateTime end = DateUtil.parse(endTime);
|
|
@@ -76,15 +77,16 @@ public class PredictController {
|
|
|
List<PointInfo> list = pointInfoService.list(wrapper);
|
|
|
Map<String, List<PointInfo>> tbPis = list.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId));
|
|
|
Map<String, Collection<GlycSj>> result = new HashMap<>();
|
|
|
- tbPis.forEach((tbId,pis)->{
|
|
|
+ tbPis.forEach((tbId, pis) -> {
|
|
|
List<PointData> zt = task.calcTurbineSimpleZt(start, end, interval, tbId);
|
|
|
- Map<String, GlycSj> map =new TreeMap<>();
|
|
|
+ Map<String, GlycSj> map = new TreeMap<>();
|
|
|
for (PointInfo info : pis) {
|
|
|
try {
|
|
|
List<PointData> s = adapterApi.getHistorySnap(URI.create("http://172.16.12.103:8011/ts"), info.getPointKey(),
|
|
|
start.getTime(), end.getTime(), interval);
|
|
|
long j = start.getTime();
|
|
|
- String dt=null;GlycSj glycSj=null;
|
|
|
+ String dt = null;
|
|
|
+ GlycSj glycSj = null;
|
|
|
//AI066 风速,AI060 发电机转速,AI065 风机状态点,AI067 风向,AI082 桨叶1角度,AI073 机舱方向/对风角度
|
|
|
//AI004 U1绕组温度,AI047 电机温度2,AI072 环境温度,AI074 机舱温度
|
|
|
switch (info.getUniformCode()) {
|
|
@@ -98,10 +100,10 @@ public class PredictController {
|
|
|
}
|
|
|
glycSj.setGl(s.get(i).getValue());
|
|
|
|
|
|
- glycSj.setZt(zt.get(i)==null?null:zt.get(i).getValue());
|
|
|
-// glycSj.setActualTime(DateUtil.formatDateTime(DateUtil.date(s.get(i).getTs())));
|
|
|
+ glycSj.setZt(zt.get(i) == null ? null : zt.get(i).getValue());
|
|
|
+ // glycSj.setActualTime(DateUtil.formatDateTime(DateUtil.date(s.get(i).getTs())));
|
|
|
j += interval * 1000;//GJNY_SXGS_LJS_F_WT_
|
|
|
-// glycSj.setTurbineId(info.getTurbineId().replaceFirst("GJNY_SXGS_","").replaceFirst("F_WT_","").replaceFirst("_EQ",""));
|
|
|
+ // glycSj.setTurbineId(info.getTurbineId().replaceFirst("GJNY_SXGS_","").replaceFirst("F_WT_","").replaceFirst("_EQ",""));
|
|
|
glycSj.setTurbineId(info.getTurbineId().replaceFirst("GJNY_SXGS_.+_F_WT_", "").replaceFirst("_EQ", ""));
|
|
|
}
|
|
|
break;
|
|
@@ -233,12 +235,13 @@ public class PredictController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- result.put(tbId,map.values());
|
|
|
+ result.put(tbId, map.values());
|
|
|
});
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/latest")
|
|
|
- public Map<String, GlycSj> latest(@RequestParam(value = "stationId",required = false) String stationId) {
|
|
|
+ public Map<String, GlycSj> latest(@RequestParam(value = "stationId", required = false) String stationId) {
|
|
|
String[] names = {"AI114", "AI066", "AI060", "AI067", "AI082", "AI073", "AI004", "AI047", "AI072", "AI074"};
|
|
|
QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
|
|
@@ -249,13 +252,13 @@ public class PredictController {
|
|
|
String keys = list.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
Map<String, GlycSj> result = new HashMap<>();
|
|
|
Map<String, Double> zt = task.calcRealtimeTurbineZt(stationId);
|
|
|
- Map<String, PointData> latest = adapterApi.getLatest(URI.create("http://172.16.12.103:8011/ts"),keys);
|
|
|
- tbPis.forEach((tbId,pis)->{
|
|
|
+ Map<String, PointData> latest = adapterApi.getLatest(URI.create("http://172.16.12.103:8011/ts"), keys);
|
|
|
+ tbPis.forEach((tbId, pis) -> {
|
|
|
GlycSj glycSj = new GlycSj();
|
|
|
for (PointInfo info : pis) {
|
|
|
PointData data = latest.get(info.getPointKey());
|
|
|
Double v1 = 0.0;
|
|
|
- if(data!=null) v1=data.getValue();
|
|
|
+ if (data != null) v1 = data.getValue();
|
|
|
try {
|
|
|
switch (info.getUniformCode()) {
|
|
|
case "AI114":
|
|
@@ -298,23 +301,24 @@ public class PredictController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- result.put(tbId,glycSj);
|
|
|
+ result.put(tbId, glycSj);
|
|
|
});
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/snap/station/dq")
|
|
|
- public List<StationInfoMin> latestStationDq(@RequestParam(value = "stationId",required = false) String stationId,
|
|
|
- @RequestParam(value = "beginTime",required = false) String beginTime,
|
|
|
- @RequestParam(value = "endTime",required = false) String endTime) {
|
|
|
+ public List<StationInfoMin> latestStationDq(@RequestParam(value = "stationId", required = false) String stationId,
|
|
|
+ @RequestParam(value = "beginTime", required = false) String beginTime,
|
|
|
+ @RequestParam(value = "endTime", required = false) String endTime) {
|
|
|
|
|
|
DateTime begin = DateUtil.parse(beginTime);
|
|
|
DateTime middle = DateUtil.parse("2024-11-03");
|
|
|
DateTime end = DateUtil.parse(endTime);
|
|
|
QueryWrapper<StationInfoMin> minWrapper = new QueryWrapper<>();
|
|
|
- minWrapper.lambda().eq(StationInfoMin::getStationId,stationId).between(StationInfoMin::getRecordDate,begin,middle)
|
|
|
+ minWrapper.lambda().eq(StationInfoMin::getStationId, stationId).between(StationInfoMin::getRecordDate, begin, middle)
|
|
|
.orderByAsc(StationInfoMin::getRecordDate);
|
|
|
List<StationInfoMin> list = stationInfoMinService.list(minWrapper);
|
|
|
-// List<StationInfoMin> min=new ArrayList<>();
|
|
|
+ // List<StationInfoMin> min=new ArrayList<>();
|
|
|
int i = 1;
|
|
|
DateTime minBegin = middle, minEnd = DateUtil.offsetMinute(middle, 15);
|
|
|
while (minEnd.isBefore(end)) {
|
|
@@ -328,35 +332,37 @@ public class PredictController {
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/latest/station/dq")
|
|
|
- public StationInfoMin latestStationDq(@RequestParam(value = "stationId",required = false) String stationId) {
|
|
|
+ public StationInfoMin latestStationDq(@RequestParam(value = "stationId", required = false) String stationId) {
|
|
|
DateTime date = DateUtil.beginOfMinute(DateUtil.date());
|
|
|
int i = Math.floorDiv(date.minute(), 15) * 15;
|
|
|
date.setMinutes(i);
|
|
|
DateTime minute = DateUtil.offsetMinute(date, -15);
|
|
|
return task.calcStationSjglAgcPjfsHjwdDlMin2(minute, date, stationId);
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/latest/station/dq2")
|
|
|
- public StationInfoMin latestStationDq2(@RequestParam(value = "stationId",required = false) String stationId) {
|
|
|
+ public StationInfoMin latestStationDq2(@RequestParam(value = "stationId", required = false) String stationId) {
|
|
|
DateTime date = DateUtil.beginOfMinute(DateUtil.date());
|
|
|
int i = Math.floorDiv(date.minute(), 15) * 15;
|
|
|
date.setMinutes(i);
|
|
|
DateTime minute = DateUtil.offsetMinute(date, -15);
|
|
|
//AGC
|
|
|
- PointInfo entityAgc = getEntity("AGC002", "booster",stationId);
|
|
|
+ PointInfo entityAgc = getEntity("AGC002", "booster", stationId);
|
|
|
getLatestByEntity(entityAgc);
|
|
|
//出线
|
|
|
- PointInfo entityCx = getEntity("AGC001", "booster",stationId);
|
|
|
- getRawDataByEntity(entityCx,minute,date);
|
|
|
+ PointInfo entityCx = getEntity("AGC001", "booster", stationId);
|
|
|
+ getRawDataByEntity(entityCx, minute, date);
|
|
|
//风速
|
|
|
- List<PointInfo> entityFs = getEntitys("AI066", "turbine",stationId);
|
|
|
- getRawDataByEntity(entityFs,minute,date);
|
|
|
+ List<PointInfo> entityFs = getEntitys("AI066", "turbine", stationId);
|
|
|
+ getRawDataByEntity(entityFs, minute, date);
|
|
|
//环境温度
|
|
|
- List<PointInfo> entityHjwd = getEntitys("AI072", "turbine",stationId);
|
|
|
+ List<PointInfo> entityHjwd = getEntitys("AI072", "turbine", stationId);
|
|
|
getLatestByEntity(entityHjwd);
|
|
|
//日发电量
|
|
|
- PointInfo entity = getEntity("Z-ZXYG-JX", "meter",stationId);
|
|
|
- getSectionDataByEntity(entity,minute,date);
|
|
|
+ PointInfo entity = getEntity("Z-ZXYG-JX", "meter", stationId);
|
|
|
+ getSectionDataByEntity(entity, minute, date);
|
|
|
|
|
|
StationInfoMin day = new StationInfoMin();
|
|
|
day.setStationId(stationId);
|
|
@@ -374,12 +380,13 @@ public class PredictController {
|
|
|
day.setHjwd(hjwd);
|
|
|
return day;
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/haha2")
|
|
|
- public Map<String, Collection<GlycSj>> haha2(@RequestParam(value = "stationId",required = false) String stationId,
|
|
|
- @RequestParam(value = "beginTime",required = false) String beginTime,
|
|
|
- @RequestParam(value = "endTime",required = false) String endTime,
|
|
|
- @RequestParam(value = "interval",required = false) Integer interval) {
|
|
|
- String a="[\n" +
|
|
|
+ public Map<String, Collection<GlycSj>> haha2(@RequestParam(value = "stationId", required = false) String stationId,
|
|
|
+ @RequestParam(value = "beginTime", required = false) String beginTime,
|
|
|
+ @RequestParam(value = "endTime", required = false) String endTime,
|
|
|
+ @RequestParam(value = "interval", required = false) Integer interval) {
|
|
|
+ String a = "[\n" +
|
|
|
" {\n" +
|
|
|
" \"turbineId\": \"0011\",\n" +
|
|
|
" \"time\": \"2024-10-14 22:22:00\",\n" +
|
|
@@ -470,12 +477,13 @@ public class PredictController {
|
|
|
e.printStackTrace();
|
|
|
// 处理异常,比如记录日志或抛出运行时异常
|
|
|
}
|
|
|
- result.put(list.get(0).getTurbineId(),glycSjList);
|
|
|
+ result.put(list.get(0).getTurbineId(), glycSjList);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@GetMapping("/haha")
|
|
|
- public Map<String, GlycSj> haha(@RequestParam(value = "stationId",required = false) String stationId) {
|
|
|
- String a=" {\n" +
|
|
|
+ public Map<String, GlycSj> haha(@RequestParam(value = "stationId", required = false) String stationId) {
|
|
|
+ String a = " {\n" +
|
|
|
" \"turbineId\": \"0011\",\n" +
|
|
|
" \"time\": \"2024-10-14 22:22:00\",\n" +
|
|
|
" \"gl\": 1744.0,\n" +
|
|
@@ -504,16 +512,17 @@ public class PredictController {
|
|
|
e.printStackTrace();
|
|
|
// 处理异常,比如记录日志或抛出运行时异常
|
|
|
}
|
|
|
- result.put(list.get(0).getTurbineId(),glycSjList);
|
|
|
+ result.put(list.get(0).getTurbineId(), glycSjList);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@PostMapping("/write")
|
|
|
public boolean write(@RequestBody Map<String, List<GlycSj2>> data) {
|
|
|
try {
|
|
|
DateTime date = DateUtil.beginOfMinute(DateUtil.date());
|
|
|
int i = Math.floorDiv(date.minute(), 15) * 15;
|
|
|
date.setMinutes(i);
|
|
|
- if (CollUtil.isEmpty(tbInfos)){
|
|
|
+ if (CollUtil.isEmpty(tbInfos)) {
|
|
|
QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
|
|
|
.in(PointInfo::getUniformCode, "AI121");
|
|
@@ -522,12 +531,12 @@ public class PredictController {
|
|
|
}
|
|
|
List<RealtimePredict> rpList = new ArrayList<>();
|
|
|
List<HistoryPredict> hpList = new ArrayList<>();
|
|
|
- List<String> ids=new ArrayList<>();
|
|
|
- data.forEach((tbId,glycsjs)->{
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ data.forEach((tbId, glycsjs) -> {
|
|
|
PointInfo info = tbInfos.get(tbId);
|
|
|
for (GlycSj2 glycsj : glycsjs) {
|
|
|
RealtimePredict rp = new RealtimePredict();
|
|
|
- rp.setId(tbId+glycsj.getTime());
|
|
|
+ rp.setId(tbId + glycsj.getTime());
|
|
|
ids.add(rp.getId());
|
|
|
rp.setModelId("1");
|
|
|
rp.setPredictType("CDQ");
|
|
@@ -538,7 +547,7 @@ public class PredictController {
|
|
|
rp.setLineId(info.getLineId());
|
|
|
rp.setTurbineId(tbId);
|
|
|
rp.setPredictPower(glycsj.getPower());
|
|
|
- rp.setPredictEnergy(glycsj.getPower()/4);
|
|
|
+ rp.setPredictEnergy(glycsj.getPower() / 4);
|
|
|
rpList.add(rp);
|
|
|
HistoryPredict hp = new HistoryPredict();
|
|
|
hp.setModelId("1");
|
|
@@ -551,7 +560,7 @@ public class PredictController {
|
|
|
hp.setLineId(info.getLineId());
|
|
|
hp.setTurbineId(tbId);
|
|
|
hp.setPredictPower(glycsj.getPower());
|
|
|
- hp.setPredictEnergy(glycsj.getPower()/4);
|
|
|
+ hp.setPredictEnergy(glycsj.getPower() / 4);
|
|
|
hpList.add(hp);
|
|
|
}
|
|
|
});
|
|
@@ -564,35 +573,45 @@ public class PredictController {
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
- @PostMapping("/write/station/dq")
|
|
|
- public boolean writeStationDq(@RequestBody Map<String, List<GlycSj2>> data) {
|
|
|
+
|
|
|
+ @PostMapping("/write/station/{type}")
|
|
|
+ public boolean writeStationDq(@PathVariable String type, @RequestBody Map<String, List<GlycSj2>> data) {
|
|
|
try {
|
|
|
DateTime date = DateUtil.beginOfMinute(DateUtil.date());
|
|
|
int i = Math.floorDiv(date.minute(), 15) * 15;
|
|
|
date.setMinutes(i);
|
|
|
List<RealtimePredict> rpList = new ArrayList<>();
|
|
|
List<HistoryPredict> hpList = new ArrayList<>();
|
|
|
- List<String> ids=new ArrayList<>();
|
|
|
- data.forEach((tbId,glycsjs)->{
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ String modelId = "1";
|
|
|
+ String predictType = type.toUpperCase();
|
|
|
+ String deviceType = "station";
|
|
|
+ data.forEach((stId, glycsjs) -> {
|
|
|
+ //yyyy-MM-dd HH:mm:ss
|
|
|
+ //GJNY_SXGS_JSL_FDC_STA
|
|
|
+ //2024-10-23 15:00:00
|
|
|
+ String sstId = stId.replaceFirst("GJNY_SXGS_", "").replaceFirst("STA", "");
|
|
|
for (GlycSj2 glycsj : glycsjs) {
|
|
|
+ DateTime ycTime = DateUtil.parseDateTime(glycsj.getTime());
|
|
|
+ String t = StrUtil.removeSuffix(glycsj.getTime(), ":00").replaceFirst(" ", "_").replaceFirst(":", "-");
|
|
|
RealtimePredict rp = new RealtimePredict();
|
|
|
- rp.setId(tbId+glycsj.getTime());
|
|
|
+ rp.setId(predictType + "_" + modelId + "_" + sstId + t);
|
|
|
ids.add(rp.getId());
|
|
|
- rp.setModelId("1");
|
|
|
- rp.setPredictType("DQ");
|
|
|
- rp.setDeviceType("station");
|
|
|
- rp.setTime(DateUtil.parseDateTime(glycsj.getTime()));
|
|
|
- rp.setSiteId(tbId);
|
|
|
+ rp.setModelId(modelId);
|
|
|
+ rp.setPredictType(predictType);
|
|
|
+ rp.setDeviceType(deviceType);
|
|
|
+ rp.setTime(ycTime);
|
|
|
+ rp.setSiteId(stId);
|
|
|
rp.setPredictPower(glycsj.getPower());
|
|
|
rp.setPredictEnergy(glycsj.getEnergy());
|
|
|
rpList.add(rp);
|
|
|
HistoryPredict hp = new HistoryPredict();
|
|
|
- hp.setModelId("1");
|
|
|
- hp.setPredictType("DQ");
|
|
|
- hp.setDeviceType("station");
|
|
|
+ hp.setModelId(modelId);
|
|
|
+ hp.setPredictType(predictType);
|
|
|
+ hp.setDeviceType(deviceType);
|
|
|
hp.setDataTime(date);
|
|
|
- hp.setPredictTime(DateUtil.parseDateTime(glycsj.getTime()));
|
|
|
- hp.setSiteId(tbId);
|
|
|
+ hp.setPredictTime(ycTime);
|
|
|
+ hp.setSiteId(stId);
|
|
|
hp.setPredictPower(glycsj.getPower());
|
|
|
hp.setPredictEnergy(glycsj.getEnergy());
|
|
|
hpList.add(hp);
|
|
@@ -623,7 +642,8 @@ public class PredictController {
|
|
|
}
|
|
|
return list.get(0);
|
|
|
}
|
|
|
- public PointInfo getEntity(String uniformCode, String institutionType,String stId) {
|
|
|
+
|
|
|
+ public PointInfo getEntity(String uniformCode, String institutionType, String stId) {
|
|
|
PointInfo pi = new PointInfo();
|
|
|
pi.setUniformCode(uniformCode);
|
|
|
pi.setInstitutionType(institutionType);
|
|
@@ -631,38 +651,45 @@ public class PredictController {
|
|
|
List<PointInfo> byEntity = pointInfoService.getByEntity(pi);
|
|
|
return byEntity.get(0);
|
|
|
}
|
|
|
+
|
|
|
public void getRawDataByEntity(List<PointInfo> entity, Date start, Date end) {
|
|
|
for (PointInfo info : entity) {
|
|
|
List<PointData> snap = adapterApi.getHistoryRaw(goldenUri(), info.getPointKey(), start.getTime(), end.getTime());
|
|
|
info.setPointDatas(snap);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public void getRawDataByEntity(PointInfo entity, Date start, Date end) {
|
|
|
List<PointData> snap = adapterApi.getHistoryRaw(goldenUri(), entity.getPointKey(), start.getTime(), end.getTime());
|
|
|
entity.setPointDatas(snap);
|
|
|
}
|
|
|
- public List<PointInfo> getEntitys(String uniformCode, String institutionType,String stId) {
|
|
|
+
|
|
|
+ public List<PointInfo> getEntitys(String uniformCode, String institutionType, String stId) {
|
|
|
PointInfo pi = new PointInfo();
|
|
|
pi.setUniformCode(uniformCode);
|
|
|
pi.setInstitutionType(institutionType);
|
|
|
pi.setStationId(stId);
|
|
|
return pointInfoService.getByEntity(pi);
|
|
|
}
|
|
|
+
|
|
|
public void getSectionDataByEntity(PointInfo entity, Date end) {
|
|
|
Map<String, PointData> section = adapterApi.getHistorySection(goldenUri(), entity.getPointKey(), end.getTime());
|
|
|
- section.forEach((k,v)->{
|
|
|
+ section.forEach((k, v) -> {
|
|
|
entity.setPointDatas(Collections.singletonList(v));
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
public URI goldenUri() {
|
|
|
return URI.create("http://172.16.12.103:8011/ts");
|
|
|
}
|
|
|
+
|
|
|
public void getLatestByEntity(PointInfo entity) {
|
|
|
Map<String, PointData> latest = adapterApi.getLatest(goldenUri(), entity.getPointKey());
|
|
|
- latest.forEach((k,v)->{
|
|
|
+ latest.forEach((k, v) -> {
|
|
|
entity.setPointDatas(Collections.singletonList(v));
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
public void getSectionDataByEntity(List<PointInfo> entitys, Date start, Date end) {
|
|
|
String collect = entitys.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
Map<String, PointData> section0 = adapterApi.getHistorySection(goldenUri(), collect, start.getTime());
|
|
@@ -673,6 +700,7 @@ public class PredictController {
|
|
|
entity.getPointDatas().add(section1.get(entity.getPointKey()));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public void getSectionDataByEntity(PointInfo entity, Date start, Date end) {
|
|
|
Map<String, PointData> section0 = adapterApi.getHistorySection(goldenUri(), entity.getPointKey(), start.getTime());
|
|
|
Map<String, PointData> section1 = adapterApi.getHistorySection(goldenUri(), entity.getPointKey(), end.getTime());
|
|
@@ -680,6 +708,7 @@ public class PredictController {
|
|
|
entity.getPointDatas().add(section0.get(entity.getPointKey()));
|
|
|
entity.getPointDatas().add(section1.get(entity.getPointKey()));
|
|
|
}
|
|
|
+
|
|
|
public void getLatestByEntity(List<PointInfo> entity) {
|
|
|
String collect = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
Map<String, PointData> latest = adapterApi.getLatest(goldenUri(), collect);
|