|
|
|
@ -22,6 +22,7 @@ import com.hnac.hzinfo.datasearch.history.OriginalDataQuery;
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import net.sf.jsqlparser.expression.StringValue; |
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
@ -87,8 +88,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
|
|
|
|
|
private final static String recent_year_power_data = "hzims:operation:key:power:data"; |
|
|
|
|
|
|
|
|
|
private final static String recent_year_load_data = "hzims:operation:key:load:data"; |
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.realIdKey}") |
|
|
|
|
public String real_id_key; |
|
|
|
|
|
|
|
|
@ -109,28 +108,33 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
} |
|
|
|
|
// 取redis实时数据
|
|
|
|
|
Map<String, String> map = this.getRealData(); |
|
|
|
|
List<PhotovoltaicRealVo> list = new ArrayList<>(); |
|
|
|
|
Random random = new Random(); |
|
|
|
|
devices.forEach(device -> { |
|
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// redis缓存设备实时数据
|
|
|
|
|
List<PhotovoltaicRealVo> history = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key); |
|
|
|
|
// 设备实时数据
|
|
|
|
|
List<PhotovoltaicRealVo> list = devices.stream().map(device -> { |
|
|
|
|
PhotovoltaicRealVo real = new PhotovoltaicRealVo(); |
|
|
|
|
real.setDeptId(device.getCreateDept()); |
|
|
|
|
real.setDeviceCode(device.getEmCode()); |
|
|
|
|
real.setDeviceName(device.getName()); |
|
|
|
|
real.setState(random.nextInt(2) - 1); |
|
|
|
|
real.setState(this.getPhotovoltaicState(device,map)); |
|
|
|
|
// 容量
|
|
|
|
|
real.setCapacity(device.getInstalledCapacity()); |
|
|
|
|
// 发电量
|
|
|
|
|
real.setGenerate(random.nextDouble() * 25000 * 300 * 2); |
|
|
|
|
real.setGenerate(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_GENERATION_CAPACITY))); |
|
|
|
|
// 功率
|
|
|
|
|
real.setLoad(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_LOAD))); |
|
|
|
|
// 电压
|
|
|
|
|
real.setVoltage(random.nextDouble() * 300); |
|
|
|
|
real.setVoltage(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_VOLTAGE))); |
|
|
|
|
// 电流
|
|
|
|
|
real.setCurrent(random.nextDouble() * 300); |
|
|
|
|
// 功率
|
|
|
|
|
real.setLoad(random.nextDouble() * 300); |
|
|
|
|
real.setCurrent(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_CURRENT))); |
|
|
|
|
// 上次功率
|
|
|
|
|
real.setLastLoad(random.nextDouble() * 300); |
|
|
|
|
list.add(real); |
|
|
|
|
}); |
|
|
|
|
real.setLastLoad(this.getLastLoad(device,history)); |
|
|
|
|
return real; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
// 存储redis
|
|
|
|
|
redisTemplate.opsForValue().set(load_photovoltaic_real_key, list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -147,7 +151,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
List<PhotovoltaicTargetVo> list = new ArrayList<>(); |
|
|
|
|
Random random = new Random(); |
|
|
|
|
devices.forEach(device -> { |
|
|
|
|
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); |
|
|
|
|
target.setDeptId(device.getCreateDept()); |
|
|
|
@ -155,53 +158,189 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
target.setDeviceName(device.getName()); |
|
|
|
|
target.setDeptName(device.getName()); |
|
|
|
|
// 当日运行时长
|
|
|
|
|
// target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY)));
|
|
|
|
|
// 当天有功功率
|
|
|
|
|
// List<ActivePowerVo> activePowerVoList = waterService.getActivePowerVoList(device);
|
|
|
|
|
// FIXME 测试数据
|
|
|
|
|
// 当天运行时长
|
|
|
|
|
target.setRunHours(new Random().nextDouble() * 24); |
|
|
|
|
//target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY)));
|
|
|
|
|
// 年发电量
|
|
|
|
|
target.setGenerationYear(random.nextDouble() * 25000 * 360); |
|
|
|
|
target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"0")); |
|
|
|
|
// 月发电量
|
|
|
|
|
target.setGenerationMon(random.nextDouble() * 25000 * 30); |
|
|
|
|
target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"1")); |
|
|
|
|
// 日发电量
|
|
|
|
|
target.setGenerationDay(random.nextDouble() * 25000); |
|
|
|
|
target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"2")); |
|
|
|
|
// 昨日发电量
|
|
|
|
|
target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"3")); |
|
|
|
|
// 收益
|
|
|
|
|
target.setIncome(target.getGenerationDay() * 0.34); |
|
|
|
|
// 昨日发电量
|
|
|
|
|
target.setGenerationYesterday(random.nextDouble() * 25000); |
|
|
|
|
// 节约标准煤
|
|
|
|
|
target.setTec(target.getGenerationMon() * 0.0001229); |
|
|
|
|
// 二氧化碳减排
|
|
|
|
|
target.setCo2(target.getGenerationMon() * 0.000997); |
|
|
|
|
// 减少森林砍伐
|
|
|
|
|
target.setDeforest(target.getGenerationMon() * 0.000553); |
|
|
|
|
// FIXME 测试模拟数据30天功率
|
|
|
|
|
List<PhotovoltaicPowerVo> photovoltaicPowers = this.activePowerVoList(device); |
|
|
|
|
target.setActivePowerVoList(photovoltaicPowers); |
|
|
|
|
// 当天有功功率
|
|
|
|
|
target.setActivePowerVoList(this.getLoadsByDay(device)); |
|
|
|
|
// 30天发电量
|
|
|
|
|
List<GenerationPowerVo> generationPowerVoList = this.getGenerationPowerList(device); |
|
|
|
|
target.setGenerationPowerVoList(generationPowerVoList); |
|
|
|
|
target.setGenerationPowerVoList(this.getGenerateByMon(device)); |
|
|
|
|
list.add(target); |
|
|
|
|
}); |
|
|
|
|
redisTemplate.opsForValue().set(load_photovoltaic_target_key, list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// FIXME 测试模拟
|
|
|
|
|
private List<PhotovoltaicPowerVo> activePowerVoList(EminfoAndEmParamVo device) { |
|
|
|
|
List<String> hours = getTestDay(); |
|
|
|
|
Random random = new Random(); |
|
|
|
|
return hours.stream().map(hour -> { |
|
|
|
|
PhotovoltaicPowerVo power = new PhotovoltaicPowerVo(); |
|
|
|
|
power.setHour(hour); |
|
|
|
|
power.setActivePower(String.valueOf(random.nextDouble() * 500)); |
|
|
|
|
return power; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
/** |
|
|
|
|
* 当天有功功率 |
|
|
|
|
* @param device |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
|
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,1,2,device.getEmCode(),HomePageConstant.PV_LOAD); |
|
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
return records.stream().map(record -> { |
|
|
|
|
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); |
|
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
load.setHour(time.getHours()); |
|
|
|
|
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); |
|
|
|
|
return load; |
|
|
|
|
}).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 近30天发电量 |
|
|
|
|
* @param device |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<GenerationPowerVo> getGenerateByMon(EminfoAndEmParamVo device) { |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -29); |
|
|
|
|
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<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
return records.stream().map(record -> { |
|
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
|
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
|
return generate; |
|
|
|
|
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据事件查询数据值 |
|
|
|
|
* @param deviceCode |
|
|
|
|
* @param rideCount |
|
|
|
|
* @param type |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private float sumValueByTime(String deviceCode, int rideCount,String type) { |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
String start = null,end = null; |
|
|
|
|
Integer cycleType = 3; |
|
|
|
|
switch (type){ |
|
|
|
|
//年
|
|
|
|
|
case "0": |
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, + 1); |
|
|
|
|
end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 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)); |
|
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
cycleType = 6; |
|
|
|
|
break; |
|
|
|
|
//月
|
|
|
|
|
case "1": |
|
|
|
|
start = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00"; |
|
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
cycleType = 5; |
|
|
|
|
break; |
|
|
|
|
//日
|
|
|
|
|
case "2": |
|
|
|
|
start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
|
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
break; |
|
|
|
|
//昨日
|
|
|
|
|
case "3": |
|
|
|
|
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)); |
|
|
|
|
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,cycleType,deviceCode,rideCount,HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取上一次功率 |
|
|
|
|
* @param device |
|
|
|
|
* @param history |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private Double getLastLoad(EminfoAndEmParamVo device, List<PhotovoltaicRealVo> history) { |
|
|
|
|
if(CollectionUtil.isEmpty(history)){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
|
List<PhotovoltaicRealVo> historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(historyDevice)){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
|
return historyDevice.get(0).getLoad(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取开机状态 |
|
|
|
|
* @param device |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private int getPhotovoltaicState(EminfoAndEmParamVo device,Map<String,String> map) { |
|
|
|
|
// 获取开关机监测点实时数据
|
|
|
|
|
String value = this.getSignageValue(device,map,HomePageConstant.PV_JOINT_RELAY); |
|
|
|
|
// 开机状态
|
|
|
|
|
if (HomePageConstant.OFF.equals(value)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取监测点实时数据 |
|
|
|
|
* @param em |
|
|
|
|
* @param map |
|
|
|
|
* @param targets |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private String getSignageValue(EminfoAndEmParamVo em,Map<String,String> map, String targets) { |
|
|
|
|
if(ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)){ |
|
|
|
|
return "0"; |
|
|
|
|
} |
|
|
|
|
Map<String,String> point = em.getPoint(); |
|
|
|
|
if(MapUtils.isEmpty(point)){ |
|
|
|
|
return "0"; |
|
|
|
|
} |
|
|
|
|
String realId = point.get(targets); |
|
|
|
|
if(StringUtil.isEmpty(realId)){ |
|
|
|
|
return "0"; |
|
|
|
|
} |
|
|
|
|
String value = map.get(realId); |
|
|
|
|
if(StringUtil.isEmpty(realId)){ |
|
|
|
|
return "0"; |
|
|
|
|
} |
|
|
|
|
// 获取value
|
|
|
|
|
return value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当天运行时长 |
|
|
|
|
* |
|
|
|
|
* @param realId |
|
|
|
@ -297,7 +436,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
private long runTime(List<PointData> result, Date startDate, Date endDate) { |
|
|
|
|
if (result.size() == 1) { |
|
|
|
|
// 一直开机
|
|
|
|
|
if (HomePageConstant.OFF.equals(result.get(0).getValue())) { |
|
|
|
|
if (HomePageConstant.PHOTOVOLTAIC_OFF.equals(result.get(0).getValue())) { |
|
|
|
|
return endDate.getTime() - startDate.getTime(); |
|
|
|
|
} |
|
|
|
|
// 一直关机
|
|
|
|
@ -365,56 +504,10 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
default: |
|
|
|
|
throw new IllegalStateException("Unexpected value: " + scope); |
|
|
|
|
} |
|
|
|
|
return homePageService.getAnalyzeCodeAndSignages(device, startTime, endTime, cycle, HomePageConstant.PHOTOVOLTAIC_GENERATE); |
|
|
|
|
return homePageService.getAnalyzeCodeAndSignages(device, startTime, endTime, cycle, HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 近30天发电量 |
|
|
|
|
* |
|
|
|
|
* @param device |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { |
|
|
|
|
List<GenerationPowerVo> generationPowerVoList = new ArrayList<>(); |
|
|
|
|
// 近30天日期集合
|
|
|
|
|
Random random = new Random(); |
|
|
|
|
List<String> dayList = this.getRecent30Day(); |
|
|
|
|
for (int i = 0; i < dayList.size() - 1; i++) { |
|
|
|
|
GenerationPowerVo generationPowerVo = new GenerationPowerVo(); |
|
|
|
|
generationPowerVo.setDate(dayList.get(i)); |
|
|
|
|
// 某天发电量
|
|
|
|
|
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00", EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(), HomePageConstant.PHOTOVOLTAIC_GENERATE); |
|
|
|
|
generationPowerVo.setGenerate(power); |
|
|
|
|
generationPowerVo.setLoad((float) (random.nextDouble() * 500)); |
|
|
|
|
generationPowerVoList.add(generationPowerVo); |
|
|
|
|
} |
|
|
|
|
return generationPowerVoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 近7天发电量 |
|
|
|
|
* |
|
|
|
|
* @param device |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<GenerationPowerVo> getGenerationPowerWeek(EminfoAndEmParamVo device) { |
|
|
|
|
List<GenerationPowerVo> generationPowerVoList = new ArrayList<>(); |
|
|
|
|
// 近一周日期集合
|
|
|
|
|
List<String> dayList = this.getRecentWeek(); |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("EEEE"); |
|
|
|
|
for (int i = 0; i < dayList.size() - 1; i++) { |
|
|
|
|
GenerationPowerVo generationPowerVo = new GenerationPowerVo(); |
|
|
|
|
generationPowerVo.setDate(sdf.format(DateUtil.parse(dayList.get(i), DateUtil.PATTERN_DATE))); |
|
|
|
|
// 某天发电量
|
|
|
|
|
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00", EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(), HomePageConstant.PHOTOVOLTAIC_GENERATE); |
|
|
|
|
generationPowerVo.setGenerate(power); |
|
|
|
|
generationPowerVoList.add(generationPowerVo); |
|
|
|
|
} |
|
|
|
|
return generationPowerVoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当天功率 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
@ -462,30 +555,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取近30天集合 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<String> getRecent30Day() { |
|
|
|
|
// 日期格式化yyyy-mm-dd
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE); |
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
// 开始日期
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
calendar.add(Calendar.DATE, +1); |
|
|
|
|
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()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取实时数据 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
@ -922,7 +991,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
// 获取实时天气
|
|
|
|
|
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(Collections.singletonList(station.getCode())); |
|
|
|
|
if (MapUtils.isNotEmpty(nowWeather)) { |
|
|
|
|
subordinate.setTemp(nowWeather.get(station.getCode()).getNow().getTemp()); |
|
|
|
|
subordinate.setNow(nowWeather.get(station.getCode()).getNow()); |
|
|
|
|
} |
|
|
|
|
// 容量、实时功率、今日发电量
|
|
|
|
|
this.subordinateTargetData(subordinate, entry.getValue().stream().collect(Collectors.toList()), deviceReals, deviceTargets); |
|
|
|
@ -1049,7 +1118,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
|
|
|
|
|
photovoltaic.setStationCode(station.getCode()); |
|
|
|
|
photovoltaic.setDeptId(station.getRefDept()); |
|
|
|
|
photovoltaic.setDeptName(station.getName()); |
|
|
|
|
photovoltaic.setTemp(this.temp(weather, station.getCode())); |
|
|
|
|
photovoltaic.setNow(weather.get(station.getCode()).getNow()); |
|
|
|
|
photovoltaic.setAddress(station.getAddress()); |
|
|
|
|
// 站点实时数据: 设备状态统计、实时功率、总发电量 、 日发电量 、 月发电量 、 co2减排 、 节约标准煤减排 、 减少森林砍伐
|
|
|
|
|
this.app_data(photovoltaic); |
|
|
|
|