奥体项目时间粒度修改
正在显示
4 个修改的文件
包含
34 行增加
和
14 行删除
... | @@ -6,6 +6,7 @@ import com.skua.modules.business.service.ISynthesizeService; | ... | @@ -6,6 +6,7 @@ import com.skua.modules.business.service.ISynthesizeService; |
6 | import com.skua.modules.business.vo.AlarmParams; | 6 | import com.skua.modules.business.vo.AlarmParams; |
7 | import com.skua.modules.business.vo.EchartResult; | 7 | import com.skua.modules.business.vo.EchartResult; |
8 | import com.skua.modules.business.vo.InputQueryParams; | 8 | import com.skua.modules.business.vo.InputQueryParams; |
9 | import com.skua.modules.business.vo.ReportParams; | ||
9 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
10 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
11 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
... | @@ -142,10 +143,10 @@ public class OlympicCenterController { | ... | @@ -142,10 +143,10 @@ public class OlympicCenterController { |
142 | 143 | ||
143 | @ApiOperation(value="获取趋势图new", notes="获取趋势图new") | 144 | @ApiOperation(value="获取趋势图new", notes="获取趋势图new") |
144 | @GetMapping(value = "/getHistoryTrends") | 145 | @GetMapping(value = "/getHistoryTrends") |
145 | public Result<List<EchartResult>> getHistoryTrends(String equipId,String type){ | 146 | public Result<List<EchartResult>> getHistoryTrends(ReportParams reportParams){ |
146 | Result<List<EchartResult>> result = new Result<List<EchartResult>>(); | 147 | Result<List<EchartResult>> result = new Result<List<EchartResult>>(); |
147 | List<EchartResult> list = new ArrayList<EchartResult>(); | 148 | List<EchartResult> list = new ArrayList<EchartResult>(); |
148 | list = olympicCenterService.getHistoryTrends(equipId,type); | 149 | list = olympicCenterService.getHistoryTrends(reportParams); |
149 | result.setResult(list); | 150 | result.setResult(list); |
150 | result.setSuccess(true); | 151 | result.setSuccess(true); |
151 | return result; | 152 | return result; | ... | ... |
... | @@ -3,6 +3,7 @@ package com.skua.modules.business.service; | ... | @@ -3,6 +3,7 @@ package com.skua.modules.business.service; |
3 | import com.skua.modules.business.vo.AlarmParams; | 3 | import com.skua.modules.business.vo.AlarmParams; |
4 | import com.skua.modules.business.vo.EchartResult; | 4 | import com.skua.modules.business.vo.EchartResult; |
5 | import com.skua.modules.business.vo.InputQueryParams; | 5 | import com.skua.modules.business.vo.InputQueryParams; |
6 | import com.skua.modules.business.vo.ReportParams; | ||
6 | 7 | ||
7 | import java.util.List; | 8 | import java.util.List; |
8 | import java.util.Map; | 9 | import java.util.Map; |
... | @@ -26,7 +27,7 @@ public interface IOlympicCenterService { | ... | @@ -26,7 +27,7 @@ public interface IOlympicCenterService { |
26 | 27 | ||
27 | Map<String, Object> getRealTimeDataNew(String sourceType); | 28 | Map<String, Object> getRealTimeDataNew(String sourceType); |
28 | 29 | ||
29 | List<EchartResult> getHistoryTrends(String equipId, String type); | 30 | List<EchartResult> getHistoryTrends(ReportParams reportParams); |
30 | 31 | ||
31 | Map<String, Object> getRealTimeDataToUENew(); | 32 | Map<String, Object> getRealTimeDataToUENew(); |
32 | 33 | ... | ... |
... | @@ -5,10 +5,7 @@ import com.skua.core.service.IFactoryInfoService; | ... | @@ -5,10 +5,7 @@ import com.skua.core.service.IFactoryInfoService; |
5 | import com.skua.modules.business.entity.WhatStructData; | 5 | import com.skua.modules.business.entity.WhatStructData; |
6 | import com.skua.modules.business.mapper.WhatStructDataMapper; | 6 | import com.skua.modules.business.mapper.WhatStructDataMapper; |
7 | import com.skua.modules.business.service.IOlympicCenterService; | 7 | import com.skua.modules.business.service.IOlympicCenterService; |
8 | import com.skua.modules.business.vo.AlarmParams; | 8 | import com.skua.modules.business.vo.*; |
9 | import com.skua.modules.business.vo.EchartResult; | ||
10 | import com.skua.modules.business.vo.InputQueryParams; | ||
11 | import com.skua.modules.business.vo.TextResult; | ||
12 | import com.skua.modules.monitor.service.IFmPgQueryService; | 9 | import com.skua.modules.monitor.service.IFmPgQueryService; |
13 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
14 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
... | @@ -928,9 +925,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -928,9 +925,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
928 | } | 925 | } |
929 | 926 | ||
930 | @Override | 927 | @Override |
931 | public List<EchartResult> getHistoryTrends(String equipId, String type) { | 928 | public List<EchartResult> getHistoryTrends(ReportParams reportParams) { |
932 | List<EchartResult> list = new ArrayList<>(); | 929 | List<EchartResult> list = new ArrayList<>(); |
933 | List<WhatStructData> wList = whatStructDataMapper.getDataList(equipId); | 930 | List<WhatStructData> wList = whatStructDataMapper.getDataList(reportParams.getEquipId()); |
931 | String type = reportParams.getType(); | ||
932 | String start = reportParams.getStartDate() + " 00:00:00"; | ||
933 | String end = reportParams.getEndDate() + " 23:59:59"; | ||
934 | String pgField = ""; | 934 | String pgField = ""; |
935 | if(wList.size() == 0){ | 935 | if(wList.size() == 0){ |
936 | return list; | 936 | return list; |
... | @@ -939,12 +939,14 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -939,12 +939,14 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
939 | pgField = pgField +","+whatStructData.getMonitorId(); | 939 | pgField = pgField +","+whatStructData.getMonitorId(); |
940 | } | 940 | } |
941 | } | 941 | } |
942 | if(reportParams.getStartDate()==null||reportParams.getEndDate()==null){ | ||
942 | Calendar cal = Calendar.getInstance(); | 943 | Calendar cal = Calendar.getInstance(); |
943 | cal.add(Calendar.DATE, -7); | 944 | cal.add(Calendar.DATE, -7); |
944 | String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); | 945 | String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); |
945 | String start = startDate + " 00:00:00"; | 946 | start = startDate + " 00:00:00"; |
946 | String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 947 | String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
947 | String end = endDate + " 23:59:59"; | 948 | end = endDate + " 23:59:59"; |
949 | } | ||
948 | List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour"); | 950 | List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour"); |
949 | if(dataList.size()>0){ | 951 | if(dataList.size()>0){ |
950 | for (Map<String, Object> map:dataList) { | 952 | for (Map<String, Object> map:dataList) { |
... | @@ -1922,16 +1924,16 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1922,16 +1924,16 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1922 | } | 1924 | } |
1923 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 1925 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
1924 | Date now = new Date(); | 1926 | Date now = new Date(); |
1925 | // System.out.println("当前时间为:" + dateFormat.format(now)); | ||
1926 | Date before = new Date(now.getTime() - minute * 60 * 1000); | 1927 | Date before = new Date(now.getTime() - minute * 60 * 1000); |
1927 | // System.out.println("之前的时间为:" + dateFormat.format(before)); | ||
1928 | List<Map<String, Object>> list = new ArrayList<>(); | 1928 | List<Map<String, Object>> list = new ArrayList<>(); |
1929 | JdbcTemplate alarmDB = (JdbcTemplate) SpringContextUtils.getBean("mysql-alarm"); | 1929 | JdbcTemplate alarmDB = (JdbcTemplate) SpringContextUtils.getBean("mysql-alarm"); |
1930 | list = alarmDB.queryForList("select alarm_content as alarmContent,alarm_param_code as alarmParamCode " + | 1930 | list = alarmDB.queryForList("select max(record_time) as recordTime,alarm_param_name as alarmParamName," + |
1931 | " alarm_content as alarmContent,alarm_param_code as alarmParamCode " + | ||
1931 | " from alert_record_history " + | 1932 | " from alert_record_history " + |
1932 | " where handle_status = 0 " + | 1933 | " where handle_status = 0 " + |
1933 | " and alarm_param_code like '"+AT_ID+"_%' " + | 1934 | " and alarm_param_code like '"+AT_ID+"_%' " + |
1934 | " and record_time between '"+dateFormat.format(before)+"' and '"+dateFormat.format(now)+"' " + | 1935 | " and record_time between '"+dateFormat.format(before)+"' and '"+dateFormat.format(now)+"' " + |
1936 | " GROUP BY alarm_param_name " + | ||
1935 | " ORDER BY record_time"); | 1937 | " ORDER BY record_time"); |
1936 | return list; | 1938 | return list; |
1937 | } | 1939 | } | ... | ... |
-
请 注册 或 登录 后发表评论