diff --git a/op-modules/op-energy/src/main/java/com/op/energy/base/service/impl/BaseLineMonitorServiceImpl.java b/op-modules/op-energy/src/main/java/com/op/energy/base/service/impl/BaseLineMonitorServiceImpl.java index 9604da9d..771c1b3d 100644 --- a/op-modules/op-energy/src/main/java/com/op/energy/base/service/impl/BaseLineMonitorServiceImpl.java +++ b/op-modules/op-energy/src/main/java/com/op/energy/base/service/impl/BaseLineMonitorServiceImpl.java @@ -95,7 +95,7 @@ public class BaseLineMonitorServiceImpl implements IBaseLineMonitorService { if (lineMonitor.getObjid().equals(lineMonitor.getParentId())) { continue; } - Long grade = 0L; + Long grade = 1L; grade = updateLineMonitorGrade(baseLineMonitors, lineMonitor, objIdList, grade); if (StringUtils.isNull(lineMonitor.getGrade()) || !lineMonitor.getGrade().equals(grade)) { lineMonitor.setGrade(grade); @@ -111,7 +111,6 @@ public class BaseLineMonitorServiceImpl implements IBaseLineMonitorService { /** * 线路计量信息等级更新 - * * @param baseLineMonitors * @param lineMonitor * @param objIdList @@ -294,7 +293,6 @@ public class BaseLineMonitorServiceImpl implements IBaseLineMonitorService { /** * 递归查找monitorId最下级节点中的表 - * * @param monitors * @param monitorId * @return diff --git a/op-modules/op-energy/src/main/java/com/op/energy/base/utils/ExportExcelUtil.java b/op-modules/op-energy/src/main/java/com/op/energy/base/utils/ExportExcelUtil.java index 27d842cb..8b1549b2 100644 --- a/op-modules/op-energy/src/main/java/com/op/energy/base/utils/ExportExcelUtil.java +++ b/op-modules/op-energy/src/main/java/com/op/energy/base/utils/ExportExcelUtil.java @@ -609,6 +609,41 @@ public class ExportExcelUtil { return result; } + /** + * 获取List连续相同数据的开始和结束的下标 + * 与计量设备编号联动 + * @param countList + * @return + */ + public static List findConsecutiveIndices(List countList, List monitorIdList) { + List result = new ArrayList<>(); + + if (monitorIdList == null || monitorIdList.isEmpty()) { + return result; + } + + int start = 0; + int end = 0; + + for (int i = 1; i < monitorIdList.size(); i++) { + if (monitorIdList.get(i).equals(monitorIdList.get(i - 1))) { + end = i; + } else { + if (start != end) { + result.add(new int[]{start, end}); + } + start = i; + end = i; + } + } + + if (start != end) { + result.add(new int[]{start, end}); + } + + return result; + } + /** * 创建表格样式 * diff --git a/op-modules/op-energy/src/main/java/com/op/energy/report/controller/dataAnalysisController.java b/op-modules/op-energy/src/main/java/com/op/energy/report/controller/dataAnalysisController.java index 412cf097..7db82206 100644 --- a/op-modules/op-energy/src/main/java/com/op/energy/report/controller/dataAnalysisController.java +++ b/op-modules/op-energy/src/main/java/com/op/energy/report/controller/dataAnalysisController.java @@ -187,7 +187,8 @@ public class dataAnalysisController extends BaseController { @PostMapping("/classificationExport") @ResponseBody - public void classificationExport(HttpServletResponse response, @RequestParam(required = false) Map paramMap) { + public void classificationExport(HttpServletResponse response, @RequestParam(required = false) Map paramMap) + { List list = dataAnalysisService.classificationExportReport(paramMap); List originalList = SpringUtils.deepCopy(list); @@ -198,12 +199,18 @@ public class dataAnalysisController extends BaseController { ArrayList threeList = new ArrayList<>(); ArrayList fourList = new ArrayList<>(); ArrayList fiveList = new ArrayList<>(); + ArrayList threeMList = new ArrayList<>(); + ArrayList fourMList = new ArrayList<>(); + ArrayList fiveMList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { oneList.add(list.get(i).getOneExpend() == null ? "" : list.get(i).getOneExpend().toPlainString()); twoList.add(list.get(i).getTwoExpend() == null ? "" : list.get(i).getTwoExpend().toPlainString()); threeList.add(list.get(i).getThreeExpend() == null ? "" : list.get(i).getThreeExpend().toPlainString()); fourList.add(list.get(i).getFourExpend() == null ? "" : list.get(i).getFourExpend().toPlainString()); fiveList.add(list.get(i).getFiveExpend() == null ? "" : list.get(i).getFiveExpend().toPlainString()); + threeMList.add(list.get(i).getThreeMonitorId() == null ? "" : list.get(i).getThreeMonitorId()); + fourMList.add(list.get(i).getFourMonitorId() == null ? "" : list.get(i).getFourMonitorId()); + fiveMList.add(list.get(i).getFiveMonitorId() == null ? "" : list.get(i).getFiveMonitorId()); } List oneListIndices = findConsecutiveIndices(oneList); for (int[] consecutiveIndex : oneListIndices) { @@ -217,24 +224,27 @@ public class dataAnalysisController extends BaseController { list.get(i).setTwoExpend(null); } } - List threeListIndices = findConsecutiveIndices(threeList); + List threeListIndices = findConsecutiveIndices(threeList, threeMList); for (int[] consecutiveIndex : threeListIndices) { + if(consecutiveIndex[1] - consecutiveIndex[0] < 1){ + continue; + } for (int i = consecutiveIndex[0] + 1; i < consecutiveIndex[1] + 1; i++) { list.get(i).setThreeExpend(null); } } - List fourListIndices = findConsecutiveIndices(fourList); + List fourListIndices = findConsecutiveIndices(fourList, fourMList); for (int[] consecutiveIndex : fourListIndices) { - if (consecutiveIndex[1] - consecutiveIndex[0] < 2) { + if(consecutiveIndex[1] - consecutiveIndex[0] < 1){ continue; } for (int i = consecutiveIndex[0] + 1; i < consecutiveIndex[1] + 1; i++) { list.get(i).setFourExpend(null); } } - List fiveListIndices = findConsecutiveIndices(fiveList); + List fiveListIndices = findConsecutiveIndices(fiveList, fiveMList); for (int[] consecutiveIndex : fiveListIndices) { - if (consecutiveIndex[1] - consecutiveIndex[0] < 2) { + if(consecutiveIndex[1] - consecutiveIndex[0] < 1){ continue; } for (int i = consecutiveIndex[0] + 1; i < consecutiveIndex[1] + 1; i++) { diff --git a/op-modules/op-energy/src/main/java/com/op/energy/report/service/impl/DataAnalysisServiceImpl.java b/op-modules/op-energy/src/main/java/com/op/energy/report/service/impl/DataAnalysisServiceImpl.java index 4c4e19ed..0321117c 100644 --- a/op-modules/op-energy/src/main/java/com/op/energy/report/service/impl/DataAnalysisServiceImpl.java +++ b/op-modules/op-energy/src/main/java/com/op/energy/report/service/impl/DataAnalysisServiceImpl.java @@ -320,7 +320,6 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService { baseLineLoss.setParams(params); List baseLineLosses = baseLineLossMapper.selectBaseLineLossList(baseLineLoss); try { - List lineMonitorList = baseLineMonitorMapper.selectBaseLineMonitorList(new BaseLineMonitor()); for (BaseLineLoss lineLoss : baseLineLosses) { HashMap hashMap = new HashMap<>(); List> energyConsumptionList = new ArrayList<>(); diff --git a/op-modules/op-energy/src/main/resources/mapper/base/BaseLineMonitorMapper.xml b/op-modules/op-energy/src/main/resources/mapper/base/BaseLineMonitorMapper.xml index ffeffcca..e610bea3 100644 --- a/op-modules/op-energy/src/main/resources/mapper/base/BaseLineMonitorMapper.xml +++ b/op-modules/op-energy/src/main/resources/mapper/base/BaseLineMonitorMapper.xml @@ -32,43 +32,93 @@ - select objid, parent_id, monitor_id, monitor_name, monitor_addr, monitor_type, monitor_status, collect_device_id, build_id, ancestors, grade, correct_value, is_ammeter, line_name, line_length, line_status, power_capacity, water_capacity, dept_id, user_id, create_by, create_time, update_by, update_time from base_line_monitor + select blm.objid, + blm.parent_id, + blm.monitor_id, + bmi.monitor_name, + bmi.monitor_addr, + blm.monitor_type, + blm.monitor_status, + blm.collect_device_id, + blm.build_id, + blm.ancestors, + blm.grade, + blm.correct_value, + blm.is_ammeter, + blm.line_name, + blm.line_length, + blm.line_status, + blm.power_capacity, + blm.water_capacity, + blm.dept_id, + blm.user_id, + blm.create_by, + blm.create_time, + blm.update_by, + blm.update_time + from base_line_monitor blm + left join base_monitor_info bmi on blm.monitor_id = bmi.monitor_id diff --git a/op-modules/op-energy/src/main/resources/mapper/report/ReportPointDnbMapper.xml b/op-modules/op-energy/src/main/resources/mapper/report/ReportPointDnbMapper.xml index 84af652d..04d8d248 100644 --- a/op-modules/op-energy/src/main/resources/mapper/report/ReportPointDnbMapper.xml +++ b/op-modules/op-energy/src/main/resources/mapper/report/ReportPointDnbMapper.xml @@ -88,13 +88,13 @@ (SELECT t.monitor_id FROM base_monitor_info t WHERE dbo.FIND_IN_SET(#{monitorSubset}, ancestors) > 0)) - and begin_time between #{params.beginBeginTime} and #{params.endBeginTime} + and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime} - and begin_time between #{params.startTime} and #{params.endTime} + and CONVERT(VARCHAR(17), begin_time, 120) between #{params.startTime} and #{params.endTime} - and begin_time between #{params.beginCollectTime} and #{params.endCollectTime} + and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime} and end_time = #{endTime} and record_time = #{recordTime} @@ -220,9 +220,8 @@ rpd.monitor_id monitorId, m.monitor_name monitorName, m.monitor_addr address, - sum(isnull(ert.expend,0)) expend, + sum(isnull(rpd.expend,0)) expend, max(rpd.meter_value) meterValue, - GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser, concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange, m.monitor_hierarchy monitorHierarchy, m.grade @@ -243,7 +242,7 @@ left join base_public_user bpu on bmp.public_share_id = bpu.id - and left(CONVERT(VARCHAR(17), rpd.begin_time, 120)e,10) between #{beginCollectTime} and #{endCollectTime} + and left(CONVERT(VARCHAR(17), rpd.begin_time, 120),10) between #{beginCollectTime} and #{endCollectTime} and rpd.monitor_id IN