|
|
@ -1,12 +1,18 @@ |
|
|
|
package com.hnac.hzims.twindisplay.service.impl; |
|
|
|
package com.hnac.hzims.twindisplay.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.hnac.hzims.damsafety.feign.IWrpSectionBClient; |
|
|
|
import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; |
|
|
|
import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; |
|
|
|
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; |
|
|
|
import com.hnac.hzims.twindisplay.service.IDigitalBaseInfoService; |
|
|
|
import com.hnac.hzims.twindisplay.service.IDigitalBaseInfoService; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; |
|
|
|
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.AnalyzeDataConditionPO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; |
|
|
|
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; |
|
|
|
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
@ -16,6 +22,9 @@ import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.time.LocalTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@Service |
|
|
@ -24,9 +33,11 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService { |
|
|
|
|
|
|
|
|
|
|
|
private final IHeWeatherWeatherClient heWeatherWeatherClient; |
|
|
|
private final IHeWeatherWeatherClient heWeatherWeatherClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
private final IAnalyseDataSearchClient ianalyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
//private final IWrpSectionBClient wrpSectionBClient;
|
|
|
|
private final IWrpSectionBClient wrpSectionBClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final AnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, Object> getDateInfo() { |
|
|
|
public Map<String, Object> getDateInfo() { |
|
|
@ -65,7 +76,7 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService { |
|
|
|
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); |
|
|
|
R<List<FieldsData>> R = ianalyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ |
|
|
|
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
@ -83,12 +94,11 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<FieldsData> getRealData(String deviceCode) { |
|
|
|
public List<FieldsData> getRealData(String deviceCode) { |
|
|
|
/*R<List<FieldsData>> realData = wrpSectionBClient.getRealData(deviceCode); |
|
|
|
R<List<FieldsData>> realData = wrpSectionBClient.getRealData(deviceCode); |
|
|
|
if(!realData.isSuccess() || CollectionUtil.isEmpty(realData.getData())){ |
|
|
|
if(!realData.isSuccess() || CollectionUtil.isEmpty(realData.getData())){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
return realData.getData();*/ |
|
|
|
return realData.getData(); |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -100,5 +110,94 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService { |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Map<String, Object> getPowerStationHisInfo(String deviceCode, String activePower, String reactivePower, String power) { |
|
|
|
|
|
|
|
R<List<FieldsData>> realData = wrpSectionBClient.getRealData(deviceCode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
if(realData.isSuccess() && CollectionUtil.isNotEmpty(realData.getData())){ |
|
|
|
|
|
|
|
List<FieldsData> datas = realData.getData(); |
|
|
|
|
|
|
|
datas.stream().forEach(data -> { |
|
|
|
|
|
|
|
if (activePower.equals(data.getSignage())) { |
|
|
|
|
|
|
|
//有功功率
|
|
|
|
|
|
|
|
result.put(activePower, data.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (reactivePower.equals(data.getSignage())) { |
|
|
|
|
|
|
|
//无功功率
|
|
|
|
|
|
|
|
result.put(reactivePower, data.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前年的第一天 2023-1-1
|
|
|
|
|
|
|
|
LocalDate year = LocalDate.now().withDayOfYear(1); |
|
|
|
|
|
|
|
//当前月的第一天 2023-8-1
|
|
|
|
|
|
|
|
LocalDate month = LocalDate.now().withDayOfMonth(1); |
|
|
|
|
|
|
|
//当天 2023-8-29
|
|
|
|
|
|
|
|
LocalDate day = LocalDate.now(); |
|
|
|
|
|
|
|
LocalTime startTime = LocalTime.MIN; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime end = LocalDateTime.now(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//年累计
|
|
|
|
|
|
|
|
LocalDateTime start = LocalDateTime.of(year, startTime); |
|
|
|
|
|
|
|
AnalyseCodeByAnalyseDataPO poForYear = getPowerByParam(deviceCode, start, end, 4, 6, 1); |
|
|
|
|
|
|
|
Result<List<AnalyzeDataConditionVO>> listForYear = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(poForYear); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//月累计
|
|
|
|
|
|
|
|
start = LocalDateTime.of(month, startTime); |
|
|
|
|
|
|
|
AnalyseCodeByAnalyseDataPO poForMonth = getPowerByParam(deviceCode, start, end, 4, 5, 1); |
|
|
|
|
|
|
|
Result<List<AnalyzeDataConditionVO>> listForMonth = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(poForMonth); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日累计
|
|
|
|
|
|
|
|
start = LocalDateTime.of(day, startTime); |
|
|
|
|
|
|
|
AnalyseCodeByAnalyseDataPO poForDay = getPowerByParam(deviceCode, start, end, 4, 4, 1); |
|
|
|
|
|
|
|
Result<List<AnalyzeDataConditionVO>> listForDay = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(poForDay); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日发电计划完成率
|
|
|
|
|
|
|
|
result.put("dayPowerRate",null); |
|
|
|
|
|
|
|
//月发电计划完成率
|
|
|
|
|
|
|
|
result.put("monthPowerRate",null); |
|
|
|
|
|
|
|
//日累计发电量
|
|
|
|
|
|
|
|
result.put("dayPowerSum",null); |
|
|
|
|
|
|
|
//月累计发电量
|
|
|
|
|
|
|
|
result.put("monthPowerSum",null); |
|
|
|
|
|
|
|
//年累计发电量
|
|
|
|
|
|
|
|
result.put("yearPowerSum",null); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据入参查询设备信息 |
|
|
|
|
|
|
|
* @param deviceCode 设备编号 |
|
|
|
|
|
|
|
* @param start 开始时间 |
|
|
|
|
|
|
|
* @param end 结束时间 |
|
|
|
|
|
|
|
* @param accessRules 取数规则0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值 |
|
|
|
|
|
|
|
* @param saveTimeType 周期类型: 0-> s(秒) 1->m(分) 2->h(小时) 3->d(天) 4->w(周) 5->n(自然月) 6->y(自然年) |
|
|
|
|
|
|
|
* @param timeInterval 间隔时间 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public AnalyseCodeByAnalyseDataPO getPowerByParam(String deviceCode, LocalDateTime start, LocalDateTime end, |
|
|
|
|
|
|
|
Integer accessRules, Integer saveTimeType, Integer timeInterval) { |
|
|
|
|
|
|
|
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); |
|
|
|
|
|
|
|
po.setDeviceCode(deviceCode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); |
|
|
|
|
|
|
|
AnalyzeDataConditionPO conditionPO = new AnalyzeDataConditionPO(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conditionPO.setBeginTime(start); |
|
|
|
|
|
|
|
conditionPO.setEndTime(end); |
|
|
|
|
|
|
|
conditionPO.setSignages(deviceCode); |
|
|
|
|
|
|
|
// conditionPO.setKeepFigures(3);
|
|
|
|
|
|
|
|
conditionPO.setAccessRules(accessRules); |
|
|
|
|
|
|
|
conditionPO.setSaveTimeType(saveTimeType); |
|
|
|
|
|
|
|
conditionPO.setTimeInterval(timeInterval); |
|
|
|
|
|
|
|
conditionPO.setFull(1); |
|
|
|
|
|
|
|
signboardConditions.add(conditionPO); |
|
|
|
|
|
|
|
po.setSignboardConditions(signboardConditions); |
|
|
|
|
|
|
|
return po; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|