|
|
|
@ -8,17 +8,21 @@ import com.mh.common.core.domain.dto.OverviewEnergyDTO; |
|
|
|
import com.mh.common.core.domain.dto.ProProfileDTO; |
|
|
|
import com.mh.common.core.domain.dto.ProProfileDTO; |
|
|
|
import com.mh.common.core.domain.entity.CollectionParamsManage; |
|
|
|
import com.mh.common.core.domain.entity.CollectionParamsManage; |
|
|
|
import com.mh.common.core.domain.entity.SysDictData; |
|
|
|
import com.mh.common.core.domain.entity.SysDictData; |
|
|
|
|
|
|
|
import com.mh.common.core.domain.vo.CollectionParamsManageDataVO; |
|
|
|
import com.mh.common.core.redis.RedisCache; |
|
|
|
import com.mh.common.core.redis.RedisCache; |
|
|
|
import com.mh.common.utils.DateUtils; |
|
|
|
import com.mh.common.utils.DateUtils; |
|
|
|
import com.mh.system.mapper.SysDictDataMapper; |
|
|
|
import com.mh.system.mapper.SysDictDataMapper; |
|
|
|
import com.mh.system.mapper.device.CollectionParamsManageMapper; |
|
|
|
import com.mh.system.mapper.device.CollectionParamsManageMapper; |
|
|
|
import com.mh.system.mapper.energy.OverviewMapper; |
|
|
|
import com.mh.system.mapper.energy.OverviewMapper; |
|
|
|
import com.mh.system.service.overview.IProOverviewService; |
|
|
|
import com.mh.system.service.overview.IProOverviewService; |
|
|
|
|
|
|
|
import lombok.Getter; |
|
|
|
|
|
|
|
import lombok.Setter; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
@ -50,6 +54,384 @@ public class ProOverviewServiceImpl implements IProOverviewService { |
|
|
|
this.overviewMapper = overviewMapper; |
|
|
|
this.overviewMapper = overviewMapper; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public List<?> ersDatas(String systemType) {
|
|
|
|
|
|
|
|
// // 从collection_params_manage、device_ledger中查询数据,获取device_ledger.device_name,order_num,system_type,device_type
|
|
|
|
|
|
|
|
// // collection_params_manage的other_name,param_type,cur_value,cur_time,grade
|
|
|
|
|
|
|
|
// List<Map<String, Object>> list = collectionParamsManageMapper.selectErsDatas(systemType);
|
|
|
|
|
|
|
|
// if (list.isEmpty()) {
|
|
|
|
|
|
|
|
// return List.of();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // list里面的map再增加一个status,status=0正常,status=1异常
|
|
|
|
|
|
|
|
// // 开始组装数据
|
|
|
|
|
|
|
|
// // 出水温度:
|
|
|
|
|
|
|
|
// // 离心机高温出水温度(device_type=6,order_num=1,param_type=12,other_name like '%出水温度%')的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 中温换热出水温度(device_type=6,order_num=2,param_type=12,other_name like '%出水温度%')的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 低温1换热出水温度(device_type=6,order_num=3,param_type=12,other_name like '%出水温度%')的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 低温2换热出水温度(device_type=6,order_num=4,param_type=12,other_name like '%出水温度%')的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 热量数据:
|
|
|
|
|
|
|
|
// // 生产累积热量(device_type=6,order_num=1,2,3,4,param_type=47,grade=40,other_name like '%累积热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// // 散热累积热量(device_type=6,order_num=5,6,param_type=47,grade=40,other_name like '%累积热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// // 总热量回收(device_type=6,order_num=1,2,3,4,5,6,param_type=47,grade=40,other_name like '%累积热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// // 热利用率(生产累积热量*100/总热量回收)
|
|
|
|
|
|
|
|
// // 系统数据:
|
|
|
|
|
|
|
|
// // 离心机入口温度(device_type=14,order_num=4,param_type=31)的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 离心机出水温度(device_type=6,order_num=1,param_type=12,other_name like '%出水温度%')的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 保障进水温度(device_type=14,order_num=3,param_type=31)的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 阀门开度:
|
|
|
|
|
|
|
|
// // 二通阀阀门开度(device_type=26,order_num=1,param_type=4)的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 三通阀阀门开度(device_type=27,order_num=1,param_type=4)的cur_value值,如果cur_time不是当天,status标识异常,
|
|
|
|
|
|
|
|
// // 热回收数据:
|
|
|
|
|
|
|
|
// // 瞬时热量(device_type=6,order_num=1,2,3,4,5,6,param_type=47,grade=140,other_name like '%瞬时热量%')的cur_value合值,,
|
|
|
|
|
|
|
|
// // 日累积热量,先默认0,
|
|
|
|
|
|
|
|
// // 累积热量(device_type=6,order_num=1,2,3,4,5,6,param_type=47,grade=40,other_name like '%累积热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// // 应用侧数据:
|
|
|
|
|
|
|
|
// // 瞬时热量(device_type=6,order_num=1,2,3,4,param_type=47,grade=140,other_name like '%瞬时热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// // 日累计热量,先默认0,
|
|
|
|
|
|
|
|
// // 累积热量(device_type=6,order_num=1,2,3,4,param_type=47,grade=40,other_name like '%累积热量%')的cur_value合值,
|
|
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<?> ersDatas(String systemType) { |
|
|
|
|
|
|
|
// 从collection_params_manage、device_ledger中查询数据,获取device_ledger.device_name,order_num,system_type,device_type
|
|
|
|
|
|
|
|
// collection_params_manage的other_name,param_type,cur_value,cur_time,grade
|
|
|
|
|
|
|
|
List<Map<String, Object>> list = collectionParamsManageMapper.selectErsDatas(systemType); |
|
|
|
|
|
|
|
if (list.isEmpty()) { |
|
|
|
|
|
|
|
return List.of(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 为每个map添加status字段,初始为0(正常)
|
|
|
|
|
|
|
|
list.forEach(map -> { |
|
|
|
|
|
|
|
Date curTime = (Date) map.get("cur_time"); |
|
|
|
|
|
|
|
// 判断cur_time是否为今天
|
|
|
|
|
|
|
|
boolean isToday = DateUtils.isToday(curTime); |
|
|
|
|
|
|
|
map.put("status", isToday ? 0 : 1); // 0正常,1异常
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将数据转换为CollectionParamsManage对象列表,便于处理
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> convertedList = convertToCollectionParamsManageDataVO(list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装出水温度数据
|
|
|
|
|
|
|
|
List<Map<String, Object>> outWaterTempData = getOutWaterTemperatureData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装热量数据
|
|
|
|
|
|
|
|
Map<String, Object> heatData = getHeatData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装系统数据
|
|
|
|
|
|
|
|
List<Map<String, Object>> systemData = getSystemData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装阀门开度数据
|
|
|
|
|
|
|
|
List<Map<String, Object>> valveData = getValveData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装热回收数据
|
|
|
|
|
|
|
|
Map<String, Object> heatRecoveryData = getHeatRecoveryData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装应用侧数据
|
|
|
|
|
|
|
|
Map<String, Object> applicationData = getApplicationData(convertedList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构建最终返回结果
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("outWaterTemperature", outWaterTempData); |
|
|
|
|
|
|
|
result.put("heatData", heatData); |
|
|
|
|
|
|
|
result.put("systemData", systemData); |
|
|
|
|
|
|
|
result.put("valveData", valveData); |
|
|
|
|
|
|
|
result.put("heatRecoveryData", heatRecoveryData); |
|
|
|
|
|
|
|
result.put("applicationData", applicationData); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return List.of(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<CollectionParamsManageDataVO> convertToCollectionParamsManageDataVO(List<Map<String, Object>> list) { |
|
|
|
|
|
|
|
return list.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::new) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取出水温度数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<Map<String, Object>> getOutWaterTemperatureData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
return list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"12".equals(item.getParamType()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("出水温度")) |
|
|
|
|
|
|
|
.filter(item -> item.getOrderNum() != null && item.getOrderNum() <= 4) // 离心机高温出水温度(order_num=1), 中温换热出水温度(order_num=2), 低温1换热出水温度(order_num=3), 低温2换热出水温度(order_num=4)
|
|
|
|
|
|
|
|
.map(item -> { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("deviceName", item.getDeviceName()); |
|
|
|
|
|
|
|
result.put("orderNum", item.getOrderNum()); |
|
|
|
|
|
|
|
result.put("paramType", item.getParamType()); |
|
|
|
|
|
|
|
result.put("otherName", item.getOtherName()); |
|
|
|
|
|
|
|
result.put("curValue", item.getCurValue()); |
|
|
|
|
|
|
|
result.put("curTime", item.getCurTime()); |
|
|
|
|
|
|
|
result.put("status", item.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据order_num确定设备类型名称
|
|
|
|
|
|
|
|
String deviceTypeName = switch (item.getOrderNum()) { |
|
|
|
|
|
|
|
case 1 -> "离心机高温出水温度"; |
|
|
|
|
|
|
|
case 2 -> "中温换热出水温度"; |
|
|
|
|
|
|
|
case 3 -> "低温1换热出水温度"; |
|
|
|
|
|
|
|
case 4 -> "低温2换热出水温度"; |
|
|
|
|
|
|
|
default -> "出水温度"; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
result.put("deviceTypeName", deviceTypeName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取热量数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Map<String, Object> getHeatData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生产累积热量 (order_num=1,2,3,4)
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> productionHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(40).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("累积热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 4) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal productionHeatSum = productionHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 散热累积热量 (order_num=5,6)
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> dissipationHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(40).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("累积热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
(item.getOrderNum() == 5 || item.getOrderNum() == 6)) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal dissipationHeatSum = dissipationHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 总热量回收 (order_num=1,2,3,4,5,6)
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> totalHeatRecovery = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(40).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("累积热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 6) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal totalHeatRecoverySum = totalHeatRecovery.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 热利用率
|
|
|
|
|
|
|
|
BigDecimal heatUtilization = BigDecimal.ZERO; |
|
|
|
|
|
|
|
if (totalHeatRecoverySum.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
|
|
heatUtilization = productionHeatSum.multiply(new BigDecimal("100")) |
|
|
|
|
|
|
|
.divide(totalHeatRecoverySum, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.put("productionHeatSum", productionHeatSum); |
|
|
|
|
|
|
|
result.put("dissipationHeatSum", dissipationHeatSum); |
|
|
|
|
|
|
|
result.put("totalHeatRecoverySum", totalHeatRecoverySum); |
|
|
|
|
|
|
|
result.put("heatUtilization", heatUtilization); |
|
|
|
|
|
|
|
// result.put("productionHeatDetails", productionHeat);
|
|
|
|
|
|
|
|
// result.put("dissipationHeatDetails", dissipationHeat);
|
|
|
|
|
|
|
|
// result.put("totalHeatRecoveryDetails", totalHeatRecovery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取系统数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<Map<String, Object>> getSystemData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
return list.stream() |
|
|
|
|
|
|
|
.filter(item -> |
|
|
|
|
|
|
|
// 离心机入口温度 (device_type=14, order_num=4, param_type=31)
|
|
|
|
|
|
|
|
("14".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"31".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(4).equals(item.getOrderNum())) || |
|
|
|
|
|
|
|
// 离心机出水温度 (device_type=6, order_num=1, param_type=12, other_name like '%出水温度%')
|
|
|
|
|
|
|
|
("6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"12".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(1).equals(item.getOrderNum()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("出水温度")) || |
|
|
|
|
|
|
|
// 保障进水温度 (device_type=14, order_num=3, param_type=31)
|
|
|
|
|
|
|
|
("14".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"31".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(3).equals(item.getOrderNum())) || |
|
|
|
|
|
|
|
// 离心机进水压力 (device_type=13, order_num=4, param_type=13)
|
|
|
|
|
|
|
|
("13".equals(item.getDeviceType()) && "13".equals(item.getParamType()) && Integer.valueOf(4).equals(item.getOrderNum())) || |
|
|
|
|
|
|
|
// 离心机出水压力 (device_type=13, order_num=5, param_type=13)
|
|
|
|
|
|
|
|
("13".equals(item.getDeviceType()) && "13".equals(item.getParamType()) && Integer.valueOf(5).equals(item.getOrderNum())) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.map(item -> { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("deviceName", item.getDeviceName()); |
|
|
|
|
|
|
|
result.put("orderNum", item.getOrderNum()); |
|
|
|
|
|
|
|
result.put("paramType", item.getParamType()); |
|
|
|
|
|
|
|
result.put("otherName", item.getOtherName()); |
|
|
|
|
|
|
|
result.put("curValue", item.getCurValue()); |
|
|
|
|
|
|
|
result.put("curTime", item.getCurTime()); |
|
|
|
|
|
|
|
result.put("status", item.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据条件确定设备类型名称
|
|
|
|
|
|
|
|
String deviceTypeName = ""; |
|
|
|
|
|
|
|
if ("14".equals(item.getDeviceType()) && "31".equals(item.getParamType()) && Integer.valueOf(4).equals(item.getOrderNum())) { |
|
|
|
|
|
|
|
deviceTypeName = "离心机入口温度"; |
|
|
|
|
|
|
|
} else if ("6".equals(item.getDeviceType()) && "12".equals(item.getParamType()) && Integer.valueOf(1).equals(item.getOrderNum())) { |
|
|
|
|
|
|
|
deviceTypeName = "离心机出水温度"; |
|
|
|
|
|
|
|
} else if ("14".equals(item.getDeviceType()) && "31".equals(item.getParamType()) && Integer.valueOf(3).equals(item.getOrderNum())) { |
|
|
|
|
|
|
|
deviceTypeName = "保障进水温度"; |
|
|
|
|
|
|
|
} else if ("13".equals(item.getDeviceType()) && "13".equals(item.getParamType()) && Integer.valueOf(4).equals(item.getOrderNum())) { |
|
|
|
|
|
|
|
deviceTypeName = "离心机进水压力"; |
|
|
|
|
|
|
|
} else if ("13".equals(item.getDeviceType()) && "13".equals(item.getParamType()) && Integer.valueOf(5).equals(item.getOrderNum())) { |
|
|
|
|
|
|
|
deviceTypeName = "离心机出水压力"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
result.put("deviceTypeName", deviceTypeName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取阀门开度数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<Map<String, Object>> getValveData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
return list.stream() |
|
|
|
|
|
|
|
.filter(item -> |
|
|
|
|
|
|
|
// 二通阀阀门开度 (device_type=26, order_num=1, param_type=4)
|
|
|
|
|
|
|
|
("26".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"4".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(1).equals(item.getOrderNum())) || |
|
|
|
|
|
|
|
// 三通阀阀门开度 (device_type=27, order_num=1, param_type=4)
|
|
|
|
|
|
|
|
("27".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"4".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(1).equals(item.getOrderNum())) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.map(item -> { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("deviceName", item.getDeviceName()); |
|
|
|
|
|
|
|
result.put("orderNum", item.getOrderNum()); |
|
|
|
|
|
|
|
result.put("paramType", item.getParamType()); |
|
|
|
|
|
|
|
result.put("otherName", item.getOtherName()); |
|
|
|
|
|
|
|
result.put("curValue", item.getCurValue()); |
|
|
|
|
|
|
|
result.put("curTime", item.getCurTime()); |
|
|
|
|
|
|
|
result.put("status", item.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据条件确定设备类型名称
|
|
|
|
|
|
|
|
String deviceTypeName = "26".equals(item.getDeviceType()) ? "二通阀阀门开度" : "三通阀阀门开度"; |
|
|
|
|
|
|
|
result.put("deviceTypeName", deviceTypeName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取热回收数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Map<String, Object> getHeatRecoveryData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 瞬时热量 (device_type=6, order_num=1,2,3,4,5,6, param_type=47, grade=140, other_name like '%瞬时热量%')
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> instantaneousHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(140).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("瞬时热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 6) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal instantaneousHeatSum = instantaneousHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 累积热量 (device_type=6, order_num=1,2,3,4,5,6, param_type=47, grade=40, other_name like '%累积热量%')
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> accumulatedHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(40).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("累积热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 6) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal accumulatedHeatSum = accumulatedHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.put("instantaneousHeatSum", instantaneousHeatSum); |
|
|
|
|
|
|
|
result.put("accumulatedHeatSum", accumulatedHeatSum); |
|
|
|
|
|
|
|
result.put("dailyAccumulatedHeat", BigDecimal.ZERO); // 日累积热量,先默认0
|
|
|
|
|
|
|
|
// result.put("instantaneousHeatDetails", instantaneousHeat);
|
|
|
|
|
|
|
|
// result.put("accumulatedHeatDetails", accumulatedHeat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取应用侧数据 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Map<String, Object> getApplicationData(List<CollectionParamsManageDataVO> list) { |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 瞬时热量 (device_type=6, order_num=1,2,3,4, param_type=47, grade=140, other_name like '%瞬时热量%')
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> instantaneousHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(140).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("瞬时热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 4) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal instantaneousHeatSum = instantaneousHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 累积热量 (device_type=6, order_num=1,2,3,4, param_type=47, grade=40, other_name like '%累积热量%')
|
|
|
|
|
|
|
|
List<CollectionParamsManageDataVO> accumulatedHeat = list.stream() |
|
|
|
|
|
|
|
.filter(item -> "6".equals(item.getDeviceType()) && |
|
|
|
|
|
|
|
"47".equals(item.getParamType()) && |
|
|
|
|
|
|
|
Integer.valueOf(40).equals(item.getGrade()) && |
|
|
|
|
|
|
|
item.getOtherName() != null && |
|
|
|
|
|
|
|
item.getOtherName().contains("累积热量") && |
|
|
|
|
|
|
|
item.getOrderNum() != null && |
|
|
|
|
|
|
|
item.getOrderNum() >= 1 && item.getOrderNum() <= 4) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal accumulatedHeatSum = accumulatedHeat.stream() |
|
|
|
|
|
|
|
.map(CollectionParamsManageDataVO::getCurValue) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.put("instantaneousHeatSum", instantaneousHeatSum); |
|
|
|
|
|
|
|
result.put("accumulatedHeatSum", accumulatedHeatSum); |
|
|
|
|
|
|
|
result.put("dailyAccumulatedHeat", BigDecimal.ZERO); // 日累计热量,先默认0
|
|
|
|
|
|
|
|
// result.put("instantaneousHeatDetails", instantaneousHeat);
|
|
|
|
|
|
|
|
// result.put("accumulatedHeatDetails", accumulatedHeat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<DeviceMonitorDTO> mainParams() { |
|
|
|
public List<DeviceMonitorDTO> mainParams() { |
|
|
|
// 查询系统类型数据
|
|
|
|
// 查询系统类型数据
|
|
|
|
@ -396,7 +778,7 @@ public class ProOverviewServiceImpl implements IProOverviewService { |
|
|
|
public List<ProProfileDTO> getProProfile() { |
|
|
|
public List<ProProfileDTO> getProProfile() { |
|
|
|
// 增加缓存处理
|
|
|
|
// 增加缓存处理
|
|
|
|
if (redisCache.hasKey(CacheConstants.PRO_PROFILE)) { |
|
|
|
if (redisCache.hasKey(CacheConstants.PRO_PROFILE)) { |
|
|
|
List<ProProfileDTO> resultList = redisCache.getCacheList(CacheConstants.PRO_PROFILE, ProProfileDTO.class); |
|
|
|
List<ProProfileDTO> resultList = redisCache.getCacheList(CacheConstants.PRO_PROFILE, ProProfileDTO.class); |
|
|
|
if (resultList != null && !resultList.isEmpty()) { |
|
|
|
if (resultList != null && !resultList.isEmpty()) { |
|
|
|
return resultList; |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -510,7 +892,7 @@ public class ProOverviewServiceImpl implements IProOverviewService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HashMap<String, BigDecimal> getTotalData(String paramType, |
|
|
|
private HashMap<String, BigDecimal> getTotalData(String paramType, |
|
|
|
QueryWrapper<CollectionParamsManage> queryWrapper, LocalDateTime startTime, LocalDateTime endTime) { |
|
|
|
QueryWrapper<CollectionParamsManage> queryWrapper, LocalDateTime startTime, LocalDateTime endTime) { |
|
|
|
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageMapper.selectList(queryWrapper); |
|
|
|
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageMapper.selectList(queryWrapper); |
|
|
|
HashMap<String, BigDecimal> result = new HashMap<>(); |
|
|
|
HashMap<String, BigDecimal> result = new HashMap<>(); |
|
|
|
// 遍历计算得出总用电量
|
|
|
|
// 遍历计算得出总用电量
|
|
|
|
|