|
|
|
@ -85,10 +85,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.save.area.url}") |
|
|
|
|
public String AREA_URL; |
|
|
|
|
@Value("${hzims.operation.save.station.url}") |
|
|
|
|
public String STATION_URL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static String charge = "hzims:operation:key:charge"; |
|
|
|
|
|
|
|
|
@ -105,41 +102,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
|
|
|
|
|
|
|
|
|
|
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean saveArea() { |
|
|
|
|
R<List<Dept>> result = sysClient.getDeptList(); |
|
|
|
|
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { |
|
|
|
|
throw new ServiceException("暂无区域数据!"); |
|
|
|
|
} |
|
|
|
|
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE); |
|
|
|
|
Map<Dept, List<StationEntity>> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE,true); |
|
|
|
|
if (MapUtils.isEmpty(map)) { |
|
|
|
|
throw new ServiceException("暂无区域数据!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
List<EminfoAndEmParamVo> deviceList = emService.getEmInfoList(); |
|
|
|
|
// 获取区域列表数据
|
|
|
|
|
List<AreaVo> list = map.entrySet().stream().map(entry->{ |
|
|
|
|
AreaVo vo = new AreaVo(); |
|
|
|
|
vo.setDeptId(entry.getKey().getId()); |
|
|
|
|
vo.setDeptName(entry.getKey().getDeptName()); |
|
|
|
|
int hydropowerCount = (int) entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).count(); |
|
|
|
|
vo.setHydropowerStationCount(hydropowerCount); |
|
|
|
|
int waterCount = entry.getValue().size() - hydropowerCount; |
|
|
|
|
vo.setWaterStationCount(waterCount); |
|
|
|
|
List<Long> value = entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(value)){ |
|
|
|
|
vo.setInstalledCapacity(0.0); |
|
|
|
|
}else{ |
|
|
|
|
double installedCapacity = deviceList.stream().filter(o-> null != o.getInstalledCapacity() && value.contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum(); |
|
|
|
|
vo.setInstalledCapacity(installedCapacity); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
// 调用Http请求
|
|
|
|
|
return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|