Commit 7065f92c authored by zhangsen's avatar zhangsen

公共接口提交

parent 303bd3c5
......@@ -22,4 +22,7 @@ public class IndexDto {
private int count;
private String equipmentsIdx;
private String equipmentIndexName; // 指标名称【风机状态名称】
private String longitude; // 经度
private String latitude; // 纬度
private String frontModule;
}
......@@ -38,12 +38,13 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据设备编号、网关ID、前段展示模块查询表数据")
@GetMapping("/getFanIdxInfoByPage")
public ResponseModel<IPage<MonitorFanIndicator>> getFanIdxInfoByPage(@RequestParam(value = "equipmentNumber", required = false) String equipmentNumber,
@RequestParam(value = "gateway", required = false) String gateway,
@RequestParam(value = "frontModule", required = false) String frontModule,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, gateway, frontModule, current, size));
public ResponseModel<IPage<IndexDto>> getFanIdxInfoByPage(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "frontModule", required = false) String frontModule,
@RequestParam(value = "systemType", required = false) String systemType,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanIdxInfoByPage(equipNum, stationId, frontModule, current, size, systemType));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -71,4 +72,12 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanStatusStatistics(stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机基础信息")
@GetMapping("/getFanBasicInfoByEquipNum")
public ResponseModel<IndexDto> getFanBasicInfoByEquipNum(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanBasicInfoByEquipNum(equipNum, stationId));
}
}
......@@ -16,6 +16,8 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
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.component.robot.BadRequest;
......@@ -104,12 +106,22 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultsData;
}
public IPage<MonitorFanIndicator> getFanIdxInfoByPage(String equipmentNumber, String gateway, String frontModule, int current, int size) {
Page<MonitorFanIndicator> page = new Page<>(current, size);
Integer integer = monitorFanIndicatorregionMapper.queryByPageTotal(equipmentNumber, gateway, frontModule);
List<MonitorFanIndicator> monitorFanIndicators = monitorFanIndicatorregionMapper.queryByPage(page.getSize(), equipmentNumber, gateway, frontModule, (current - 1) * size);
page.setTotal(integer);
page.setRecords(monitorFanIndicators);
public IPage<IndexDto> getFanIdxInfoByPage(String equipNum, String stationId, String frontModule, int current, int size, String systemType) {
StationBasic stationBasic = getOneByStationNumber(stationId);
Page<IndexDto> page = new Page<>(current, size);
String sql = "";
if (StringUtils.isNotEmpty(systemType)) {
sql = String.format("SELECT equipmentIndexName, value, frontModule FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/ and systemType =~/%s/ ", stationBasic.getFanGatewayId(), equipNum, frontModule, systemType);
} else {
sql = String.format("SELECT equipmentIndexName, value, frontModule FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/", stationBasic.getFanGatewayId(), equipNum, frontModule);
}
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
List<IndexDto> collect = influxDBList.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
page.setTotal(influxDBList.size());
page.setRecords(collect);
return page;
}
......@@ -196,4 +208,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, Long> collect = influxDBList.stream().collect(Collectors.groupingBy(IndexDto::getEquipmentIndexName, Collectors.counting()));
return collect;
}
public IndexDto getFanBasicInfoByEquipNum(String equipNum, String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and value = 'true' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum);
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
if (CollectionUtils.isNotEmpty(influxDBList)) {
String equipmentSpecificName = influxDBList.get(0).getEquipmentSpecificName();
influxDBList.get(0).setEquipmentSpecificName(equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#")));
return influxDBList.get(0);
}
return new IndexDto();
}
}
\ 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