|
|
@ -3,10 +3,38 @@ package com.hnac.hzims.operational.report.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.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
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.equipment.entity.EmInfoEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.vo.RideDeviceVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.service.IAnalyseDataService; |
|
|
|
import com.hnac.hzims.operational.report.entity.RunMonthEntity; |
|
|
|
import com.hnac.hzims.operational.report.entity.RunMonthEntity; |
|
|
|
import com.hnac.hzims.operational.report.mapper.RunMonthMapper; |
|
|
|
import com.hnac.hzims.operational.report.mapper.RunMonthMapper; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthService; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthService; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.station.vo.StationVO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.PointData; |
|
|
|
|
|
|
|
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.history.IHistoryDataSearchClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.history.OriginalDataQuery; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.soe.ISoeClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.dto.StbAnalysisDTO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFFont; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFFont; |
|
|
@ -17,10 +45,9 @@ import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
@ -31,19 +58,33 @@ import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.*; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author ysj |
|
|
|
* @author ysj |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@SuppressWarnings("ALL") |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@AllArgsConstructor |
|
|
|
@AllArgsConstructor |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMonthEntity> implements RunMonthService { |
|
|
|
public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMonthEntity> implements RunMonthService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IStationService stationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataService dataService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ISoeClient soeClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IEmInfoClient deivceClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SoeDataClient soeDataClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IPlanGenertionClient planClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询站点月报运行数据 |
|
|
|
* 查询站点月报运行数据 |
|
|
|
* @param mon |
|
|
|
* @param mon |
|
|
@ -124,6 +165,488 @@ public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMont |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 生成站点月报 |
|
|
|
|
|
|
|
* @param mon |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Boolean generate(String mon, String stationCode) { |
|
|
|
|
|
|
|
// 步骤2.查询站点
|
|
|
|
|
|
|
|
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(StationEntity::getDataOrigin, HomePageConstant.DATA_ORIGIN) |
|
|
|
|
|
|
|
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER) |
|
|
|
|
|
|
|
.eq(StationEntity::getCode,stationCode) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(station)){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到站点信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 查询站点设备
|
|
|
|
|
|
|
|
List<RideDeviceVo> devices = deivceClient.rideDevices(Collections.singletonList(station.getRefDept())); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
|
|
|
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 计划发电量
|
|
|
|
|
|
|
|
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(stationCode), null , DateUtil.format(new Date(),"yyyy")); |
|
|
|
|
|
|
|
RunMonthEntity run = new RunMonthEntity(); |
|
|
|
|
|
|
|
run.setTenantId(station.getTenantId()); |
|
|
|
|
|
|
|
run.setCreateDept(station.getRefDept()); |
|
|
|
|
|
|
|
run.setCreateUser(station.getCreateUser()); |
|
|
|
|
|
|
|
run.setUpdateUser(station.getUpdateUser()); |
|
|
|
|
|
|
|
run.setStationCode(station.getCode()); |
|
|
|
|
|
|
|
run.setStationName(station.getName()); |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(org.springblade.core.tool.utils.DateUtil.parse("2024-05-01 00:00:00", org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
|
|
|
|
run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); |
|
|
|
|
|
|
|
List<RideDeviceVo> stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 运行数据
|
|
|
|
|
|
|
|
run.setRunData(this.runData(station.getCode(),stationDevices,plans)); |
|
|
|
|
|
|
|
// 告警数据
|
|
|
|
|
|
|
|
run.setAlarmData(this.alarmData(station.getCode())); |
|
|
|
|
|
|
|
// 月度运行曲线
|
|
|
|
|
|
|
|
run.setCurveData(this.curveData(stationDevices)); |
|
|
|
|
|
|
|
// TODO 运行数据分析
|
|
|
|
|
|
|
|
// TODO 运行建议及其他
|
|
|
|
|
|
|
|
// TODO 保存生成月报数据
|
|
|
|
|
|
|
|
// runMonService.save(run);
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 运行数据 |
|
|
|
|
|
|
|
* @param devices |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String runData(String stationCode,List<RideDeviceVo> devices,List<PlanGenerationEntity> plans) { |
|
|
|
|
|
|
|
List<RunDataVo> runs = new ArrayList<>(); |
|
|
|
|
|
|
|
devices.forEach(device->{ |
|
|
|
|
|
|
|
RunDataVo run = new RunDataVo(); |
|
|
|
|
|
|
|
run.setDeviceCode(device.getNumber()); |
|
|
|
|
|
|
|
run.setDeviceName(device.getName()); |
|
|
|
|
|
|
|
// 运行时长
|
|
|
|
|
|
|
|
run.setRunHours(this.runHours(device)); |
|
|
|
|
|
|
|
// 月发电量
|
|
|
|
|
|
|
|
Double day = this.generates(0,device.getNumber(),device.getRide()); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(day)){ |
|
|
|
|
|
|
|
run.setGenerate(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
run.setGenerate(day/10000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 年发电量
|
|
|
|
|
|
|
|
Double year = this.generates(1,device.getNumber(),device.getRide()); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(day)){ |
|
|
|
|
|
|
|
run.setGenerateYear(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
run.setGenerateYear(year/10000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 计划发电量
|
|
|
|
|
|
|
|
run.setPlan(this.planGenerate(0,stationCode,plans)/10000); |
|
|
|
|
|
|
|
// 年计划发电量
|
|
|
|
|
|
|
|
run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); |
|
|
|
|
|
|
|
runs.add(run); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return JSONObject.toJSONString(runs); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 实际发电量 |
|
|
|
|
|
|
|
* @param type |
|
|
|
|
|
|
|
* @param deviceCode |
|
|
|
|
|
|
|
* @param ride |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double generates(int type,String deviceCode,double ride) { |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
String end = null,start = null; |
|
|
|
|
|
|
|
int cycleType = 5; |
|
|
|
|
|
|
|
switch (type){ |
|
|
|
|
|
|
|
case 0 : |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
|
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1 : |
|
|
|
|
|
|
|
cycleType = 6; |
|
|
|
|
|
|
|
end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH)); |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Double.valueOf(dataService.periodTargetFloat(start,end,5,cycleType,deviceCode,ride,HomePageConstant.HYDROPOWER_GENERATE_POWER)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 计划发电量 |
|
|
|
|
|
|
|
* @param type |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
* @param plans |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double planGenerate(int type, String stationCode,List<PlanGenerationEntity> plans) { |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
if(type == 0){ |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); |
|
|
|
|
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
|
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
|
|
|
|
String time = DateUtil.format(calendar.getTime(),"yyyy-MM"); |
|
|
|
|
|
|
|
return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) |
|
|
|
|
|
|
|
.mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String time = DateUtil.format(calendar.getTime(),"yyyy"); |
|
|
|
|
|
|
|
return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) |
|
|
|
|
|
|
|
.mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取运行数据 |
|
|
|
|
|
|
|
* @param device |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Double runHours(EmInfoEntity device) { |
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 确定查询时间范围: 年、月
|
|
|
|
|
|
|
|
Date startDate,endDate; |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
endDate = calendar.getTime(); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
|
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
|
|
|
|
startDate = calendar.getTime(); |
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 告警数据 |
|
|
|
|
|
|
|
* @param code |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String alarmData(String code) { |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
|
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,1); |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
// HZ3000:故障告警
|
|
|
|
|
|
|
|
List<RunAlarmVo> alarms = this.hz3000Alarm(code,start,end); |
|
|
|
|
|
|
|
// FIXME 设备实例:一级告警
|
|
|
|
|
|
|
|
// FDP智能预警
|
|
|
|
|
|
|
|
alarms.addAll(this.intelligentEarly(code,start,end)); |
|
|
|
|
|
|
|
return JSONObject.toJSONString(alarms); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 查询hz3000告警 |
|
|
|
|
|
|
|
* @param code |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<RunAlarmVo> hz3000Alarm(String code,String start,String end) { |
|
|
|
|
|
|
|
SoeQueryConditionByStation query = new SoeQueryConditionByStation(); |
|
|
|
|
|
|
|
query.setStationIds(Collections.singletonList(code)); |
|
|
|
|
|
|
|
query.setTypes(Collections.singletonList(AlarmHandleConstant.FAULT)); |
|
|
|
|
|
|
|
query.setBeginTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); |
|
|
|
|
|
|
|
query.setEndTime(LocalDateTime.parse(end,DateUtil.DATETIME_FORMATTER)); |
|
|
|
|
|
|
|
query.setNeedPage(false); |
|
|
|
|
|
|
|
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query); |
|
|
|
|
|
|
|
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result.getData().getRecords().stream().collect(Collectors.groupingBy(SoeData::getSoeExplain)).entrySet().stream().map(entry->{ |
|
|
|
|
|
|
|
RunAlarmVo alarm = new RunAlarmVo(); |
|
|
|
|
|
|
|
alarm.setAlarmTime(DateUtil.format(entry.getValue().stream().sorted(Comparator.comparing(SoeData::getTs)).collect(Collectors.toList()).get(0).getTs(),DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
alarm.setDeviceName(entry.getValue().get(0).getDeviceName()); |
|
|
|
|
|
|
|
alarm.setContent(entry.getKey()); |
|
|
|
|
|
|
|
alarm.setType(String.valueOf(AlarmConstants.FAULT)); |
|
|
|
|
|
|
|
alarm.setTypeName("故障"); |
|
|
|
|
|
|
|
alarm.setCount(Math.max(entry.getValue().stream().filter(o->StringUtil.isNotBlank(o.getTraceCount())).mapToInt(soe->Integer.parseInt(soe.getTraceCount())).sum(), 1)); |
|
|
|
|
|
|
|
return alarm; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 智能预警 |
|
|
|
|
|
|
|
* @param code |
|
|
|
|
|
|
|
* @param start |
|
|
|
|
|
|
|
* @param end |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<RunAlarmVo> intelligentEarly(String code, String start, String end) { |
|
|
|
|
|
|
|
StbAnalysisDTO param = new StbAnalysisDTO(); |
|
|
|
|
|
|
|
param.setStartTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); |
|
|
|
|
|
|
|
param.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER)); |
|
|
|
|
|
|
|
param.setStations(Collections.singletonList(code)); |
|
|
|
|
|
|
|
param.setNeedPage(false); |
|
|
|
|
|
|
|
Result<HzPage<StbAnalysisVO>> result = soeDataClient.pageStbAnalysis(param); |
|
|
|
|
|
|
|
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result.getData().getRecords().stream().collect(Collectors.groupingBy(StbAnalysisVO::getName)).entrySet().stream().map(entry->{ |
|
|
|
|
|
|
|
RunAlarmVo alarm = new RunAlarmVo(); |
|
|
|
|
|
|
|
alarm.setAlarmTime(entry.getValue().stream().sorted(Comparator.comparing(StbAnalysisVO::getTs)).collect(Collectors.toList()).get(0).getTs()); |
|
|
|
|
|
|
|
alarm.setDeviceName(entry.getValue().get(0).getOrd()); |
|
|
|
|
|
|
|
alarm.setContent(entry.getKey()); |
|
|
|
|
|
|
|
alarm.setType(String.valueOf(AlarmConstants.EARLY)); |
|
|
|
|
|
|
|
alarm.setTypeName("智能预警"); |
|
|
|
|
|
|
|
alarm.setReason(entry.getValue().get(0).getFinfo()); |
|
|
|
|
|
|
|
alarm.setMemo(entry.getValue().get(0).getInfo()); |
|
|
|
|
|
|
|
alarm.setCount(entry.getValue().size()); |
|
|
|
|
|
|
|
return alarm; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 运行曲线 |
|
|
|
|
|
|
|
* @param devices |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String curveData(List<RideDeviceVo> devices) { |
|
|
|
|
|
|
|
List<CurveEchartVo> curveDatas = devices.stream().map(device -> { |
|
|
|
|
|
|
|
CurveEchartVo curveData = new CurveEchartVo(); |
|
|
|
|
|
|
|
curveData.setDeviceCode(device.getNumber()); |
|
|
|
|
|
|
|
curveData.setDeviceName(device.getName()); |
|
|
|
|
|
|
|
// 负荷曲线
|
|
|
|
|
|
|
|
curveData.setLoadCurve(this.curve(this.attribute(0), device.getNumber())); |
|
|
|
|
|
|
|
// 轴承温度曲线
|
|
|
|
|
|
|
|
curveData.setBearingTempCurve(this.curve(this.attribute(1), device.getNumber())); |
|
|
|
|
|
|
|
// 定子温度曲线
|
|
|
|
|
|
|
|
curveData.setStatorTempCurve(this.curve(this.attribute(2), device.getNumber())); |
|
|
|
|
|
|
|
return curveData; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return JSONObject.toJSONString(curveDatas); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取曲线数据 |
|
|
|
|
|
|
|
* @param attributes |
|
|
|
|
|
|
|
* @param deviceCode |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<EchartVo> curve(List<AttributeVo> attributes, String deviceCode) { |
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
//calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME));
|
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
|
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
List<AnalyzeDataConditionVO> datas = dataService.periodTargetSignages(start,end,3,3,deviceCode,attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDatas = new ArrayList<>(); |
|
|
|
|
|
|
|
Calendar day = Calendar.getInstance(); |
|
|
|
|
|
|
|
datas.forEach(data->{ |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(data.getList())){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
analyseDatas.addAll(data.getList().stream().peek(item->{ |
|
|
|
|
|
|
|
item.setSignage(data.getSignage()); |
|
|
|
|
|
|
|
Date date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
day.setTime(date); |
|
|
|
|
|
|
|
item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH))); |
|
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(analyseDatas)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String,List<AnalyseDataTaosVO>> map = analyseDatas.stream().collect(Collectors.groupingBy(AnalyseDataTaosVO::getTs)); |
|
|
|
|
|
|
|
return map.entrySet().stream().map(entry->{ |
|
|
|
|
|
|
|
EchartVo echart = new EchartVo(); |
|
|
|
|
|
|
|
echart.setTime(Integer.valueOf(entry.getKey())); |
|
|
|
|
|
|
|
echart.setValues(entry.getValue().stream().map(value->{ |
|
|
|
|
|
|
|
EchartValueVo echartValue = new EchartValueVo(); |
|
|
|
|
|
|
|
echartValue.setAttribute(value.getSignage()); |
|
|
|
|
|
|
|
echartValue.setAttributeName(attributes.stream().filter(o->o.getSignage().equals(value.getSignage())).collect(Collectors.toList()).get(0).getSignageName()); |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(value.getVal())){ |
|
|
|
|
|
|
|
echartValue.setValue(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
echartValue.setValue(Double.parseDouble(value.getVal())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return echartValue; |
|
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
return echart; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(EchartVo::getTime)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 曲线属性获取 |
|
|
|
|
|
|
|
* @param attributeType |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<AttributeVo> attribute(int attributeType) { |
|
|
|
|
|
|
|
List<AttributeVo> attributes = new ArrayList<>(); |
|
|
|
|
|
|
|
switch (attributeType){ |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
AttributeVo attribute = new AttributeVo(); |
|
|
|
|
|
|
|
attribute.setSignage(HomePageConstant.ACTIVE_POWER); |
|
|
|
|
|
|
|
attribute.setSignageName("负荷"); |
|
|
|
|
|
|
|
attributes.add(attribute); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AttributeVo upper_temp = new AttributeVo(); |
|
|
|
|
|
|
|
upper_temp.setSignage(HomePageConstant.UPPER_GUIDE_BEARING_TEMP); |
|
|
|
|
|
|
|
upper_temp.setSignageName("上导轴承瓦温1"); |
|
|
|
|
|
|
|
attributes.add(upper_temp); |
|
|
|
|
|
|
|
AttributeVo oil_tem = new AttributeVo(); |
|
|
|
|
|
|
|
oil_tem.setSignage(HomePageConstant.UPPER_GUIDE_BEARING_OIL_GROOVE_TEMP); |
|
|
|
|
|
|
|
oil_tem.setSignageName("上导轴承油槽温度"); |
|
|
|
|
|
|
|
attributes.add(oil_tem); |
|
|
|
|
|
|
|
AttributeVo thrust_tem = new AttributeVo(); |
|
|
|
|
|
|
|
thrust_tem.setSignage(HomePageConstant.THRUST_BEARING_TEMP); |
|
|
|
|
|
|
|
thrust_tem.setSignageName("推力轴瓦温度1"); |
|
|
|
|
|
|
|
attributes.add(thrust_tem); |
|
|
|
|
|
|
|
AttributeVo lower_tem = new AttributeVo(); |
|
|
|
|
|
|
|
lower_tem.setSignage(HomePageConstant.LOWER_GUIDE_BEARING_TEMP); |
|
|
|
|
|
|
|
lower_tem.setSignageName("下导轴承瓦温1"); |
|
|
|
|
|
|
|
attributes.add(lower_tem); |
|
|
|
|
|
|
|
AttributeVo tank_tem = new AttributeVo(); |
|
|
|
|
|
|
|
tank_tem.setSignage(HomePageConstant.LOWER_GUIDE_OIL_TANK_TEMP); |
|
|
|
|
|
|
|
tank_tem.setSignageName("下导油槽温度"); |
|
|
|
|
|
|
|
attributes.add(tank_tem); |
|
|
|
|
|
|
|
AttributeVo tile_tem = new AttributeVo(); |
|
|
|
|
|
|
|
tile_tem.setSignage(HomePageConstant.WATER_GUIDE_TILE_TEMP); |
|
|
|
|
|
|
|
tile_tem.setSignageName("水导瓦温"); |
|
|
|
|
|
|
|
attributes.add(tile_tem); |
|
|
|
|
|
|
|
AttributeVo water_tem = new AttributeVo(); |
|
|
|
|
|
|
|
water_tem.setSignage(HomePageConstant.WATER_GUIDE_OIL_TANK_TEMP); |
|
|
|
|
|
|
|
water_tem.setSignageName("水导油槽温度"); |
|
|
|
|
|
|
|
attributes.add(water_tem); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
AttributeVo A_tem = new AttributeVo(); |
|
|
|
|
|
|
|
A_tem.setSignage(HomePageConstant.A_PHASE_IRON_CORE_TEMP); |
|
|
|
|
|
|
|
A_tem.setSignageName("A相铁芯温度1"); |
|
|
|
|
|
|
|
attributes.add(A_tem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AttributeVo B_tem = new AttributeVo(); |
|
|
|
|
|
|
|
B_tem.setSignage(HomePageConstant.B_PHASE_IRON_CORE_TEMP); |
|
|
|
|
|
|
|
B_tem.setSignageName("B相铁芯温度1"); |
|
|
|
|
|
|
|
attributes.add(B_tem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AttributeVo C_tem = new AttributeVo(); |
|
|
|
|
|
|
|
C_tem.setSignage(HomePageConstant.C_PHASE_IRON_CORE_TEMP); |
|
|
|
|
|
|
|
C_tem.setSignageName("C相铁芯温度1"); |
|
|
|
|
|
|
|
attributes.add(C_tem); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return attributes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 检查站点是否存在设备信息 |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Boolean check(String stationCode) { |
|
|
|
|
|
|
|
// 查询站点
|
|
|
|
|
|
|
|
StationVO station = stationService.getStationByCode(stationCode); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(station)){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到站点信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 查询设备
|
|
|
|
|
|
|
|
R<List<EmInfoEntity>> emInfos = deivceClient.getEmInfoByDept(Collections.singletonList(station.getRefDept())); |
|
|
|
|
|
|
|
if(!emInfos.isSuccess() || CollectionUtil.isEmpty(emInfos.getData())){ |
|
|
|
|
|
|
|
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<EmInfoEntity> devices = emInfos.getData().stream().filter(o->"2".equals(o.getEmType())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
|
|
|
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 手绘运行数据表格 |
|
|
|
* 手绘运行数据表格 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -280,16 +803,14 @@ public class RunMonthServiceImpl extends BaseServiceImpl<RunMonthMapper, RunMont |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<CurveYArrayVo> curveToArray(List<EchartVo> curves) { |
|
|
|
private List<CurveYArrayVo> curveToArray(List<EchartVo> curves) { |
|
|
|
List<CurveAttrValueVo> attrValues = new ArrayList<>(); |
|
|
|
List<CurveAttrValueVo> attrValues = new ArrayList<>(); |
|
|
|
curves.forEach(curve->{ |
|
|
|
curves.forEach(curve-> attrValues.addAll(curve.getValues().stream().map(value->{ |
|
|
|
attrValues.addAll(curve.getValues().stream().map(value->{ |
|
|
|
CurveAttrValueVo attrValue = new CurveAttrValueVo(); |
|
|
|
CurveAttrValueVo attrValue = new CurveAttrValueVo(); |
|
|
|
attrValue.setAttribute(value.getAttribute()); |
|
|
|
attrValue.setAttribute(value.getAttribute()); |
|
|
|
attrValue.setAttributeName(value.getAttributeName()); |
|
|
|
attrValue.setAttributeName(value.getAttributeName()); |
|
|
|
attrValue.setTime(curve.getTime()); |
|
|
|
attrValue.setTime(curve.getTime()); |
|
|
|
attrValue.setValue(value.getValue()); |
|
|
|
attrValue.setValue(value.getValue()); |
|
|
|
return attrValue; |
|
|
|
return attrValue; |
|
|
|
}).collect(Collectors.toList()))); |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return attrValues.stream().collect(Collectors.groupingBy(CurveAttrValueVo::getAttribute)).entrySet().stream().map(entry->{ |
|
|
|
return attrValues.stream().collect(Collectors.groupingBy(CurveAttrValueVo::getAttribute)).entrySet().stream().map(entry->{ |
|
|
|
CurveYArrayVo yArray = new CurveYArrayVo(); |
|
|
|
CurveYArrayVo yArray = new CurveYArrayVo(); |
|
|
|
yArray.setAttribute(entry.getKey()); |
|
|
|
yArray.setAttribute(entry.getKey()); |
|
|
|