d07e8068 张雷

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

1 个父辈 ebb278a6
......@@ -129,11 +129,11 @@ public class OlympicCenterController {
}
@ApiOperation(value="获取趋势图new", notes="获取趋势图new")
@GetMapping(value = "/getPressureChartNew")
public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){
@GetMapping(value = "/getHistoryTrends")
public Result<List<EchartResult>> getHistoryTrends(String equipId,String type){
Result<List<EchartResult>> result = new Result<List<EchartResult>>();
List<EchartResult> list = new ArrayList<EchartResult>();
list = olympicCenterService.getPressureChartNew(equipId,type);
list = olympicCenterService.getHistoryTrends(equipId,type);
result.setResult(list);
result.setSuccess(true);
return result;
......@@ -161,4 +161,25 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取泵站实时数据", notes="获取泵站实时数据")
@GetMapping(value = "/getPumpRealTimeData")
public Result<Map<String,Object>> getPumpRealTimeData(String sourceType,String pumpId){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = olympicCenterService.getPumpRealTimeData(sourceType, pumpId);
result.setResult(map);
result.setSuccess(true);
return result;
}
@ApiOperation(value="获取设备状态表格", notes="获取设备状态表格")
@GetMapping(value = "/getPumpRealTimeReport")
public Result<List<Map<String,Object>>> getPumpRealTimeReport(String sourceType){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<>();
list = olympicCenterService.getPumpRealTimeReport(sourceType);
result.setResult(list);
result.setSuccess(true);
return result;
}
}
......
......@@ -27,4 +27,8 @@ public interface WhatStructDataMapper {
List<WhatStructData> getPressureList(@Param("loction") String loction);
List<WhatStructData> getTemperatureList(@Param("loction") String loction);
List<WhatStructData> getEquipDataList(@Param("sourceType") String sourceType, @Param("pumpId") String pumpId);
List<WhatStructData> getEquipDataListBySource(@Param("sourceType") String sourceType);
}
......
......@@ -54,4 +54,14 @@
</if>
</select>
<select id="getEquipDataList" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data_bak
where pump_code = #{sourceType} and equip_code = #{pumpId}
</select>
<select id="getEquipDataListBySource" resultType="com.skua.modules.business.entity.WhatStructData">
select * from what_struct_data_bak
where pump_code = #{sourceType}
</select>
</mapper>
\ No newline at end of file
......
......@@ -24,11 +24,15 @@ public interface IOlympicCenterService {
Map<String, Object> getRealTimeDataNew(String sourceType);
List<EchartResult> getPressureChartNew(String equipId, String type);
List<EchartResult> getHistoryTrends(String equipId, String type);
Map<String, Object> getRealTimeDataToUENew();
List<Map<String, Object>> getFlowData(String equipId);
List<Map<String, Object>> getRealTimeReport(String dataType, String loction);
Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId);
List<Map<String, Object>> getPumpRealTimeReport(String sourceType);
}
......
......@@ -867,7 +867,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
@Override
public List<EchartResult> getPressureChartNew(String equipId, String type) {
public List<EchartResult> getHistoryTrends(String equipId, String type) {
List<EchartResult> list = new ArrayList<>();
List<WhatStructData> wList = whatStructDataMapper.getDataList(equipId);
String pgField = "";
......@@ -898,8 +898,20 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for (WhatStructData whatStructData:wList) {
EchartResult eResult = new EchartResult();
eResult.setName(map.get("time").toString());
if(whatStructData.getMonitorId()==null){
eResult.setValue("");
}else{
eResult.setValue(map.get(whatStructData.getMonitorId()).toString());
}
if("flow".equals(whatStructData.getEquipType())){
eResult.setSeries("瞬时流量");
}else if("flow_ljll".equals(whatStructData.getEquipType())){
eResult.setSeries("正向累计流量");
}else if("flow_rljll".equals(whatStructData.getEquipType())){
eResult.setSeries("反向累计流量");
}else{
eResult.setSeries(whatStructData.getEquipType());
}
list.add(eResult);
}
}else if("t".equals(type)){
......@@ -1104,15 +1116,172 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
list.add(map);
}
}else if("pressure".equals(dataType)){
return list;
for (WhatStructData whatStructData:wList) {
Map<String, Object> map = new HashMap<>();
map.put("id",whatStructData.getId());
map.put("name",whatStructData.getId());
map.put("time","");
map.put("value","");
for (Map<String, Object> mMap : monitorList ) {
if(whatStructData.getMonitorId()!=null){
if(whatStructData.getMonitorId().equals(mMap.get("monitorid"))){
map.put("time",mMap.get("time"));
map.put("value",formatDouble(Double.parseDouble(mMap.get("monitorvalue").toString())*Double.parseDouble(whatStructData.getMonitorZoom())));
}
}else{
break;
}
}
list.add(map);
}
}else if("temperature".equals(dataType)){
return list;
for (WhatStructData whatStructData:wList) {
Map<String, Object> map = new HashMap<>();
map.put("id",whatStructData.getId());
map.put("name",whatStructData.getId());
map.put("time","");
map.put("value","");
list.add(map);
}
}else{
return list;
}
return list;
}
@Override
public Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId) {
Map<String, Object> map = new HashMap<>();
map.put("status","变频运行");
map.put("runtime","0.6563");
map.put("name",pumpId);
String pgField = "";
List<Map<String, Object>> statusList = new ArrayList<>();
List<WhatStructData> equipList = new ArrayList<>();
equipList = whatStructDataMapper.getEquipDataList(sourceType, pumpId);
if(equipList.size()==0){
return map;
}
Map<String, Object> equipMap = new HashMap<>();
for (WhatStructData whatStructData : equipList) {
pgField = pgField +","+whatStructData.getMonitorId();
if("equip_status".equals(whatStructData.getEquipType())){
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("name",whatStructData.getId());
statusMap.put("monitorid",whatStructData.getMonitorId());
statusList.add(statusMap);
if("0".equals(whatStructData.getMonitorZoom())){
equipMap.put("show_model", "2");//根据两个点判断状态
}else{
equipMap.put("show_model", "1");//根据1个点判断状态
}
}
if("equip_time".equals(whatStructData.getEquipType())){
equipMap.put("runtime",whatStructData.getMonitorId());
}
}
equipMap.put("status",statusList);
Map<String, Object> monitorMap = new HashMap<>();
List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
if(monitorList.size()==1){
monitorMap = monitorList.get(0);
map.put("runtime", monitorMap.get(equipMap.get("runtime").toString()));
String equipStatus = "停止";
if("2".equals(equipMap.get("show_model"))){
equipStatus = getStatus2(monitorMap,statusList,pumpId);
}else{
equipStatus = getStatus1(monitorMap,statusList,pumpId);
}
map.put("status",equipStatus);
}
return map;
}
@Override
public List<Map<String, Object>> getPumpRealTimeReport(String sourceType) {
List<Map<String, Object>> list = new ArrayList<>();
List<WhatStructData> timeList = new ArrayList<>();
List<WhatStructData> equipList = new ArrayList<>();
String pgField = "";
equipList = whatStructDataMapper.getEquipDataListBySource(sourceType);
if(equipList.size()==0){
return null;
}
for (WhatStructData whatStructData : equipList) {
pgField = pgField + "," + whatStructData.getMonitorId();
if("equip_time".equals(whatStructData.getEquipType())){
timeList.add(whatStructData);
}
}
Map<String, Object> monitorMap = new HashMap<>();
List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
if(monitorList.size()==1){
monitorMap = monitorList.get(0);
}
for (WhatStructData whatStructData:timeList) {
List<Map<String, Object>> list1 = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("id",whatStructData.getEquipCode());
map.put("name",whatStructData.getEquipCode());
String equipCode = whatStructData.getEquipCode();
for (WhatStructData whatStructData1 : equipList) {
if(equipCode.equals(whatStructData1.getEquipCode())){
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("name",whatStructData1.getId());
if(whatStructData1.getMonitorId()!=null){
statusMap.put("monitorid",whatStructData1.getMonitorId());
}else{
statusMap.put("monitorid","");
}
list1.add(statusMap);
}
}
map.put("status", getStatus2(monitorMap,list1,equipCode));
map.put("signal","--");
if(whatStructData.getMonitorId()!=null){
map.put("runtime",monitorMap.get(whatStructData.getMonitorId()));
}else{
map.put("runtime","--");
}
list.add(map);
}
return list;
}
private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
String status = "停止";
Map<String, Object> bean = list.get(0);
String monitorStatus = map.get(bean.get("monitorid").toString()).toString();
if("2".equals(monitorStatus)){
status = "故障";
}else if("1".equals(monitorStatus)){
status = "运行";
}else{
status = "停止";
}
return status;
}
private String getStatus2(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
String status = "停止";
String bpName = pumpId+"_BP";
String gpName = pumpId+"_GP";
for (Map<String, Object> bean : list) {
if(bpName.equals(bean.get("name"))){
if("1".equals(map.get(bean.get("monitorid").toString()))){
status = "变频运行";
}
}
if(gpName.equals(bean.get("name"))){
if("1".equals(map.get(bean.get("monitorid").toString()))){
status = "工频运行";
}
}
}
return status;
}
private List<Map<String, Object>> getMnData(){
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> flowMap = new HashMap<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!