Commit 9d2e04a8 authored by caotao's avatar caotao

功率曲线新增风机、光伏的负载率计算

parent 7faa34f3
......@@ -64,6 +64,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
......@@ -83,7 +84,7 @@ public class DemoController extends BaseController {
@Autowired
TestServiceImpl testServiceimpl;
@Autowired
@Resource
InfluxDbConnection influxDbConnection;
@Autowired
......
......@@ -688,12 +688,12 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<Map<String,String>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "stationType", required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
if (null != stationType){
gatewayId = stationBasic.getBoosterGatewayId();
}
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName ));
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// if (null != stationType){
// gatewayId = stationBasic.getBoosterGatewayId();
// }
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(stationId,equipmentIndexName));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
......@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class CommonServiceImpl {
......@@ -308,9 +309,11 @@ public class CommonServiceImpl {
throw new RuntimeException(e);
}
}
return stationCacheInfoDtoList;
}
public StationCacheInfoDto getStationCacheInfoDtoByStationId(String stationId){
return getListStationCacheInfoDto().stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList()).get(0);
}
public String getFanDevicePrefix(String stationid){
StationBasic stationBasic = stationBasicMapper.selectById(stationid);
return PinyinUtil.getFirstLetter(stationBasic.getStationName().split("风")[0],"").toUpperCase(Locale.ROOT);
......
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SystemEnumMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper;
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.influxdb.InfluxdbUtil;
import com.yeejoin.amos.component.robot.BadRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -71,6 +72,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
InfluxDButils influxDButils;
@Autowired
InfluxdbUtil influxdbUtil;
@Autowired
SystemEnumMapper systemEnumMapper;
......@@ -1473,8 +1476,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultMap;
}
public Map<String, String> getStatisticsInfo(String gatewayId, String equipmentIndexName) {
return temporaryDataMapper.getStatisticsInfo(gatewayId, equipmentIndexName);
public Map<String, String> getStatisticsInfo( String equipmentIndexName,String stationId) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
String gatewayId = stationCacheInfoDto.getFanGatewayId();
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);
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