|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.operational.census.service.AreaDutyService; |
|
|
|
import com.hnac.hzims.operational.census.service.AreaDutyService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.census.vo.AreaAssetDeviceVo; |
|
|
|
import com.hnac.hzims.operational.census.vo.AreaAssetVo; |
|
|
|
import com.hnac.hzims.operational.census.vo.AreaAssetVo; |
|
|
|
import com.hnac.hzims.operational.census.vo.AreaTimelyVo; |
|
|
|
import com.hnac.hzims.operational.census.vo.AreaTimelyVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.AreaDutyVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.AreaDutyVo; |
|
|
@ -13,8 +14,10 @@ import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -73,8 +76,22 @@ public class AreaDutyServiceImpl implements AreaDutyService { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public AreaTimelyVo timely(Long deptId) { |
|
|
|
public List<AreaTimelyVo> timely(Long deptId,Integer type) { |
|
|
|
return null; |
|
|
|
switch (type){ |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -101,9 +118,23 @@ public class AreaDutyServiceImpl implements AreaDutyService { |
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
// 水电站设备实时数据
|
|
|
|
// 水电站设备实时数据
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
return devices.stream().filter(device -> depts.contains(device.getCreateDept())).collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
return devices.stream().filter(device -> depts.contains(device.getCreateDept())).collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
AreaAssetVo asset = new AreaAssetVo(); |
|
|
|
AreaAssetVo asset = new AreaAssetVo(); |
|
|
|
|
|
|
|
asset.setDeptId(entry.getKey()); |
|
|
|
|
|
|
|
asset.setDeptName(sysClient.getDeptName(entry.getKey()).getData()); |
|
|
|
|
|
|
|
asset.setDevices(entry.getValue().stream().map(value->{ |
|
|
|
|
|
|
|
AreaAssetDeviceVo item = new AreaAssetDeviceVo(); |
|
|
|
|
|
|
|
item.setDeptId(entry.getKey()); |
|
|
|
|
|
|
|
item.setDeptName(asset.getDeptName()); |
|
|
|
|
|
|
|
// 状态
|
|
|
|
|
|
|
|
HydropowerUnitRealVo real = reals.stream().filter(o->o.getDeviceCode().equals(value.getEmCode())).min(Comparator.comparing(HydropowerUnitRealVo::getDeviceCode)).get(); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(real)){ |
|
|
|
|
|
|
|
item.setStatus(2); |
|
|
|
|
|
|
|
}else if(Math.abs(real.getActivePower()) > 0){ |
|
|
|
|
|
|
|
item.setStatus(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
return asset; |
|
|
|
return asset; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}catch (Exception ex){ |
|
|
|
}catch (Exception ex){ |
|
|
@ -111,4 +142,7 @@ public class AreaDutyServiceImpl implements AreaDutyService { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |