|
|
|
@ -525,19 +525,20 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteDefectVo> defect(String areaName, Integer type) { |
|
|
|
|
public IPage<CompleteDefectVo> defect(IPage<CompleteDefectVo> page,String areaName, Integer type) { |
|
|
|
|
if(HomePageConstant.DISTRIBUTION_NETWORK.equals(type)){ |
|
|
|
|
return this.getFillDefect(areaName,type); |
|
|
|
|
List<CompleteDefectVo> defects = this.getFillDefect(areaName,type); |
|
|
|
|
page.setTotal(defects.size()); |
|
|
|
|
page.setRecords(defects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<Dept> depts = areas.keySet().stream().filter(dept -> StringUtils.isEmpty(areaName) || dept.getDeptName().contains(areaName)).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(depts)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
|
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); |
|
|
|
@ -571,7 +572,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
} |
|
|
|
|
exe.shutdown(); |
|
|
|
|
return completeDefects; |
|
|
|
|
page.setTotal(completeDefects.size()); |
|
|
|
|
page.setRecords(completeDefects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -582,7 +585,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<ExamineCardVo> examineCard(String stationName, Integer type) { |
|
|
|
|
public IPage<ExamineCardVo> examineCard(IPage<ExamineCardVo> page,String stationName, Integer type) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
@ -592,7 +595,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 查询检修卡
|
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
@ -603,19 +606,22 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
.le(OverEntity::getCreateTime,endTime) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtils.isEmpty(overs)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<OverDetailsEntity> overDetails = overDetailsService.list(Wrappers.<OverDetailsEntity>lambdaQuery() |
|
|
|
|
.in(OverDetailsEntity::getOverId,overs.stream().map(OverEntity::getId).collect(Collectors.toList())) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
|
List<ExamineCardVo> cards = overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{ |
|
|
|
|
ExamineCardVo examineCard = new ExamineCardVo(); |
|
|
|
|
examineCard.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName()); |
|
|
|
|
examineCard.setCardTotal(entry.getValue().stream().mapToDouble(over-> Double.parseDouble(over.getTotalPrice().toString())).sum()); |
|
|
|
|
examineCard.setCardCount(overDetails.stream().filter(detail-> entry.getValue().stream().map(OverEntity::getId).collect(Collectors.toList()).contains(detail.getOverId())).mapToInt(OverDetailsEntity::getQuantity).sum()); |
|
|
|
|
return examineCard; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(cards.size()); |
|
|
|
|
page.setRecords(cards.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -626,7 +632,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<CompleteOtherVo> completeOther(String stationName, Integer type, Integer queryType) { |
|
|
|
|
public IPage<CompleteOtherVo> completeOther(IPage<CompleteOtherVo> page,String stationName, Integer type, Integer queryType) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, type); |
|
|
|
@ -636,7 +642,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 查询设备在线率/Fa投入条数
|
|
|
|
|
String startTime = this.getFristDayByYear(); |
|
|
|
@ -647,9 +653,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
.le(OtherEntity::getCreateTime,endTime) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtils.isEmpty(others)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
return others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> { |
|
|
|
|
List<CompleteOtherVo> records = others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> { |
|
|
|
|
CompleteOtherVo other = new CompleteOtherVo(); |
|
|
|
|
other.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName()); |
|
|
|
|
if(CensusConstant.QUERY_TYPE_DEFAULT.equals(queryType)){ |
|
|
|
@ -659,6 +665,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return other; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -750,7 +759,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DeviceClassifyVo> deviceClassify(String stationName, Long deptId,Integer status) { |
|
|
|
|
public IPage<DeviceClassifyVo> deviceClassify(IPage<DeviceClassifyVo> page,String stationName, Long deptId,Integer status) { |
|
|
|
|
// 获取区域设备统计
|
|
|
|
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); |
|
|
|
|
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); |
|
|
|
@ -759,21 +768,21 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
//根据用户权限获取机构
|
|
|
|
|
R<List<Dept>> result = sysClient.getDeptByCurrentUser(); |
|
|
|
|
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 站点
|
|
|
|
|
List<StationEntity> stations = stationService.getStationList(result.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
List<Long> detpIds = stations.stream().filter(o-> StringUtils.isEmpty(stationName) || o.getName().contains(stationName)).map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(detpIds)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); |
|
|
|
|
if(CollectionUtils.isEmpty(devices)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 获取设备集合
|
|
|
|
|
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EminfoAndEmParamVo::getCreateDept)).map(device -> { |
|
|
|
@ -791,11 +800,16 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return deviceClassify; |
|
|
|
|
}).filter(deviceClass -> StringUtils.isEmpty(stationName) || deviceClass.getStationName().contains(stationName)).collect(Collectors.toList()); |
|
|
|
|
List<DeviceClassifyVo> records = new ArrayList<>(); |
|
|
|
|
// 状态过滤
|
|
|
|
|
if(ObjectUtil.isEmpty(status)){ |
|
|
|
|
return deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
records = deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
}else{ |
|
|
|
|
records = deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
return deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -805,7 +819,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<HydropowerTargetVo> hydropowerTarget(String stationName, Long deptId,Integer target) { |
|
|
|
|
public IPage<HydropowerTargetVo> hydropowerTarget(IPage<HydropowerTargetVo> page,String stationName, Long deptId,Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, HomePageConstant.HYDROPOWER); |
|
|
|
@ -818,13 +832,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 功率
|
|
|
|
|
if(HomePageConstant.POWER.equals(target)){ |
|
|
|
|
// 实时数据
|
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<HydropowerTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
HydropowerTargetVo hydropower = new HydropowerTargetVo(); |
|
|
|
|
hydropower.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(reals)){ |
|
|
|
@ -834,11 +848,14 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return hydropower; |
|
|
|
|
})/*.filter(hydropower -> Math.abs(hydropower.getPower()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getPower).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 指标数据
|
|
|
|
|
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
// 发电量
|
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<HydropowerTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
HydropowerTargetVo hydropowerTarget = new HydropowerTargetVo(); |
|
|
|
|
hydropowerTarget.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtils.isEmpty(targets)){ |
|
|
|
@ -860,6 +877,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return hydropowerTarget; |
|
|
|
|
})/*.filter(hydropower -> Math.abs(hydropower.getElectric()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getElectric).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -869,7 +889,7 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<WaterTargetVo> waterTarget(String stationName, Long deptId,Integer target) { |
|
|
|
|
public IPage<WaterTargetVo> waterTarget(IPage<WaterTargetVo> page,String stationName, Long deptId,Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.in(StationEntity::getType, HomePageConstant.waterList); |
|
|
|
@ -883,12 +903,12 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 负荷
|
|
|
|
|
if(HomePageConstant.LOADING.equals(target)){ |
|
|
|
|
List<WaterPumpRealVo> pumps = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(load_waterpump_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<WaterTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
WaterTargetVo water = new WaterTargetVo(); |
|
|
|
|
water.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(pumps)){ |
|
|
|
@ -899,10 +919,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
water.setLoad(Optional.ofNullable(use).orElse(0.0)); |
|
|
|
|
return water; |
|
|
|
|
})/*.filter(water -> Math.abs(water.getLoad()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getLoad).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 用电量
|
|
|
|
|
List<WaterPumpTargetVo> targets = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(load_waterpump_target_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<WaterTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
WaterTargetVo water = new WaterTargetVo(); |
|
|
|
|
water.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(targets)){ |
|
|
|
@ -924,10 +947,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return water; |
|
|
|
|
})/*.filter(water -> Math.abs(water.getUse()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getUse).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<PhotovoTargetVo> photovoltaicTarget(String stationName, Long deptId, Integer target) { |
|
|
|
|
public IPage<PhotovoTargetVo> photovoltaicTarget(IPage<PhotovoTargetVo> page,String stationName, Long deptId, Integer target) { |
|
|
|
|
// 站点
|
|
|
|
|
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery(); |
|
|
|
|
wappers.eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC); |
|
|
|
@ -941,13 +967,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
List<StationEntity> stations = stationService.list(wappers); |
|
|
|
|
if(CollectionUtils.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 负荷
|
|
|
|
|
if(HomePageConstant.LOADING.equals(target)){ |
|
|
|
|
// 实时数据
|
|
|
|
|
List<PhotovoltaicRealVo> reals = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<PhotovoTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
PhotovoTargetVo photovo = new PhotovoTargetVo(); |
|
|
|
|
photovo.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(reals)){ |
|
|
|
@ -957,10 +983,13 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return photovo; |
|
|
|
|
})/*.filter(photovoltaic -> Math.abs(photovoltaic.getLoad()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getLoad).reversed()).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// 发电量
|
|
|
|
|
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key); |
|
|
|
|
return stations.stream().map(station->{ |
|
|
|
|
List<PhotovoTargetVo> records = stations.stream().map(station->{ |
|
|
|
|
PhotovoTargetVo photovo = new PhotovoTargetVo(); |
|
|
|
|
photovo.setStationName(station.getName()); |
|
|
|
|
if(CollectionUtil.isEmpty(targets)){ |
|
|
|
@ -982,61 +1011,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return photovo; |
|
|
|
|
})/*.filter(photovo -> Math.abs(photovo.getGenerate()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getGenerate).reversed()).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 集团设备统计 |
|
|
|
|
* @param areaName |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DeviceGroupVo> deviceGroup(String areaName) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 获取设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); |
|
|
|
|
// 获取设备状态
|
|
|
|
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); |
|
|
|
|
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); |
|
|
|
|
List<String> overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL); |
|
|
|
|
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); |
|
|
|
|
return areas.entrySet().stream().map(entry->{ |
|
|
|
|
DeviceGroupVo group = new DeviceGroupVo(); |
|
|
|
|
group.setDeptId(entry.getKey().getId()); |
|
|
|
|
group.setAreaName(entry.getKey().getDeptName()); |
|
|
|
|
if(CollectionUtils.isEmpty(devices)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
group.setOverhaultCount(0L); |
|
|
|
|
group.setRunCount(0L); |
|
|
|
|
group.setReserveCount(0L); |
|
|
|
|
return group; |
|
|
|
|
} |
|
|
|
|
List<String> numbers = devices.stream().filter(device-> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getCreateDept())).map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
// 故障
|
|
|
|
|
if(CollectionUtils.isEmpty(faultList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(faultList::contains).count()); |
|
|
|
|
} |
|
|
|
|
// 检修
|
|
|
|
|
if(CollectionUtils.isEmpty(overhaultList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(overhaultList::contains).count()); |
|
|
|
|
} |
|
|
|
|
// 运行
|
|
|
|
|
if(CollectionUtils.isEmpty(runtList)){ |
|
|
|
|
group.setFaultCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
group.setFaultCount(numbers.stream().filter(runtList::contains).count()); |
|
|
|
|
} |
|
|
|
|
// 备用
|
|
|
|
|
group.setReserveCount(numbers.size() - group.getFaultCount() - group.getOverhaultCount() - group.getRunCount()); |
|
|
|
|
return group; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1046,15 +1023,15 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DutyGroupVo> dutyGroup(String areaName, Long type) { |
|
|
|
|
public IPage<DutyGroupVo> dutyGroup(IPage<DutyGroupVo> page,String areaName, Long type) { |
|
|
|
|
// 获取区域机构
|
|
|
|
|
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if(MapUtils.isEmpty(areas)){ |
|
|
|
|
return null; |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
// redis中取区域数据
|
|
|
|
|
List<AreaDutyVo> areaDutyVoList = (List<AreaDutyVo>) redisTemplate.opsForValue().get(areaDutyInfoKey); |
|
|
|
|
return areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> { |
|
|
|
|
List<DutyGroupVo> records = areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> { |
|
|
|
|
DutyGroupVo duty = new DutyGroupVo(); |
|
|
|
|
duty.setDeptId(stationEntities.getId()); |
|
|
|
|
duty.setAreaName(stationEntities.getDeptName()); |
|
|
|
@ -1080,6 +1057,9 @@ public class TargetServiceImpl implements TargetService {
|
|
|
|
|
} |
|
|
|
|
return duty; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setTotal(records.size()); |
|
|
|
|
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList())); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|