Browse Source

@电站运行数据@翟千民

zhongwei
zhaiqm 1 year ago
parent
commit
4248245ce4
  1. 6
      hzims-service-api/dam-safety-api/pom.xml
  2. 5
      hzims-service-api/dam-safety-api/src/main/java/com/hnac/hzims/damsafety/feign/IWrpSectionBClient.java
  3. 10
      hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/feign/WrpSectionBClient.java
  4. 5
      hzims-service/digital-twin-display/pom.xml
  5. 20
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/controller/BaseInfoController.java
  6. 10
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/IDigitalBaseInfoService.java
  7. 111
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/impl/DigitalBaseInfoServiceImpl.java

6
hzims-service-api/dam-safety-api/pom.xml

@ -3,6 +3,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
</dependencies>
<parent>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-service-api</artifactId>

5
hzims-service-api/dam-safety-api/src/main/java/com/hnac/hzims/damsafety/feign/IWrpSectionBClient.java

@ -1,6 +1,7 @@
package com.hnac.hzims.damsafety.feign;
import com.hnac.hzims.damsafety.vo.WrpSectionBVO;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -15,6 +16,7 @@ import java.util.Map;
public interface IWrpSectionBClient {
String API_PREFIX = "/wrpSectionBClient";
String LIST = API_PREFIX + "/list";
String GET_REAL_DATA = API_PREFIX + "/getRealData";
/**
* 获取断面列表
@ -23,4 +25,7 @@ public interface IWrpSectionBClient {
*/
@GetMapping(LIST)
R<List<WrpSectionBVO>> list(Map<String, Object> param);
@GetMapping(GET_REAL_DATA)
R<List<FieldsData>> getRealData(String deviceCode);
}

10
hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/feign/WrpSectionBClient.java

@ -2,10 +2,12 @@ package com.hnac.hzims.damsafety.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.damsafety.entity.WrpSectionB;
import com.hnac.hzims.damsafety.service.IDamSafetyDataService;
import com.hnac.hzims.damsafety.service.IWrpSectionBService;
import com.hnac.hzims.damsafety.util.ParamUtil;
import com.hnac.hzims.damsafety.vo.WrpSectionBVO;
import com.hnac.hzims.damsafety.wrapper.WrpSectionBWrapper;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
@ -19,10 +21,18 @@ public class WrpSectionBClient implements IWrpSectionBClient {
@Autowired
private IWrpSectionBService wrpSectionBService;
@Autowired
private IDamSafetyDataService damSafetyDataService;
@Override
public R<List<WrpSectionBVO>> list(Map<String, Object> param) {
LambdaQueryWrapper<WrpSectionB> wrapper= ParamUtil.conditionWrpSectionB(param);
List<WrpSectionB> list = wrpSectionBService.list(wrapper);
return R.data(WrpSectionBWrapper.build().listVO(list));
}
@Override
public R<List<FieldsData>> getRealData(String deviceCode) {
return R.data(damSafetyDataService.getRealData(deviceCode));
}
}

5
hzims-service/digital-twin-display/pom.xml

@ -67,12 +67,11 @@
<version>${hzims.project.version}</version>
</dependency>
<!--<dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>dam-safety-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>-->
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>

20
hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/controller/BaseInfoController.java

@ -49,9 +49,11 @@ public class BaseInfoController {
@ApiOperation(notes = "获取设备实时信息接口", value = "获取设备实时信息接口")
@RequestMapping(value = "/getRealData", method = RequestMethod.GET)
public R getRealData(String deviceCode){
public Map<String, Object> getRealData(String deviceCode){
Map<String, Object> result = new HashMap<>();
List<FieldsData> data = digitalBaseInfoService.getRealData(deviceCode);
return R.data(data,"查询成功");
result.put(deviceCode, data);
return result;
}
@ApiOperation(notes = "获取降雨量信息", value = "获取降雨量信息")
@ -60,4 +62,18 @@ public class BaseInfoController {
public Map<String,List<RainFallCountByMonthVo>> getRainFallInfo(String year,String location) {
return digitalBaseInfoService.getRainFallInfo(year,location);
}
@ApiOperation(notes = "获取电站发电运行信息", value = "获取电站发电运行信息")
@RequestMapping(value = "/getPowerStationHisInfo", method = RequestMethod.GET)
public Map<String, Object> getPowerStationHisInfo(String deviceCode){
//有功功率属性名
String activePower = "activePower";
//无功功率属性名
String reactivePower = "reactivePower";
//发电量
String power = "power";
Map<String, Object> data = digitalBaseInfoService.getPowerStationHisInfo(deviceCode,activePower,reactivePower,power);
return data;
}
}

10
hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/IDigitalBaseInfoService.java

@ -44,4 +44,14 @@ public interface IDigitalBaseInfoService {
* @return
*/
Map<String, List<RainFallCountByMonthVo>> getRainFallInfo(String year, String location);
/**
* 获取电站发电运行信息
* @param deviceCode
* @param activePower
* @param reactivePower
* @param power
* @return
*/
Map<String, Object> getPowerStationHisInfo(String deviceCode, String activePower, String reactivePower, String power);
}

111
hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/impl/DigitalBaseInfoServiceImpl.java

@ -1,12 +1,18 @@
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.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.twindisplay.service.IDigitalBaseInfoService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
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.sdk.analyse.AnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
@ -16,6 +22,9 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
@Service
@ -24,9 +33,11 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService {
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
public Map<String, Object> getDateInfo() {
@ -65,7 +76,7 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService {
List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
R<List<FieldsData>> R = ianalyseDataSearchClient.getRealDataByAnalyzeCode(realData);
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return 0.0;
}
@ -83,12 +94,11 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService {
@Override
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())){
return null;
}
return realData.getData();*/
return null;
return realData.getData();
}
@Override
@ -100,5 +110,94 @@ public class DigitalBaseInfoServiceImpl implements IDigitalBaseInfoService {
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;
}
}

Loading…
Cancel
Save