|
|
@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; |
|
|
|
|
|
|
|
import com.hnac.gglm.bigmodel.api.feign.IDataAnalyseClient; |
|
|
|
import com.hnac.gglm.bigmodel.api.feign.IDataAnalyseClient; |
|
|
|
import com.hnac.gglm.bigmodel.business.dto.*; |
|
|
|
import com.hnac.gglm.bigmodel.business.dto.*; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; |
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
|
|
|
|
import com.hnac.hzims.electric.entity.ThreeEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.electric.feign.IThreeElectricClient; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
@ -29,17 +31,14 @@ import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
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 com.hnac.hzims.operational.station.vo.StationVO; |
|
|
|
import com.hnac.hzims.operational.station.vo.StationVO; |
|
|
|
import com.hnac.hzinfo.datasearch.PointData; |
|
|
|
import com.hnac.hzims.startStop.feign.IStartStopClient; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; |
|
|
|
import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; |
|
|
|
import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; |
|
|
|
import com.hnac.hzinfo.datasearch.history.OriginalDataQuery; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.soe.ISoeClient; |
|
|
|
import com.hnac.hzinfo.datasearch.soe.ISoeClient; |
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; |
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; |
|
|
|
import com.hnac.hzinfo.exception.HzServiceException; |
|
|
|
import com.hnac.hzinfo.exception.HzServiceException; |
|
|
|
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; |
|
|
@ -101,6 +100,10 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
|
|
|
|
|
|
|
|
private final IPlanGenertionClient planClient; |
|
|
|
private final IPlanGenertionClient planClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IStartStopClient startStopClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IThreeElectricClient threeElectricClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IDataAnalyseClient dataAnalyseClient; |
|
|
|
private final IDataAnalyseClient dataAnalyseClient; |
|
|
@ -236,11 +239,18 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
if (CollectionUtil.isEmpty(devices)) { |
|
|
|
if (CollectionUtil.isEmpty(devices)) { |
|
|
|
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); |
|
|
|
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse(mon, "yyyy-MM")); |
|
|
|
|
|
|
|
|
|
|
|
// 计划发电量
|
|
|
|
// 计划发电量
|
|
|
|
DevicePlanGenerationVo param = new DevicePlanGenerationVo(); |
|
|
|
DevicePlanGenerationVo param = new DevicePlanGenerationVo(); |
|
|
|
param.setStationIds(Collections.singletonList(stationCode)); |
|
|
|
param.setStationIds(Collections.singletonList(stationCode)); |
|
|
|
param.setDate(DateUtil.format(new Date(), "yyyy")); |
|
|
|
param.setDate(DateUtil.format(calendar.getTime(), "yyyy")); |
|
|
|
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param); |
|
|
|
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 实际发电量
|
|
|
|
|
|
|
|
List<ThreeEntity> threes = threeElectricClient.electrics(stationCode,DateUtil.format(calendar.getTime(), "yyyy")); |
|
|
|
|
|
|
|
|
|
|
|
RunMonthEntity run = new RunMonthEntity(); |
|
|
|
RunMonthEntity run = new RunMonthEntity(); |
|
|
|
run.setTenantId(station.getTenantId()); |
|
|
|
run.setTenantId(station.getTenantId()); |
|
|
|
run.setCreateDept(station.getRefDept()); |
|
|
|
run.setCreateDept(station.getRefDept()); |
|
|
@ -249,8 +259,6 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
run.setStationCode(station.getCode()); |
|
|
|
run.setStationCode(station.getCode()); |
|
|
|
run.setStationName(station.getName()); |
|
|
|
run.setStationName(station.getName()); |
|
|
|
run.setMonth(mon); |
|
|
|
run.setMonth(mon); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse(mon, "yyyy-MM")); |
|
|
|
|
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
calendar.add(Calendar.MONTH, 1); |
|
|
|
calendar.add(Calendar.MONTH, 1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -1); |
|
|
@ -261,37 +269,16 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
List<CurveEchartVo> curveEcharts = new ArrayList<>(); |
|
|
|
List<CurveEchartVo> curveEcharts = new ArrayList<>(); |
|
|
|
for (RideDeviceVo device : devices) { |
|
|
|
for (RideDeviceVo device : devices) { |
|
|
|
// 运行数据
|
|
|
|
// 运行数据
|
|
|
|
runDatas.add(this.runData(station.getCode(), device, plans, start, end)); |
|
|
|
runDatas.add(this.runData(station.getCode(), device, plans,threes,start,end)); |
|
|
|
// 月度运行曲线
|
|
|
|
|
|
|
|
curveEcharts.add(this.curveData(device, start, end)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*CountDownLatch countDownLatch = new CountDownLatch(devices.size()); |
|
|
|
|
|
|
|
List<RunDataVo> runDatas = new CopyOnWriteArrayList<>(); |
|
|
|
|
|
|
|
List<CurveEchartVo> curveEcharts = new CopyOnWriteArrayList<>(); |
|
|
|
|
|
|
|
for (RideDeviceVo device : devices){ |
|
|
|
|
|
|
|
pool.submit(()->{ |
|
|
|
|
|
|
|
// 运行数据
|
|
|
|
|
|
|
|
runDatas.add(this.runData(station.getCode(),device,plans,start,end)); |
|
|
|
|
|
|
|
// 月度运行曲线
|
|
|
|
// 月度运行曲线
|
|
|
|
curveEcharts.add(this.curveData(device, start, end)); |
|
|
|
curveEcharts.add(this.curveData(device, start, end)); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//所有模板数据获取完成后释放锁
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
countDownLatch.await(); |
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
if (!CollectionUtil.isEmpty(runDatas)) { |
|
|
|
if (!CollectionUtil.isEmpty(runDatas)) { |
|
|
|
run.setRunData(JSONObject.toJSONString(runDatas)); |
|
|
|
run.setRunData(JSONObject.toJSONString(runDatas)); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!CollectionUtil.isEmpty(curveEcharts)) { |
|
|
|
if (!CollectionUtil.isEmpty(curveEcharts)) { |
|
|
|
run.setCurveData(JSONObject.toJSONString(curveEcharts)); |
|
|
|
run.setCurveData(JSONObject.toJSONString(curveEcharts)); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO 运行数据分析
|
|
|
|
|
|
|
|
// TODO 运行建议及其他
|
|
|
|
|
|
|
|
// 先删除原先月报数据
|
|
|
|
// 先删除原先月报数据
|
|
|
|
this.deleteRunReport(mon, stationCode); |
|
|
|
this.deleteRunReport(mon, stationCode); |
|
|
|
// 保存生成月报数据
|
|
|
|
// 保存生成月报数据
|
|
|
@ -473,53 +460,55 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
* @param devices |
|
|
|
* @param devices |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private RunDataVo runData(String stationCode, RideDeviceVo device, List<PlanGenerationEntity> plans, String start, String end) { |
|
|
|
private RunDataVo runData(String stationCode, RideDeviceVo device, List<PlanGenerationEntity> plans,List<ThreeEntity> threes, String start, String end) { |
|
|
|
RunDataVo run = new RunDataVo(); |
|
|
|
RunDataVo run = new RunDataVo(); |
|
|
|
run.setDeviceCode(device.getNumber()); |
|
|
|
run.setDeviceCode(device.getNumber()); |
|
|
|
run.setDeviceName(device.getName()); |
|
|
|
run.setDeviceName(device.getName()); |
|
|
|
// 运行时长
|
|
|
|
// 运行时长
|
|
|
|
run.setRunHours(this.runHours(device, DateUtil.parse(start, DateUtil.PATTERN_DATETIME), DateUtil.parse(end, DateUtil.PATTERN_DATETIME))); |
|
|
|
run.setRunHours(startStopClient.deviceDuration(device.getNumber(),start,end)); |
|
|
|
// 月发电量
|
|
|
|
// 发电量 以万kwh为单位
|
|
|
|
Double day = this.generates(0, device.getNumber(), device.getRide(), start, end); |
|
|
|
if(CollectionUtil.isEmpty(threes)){ |
|
|
|
if (ObjectUtil.isEmpty(day)) { |
|
|
|
|
|
|
|
run.setGenerate(0.0); |
|
|
|
run.setGenerate(0.0); |
|
|
|
} else { |
|
|
|
|
|
|
|
run.setGenerate(day / 10000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 年发电量
|
|
|
|
|
|
|
|
Double year = this.generates(1, device.getNumber(), device.getRide(), start, end); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(day)) { |
|
|
|
|
|
|
|
run.setGenerateYear(0.0); |
|
|
|
run.setGenerateYear(0.0); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
|
|
|
|
// 月发电量 以万kwh为单位
|
|
|
|
|
|
|
|
double generate = threes.stream().filter(o-> StringUtils.isNotEmpty(o.getDeviceCode()) && device.getNumber().equals(o.getDeviceCode()) && start.contains(o.getStrMonth())).mapToDouble(o->o.getGenerate().doubleValue()).sum(); |
|
|
|
|
|
|
|
if(generate > 0){ |
|
|
|
|
|
|
|
run.setGenerate(generate / 10000); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
run.setGenerate(0.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 年发电量 以万kwh为单位
|
|
|
|
|
|
|
|
double year = threes.stream().mapToDouble(o->o.getGenerate().doubleValue()).sum(); |
|
|
|
|
|
|
|
if(year > 0){ |
|
|
|
run.setGenerateYear(year / 10000); |
|
|
|
run.setGenerateYear(year / 10000); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
run.setGenerateYear(0.0); |
|
|
|
} |
|
|
|
} |
|
|
|
// 计划发电量
|
|
|
|
} |
|
|
|
run.setPlan(this.planGenerate(0, stationCode, plans) / 10000); |
|
|
|
// 计划发电量 以万kwh为单位
|
|
|
|
// 年计划发电量
|
|
|
|
if(CollectionUtil.isEmpty(plans)){ |
|
|
|
run.setPlanYear(this.planGenerate(1, stationCode, plans) / 10000); |
|
|
|
run.setPlan(0.0); |
|
|
|
return run; |
|
|
|
run.setPlanYear(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
// 月计划发电量 以万kwh为单位
|
|
|
|
|
|
|
|
double generate = plans.stream().filter(o-> start.contains(o.getDateTime())).mapToDouble(o->o.getPlanGeneration().doubleValue()).sum(); |
|
|
|
|
|
|
|
if(generate > 0){ |
|
|
|
|
|
|
|
run.setPlan(generate / 10000); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
run.setPlan(0.0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
// 年计划发电量 以万kwh为单位
|
|
|
|
* 实际发电量 |
|
|
|
double year = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
* |
|
|
|
if(year > 0){ |
|
|
|
* @param type |
|
|
|
run.setPlanYear(year / 10000); |
|
|
|
* @param deviceCode |
|
|
|
}else{ |
|
|
|
* @param ride |
|
|
|
run.setPlanYear(0.0); |
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double generates(int type, String deviceCode, double ride, String start, String end) { |
|
|
|
|
|
|
|
if (type == 0) { |
|
|
|
|
|
|
|
return Double.valueOf(dataService.periodTargetFloat(start, end, 5, 5, deviceCode, ride, HomePageConstant.HYDROPOWER_GENERATE_POWER)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
} |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
return run; |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DAY_OF_MONTH)); |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
|
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
return Double.valueOf(dataService.periodTargetFloat(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME), end, 5, 6, deviceCode, ride, HomePageConstant.HYDROPOWER_GENERATE_POWER)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -547,86 +536,6 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
.mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
.mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取运行数据 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param device |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double runHours(RideDeviceVo device, Date startDate, Date endDate) { |
|
|
|
|
|
|
|
MultiAnalyzeCodePO analyze = new MultiAnalyzeCodePO(); |
|
|
|
|
|
|
|
analyze.setDeviceCode(device.getNumber()); |
|
|
|
|
|
|
|
analyze.setSignages(Collections.singletonList(HomePageConstant.ACTIVE_POWER)); |
|
|
|
|
|
|
|
List<AnalyzeCodeBySignagesVO> signages = dataService.analyzeCodeBySignages(Collections.singletonList(analyze)); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(signages)) { |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 监测点
|
|
|
|
|
|
|
|
String realId = signages.get(0).getRealId(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(realId)) { |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.getRunConvertData(realId, startDate, endDate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取时间范围内运行时长 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param realId |
|
|
|
|
|
|
|
* @param startDate |
|
|
|
|
|
|
|
* @param endDate |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double getRunConvertData(String realId, Date startDate, Date endDate) { |
|
|
|
|
|
|
|
OriginalDataQuery originalDataQuery = new OriginalDataQuery(); |
|
|
|
|
|
|
|
originalDataQuery.setRealId(realId); |
|
|
|
|
|
|
|
originalDataQuery.setBeginTime(startDate); |
|
|
|
|
|
|
|
originalDataQuery.setEndTime(endDate); |
|
|
|
|
|
|
|
originalDataQuery.setLimit(100000); |
|
|
|
|
|
|
|
originalDataQuery.setPage(1); |
|
|
|
|
|
|
|
// 查询时间范围开关机监测点历史数据
|
|
|
|
|
|
|
|
Result<HzPage<PointData>> result = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); |
|
|
|
|
|
|
|
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 开机运行时长
|
|
|
|
|
|
|
|
long time = this.getRunTime(result.getData().getRecords(), startDate, endDate); |
|
|
|
|
|
|
|
return BigDecimal.valueOf(time / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取运行时长 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param result |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private long getRunTime(List<PointData> result, Date startDate, Date endDate) { |
|
|
|
|
|
|
|
if (result.size() == 1) { |
|
|
|
|
|
|
|
// 一直开机
|
|
|
|
|
|
|
|
if (Double.parseDouble(result.get(0).getValue()) > 0) { |
|
|
|
|
|
|
|
return endDate.getTime() - startDate.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 一直关机
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
long time = 0; |
|
|
|
|
|
|
|
// 遍历累计开机时长
|
|
|
|
|
|
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
|
|
|
|
|
// 记录为开机状态 就计算到下次关机的时间差
|
|
|
|
|
|
|
|
if (Double.parseDouble(result.get(i).getValue()) <= 0) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Date endTime, startTime = DateUtil.parse(result.get(i).getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
// 遍历至最后一条数据,累计至当前时间
|
|
|
|
|
|
|
|
if (i == result.size() - 1) { |
|
|
|
|
|
|
|
endTime = endDate; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
endTime = DateUtil.parse(result.get(i + 1).getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
time += endTime.getTime() - startTime.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return time; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 告警数据 |
|
|
|
* 告警数据 |
|
|
|