Commit 6e5aedc7 authored by zhangsen's avatar zhangsen

树接口提交

parent 10a20d43
...@@ -21,4 +21,6 @@ public class IndexDto { ...@@ -21,4 +21,6 @@ public class IndexDto {
private String value; private String value;
private int count; private int count;
private String equipmentsIdx; private String equipmentsIdx;
private String equipmentNumber; // 风机编码
private String equipmentIndexName; // 指标名称【风机状态名称】
} }
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
<select id="getStationListByRegionCode" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto"> <select id="getStationListByRegionCode" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto">
select select
station_name as name, station_name as name,
station_code as code, sequence_nbr as code,
station_type as parentCode, station_type as parentCode,
sequence_nbr as id, sequence_nbr as id,
'1' as isOnclick '1' as isOnclick
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord; import com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord;
import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@Api(tags = "大屏相关API") @Api(tags = "大屏相关API")
...@@ -54,7 +56,19 @@ public class MonitorFanIdxController extends BaseController { ...@@ -54,7 +56,19 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态列表")
@GetMapping("/getFanStatusList")
public ResponseModel<List<IndexDto>> getFanStatusList(@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanStatusList(stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态统计")
@GetMapping("/getFanStatusStatistics")
public ResponseModel<Map<String, Long>> getFanStatusStatistics(@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanStatusStatistics(stationId));
}
} }
...@@ -14,14 +14,17 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; ...@@ -14,14 +14,17 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -41,6 +44,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -41,6 +44,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired @Autowired
private RegionMapper regionMapper; private RegionMapper regionMapper;
@Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
StationDataTaskImpl stationDataTask;
@Autowired
InfluxDButils influxDButils;
@Override @Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) { public void UpdateMonitorFanIndicator(List<IndexDto> list) {
...@@ -119,7 +134,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -119,7 +134,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
* @param indicator * @param indicator
* @return * @return
*/ */
public Object getIndicatoralueTotal(String gateway,String indicator){ public Object getIndicatoralueTotal(String gateway,String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway,indicator); return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway,indicator);
} }
private StationBasic getOneByStationNumber(String stationId) {
return stationBasicMapper.selectById(stationId);
}
public List<IndexDto> getFanStatusList(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
return influxDBList;
}
public Map<String, Long> getFanStatusStatistics(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
// key:状态 value:数量
Map<String, Long> collect = influxDBList.stream().collect(Collectors.groupingBy(IndexDto::getEquipmentIndexName, Collectors.counting()));
return collect;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment