diff --git a/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html b/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html index 2489b3c..18936e6 100644 --- a/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html +++ b/ruoyi-admin/src/main/resources/templates/board/pointTimeSiteReport.html @@ -196,16 +196,39 @@ layui.use('laydate', function () { var laydate = layui.laydate; + var today = new Date(); + var startOfToday = new Date(today); + startOfToday.setHours(0, 0, 0, 0); // 将时、分、秒、毫秒全部归零 + var endOfToday = new Date(today); + endOfToday.setHours(23, 59, 59, 999); // 设置为当天最后一毫秒 + // 格式化开始时间 + var formattedStart = startOfToday.getFullYear() + '-' + + String(startOfToday.getMonth() + 1).padStart(2, '0') + '-' + + String(startOfToday.getDate()).padStart(2, '0') + ' ' + + String(startOfToday.getHours()).padStart(2, '0') + ':' + + String(startOfToday.getMinutes()).padStart(2, '0') + ':' + + String(startOfToday.getSeconds()).padStart(2, '0'); + + // 格式化结束时间 + var formattedEnd = endOfToday.getFullYear() + '-' + + String(endOfToday.getMonth() + 1).padStart(2, '0') + '-' + + String(endOfToday.getDate()).padStart(2, '0') + ' ' + + String(endOfToday.getHours()).padStart(2, '0') + ':' + + String(endOfToday.getMinutes()).padStart(2, '0') + ':' + + String(endOfToday.getSeconds()).padStart(2, '0'); + laydate.render({ elem: '#laydate-demo-3', type: 'datetime', - trigger: 'click' + trigger: 'click', + value: formattedStart // 为第一个选择器设置默认值为今天 }); laydate.render({ elem: '#laydate-demo-4', type: 'datetime', - trigger: 'click' + trigger: 'click', + value: formattedEnd // 为第二个选择器设置默认值为今天 }); }); 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 442fd48..ddfab7d 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 @@ -3,10 +3,7 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.*; -import com.ruoyi.system.mapper.BaseLineLossMapper; -import com.ruoyi.system.mapper.BaseLineMonitorMapper; -import com.ruoyi.system.mapper.RepPointTempertureMapper; -import com.ruoyi.system.mapper.Rep_Work_Point_DnbMapper; +import com.ruoyi.system.mapper.*; import com.ruoyi.system.service.IDataAnalysisService; import com.ruoyi.system.service.IRep_Work_Point_DnbService; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +41,9 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService { @Autowired private RepPointTempertureMapper repPointTempertureMapper; + @Autowired + private T_MonitorMapper t_MonitorMapper; + /** * 线损分析返回数据 * @@ -211,7 +211,15 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService { if (String.valueOf(map.get("startTime")).equals("") || String.valueOf(map.get("endTime")).equals("")){ 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")); + } List> repPointTempertures = repPointTempertureMapper.selectpointTimeSiteReport(map); resultList = transform(repPointTempertures); return resultList; diff --git a/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml index f1d9d82..d259e24 100644 --- a/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/RepPointTempertureMapper.xml @@ -54,6 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pt.beginTime between #{startTime} and #{endTime} + + and pt.MonitorID IN + + #{monitorId} + + order by pt.MonitorID