98eca395 张雷

奥体项目实时数据接口开发

1 个父辈 42db58e6
......@@ -39,6 +39,16 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE")
@GetMapping(value = "/getRealTimeDataToUE")
public Result<Map<String,Object>> getRealTimeDataToUE(){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = olympicCenterService.getRealTimeDataToUE();
result.setResult(map);
result.setSuccess(true);
return result;
}
/**
* 获取泵站指标历史趋势曲线
* @param field ssll:瞬时流量 ljll:累计流量 rll:日流量
......
package com.skua.modules.business.mapper;
import com.skua.modules.business.entity.WhatStructData;
import java.util.List;
/**
* 武汉奥体中心接口
*/
public interface WhatStructDataMapper {
List<WhatStructData> getList();
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.business.mapper.WhatStructDataMapper">
<select id="getList" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data
</select>
</mapper>
\ No newline at end of file
......@@ -19,4 +19,6 @@ public interface IOlympicCenterService {
List<EchartResult> getPressureChart(String equipId,String type);
Map<String, Object> getBzRealTimeData(String sourceType);
Map<String, Object> getRealTimeDataToUE();
}
......
package com.skua.modules.business.service.impl;
import com.skua.core.service.IPgQueryService;
import com.skua.modules.business.entity.WhatStructData;
import com.skua.modules.business.mapper.WhatStructDataMapper;
import com.skua.modules.business.service.IOlympicCenterService;
import com.skua.modules.business.vo.EchartResult;
import com.skua.modules.business.vo.TextResult;
import com.skua.modules.equip.mapper.FmEquipInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -18,6 +21,8 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
// @Autowired
// private IPgQueryService pgQueryService;
@Autowired
private WhatStructDataMapper whatStructDataMapper;
@Override
public Map<String,Object> getRealTimeData(String sourceType) {
......@@ -35,7 +40,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
TextResult textResult = new TextResult();
textResult.setTitle("压力表"+(i+1));
if(i==8){
textResult.setValue("0.41");
textResult.setValue("0.04");
}else{
textResult.setValue("0.00");
}
......@@ -91,7 +96,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
TextResult textResult = new TextResult();
textResult.setTitle("压力表"+(i+1));
if(i==8){
textResult.setValue("0.41");
textResult.setValue("0.041");
}else{
textResult.setValue("0.00");
}
......@@ -258,6 +263,38 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return map;
}
@Override
public Map<String, Object> getRealTimeDataToUE() {
List<WhatStructData> list = whatStructDataMapper.getList();
Map<String, Object> map = new HashMap<>();
List<WhatStructData> pAtList = new ArrayList<>();
List<WhatStructData> fAtList = new ArrayList<>();
List<WhatStructData> wAtList = new ArrayList<>();
for (WhatStructData whatStructData:list) {
if("pressure".equals(whatStructData.getEquipType())){
pAtList.add(whatStructData);
}else if("flow".equals(whatStructData.getEquipType())){
fAtList.add(whatStructData);
}else if("temperature".equals(whatStructData.getEquipType())){
wAtList.add(whatStructData);
}else{ }
}
for (int i = 0; i < pAtList.size(); i++) {
if("205".equals(pAtList.get(i).getId())){
map.put(pAtList.get(i).getId(),"0.04");
}else{
map.put(pAtList.get(i).getId(),"0.00");
}
}
for (int j = 0; j < fAtList.size(); j++) {
map.put(fAtList.get(j).getId(),"0.00");
}
for (int k = 0; k < wAtList.size(); k++) {
map.put(wAtList.get(k).getId(),"--");
}
return map;
}
public static void main(String[] args) {
for (int i = 0; i < 24; i++) {
Calendar date = Calendar.getInstance();
......
......@@ -98,9 +98,9 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://120.24.205.69:10086/postgres?useUnicode=true&characterEncoding=UTF8
url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
username: postgres
password: Sever@3202_Jksc$
password: JKjnf9713xt
driver-class-name: org.postgresql.Driver
#redis 配置
redis:
......
......@@ -98,8 +98,8 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:mysql://192.168.21.6:13306/zhsw_modules?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: root
url: jdbc:postgresql://192.168.21.5:10086/postgres?useUnicode=true&characterEncoding=UTF8
username: postgres
password: jkauto@123wh
driver-class-name: org.postgresql.Driver
#redis 配置
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!