|
|
@ -7,6 +7,7 @@ import com.mh.user.entity.*; |
|
|
|
import com.mh.user.mapper.*; |
|
|
|
import com.mh.user.mapper.*; |
|
|
|
import com.mh.user.service.DataResultService; |
|
|
|
import com.mh.user.service.DataResultService; |
|
|
|
import com.mh.user.service.DeviceInstallService; |
|
|
|
import com.mh.user.service.DeviceInstallService; |
|
|
|
|
|
|
|
import com.mh.user.service.MeterManageService; |
|
|
|
import com.mh.user.utils.DateUtil; |
|
|
|
import com.mh.user.utils.DateUtil; |
|
|
|
import com.mh.user.utils.ExchangeStringUtil; |
|
|
|
import com.mh.user.utils.ExchangeStringUtil; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -61,6 +62,9 @@ public class DataResultServiceImpl implements DataResultService { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
MeterManageMapper meterManageMapper; |
|
|
|
MeterManageMapper meterManageMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
MeterManageService meterManageService; |
|
|
|
|
|
|
|
|
|
|
|
private final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
private final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -247,16 +251,27 @@ public class DataResultServiceImpl implements DataResultService { |
|
|
|
if (projectId != null && !projectId.isEmpty()) { |
|
|
|
if (projectId != null && !projectId.isEmpty()) { |
|
|
|
String startDate = ""; |
|
|
|
String startDate = ""; |
|
|
|
curDate = curDate.substring(0, 16) + ":00"; |
|
|
|
curDate = curDate.substring(0, 16) + ":00"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断项目是否为冷量计项目
|
|
|
|
|
|
|
|
int isHotCollection = meterManageService.queryIsHotCollection("", projectId); |
|
|
|
|
|
|
|
String momentCoolingStr = Constant.MOMENT_COOLING; |
|
|
|
|
|
|
|
String outTempStr = Constant.OUT_TEMP; |
|
|
|
|
|
|
|
String intTempStr = Constant.INT_TEMP; |
|
|
|
|
|
|
|
if (isHotCollection == 2) { |
|
|
|
|
|
|
|
momentCoolingStr = Constant.MOMENT_HOT; |
|
|
|
|
|
|
|
outTempStr = Constant.TEMP; |
|
|
|
|
|
|
|
intTempStr = Constant.PRE; |
|
|
|
|
|
|
|
} |
|
|
|
// 查询温度低的冷量计
|
|
|
|
// 查询温度低的冷量计
|
|
|
|
String registerAddr = meterManageMapper.selectRegisterAddr(projectId, Constant.INT_TEMP); |
|
|
|
String registerAddr = meterManageMapper.selectRegisterAddr(projectId, intTempStr); |
|
|
|
if (dateType.equals("1小时")) { |
|
|
|
if (dateType.equals("1小时")) { |
|
|
|
startDate = ExchangeStringUtil.dateRoll(1, curDate); |
|
|
|
startDate = ExchangeStringUtil.dateRoll(1, curDate); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, Constant.MOMENT_COOLING, registerAddr); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, momentCoolingStr, registerAddr); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
} else if (dateType.equals("2小时")) { |
|
|
|
} else if (dateType.equals("2小时")) { |
|
|
|
startDate = ExchangeStringUtil.dateRoll(2, curDate); |
|
|
|
startDate = ExchangeStringUtil.dateRoll(2, curDate); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, Constant.MOMENT_COOLING, registerAddr); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, momentCoolingStr, registerAddr); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
} else if (dateType.equals("8小时") || dateType.equals("12小时") || dateType.equals("24小时")) { |
|
|
|
} else if (dateType.equals("8小时") || dateType.equals("12小时") || dateType.equals("24小时")) { |
|
|
@ -269,12 +284,13 @@ public class DataResultServiceImpl implements DataResultService { |
|
|
|
startDate = ExchangeStringUtil.dateRoll(24, curDate); |
|
|
|
startDate = ExchangeStringUtil.dateRoll(24, curDate); |
|
|
|
queryType = 2; |
|
|
|
queryType = 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询瞬时冷量
|
|
|
|
// 查询瞬时冷量
|
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, Constant.MOMENT_COOLING, null); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, momentCoolingStr, null); |
|
|
|
// 查询进水温度值(及冷冻水出水温度)
|
|
|
|
// 查询进水温度值(及冷冻水出水温度)
|
|
|
|
List<DataResultChEntity> intTempRecords = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, Constant.OUT_TEMP, registerAddr); |
|
|
|
List<DataResultChEntity> intTempRecords = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, outTempStr, registerAddr); |
|
|
|
// 查询出水温度值(及冷冻水进水温度)
|
|
|
|
// 查询出水温度值(及冷冻水进水温度)
|
|
|
|
List<DataResultChEntity> outTempRecords = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, Constant.INT_TEMP, registerAddr); |
|
|
|
List<DataResultChEntity> outTempRecords = queryDataResultMi(projectId, startDate, curDate, page, limit, queryType, intTempStr, registerAddr); |
|
|
|
// 拼接数据
|
|
|
|
// 拼接数据
|
|
|
|
// 将数据按时间分组
|
|
|
|
// 将数据按时间分组
|
|
|
|
Map<String, DataResultChEntity> momentCoolingMap = records.stream() |
|
|
|
Map<String, DataResultChEntity> momentCoolingMap = records.stream() |
|
|
@ -328,9 +344,9 @@ public class DataResultServiceImpl implements DataResultService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
int count = 0; |
|
|
|
int count = 0; |
|
|
|
if (dateType.equals("24小时")) { |
|
|
|
if (dateType.equals("24小时")) { |
|
|
|
count = dataResultFifteenMiCount(projectId, startDate, curDate, Constant.MOMENT_COOLING, registerAddr); |
|
|
|
count = dataResultFifteenMiCount(projectId, startDate, curDate, momentCoolingStr, registerAddr); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
count = dataResultFiveMiCount(projectId, startDate, curDate, Constant.MOMENT_COOLING, registerAddr); |
|
|
|
count = dataResultFiveMiCount(projectId, startDate, curDate, momentCoolingStr, registerAddr); |
|
|
|
} |
|
|
|
} |
|
|
|
return HttpResult.ok(count, mergedRecords); |
|
|
|
return HttpResult.ok(count, mergedRecords); |
|
|
|
} |
|
|
|
} |
|
|
@ -348,7 +364,7 @@ public class DataResultServiceImpl implements DataResultService { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
else { //1小时
|
|
|
|
else { //1小时
|
|
|
|
startDate = ExchangeStringUtil.dateRoll(1, curDate); |
|
|
|
startDate = ExchangeStringUtil.dateRoll(1, curDate); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, Constant.MOMENT_COOLING, registerAddr); |
|
|
|
List<DataResultChEntity> records = queryDataResultMi(projectId, startDate, curDate, page, limit, 0, momentCoolingStr, registerAddr); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
int count = dataResultOneMiCount(projectId, startDate, curDate); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
return HttpResult.ok(count, records); |
|
|
|
} |
|
|
|
} |
|
|
|