| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -35,6 +35,9 @@ import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; | 
					 | 
					 | 
					 | 
					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.device.DeviceDataClient; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzinfo.sdk.v5.device.dto.ReductionDataDTO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.hnac.hzinfo.sdk.v5.device.vo.ReductionDataVO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import lombok.Getter; | 
					 | 
					 | 
					 | 
					import lombok.Getter; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import lombok.RequiredArgsConstructor; | 
					 | 
					 | 
					 | 
					import lombok.RequiredArgsConstructor; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -52,6 +55,7 @@ import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.math.BigDecimal; | 
					 | 
					 | 
					 | 
					import java.math.BigDecimal; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.math.RoundingMode; | 
					 | 
					 | 
					 | 
					import java.math.RoundingMode; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.time.LocalDate; | 
					 | 
					 | 
					 | 
					import java.time.LocalDate; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.time.LocalDateTime; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.time.format.DateTimeFormatter; | 
					 | 
					 | 
					 | 
					import java.time.format.DateTimeFormatter; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.*; | 
					 | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.concurrent.*; | 
					 | 
					 | 
					 | 
					import java.util.concurrent.*; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -99,6 +103,8 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						private final IAnalyseDataSearchClient analyseDataSearchClient; | 
					 | 
					 | 
					 | 
						private final IAnalyseDataSearchClient analyseDataSearchClient; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						private final DeviceDataClient deviceDataClient; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						@Value("${hzims.equipment.emInfo.emInfoList}") | 
					 | 
					 | 
					 | 
						@Value("${hzims.equipment.emInfo.emInfoList}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						public String device_cache_cofig_final; | 
					 | 
					 | 
					 | 
						public String device_cache_cofig_final; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1264,6 +1270,74 @@ public class RealTargetServiceImpl implements RealTargetService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							log.info("近年发电量数据接口,总耗时:"+(time3-time)); | 
					 | 
					 | 
					 | 
							log.info("近年发电量数据接口,总耗时:"+(time3-time)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						@Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						public void loadPowerDataNew(List<Integer> types, Integer serveType, int year) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 站点查询
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							List<StationEntity> stationList = stationService.list(new LambdaQueryWrapper<StationEntity>() {{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								eq(StationEntity::getDataOrigin,"0"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (ObjectUtil.isNotEmpty(serveType)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									eq(StationEntity::getServeType, serveType); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (CollectionUtil.isNotEmpty(types)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									in(StationEntity::getType, types); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 设备信息
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							List<EminfoAndEmParamVo> devices  = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									new TypeReference<List<EminfoAndEmParamVo>>() {}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 结束时间
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							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(),DateUtil.PATTERN_DATE) + " 00:00:00"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							LocalDateTime endTime = LocalDateTime.parse(end); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 开始时间
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							LocalDateTime startTime = LocalDateTime.parse(end); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							// 存储数据map:<站点id, <月份, 发电量>>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							Map<Long, Map<String, Float>> powerMap = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							stationList.forEach(station -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								List<PowerMonthVo> datas = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								// 站点设备集合
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								log.info("load_power_data station :" + station.getCode() + "==== device :" + stationDevices); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (CollectionUtil.isNotEmpty(devices)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									stationDevices.forEach(device -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										ReductionDataDTO reductionDataDTO = new ReductionDataDTO(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setDeviceCode(device.getEmCode()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setSaveTimeType(5); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setTimeInterval(1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setBeginTime(startTime); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setEndTime(endTime); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										reductionDataDTO.setNeedPage(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										Result<ReductionDataVO> reductionDataVOResult = deviceDataClient.pageDeviceCodeAndSignages(reductionDataDTO); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										if (!reductionDataVOResult.isSuccess() || CollectionUtil.isEmpty(reductionDataVOResult.getData().getDataList())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										List<Map<String, String>> dataList = reductionDataVOResult.getData().getDataList(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										datas.addAll(dataList.stream().map(data -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											PowerMonthVo generate = new PowerMonthVo(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											Date time = DateUtil.parse(data.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					//						generate.setPower(Float.parseFloat(Optional.ofNullable(data.get(HomePageConstant.HYDROPOWER_GENERATE_POWER))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					//								.orElse("0")) * device.getRideCount());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											return generate; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										}).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								// 补充填报数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								datas.addAll(this.generateFill(station,start,end)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (CollectionUtil.isEmpty(datas)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								Map<String, Float> map = datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								powerMap.put(station.getId(), map); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							redisTemplate.opsForValue().set(recent_year_power_data, powerMap); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * 近年发电量数据 | 
					 | 
					 | 
					 | 
						 * 近年发电量数据 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * | 
					 | 
					 | 
					 | 
						 * | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |