|
@@ -11,12 +11,8 @@ import org.jeecg.modules.common.GuanCommonConstant;
|
|
import org.jeecg.modules.system.entity.SysDictItem;
|
|
import org.jeecg.modules.system.entity.SysDictItem;
|
|
import org.jeecg.modules.system.service.ISysDictItemService;
|
|
import org.jeecg.modules.system.service.ISysDictItemService;
|
|
import org.jeecg.modules.webaccess.dto.*;
|
|
import org.jeecg.modules.webaccess.dto.*;
|
|
-import org.jeecg.modules.webaccess.entity.GuanAnachglog;
|
|
|
|
-import org.jeecg.modules.webaccess.entity.GuanDashboardParam;
|
|
|
|
-import org.jeecg.modules.webaccess.entity.GuanRAlarm;
|
|
|
|
-import org.jeecg.modules.webaccess.entity.GuanTest;
|
|
|
|
|
|
+import org.jeecg.modules.webaccess.entity.*;
|
|
import org.jeecg.modules.webaccess.mapper.GuanDashboardParamMapper;
|
|
import org.jeecg.modules.webaccess.mapper.GuanDashboardParamMapper;
|
|
-import org.jeecg.modules.webaccess.mapper.GuanRAlarmMapper;
|
|
|
|
import org.jeecg.modules.webaccess.mapper.GuanTestMapper;
|
|
import org.jeecg.modules.webaccess.mapper.GuanTestMapper;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
@@ -34,7 +30,6 @@ import java.time.ZoneId;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
-import java.util.jar.JarEntry;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -431,7 +426,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<根据大屏参数设置,获取实时点位值(通过webaccess接口)>>
|
|
|
|
|
|
+ //region <<大屏-获取实时点位值(通过webaccess接口)>>
|
|
/**
|
|
/**
|
|
* 获取实时点位值
|
|
* 获取实时点位值
|
|
*
|
|
*
|
|
@@ -485,22 +480,52 @@ public class WebAccessService {
|
|
JSONObject calObj = (JSONObject) obj;
|
|
JSONObject calObj = (JSONObject) obj;
|
|
switch (calObj.get("Name").toString()) {
|
|
switch (calObj.get("Name").toString()) {
|
|
case "试验运行时间":
|
|
case "试验运行时间":
|
|
- syyxsj = (Integer) calObj.get("Value");
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ syyxsj = (Integer) calObj.get("Value");
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ syyxsj = ((Double) calObj.get("Value")).intValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "预计结束时间":
|
|
case "预计结束时间":
|
|
- yjjssj = (Integer) calObj.get("Value");
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ yjjssj = (Integer) calObj.get("Value");
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ yjjssj = ((Double) calObj.get("Value")).intValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "程序段设定时间":
|
|
case "程序段设定时间":
|
|
- cxdsdsj = (Integer) calObj.get("Value");
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ cxdsdsj = (Integer) calObj.get("Value");
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ cxdsdsj = ((Double) calObj.get("Value")).intValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "程序段运行时间":
|
|
case "程序段运行时间":
|
|
- cxdyxsj = (Integer) calObj.get("Value");
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ cxdyxsj = (Integer) calObj.get("Value");
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ cxdyxsj = ((Double) calObj.get("Value")).intValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "温度输出率":
|
|
case "温度输出率":
|
|
- wdscl = ((Integer) calObj.get("Value")).floatValue();
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ wdscl = ((Integer) calObj.get("Value")).floatValue();
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ wdscl = ((Double) calObj.get("Value")).floatValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "湿度输出率":
|
|
case "湿度输出率":
|
|
- sdscl = ((Integer) calObj.get("Value")).floatValue();
|
|
|
|
|
|
+ if (calObj.get("Value").getClass().getName().equals("java.lang.Integer")) {
|
|
|
|
+ sdscl = ((Integer) calObj.get("Value")).floatValue();
|
|
|
|
+ }
|
|
|
|
+ else if (calObj.get("Value").getClass().getName().equals("java.lang.Double")) {
|
|
|
|
+ sdscl = ((Double) calObj.get("Value")).floatValue();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case "":
|
|
case "":
|
|
break;
|
|
break;
|
|
@@ -615,7 +640,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<根据大屏参数设置,获取实时点位值(通过redis)>>
|
|
|
|
|
|
+ //region <<大屏-获取实时点位值(通过redis)>>
|
|
/**
|
|
/**
|
|
* 获取实时点位值
|
|
* 获取实时点位值
|
|
*
|
|
*
|
|
@@ -634,8 +659,9 @@ public class WebAccessService {
|
|
for (GuanDashboardParam param : dashboardParamList) {
|
|
for (GuanDashboardParam param : dashboardParamList) {
|
|
if (param.getTagName() != null && !"".equals(param.getTagName())) {
|
|
if (param.getTagName() != null && !"".equals(param.getTagName())) {
|
|
JSONObject js = new JSONObject();
|
|
JSONObject js = new JSONObject();
|
|
|
|
+ Bwanalogtable bwanalogtable = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName());
|
|
js.put("Name", param.getTagName());
|
|
js.put("Name", param.getTagName());
|
|
- js.put("Value", redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName()));
|
|
|
|
|
|
+ js.put("Value", bwanalogtable.getAvgvalue());
|
|
js.put("Quality", 1);
|
|
js.put("Quality", 1);
|
|
|
|
|
|
resJsonArray.add(js);
|
|
resJsonArray.add(js);
|
|
@@ -650,7 +676,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<根据大屏参数设置,获取实时曲线、全程曲线(全部)(通过webaccess接口)>>
|
|
|
|
|
|
+ //region <<大屏-获取实时曲线、全程曲线(全部)(通过webaccess接口)>>
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取实时曲线
|
|
* 获取实时曲线
|
|
@@ -696,6 +722,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
JSONObject jo = null;
|
|
JSONObject jo = null;
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
|
|
|
curve.setType("实时");
|
|
curve.setType("实时");
|
|
// 1.1 每笔数据之间隔时间
|
|
// 1.1 每笔数据之间隔时间
|
|
@@ -737,6 +764,7 @@ public class WebAccessService {
|
|
// 获取信息
|
|
// 获取信息
|
|
JSONObject dataLog = GetDataLog(jo);
|
|
JSONObject dataLog = GetDataLog(jo);
|
|
curve.setName(param.getParamName());
|
|
curve.setName(param.getParamName());
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
if (dataLog.getJSONArray("DataLog").size() > 0) {
|
|
if (dataLog.getJSONArray("DataLog").size() > 0) {
|
|
List<String> values = dataLog.getJSONArray("DataLog").getJSONObject(0).getJSONArray("Values");
|
|
List<String> values = dataLog.getJSONArray("DataLog").getJSONObject(0).getJSONArray("Values");
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
@@ -811,6 +839,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
JSONObject jo = null;
|
|
JSONObject jo = null;
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
|
|
|
// 2 获取 全程曲线 参数
|
|
// 2 获取 全程曲线 参数
|
|
curve.setType("全程");
|
|
curve.setType("全程");
|
|
@@ -840,6 +869,7 @@ public class WebAccessService {
|
|
// 获取信息
|
|
// 获取信息
|
|
JSONObject dataLog = GetDataLog(jo);
|
|
JSONObject dataLog = GetDataLog(jo);
|
|
curve.setName(param.getParamName());
|
|
curve.setName(param.getParamName());
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
if (dataLog.getJSONArray("DataLog").size() > 0) {
|
|
if (dataLog.getJSONArray("DataLog").size() > 0) {
|
|
List<String> values = dataLog.getJSONArray("DataLog").getJSONObject(0).getJSONArray("Values");
|
|
List<String> values = dataLog.getJSONArray("DataLog").getJSONObject(0).getJSONArray("Values");
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
@@ -887,6 +917,9 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
Date beginTime = (Date) startTime.clone();
|
|
Date beginTime = (Date) startTime.clone();
|
|
|
|
|
|
|
|
+ if (curveList.get(i).getSubList() == null || curveList.get(i).getSubList().size() < 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
for (int j = 0; j < curveList.get(i).getSubList().size(); j++) {
|
|
for (int j = 0; j < curveList.get(i).getSubList().size(); j++) {
|
|
curveList.get(i).getSubList().get(j).setLogtime(beginTime);
|
|
curveList.get(i).getSubList().get(j).setLogtime(beginTime);
|
|
curveList.get(i).getSubList().get(j).setTranstime(new SimpleDateFormat(dateformat).format(beginTime));
|
|
curveList.get(i).getSubList().get(j).setTranstime(new SimpleDateFormat(dateformat).format(beginTime));
|
|
@@ -900,7 +933,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<根据大屏参数设置,获取实时曲线、全程曲线(增量)(通过webaccess接口)>>
|
|
|
|
|
|
+ //region <<大屏-获取实时曲线、全程曲线(增量)(通过webaccess接口)>>
|
|
/**
|
|
/**
|
|
* 获取实时曲线
|
|
* 获取实时曲线
|
|
* @return
|
|
* @return
|
|
@@ -940,7 +973,18 @@ public class WebAccessService {
|
|
JSONObject res = resArray.getJSONObject(i);
|
|
JSONObject res = resArray.getJSONObject(i);
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
curve.setType("实时");
|
|
curve.setType("实时");
|
|
- curve.setName(res.get("Name").toString());
|
|
|
|
|
|
+ List<GuanDashboardParam> subdashList = dashboardParamList.stream()
|
|
|
|
+ .filter(p -> p.getTagName().equals(res.get("Name").toString()) &&
|
|
|
|
+ (p.getParamName().equals("辐射强度值-实时") ||
|
|
|
|
+ p.getParamName().equals("湿度实值-实时") || p.getParamName().equals("温度实值-实时"))
|
|
|
|
+ ).collect(Collectors.toList());
|
|
|
|
+ if (subdashList == null || subdashList.size() < 1) {
|
|
|
|
+ curve.setName(res.get("Name").toString());
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ curve.setName(subdashList.get(0).getParamName());
|
|
|
|
+ }
|
|
|
|
+ curve.setTagname(res.get("Name").toString());
|
|
|
|
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
@@ -997,7 +1041,18 @@ public class WebAccessService {
|
|
JSONObject res = resArray.getJSONObject(i);
|
|
JSONObject res = resArray.getJSONObject(i);
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
curve.setType("全程");
|
|
curve.setType("全程");
|
|
- curve.setName(res.get("Name").toString());
|
|
|
|
|
|
+ List<GuanDashboardParam> subdashList = dashboardParamList.stream()
|
|
|
|
+ .filter(p -> p.getTagName().equals(res.get("Name").toString()) &&
|
|
|
|
+ (p.getParamName().equals("辐射强度值-全程") ||
|
|
|
|
+ p.getParamName().equals("湿度实值-全程") || p.getParamName().equals("温度实值-全程"))
|
|
|
|
+ ).collect(Collectors.toList());
|
|
|
|
+ if (subdashList == null || subdashList.size() < 1) {
|
|
|
|
+ curve.setName(res.get("Name").toString());
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ curve.setName(subdashList.get(0).getParamName());
|
|
|
|
+ }
|
|
|
|
+ curve.setTagname(res.get("Name").toString());
|
|
|
|
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
@@ -1016,7 +1071,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<根据大屏参数设置,获取实时曲线、全程曲线(增量)(通过redis缓存)>>
|
|
|
|
|
|
+ //region <<大屏-获取实时曲线、全程曲线(增量)(通过redis缓存)>>
|
|
/**
|
|
/**
|
|
* 获取实时曲线
|
|
* 获取实时曲线
|
|
* @return
|
|
* @return
|
|
@@ -1046,14 +1101,20 @@ public class WebAccessService {
|
|
|
|
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
curve.setType("实时");
|
|
curve.setType("实时");
|
|
- curve.setName(param.getTagName());
|
|
|
|
|
|
+ curve.setName(param.getParamName());
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
|
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
sub.setLogtime(new Date());
|
|
sub.setLogtime(new Date());
|
|
|
|
|
|
|
|
+ Bwanalogtable bwanalogtable = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName());
|
|
|
|
+// sub.setTranstime(bwanalogtable.getLogtime());
|
|
|
|
+
|
|
|
|
+ // 判断一下,如果点位值长时间没更新(10秒),则将值设为#
|
|
|
|
+
|
|
sub.setTranstime(new SimpleDateFormat("HH:mm:ss").format(new Date()));
|
|
sub.setTranstime(new SimpleDateFormat("HH:mm:ss").format(new Date()));
|
|
- sub.setTagvalue(redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName()).toString());
|
|
|
|
|
|
+ sub.setTagvalue(bwanalogtable.getAvgvalue().toString());
|
|
subList.add(sub);
|
|
subList.add(sub);
|
|
|
|
|
|
curve.setSubList(subList);
|
|
curve.setSubList(subList);
|
|
@@ -1091,14 +1152,17 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
CurveDTO curve = new CurveDTO();
|
|
CurveDTO curve = new CurveDTO();
|
|
curve.setType("全程");
|
|
curve.setType("全程");
|
|
- curve.setName(param.getTagName());
|
|
|
|
|
|
+ curve.setName(param.getParamName());
|
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
|
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
List<CurveSubDTO> subList = new ArrayList<>();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
CurveSubDTO sub = new CurveSubDTO();
|
|
sub.setLogtime(new Date());
|
|
sub.setLogtime(new Date());
|
|
|
|
|
|
|
|
+ Bwanalogtable bwanalogtable = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName());
|
|
sub.setTranstime(new SimpleDateFormat("MM-dd HH:mm:ss").format(new Date()));
|
|
sub.setTranstime(new SimpleDateFormat("MM-dd HH:mm:ss").format(new Date()));
|
|
- sub.setTagvalue(redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + param.getTagName()).toString());
|
|
|
|
|
|
+// sub.setTranstime(bwanalogtable.getLogdate().replace("/", "-").substring(3) + " " + bwanalogtable.getLogtime());
|
|
|
|
+ sub.setTagvalue(bwanalogtable.getAvgvalue().toString());
|
|
subList.add(sub);
|
|
subList.add(sub);
|
|
|
|
|
|
curve.setSubList(subList);
|
|
curve.setSubList(subList);
|
|
@@ -1109,7 +1173,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- // region <<根据大屏参数设置,获取预制曲线>>
|
|
|
|
|
|
+ // region <<大屏-获取预制曲线(通过webaccess接口)>>
|
|
/**
|
|
/**
|
|
* 获取预制曲线
|
|
* 获取预制曲线
|
|
* @return
|
|
* @return
|
|
@@ -1130,7 +1194,7 @@ public class WebAccessService {
|
|
circulates = getNbxh();
|
|
circulates = getNbxh();
|
|
|
|
|
|
// 获取循环详细信息(温度、湿度、时间)
|
|
// 获取循环详细信息(温度、湿度、时间)
|
|
- getCxsd(circulates, duans);
|
|
|
|
|
|
+ getCxsdOne(circulates, duans);
|
|
|
|
|
|
circulates.remove(circulates.size() - 1);
|
|
circulates.remove(circulates.size() - 1);
|
|
}
|
|
}
|
|
@@ -1442,13 +1506,378 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
// endregion
|
|
// endregion
|
|
|
|
|
|
- // region <<获取报警信息>>
|
|
|
|
|
|
+ // region <<大屏-获取预制曲线(通过redis缓存)>>
|
|
|
|
+ /**
|
|
|
|
+ * 获取预制曲线
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<CirculateDTO> getYzcxCache(List<String> duans) {
|
|
|
|
+ List<CirculateDTO> circulates = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ // 先获取 运行方式设定
|
|
|
|
+ Bwanalogtable bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "运行方式设定");
|
|
|
|
+ String tagValue = "";
|
|
|
|
+ if (bw == null) {
|
|
|
|
+ List<WaLogDTO> tags = new ArrayList<>();
|
|
|
|
+ WaLogDTO tag = new WaLogDTO("运行方式设定");
|
|
|
|
+ tags.add(tag);
|
|
|
|
+ JSONObject jsonObject = generateGetObject(tags);
|
|
|
|
+ tagValue = getTagNameValues(jsonObject);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ tagValue = bw.getAvgvalue().intValue() + "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 程序方式
|
|
|
|
+ if ("1".equals(tagValue)) {
|
|
|
|
+ // 获取4个内部循环定义信息(启始段、结束段、次数)
|
|
|
|
+ circulates = getNbxhCache();
|
|
|
|
+
|
|
|
|
+ // 获取循环详细信息(温度、湿度、时间)
|
|
|
|
+ getCxsdOne(circulates, duans);
|
|
|
|
+
|
|
|
|
+ circulates.remove(circulates.size() - 1);
|
|
|
|
+ }
|
|
|
|
+ // 定值方式
|
|
|
|
+ else if ("2".equals(tagValue)) {
|
|
|
|
+ getDzfsInfoCache(circulates);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return circulates;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取定值方式的数据
|
|
|
|
+ * @param circulates
|
|
|
|
+ */
|
|
|
|
+ private void getDzfsInfoCache(List<CirculateDTO> circulates) {
|
|
|
|
+ // 获取 温度设定值
|
|
|
|
+ Bwanalogtable bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "温度设定值");
|
|
|
|
+ String temp = "";
|
|
|
|
+ if (bw == null) {
|
|
|
|
+ List<WaLogDTO> tags = new ArrayList<>();
|
|
|
|
+ WaLogDTO tag = new WaLogDTO("温度设定值");
|
|
|
|
+ tags.add(tag);
|
|
|
|
+ JSONObject jsonObject = generateGetObject(tags);
|
|
|
|
+ temp = getTagNameValues(jsonObject);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ temp = bw.getAvgvalue() + "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取 湿度设定值
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "湿度设定值");
|
|
|
|
+ String humi = "";
|
|
|
|
+ if (bw == null) {
|
|
|
|
+ List<WaLogDTO> tags = new ArrayList<>();
|
|
|
|
+ WaLogDTO tag = new WaLogDTO("湿度设定值");
|
|
|
|
+ tags.add(tag);
|
|
|
|
+ JSONObject jsonObject = generateGetObject(tags);
|
|
|
|
+ humi = getTagNameValues(jsonObject);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ humi = bw.getAvgvalue() + "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setBegintime("1");
|
|
|
|
+ circulate.setEndtime("10");
|
|
|
|
+ circulate.setBeginsec(1);
|
|
|
|
+ circulate.setEndsec(10);
|
|
|
|
+ circulate.setCircname("定值运行");
|
|
|
|
+
|
|
|
|
+ List<SectionDTO> sections = new ArrayList<>();
|
|
|
|
+ for(int i = 1; i <= 10; i++) {
|
|
|
|
+ SectionDTO section = new SectionDTO();
|
|
|
|
+ section.setTemperature(Float.parseFloat(temp));
|
|
|
|
+ section.setHumidity(Float.parseFloat(humi));
|
|
|
|
+ section.setTime(i + "");
|
|
|
|
+ sections.add(section);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ circulate.setSections(sections);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取循环详细信息(温度、湿度、时间)
|
|
|
|
+ * 这里还是需要调用webaccess的api接口,因为wa存数据库速度太慢,影响别的参数
|
|
|
|
+ * @param circulates 循环信息
|
|
|
|
+ * @param duans 段标识
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private void getCxsdOne(List<CirculateDTO> circulates, List<String> duans) {
|
|
|
|
+
|
|
|
|
+ Integer allSecond = 0; // 累加的秒
|
|
|
|
+
|
|
|
|
+ if (circulates == null || circulates.size() < 1) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 循环获取温度、湿度、分、秒设定
|
|
|
|
+ List<WaLogDTO> tags = new ArrayList<>();
|
|
|
|
+ for (int j = 0; j < circulates.size(); j++) {
|
|
|
|
+ // 全部循环设定值,则略过
|
|
|
|
+ if (circulates.get(j).getCircname().equals("全部循环设定值")) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = circulates.get(j).getBeginsec(); i <= circulates.get(j).getEndsec(); i++) {
|
|
|
|
+ // 段标识
|
|
|
|
+ duans.add(i + "");
|
|
|
|
+
|
|
|
|
+ int xb = i + 1; // 下标
|
|
|
|
+ String cxd = (xb < 10 ? "0" + xb : "" + xb);
|
|
|
|
+
|
|
|
|
+ SectionDTO section = new SectionDTO();
|
|
|
|
+ section.setSecname(i); // 段号
|
|
|
|
+
|
|
|
|
+ // 温度
|
|
|
|
+ cxsdAdd(tags, "程序温度设定" + cxd);
|
|
|
|
+ // 湿度
|
|
|
|
+ cxsdAdd(tags, "程序湿度设定" + cxd);
|
|
|
|
+ // 分
|
|
|
|
+ cxsdAdd(tags, "程序时间设定分" + cxd);
|
|
|
|
+ // 秒
|
|
|
|
+ cxsdAdd(tags, "程序时间设定秒" + cxd);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ JSONObject waparams = generateGetObject(tags);
|
|
|
|
+ JSONObject jsonObject = getTagNameValuesNoAnalysis(waparams);
|
|
|
|
+ JSONArray resJsonArray = jsonObject.getJSONArray("Values");
|
|
|
|
+
|
|
|
|
+ // 循环获取信息
|
|
|
|
+ for (int j = 0; j < circulates.size(); j++) {
|
|
|
|
+ // 全部循环设定值,则略过
|
|
|
|
+ if (circulates.get(j).getCircname().equals("全部循环设定值")) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SectionDTO> sections = new ArrayList<>();
|
|
|
|
+ for (int i = circulates.get(j).getBeginsec(); i <= circulates.get(j).getEndsec(); i++) {
|
|
|
|
+ // 段标识
|
|
|
|
+ duans.add(i + "");
|
|
|
|
+
|
|
|
|
+ int xb = i + 1; // 下标
|
|
|
|
+ String cxd = (xb < 10 ? "0" + xb : "" + xb);
|
|
|
|
+
|
|
|
|
+ SectionDTO section = new SectionDTO();
|
|
|
|
+ section.setSecname(i); // 段号
|
|
|
|
+
|
|
|
|
+ // 温度
|
|
|
|
+ Float temperature = Float.parseFloat(getCxsdValue(resJsonArray, "程序温度设定" + cxd).toString());
|
|
|
|
+ section.setTemperature(temperature);
|
|
|
|
+
|
|
|
|
+ // 湿度
|
|
|
|
+ Float humidity = Float.parseFloat(getCxsdValue(resJsonArray, "程序湿度设定" + cxd).toString());
|
|
|
|
+ section.setHumidity(humidity);
|
|
|
|
+
|
|
|
|
+ // 分
|
|
|
|
+ Integer minute = Integer.parseInt(getCxsdValue(resJsonArray, "程序时间设定分" + cxd).toString());
|
|
|
|
+ section.setMinute(minute);
|
|
|
|
+
|
|
|
|
+ // 秒
|
|
|
|
+ Integer second = Integer.parseInt(getCxsdValue(resJsonArray, "程序时间设定秒" + cxd).toString());
|
|
|
|
+ section.setSecond(second);
|
|
|
|
+
|
|
|
|
+ // 虚拟一个开头,不然线不对
|
|
|
|
+ if (allSecond == 0) {
|
|
|
|
+ SectionDTO firstsection = new SectionDTO();
|
|
|
|
+ firstsection.setSecname(-1);
|
|
|
|
+ firstsection.setTemperature(temperature);
|
|
|
|
+ firstsection.setHumidity(humidity);
|
|
|
|
+ // 时间
|
|
|
|
+ firstsection.setTime("00:00");
|
|
|
|
+ allSecond += minute * 60 + second;
|
|
|
|
+
|
|
|
|
+ sections.add(firstsection);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 时间
|
|
|
|
+ section.setTime(generateTime(allSecond));
|
|
|
|
+ allSecond += minute * 60 + second;
|
|
|
|
+
|
|
|
|
+ sections.add(section);
|
|
|
|
+ }
|
|
|
|
+ if (sections != null && sections.size() > 0) {
|
|
|
|
+ if (j == 0) {
|
|
|
|
+ circulates.get(j).setBegintime(sections.get(0).getTime());
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ circulates.get(j).setBegintime(circulates.get(j - 1).getSections().get(circulates.get(j - 1).getSections().size() - 1).getTime());
|
|
|
|
+ }
|
|
|
|
+ circulates.get(j).setEndtime(sections.get(sections.size() - 1).getTime());
|
|
|
|
+ }
|
|
|
|
+ circulates.get(j).setSections(sections);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 程序时段查询条件组合
|
|
|
|
+ * @param tags
|
|
|
|
+ * @param tagname
|
|
|
|
+ */
|
|
|
|
+ private void cxsdAdd(List<WaLogDTO> tags, String tagname) {
|
|
|
|
+ WaLogDTO waLogDTO = new WaLogDTO(tagname);
|
|
|
|
+ List<WaLogDTO> subtags = tags.stream().filter(p -> p.getTagname().equals(tagname)).collect(Collectors.toList());
|
|
|
|
+ if (subtags == null || subtags.size() < 1) {
|
|
|
|
+ tags.add(waLogDTO);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取程序段值
|
|
|
|
+ * @param res
|
|
|
|
+ * @param tagname
|
|
|
|
+ */
|
|
|
|
+ private Object getCxsdValue(JSONArray res, String tagname) {
|
|
|
|
+ if (res == null || res.size() < 1) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (Object obj : res) {
|
|
|
|
+ JSONObject js = (JSONObject) obj;
|
|
|
|
+ if (js.get("Name").equals(tagname)) {
|
|
|
|
+ return js.get("Value");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取4个内部循环定义信息(启始段、结束段、次数)
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<CirculateDTO> getNbxhCache() {
|
|
|
|
+ List<CirculateDTO> circulates = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ Integer nbxh1_qsd = 0;
|
|
|
|
+ Integer nbxh1_jsd = 0;
|
|
|
|
+ Integer nbxh1_cs = 0;
|
|
|
|
+ Integer nbxh2_qsd = 0;
|
|
|
|
+ Integer nbxh2_jsd = 0;
|
|
|
|
+ Integer nbxh2_cs = 0;
|
|
|
|
+ Integer nbxh3_qsd = 0;
|
|
|
|
+ Integer nbxh3_jsd = 0;
|
|
|
|
+ Integer nbxh3_cs = 0;
|
|
|
|
+ Integer nbxh4_qsd = 0;
|
|
|
|
+ Integer nbxh4_jsd = 0;
|
|
|
|
+ Integer nbxh4_cs = 0;
|
|
|
|
+ Integer quanbu = 0;
|
|
|
|
+
|
|
|
|
+ // 1.1内部循环1
|
|
|
|
+ Bwanalogtable bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环1_启始段");
|
|
|
|
+ nbxh1_qsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环1_结束段");
|
|
|
|
+ nbxh1_jsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环1_次数");
|
|
|
|
+ nbxh1_cs = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ // 1.2内部循环2
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环2_启始段");
|
|
|
|
+ nbxh2_qsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环2_结束段");
|
|
|
|
+ nbxh2_jsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环2_次数");
|
|
|
|
+ nbxh2_cs = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ // 1.3内部循环3
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环3_启始段");
|
|
|
|
+ nbxh3_qsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环3_结束段");
|
|
|
|
+ nbxh3_jsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环3_次数");
|
|
|
|
+ nbxh3_cs = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ // 1.4内部循环4
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环4_启始段");
|
|
|
|
+ nbxh4_qsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环4_结束段");
|
|
|
|
+ nbxh4_jsd = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "内部循环4_次数");
|
|
|
|
+ nbxh4_cs = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ // 2全部循环
|
|
|
|
+ bw = null;
|
|
|
|
+ bw = (Bwanalogtable) redisUtil.get(GuanCommonConstant.GUAN_TAGVALUE_PREFIX + "全部循环设定值");
|
|
|
|
+ quanbu = bw.getAvgvalue() == null ? 0 : bw.getAvgvalue().intValue();
|
|
|
|
+
|
|
|
|
+ // 依据循环的次序,判断循环是否使用,使用则添加到循环中,否则抛弃
|
|
|
|
+ if (nbxh1_cs > 0) {
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setCircname("内部循环1");
|
|
|
|
+ circulate.setBeginsec(nbxh1_qsd);
|
|
|
|
+ circulate.setEndsec(nbxh1_jsd);
|
|
|
|
+ circulate.setTimenum(nbxh1_cs);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (nbxh2_cs > 0) {
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setCircname("内部循环2");
|
|
|
|
+ circulate.setBeginsec(nbxh2_qsd);
|
|
|
|
+ circulate.setEndsec(nbxh2_jsd);
|
|
|
|
+ circulate.setTimenum(nbxh2_cs);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (nbxh3_cs > 0) {
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setCircname("内部循环3");
|
|
|
|
+ circulate.setBeginsec(nbxh3_qsd);
|
|
|
|
+ circulate.setEndsec(nbxh3_jsd);
|
|
|
|
+ circulate.setTimenum(nbxh3_cs);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (nbxh4_cs > 0) {
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setCircname("内部循环4");
|
|
|
|
+ circulate.setBeginsec(nbxh4_qsd);
|
|
|
|
+ circulate.setEndsec(nbxh4_jsd);
|
|
|
|
+ circulate.setTimenum(nbxh4_cs);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CirculateDTO circulate = new CirculateDTO();
|
|
|
|
+ circulate.setCircname("全部循环设定值");
|
|
|
|
+ circulate.setTimenum(nbxh1_qsd);
|
|
|
|
+ circulates.add(circulate);
|
|
|
|
+
|
|
|
|
+ return circulates;
|
|
|
|
+ }
|
|
|
|
+ // endregion
|
|
|
|
+
|
|
|
|
+ // region <<大屏-获取报警信息(主要从数据库)>>
|
|
/**
|
|
/**
|
|
* 获取24小时内报警信息
|
|
* 获取24小时内报警信息
|
|
|
|
+ * @param ifRefresh 是否强制刷新
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<GuanRAlarm> getAlarm24h() {
|
|
|
|
- List<GuanRAlarm> alarmList = guanRAlarmService.selectAlarm24h(false);
|
|
|
|
|
|
+ public List<GuanRAlarm> getAlarm24h(Boolean ifRefresh) {
|
|
|
|
+ List<GuanRAlarm> alarmList = guanRAlarmService.selectAlarm24h(ifRefresh);
|
|
|
|
|
|
return alarmList;
|
|
return alarmList;
|
|
}
|
|
}
|
|
@@ -1504,7 +1933,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
- //region <<组合获取到的大屏展示数据>>
|
|
|
|
|
|
+ //region <<大屏-组合获取到的大屏展示数据(通过webaccess接口)>>
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取设备实时数据
|
|
* 获取设备实时数据
|
|
@@ -1611,7 +2040,7 @@ public class WebAccessService {
|
|
|
|
|
|
// 最近24H报警信息在缓存中不存在,则获取信息并存入缓存中,否则不做处理
|
|
// 最近24H报警信息在缓存中不存在,则获取信息并存入缓存中,否则不做处理
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_ALARMS_24H)) {
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_ALARMS_24H)) {
|
|
- List<GuanRAlarm> alarmList = getAlarm24h();
|
|
|
|
|
|
+ List<GuanRAlarm> alarmList = getAlarm24h(false);
|
|
jsonObject.put("最近24H报警信息", alarmList.toString());
|
|
jsonObject.put("最近24H报警信息", alarmList.toString());
|
|
redisUtil.set(GuanCommonConstant.GUAN_ALARMS_24H, alarmList);
|
|
redisUtil.set(GuanCommonConstant.GUAN_ALARMS_24H, alarmList);
|
|
}
|
|
}
|
|
@@ -1709,7 +2138,7 @@ public class WebAccessService {
|
|
// 重新获取预制曲线
|
|
// 重新获取预制曲线
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_PREPARE_CURVE) || isRefresh) {
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_PREPARE_CURVE) || isRefresh) {
|
|
List<String> duans = new ArrayList<>();
|
|
List<String> duans = new ArrayList<>();
|
|
- List<CirculateDTO> yzqxList = getYzcx(duans);
|
|
|
|
|
|
+ List<CirculateDTO> yzqxList = getYzcxCache(duans);
|
|
redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE, yzqxList);
|
|
redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE, yzqxList);
|
|
redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE_SECTION, duans);
|
|
redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE_SECTION, duans);
|
|
}
|
|
}
|
|
@@ -1728,15 +2157,209 @@ public class WebAccessService {
|
|
|
|
|
|
// 重新获取当前时间之前24小时的报警信息
|
|
// 重新获取当前时间之前24小时的报警信息
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_ALARMS_24H) || isRefresh) {
|
|
if (!redisUtil.hasKey(GuanCommonConstant.GUAN_ALARMS_24H) || isRefresh) {
|
|
- List<GuanRAlarm> alarmList = getAlarm24h();
|
|
|
|
|
|
+ List<GuanRAlarm> alarmList = getAlarm24h(isRefresh);
|
|
redisUtil.set(GuanCommonConstant.GUAN_ALARMS_24H, alarmList);
|
|
redisUtil.set(GuanCommonConstant.GUAN_ALARMS_24H, alarmList);
|
|
}
|
|
}
|
|
|
|
|
|
log.info(String.format("缓存信息! 结束时间 ↑↑↑↑↑↑↑↑↑↑:" + DateUtils.getTimestamp()));
|
|
log.info(String.format("缓存信息! 结束时间 ↑↑↑↑↑↑↑↑↑↑:" + DateUtils.getTimestamp()));
|
|
}
|
|
}
|
|
|
|
+ //endregion
|
|
|
|
+
|
|
|
|
+ //region <<大屏-组合获取到的大屏展示数据(通过redis缓存)>>
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取设备实时数据
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String loadRealtimeDataCache() {
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备实时信息! 开始时间 ↓↓↓↓↓↓↓↓↓↓:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+
|
|
|
|
+ // 设备实时值
|
|
|
|
+ JSONArray tagArray = getDashboardCache();
|
|
|
|
+ jsonObject.put("设备实时值", tagArray);
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备实时信息! 结束时间 ↑↑↑↑↑↑↑↑↑↑:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ return jsonObject.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取曲线数据
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String loadCurveDataCache() {
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备曲线信息! 开始时间 ↓↓↓↓↓↓↓↓↓↓:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+
|
|
|
|
+ // 实时曲线在缓存中不存在,则获取实时曲线并存入缓存中,否则做增量添加
|
|
|
|
+ if (!redisUtil.hasKey(GuanCommonConstant.GUAN_REALTIME_CURVE)) {
|
|
|
|
+ List<CurveDTO> realtimeCurveList = getRealtimeCurve(null);
|
|
|
|
+ jsonObject.put("实时曲线", realtimeCurveList.toString());
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_REALTIME_CURVE, realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+ // 增量添加
|
|
|
|
+ else {
|
|
|
|
+ List<CurveDTO> incrementRealtimeCurveList = getIncrementRealtimeCurveCache();
|
|
|
|
+ List<CurveDTO> realtimeCurveList = (List<CurveDTO>) redisUtil.get(GuanCommonConstant.GUAN_REALTIME_CURVE);
|
|
|
|
+ // 将获取的增加数据增加到实时曲线的列表中
|
|
|
|
+ if (realtimeCurveList != null && realtimeCurveList.size() > 0) {
|
|
|
|
+ for (int i = 0; i < realtimeCurveList.size(); i++) {
|
|
|
|
+ String name = realtimeCurveList.get(i).getName();
|
|
|
|
+ List<CurveDTO> subCurveList = incrementRealtimeCurveList.stream()
|
|
|
|
+ .filter(p -> p.getName().equals(name)).collect(Collectors.toList());
|
|
|
|
+ if (subCurveList != null && subCurveList.size() > 0 &&
|
|
|
|
+ subCurveList.get(0).getSubList() != null && subCurveList.get(0).getSubList().size() > 0) {
|
|
|
|
+ realtimeCurveList.get(i).getSubList().add(subCurveList.get(0).getSubList().get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 排序
|
|
|
|
+ curveSort(realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ Collections.copy(incrementRealtimeCurveList, realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+ jsonObject.put("实时曲线", realtimeCurveList.toString());
|
|
|
|
+ // 重新缓存实时曲线
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_REALTIME_CURVE, realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 全程曲线在缓存中不存在,则获取全程曲线并存入缓存中,否则做增量添加
|
|
|
|
+ if (!redisUtil.hasKey(GuanCommonConstant.GUAN_WHOLE_CURE)) {
|
|
|
|
+ List<CurveDTO> wholeCurveList = getWholeCurve(null);
|
|
|
|
+ jsonObject.put("全程曲线", wholeCurveList.toString());
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_WHOLE_CURE, wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+ // 增量添加
|
|
|
|
+ else {
|
|
|
|
+ List<CurveDTO> incrementWholeCurveList = getIncrementWholeCurveCache();
|
|
|
|
+ List<CurveDTO> wholeCurveList = (List<CurveDTO>) redisUtil.get(GuanCommonConstant.GUAN_WHOLE_CURE);
|
|
|
|
+ // 将获取的增加数据增加到全程曲线的列表中
|
|
|
|
+ if (wholeCurveList != null && wholeCurveList.size() > 0) {
|
|
|
|
+ for (int i = 0; i < wholeCurveList.size(); i++) {
|
|
|
|
+ String name = wholeCurveList.get(i).getName();
|
|
|
|
+ List<CurveDTO> subCurveList = incrementWholeCurveList.stream()
|
|
|
|
+ .filter(p -> p.getName().equals(name)).collect(Collectors.toList());
|
|
|
|
+ if (subCurveList != null && subCurveList.size() > 0 &&
|
|
|
|
+ subCurveList.get(0).getSubList() != null && subCurveList.get(0).getSubList().size() > 0) {
|
|
|
|
+ wholeCurveList.get(i).getSubList().add(subCurveList.get(0).getSubList().get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 排序
|
|
|
|
+ curveSort(wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ Collections.copy(incrementWholeCurveList, wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+ jsonObject.put("全程曲线", wholeCurveList.toString());
|
|
|
|
+ // 重新缓存全程曲线
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_WHOLE_CURE, wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 预制曲线在缓存中不存在,则获取预制曲线并存入缓存中,否则不做处理
|
|
|
|
+ if (!redisUtil.hasKey(GuanCommonConstant.GUAN_PREPARE_CURVE)) {
|
|
|
|
+ List<String> duans = new ArrayList<>();
|
|
|
|
+ List<CirculateDTO> yzqxList = getYzcxCache(duans);
|
|
|
|
+ jsonObject.put("预制曲线", yzqxList);
|
|
|
|
+ jsonObject.put("预制曲线线段", duans);
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE, yzqxList);
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_PREPARE_CURVE_SECTION, duans);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 最近24H报警信息在缓存中不存在,则获取信息并存入缓存中,否则不做处理
|
|
|
|
+ if (!redisUtil.hasKey(GuanCommonConstant.GUAN_ALARMS_24H)) {
|
|
|
|
+ List<GuanRAlarm> alarmList = getAlarm24h(false);
|
|
|
|
+ jsonObject.put("最近24H报警信息", alarmList.toString());
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_ALARMS_24H, alarmList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备曲线信息! 结束时间 ↑↑↑↑↑↑↑↑↑↑:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ return jsonObject.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取曲线数据 增量
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String loadIncrementCurveDataCache() {
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备曲线信息(增量)! 开始时间 ↓↓↓↓↓↓↓↓↓↓:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+
|
|
|
|
+ // 实时曲线
|
|
|
|
+ List<CurveDTO> incrementRealtimeCurveList = getIncrementRealtimeCurveCache();
|
|
|
|
+ List<CurveDTO> realtimeCurveList = null;
|
|
|
|
+ if (redisUtil.hasKey(GuanCommonConstant.GUAN_REALTIME_CURVE)) {
|
|
|
|
+ realtimeCurveList = (List<CurveDTO>) redisUtil.get(GuanCommonConstant.GUAN_REALTIME_CURVE);
|
|
|
|
+ }
|
|
|
|
+ // 将获取的增加数据增加到实时曲线的列表中
|
|
|
|
+ if (realtimeCurveList != null && realtimeCurveList.size() > 0) {
|
|
|
|
+ for (int i = 0; i < realtimeCurveList.size(); i++) {
|
|
|
|
+ String name = realtimeCurveList.get(i).getName();
|
|
|
|
+ List<CurveDTO> subCurveList = incrementRealtimeCurveList.stream()
|
|
|
|
+ .filter(p -> p.getName().equals(name)).collect(Collectors.toList());
|
|
|
|
+ if (subCurveList != null && subCurveList.size() > 0 &&
|
|
|
|
+ subCurveList.get(0).getSubList() != null && subCurveList.get(0).getSubList().size() > 0) {
|
|
|
|
+ if (realtimeCurveList.get(i).getSubList() == null) {
|
|
|
|
+ realtimeCurveList.get(i).setSubList(new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
+ realtimeCurveList.get(i).getSubList().add(subCurveList.get(0).getSubList().get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 排序
|
|
|
|
+ curveSort(realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ Collections.copy(incrementRealtimeCurveList, realtimeCurveList);
|
|
|
|
+ }
|
|
|
|
+ // 重新缓存实时曲线
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_REALTIME_CURVE, realtimeCurveList);
|
|
|
|
+ // 返回增量信息
|
|
|
|
+ jsonObject.put("实时曲线", incrementRealtimeCurveList.toString());
|
|
|
|
+
|
|
|
|
+ // 全程曲线
|
|
|
|
+ List<CurveDTO> incrementWholeCurveList = getIncrementWholeCurveCache();
|
|
|
|
+ List<CurveDTO> wholeCurveList = null;
|
|
|
|
+ if (redisUtil.hasKey(GuanCommonConstant.GUAN_WHOLE_CURE)) {
|
|
|
|
+ wholeCurveList = (List<CurveDTO>) redisUtil.get(GuanCommonConstant.GUAN_WHOLE_CURE);
|
|
|
|
+ }
|
|
|
|
+ // 将获取的增加数据增加到全程曲线的列表中
|
|
|
|
+ if (wholeCurveList != null && wholeCurveList.size() > 0) {
|
|
|
|
+ for (int i = 0; i < wholeCurveList.size(); i++) {
|
|
|
|
+ String name = wholeCurveList.get(i).getName();
|
|
|
|
+ List<CurveDTO> subCurveList = incrementWholeCurveList.stream()
|
|
|
|
+ .filter(p -> p.getName().equals(name)).collect(Collectors.toList());
|
|
|
|
+ if (subCurveList != null && subCurveList.size() > 0 &&
|
|
|
|
+ subCurveList.get(0).getSubList() != null && subCurveList.get(0).getSubList().size() > 0) {
|
|
|
|
+ if (wholeCurveList.get(i).getSubList() == null) {
|
|
|
|
+ wholeCurveList.get(i).setSubList(new ArrayList<CurveSubDTO>());
|
|
|
|
+ }
|
|
|
|
+ wholeCurveList.get(i).getSubList().add(subCurveList.get(0).getSubList().get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 排序
|
|
|
|
+ curveSort(wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ Collections.copy(incrementWholeCurveList, wholeCurveList);
|
|
|
|
+ }
|
|
|
|
+ // 返回增量信息
|
|
|
|
+ redisUtil.set(GuanCommonConstant.GUAN_WHOLE_CURE, wholeCurveList);
|
|
|
|
+ jsonObject.put("全程曲线", incrementWholeCurveList.toString());
|
|
|
|
+
|
|
|
|
+ log.info(String.format(" 获取设备曲线信息(增量)! 结束时间 ↑↑↑↑↑↑↑↑↑↑:" + DateUtils.getTimestamp()));
|
|
|
|
+
|
|
|
|
+ return jsonObject.toString();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 前端页面首次加载,获取大屏展示数据
|
|
|
|
|
|
+ * 前端页面首次加载,获取大屏展示数据(只从缓存中获取)
|
|
* 只获取报警信息、预制曲线、全程曲线、实时曲线,其它信息不获取
|
|
* 只获取报警信息、预制曲线、全程曲线、实时曲线,其它信息不获取
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
@@ -1803,7 +2426,7 @@ public class WebAccessService {
|
|
}
|
|
}
|
|
// endregion
|
|
// endregion
|
|
|
|
|
|
- //region <<曲线排序>>
|
|
|
|
|
|
+ //region <<大屏-曲线排序>>
|
|
/**
|
|
/**
|
|
* 曲线排序
|
|
* 曲线排序
|
|
* @param curveList
|
|
* @param curveList
|