ebb278a6 张雷

奥体项目数据报表接口修改

1 个父辈 a30d7c24
...@@ -39,7 +39,7 @@ public class OlympicCenterController { ...@@ -39,7 +39,7 @@ public class OlympicCenterController {
39 return result; 39 return result;
40 } 40 }
41 41
42 @ApiOperation(value="获取整体实时数据", notes="获取整体实时数据") 42 @ApiOperation(value="获取整体实时数据new", notes="获取整体实时数据new")
43 @GetMapping(value = "/getRealTimeDataNew") 43 @GetMapping(value = "/getRealTimeDataNew")
44 public Result<Map<String,Object>> getRealTimeDataNew(String sourceType){ 44 public Result<Map<String,Object>> getRealTimeDataNew(String sourceType){
45 Result<Map<String,Object>> result = new Result<Map<String,Object>>(); 45 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
...@@ -59,7 +59,7 @@ public class OlympicCenterController { ...@@ -59,7 +59,7 @@ public class OlympicCenterController {
59 return result; 59 return result;
60 } 60 }
61 61
62 @ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE") 62 @ApiOperation(value="新获取整体实时数据给UE", notes="新获取整体实时数据给UE")
63 @GetMapping(value = "/getRealTimeDataToUENew") 63 @GetMapping(value = "/getRealTimeDataToUENew")
64 public Result<Map<String,Object>> getRealTimeDataToUENew(){ 64 public Result<Map<String,Object>> getRealTimeDataToUENew(){
65 Result<Map<String,Object>> result = new Result<Map<String,Object>>(); 65 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
...@@ -128,7 +128,7 @@ public class OlympicCenterController { ...@@ -128,7 +128,7 @@ public class OlympicCenterController {
128 return result; 128 return result;
129 } 129 }
130 130
131 @ApiOperation(value="获取趋势图", notes="获取趋势图") 131 @ApiOperation(value="获取趋势图new", notes="获取趋势图new")
132 @GetMapping(value = "/getPressureChartNew") 132 @GetMapping(value = "/getPressureChartNew")
133 public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){ 133 public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){
134 Result<List<EchartResult>> result = new Result<List<EchartResult>>(); 134 Result<List<EchartResult>> result = new Result<List<EchartResult>>();
...@@ -139,4 +139,26 @@ public class OlympicCenterController { ...@@ -139,4 +139,26 @@ public class OlympicCenterController {
139 return result; 139 return result;
140 } 140 }
141 141
142 @ApiOperation(value="获取流量计详细数据", notes="获取流量计详细数据")
143 @GetMapping(value = "/getFlowData")
144 public Result<List<Map<String,Object>>> getFlowData(String equipId){
145 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
146 List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
147 list = olympicCenterService.getFlowData(equipId);
148 result.setResult(list);
149 result.setSuccess(true);
150 return result;
151 }
152
153 @ApiOperation(value="获取实时数据报表", notes="获取实时数据报表")
154 @GetMapping(value = "/getRealTimeReport")
155 public Result<List<Map<String,Object>>> getRealTimeReport(String dataType,String loction){
156 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
157 List<Map<String,Object>> list = new ArrayList<>();
158 list = olympicCenterService.getRealTimeReport(dataType, loction);
159 result.setResult(list);
160 result.setSuccess(true);
161 return result;
162 }
163
142 } 164 }
......
...@@ -44,6 +44,9 @@ public class WhatStructData { ...@@ -44,6 +44,9 @@ public class WhatStructData {
44 /**点实时值*/ 44 /**点实时值*/
45 @ApiModelProperty(value = "点实时值") 45 @ApiModelProperty(value = "点实时值")
46 private String monitorValue; 46 private String monitorValue;
47 /**缩放倍数*/
48 @ApiModelProperty(value = "缩放倍数")
49 private String monitorZoom;
47 /**所属泵站*/ 50 /**所属泵站*/
48 @ApiModelProperty(value = "所属泵站") 51 @ApiModelProperty(value = "所属泵站")
49 private String pumpCode; 52 private String pumpCode;
......
...@@ -21,4 +21,10 @@ public interface WhatStructDataMapper { ...@@ -21,4 +21,10 @@ public interface WhatStructDataMapper {
21 List<WhatStructData> getDataList(@Param("equipId") String equipId); 21 List<WhatStructData> getDataList(@Param("equipId") String equipId);
22 22
23 List<WhatStructData> getListForUENew(); 23 List<WhatStructData> getListForUENew();
24
25 List<WhatStructData> getFlowList(@Param("loction") String loction);
26
27 List<WhatStructData> getPressureList(@Param("loction") String loction);
28
29 List<WhatStructData> getTemperatureList(@Param("loction") String loction);
24 } 30 }
......
...@@ -33,4 +33,25 @@ ...@@ -33,4 +33,25 @@
33 select * from what_struct_data_bak order by monitor_sort 33 select * from what_struct_data_bak order by monitor_sort
34 </select> 34 </select>
35 35
36 <select id="getFlowList" resultType="com.skua.modules.business.entity.WhatStructData">
37 select * from what_struct_data_bak where equip_type like CONCAT('flow','%')
38 <if test="loction!=null and loction!=''">
39 and pump_code = #{loction}
40 </if>
41 </select>
42
43 <select id="getPressureList" resultType="com.skua.modules.business.entity.WhatStructData">
44 select * from what_struct_data_bak where equip_type like CONCAT('pressure','%')
45 <if test="loction!=null and loction!=''">
46 and pump_code = #{loction}
47 </if>
48 </select>
49
50 <select id="getTemperatureList" resultType="com.skua.modules.business.entity.WhatStructData">
51 select * from what_struct_data_bak where equip_type like CONCAT('temperature','%')
52 <if test="loction!=null and loction!=''">
53 and pump_code = #{loction}
54 </if>
55 </select>
56
36 </mapper> 57 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -27,4 +27,8 @@ public interface IOlympicCenterService { ...@@ -27,4 +27,8 @@ public interface IOlympicCenterService {
27 List<EchartResult> getPressureChartNew(String equipId, String type); 27 List<EchartResult> getPressureChartNew(String equipId, String type);
28 28
29 Map<String, Object> getRealTimeDataToUENew(); 29 Map<String, Object> getRealTimeDataToUENew();
30
31 List<Map<String, Object>> getFlowData(String equipId);
32
33 List<Map<String, Object>> getRealTimeReport(String dataType, String loction);
30 } 34 }
......
...@@ -10,4 +10,6 @@ public interface IFmPgQueryService { ...@@ -10,4 +10,6 @@ public interface IFmPgQueryService {
10 10
11 List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields); 11 List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields);
12 12
13 List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields);
14
13 } 15 }
......
...@@ -11,7 +11,7 @@ import java.text.SimpleDateFormat; ...@@ -11,7 +11,7 @@ import java.text.SimpleDateFormat;
11 import java.util.*; 11 import java.util.*;
12 12
13 /** 13 /**
14 * 数据指标信息表 14 * 实时数据查询
15 */ 15 */
16 @Service 16 @Service
17 public class FmPgQueryServiceImpl implements IFmPgQueryService { 17 public class FmPgQueryServiceImpl implements IFmPgQueryService {
...@@ -94,4 +94,44 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -94,4 +94,44 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
94 } 94 }
95 return timeStemp/1000; 95 return timeStemp/1000;
96 } 96 }
97
98 @Override
99 public List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields) {
100 String[] factoryIdArray = factoryId.split(",");
101 String sqlPart = "";
102 for(String id : factoryIdArray) {
103 sqlPart = sqlPart +",'"+id+"'";
104 }
105 sqlPart = sqlPart.substring(1);
106 JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
107 List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
108 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
109 List<Map<String, Object>> factoryDesign = masterDB
110 .queryForList("select * from sys_factory_device where factory_id in ("+sqlPart+")");
111 if(factoryDesign==null||factoryDesign.size()==0) {
112 return result;
113 }
114 StringBuilder str = new StringBuilder();
115 String[] fieldsArr = fields.split(",");
116 for (int i = 0; i < fieldsArr.length; ++i){
117 if(!StringUtils.isEmpty(fieldsArr[i])&&!fieldsArr[i].equals("null")) {
118 str.append("'"+fieldsArr[i]+"'").append(",");
119 }
120 }
121 if(fieldsArr.length > 0){
122 str.append("''");
123 }else{
124 return result;
125 }
126 String deviceIds = "";
127 for(Map<String,Object> map: factoryDesign) {
128 deviceIds = deviceIds +",'"+map.get("device_id")+"'";
129 }
130 deviceIds = deviceIds.substring(1);
131
132 //获取pg数据库时间,向前推采集频率的三倍时间,做数据容错
133 String sql = "select ts as time,nm as monitorId,v as monitorValue from realtimedata where nm in("+str.toString()+") and factoryname in ("+deviceIds+")";
134 result = pgDb.queryForList(sql);
135 return result;
136 }
97 } 137 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!