|
|
@@ -604,10 +604,10 @@ public class ProjectService {
|
|
|
} catch (Exception e) {
|
|
|
log.error("select tdengine devices error :{}", e.getMessage(), e);
|
|
|
}
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<DevicesAlarmLogVO> mapList = new ArrayList<>();
|
|
|
if (!CollectionUtils.isEmpty(selected)) {
|
|
|
for (int i = 0; i < selected.size(); i++) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+ DevicesAlarmLogVO map = new DevicesAlarmLogVO();
|
|
|
SlopeData currSlopeData = selected.get(i);
|
|
|
// String key = currSlopeData.getTs().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
@@ -630,8 +630,8 @@ public class ProjectService {
|
|
|
long t = (epochMilli - epochMilli1) / (60 * 60 * 1000);
|
|
|
long val = Long.parseLong(val1) - Long.parseLong(val2);
|
|
|
decimal = BigDecimal.valueOf(val).divide((new BigDecimal(t).multiply(new BigDecimal(t))), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
- map.put("dateTime", key);
|
|
|
- map.put("dateValue", decimal);
|
|
|
+ map.setDateTime(key);
|
|
|
+ map.setDataValue(decimal.toString());
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
}
|
|
|
@@ -717,11 +717,8 @@ public class ProjectService {
|
|
|
}
|
|
|
returnVO.setThreeLevelAlarm(thresholdLevelVO);
|
|
|
//时间统计轴(当前数据检测值)
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<DevicesAlarmLogVO> mapList = new ArrayList<>();
|
|
|
if (currentValue != null) {
|
|
|
- /**存在经纬度海拔值的需要公式计算*/
|
|
|
- List<String> itemList = new ArrayList<>();
|
|
|
- itemList.add(DictItemEnum.LONGITUDE_X.getValue());
|
|
|
// Date date = new Date();
|
|
|
for (int i = 0; i < dateList.size(); i++) {
|
|
|
String dateStart = DateUtil.getDateTimeToHour(dateList.get(i), 24);
|
|
|
@@ -734,8 +731,11 @@ public class ProjectService {
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(selected)) {
|
|
|
for (SlopeData message : selected) {
|
|
|
+ /**存在经纬度海拔值的需要公式计算*/
|
|
|
+ List<String> itemList = new ArrayList<>();
|
|
|
+ itemList.add(DictItemEnum.LONGITUDE_X.getValue());
|
|
|
BigDecimal offsetValue = new BigDecimal("0.00");
|
|
|
- Map<String, Object> datemap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ DevicesAlarmLogVO datemap = new DevicesAlarmLogVO();
|
|
|
Date createTime = message.getTs();
|
|
|
// String key = createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH");
|
|
|
@@ -744,8 +744,8 @@ public class ProjectService {
|
|
|
String val1 = message.getVal();
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
- SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), "2");
|
|
|
- double angleInRadians = Math.toRadians(selected == null ? 0L : Double.parseDouble(selectListByLine.getVal()));
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.LATITUDE_Y.getValue());
|
|
|
+ double angleInRadians = Math.toRadians(selectListByLine == null ? 0L : Double.parseDouble(selectListByLine.getVal()));
|
|
|
double cosValue = Math.cos(angleInRadians);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(val1)) {
|
|
|
double doubleValue = (new BigDecimal(val1).subtract(currentValue)).divide(new BigDecimal(360), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
@@ -753,11 +753,13 @@ public class ProjectService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ itemList.clear();
|
|
|
itemList.add(DictItemEnum.LATITUDE_Y.getValue());
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
- offsetValue = new BigDecimal(line).subtract(currentValue);
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.LATITUDE_Y.getValue());
|
|
|
+ offsetValue = selectListByLine == null ? new BigDecimal("0.00") : (new BigDecimal(selectListByLine.getVal()).subtract(currentValue));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -766,12 +768,13 @@ public class ProjectService {
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
- offsetValue = new BigDecimal(line).divide(new BigDecimal(1000), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.ALTITUDE_Z.getValue());
|
|
|
+ offsetValue = selectListByLine == null ? new BigDecimal("0.00") : new BigDecimal(selectListByLine.getVal()).divide(new BigDecimal(1000), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- datemap.put("dateTime", key);
|
|
|
- datemap.put("dataValue", offsetValue);
|
|
|
+ datemap.setDateTime(key);
|
|
|
+ datemap.setDataValue(offsetValue.toString());
|
|
|
mapList.add(datemap);
|
|
|
}
|
|
|
}
|
|
|
@@ -894,10 +897,10 @@ public class ProjectService {
|
|
|
} catch (Exception e) {
|
|
|
log.error("select tdengine devices error :{}", e.getMessage(), e);
|
|
|
}
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<DevicesAlarmLogVO> mapList = new ArrayList<>();
|
|
|
if (!CollectionUtils.isEmpty(selected)) {
|
|
|
for (int i = 0; i < selected.size(); i++) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+ DevicesAlarmLogVO map = new DevicesAlarmLogVO();
|
|
|
SlopeData currSlopeData = selected.get(i);
|
|
|
// String key = currSlopeData.getTs().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
@@ -911,8 +914,8 @@ public class ProjectService {
|
|
|
// long t = (epochMilli - epochMilli1) / (60 * 60 * 1000);
|
|
|
// long val = Long.parseLong(val1) - Long.parseLong(val2);
|
|
|
// decimal = BigDecimal.valueOf(val).divide((new BigDecimal(t).multiply(new BigDecimal(t))), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
- map.put("dataTime", key);
|
|
|
- map.put("dataValue", decimal);
|
|
|
+ map.setDateTime(key);
|
|
|
+ map.setDataValue(decimal.toString());
|
|
|
mapList.add(map);
|
|
|
} else {
|
|
|
SlopeData lastSlopeData = selected.get(i + 1);
|
|
|
@@ -934,8 +937,8 @@ public class ProjectService {
|
|
|
long val = Long.parseLong(val1) - Long.parseLong(val2);
|
|
|
decimal = BigDecimal.valueOf(val).divide((new BigDecimal(t).multiply(new BigDecimal(t))), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
// map.put(key, decimal);
|
|
|
- map.put("dataTime", key);
|
|
|
- map.put("dataValue", decimal);
|
|
|
+ map.setDataValue(decimal.toString());
|
|
|
+ map.setDateTime(key);
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
}
|
|
|
@@ -1029,7 +1032,7 @@ public class ProjectService {
|
|
|
// thresholdMap.put("threeLevelAlarm", map);
|
|
|
returnVO.setThreeLevelAlarm(thresholdLevelVO);
|
|
|
//时间统计轴(当前数据检测值)
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<DevicesAlarmLogVO> mapList = new ArrayList<>();
|
|
|
if (currentValue != null) {
|
|
|
/**存在经纬度海拔值的需要公式计算*/
|
|
|
List<String> itemList = new ArrayList<>();
|
|
|
@@ -1046,7 +1049,7 @@ public class ProjectService {
|
|
|
if (!CollectionUtils.isEmpty(selected)) {
|
|
|
for (SlopeData message : selected) {
|
|
|
BigDecimal offsetValue = new BigDecimal("0.00");
|
|
|
- Map<String, Object> datemap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ DevicesAlarmLogVO datemap = new DevicesAlarmLogVO();
|
|
|
Date createTime = message.getTs();
|
|
|
// String key = createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH");
|
|
|
@@ -1055,23 +1058,25 @@ public class ProjectService {
|
|
|
String val1 = message.getVal();
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
- SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), "2");
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.LATITUDE_Y.getValue());
|
|
|
double angleInRadians = Math.toRadians(selected == null ? 0L : (selectListByLine == null ? 0L : Double.parseDouble(selectListByLine.getVal())));
|
|
|
double cosValue = Math.cos(angleInRadians);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(val1)) {
|
|
|
BigDecimal subtract = new BigDecimal(val1).subtract(currentValue);
|
|
|
if (subtract.compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
- double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ double doubleValue = subtract.divide(new BigDecimal("360.00"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ itemList.clear();
|
|
|
itemList.add(DictItemEnum.LATITUDE_Y.getValue());
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.LATITUDE_Y.getValue());
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
- offsetValue = new BigDecimal(line).subtract(currentValue);
|
|
|
+ offsetValue = selectListByLine == null ? new BigDecimal("0.00") : new BigDecimal(selectListByLine.getVal()).subtract(currentValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1080,12 +1085,13 @@ public class ProjectService {
|
|
|
if (itemList.contains(partName)) {
|
|
|
if (Objects.nonNull(currentValue)) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
- offsetValue = new BigDecimal(line).divide(new BigDecimal(1000), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
+ SlopeData selectListByLine = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.ALTITUDE_Z.getValue());
|
|
|
+ offsetValue = selectListByLine == null ? new BigDecimal("0.00") : new BigDecimal(selectListByLine.getVal()).divide(new BigDecimal(1000), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- datemap.put("dateTime", key);
|
|
|
- datemap.put("dataValue", offsetValue);
|
|
|
+ datemap.setDateTime(key);
|
|
|
+ datemap.setDataValue(offsetValue.toString());
|
|
|
mapList.add(datemap);
|
|
|
}
|
|
|
}
|