|
|
@ -5,15 +5,17 @@ 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.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.entity.EmParamEntity; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.station.StationConstants; |
|
|
|
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.scheduled.service.equipment.DeviceParamService; |
|
|
|
|
|
|
|
import com.hnac.hzims.scheduled.service.equipment.DeviceService; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.*; |
|
|
|
import com.hnac.hzims.scheduled.service.operation.*; |
|
|
|
import com.hnac.hzinfo.datasearch.PointData; |
|
|
|
import com.hnac.hzinfo.datasearch.PointData; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
|
|
@ -28,7 +30,6 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
@ -40,6 +41,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* APP首页实现类 |
|
|
|
* APP首页实现类 |
|
|
@ -52,13 +54,17 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
|
|
|
|
|
|
|
|
private final UseService useService; |
|
|
|
private final UseService useService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DataService dataService; |
|
|
|
|
|
|
|
|
|
|
|
private final PowerService powerService; |
|
|
|
private final PowerService powerService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DeviceService deviceService; |
|
|
|
|
|
|
|
|
|
|
|
private final StationService stationService; |
|
|
|
private final StationService stationService; |
|
|
|
|
|
|
|
|
|
|
|
private final GenerateService generateService; |
|
|
|
private final GenerateService generateService; |
|
|
|
|
|
|
|
|
|
|
|
private final AnalyseDataService analyseDataService; |
|
|
|
private final DeviceParamService deviceParamService; |
|
|
|
|
|
|
|
|
|
|
|
private final StationAttributeService attributeService; |
|
|
|
private final StationAttributeService attributeService; |
|
|
|
|
|
|
|
|
|
|
@ -66,8 +72,6 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
private final IHistoryDataSearchClient historyDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.equipment.emInfo.emInfoList}") |
|
|
|
@Value("${hzims.equipment.emInfo.emInfoList}") |
|
|
@ -86,6 +90,71 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; |
|
|
|
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void loadEmInfo() { |
|
|
|
|
|
|
|
// 查询所有首页展示/状态非删除设备
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> devices = deviceService.device(); |
|
|
|
|
|
|
|
// 查询所有设备(ct、pt、installedCapacity)配置参数
|
|
|
|
|
|
|
|
List<EmParamEntity> paramList = deviceParamService.params(); |
|
|
|
|
|
|
|
// 获取设备监测点位:未配置监测点位不进行统计设备
|
|
|
|
|
|
|
|
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = devices.stream().map(o->{ |
|
|
|
|
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
|
|
|
|
|
|
|
multiAnalyzeCodePO.setDeviceCode(o.getEmCode()); |
|
|
|
|
|
|
|
multiAnalyzeCodePO.setSignages(HomePageConstant.SIGNAGES); |
|
|
|
|
|
|
|
return multiAnalyzeCodePO; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 切割
|
|
|
|
|
|
|
|
int limit = countStep(multiAnalyzeCodePOList.size()); |
|
|
|
|
|
|
|
List<List<MultiAnalyzeCodePO>> lists = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> multiAnalyzeCodePOList.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 接收数据
|
|
|
|
|
|
|
|
List<AnalyzeCodeBySignagesVO> analys = new ArrayList<>(); |
|
|
|
|
|
|
|
lists.forEach(list->{ |
|
|
|
|
|
|
|
List<AnalyzeCodeBySignagesVO> result = dataService.analyzeCodeBySignages(list); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(result)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
analys.addAll(result); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 设备遍历
|
|
|
|
|
|
|
|
devices.forEach(item->{ |
|
|
|
|
|
|
|
item.setRideCount(1); |
|
|
|
|
|
|
|
item.setInstalledCapacity(0.0); |
|
|
|
|
|
|
|
List<AnalyzeCodeBySignagesVO> signages = analys.stream().filter(o-> item.getEmCode().equals(o.getDeviceCode()) && !StringUtil.isEmpty(o.getSignage()) && !StringUtil.isEmpty(o.getRealId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(signages)){ |
|
|
|
|
|
|
|
// list -> map
|
|
|
|
|
|
|
|
item.setPoint(signages.stream().collect(Collectors.toMap(AnalyzeCodeBySignagesVO::getSignage,AnalyzeCodeBySignagesVO::getRealId))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 寻找设备配置参数
|
|
|
|
|
|
|
|
List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(itemParamList)){ |
|
|
|
|
|
|
|
// 遍历设备配置参数
|
|
|
|
|
|
|
|
for(EmParamEntity param : itemParamList){ |
|
|
|
|
|
|
|
String param_name = param.getParamName(); |
|
|
|
|
|
|
|
switch (param_name){ |
|
|
|
|
|
|
|
case "ct": |
|
|
|
|
|
|
|
item.setCt(Integer.valueOf(param.getParamValue())); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "pt": |
|
|
|
|
|
|
|
item.setPt(Integer.valueOf(param.getParamValue())); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "installedCapacity": |
|
|
|
|
|
|
|
item.setInstalledCapacity(Double.valueOf(param.getParamValue())); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 设置ct * pt
|
|
|
|
|
|
|
|
if(null != item.getCt() && null != item.getPt()){ |
|
|
|
|
|
|
|
item.setRideCount(item.getCt() * item.getPt()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 设置缓存
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(device_cache_cofig_final, JSONObject.toJSONString(devices.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 加载水电站机组实时数据 |
|
|
|
* 加载水电站机组实时数据 |
|
|
|
* @param param |
|
|
|
* @param param |
|
|
@ -297,15 +366,6 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
List<WaterLevelVo> list = new ArrayList<>(); |
|
|
|
List<WaterLevelVo> list = new ArrayList<>(); |
|
|
|
modelList.forEach(item -> { |
|
|
|
modelList.forEach(item -> { |
|
|
|
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>(); |
|
|
|
|
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
|
|
|
|
|
|
|
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); |
|
|
|
|
|
|
|
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); |
|
|
|
|
|
|
|
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); |
|
|
|
|
|
|
|
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); |
|
|
|
|
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WaterLevelVo waterLevelVo = new WaterLevelVo(); |
|
|
|
WaterLevelVo waterLevelVo = new WaterLevelVo(); |
|
|
|
waterLevelVo.setStationCode(item.getStationId()); |
|
|
|
waterLevelVo.setStationCode(item.getStationId()); |
|
|
|
// 前水位
|
|
|
|
// 前水位
|
|
|
@ -540,7 +600,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
private float getUsrPowerDay(EminfoAndEmParamVo device) { |
|
|
|
private float getUsrPowerDay(EminfoAndEmParamVo device) { |
|
|
|
String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); |
|
|
|
String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); |
|
|
|
// 当日用电量
|
|
|
|
// 当日用电量
|
|
|
|
return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
return dataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -553,7 +613,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
// 当月用电量
|
|
|
|
// 当月用电量
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
return dataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -569,7 +629,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
// 当年用电量
|
|
|
|
// 当年用电量
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
return dataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -580,7 +640,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
public List<ActivePowerVo> getActivePowerVoList(EminfoAndEmParamVo device) { |
|
|
|
public List<ActivePowerVo> getActivePowerVoList(EminfoAndEmParamVo device) { |
|
|
|
String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"); |
|
|
|
String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"); |
|
|
|
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); |
|
|
|
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); |
|
|
|
List<AnalyseDataTaosVO> datas = analyseDataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER); |
|
|
|
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER); |
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -607,7 +667,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -637,7 +697,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
// 查询数据
|
|
|
|
// 查询数据
|
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
return new HashMap<>(); |
|
|
|
return new HashMap<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -843,12 +903,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
List<String> signages = Collections.singletonList(signage); |
|
|
|
List<String> signages = Collections.singletonList(signage); |
|
|
|
realData.setSignages(signages); |
|
|
|
realData.setSignages(signages); |
|
|
|
// 调用fegin接口查询实时数据
|
|
|
|
// 调用fegin接口查询实时数据
|
|
|
|
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
List<FieldsData> fields = dataService.getRealDataByAnalyzeCode(instanceCode,signages); |
|
|
|
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ |
|
|
|
if(CollectionUtil.isEmpty(fields)){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
// 时间限制
|
|
|
|
// 时间限制
|
|
|
|
String time = R.getData().get(0).getTime(); |
|
|
|
String time = fields.get(0).getTime(); |
|
|
|
if(StringUtil.isEmpty(time) || "-".equals(time)){ |
|
|
|
if(StringUtil.isEmpty(time) || "-".equals(time)){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
@ -856,7 +916,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
return Double.parseDouble(R.getData().get(0).getValue()); |
|
|
|
return Double.parseDouble(fields.get(0).getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -867,9 +927,9 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { |
|
|
|
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { |
|
|
|
String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE); |
|
|
|
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); |
|
|
|
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); |
|
|
|
List<AnalyseDataTaosVO> datas = analyseDataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage); |
|
|
|
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage); |
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
return new HashMap<>(); |
|
|
|
return new HashMap<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1027,7 +1087,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1052,7 +1112,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
// 设备采集发电量
|
|
|
|
// 设备采集发电量
|
|
|
|
if(CollectionUtil.isNotEmpty(devices)){ |
|
|
|
if(CollectionUtil.isNotEmpty(devices)){ |
|
|
|
devices.forEach(device->{ |
|
|
|
devices.forEach(device->{ |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1260,7 +1320,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new ServiceException("无效查询类型!"); |
|
|
|
throw new ServiceException("无效查询类型!"); |
|
|
|
} |
|
|
|
} |
|
|
|
return analyseDataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
return dataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1272,7 +1332,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
private List<PhotovoltaicPowerVo> photovoltaicLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
private List<PhotovoltaicPowerVo> photovoltaicLoadsByDay(EminfoAndEmParamVo device) { |
|
|
|
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1299,7 +1359,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY); |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
if (CollectionUtil.isEmpty(records)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1350,6 +1410,13 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 计算切分次数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static Integer countStep(Integer size) { |
|
|
|
|
|
|
|
return (size + 3 - 1) / 3; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 泵站设备 |
|
|
|
* 泵站设备 |
|
|
|
* @param stations |
|
|
|
* @param stations |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -1358,11 +1425,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<EminfoAndEmParamVo> devices = null; |
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
Object json = redisTemplate.opsForValue().get(device_cache_cofig_final); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(json)) { |
|
|
|
|
|
|
|
devices = JSONObject.parseObject(json.toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1484,7 +1547,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new IllegalStateException("Unexpected value: " + scope); |
|
|
|
throw new IllegalStateException("Unexpected value: " + scope); |
|
|
|
} |
|
|
|
} |
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1495,7 +1558,7 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { |
|
|
|
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { |
|
|
|
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); |
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|