Browse Source

Merge remote-tracking branch 'origin/huoshan' into huoshan

zhongwei
yang_shj 1 year ago
parent
commit
dc40eb3e23
  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. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java
  4. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java
  5. 10
      hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/feign/WrpSectionBClient.java
  6. 5
      hzims-service/digital-twin-display/pom.xml
  7. 20
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/controller/BaseInfoController.java
  8. 10
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/IDigitalBaseInfoService.java
  9. 111
      hzims-service/digital-twin-display/src/main/java/com/hnac/hzims/twindisplay/service/impl/DigitalBaseInfoServiceImpl.java
  10. 63
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java
  11. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java
  12. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java
  13. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.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);
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.hiddendanger.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("hidden_danger")
public class HiddenDanger {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 危险行为
*/
@TableField("danger_behavior")
private String dangerBehavior;
/**
* 发生次数
*/
@TableField("times")
private Integer times;
}

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java

@ -0,0 +1,13 @@
package com.hnac.hzims.safeproduct.hiddendanger.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
@Data
public class HiddenDangerQueryVo {
/**
* 危险行为
*/
@TableField("danger_behavior")
private String dangerBehavior;
}

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;
}
}

63
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java

@ -0,0 +1,63 @@
package com.hnac.hzims.safeproduct.hiddendanger.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger;
import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService;
import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RestController
@RequestMapping("/hiddendanger")
public class HiddenDangerController {
@Autowired
HiddenDangerService hiddenDangerService;
/**
* 分页查询
*/
@GetMapping("/listPage/{page}/{size}")
public R listPage(@PathVariable Long page,
@PathVariable Long size,
HiddenDangerQueryVo hiddenDangerQueryVo) {
Page<HiddenDanger> pageParam = new Page<>(page, size);
IPage<HiddenDanger> resultParams =
hiddenDangerService.selectPage(pageParam,
hiddenDangerQueryVo);
return R.data(resultParams);
}
/**
* 新增指标项管理
*/
@PostMapping("/save")
public R save(@RequestBody HiddenDanger hiddenDanger) {
hiddenDangerService.save(hiddenDanger);
return R.success("新增成功");
}
/**
* 更新指标项管理
*/
@PutMapping("/update")
public R update(@RequestBody HiddenDanger hiddenDanger) {
hiddenDangerService.updateById(hiddenDanger);
return R.success("修改成功");
}
/**
* 删除指标项管理
*/
@DeleteMapping("/remove/{id}")
public R remove(@PathVariable Long id) {
hiddenDangerService.removeById(id);
return R.success("删除成功");
}
}

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java

@ -0,0 +1,7 @@
package com.hnac.hzims.safeproduct.hiddendanger.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger;
public interface HiddenDangerMapper extends BaseMapper<HiddenDanger> {
}

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.safeproduct.hiddendanger.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger;
import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo;
public interface HiddenDangerService extends IService<HiddenDanger> {
/**
* 分页查询
* @param pageParam
* @param hiddenDangerQueryVo
* @return
*/
IPage<HiddenDanger> selectPage(Page<HiddenDanger> pageParam, HiddenDangerQueryVo hiddenDangerQueryVo);
}

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java

@ -0,0 +1,27 @@
package com.hnac.hzims.safeproduct.hiddendanger.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger;
import com.hnac.hzims.safeproduct.hiddendanger.mapper.HiddenDangerMapper;
import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService;
import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo;
import org.springframework.stereotype.Service;
@Service
public class HiddenDangerServiceImpl extends ServiceImpl<HiddenDangerMapper, HiddenDanger> implements HiddenDangerService {
@Override
public IPage<HiddenDanger> selectPage(Page<HiddenDanger> pageParam, HiddenDangerQueryVo hiddenDangerQueryVo) {
String dangerBehavior = hiddenDangerQueryVo.getDangerBehavior();
LambdaQueryWrapper<HiddenDanger> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(dangerBehavior)) {
queryWrapper.like(HiddenDanger::getDangerBehavior,dangerBehavior);
}
IPage<HiddenDanger> hiddenDangerIPage = baseMapper.selectPage(pageParam, queryWrapper);
return hiddenDangerIPage;
}
}
Loading…
Cancel
Save