From d2c9fca95057118f1d4535394d1377dabb1b043d Mon Sep 17 00:00:00 2001 From: 25604 Date: Wed, 16 Jul 2025 14:37:43 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=86=B7?= =?UTF-8?q?=E6=BA=90=E7=94=B5=E8=A1=A8=EF=BC=8C=E4=BC=98=E5=8C=96=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/ChillersParamsController.java | 4 + .../test/java/com/mh/MHApplicationTest.java | 43 ++++++ .../java/com/mh/quartz/task/HotWaterTask.java | 2 +- .../system/mapper/energy/AnalysisMapper.java | 20 +-- .../mh/system/mapper/energy/EnergyMapper.java | 8 +- .../mapper/energy/EnergyQueryMapper.java | 6 +- .../mapper/energy/HotEnergyQueryMapper.java | 2 +- .../impl/CoolingSystemMonitorServiceImpl.java | 138 ++++++++---------- .../energy/impl/EnergyAnalyzeServiceImpl.java | 2 +- .../energy/impl/EnergyServiceImpl.java | 122 +++++++++------- .../overview/impl/BigScreenServiceImpl.java | 13 +- .../overview/impl/ProOverviewServiceImpl.java | 24 +-- .../resources/mapper/system/EnergyMapper.xml | 68 ++++++--- 13 files changed, 277 insertions(+), 175 deletions(-) diff --git a/mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java b/mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java index 3ceb80a..394f844 100644 --- a/mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java +++ b/mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java @@ -69,6 +69,10 @@ public class ChillersParamsController extends BaseController { CollectionParamsManageVO2 vo = new CollectionParamsManageVO2(); BeanUtils.copyProperties(item, vo); vo.setCurValue(item.getCurValue().setScale(2).toString()); + // 再根据mtType判断,如果是压缩机的,就只保留整数 + if (vo.getMtType().equals("9") || vo.getMtType().equals("10") || vo.getMtType().equals("11")) { + vo.setCurValue(new BigDecimal(vo.getCurValue()).intValue() + ""); + } // 判断运行状态、启停、故障、本地远程 switch (vo.getParamType()) { case "1": // 运行状态 diff --git a/mh-admin/src/test/java/com/mh/MHApplicationTest.java b/mh-admin/src/test/java/com/mh/MHApplicationTest.java index fc4833b..8383426 100644 --- a/mh-admin/src/test/java/com/mh/MHApplicationTest.java +++ b/mh-admin/src/test/java/com/mh/MHApplicationTest.java @@ -10,6 +10,7 @@ import com.mh.common.utils.DateUtils; import com.mh.common.utils.StringUtils; import com.mh.quartz.task.DealDataTask; import com.mh.quartz.task.GetWeatherDataTask; +import com.mh.quartz.task.HotWaterTask; import com.mh.system.mapper.device.DataProcessMapper; import com.mh.system.service.ISysParamsService; import com.mh.system.service.ISysUserService; @@ -40,6 +41,48 @@ public class MHApplicationTest { @Autowired private ISysUserService sysUserService; + @Autowired + private HotWaterTask hotWaterTask; + + @Test + public void calcAnalysisData() { + for (int i = 9; i < 10; i++) { + hotWaterTask.calcAnalysisData("2025-07-0"+i); + } + } + + @Test + public void calcEnergyData() { + + for (int i = 10; i < 17; i++) { + hotWaterTask.calcEnergyData("2025-07-"+i+" 00:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 01:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 02:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 03:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 04:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 05:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 06:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 07:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 08:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 09:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 10:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 11:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 12:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 13:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 14:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 15:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 16:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 17:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 18:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 19:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 20:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 21:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 22:00:00"); + hotWaterTask.calcEnergyData("2025-07-"+i+" 23:00:00"); + } + + } + @Test public void test() throws Exception { SysUser sysUser = sysUserService.selectUserById(1L); diff --git a/mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java b/mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java index 068991a..bb1b818 100644 --- a/mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java +++ b/mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java @@ -185,7 +185,7 @@ public class HotWaterTask { if (StringUtils.isEmpty(lastHourTime)) { LocalDateTime now = LocalDateTime.now(); LocalDateTime lastHour = now.minusHours(1); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00"); lastHourTime = lastHour.format(formatter); } String tableName = "data_hour" + lastHourTime.substring(0, 4); diff --git a/mh-system/src/main/java/com/mh/system/mapper/energy/AnalysisMapper.java b/mh-system/src/main/java/com/mh/system/mapper/energy/AnalysisMapper.java index 39b0f6f..29feff4 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/energy/AnalysisMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/energy/AnalysisMapper.java @@ -23,34 +23,34 @@ public interface AnalysisMapper { * @param buildingId * @return */ - @Select("select * from analysis_elect_year where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_elect_year where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisElectYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_Water_year where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_Water_year where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisWaterYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_Energy_year where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_Energy_year where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisEnergyYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_Maintain_year where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_Maintain_year where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisMaintainYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_runtime_year where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_runtime_year where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisRuntimeYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_elect_month where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_elect_month where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisElectMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_Water_month where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_Water_month where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisWaterMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_Energy_month where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_Energy_month where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisEnergyMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_maintain_month where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_maintain_month where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisMaintainMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); - @Select("select * from analysis_runtime_month where cur_date=#{curDate} and building_id=#{buildingId}") + @Select("select * from analysis_runtime_month where cur_date=#{curDate} and building_id=#{buildingId} order by id ") List queryAnalysisRuntimeMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); } diff --git a/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java b/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java index 362bb4b..e602980 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java @@ -56,7 +56,8 @@ public interface EnergyMapper { " join device_ledger dl " + "on " + " cpm.device_ledger_id = dl.id " + - " and dl.device_type in ('5', '6') and cpm.grade = 40 and cpm.terminal_device_type = '15' " + + " and dl.device_type in ('5', '6') and cpm.grade = 40 " + +// " and cpm.terminal_device_type = '15' " + "" + " and cpm.system_type = #{systemType} " + "" + @@ -107,7 +108,8 @@ public interface EnergyMapper { " join device_ledger dl " + "on " + " cpm.device_ledger_id = dl.id " + - " and dl.device_type in ('5', '6') and cpm.grade = 40 and cpm.terminal_device_type = '15' " + + " and dl.device_type in ('5', '6') and cpm.grade = 40 " + +// " and cpm.terminal_device_type = '15' " + "" + " and cpm.system_type = #{systemType} " + "" + @@ -176,7 +178,7 @@ public interface EnergyMapper { "on " + " cpm.device_ledger_id = dl.id " + " and dl.device_type in ('5', '6') and cpm.grade = 40 " + - " and cpm.terminal_device_type = '15' " + +// " and cpm.terminal_device_type = '15' " + "" + " and cpm.system_type = #{systemType} " + "" + diff --git a/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java b/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java index eff4eb0..130fad4 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java @@ -56,7 +56,7 @@ public interface EnergyQueryMapper { " join device_ledger dl " + "on " + " cpm.device_ledger_id = dl.id " + - " and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " + + " and dl.device_type in ('5', '6') " + " " + " and cpm.system_type = #{systemType} " + "" + @@ -107,7 +107,7 @@ public interface EnergyQueryMapper { " join device_ledger dl " + "on " + " cpm.device_ledger_id = dl.id " + - " and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " + + " and dl.device_type in ('5', '6') " + " " + " and cpm.system_type = #{systemType} " + "" + @@ -177,7 +177,7 @@ public interface EnergyQueryMapper { " join device_ledger dl " + "on " + " cpm.device_ledger_id = dl.id " + - " and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " + + " and dl.device_type in ('5', '6') " + " " + " and cpm.system_type = #{systemType} " + "" + diff --git a/mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java b/mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java index 8e98541..1dd2d13 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java @@ -66,7 +66,7 @@ public interface HotEnergyQueryMapper { ")) t1 on " + " dh.device_num = t1.mt_num " + "where " + - " date_trunc(#{dateType}, dh.cur_time) = date_trunc(#{dateType},#{lastHour}::timestamp) " + + " date_trunc(#{dateType}, dh.last_time) = date_trunc(#{dateType},#{lastHour}::timestamp) " + "order by " + " cur_time; " + "") diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java index bb8233f..c4da5f2 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java @@ -200,85 +200,75 @@ public class CoolingSystemMonitorServiceImpl implements ICoolingSystemMonitorSer // 查询总表的数据 QueryWrapper queryWrapper = new QueryWrapper() .eq("system_type", "0") - .eq("terminal_device_type", "15") .in("param_type", Arrays.asList("16", "17")); List collectionParamsManages = collectionParamsManageMapper.selectList(queryWrapper); // 遍历获取数据 - if (null != collectionParamsManages && !collectionParamsManages.isEmpty()) { - for (CollectionParamsManage value : collectionParamsManages) { - // 判断paramTYpe,如果16:是电表,如果是17:是冷量计 - if ("16".equals(value.getParamType())) { - // 电表 - // 在判断cur_time是当天值,grade,40:累计值,140:瞬时值 - if (DateUtils.isSameDay(new Date(), value.getCurTime())) { - // 如果是当天值,判断grade,40:累计值,140:瞬时值 - if (value.getGrade() == 40) { - // 累计值 - sysPerformanceDTO.setYearPower(value.getCurValue().subtract(value.getMtInitValue())); - } else if (value.getGrade() == 140) { - // 瞬时值 - sysPerformanceDTO.setRealPower(value.getCurValue()); - } - } else { - // 如果不是当天值,判断grade,40:累计值,140:瞬时值 - BigDecimal bigDecimal = new BigDecimal("0.0"); - if (value.getGrade() == 40) { - // 累计值 - sysPerformanceDTO.setYearPower(bigDecimal); - } else if (value.getGrade() == 140) { - // 瞬时值 - sysPerformanceDTO.setRealPower(bigDecimal); - } - } - } else if ("17".equals(value.getParamType())) { - // 冷量计 - // 在判断cur_time是当天值,grade,40:累计值,140:瞬时值 - if (DateUtils.isSameDay(new Date(), value.getCurTime())) { - // 如果是当天值,判断grade,40:累计值,140:瞬时值 - if (value.getGrade() == 40) { - // 累计值 - sysPerformanceDTO.setYearCold(value.getCurValue().subtract(value.getMtInitValue())); - } else if (value.getGrade() == 140) { - // 瞬时值 - sysPerformanceDTO.setRealCold(value.getCurValue()); - } - } else { - // 如果不是当天值,判断grade,40:累计值,140:瞬时值 - BigDecimal bigDecimal = new BigDecimal("0.0"); - if (value.getGrade() == 40) { - // 累计值 - sysPerformanceDTO.setYearCold(bigDecimal); - } else if (value.getGrade() == 140) { - // 瞬时值 - sysPerformanceDTO.setRealCold(bigDecimal); - } - } - } - } - // 开始计算瞬时EER和累计EER - BigDecimal yearPower = sysPerformanceDTO.getYearPower(); - BigDecimal yearCold = sysPerformanceDTO.getYearCold(); - BigDecimal realPower = sysPerformanceDTO.getRealPower(); - BigDecimal realCold = sysPerformanceDTO.getRealCold(); - - // 计算瞬时EER - if (realPower != null && realCold != null) { - if (realPower.compareTo(BigDecimal.ZERO) == 0) { - sysPerformanceDTO.setRealEER(BigDecimal.ZERO.setScale(1)); // 除数为0时赋值为0.0 - } else { - BigDecimal eer = realCold.divide(realPower, 1, RoundingMode.HALF_UP); - sysPerformanceDTO.setRealEER(eer); - } + if (collectionParamsManages != null && !collectionParamsManages.isEmpty()) { + // 累计电量(yearPower) + BigDecimal totalYearPower = collectionParamsManages.stream() + .filter(value -> "16".equals(value.getParamType()) && "5".equals(value.getMtType()) && value.getCurTime() != null) + .filter(value -> DateUtils.isSameDay(new Date(), value.getCurTime())) + .filter(value -> value.getGrade() == 40) + .map(value -> value.getCurValue().subtract(value.getMtInitValue())) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + sysPerformanceDTO.setYearPower(totalYearPower); + + // 累计瞬时电量(realPower) + BigDecimal totalRealPower = collectionParamsManages.stream() + .filter(value -> "16".equals(value.getParamType()) && "5".equals(value.getMtType()) && value.getCurTime() != null) + .filter(value -> DateUtils.isSameDay(new Date(), value.getCurTime())) + .filter(value -> value.getGrade() == 140) + .map(CollectionParamsManage::getCurValue) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + sysPerformanceDTO.setRealPower(totalRealPower); + + // 累计冷量(yearCold) + BigDecimal totalYearCold = collectionParamsManages.stream() + .filter(value -> "17".equals(value.getParamType()) && "15".equals(value.getTerminalDeviceType()) && value.getCurTime() != null) + .filter(value -> DateUtils.isSameDay(new Date(), value.getCurTime())) + .filter(value -> value.getGrade() == 40) + .map(value -> value.getCurValue().subtract(value.getMtInitValue())) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + sysPerformanceDTO.setYearCold(totalYearCold); + + // 累计瞬时冷量(realCold) + BigDecimal totalRealCold = collectionParamsManages.stream() + .filter(value -> "17".equals(value.getParamType()) && "15".equals(value.getTerminalDeviceType()) && value.getCurTime() != null) + .filter(value -> DateUtils.isSameDay(new Date(), value.getCurTime())) + .filter(value -> value.getGrade() == 140) + .map(CollectionParamsManage::getCurValue) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + sysPerformanceDTO.setRealCold(totalRealCold); + + } + + // 开始计算瞬时EER和累计EER + BigDecimal yearPower = sysPerformanceDTO.getYearPower(); + BigDecimal yearCold = sysPerformanceDTO.getYearCold(); + BigDecimal realPower = sysPerformanceDTO.getRealPower(); + BigDecimal realCold = sysPerformanceDTO.getRealCold(); + + // 计算瞬时EER + if (realPower != null && realCold != null) { + if (realPower.compareTo(BigDecimal.ZERO) == 0) { + sysPerformanceDTO.setRealEER(BigDecimal.ZERO.setScale(1)); // 除数为0时赋值为0.0 + } else { + BigDecimal eer = realCold.divide(realPower, 1, RoundingMode.HALF_UP); + sysPerformanceDTO.setRealEER(eer); } + } - // 计算累计EER - if (yearPower != null && yearCold != null) { - if (yearPower.compareTo(BigDecimal.ZERO) == 0) { - sysPerformanceDTO.setYearEER(BigDecimal.ZERO.setScale(1)); // 除数为0时赋值为0.0 - } else { - BigDecimal yearEer = yearCold.divide(yearPower, 1, RoundingMode.HALF_UP); - sysPerformanceDTO.setYearEER(yearEer); - } + // 计算累计EER + if (yearPower != null && yearCold != null) { + if (yearPower.compareTo(BigDecimal.ZERO) == 0) { + sysPerformanceDTO.setYearEER(BigDecimal.ZERO.setScale(1)); // 除数为0时赋值为0.0 + } else { + BigDecimal yearEer = yearCold.divide(yearPower, 1, RoundingMode.HALF_UP); + sysPerformanceDTO.setYearEER(yearEer); } } return sysPerformanceDTO; diff --git a/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java index d605801..f1204d6 100644 --- a/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyAnalyzeServiceImpl.java @@ -267,7 +267,7 @@ public class EnergyAnalyzeServiceImpl implements EnergyAnalyzeService { .sorted(Comparator.comparing(DeviceTypeEnergy::getGrade)) .map(val -> { ColumnFilter data = new ColumnFilter(); - data.setName(val.getRemark()); + data.setName(val.getRemark().replace("累计读数", "")); BigDecimal calcValue = new BigDecimal(val.getCalcValue()).setScale(2, RoundingMode.HALF_UP); data.setValue(String.valueOf(calcValue)); return data; diff --git a/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyServiceImpl.java index 302f555..3474ab6 100644 --- a/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/energy/impl/EnergyServiceImpl.java @@ -125,7 +125,7 @@ public class EnergyServiceImpl implements IEnergyService { int pageNum = Integer.parseInt(String.valueOf(vo.getPageNum())); int pageSize = Integer.parseInt(String.valueOf(vo.getPageSize())); if (pageNum != 0) { - int startIndex = (pageNum-1)*pageSize; + int startIndex = (pageNum - 1) * pageSize; int endIndex = Math.min(pageNum * pageSize, timeStr.size()); value = value.subList(startIndex, endIndex); column.setValue(getArrChillerLine(value, timeStr.subList(startIndex, endIndex).toArray(new String[0]))); @@ -144,7 +144,7 @@ public class EnergyServiceImpl implements IEnergyService { map.put("timeStr", timeStr); map.put("dataList", columnData); } else { - int startIndex = (pageNum-1) * pageSize; + int startIndex = (pageNum - 1) * pageSize; int endIndex = Math.min(pageNum * pageSize, timeStr.size()); if (startIndex > endIndex) { return AjaxResult.success(new ArrayList<>(map.entrySet())); @@ -194,8 +194,8 @@ public class EnergyServiceImpl implements IEnergyService { futures.add(executor.submit(() -> { // 折线图,都查询min表 // 多表 - String lastTable = "data_min" + vo.getStartTime().substring(0,4); - String curTable = "data_min" + vo.getEndTime().substring(0,4); + String lastTable = "data_min" + vo.getStartTime().substring(0, 4); + String curTable = "data_min" + vo.getEndTime().substring(0, 4); List consumptionAnalyzeEntities = energyMapper.queryDeviceLineManyTable(vo.getStartTime(), vo.getEndTime(), lastTable, curTable, vo.getDeviceType(), vo.getSystemType()); if (null == consumptionAnalyzeEntities || consumptionAnalyzeEntities.size() == 0) { latch.countDown(); @@ -241,10 +241,10 @@ public class EnergyServiceImpl implements IEnergyService { energyConsumptionDTO.setLineTimes((String[]) allData.get("timeStrLineArr")); List> listData = new ArrayList<>(); Map meter = new HashMap<>(); - meter.put("meter",allData.get("meterArr")); + meter.put("meter", allData.get("meterArr")); listData.add(meter); Map lineMeter = new HashMap<>(); - lineMeter.put("lineMeter",allData.get("meterLineArr")); + lineMeter.put("lineMeter", allData.get("meterLineArr")); listData.add(lineMeter); energyConsumptionDTO.setData(listData); return AjaxResult.success(energyConsumptionDTO); @@ -312,10 +312,10 @@ public class EnergyServiceImpl implements IEnergyService { try { double cold = Math.round(Double.parseDouble(coldArr[i]) * 100) / 100.0; double meter = Math.round(Double.parseDouble(meterArr[i]) * 100) / 100.0; - double cop = Math.round((meter==0 ? 0.00 : cold/ meter) * 100) / 100.0; + double cop = Math.round((meter == 0 ? 0.00 : cold / meter) * 100) / 100.0; copArr[i] = String.valueOf(cop); } catch (NumberFormatException e) { - log.error("处理累计能耗异常==>",e); + log.error("处理累计能耗异常==>", e); throw new RuntimeException(e); } } @@ -375,10 +375,10 @@ public class EnergyServiceImpl implements IEnergyService { try { double cold = Math.round(Double.parseDouble(lineEfrColdArr[i]) * 100) / 100.0; double meter = Math.round(Double.parseDouble(lineInstantaneousMeterArr[i]) * 100) / 100.0; - double cop = Math.round((meter==0 ? 0.00 : cold/ meter) * 100) / 100.0; + double cop = Math.round((meter == 0 ? 0.00 : cold / meter) * 100) / 100.0; lineCopArr[i] = String.valueOf(cop); } catch (NumberFormatException e) { - log.error("处理累计能耗异常==>",e); + log.error("处理累计能耗异常==>", e); throw new RuntimeException(e); } } @@ -432,13 +432,13 @@ public class EnergyServiceImpl implements IEnergyService { meterLine.put("lineMeter", allData.get("lineMeterArr")); listData.add(meterLine); Map copLine = new HashMap<>(); - copLine.put("lineCop",allData.get("lineCopArr")); + copLine.put("lineCop", allData.get("lineCopArr")); listData.add(copLine); Map instantaneousColdLine = new HashMap<>(); - instantaneousColdLine.put("lineInstantaneousCold",allData.get("lineInstantaneousColdArr")); + instantaneousColdLine.put("lineInstantaneousCold", allData.get("lineInstantaneousColdArr")); listData.add(instantaneousColdLine); Map instantaneousMeterLine = new HashMap<>(); - instantaneousMeterLine.put("lineInstantaneousMeter",allData.get("lineInstantaneousMeterArr")); + instantaneousMeterLine.put("lineInstantaneousMeter", allData.get("lineInstantaneousMeterArr")); listData.add(instantaneousMeterLine); energyConsumptionDTO.setData(listData); return AjaxResult.success(energyConsumptionDTO); @@ -462,8 +462,8 @@ public class EnergyServiceImpl implements IEnergyService { public AjaxResult yoy(EnergyConsumptionVO vo) { // 获取今年的值 List consumptionAnalyzeEntities; - String lastTableName = "data_"+vo.getTimeType(); - String curTableName = "data_"+vo.getTimeType(); + String lastTableName = "data_" + vo.getTimeType(); + String curTableName = "data_" + vo.getTimeType(); String startTime = vo.getStartTime(); String endTime = vo.getEndTime(); String deviceType = vo.getParamType(); @@ -478,8 +478,8 @@ public class EnergyServiceImpl implements IEnergyService { // curTableName = "data_min_cop"; // deviceType = "system"; } else { - lastTableName = lastTableName+startTime.substring(0,4); - curTableName = curTableName+endTime.substring(0,4); + lastTableName = lastTableName + startTime.substring(0, 4); + curTableName = curTableName + endTime.substring(0, 4); } String timeType = vo.getTimeType(); if (!(lastTableName.equalsIgnoreCase(curTableName)) && ("hour".equalsIgnoreCase(timeType) || "day".equalsIgnoreCase(timeType))) { @@ -487,11 +487,11 @@ public class EnergyServiceImpl implements IEnergyService { // 获取上一期的时间 startTime = DateUtils.yoyDate(startTime); endTime = DateUtils.yoyDate(endTime); - String yoyLastTableName = lastTableName.substring(0, lastTableName.length() - 4) + startTime.substring(0,4); - String yoyCurTableName = curTableName.substring(0, lastTableName.length() - 4) + endTime.substring(0,4); + String yoyLastTableName = lastTableName.substring(0, lastTableName.length() - 4) + startTime.substring(0, 4); + String yoyCurTableName = curTableName.substring(0, lastTableName.length() - 4) + endTime.substring(0, 4); consumptionAnalyzeEntities = energyMapper.queryManyTableYoy(vo.getStartTime(), vo.getEndTime(), lastTableName, curTableName, startTime, endTime, yoyLastTableName, yoyCurTableName, getTimeLen(vo.getTimeType()), deviceType, vo.getTimeType(), vo.getSystemType()); - } else { + } else { // 单表 startTime = DateUtils.yoyDate(startTime); endTime = DateUtils.yoyDate(endTime); @@ -523,7 +523,8 @@ public class EnergyServiceImpl implements IEnergyService { // 获取电量读数 vo.setParamType("5"); AjaxResult meterData = yoy(vo); - EnergyConsumptionDTO meterEnergyData = (EnergyConsumptionDTO) meterData.get("data");; + EnergyConsumptionDTO meterEnergyData = (EnergyConsumptionDTO) meterData.get("data"); + ; if (meterEnergyData == null) { return AjaxResult.error(); } @@ -584,28 +585,47 @@ public class EnergyServiceImpl implements IEnergyService { List meterCurDataList = new ArrayList<>(Arrays.asList(meterCurData)); List meterLastDataList = new ArrayList<>(Arrays.asList(meterLastData)); - if (timeAList.size() < timeBList.size()) { - for (String time : timeBList) { - if (!timeAList.contains(time)) { - timeAList.add(time); - cloudCurDataList.add("0"); - } + + // 遍历 timeB,补齐 timeA 缺失的部分,并在 cloud 数据中插入 0 + for (int i = 0; i < timeBList.size(); i++) { + String time = timeBList.get(i); + int indexInTimeA = timeAList.indexOf(time); + + if (indexInTimeA == -1) { + // timeB[i] 在 timeA 中不存在,需要在 cloud 的 list 中插入 "0" + cloudCurDataList.add(i, "0"); + cloudLastDataList.add(i, "0"); + timeAList.add(i, time); // 同步更新时间列表 + } else if (indexInTimeA != i) { + // 如果顺序不同,同步调整 cloud 列表 + // 这里可以考虑排序后统一处理,或者抛出异常提示时间顺序不一致 + log.warn("时间顺序不一致,请确保输入时间已排序"); } - meterEnergyData.setTimes(timeAList.toArray(new String[0])); - cloudCurData = cloudCurDataList.toArray(new String[0]); - cloudLastData = cloudLastDataList.toArray(new String[0]); - } else if (timeBList.size() < timeAList.size()) { - for (String time : timeAList) { - if (!timeBList.contains(time)) { - timeBList.add(time); - meterCurDataList.add("0"); - meterLastDataList.add("0"); - } + } + + // 反向处理 timeA 多出的情况(可选) + for (int i = 0; i < timeAList.size(); i++) { + String time = timeAList.get(i); + int indexInTimeB = timeBList.indexOf(time); + + if (indexInTimeB == -1) { + // timeA[i] 在 timeB 中不存在,删除或跳过 + timeAList.remove(i); + cloudCurDataList.remove(i); + cloudLastDataList.remove(i); + i--; // 回退索引 } - meterEnergyData.setTimes(timeBList.toArray(new String[0])); - meterCurData = meterCurDataList.toArray(new String[0]); - meterLastData = meterLastDataList.toArray(new String[0]); } + + // 更新回原对象 + cloudEnergyData.setTimes(timeAList.toArray(new String[0])); + meterEnergyData.setTimes(timeAList.toArray(new String[0])); // 保持时间一致 + + cloudCurData = cloudCurDataList.toArray(new String[0]); + cloudLastData = cloudLastDataList.toArray(new String[0]); + meterCurData = meterCurDataList.toArray(new String[0]); + meterLastData = meterLastDataList.toArray(new String[0]); + energyConsumptionDTO.setTitles(meterEnergyData.getTitles()); energyConsumptionDTO.setTimes(meterEnergyData.getTimes()); energyConsumptionDTO.setLineTimes(meterEnergyData.getLineTimes()); @@ -652,13 +672,13 @@ public class EnergyServiceImpl implements IEnergyService { // )); List> listData = new ArrayList<>(); Map cur = new HashMap<>(); - cur.put("curValue",copMap); + cur.put("curValue", copMap); listData.add(cur); Map last = new HashMap<>(); - last.put("lastValue",copLastMap); + last.put("lastValue", copLastMap); listData.add(last); Map yoy = new HashMap<>(); - yoy.put(type,yoyMap); + yoy.put(type, yoyMap); listData.add(yoy); energyConsumptionDTO.setData(listData); } @@ -674,12 +694,12 @@ public class EnergyServiceImpl implements IEnergyService { String deviceType = vo.getParamType(); if ("meter".equals(deviceType)) { deviceType = "5"; - } else if ("cloud".equals(deviceType)){ + } else if ("cloud".equals(deviceType)) { deviceType = "6"; } // 判断查询时间类型是month,year if ("month".equalsIgnoreCase(vo.getTimeType()) || "year".equalsIgnoreCase(vo.getTimeType())) { - String tableName = "data_"+vo.getTimeType(); + String tableName = "data_" + vo.getTimeType(); // 计算COP值(后期有一个表存储) if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { // tableName = "data_min_cop"; @@ -689,8 +709,8 @@ public class EnergyServiceImpl implements IEnergyService { consumptionAnalyzeEntities = energyMapper.queryMonthAndYearMom(vo.getStartTime(), vo.getEndTime(), startTime, endTime, tableName, getTimeLen(vo.getTimeType()), deviceType, vo.getTimeType(), vo.getSystemType()); } else { // 判斷是否需要進行連表查詢 - String tableName1 = "data_"+vo.getTimeType()+startTime.substring(0, 4); - String tableName2 = "data_"+vo.getTimeType()+vo.getEndTime().substring(0, 4); + String tableName1 = "data_" + vo.getTimeType() + startTime.substring(0, 4); + String tableName2 = "data_" + vo.getTimeType() + vo.getEndTime().substring(0, 4); // 计算COP值(后期有一个表存储) if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { // tableName1 = "data_min_cop"; @@ -776,7 +796,7 @@ public class EnergyServiceImpl implements IEnergyService { EnergyConsumptionDTO result = new EnergyConsumptionDTO(); EnergyConsumptionDTO yoyData = (EnergyConsumptionDTO) yoy.get("data"); EnergyConsumptionDTO momData = (EnergyConsumptionDTO) mom.get("data"); - if (yoyData.getData()==null || momData.getData()==null) { + if (yoyData.getData() == null || momData.getData() == null) { return AjaxResult.success(result); } result.setTitles(new String[]{"curValue", "lastValue", "yoy", "mom"}); @@ -842,13 +862,13 @@ public class EnergyServiceImpl implements IEnergyService { energyConsumptionDTO.setTimes(timeStrArr); List> listData = new ArrayList<>(); Map cur = new HashMap<>(); - cur.put("curValue",curValue); + cur.put("curValue", curValue); listData.add(cur); Map last = new HashMap<>(); - last.put("lastValue",lastValue); + last.put("lastValue", lastValue); listData.add(last); Map yoy = new HashMap<>(); - yoy.put(compareType,yoyValue); + yoy.put(compareType, yoyValue); listData.add(yoy); energyConsumptionDTO.setData(listData); return AjaxResult.success(energyConsumptionDTO); diff --git a/mh-system/src/main/java/com/mh/system/service/overview/impl/BigScreenServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/overview/impl/BigScreenServiceImpl.java index fd9f39b..4a25a93 100644 --- a/mh-system/src/main/java/com/mh/system/service/overview/impl/BigScreenServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/overview/impl/BigScreenServiceImpl.java @@ -16,6 +16,7 @@ import com.mh.system.service.overview.IBigScreenService; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; @@ -110,13 +111,17 @@ public class BigScreenServiceImpl implements IBigScreenService { bigScreenOverviewAndBasicDTO.setBuildingArea(new BigDecimal(sysParams.get(0).getBuildingArea())); // 计算单位面积能耗 // 用电转换,公式:单位面积能耗(kWh/m2)=用电量(kWh)➗建筑面积(m2) - bigScreenOverviewAndBasicDTO.setEleUnitArea(bigScreenOverviewAndBasicDTO.getTotalEle().divide(bigScreenOverviewAndBasicDTO.getBuildingArea())); + bigScreenOverviewAndBasicDTO.setEleUnitArea(bigScreenOverviewAndBasicDTO.getTotalEle() + .divide(bigScreenOverviewAndBasicDTO.getBuildingArea(), 2, RoundingMode.HALF_UP)); // 用冷转换,公式:单位面积能耗(kWh/m2)=用冷量(kW)➗建筑面积(m2) - bigScreenOverviewAndBasicDTO.setColdUnitArea(bigScreenOverviewAndBasicDTO.getTotalCold().divide(bigScreenOverviewAndBasicDTO.getBuildingArea())); + bigScreenOverviewAndBasicDTO.setColdUnitArea(bigScreenOverviewAndBasicDTO.getTotalCold() + .divide(bigScreenOverviewAndBasicDTO.getBuildingArea(), 2, RoundingMode.HALF_UP)); // 用水转换,公式:单位面积能耗(kWh/m2)=用水量(吨)➗建筑面积(m2) - bigScreenOverviewAndBasicDTO.setWaterUnitArea(bigScreenOverviewAndBasicDTO.getTotalWater().divide(bigScreenOverviewAndBasicDTO.getBuildingArea())); + bigScreenOverviewAndBasicDTO.setWaterUnitArea(bigScreenOverviewAndBasicDTO.getTotalWater() + .divide(bigScreenOverviewAndBasicDTO.getBuildingArea(), 2, RoundingMode.HALF_UP)); // 用气转换,公式:单位面积能耗(kWh/m2)=用蒸汽量(吨)➗建筑面积(m2) - bigScreenOverviewAndBasicDTO.setGasUnitArea(bigScreenOverviewAndBasicDTO.getTotalGas().divide(bigScreenOverviewAndBasicDTO.getBuildingArea())); + bigScreenOverviewAndBasicDTO.setGasUnitArea(bigScreenOverviewAndBasicDTO.getTotalGas() + .divide(bigScreenOverviewAndBasicDTO.getBuildingArea(), 2, RoundingMode.HALF_UP)); } return List.of(bigScreenOverviewAndBasicDTO); } diff --git a/mh-system/src/main/java/com/mh/system/service/overview/impl/ProOverviewServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/overview/impl/ProOverviewServiceImpl.java index ef048d8..0bda158 100644 --- a/mh-system/src/main/java/com/mh/system/service/overview/impl/ProOverviewServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/overview/impl/ProOverviewServiceImpl.java @@ -59,6 +59,7 @@ public class ProOverviewServiceImpl implements IProOverviewService { BigDecimal realEle = null; if (realEleParams != null && !realEleParams.isEmpty()) { realEle = realEleParams.stream() + .filter(value -> value.getMtType().equals("5")) .map(CollectionParamsManage::getCurValue) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); @@ -135,12 +136,14 @@ public class ProOverviewServiceImpl implements IProOverviewService { case 2: // 空调风柜系统 // 查询风柜运行状态 - List windCabinetRunParams = queryCollectionParams("1", "2", 140, null, true); + List windCabinetRunParams = queryCollectionParams("1", "2", 140, null, false); if (windCabinetRunParams != null && !windCabinetRunParams.isEmpty()) { // 查询风柜正在运行设备,判断cur_value=1的 long runCount = windCabinetRunParams.stream().filter(param -> param != null && param.getCurValue() != null - && param.getCurValue().compareTo(BigDecimal.ONE) == 0).count(); + && param.getCurValue().compareTo(BigDecimal.ONE) == 0 + && DateUtils.dateToString(param.getCurTime(), "yyyy-MM-dd").equals(DateUtils.dateToString(new Date(), "yyyy-MM-dd")) + ).count(); long stopCount = windCabinetRunParams.size() - runCount; ColumnFilter runColumn = new ColumnFilter("运行", runCount + ""); ColumnFilter stopColumn = new ColumnFilter("停止", stopCount + ""); @@ -155,7 +158,7 @@ public class ProOverviewServiceImpl implements IProOverviewService { break; case 4: // 室内温度监测系统 - List tempParams = queryCollectionParams("12", "4", 140, null, true); + List tempParams = queryCollectionParams("12", "4", 140, null, false); // stream流判断时间cur_time是否是今天,如果是今天则判断在线,不是则判断离线 if (tempParams != null && !tempParams.isEmpty()) { long onlineCount = tempParams.stream() @@ -246,9 +249,9 @@ public class ProOverviewServiceImpl implements IProOverviewService { queryWrapper.apply("DATE(cur_time) = DATE({0})", todayStr); } - if (terminalDeviceType != null && !terminalDeviceType.isEmpty()) { - queryWrapper.eq("terminal_device_type", terminalDeviceType); - } +// if (terminalDeviceType != null && !terminalDeviceType.isEmpty()) { +// queryWrapper.eq("terminal_device_type", terminalDeviceType); +// } return collectionParamsManageMapper.selectList(queryWrapper); } @@ -343,11 +346,12 @@ public class ProOverviewServiceImpl implements IProOverviewService { queryWrapper.eq("system_type", sysType); queryWrapper.eq("grade", 40); queryWrapper.eq("mt_is_sum", 0); + queryWrapper.eq("is_use", 0); Long count = collectionParamsManageMapper.selectCount(queryWrapper); HashMap totalData = new HashMap<>(); if (count > 0) { // 查询总表 - queryWrapper.eq("terminal_device_type", "15"); +// queryWrapper.eq("terminal_device_type", "15"); totalData = getTotalData(paramType, queryWrapper); } else { // 查询分表综合 @@ -356,7 +360,7 @@ public class ProOverviewServiceImpl implements IProOverviewService { queryWrapper.eq("system_type", sysType); queryWrapper.eq("grade", 40); queryWrapper.eq("mt_is_sum", 1); - queryWrapper.ne("terminal_device_type", "15"); +// queryWrapper.ne("terminal_device_type", "15"); // 查询分表总和 totalData = getTotalData(paramType, queryWrapper); } @@ -396,14 +400,16 @@ public class ProOverviewServiceImpl implements IProOverviewService { List collectionParamsManages = collectionParamsManageMapper.selectList(queryWrapper); HashMap result = new HashMap<>(); // 遍历计算得出总用电量 + final BigDecimal[] totalValue = {BigDecimal.ZERO}; collectionParamsManages.forEach(collectionParamsManage -> { BigDecimal curValue = collectionParamsManage.getCurValue() == null ? BigDecimal.ZERO : collectionParamsManage.getCurValue(); BigDecimal mtInitValue = collectionParamsManage.getMtInitValue() == null ? BigDecimal.ZERO : collectionParamsManage.getMtInitValue(); BigDecimal mtRatio = collectionParamsManage.getMtRatio() == null ? BigDecimal.ZERO : BigDecimal.valueOf(collectionParamsManage.getMtRatio()); BigDecimal multiply = (curValue.subtract(mtInitValue)).multiply(mtRatio); // TODO - result.put("totalValue", multiply); + totalValue[0] = totalValue[0].add(multiply); }); + result.put("totalValue", totalValue[0]); // 计算得出今年的各个参数用量 if (!collectionParamsManages.isEmpty()) { BigDecimal yearValue = overviewMapper.queryByDeviceNum(collectionParamsManages); diff --git a/mh-system/src/main/resources/mapper/system/EnergyMapper.xml b/mh-system/src/main/resources/mapper/system/EnergyMapper.xml index fe1d883..8795df5 100644 --- a/mh-system/src/main/resources/mapper/system/EnergyMapper.xml +++ b/mh-system/src/main/resources/mapper/system/EnergyMapper.xml @@ -104,7 +104,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) @@ -140,7 +142,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) @@ -175,7 +179,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) @@ -210,7 +216,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) @@ -252,7 +260,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), @@ -281,7 +291,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), @@ -311,7 +323,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), @@ -340,7 +354,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY device_type, SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), @@ -391,7 +407,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) @@ -429,7 +447,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) GROUP BY EXTRACT(YEAR FROM cur_time) @@ -490,7 +510,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), @@ -530,7 +552,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by extract(year from cur_time) @@ -581,7 +605,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), extract(year from cur_time) @@ -610,7 +636,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), extract(year from cur_time) @@ -640,7 +668,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by extract(year from cur_time) @@ -667,7 +697,9 @@ and cpm.system_type = #{systemType} - and cpm.grade = 40 and cpm.terminal_device_type = '15' ) + and cpm.grade = 40 +-- and cpm.terminal_device_type = '15' + ) group by extract(year from cur_time) @@ -854,7 +886,7 @@ cpm.device_ledger_id = dl.id and dl.device_type = '5' and cpm.grade = 140 - and cpm.terminal_device_type = '15' +-- and cpm.terminal_device_type = '15' ) group by device_type, @@ -881,7 +913,7 @@ cpm.device_ledger_id = dl.id and dl.device_type = '6' and cpm.grade = 140 - and cpm.terminal_device_type = '15' +-- and cpm.terminal_device_type = '15' ) group by device_type,