|
|
@ -3,15 +3,18 @@ package com.hnac.hzims.operational.main.service.impl; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.Daily; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.Daily; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; |
|
|
|
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.fill.service.UseService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.station.StationConstants; |
|
|
|
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService; |
|
|
@ -44,8 +47,6 @@ import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.ParseException; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.time.Duration; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
@ -60,26 +61,28 @@ import java.util.stream.Collectors; |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class WaterServiceImpl implements IWaterService { |
|
|
|
public class WaterServiceImpl implements IWaterService { |
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataService analyseDataService; |
|
|
|
private final UseService useService; |
|
|
|
|
|
|
|
|
|
|
|
private final IHomePageService homePageService; |
|
|
|
private final IHomePageService homePageService; |
|
|
|
|
|
|
|
|
|
|
|
private final IStationService stationService; |
|
|
|
private final IStationService stationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IWeatherService weatherService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataService analyseDataService; |
|
|
|
|
|
|
|
|
|
|
|
private final ISideHustleService sideHustleService; |
|
|
|
private final ISideHustleService sideHustleService; |
|
|
|
|
|
|
|
|
|
|
|
private final IMainSystemMonitoringService maintenanceTaskService; |
|
|
|
private final IMainSystemMonitoringService maintenanceTaskService; |
|
|
|
|
|
|
|
|
|
|
|
private final IHzimsAnalyzeModelStationService modelStationService; |
|
|
|
private final IHzimsAnalyzeModelStationService modelStationService; |
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IWeatherService weatherService; |
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.realIdKey}") |
|
|
|
@Value("${hzims.operation.realIdKey}") |
|
|
@ -91,54 +94,48 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
|
|
|
|
|
|
|
|
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; |
|
|
|
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; |
|
|
|
|
|
|
|
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
|
|
|
private final SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
|
|
|
private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
// 时间格式化yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
|
|
|
private final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 水利-泵组实时加载 |
|
|
|
* 水利-泵组实时加载 |
|
|
|
* @param param |
|
|
|
* @param param |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void loadWaterPumpReal(String param) { |
|
|
|
public void loadWaterPumpReal(String param) { |
|
|
|
// 有效设备
|
|
|
|
// 水利站点
|
|
|
|
List<EminfoAndEmParamVo> valid = this.getValidDeviceList(); |
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
if(CollectionUtil.isEmpty(valid)){ |
|
|
|
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) |
|
|
|
|
|
|
|
.in(StationEntity::getType,HomePageConstant.waterList) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 泵站设备
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 实时数据
|
|
|
|
// 实时数据
|
|
|
|
Map<String, String> map = this.getRealMap(); |
|
|
|
Map<String, String> map = this.getRealMap(); |
|
|
|
List<WaterPumpRealVo> list = new ArrayList<>(); |
|
|
|
List<WaterPumpRealVo> list = devices.stream().map(device->{ |
|
|
|
valid.forEach(device->{ |
|
|
|
WaterPumpRealVo real = new WaterPumpRealVo(); |
|
|
|
WaterPumpRealVo waterPumpRealVo = new WaterPumpRealVo(); |
|
|
|
real.setDeptId(device.getCreateDept()); |
|
|
|
waterPumpRealVo.setDeptId(device.getCreateDept()); |
|
|
|
real.setDeviceCode(device.getEmCode()); |
|
|
|
waterPumpRealVo.setDeviceCode(device.getEmCode()); |
|
|
|
real.setDeptName(device.getName()); |
|
|
|
waterPumpRealVo.setDeptName(device.getName()); |
|
|
|
|
|
|
|
// 装机容量
|
|
|
|
// 装机容量
|
|
|
|
waterPumpRealVo.setInstalledCapacity(device.getInstalledCapacity()); |
|
|
|
real.setInstalledCapacity(device.getInstalledCapacity()); |
|
|
|
// 开机状态
|
|
|
|
// 开机状态
|
|
|
|
int state = this.getPumpState(device,map); |
|
|
|
real.setState(this.getPumpState(device,map)); |
|
|
|
waterPumpRealVo.setState(state); |
|
|
|
|
|
|
|
// 功率因数
|
|
|
|
// 功率因数
|
|
|
|
double powerFactor = this.getPowerFactor(device,map); |
|
|
|
real.setPowerFactor(this.getPowerFactor(device,map)); |
|
|
|
waterPumpRealVo.setPowerFactor(powerFactor); |
|
|
|
|
|
|
|
// 有功功率
|
|
|
|
// 有功功率
|
|
|
|
float activePower = this.getActivePower(device,map); |
|
|
|
real.setActivePower(this.getActivePower(device,map)); |
|
|
|
waterPumpRealVo.setActivePower(activePower); |
|
|
|
|
|
|
|
// 无功功率
|
|
|
|
// 无功功率
|
|
|
|
float reactivePower = this.getReactivePower(device,map); |
|
|
|
real.setReactivePower(this.getReactivePower(device,map)); |
|
|
|
waterPumpRealVo.setReactivePower(reactivePower); |
|
|
|
|
|
|
|
// 电压
|
|
|
|
// 电压
|
|
|
|
double voltage = this.getVoltage(device,map); |
|
|
|
real.setVoltage(this.getVoltage(device,map)); |
|
|
|
waterPumpRealVo.setVoltage(voltage); |
|
|
|
|
|
|
|
// 电流
|
|
|
|
// 电流
|
|
|
|
double current = this.getCurrent(device,map); |
|
|
|
real.setCurrent(this.getCurrent(device,map)); |
|
|
|
waterPumpRealVo.setCurrent(current); |
|
|
|
return real; |
|
|
|
list.add(waterPumpRealVo); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(loadwaterpump_real_key,list); |
|
|
|
redisTemplate.opsForValue().set(loadwaterpump_real_key,list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -148,44 +145,48 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void loadWaterPumpTarget(String param) { |
|
|
|
public void loadWaterPumpTarget(String param) { |
|
|
|
List<EminfoAndEmParamVo> valid = this.getValidDeviceList(); |
|
|
|
// 水利站点
|
|
|
|
if(CollectionUtil.isEmpty(valid)){ |
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) |
|
|
|
|
|
|
|
.in(StationEntity::getType,HomePageConstant.waterList) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
List<WaterPumpTargetVo> list = new ArrayList<>(); |
|
|
|
// 泵站设备
|
|
|
|
valid.forEach(device->{ |
|
|
|
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
WaterPumpTargetVo waterPumpTargetVo = new WaterPumpTargetVo(); |
|
|
|
// 补充站点填报发电量
|
|
|
|
waterPumpTargetVo.setDeptId(device.getCreateDept()); |
|
|
|
List<WaterPumpTargetVo> list = this.useFill(stations); |
|
|
|
waterPumpTargetVo.setDeviceCode(device.getEmCode()); |
|
|
|
// 站点设备数据统计
|
|
|
|
waterPumpTargetVo.setDeptName(device.getName()); |
|
|
|
if(CollectionUtil.isNotEmpty(devices)){ |
|
|
|
// 当年用电量
|
|
|
|
list.addAll(devices.stream().map(device->{ |
|
|
|
float usrPowerYear = this.getUsrPowerYear(device); |
|
|
|
WaterPumpTargetVo target = new WaterPumpTargetVo(); |
|
|
|
waterPumpTargetVo.setUsrPowerYear(usrPowerYear); |
|
|
|
target.setDeptId(device.getCreateDept()); |
|
|
|
// 当月用电量
|
|
|
|
target.setDeviceCode(device.getEmCode()); |
|
|
|
float usrPowerMon = this.getUsrPowerMon(device); |
|
|
|
target.setDeptName(device.getName()); |
|
|
|
waterPumpTargetVo.setUsrPowerMon(usrPowerMon); |
|
|
|
// 当年用电量
|
|
|
|
// 当日用电量
|
|
|
|
target.setUsrPowerYear(this.getUsrPowerYear(device)); |
|
|
|
float usrPowerDay = this.getUsrPowerDay(device); |
|
|
|
// 当月用电量
|
|
|
|
waterPumpTargetVo.setUsrPowerDay(usrPowerDay); |
|
|
|
target.setUsrPowerMon(this.getUsrPowerMon(device)); |
|
|
|
// 月运行次数、时长
|
|
|
|
// 当日用电量
|
|
|
|
WaterRunVo runMon = this.getRunData(device,1); |
|
|
|
target.setUsrPowerDay(this.getUsrPowerDay(device)); |
|
|
|
waterPumpTargetVo.setRunCountMon(runMon.getCount()); |
|
|
|
// 当日机组有功功率
|
|
|
|
waterPumpTargetVo.setRunDurationMon(runMon.getHour()); |
|
|
|
target.setActivePowerVoList(this.getActivePowerVoList(device)); |
|
|
|
// 年运行次数、时长
|
|
|
|
// 近30天用电量
|
|
|
|
WaterRunVo runYear = this.getRunData(device,0); |
|
|
|
target.setUsrPowerVoList(this.getUsrPowerVoList(device)); |
|
|
|
waterPumpTargetVo.setRunCountYear(runYear.getCount()); |
|
|
|
// 近3年用电量
|
|
|
|
waterPumpTargetVo.setRunDurationYear(runYear.getHour()); |
|
|
|
target.setUsrYearMap(this.getUsrYearMap(device)); |
|
|
|
// 当日机组有功功率
|
|
|
|
// 月运行次数、时长
|
|
|
|
List<ActivePowerVo> activePowerVoList = this.getActivePowerVoList(device); |
|
|
|
WaterRunVo runMon = this.getRunData(device,1); |
|
|
|
waterPumpTargetVo.setActivePowerVoList(activePowerVoList); |
|
|
|
target.setRunCountMon(runMon.getCount()); |
|
|
|
// 近30天用电量
|
|
|
|
target.setRunDurationMon(runMon.getHour()); |
|
|
|
List<UsrPowerVo> usrPowerVoList = this.getUsrPowerVoList(device); |
|
|
|
// 年运行次数、时长
|
|
|
|
waterPumpTargetVo.setUsrPowerVoList(usrPowerVoList); |
|
|
|
WaterRunVo runYear = this.getRunData(device,0); |
|
|
|
// 近3年用电量
|
|
|
|
target.setRunCountYear(runYear.getCount()); |
|
|
|
Map<String,Float> usrYearMap = this.getUsrYearMap(device); |
|
|
|
target.setRunDurationYear(runYear.getHour()); |
|
|
|
waterPumpTargetVo.setUsrYearMap(usrYearMap); |
|
|
|
return target; |
|
|
|
list.add(waterPumpTargetVo); |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
}); |
|
|
|
} |
|
|
|
redisTemplate.opsForValue().set(loadwaterpump_target_key,list); |
|
|
|
redisTemplate.opsForValue().set(loadwaterpump_target_key,list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -231,22 +232,19 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取监测点位是否配置 |
|
|
|
* 泵站设备 |
|
|
|
* @param instanceCode |
|
|
|
* @param stations |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean getSetting(String instanceCode) { |
|
|
|
private List<EminfoAndEmParamVo> pumpDevices(List<Long> stations){ |
|
|
|
// 获取设备监测点位:未配置监测点位不进行统计设备
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
List<MultiAnalyzeCodePO> list = new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
MultiAnalyzeCodePO po = new MultiAnalyzeCodePO(); |
|
|
|
|
|
|
|
po.setDeviceCode(instanceCode); |
|
|
|
|
|
|
|
po.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); |
|
|
|
|
|
|
|
list.add(po); |
|
|
|
|
|
|
|
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list); |
|
|
|
|
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return devices.stream().filter(device->stations.contains(device.getCreateDept())).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -261,7 +259,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
List<String> signages = Collections.singletonList(signage); |
|
|
|
List<String> signages = Collections.singletonList(signage); |
|
|
|
realData.setSignages(signages); |
|
|
|
realData.setSignages(signages); |
|
|
|
// 调用fegin接口查询实时数据
|
|
|
|
// 调用fegin接口查询实时数据
|
|
|
|
R<List<FieldsData>> R = null; |
|
|
|
R<List<FieldsData>> R; |
|
|
|
try { |
|
|
|
try { |
|
|
|
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -279,12 +277,8 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
if(StringUtil.isBlank(time)){ |
|
|
|
if(StringUtil.isBlank(time)){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
try{ |
|
|
|
Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT); |
|
|
|
Date date = sdf.parse(time); |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch (ParseException e){ |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
return Double.parseDouble(R.getData().get(0).getValue()); |
|
|
|
return Double.parseDouble(R.getData().get(0).getValue()); |
|
|
@ -297,7 +291,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { |
|
|
|
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { |
|
|
|
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), dtf); |
|
|
|
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); |
|
|
|
LocalDateTime endTime = LocalDateTime.now(); |
|
|
|
LocalDateTime endTime = LocalDateTime.now(); |
|
|
|
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); |
|
|
|
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); |
|
|
|
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); |
|
|
|
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); |
|
|
@ -334,29 +328,6 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取有效设备 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<EminfoAndEmParamVo> getValidDeviceList() { |
|
|
|
|
|
|
|
// 水利站点(All)
|
|
|
|
|
|
|
|
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, HomePageConstant.waterList, null); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取所有设备
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(deviceList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 有效泵租设备
|
|
|
|
|
|
|
|
List<Long> deptIdList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(deptIdList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return deviceList.stream().filter(o->deptIdList.contains(o.getCreateDept())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取有效站点模型 |
|
|
|
* 获取有效站点模型 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -573,11 +544,11 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private float getUsrPowerYear(EminfoAndEmParamVo device) { |
|
|
|
private float getUsrPowerYear(EminfoAndEmParamVo device) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
String end = sdf.format(calendar.getTime()); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
String start = df.format(calendar.getTime()); |
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
// 当年用电量
|
|
|
|
// 当年用电量
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
} |
|
|
|
} |
|
|
@ -794,43 +765,87 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount()); |
|
|
|
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount()); |
|
|
|
return generate; |
|
|
|
return generate; |
|
|
|
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower)); |
|
|
|
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 获取填报用电量 |
|
|
|
|
|
|
|
* @param stations |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<WaterPumpTargetVo> useFill(List<StationEntity> stations) { |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM"); |
|
|
|
|
|
|
|
String year = String.valueOf(calendar.get(Calendar.YEAR)); |
|
|
|
|
|
|
|
return stations.stream().map(station ->{ |
|
|
|
|
|
|
|
WaterPumpTargetVo target = new WaterPumpTargetVo(); |
|
|
|
|
|
|
|
target.setDeptId(station.getRefDept()); |
|
|
|
|
|
|
|
target.setDeptName(station.getName()); |
|
|
|
|
|
|
|
// 月运行次数、时长
|
|
|
|
|
|
|
|
target.setRunCountMon(0); |
|
|
|
|
|
|
|
target.setRunDurationMon(0.0); |
|
|
|
|
|
|
|
// 年运行次数、时长
|
|
|
|
|
|
|
|
target.setRunCountYear(0); |
|
|
|
|
|
|
|
target.setRunDurationYear(0.0); |
|
|
|
|
|
|
|
// 当年用电量
|
|
|
|
|
|
|
|
target.setUsrPowerYear(useService.use(year,station.getCode())); |
|
|
|
|
|
|
|
// 当月用电量
|
|
|
|
|
|
|
|
target.setUsrPowerMon(useService.use(mon,station.getCode())); |
|
|
|
|
|
|
|
// 当日用电量
|
|
|
|
|
|
|
|
target.setUsrPowerDay(useService.use(day,station.getCode())); |
|
|
|
|
|
|
|
if(StationConstants.DATA_ORIGIN_FILL.equals(station.getDataOrigin())){ |
|
|
|
|
|
|
|
// 30天用电量
|
|
|
|
|
|
|
|
target.setUsrPowerVoList(useService.use30Day(day,station.getCode())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 近3年用电量
|
|
|
|
|
|
|
|
target.setUsrYearMap(this.useThreeYear(station.getCode())); |
|
|
|
|
|
|
|
return target; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 填报近3年发电量 |
|
|
|
|
|
|
|
* @param station |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Map<String, Float> useThreeYear(String station) { |
|
|
|
|
|
|
|
// 开始时间
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
|
|
|
|
String end = DateUtil.format(calendar.getTime(),"yyyy-MM"); |
|
|
|
|
|
|
|
// 结束日期
|
|
|
|
|
|
|
|
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
|
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
return useService.generateThreeYear(start,end,station); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 水利首页-指标数据 |
|
|
|
* 水利首页-指标数据 |
|
|
|
* @param deptId |
|
|
|
* @param deptId |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WaterConservancyVo waterConservancy(Long deptId) { |
|
|
|
public WaterConservancyVo waterConservancy(Long deptId) { |
|
|
|
//根据用户权限获取机构
|
|
|
|
// 查询水利站点
|
|
|
|
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); |
|
|
|
List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { |
|
|
|
if (CollectionUtil.isEmpty(stations)) { |
|
|
|
return null; |
|
|
|
return new WaterConservancyVo(); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取水利站点
|
|
|
|
|
|
|
|
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 站点归属机构集合
|
|
|
|
|
|
|
|
List<Long> deptList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(deptList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
WaterConservancyVo response = new WaterConservancyVo(); |
|
|
|
WaterConservancyVo response = new WaterConservancyVo(); |
|
|
|
// 查询指标标题机构
|
|
|
|
// 查询指标标题机构
|
|
|
|
Dept title = this.getTitleDetp(R.getData(),deptId); |
|
|
|
Dept title = this.getTitleDetp(deptId); |
|
|
|
if(ObjectUtil.isNotEmpty(title)){ |
|
|
|
if(ObjectUtil.isNotEmpty(title)){ |
|
|
|
response.setDepartId(title.getId()); |
|
|
|
response.setDepartId(title.getId()); |
|
|
|
response.setDepartName(title.getDeptName()); |
|
|
|
response.setDepartName(title.getDeptName()); |
|
|
|
} |
|
|
|
} |
|
|
|
response.setWaterStationCount((int) stationList.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count()); |
|
|
|
response.setWaterStationCount((int) stations.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count()); |
|
|
|
response.setSluiceGateCount((int) stationList.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count()); |
|
|
|
response.setSluiceGateCount((int) stations.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count()); |
|
|
|
response.setWaterInstall(0.0); |
|
|
|
response.setWaterInstall(0.0); |
|
|
|
response.setWaterPower(0.0); |
|
|
|
response.setWaterPower(0.0); |
|
|
|
response.setKWhYear(0f); |
|
|
|
response.setKWhYear(0f); |
|
|
@ -838,39 +853,35 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
response.setKWhDay(0f); |
|
|
|
response.setKWhDay(0f); |
|
|
|
// 获取设备实时数据
|
|
|
|
// 获取设备实时数据
|
|
|
|
List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key); |
|
|
|
List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if(CollectionUtil.isNotEmpty(list)){ |
|
|
|
return response; |
|
|
|
// 获取站点机构有效设备
|
|
|
|
} |
|
|
|
List<WaterPumpRealVo> valid = list.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList()); |
|
|
|
// 获取站点机构有效设备
|
|
|
|
if(CollectionUtil.isNotEmpty(valid)){ |
|
|
|
List<WaterPumpRealVo> valid = list.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList()); |
|
|
|
// 装机容量
|
|
|
|
if(CollectionUtil.isEmpty(valid)){ |
|
|
|
double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum(); |
|
|
|
return response; |
|
|
|
response.setWaterInstall(waterInstall); |
|
|
|
|
|
|
|
// 有功功率
|
|
|
|
|
|
|
|
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum(); |
|
|
|
|
|
|
|
response.setWaterPower(waterPower); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 装机容量
|
|
|
|
|
|
|
|
double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum(); |
|
|
|
|
|
|
|
response.setWaterInstall(waterInstall); |
|
|
|
|
|
|
|
// 有功功率
|
|
|
|
|
|
|
|
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum(); |
|
|
|
|
|
|
|
response.setWaterPower(waterPower); |
|
|
|
|
|
|
|
// 获取设备指标数据
|
|
|
|
// 获取设备指标数据
|
|
|
|
List<WaterPumpTargetVo> targetList = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(loadwaterpump_target_key); |
|
|
|
List<WaterPumpTargetVo> targetList = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(loadwaterpump_target_key); |
|
|
|
if(CollectionUtil.isEmpty(targetList)){ |
|
|
|
if(CollectionUtil.isNotEmpty(targetList)){ |
|
|
|
return response; |
|
|
|
// 获取站点机构有效设备
|
|
|
|
} |
|
|
|
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList()); |
|
|
|
// 获取站点机构有效设备
|
|
|
|
if(CollectionUtil.isNotEmpty(validTarget)){ |
|
|
|
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList()); |
|
|
|
// 年用电量
|
|
|
|
if(CollectionUtil.isEmpty(valid)){ |
|
|
|
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum(); |
|
|
|
return response; |
|
|
|
response.setKWhYear((float) kwhYear); |
|
|
|
|
|
|
|
// 月用电量
|
|
|
|
|
|
|
|
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum(); |
|
|
|
|
|
|
|
response.setKWhMon((float) kwhMon); |
|
|
|
|
|
|
|
// 日用电量
|
|
|
|
|
|
|
|
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum(); |
|
|
|
|
|
|
|
response.setKWhDay((float) kwhDay); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 年用电量
|
|
|
|
|
|
|
|
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum(); |
|
|
|
|
|
|
|
response.setKWhYear((float) kwhYear); |
|
|
|
|
|
|
|
// 月用电量
|
|
|
|
|
|
|
|
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum(); |
|
|
|
|
|
|
|
response.setKWhMon((float) kwhMon); |
|
|
|
|
|
|
|
// 日用电量
|
|
|
|
|
|
|
|
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum(); |
|
|
|
|
|
|
|
response.setKWhDay((float) kwhDay); |
|
|
|
|
|
|
|
return response; |
|
|
|
return response; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -888,7 +899,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取站点编码集合
|
|
|
|
// 获取站点编码集合
|
|
|
|
List<String> codes = map.entrySet().stream().map(o-> o.getValue().get(0).getCode()).collect(Collectors.toList()); |
|
|
|
List<String> codes = map.values().stream().map(stationEntities -> stationEntities.get(0).getCode()).collect(Collectors.toList()); |
|
|
|
// 获取实时天气
|
|
|
|
// 获取实时天气
|
|
|
|
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes); |
|
|
|
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes); |
|
|
|
// 获取七天天气
|
|
|
|
// 获取七天天气
|
|
|
@ -977,7 +988,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<StationEntity> getStationList(Map<Dept, List<StationEntity>> map) { |
|
|
|
private List<StationEntity> getStationList(Map<Dept, List<StationEntity>> map) { |
|
|
|
return map.values().stream().collect(Collectors.toList()).get(0); |
|
|
|
return new ArrayList<>(map.values()).get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1061,7 +1072,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> codeList = stationList.stream().filter(o->StringUtil.isNotBlank(o.getCode())).map(StationEntity::getCode).collect(Collectors.toList()); |
|
|
|
List<String> codeList = stationList.stream().map(StationEntity::getCode).filter(StringUtil::isNotBlank).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(codeList)){ |
|
|
|
if(CollectionUtil.isEmpty(codeList)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1154,16 +1165,17 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Dept getTitleDetp(List<Dept> authList, Long deptId) { |
|
|
|
public Dept getTitleDetp(Long deptId) { |
|
|
|
|
|
|
|
R<List<Dept>> depts = sysClient.getDeptByCurrentUser(); |
|
|
|
if(null == deptId){ |
|
|
|
if(null == deptId){ |
|
|
|
// 最小类型机构
|
|
|
|
// 最小类型机构
|
|
|
|
Dept dept = authList.stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null); |
|
|
|
Dept dept = depts.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null); |
|
|
|
if(ObjectUtil.isEmpty(dept)){ |
|
|
|
if(ObjectUtil.isEmpty(dept)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
return dept; |
|
|
|
return dept; |
|
|
|
} |
|
|
|
} |
|
|
|
List<Dept> list = authList.stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList()); |
|
|
|
List<Dept> list = depts.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1289,12 +1301,12 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
response.setUsePowerMon((float) kwhMon); |
|
|
|
response.setUsePowerMon((float) kwhMon); |
|
|
|
// 月运行时长
|
|
|
|
// 月运行时长
|
|
|
|
Optional<WaterPumpTargetVo> waterPumpTargetVoOptional = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)); |
|
|
|
Optional<WaterPumpTargetVo> waterPumpTargetVoOptional = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)); |
|
|
|
double monRunTime = waterPumpTargetVoOptional.isPresent() ? waterPumpTargetVoOptional.map(WaterPumpTargetVo::getRunDurationMon).orElse(0.0) : 0.0; |
|
|
|
double monRunTime = waterPumpTargetVoOptional.map(WaterPumpTargetVo::getRunDurationMon).orElse(0.0); |
|
|
|
//double monRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)).get().getRunDurationMon();
|
|
|
|
//double monRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)).get().getRunDurationMon();
|
|
|
|
response.setRunDurationMon(monRunTime); |
|
|
|
response.setRunDurationMon(monRunTime); |
|
|
|
// 年运行时长
|
|
|
|
// 年运行时长
|
|
|
|
Optional<WaterPumpTargetVo> optionalWaterPumpTargetVo = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)); |
|
|
|
Optional<WaterPumpTargetVo> optionalWaterPumpTargetVo = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)); |
|
|
|
double yearRunTime = optionalWaterPumpTargetVo.isPresent() ? optionalWaterPumpTargetVo.map(WaterPumpTargetVo::getRunDurationYear).orElse(0.0) : 0.0; |
|
|
|
double yearRunTime = optionalWaterPumpTargetVo.map(WaterPumpTargetVo::getRunDurationYear).orElse(0.0); |
|
|
|
//double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear();
|
|
|
|
//double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear();
|
|
|
|
response.setRunDurationYear(yearRunTime); |
|
|
|
response.setRunDurationYear(yearRunTime); |
|
|
|
// 水位曲线/年用电量
|
|
|
|
// 水位曲线/年用电量
|
|
|
@ -1496,26 +1508,6 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取近30天集合 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<String> getRecent30Day() { |
|
|
|
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
|
|
|
// 开始日期
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
|
|
|
list.add(df.format(calendar.getTime())); |
|
|
|
|
|
|
|
// 获取日期之间的月
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
while (i < 30) { |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, - 1); |
|
|
|
|
|
|
|
list.add(df.format(calendar.getTime())); |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 闸门列表 |
|
|
|
* 闸门列表 |
|
|
|
* @param deptId |
|
|
|
* @param deptId |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -1536,7 +1528,7 @@ public class WaterServiceImpl implements IWaterService { |
|
|
|
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { |
|
|
|
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
Dept title = this.getTitleDetp(R.getData(),deptId); |
|
|
|
Dept title = this.getTitleDetp(deptId); |
|
|
|
if(ObjectUtil.isEmpty(title)){ |
|
|
|
if(ObjectUtil.isEmpty(title)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|