Commit f8c02037 authored by wujiang's avatar wujiang

修复监盘报错

parent 128fd2bc
......@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
if(result!=null)
{
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth);
......
......@@ -567,7 +567,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
if(equipments!=null)
{
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result;
}
......
......@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>();
......@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId();
String companyLevel ="";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
}else{
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
}
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
......@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList());
if(stationBasic.getStationType().equals("FDZ")){
treeDto = fdzTreeDto;
}else {
if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
.collect(Collectors.toList());
if (stationBasic.getStationType().equals("FDZ")) {
treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto;
}
treeDto.setChildren(children);
......@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>();
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
"停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
......@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
......@@ -893,7 +893,14 @@ public class MonitoringServiceImpl {
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
}
}
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 / getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
Double PlanGen = getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId());
if(PlanGen!=null)
{
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 /PlanGen));
}else
{
stationCacheInfoDto.setAddress("0.0");
}
});
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
......
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