|
@@ -1,6 +1,7 @@
|
|
package com.sckj.iron.service.impl;
|
|
package com.sckj.iron.service.impl;
|
|
|
|
|
|
import com.sckj.common.exception.OperateException;
|
|
import com.sckj.common.exception.OperateException;
|
|
|
|
+import com.sckj.common.util.TimeUtils;
|
|
import com.sckj.iron.dto.IronTrendL1DTO;
|
|
import com.sckj.iron.dto.IronTrendL1DTO;
|
|
import com.sckj.iron.dto.IronTrendL2DTO;
|
|
import com.sckj.iron.dto.IronTrendL2DTO;
|
|
import com.sckj.iron.dto.RealtimeData;
|
|
import com.sckj.iron.dto.RealtimeData;
|
|
@@ -10,6 +11,7 @@ import com.sckj.l2.service.impl.TL2DataServiceImpl;
|
|
import com.sckj.opc.entity.OPCData;
|
|
import com.sckj.opc.entity.OPCData;
|
|
import com.sckj.opc.service.OPCDataServiceImpl;
|
|
import com.sckj.opc.service.OPCDataServiceImpl;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -30,6 +32,9 @@ public class TIronVisualScreenServiceImpl {
|
|
TL2DataServiceImpl tl2DataService;
|
|
TL2DataServiceImpl tl2DataService;
|
|
|
|
|
|
|
|
|
|
|
|
+ private static final SimpleDateFormat sdfMinute = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:00");
|
|
|
|
+
|
|
|
|
+
|
|
/***
|
|
/***
|
|
* 实时数据图图例
|
|
* 实时数据图图例
|
|
* @param result
|
|
* @param result
|
|
@@ -37,48 +42,6 @@ public class TIronVisualScreenServiceImpl {
|
|
*/
|
|
*/
|
|
public Map<String, Object> getIronLegend(Map<String, Object> result) {
|
|
public Map<String, Object> getIronLegend(Map<String, Object> result) {
|
|
java.util.Date startTime = new java.util.Date();
|
|
java.util.Date startTime = new java.util.Date();
|
|
- // 查询区间前的最近一条历史数据(前置值)
|
|
|
|
- // OPC类
|
|
|
|
-// OPCData preTemp = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1_IRONNOTCH_MIR_TEMP")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .le(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
-// OPCData preSpeed1 = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1_IRONNOTCH_RAILLINE_ACPIRON_SPEED1")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .le(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
-// OPCData preSpeed2 = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1_IRONNOTCH_RAILLINE_ACPIRON_SPEED2")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .le(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
-// OPCData preWeight1 = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1TH_1_MIR_NWT")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .le(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
-// OPCData preWeight2 = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1TH_2_MIR_NWT")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .le(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
-
|
|
|
|
- // tappingMap补齐每一分钟,前面无数据用前置值补齐
|
|
|
|
- // 先查区间前最近一条tapping
|
|
|
|
-// Integer preTappingVal = 0;
|
|
|
|
-// OPCData preTapping = opcDataService.lambdaQuery()
|
|
|
|
-// .eq(OPCData::getPointName, "BF4_1_IRONNOTCH_TAPPING")
|
|
|
|
-// .isNotNull(OPCData::getData)
|
|
|
|
-// .lt(OPCData::getServerTime, startTime)
|
|
|
|
-// .orderByDesc(OPCData::getServerTime)
|
|
|
|
-// .last("limit 1").one();
|
|
|
|
|
|
|
|
// L2类
|
|
// L2类
|
|
TL2Data preL2 = tl2DataService.lambdaQuery()
|
|
TL2Data preL2 = tl2DataService.lambdaQuery()
|
|
@@ -86,15 +49,67 @@ public class TIronVisualScreenServiceImpl {
|
|
.orderByDesc(TL2Data::getIronStarttime)
|
|
.orderByDesc(TL2Data::getIronStarttime)
|
|
.last("limit 1").one();
|
|
.last("limit 1").one();
|
|
|
|
|
|
-// result.put("ironTemp", preTemp.getData());
|
|
|
|
-// result.put("ironSpeed", Double.parseDouble(preSpeed1.getData().toString()) + Double.parseDouble(preSpeed2.getData().toString()));
|
|
|
|
result.put("elementS", RealtimeData.builder().desc("铁水成分-硫").value(preL2.getElementS()).build());
|
|
result.put("elementS", RealtimeData.builder().desc("铁水成分-硫").value(preL2.getElementS()).build());
|
|
result.put("elementSi", RealtimeData.builder().desc("铁水成分-硅").value(preL2.getElementSi()).build());
|
|
result.put("elementSi", RealtimeData.builder().desc("铁水成分-硅").value(preL2.getElementSi()).build());
|
|
- result.put("mudWeight", RealtimeData.builder().desc("泥炮量").value(preL2.getMudWeight()).unit("L").build());
|
|
|
|
- result.put("pollMm",RealtimeData.builder().desc("钻杆直径").value(preL2.getPollMm()).unit("mm").build());
|
|
|
|
|
|
+ result.put("mudWeight", RealtimeData.builder().desc("泥炮量").value(preL2.getMudWeight()).unit("L").build());
|
|
|
|
+ result.put("pollMm", RealtimeData.builder().desc("钻杆直径").value(preL2.getPollMm()).unit("mm").build());
|
|
result.put("openDepth", RealtimeData.builder().desc("开口深度").value(preL2.getOpenDepth()).unit("mm").build());
|
|
result.put("openDepth", RealtimeData.builder().desc("开口深度").value(preL2.getOpenDepth()).unit("mm").build());
|
|
-// result.put("ironCosttime", preL2.getIronCosttime());
|
|
|
|
-// result.put("ironWeight", Double.parseDouble(preWeight1.getData().toString()) + Double.parseDouble(preWeight2.getData().toString()));
|
|
|
|
|
|
+
|
|
|
|
+ // 1. 计算起止时间
|
|
|
|
+ int hours = 24;
|
|
|
|
+ //给固定时间,24小时之内
|
|
|
|
+ java.util.Date endTime = new java.util.Date();
|
|
|
|
+ java.util.Calendar cal = java.util.Calendar.getInstance();
|
|
|
|
+ cal.setTime(endTime);
|
|
|
|
+ cal.add(java.util.Calendar.HOUR_OF_DAY, -hours);
|
|
|
|
+ startTime = cal.getTime();
|
|
|
|
+ List<OPCData> list = opcDataService.lambdaQuery()
|
|
|
|
+ .in(OPCData::getPointName, Arrays.asList(
|
|
|
|
+ "BF4_1TH_2_TPC_CARNO", // 1TH-2号车混铁车车号
|
|
|
|
+ "BF4_1TH_1_TPC_CARNO" // 1TH-1号车混铁车车号
|
|
|
|
+ ))
|
|
|
|
+ .between(OPCData::getServerTime, startTime, endTime)
|
|
|
|
+ .orderByAsc(OPCData::getServerTime)
|
|
|
|
+ .list();
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
+ RealtimeData ironWeight = (RealtimeData) result.getOrDefault("ironWeight", RealtimeData.builder().desc("铁水流量").unit("t").value(0).build());
|
|
|
|
+ List<Map<String, Object>> collect = list.stream().map(item -> {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("data", item.getData());
|
|
|
|
+ map.put("createTime", sdfMinute.format(item.getSourceTime()));
|
|
|
|
+ return map;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Map<String, Object> extraMap = new HashMap<>();
|
|
|
|
+ extraMap.put("mark", collect);
|
|
|
|
+ ironWeight.setExtra(extraMap);
|
|
|
|
+
|
|
|
|
+ result.put("ironWeight", ironWeight);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<TL2Data> list1 = tl2DataService.lambdaQuery()
|
|
|
|
+ .between(TL2Data::getIronStarttime,
|
|
|
|
+ new SimpleDateFormat("yyyyMMddHHmmss").format(startTime),
|
|
|
|
+ new SimpleDateFormat("yyyyMMddHHmmss").format(endTime))
|
|
|
|
+ .orderByAsc(TL2Data::getIronStarttime)
|
|
|
|
+ .list();
|
|
|
|
+
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list1)) {
|
|
|
|
+ RealtimeData ironCosttime = (RealtimeData) result.getOrDefault("ironCosttime", RealtimeData.builder().desc("出铁时间").unit("min").value(0).build());
|
|
|
|
+ List<Map<String, Object>> collect = list1.stream().map(item -> {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("data", String.format("第%s次出铁(%s号铁口)%s分钟",item.getIronNo(),item.getTapholeId(),item.getIronCosttime()));
|
|
|
|
+ map.put("createTime", TimeUtils.formatPartialDateString(item.getIronStarttime()));
|
|
|
|
+ return map;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Map<String, Object> extraMap = new HashMap<>();
|
|
|
|
+ extraMap.put("mark", collect);
|
|
|
|
+ ironCosttime.setExtra(extraMap);
|
|
|
|
+
|
|
|
|
+ result.put("ironCosttime", ironCosttime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -255,12 +270,11 @@ public class TIronVisualScreenServiceImpl {
|
|
List<IronTrendL2DTO> elemenList = elemenListFuture.get();
|
|
List<IronTrendL2DTO> elemenList = elemenListFuture.get();
|
|
|
|
|
|
// 1. 生成完整的每一分钟时间点
|
|
// 1. 生成完整的每一分钟时间点
|
|
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:00");
|
|
|
|
java.util.List<String> xAxis = new java.util.ArrayList<>();
|
|
java.util.List<String> xAxis = new java.util.ArrayList<>();
|
|
java.util.Calendar cursor = java.util.Calendar.getInstance();
|
|
java.util.Calendar cursor = java.util.Calendar.getInstance();
|
|
cursor.setTime(startTime);
|
|
cursor.setTime(startTime);
|
|
while (!cursor.getTime().after(endTime)) {
|
|
while (!cursor.getTime().after(endTime)) {
|
|
- xAxis.add(sdf.format(cursor.getTime()));
|
|
|
|
|
|
+ xAxis.add(sdfMinute.format(cursor.getTime()));
|
|
cursor.add(java.util.Calendar.MINUTE, 1);
|
|
cursor.add(java.util.Calendar.MINUTE, 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -315,14 +329,13 @@ public class TIronVisualScreenServiceImpl {
|
|
|
|
|
|
// 2. 构建每分钟补全的二维数组
|
|
// 2. 构建每分钟补全的二维数组
|
|
java.util.Map<String, Object> result = new java.util.LinkedHashMap<>();
|
|
java.util.Map<String, Object> result = new java.util.LinkedHashMap<>();
|
|
-// result.put("ironTemp", buildMinuteArray(tempList, xAxis, preTemp != null ? preTemp.getData() : null));
|
|
|
|
-// result.put("ironSpeed", buildMinuteArrayForSpeed(xAxis, speed1List, speed2List, preSpeed1 != null ? preSpeed1.getData() : null, preSpeed2 != null ? preSpeed2.getData() : null));
|
|
|
|
-// result.put("elementS", buildMinuteArray(elemenList, xAxis, "elementS", preL2 != null ? preL2.getElementS() : null));
|
|
|
|
-// result.put("elementSi", buildMinuteArray(elemenList, xAxis, "elementSi", preL2 != null ? preL2.getElementSi() : null));
|
|
|
|
-// result.put("mudWeight", buildMinuteArray(elemenList, xAxis, "mudWeight", preL2 != null ? preL2.getMudWeight() : null));
|
|
|
|
-// result.put("pollMm", buildMinuteArray(elemenList, xAxis, "pollMm", preL2 != null ? preL2.getPollMm() : null));
|
|
|
|
-// result.put("openDepth", buildMinuteArray(elemenList, xAxis, "openDepth", preL2 != null ? preL2.getOpenDepth() : null));
|
|
|
|
-// result.put("ironCosttime", buildMinuteArray(elemenList, xAxis, "ironCosttime", preL2 != null ? preL2.getIronCosttime() : null));
|
|
|
|
|
|
+ result.put("ironTemp", buildMinuteArray(tempList, xAxis, preTemp != null ? preTemp.getData() : null));
|
|
|
|
+ result.put("elementS", buildMinuteArray(elemenList, xAxis, "elementS", preL2 != null ? preL2.getElementS() : null));
|
|
|
|
+ result.put("elementSi", buildMinuteArray(elemenList, xAxis, "elementSi", preL2 != null ? preL2.getElementSi() : null));
|
|
|
|
+ result.put("mudWeight", buildMinuteArray(elemenList, xAxis, "mudWeight", preL2 != null ? preL2.getMudWeight() : null));
|
|
|
|
+ result.put("pollMm", buildMinuteArray(elemenList, xAxis, "pollMm", preL2 != null ? preL2.getPollMm() : null));
|
|
|
|
+ result.put("openDepth", buildMinuteArray(elemenList, xAxis, "openDepth", preL2 != null ? preL2.getOpenDepth() : null));
|
|
|
|
+
|
|
|
|
|
|
// 统计出铁累计重量递增曲线
|
|
// 统计出铁累计重量递增曲线
|
|
if (preTapping != null && preTapping.getData() != null) {
|
|
if (preTapping != null && preTapping.getData() != null) {
|
|
@@ -344,7 +357,7 @@ public class TIronVisualScreenServiceImpl {
|
|
Map<String, Integer> rawTappingMap = new LinkedHashMap<>();
|
|
Map<String, Integer> rawTappingMap = new LinkedHashMap<>();
|
|
for (OPCData item : tappingList) {
|
|
for (OPCData item : tappingList) {
|
|
if (item.getServerTime() != null && item.getData() != null) {
|
|
if (item.getServerTime() != null && item.getData() != null) {
|
|
- String min = sdf.format(item.getServerTime());
|
|
|
|
|
|
+ String min = sdfMinute.format(item.getServerTime());
|
|
Integer val = null;
|
|
Integer val = null;
|
|
Object v = item.getData();
|
|
Object v = item.getData();
|
|
if (v instanceof Number) val = ((Number) v).intValue();
|
|
if (v instanceof Number) val = ((Number) v).intValue();
|
|
@@ -366,53 +379,56 @@ public class TIronVisualScreenServiceImpl {
|
|
tappingMap.put(t, v);
|
|
tappingMap.put(t, v);
|
|
if (v != null) last = v;
|
|
if (v != null) last = v;
|
|
}
|
|
}
|
|
- // weight1Map/weight2Map
|
|
|
|
- Map<String, Double> weight1Map = new LinkedHashMap<>();
|
|
|
|
- Map<String, Double> weight2Map = new LinkedHashMap<>();
|
|
|
|
- for (IronTrendL1DTO e : weight1List) {
|
|
|
|
- if (e.getCreateTime() != null) {
|
|
|
|
- String min = sdf.format(e.getCreateTime());
|
|
|
|
- Object v = e.getData();
|
|
|
|
- Double value = null;
|
|
|
|
- if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
|
|
- else if (v instanceof String) {
|
|
|
|
- String str = ((String) v).trim();
|
|
|
|
- if (!str.isEmpty()) {
|
|
|
|
- try {
|
|
|
|
- value = Double.parseDouble(str);
|
|
|
|
- } catch (Exception ignore) {
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (value != null) weight1Map.put(min, value);
|
|
|
|
|
|
+ int ironWeightScale = 2; // 可调整为0、1、2等
|
|
|
|
+ List<List<Object>> ironFlowArr = buildIronFlowMinuteArray(xAxis, tappingMap, weight1List, weight2List, ironWeightScale);
|
|
|
|
+ result.put("ironWeight", ironFlowArr);
|
|
|
|
+
|
|
|
|
+ // 处理铁水流速,出铁中按原逻辑,出铁结束后为0
|
|
|
|
+ List<List<Object>> ironSpeedArr = buildMinuteArrayForSpeed(xAxis, speed1List, speed2List, preSpeed1 != null ? preSpeed1.getData() : null, preSpeed2 != null ? preSpeed2.getData() : null);
|
|
|
|
+ for (int i = 0; i < xAxis.size(); i++) {
|
|
|
|
+ String t = xAxis.get(i);
|
|
|
|
+ Integer tapping = tappingMap.getOrDefault(t, 0);
|
|
|
|
+ if (tapping == 0 && ironSpeedArr.get(i).size() > 1) {
|
|
|
|
+ ironSpeedArr.get(i).set(1, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (IronTrendL1DTO e : weight2List) {
|
|
|
|
- if (e.getCreateTime() != null) {
|
|
|
|
- String min = sdf.format(e.getCreateTime());
|
|
|
|
- Object v = e.getData();
|
|
|
|
- Double value = null;
|
|
|
|
- if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
|
|
- else if (v instanceof String) {
|
|
|
|
- String str = ((String) v).trim();
|
|
|
|
- if (!str.isEmpty()) {
|
|
|
|
- try {
|
|
|
|
- value = Double.parseDouble(str);
|
|
|
|
- } catch (Exception ignore) {
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (value != null) weight2Map.put(min, value);
|
|
|
|
|
|
+ result.put("ironSpeed", ironSpeedArr);
|
|
|
|
+
|
|
|
|
+// List<List<Object>> ironCosttime = buildMinuteArray(elemenList, xAxis, "ironCosttime", preL2 != null ? preL2.getIronCosttime() : null);
|
|
|
|
+// for (int i = 0; i < xAxis.size(); i++) {
|
|
|
|
+// String t = xAxis.get(i);
|
|
|
|
+// Integer tapping = tappingMap.getOrDefault(t, 0);
|
|
|
|
+// if (tapping == 0 && ironCosttime.get(i).size() > 1) {
|
|
|
|
+// ironCosttime.get(i).set(1, 0);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// result.put("ironCosttime", ironCosttime);
|
|
|
|
+
|
|
|
|
+ // 处理L2类数据,tapping=0时设为0
|
|
|
|
+ List<List<Object>> elementSArr = buildMinuteArray(elemenList, xAxis, "elementS", preL2 != null ? preL2.getElementS() : null);
|
|
|
|
+ List<List<Object>> elementSiArr = buildMinuteArray(elemenList, xAxis, "elementSi", preL2 != null ? preL2.getElementSi() : null);
|
|
|
|
+ List<List<Object>> mudWeightArr = buildMinuteArray(elemenList, xAxis, "mudWeight", preL2 != null ? preL2.getMudWeight() : null);
|
|
|
|
+ List<List<Object>> pollMmArr = buildMinuteArray(elemenList, xAxis, "pollMm", preL2 != null ? preL2.getPollMm() : null);
|
|
|
|
+ List<List<Object>> openDepthArr = buildMinuteArray(elemenList, xAxis, "openDepth", preL2 != null ? preL2.getOpenDepth() : null);
|
|
|
|
+ List<List<Object>> ironCosttimeArr = buildMinuteArray(elemenList, xAxis, "ironCosttime", preL2 != null ? preL2.getIronCosttime() : null);
|
|
|
|
+ for (int i = 0; i < xAxis.size(); i++) {
|
|
|
|
+ String t = xAxis.get(i);
|
|
|
|
+ Integer tapping = tappingMap.getOrDefault(t, 0);
|
|
|
|
+ if (tapping == 0) {
|
|
|
|
+ if (elementSArr.get(i).size() > 1) elementSArr.get(i).set(1, 0);
|
|
|
|
+ if (elementSiArr.get(i).size() > 1) elementSiArr.get(i).set(1, 0);
|
|
|
|
+ if (mudWeightArr.get(i).size() > 1) mudWeightArr.get(i).set(1, 0);
|
|
|
|
+ if (pollMmArr.get(i).size() > 1) pollMmArr.get(i).set(1, 0);
|
|
|
|
+ if (openDepthArr.get(i).size() > 1) openDepthArr.get(i).set(1, 0);
|
|
|
|
+ if (ironCosttimeArr.get(i).size() > 1) ironCosttimeArr.get(i).set(1, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // 计算铁水流量总和
|
|
|
|
-// double totalIronFlow = calculateTotalIronFlow(xAxis, weight1Map, weight2Map);
|
|
|
|
-// result.put("铁水流量", totalIronFlow);
|
|
|
|
-
|
|
|
|
- // 铁水流量分钟累计显示,分别处理weight1Map和weight2Map,不合并为totalWeightMap
|
|
|
|
- int ironWeightScale = 2; // 可调整为0、1、2等
|
|
|
|
- List<List<Object>> ironFlowArr = buildIronFlowMinuteArrayV3(xAxis, tappingMap, weight1Map, weight2Map, ironWeightScale);
|
|
|
|
- result.put("ironWeight", ironFlowArr);
|
|
|
|
|
|
+ result.put("elementS", elementSArr);
|
|
|
|
+ result.put("elementSi", elementSiArr);
|
|
|
|
+ result.put("mudWeight", mudWeightArr);
|
|
|
|
+ result.put("pollMm", pollMmArr);
|
|
|
|
+ result.put("openDepth", openDepthArr);
|
|
|
|
+ result.put("ironCosttime", ironCosttimeArr);
|
|
|
|
|
|
return result;
|
|
return result;
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
@@ -430,13 +446,13 @@ public class TIronVisualScreenServiceImpl {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// 新增工具方法:L1类型
|
|
// 新增工具方法:L1类型
|
|
private java.util.List<java.util.List<Object>> buildMinuteArray(java.util.List<IronTrendL1DTO> list, java.util.List<String> xAxis, Object preValue) {
|
|
private java.util.List<java.util.List<Object>> buildMinuteArray(java.util.List<IronTrendL1DTO> list, java.util.List<String> xAxis, Object preValue) {
|
|
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:00");
|
|
|
|
java.util.Map<String, Object> timeValueMap = new java.util.LinkedHashMap<>();
|
|
java.util.Map<String, Object> timeValueMap = new java.util.LinkedHashMap<>();
|
|
for (IronTrendL1DTO e : list) {
|
|
for (IronTrendL1DTO e : list) {
|
|
if (e.getCreateTime() != null) {
|
|
if (e.getCreateTime() != null) {
|
|
- String min = sdf.format(e.getCreateTime());
|
|
|
|
|
|
+ String min = sdfMinute.format(e.getCreateTime());
|
|
timeValueMap.put(min, e.getData());
|
|
timeValueMap.put(min, e.getData());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -450,14 +466,14 @@ public class TIronVisualScreenServiceImpl {
|
|
return arr;
|
|
return arr;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// 合并铁水流速专用
|
|
// 合并铁水流速专用
|
|
private java.util.List<java.util.List<Object>> buildMinuteArrayForSpeed(java.util.List<String> xAxis, java.util.List<IronTrendL1DTO> speed1List, java.util.List<IronTrendL1DTO> speed2List, Object pre1, Object pre2) {
|
|
private java.util.List<java.util.List<Object>> buildMinuteArrayForSpeed(java.util.List<String> xAxis, java.util.List<IronTrendL1DTO> speed1List, java.util.List<IronTrendL1DTO> speed2List, Object pre1, Object pre2) {
|
|
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:00");
|
|
|
|
java.util.Map<String, Double> speed1Map = new java.util.LinkedHashMap<>();
|
|
java.util.Map<String, Double> speed1Map = new java.util.LinkedHashMap<>();
|
|
java.util.Map<String, Double> speed2Map = new java.util.LinkedHashMap<>();
|
|
java.util.Map<String, Double> speed2Map = new java.util.LinkedHashMap<>();
|
|
for (IronTrendL1DTO e : speed1List) {
|
|
for (IronTrendL1DTO e : speed1List) {
|
|
if (e.getCreateTime() != null) {
|
|
if (e.getCreateTime() != null) {
|
|
- String min = sdf.format(e.getCreateTime());
|
|
|
|
|
|
+ String min = sdfMinute.format(e.getCreateTime());
|
|
Object v = e.getData();
|
|
Object v = e.getData();
|
|
Double value = null;
|
|
Double value = null;
|
|
if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
@@ -472,7 +488,7 @@ public class TIronVisualScreenServiceImpl {
|
|
}
|
|
}
|
|
for (IronTrendL1DTO e : speed2List) {
|
|
for (IronTrendL1DTO e : speed2List) {
|
|
if (e.getCreateTime() != null) {
|
|
if (e.getCreateTime() != null) {
|
|
- String min = sdf.format(e.getCreateTime());
|
|
|
|
|
|
+ String min = sdfMinute.format(e.getCreateTime());
|
|
Object v = e.getData();
|
|
Object v = e.getData();
|
|
Double value = null;
|
|
Double value = null;
|
|
if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
@@ -526,6 +542,8 @@ public class TIronVisualScreenServiceImpl {
|
|
arr.add(java.util.Arrays.asList(t, sum));
|
|
arr.add(java.util.Arrays.asList(t, sum));
|
|
if (sum != null) last = sum;
|
|
if (sum != null) last = sum;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
return arr;
|
|
return arr;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -571,7 +589,46 @@ public class TIronVisualScreenServiceImpl {
|
|
|
|
|
|
|
|
|
|
// 新增:铁水流量分钟累计显示方法V3,分别处理weight1Map和weight2Map
|
|
// 新增:铁水流量分钟累计显示方法V3,分别处理weight1Map和weight2Map
|
|
- private List<List<Object>> buildIronFlowMinuteArrayV3(List<String> xAxis, Map<String, Integer> tappingMap, Map<String, Double> weight1Map, Map<String, Double> weight2Map, int scale) {
|
|
|
|
|
|
+ private List<List<Object>> buildIronFlowMinuteArray(List<String> xAxis, Map<String, Integer> tappingMap, List<IronTrendL1DTO> weight1List, List<IronTrendL1DTO> weight2List, int scale) {
|
|
|
|
+ // 先转为map,key为分钟字符串
|
|
|
|
+ Map<String, Double> weight1Map = new LinkedHashMap<>();
|
|
|
|
+ for (IronTrendL1DTO e : weight1List) {
|
|
|
|
+ if (e.getCreateTime() != null) {
|
|
|
|
+ String min = sdfMinute.format(e.getCreateTime());
|
|
|
|
+ Object v = e.getData();
|
|
|
|
+ Double value = null;
|
|
|
|
+ if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
|
|
+ else if (v instanceof String) {
|
|
|
|
+ String str = ((String) v).trim();
|
|
|
|
+ if (!str.isEmpty()) {
|
|
|
|
+ try {
|
|
|
|
+ value = Double.parseDouble(str);
|
|
|
|
+ } catch (Exception ignore) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (value != null) weight1Map.put(min, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String, Double> weight2Map = new LinkedHashMap<>();
|
|
|
|
+ for (IronTrendL1DTO e : weight2List) {
|
|
|
|
+ if (e.getCreateTime() != null) {
|
|
|
|
+ String min = sdfMinute.format(e.getCreateTime());
|
|
|
|
+ Object v = e.getData();
|
|
|
|
+ Double value = null;
|
|
|
|
+ if (v instanceof Number) value = ((Number) v).doubleValue();
|
|
|
|
+ else if (v instanceof String) {
|
|
|
|
+ String str = ((String) v).trim();
|
|
|
|
+ if (!str.isEmpty()) {
|
|
|
|
+ try {
|
|
|
|
+ value = Double.parseDouble(str);
|
|
|
|
+ } catch (Exception ignore) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (value != null) weight2Map.put(min, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
List<List<Object>> arr = new ArrayList<>();
|
|
List<List<Object>> arr = new ArrayList<>();
|
|
double accWeight = 0;
|
|
double accWeight = 0;
|
|
// 1号车状态
|
|
// 1号车状态
|
|
@@ -586,60 +643,64 @@ public class TIronVisualScreenServiceImpl {
|
|
double w1 = weight1Map.getOrDefault(t, 0d);
|
|
double w1 = weight1Map.getOrDefault(t, 0d);
|
|
double w2 = weight2Map.getOrDefault(t, 0d);
|
|
double w2 = weight2Map.getOrDefault(t, 0d);
|
|
|
|
|
|
- // 1号车逻辑
|
|
|
|
- if (w1 > 0) {
|
|
|
|
- if (!inCycle1) {
|
|
|
|
- inCycle1 = true;
|
|
|
|
- max1 = w1;
|
|
|
|
- } else {
|
|
|
|
- if (w1 > max1) max1 = w1;
|
|
|
|
|
|
+ if (tapping == 1) {
|
|
|
|
+ // 1号车逻辑
|
|
|
|
+ if (w1 > 0) {
|
|
|
|
+ if (!inCycle1) {
|
|
|
|
+ inCycle1 = true;
|
|
|
|
+ max1 = w1;
|
|
|
|
+ } else {
|
|
|
|
+ if (w1 > max1) max1 = w1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 2号车逻辑
|
|
|
|
- if (w2 > 0) {
|
|
|
|
- if (!inCycle2) {
|
|
|
|
- inCycle2 = true;
|
|
|
|
- max2 = w2;
|
|
|
|
- } else {
|
|
|
|
- if (w2 > max2) max2 = w2;
|
|
|
|
|
|
+ // 2号车逻辑
|
|
|
|
+ if (w2 > 0) {
|
|
|
|
+ if (!inCycle2) {
|
|
|
|
+ inCycle2 = true;
|
|
|
|
+ max2 = w2;
|
|
|
|
+ } else {
|
|
|
|
+ if (w2 > max2) max2 = w2;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- // 检查1号车归零
|
|
|
|
- boolean add1 = false;
|
|
|
|
- if (inCycle1 && w1 == 0 && last1 > 0) {
|
|
|
|
- add1 = true;
|
|
|
|
- inCycle1 = false;
|
|
|
|
- }
|
|
|
|
- // 检查2号车归零
|
|
|
|
- boolean add2 = false;
|
|
|
|
- if (inCycle2 && w2 == 0 && last2 > 0) {
|
|
|
|
- add2 = true;
|
|
|
|
- inCycle2 = false;
|
|
|
|
- }
|
|
|
|
|
|
+ // 检查1号车归零
|
|
|
|
+ boolean add1 = false;
|
|
|
|
+ if (inCycle1 && w1 == 0 && last1 > 0) {
|
|
|
|
+ add1 = true;
|
|
|
|
+ inCycle1 = false;
|
|
|
|
+ }
|
|
|
|
+ // 检查2号车归零
|
|
|
|
+ boolean add2 = false;
|
|
|
|
+ if (inCycle2 && w2 == 0 && last2 > 0) {
|
|
|
|
+ add2 = true;
|
|
|
|
+ inCycle2 = false;
|
|
|
|
+ }
|
|
|
|
|
|
- // 归零时把最大值加到累计值
|
|
|
|
- if (add1 && max1 > 0) {
|
|
|
|
- accWeight += max1;
|
|
|
|
- max1 = 0;
|
|
|
|
- }
|
|
|
|
- if (add2 && max2 > 0) {
|
|
|
|
- accWeight += max2;
|
|
|
|
- max2 = 0;
|
|
|
|
- }
|
|
|
|
|
|
+ // 归零时把最大值加到累计值
|
|
|
|
+ if (add1 && max1 > 0) {
|
|
|
|
+ accWeight += max1;
|
|
|
|
+ max1 = 0;
|
|
|
|
+ }
|
|
|
|
+ if (add2 && max2 > 0) {
|
|
|
|
+ accWeight += max2;
|
|
|
|
+ max2 = 0;
|
|
|
|
+ }
|
|
|
|
|
|
- // tapping=1时,显示accWeight+max(max1,max2);tapping=0时,显示0
|
|
|
|
- double value;
|
|
|
|
- if (tapping == 1) {
|
|
|
|
- double curMax = Math.max(max1, max2);
|
|
|
|
- value = accWeight + curMax;
|
|
|
|
|
|
+ // tapping=1时,显示accWeight+max(max1,max2)
|
|
|
|
+ double value = accWeight + Math.max(max1, max2);
|
|
|
|
+ double factor = Math.pow(10, scale);
|
|
|
|
+ value = Math.round(value * factor) / factor;
|
|
|
|
+ arr.add(Arrays.asList(t, value));
|
|
} else {
|
|
} else {
|
|
- value = 0;
|
|
|
|
|
|
+ // tapping=0时,重置所有累计和周期最大值
|
|
|
|
+ accWeight = 0;
|
|
|
|
+ max1 = 0;
|
|
|
|
+ max2 = 0;
|
|
|
|
+ inCycle1 = false;
|
|
|
|
+ inCycle2 = false;
|
|
|
|
+ double value = 0;
|
|
|
|
+ arr.add(Arrays.asList(t, value));
|
|
}
|
|
}
|
|
- // 按scale参数四舍五入
|
|
|
|
- double factor = Math.pow(10, scale);
|
|
|
|
- value = Math.round(value * factor) / factor;
|
|
|
|
- arr.add(Arrays.asList(t, value));
|
|
|
|
last1 = w1;
|
|
last1 = w1;
|
|
last2 = w2;
|
|
last2 = w2;
|
|
}
|
|
}
|