|
|
@@ -38,7 +38,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -410,6 +409,7 @@ public class ProjectService {
|
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
|
String latitude = param.getLatitude();
|
|
|
String projectId = param.getProjectId();
|
|
|
+ String type = param.getType();
|
|
|
if (String.valueOf(NumberConstant.FOUR).equals(latitude)) {
|
|
|
String deviceId = param.getDeviceId();
|
|
|
String mountainId = headerData.getMountainId();
|
|
|
@@ -421,14 +421,25 @@ public class ProjectService {
|
|
|
if (kwsDevice == null) {
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
- //当前设备下的所有基本要素
|
|
|
List<Map<String, ProjectCatLogVO>> returnList = new ArrayList<>();
|
|
|
- basicItem(mountainId, projectId, deviceId, kwsDevice, returnList);
|
|
|
-
|
|
|
- //集成要素 折线图
|
|
|
- //集成要素-测量值计算
|
|
|
- integrationItem(headerData, deviceId, kwsDevice, returnList);
|
|
|
- LocalDateTime localDateTime = DateUtil.localDateToLocalDateTimeStart(LocalDate.now());
|
|
|
+ Map<String, SystemDict> dictByDictCode = new HashMap<>();
|
|
|
+ if (Objects.nonNull(type)) {
|
|
|
+ dictByDictCode = commonService.getDictByDictCode(DictEnum.MODEL_PART);
|
|
|
+ if (dictByDictCode.get(type) != null) {
|
|
|
+ //当前设备下的所有基本要素
|
|
|
+ basicItem(mountainId, projectId, deviceId, kwsDevice, returnList, type);
|
|
|
+ } else {
|
|
|
+ //集成要素 折线图
|
|
|
+ //集成要素-测量值计算
|
|
|
+ integrationItem(headerData, deviceId, kwsDevice, returnList, type);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //当前设备下的所有基本要素
|
|
|
+ basicItem(mountainId, projectId, deviceId, kwsDevice, returnList, type);
|
|
|
+ //集成要素 折线图
|
|
|
+ //集成要素-测量值计算
|
|
|
+ integrationItem(headerData, deviceId, kwsDevice, returnList, type);
|
|
|
+ }
|
|
|
return HttpResult.ok(returnList);
|
|
|
} else if (String.valueOf(NumberConstant.THREE).equals(latitude)) {
|
|
|
String deviceId = param.getDeviceId();
|
|
|
@@ -441,36 +452,159 @@ public class ProjectService {
|
|
|
if (kwsDevice == null) {
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
-// List<String> dateTimeDay = DateUtil.getDateTimeDay(LocalDateTime.now(), 7, new ArrayList<String>());
|
|
|
- List<Date> dateTimeDay = DateUtil.getDateTimeDayToDate(LocalDateTime.now(), 7, new ArrayList<Date>());
|
|
|
- for (Date dateTime : dateTimeDay) {
|
|
|
+ List<Map<String, ProjectCatLogVO>> returnList = new ArrayList<>();
|
|
|
+ Map<String, SystemDict> dictByDictCode = new HashMap<>();
|
|
|
+ if (Objects.nonNull(type)) {
|
|
|
+ dictByDictCode = commonService.getDictByDictCode(DictEnum.MODEL_PART);
|
|
|
+ if (dictByDictCode.get(type) != null) {
|
|
|
+ List<Date> dateTimeDay = DateUtil.getDateTimeDayToDate(LocalDateTime.now(), 7, new ArrayList<>());
|
|
|
+ //当前设备下的所有基本要素
|
|
|
+ basicItemByWeek(mountainId, projectId, deviceId, kwsDevice, returnList, dateTimeDay, type);
|
|
|
+ } else {
|
|
|
+ //集成要素-测量值计算
|
|
|
+ integrationItemWeek(headerData, deviceId, kwsDevice, returnList, type);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<Date> dateTimeDay = DateUtil.getDateTimeDayToDate(LocalDateTime.now(), 7, new ArrayList<>());
|
|
|
//当前设备下的所有基本要素
|
|
|
- List<ProjectCatLogVO> returnList = new ArrayList<>();
|
|
|
- basicItemByWeek(mountainId, projectId, deviceId, kwsDevice, returnList, dateTime);
|
|
|
+ basicItemByWeek(mountainId, projectId, deviceId, kwsDevice, returnList, dateTimeDay, type);
|
|
|
+ integrationItemWeek(headerData, deviceId, kwsDevice, returnList, type);
|
|
|
}
|
|
|
- /**下面是查询当天每小时数据总量的代码示例:
|
|
|
-
|
|
|
- SELECT DATE_FORMAT(timestamp, '%Y-%m-%d %H:00:00') AS hour,
|
|
|
- COUNT(*) AS count
|
|
|
- FROM data
|
|
|
- WHERE DATE(timestamp) = CURDATE()
|
|
|
- GROUP BY hour;*/
|
|
|
-
|
|
|
- /** 下面是查询当天每小时某个字段平均值的代码示例:
|
|
|
-
|
|
|
-
|
|
|
- SELECT DATE_FORMAT(timestamp, '%Y-%m-%d %H:00:00') AS hour,
|
|
|
- AVG(value) AS average
|
|
|
- FROM data
|
|
|
- WHERE DATE(timestamp) = CURDATE()
|
|
|
- GROUP BY hour;*/
|
|
|
-
|
|
|
+ return HttpResult.ok(returnList);
|
|
|
} else if (String.valueOf(NumberConstant.TWO).equals(latitude)) {
|
|
|
} else if (String.valueOf(NumberConstant.ONE).equals(latitude)) {
|
|
|
} else {
|
|
|
throw new BusinessException("数据传输异常");
|
|
|
}
|
|
|
- return null;
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void integrationItemWeek(HeaderData headerData, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList, String type) {
|
|
|
+ List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(new LambdaQueryWrapper<KwsDeviceIntegration>()
|
|
|
+ .eq(KwsDeviceIntegration::getMountainId, headerData.getMountainId())
|
|
|
+ .eq(KwsDeviceIntegration::getDeviceId, deviceId)
|
|
|
+ );
|
|
|
+ List<Long> longList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(deviceIntegrations)) {
|
|
|
+ longList = deviceIntegrations.stream().map(KwsDeviceIntegration::getIntegrationId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(longList)) {
|
|
|
+ List<KwsIntegration> kwsIntegrations = integrationMapper.selectList(new LambdaQueryWrapper<KwsIntegration>()
|
|
|
+ .in(KwsIntegration::getId, longList)
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(type),KwsIntegration::getIntegrationName,type));
|
|
|
+ if (!CollectionUtils.isEmpty(kwsIntegrations) && kwsIntegrations.size() > 0) {
|
|
|
+ kwsIntegrations.forEach(integration -> {
|
|
|
+ Map<String, ProjectCatLogVO> returnMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ ProjectCatLogVO projectCatLogVO = new ProjectCatLogVO();
|
|
|
+ String integrationName = integration.getIntegrationName();
|
|
|
+ String partNames = integration.getPartNames();
|
|
|
+ List<KwsDeviceReference> referenceList = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()
|
|
|
+ .eq(KwsDeviceReference::getMountainId, headerData.getMountainId())
|
|
|
+ .eq(KwsDeviceReference::getDeviceId, Long.parseLong(deviceId))
|
|
|
+ .eq(KwsDeviceReference::getItem, integrationName)
|
|
|
+ .eq(KwsDeviceReference::getDelFlag, 0)
|
|
|
+ .eq(KwsDeviceReference::getType, 2)
|
|
|
+ );
|
|
|
+ //当前基准值
|
|
|
+ projectCatLogVO.setReference(CollectionUtils.isEmpty(referenceList) ? null :
|
|
|
+ (referenceList.get(0).getCurrentValue() == null ? null : referenceList.get(0).getCurrentValue()));
|
|
|
+ //当前要素阈值
|
|
|
+ List<KwsThreshold> kwsThresholds = thresholdMapper.selectList(new LambdaQueryWrapper<KwsThreshold>()
|
|
|
+ .eq(KwsThreshold::getDelFlag, 0)
|
|
|
+ .eq(KwsThreshold::getItemName, integrationName)
|
|
|
+ .eq(KwsThreshold::getMountainId, headerData.getMountainId())
|
|
|
+ .eq(KwsThreshold::getDeviceId, deviceId)
|
|
|
+ );
|
|
|
+ Map<Integer, List<KwsThreshold>> listMap = new HashMap<>();
|
|
|
+ if (!CollectionUtils.isEmpty(kwsThresholds)) {
|
|
|
+ listMap = kwsThresholds.stream().collect(Collectors.groupingBy(KwsThreshold::getLevel));
|
|
|
+ }
|
|
|
+ //阈值等级map
|
|
|
+// Map<String, Map<String, String>> thresholdMap = new HashMap<>();
|
|
|
+// Map<String, String> map = new HashMap<>();
|
|
|
+ ThresholdLevelVO thresholdLevelVO = new ThresholdLevelVO();
|
|
|
+ String thresholdMax = "";
|
|
|
+ String thresholdMin = "";
|
|
|
+ if (listMap.get(1) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(1).get(0);
|
|
|
+ thresholdMax = kwsThreshold.getMax();
|
|
|
+ thresholdMin = kwsThreshold.getMin();
|
|
|
+ thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
+ thresholdLevelVO.setThresholdMin(thresholdMin);
|
|
|
+// map.put("thresholdMax", thresholdMax);
|
|
|
+// map.put("thresholdMin", thresholdMin);
|
|
|
+ }
|
|
|
+// thresholdMap.put("oneLevelAlarm", map);
|
|
|
+ projectCatLogVO.setOneLevelAlarm(thresholdLevelVO);
|
|
|
+ if (listMap.get(2) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(2).get(0);
|
|
|
+ thresholdMax = kwsThreshold.getMax();
|
|
|
+ thresholdMin = kwsThreshold.getMin();
|
|
|
+ thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
+ thresholdLevelVO.setThresholdMin(thresholdMin);
|
|
|
+// map.put("thresholdMax", thresholdMax);
|
|
|
+// map.put("thresholdMin", thresholdMin);
|
|
|
+ }
|
|
|
+// thresholdMap.put("twoLevelAlarm", map);
|
|
|
+ projectCatLogVO.setTwoLevelAlarm(thresholdLevelVO);
|
|
|
+
|
|
|
+ if (listMap.get(3) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(3).get(0);
|
|
|
+ thresholdMax = kwsThreshold.getMax();
|
|
|
+ thresholdMin = kwsThreshold.getMin();
|
|
|
+ thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
+ thresholdLevelVO.setThresholdMin(thresholdMin);
|
|
|
+// map.put("thresholdMax", thresholdMax);
|
|
|
+// map.put("thresholdMin", thresholdMin);
|
|
|
+ }
|
|
|
+// thresholdMap.put("threeLevelAlarm", map);
|
|
|
+ projectCatLogVO.setThreeLevelAlarm(thresholdLevelVO);
|
|
|
+
|
|
|
+ //当前测量值-TD获取
|
|
|
+ String formula = integration.getFormula();
|
|
|
+ List<String> stringList = StringUtils.splitStrToList(partNames, String.class);
|
|
|
+ if (!CollectionUtils.isEmpty(stringList)) {
|
|
|
+ for (String item : stringList) {
|
|
|
+ //当前仅有加速度
|
|
|
+ BigDecimal decimal = new BigDecimal("0.00");
|
|
|
+ Date date = new Date();
|
|
|
+ String dateStart = DateUtil.getDateTimeToHour(date, 24);
|
|
|
+ String dateEnd = DateUtil.localDateTimeFormat(LocalDateTime.now());
|
|
|
+ List<SlopeData> selected = slopeDataMapper.selectLineList(kwsDevice.getSnCode(), item, dateStart, dateEnd);
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(selected)) {
|
|
|
+ for (int i = 0; i < selected.size(); i++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ SlopeData currSlopeData = selected.get(i);
|
|
|
+ String key = currSlopeData.getTs().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
+ SlopeData lastSlopeData = selected.get(i + 1);
|
|
|
+ LocalDateTime localDateTime = currSlopeData.getTs();
|
|
|
+ long epochMilli1 = 0L;
|
|
|
+ String val2 = "0";
|
|
|
+ LocalDateTime localDateTime1 = lastSlopeData.getTs();
|
|
|
+ if (lastSlopeData != null) {
|
|
|
+ epochMilli1 = localDateTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
+ val2 = lastSlopeData.getVal();
|
|
|
+ }
|
|
|
+ long epochMilli = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
+ epochMilli1 = localDateTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
+ String val1 = currSlopeData.getVal();
|
|
|
+ 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))));
|
|
|
+ map.put(key, decimal);
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projectCatLogVO.setType(integrationName);
|
|
|
+ projectCatLogVO.setMonitor(mapList);
|
|
|
+ returnMap.put(integrationName, projectCatLogVO);
|
|
|
+ returnList.add(returnMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -481,14 +615,17 @@ public class ProjectService {
|
|
|
* @param deviceId 所属设备
|
|
|
* @param kwsDevice 设备信息
|
|
|
* @param returnList 返回数据
|
|
|
- * @param date 时间范围
|
|
|
+ * @param dateList 时间范围
|
|
|
*/
|
|
|
- private void basicItemByWeek(String mountainId, String projectId, String deviceId, KwsDevice kwsDevice, List<ProjectCatLogVO> returnList, Date date) {
|
|
|
- List<ProjectDeviceVO> projectDeviceList = projectMapper.selectDeviceByProjectId(mountainId, Long.parseLong(projectId), Long.parseLong(deviceId));
|
|
|
+ private void basicItemByWeek(String mountainId, String projectId, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList, List<Date> dateList, String type) {
|
|
|
+ List<ProjectDeviceVO> projectDeviceList = projectMapper.selectDeviceByProjectId(mountainId, Long.parseLong(projectId), Long.parseLong(deviceId), type);
|
|
|
if (!CollectionUtils.isEmpty(projectDeviceList)) {
|
|
|
for (ProjectDeviceVO projectDeviceVO : projectDeviceList) {
|
|
|
+ Map<String, ProjectCatLogVO> returnMap = new HashMap<>();
|
|
|
ProjectCatLogVO returnVO = new ProjectCatLogVO();
|
|
|
String partName = projectDeviceVO.getPartName();
|
|
|
+ Map<String, SystemDict> dictByDictCode = commonService.getDictByDictCode(DictEnum.MODEL_PART);
|
|
|
+ String itemName = dictByDictCode.get(partName) == null ? partName : dictByDictCode.get(partName).getLabel();
|
|
|
//设置过阈值的基本要素
|
|
|
List<KwsDeviceReference> references = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()
|
|
|
.eq(KwsDeviceReference::getDeviceId, deviceId)
|
|
|
@@ -516,25 +653,24 @@ public class ProjectService {
|
|
|
ThresholdLevelVO thresholdLevelVO = new ThresholdLevelVO();
|
|
|
String thresholdMax = "";
|
|
|
String thresholdMin = "";
|
|
|
- if (listMap.get("1") != null) {
|
|
|
- KwsThreshold kwsThreshold = listMap.get("1").get(0);
|
|
|
+ if (listMap.get(1) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(1).get(0);
|
|
|
thresholdMax = kwsThreshold.getMax();
|
|
|
thresholdMin = kwsThreshold.getMin();
|
|
|
thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
thresholdLevelVO.setThresholdMin(thresholdMin);
|
|
|
}
|
|
|
returnVO.setOneLevelAlarm(thresholdLevelVO);
|
|
|
- if (listMap.get("2") != null) {
|
|
|
- KwsThreshold kwsThreshold = listMap.get("2").get(0);
|
|
|
+ if (listMap.get(2) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(2).get(0);
|
|
|
thresholdMax = kwsThreshold.getMax();
|
|
|
thresholdMin = kwsThreshold.getMin();
|
|
|
thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
thresholdLevelVO.setThresholdMin(thresholdMin);
|
|
|
}
|
|
|
returnVO.setTwoLevelAlarm(thresholdLevelVO);
|
|
|
-
|
|
|
- if (listMap.get("3") != null) {
|
|
|
- KwsThreshold kwsThreshold = listMap.get("3").get(0);
|
|
|
+ if (listMap.get(3) != null) {
|
|
|
+ KwsThreshold kwsThreshold = listMap.get(3).get(0);
|
|
|
thresholdMax = kwsThreshold.getMax();
|
|
|
thresholdMin = kwsThreshold.getMin();
|
|
|
thresholdLevelVO.setThresholdMax(thresholdMax);
|
|
|
@@ -548,52 +684,56 @@ public class ProjectService {
|
|
|
List<String> itemList = new ArrayList<>();
|
|
|
itemList.add(DictItemEnum.LONGITUDE_X.getValue());
|
|
|
// Date date = new Date();
|
|
|
- String dateStart = DateUtil.getDateTimeToHour(date, 24);
|
|
|
- String dateEnd = DateUtil.localDateTimeFormat(LocalDateTime.now());
|
|
|
- List<SlopeData> selected = slopeDataMapper.selectLineList(kwsDevice.getSnCode(), partName, dateStart, dateEnd);
|
|
|
- if (!CollectionUtils.isEmpty(selected)) {
|
|
|
- for (SlopeData message : selected) {
|
|
|
- BigDecimal offsetValue = new BigDecimal("0.00");
|
|
|
- Map<String, Object> datemap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
- LocalDateTime createTime = message.getCreateTime();
|
|
|
- String key = createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
- String line = message.getLine();
|
|
|
- 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()));
|
|
|
- double cosValue = Math.cos(angleInRadians);
|
|
|
- if (org.apache.commons.lang3.StringUtils.isNotBlank(val1)) {
|
|
|
- double doubleValue = (new BigDecimal(val1).subtract(currentValue)).divide(new BigDecimal(360)).doubleValue();
|
|
|
- offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
|
+ for (int i = 0; i < dateList.size(); i++) {
|
|
|
+ String dateStart = DateUtil.getDateTimeToHour(dateList.get(i), 24);
|
|
|
+ String dateEnd = DateUtil.localDateTimeFormat(LocalDateTime.now());
|
|
|
+ List<SlopeData> selected = slopeDataMapper.selectLineList(kwsDevice.getSnCode(), partName, dateStart, dateEnd);
|
|
|
+ if (!CollectionUtils.isEmpty(selected)) {
|
|
|
+ for (SlopeData message : selected) {
|
|
|
+ BigDecimal offsetValue = new BigDecimal("0.00");
|
|
|
+ Map<String, Object> datemap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ LocalDateTime createTime = message.getCreateTime();
|
|
|
+ String key = createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH"));
|
|
|
+ String line = message.getLine();
|
|
|
+ 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()));
|
|
|
+ double cosValue = Math.cos(angleInRadians);
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(val1)) {
|
|
|
+ double doubleValue = (new BigDecimal(val1).subtract(currentValue)).divide(new BigDecimal(360)).doubleValue();
|
|
|
+ offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- 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);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- itemList.clear();
|
|
|
- itemList.add(DictItemEnum.ALTITUDE_Z.getValue());
|
|
|
- if (itemList.contains(partName)) {
|
|
|
- if (Objects.nonNull(currentValue)) {
|
|
|
- if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
- offsetValue = new BigDecimal(line).divide(new BigDecimal(1000));
|
|
|
+ itemList.clear();
|
|
|
+ itemList.add(DictItemEnum.ALTITUDE_Z.getValue());
|
|
|
+ if (itemList.contains(partName)) {
|
|
|
+ if (Objects.nonNull(currentValue)) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(line)) {
|
|
|
+ offsetValue = new BigDecimal(line).divide(new BigDecimal(1000));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ datemap.put(key, offsetValue);
|
|
|
+ mapList.add(datemap);
|
|
|
}
|
|
|
- datemap.put(key, offsetValue);
|
|
|
- mapList.add(datemap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ returnVO.setType(partName);
|
|
|
returnVO.setMonitor(mapList);
|
|
|
- returnList.add(returnVO);
|
|
|
+ returnMap.put(itemName, returnVO);
|
|
|
+ returnList.add(returnMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -601,7 +741,7 @@ public class ProjectService {
|
|
|
/**
|
|
|
* 集成要素折线图计算
|
|
|
*/
|
|
|
- private void integrationItem(HeaderData headerData, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList) {
|
|
|
+ private void integrationItem(HeaderData headerData, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList, String type) {
|
|
|
List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(new LambdaQueryWrapper<KwsDeviceIntegration>()
|
|
|
.eq(KwsDeviceIntegration::getMountainId, headerData.getMountainId())
|
|
|
.eq(KwsDeviceIntegration::getDeviceId, deviceId)
|
|
|
@@ -611,7 +751,9 @@ public class ProjectService {
|
|
|
longList = deviceIntegrations.stream().map(KwsDeviceIntegration::getIntegrationId).collect(Collectors.toList());
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(longList)) {
|
|
|
- List<KwsIntegration> kwsIntegrations = integrationMapper.selectList(new LambdaQueryWrapper<KwsIntegration>().in(KwsIntegration::getId, longList));
|
|
|
+ List<KwsIntegration> kwsIntegrations = integrationMapper.selectList(new LambdaQueryWrapper<KwsIntegration>()
|
|
|
+ .in(KwsIntegration::getId, longList)
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(type),KwsIntegration::getIntegrationName,type));
|
|
|
if (!CollectionUtils.isEmpty(kwsIntegrations) && kwsIntegrations.size() > 0) {
|
|
|
kwsIntegrations.forEach(integration -> {
|
|
|
Map<String, ProjectCatLogVO> returnMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
@@ -716,6 +858,7 @@ public class ProjectService {
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
}
|
|
|
+ projectCatLogVO.setType(integrationName);
|
|
|
projectCatLogVO.setMonitor(mapList);
|
|
|
returnMap.put(integrationName, projectCatLogVO);
|
|
|
returnList.add(returnMap);
|
|
|
@@ -729,8 +872,8 @@ public class ProjectService {
|
|
|
/**
|
|
|
* 折线图 基本要素
|
|
|
*/
|
|
|
- private void basicItem(String mountainId, String projectId, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList) {
|
|
|
- List<ProjectDeviceVO> projectDeviceList = projectMapper.selectDeviceByProjectId(mountainId, Long.parseLong(projectId), Long.parseLong(deviceId));
|
|
|
+ private void basicItem(String mountainId, String projectId, String deviceId, KwsDevice kwsDevice, List<Map<String, ProjectCatLogVO>> returnList, String type) {
|
|
|
+ List<ProjectDeviceVO> projectDeviceList = projectMapper.selectDeviceByProjectId(mountainId, Long.parseLong(projectId), Long.parseLong(deviceId), type);
|
|
|
if (!CollectionUtils.isEmpty(projectDeviceList)) {
|
|
|
for (ProjectDeviceVO projectDeviceVO : projectDeviceList) {
|
|
|
Map<String, ProjectCatLogVO> returnMap = new HashMap<>();
|
|
|
@@ -854,6 +997,7 @@ public class ProjectService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ returnVO.setType(partName);
|
|
|
returnVO.setMonitor(mapList);
|
|
|
returnMap.put(itemName, returnVO);
|
|
|
returnList.add(returnMap);
|