diff --git a/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html b/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html index 18936e6..7018069 100644 --- a/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html +++ b/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html @@ -93,19 +93,20 @@ exportExcel(document.getElementById("bootstrap-table").outerHTML, "测控点整点报表.xls") } - function newSearh(){ - let dateList= getHoursBetween($("#laydate-demo-3").val(),$("#laydate-demo-4").val()); + function reloadTable() { + let startTime = $("#laydate-demo-3").val(); + let endTime = $("#laydate-demo-4").val(); + if (!startTime || !endTime) { + return; + } + let dateList = getHoursBetween(startTime, endTime); $('#bootstrap-table').bootstrapTable('destroy'); initTable(dateList); - // $.table.search(); } - $(function () { - const formattedDate = new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai', hour12: false }).slice(0, 13) + ':00:00'; - let dateList = getHoursBetween(formattedDate, formattedDate) - initTable(dateList); - }); - + function newSearh(){ + reloadTable(); + } function initTable(columns){ let timeList = []; @@ -172,7 +173,7 @@ function zOnClick(event, treeId, treeNode) { $("#monitorId").val(treeNode.id); - $.table.search(); + reloadTable(); } } @@ -230,6 +231,8 @@ trigger: 'click', value: formattedEnd // 为第二个选择器设置默认值为今天 }); + + reloadTable(); }); /* 测控点信息 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DataAnalysisServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DataAnalysisServiceImpl.java index ddfab7d..b8eb027 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DataAnalysisServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DataAnalysisServiceImpl.java @@ -208,20 +208,26 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService { @Override public List> pointTimeSiteReport(Map map) { List> resultList = new ArrayList<>(); - if (String.valueOf(map.get("startTime")).equals("") || String.valueOf(map.get("endTime")).equals("")){ + Object startTime = map.get("startTime"); + Object endTime = map.get("endTime"); + if (startTime == null || endTime == null + || StringUtils.isEmpty(String.valueOf(startTime)) + || StringUtils.isEmpty(String.valueOf(endTime))) { return resultList; } - String monitorId = String.valueOf(map.get("monitorId")); - T_Monitor tMonitor = new T_Monitor(); - tMonitor.setpMonitorid(monitorId); - List tMonitors = t_MonitorMapper.selectT_MonitorList(tMonitor); - if (!tMonitors.isEmpty()) { - List monitorIdList = tMonitors.stream().map(T_Monitor::getMonitorId).collect(Collectors.toList()); - map.put("monitorIdList", monitorIdList); - map.remove(("monitorId")); + String monitorId = map.get("monitorId") == null ? "" : String.valueOf(map.get("monitorId")).trim(); + if (StringUtils.isNotEmpty(monitorId) && !"null".equalsIgnoreCase(monitorId)) { + T_Monitor tMonitor = new T_Monitor(); + tMonitor.setpMonitorid(monitorId); + List tMonitors = t_MonitorMapper.selectT_MonitorList(tMonitor); + if (!tMonitors.isEmpty()) { + List monitorIdList = tMonitors.stream().map(T_Monitor::getMonitorId).collect(Collectors.toList()); + map.put("monitorIdList", monitorIdList); + map.remove("monitorId"); + } } List> repPointTempertures = repPointTempertureMapper.selectpointTimeSiteReport(map); - resultList = transform(repPointTempertures); + resultList = transform(repPointTempertures); return resultList; } @@ -240,7 +246,8 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService { String monitorId = originalMap.get("monitorId"); String monitorName = originalMap.get("monitorName"); String pointTime = String.valueOf(originalMap.get("pointTime")); - String expend = String.valueOf(originalMap.get("expend")); + Object expendValue = originalMap.get("expend"); + String expend = expendValue == null ? "" : String.valueOf(expendValue); resultMap.put("monitorId",monitorId); resultMap.put("monitorName",monitorName); resultMap.put("expend"+ pointTime,expend); diff --git a/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml index d259e24..28d830c 100644 --- a/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml @@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select TM.monitorName monitorName, pt.MonitorID monitorId, pt.Tempreture expend, - CONVERT(varchar(16), pt.beginTime, 120) + ':00' pointTime + CONVERT(varchar(13), pt.beginTime, 120) + ':00:00' pointTime from Rep_Point_Temperture pt left join T_Monitor TM on pt.MonitorID = TM.monitorId WHERE TM.monitorId IS NOT NULL @@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{monitorId} - order by pt.MonitorID + order by pt.MonitorID, pt.beginTime