ebb278a6 张雷

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

1 个父辈 a30d7c24
......@@ -39,7 +39,7 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取整体实时数据", notes="获取整体实时数据")
@ApiOperation(value="获取整体实时数据new", notes="获取整体实时数据new")
@GetMapping(value = "/getRealTimeDataNew")
public Result<Map<String,Object>> getRealTimeDataNew(String sourceType){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
......@@ -59,7 +59,7 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE")
@ApiOperation(value="新获取整体实时数据给UE", notes="新获取整体实时数据给UE")
@GetMapping(value = "/getRealTimeDataToUENew")
public Result<Map<String,Object>> getRealTimeDataToUENew(){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
......@@ -128,7 +128,7 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取趋势图", notes="获取趋势图")
@ApiOperation(value="获取趋势图new", notes="获取趋势图new")
@GetMapping(value = "/getPressureChartNew")
public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){
Result<List<EchartResult>> result = new Result<List<EchartResult>>();
......@@ -139,4 +139,26 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取流量计详细数据", notes="获取流量计详细数据")
@GetMapping(value = "/getFlowData")
public Result<List<Map<String,Object>>> getFlowData(String equipId){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
list = olympicCenterService.getFlowData(equipId);
result.setResult(list);
result.setSuccess(true);
return result;
}
@ApiOperation(value="获取实时数据报表", notes="获取实时数据报表")
@GetMapping(value = "/getRealTimeReport")
public Result<List<Map<String,Object>>> getRealTimeReport(String dataType,String loction){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<>();
list = olympicCenterService.getRealTimeReport(dataType, loction);
result.setResult(list);
result.setSuccess(true);
return result;
}
}
......
......@@ -44,6 +44,9 @@ public class WhatStructData {
/**点实时值*/
@ApiModelProperty(value = "点实时值")
private String monitorValue;
/**缩放倍数*/
@ApiModelProperty(value = "缩放倍数")
private String monitorZoom;
/**所属泵站*/
@ApiModelProperty(value = "所属泵站")
private String pumpCode;
......
......@@ -21,4 +21,10 @@ public interface WhatStructDataMapper {
List<WhatStructData> getDataList(@Param("equipId") String equipId);
List<WhatStructData> getListForUENew();
List<WhatStructData> getFlowList(@Param("loction") String loction);
List<WhatStructData> getPressureList(@Param("loction") String loction);
List<WhatStructData> getTemperatureList(@Param("loction") String loction);
}
......
......@@ -33,4 +33,25 @@
select * from what_struct_data_bak order by monitor_sort
</select>
<select id="getFlowList" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data_bak where equip_type like CONCAT('flow','%')
<if test="loction!=null and loction!=''">
and pump_code = #{loction}
</if>
</select>
<select id="getPressureList" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data_bak where equip_type like CONCAT('pressure','%')
<if test="loction!=null and loction!=''">
and pump_code = #{loction}
</if>
</select>
<select id="getTemperatureList" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data_bak where equip_type like CONCAT('temperature','%')
<if test="loction!=null and loction!=''">
and pump_code = #{loction}
</if>
</select>
</mapper>
\ No newline at end of file
......
......@@ -27,4 +27,8 @@ public interface IOlympicCenterService {
List<EchartResult> getPressureChartNew(String equipId, String type);
Map<String, Object> getRealTimeDataToUENew();
List<Map<String, Object>> getFlowData(String equipId);
List<Map<String, Object>> getRealTimeReport(String dataType, String loction);
}
......
......@@ -10,4 +10,6 @@ public interface IFmPgQueryService {
List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields);
List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields);
}
......
......@@ -11,7 +11,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
/**
* 数据指标信息表
* 实时数据查询
*/
@Service
public class FmPgQueryServiceImpl implements IFmPgQueryService {
......@@ -94,4 +94,44 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
}
return timeStemp/1000;
}
@Override
public List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields) {
String[] factoryIdArray = factoryId.split(",");
String sqlPart = "";
for(String id : factoryIdArray) {
sqlPart = sqlPart +",'"+id+"'";
}
sqlPart = sqlPart.substring(1);
JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
List<Map<String, Object>> factoryDesign = masterDB
.queryForList("select * from sys_factory_device where factory_id in ("+sqlPart+")");
if(factoryDesign==null||factoryDesign.size()==0) {
return result;
}
StringBuilder str = new StringBuilder();
String[] fieldsArr = fields.split(",");
for (int i = 0; i < fieldsArr.length; ++i){
if(!StringUtils.isEmpty(fieldsArr[i])&&!fieldsArr[i].equals("null")) {
str.append("'"+fieldsArr[i]+"'").append(",");
}
}
if(fieldsArr.length > 0){
str.append("''");
}else{
return result;
}
String deviceIds = "";
for(Map<String,Object> map: factoryDesign) {
deviceIds = deviceIds +",'"+map.get("device_id")+"'";
}
deviceIds = deviceIds.substring(1);
//获取pg数据库时间,向前推采集频率的三倍时间,做数据容错
String sql = "select ts as time,nm as monitorId,v as monitorValue from realtimedata where nm in("+str.toString()+") and factoryname in ("+deviceIds+")";
result = pgDb.queryForList(sql);
return result;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!