Commit 9c55e0d6 authored by caotao's avatar caotao

监盘接口调整优化

parent 5d4da207
......@@ -553,12 +553,12 @@ public class DemoController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站")
@ApiOperation(value = "初始化inlfuxdb-new")
@GetMapping("/test17")
public ResponseModel<Integer> demoTest17() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313"};
// String [] strings = {"1669525017559306241"};
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
......@@ -582,15 +582,15 @@ public class DemoController extends BaseController {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("address", monitorFanIndicator.getIndexAddress());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
tag.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "4");
maps2.put("value", "");
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
......@@ -599,9 +599,8 @@ public class DemoController extends BaseController {
maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
influxDbConnection.insert("test_" + monitorFanIndicator.getGateway(), tag, maps2);
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
}
}
return ResponseHelper.buildResponse(num);
}
......
......@@ -48,7 +48,7 @@ public class MonitoringMapController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国-安全生产天数")
@GetMapping("/getSecDays")
public ResponseModel<String> getSecDays(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
public ResponseModel<HashMap<String,String>> getSecDays(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSecDays(secStartDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
......@@ -60,57 +60,41 @@ import java.util.stream.Collectors;
@Slf4j
public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private final static List<String> fanStatesList = Arrays.asList("报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "正常发电状态");
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
private RegionMapper regionMapper;
@Autowired
InfluxDButils influxDButils;
@Autowired
InfluxdbUtil influxdbUtil;
@Autowired
SystemEnumMapper systemEnumMapper;
@Autowired
SwitchPictureMapper switchPictureMapper;
@Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
TemporaryDataMapper temporaryDataMapper;
@Autowired
AlarmEventMapper alarmEventMapper;
@Autowired
AlarmEventServiceImpl alarmEventService;
@Autowired
TemporaryDataServiceImpl temporaryDataService;
@Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
EmqKeeper emqKeeper;
@Value("${pictureUrl}")
String pictureUrl;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
private RegionMapper regionMapper;
//风机状态列表
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
@Value("${pictureUrl}")
String pictureUrl;
@Value("classpath:/json/topic.json")
private Resource topic;
......@@ -953,7 +937,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.put("windSpeed", listDatum.getValue());
map.put("power", listDatum.getValueLabel());
//获取风机状态如果获取到的状态为空-则默认为正常运行状态
String fantStatus = ObjectUtils.isEmpty(fanstatutsHashMap.get(num)) ? "正常运行" : fanstatutsHashMap.get(num);
String fantStatus = ObjectUtils.isEmpty(fanstatutsHashMap.get(num)) ? "通讯中断" : fanstatutsHashMap.get(num);
map.put("url", fanStatusImagePathPrefix + File.separator + "风机-" + fantStatus + ".gif");
statusMaps.add(map);
}
......@@ -1476,17 +1460,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultMap;
}
public Map<String, String> getStatisticsInfo( String equipmentIndexName,String stationId) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
public Map<String, String> getStatisticsInfo(String equipmentIndexName, String stationId) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
String gatewayId = stationCacheInfoDto.getFanGatewayId();
if (!"FDZ".equals(stationCacheInfoDto.getStationType())){
if (!"FDZ".equals(stationCacheInfoDto.getStationType())) {
gatewayId = stationCacheInfoDto.getBoosterGatewayId();
}
String sql = "SELECT value FROM indicators_" + stationCacheInfoDto.getBoosterGatewayId() + " WHERE equipmentIndexName='220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值' or equipmentIndexName='南瑞光差保护_313P'";
List<Map<String,Object>> resultList =influxdbUtil.query(sql);
String load = String.format("%.2f",Double.parseDouble(String.valueOf(resultList.get(0).get("value")))/Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
Map<String,String> result = temporaryDataMapper.getStatisticsInfo(gatewayId, equipmentIndexName);
result.put("load",load);
List<Map<String, Object>> resultList = influxdbUtil.query(sql);
String load = String.format("%.2f", Double.parseDouble(String.valueOf(resultList.get(0).get("value"))) / Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
Map<String, String> result = temporaryDataMapper.getStatisticsInfo(gatewayId, equipmentIndexName);
result.put("load", load);
return result;
}
......@@ -1507,6 +1491,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
return statusMaps;
}
public String keepTwoDecimalPlaces(String value) {
String s = "0.00";
if (!ObjectUtils.isEmpty(value)) {
......@@ -1622,7 +1607,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public List<Map<String, Object>> solarPowerOperation(String gatewayId) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '有功功率' or equipmentIndexName = '逆变器效率' or equipmentIndexName ='总直流功率' or equipmentIndexName ='日发电量' or equipmentIndexName ='总发电量' ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
......@@ -1968,10 +1952,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public Page<DeaviationRateDto> getDeaviAtionRate(String stationId, String equipNumber) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
Page<DeaviationRateDto> deaviationRateDtoPage = new Page<>(1,100);
List<DeaviationRateDto> deaviationRateDtoList =new ArrayList<>();
String sql = "SELECT * FROM indicators_" + stationCacheInfoDto.getFanGatewayId() + " WHERE equipmentIndexName =~/路电流/ and and equipmentNumber ='+" + equipNumber+"'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
Page<DeaviationRateDto> deaviationRateDtoPage = new Page<>(1, 100);
List<DeaviationRateDto> deaviationRateDtoList = new ArrayList<>();
String sql = "SELECT * FROM indicators_" + stationCacheInfoDto.getFanGatewayId() + " WHERE equipmentIndexName =~/路电流/ and and equipmentNumber ='+" + equipNumber + "'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
Random random = new Random();
indicatorsDtoList.forEach(indicatorsDto -> {
DeaviationRateDto deaviationRateDto = new DeaviationRateDto();
......
......@@ -1083,7 +1083,9 @@ public class MonitoringServiceImpl {
return result;
}
public String getSecDays(String secStartDate) {
return String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY));
public HashMap<String,String> getSecDays(String secStartDate) {
HashMap<String,String> result = new HashMap<>();
result.put("title",String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY)));
return result;
}
}
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