Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 5 months ago
parent
commit
de348f6c1e
  1. 32
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmVideoVo.java
  2. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  3. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  4. 24
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java
  5. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java
  6. 24
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java
  7. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  8. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java
  9. 8
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  10. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  11. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  12. 30
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  13. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java
  14. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java
  15. 100
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/GenerationReportServiceImpl.java

32
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmVideoVo.java

@ -0,0 +1,32 @@
package com.hnac.hzims.alarm.show.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
/**
* @author ysj
* @date 2023/03/17 10:02:33
* @version 4.0.0
*/
@Data
public class AlarmVideoVo {
@ApiModelProperty("视频设备编码")
private String pointCode;
@ApiModelProperty("视频名称")
@QueryField(condition = SqlCondition.LIKE)
private String videoName;
@ApiModelProperty("视频服务器host")
private String videoHost;
@ApiModelProperty("运管中心appSecret")
private String videoAppSecret;
@ApiModelProperty("运管中心appKey")
private String videoAppKey;
}

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -87,6 +87,8 @@ public interface IEmInfoClient {
String RIDE_DEVICES = API_PREFIX + "/rideDevices";
String CREWS_DEVICES = API_PREFIX + "/crewsDevices";
@PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id);
@ -176,4 +178,7 @@ public interface IEmInfoClient {
@GetMapping(RIDE_DEVICES)
List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds);
@GetMapping(CREWS_DEVICES)
List<EmInfoEntity> crewsDevices(@RequestParam("refDept") Long refDept);
}

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -120,4 +120,9 @@ public class IEmInfoClientBack implements IEmInfoClient {
public List<RideDeviceVo> rideDevices(List<Long> longs) {
return new ArrayList<>();
}
@Override
public List<EmInfoEntity> crewsDevices(Long refDept) {
return new ArrayList<>();
}
}

24
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java

@ -0,0 +1,24 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel("发电量报表")
public class GenerationDeviceVo {
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("属性时间范围统计数据")
private List<GenerationReportVo> attributes;
}

19
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel("发电量报表")
public class GenerationReportTimeVo {
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("值")
private Double value;
}

24
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java

@ -0,0 +1,24 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel("发电量报表")
public class GenerationReportVo {
@ApiModelProperty("属性")
private String attribute;
@ApiModelProperty("属性名称")
private String attributeName;
@ApiModelProperty("属性时间范围统计数据")
private List<GenerationReportTimeVo> times;
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -162,6 +162,12 @@ public class EmInfoClient implements IEmInfoClient {
return service.rideDevices(deptIds);
}
@Override
@GetMapping(CREWS_DEVICES)
public List<EmInfoEntity> crewsDevices(@RequestParam("refDept") Long refDept) {
return service.list(Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getEmType,2).eq(EmInfoEntity::getCreateDept,refDept));
}
@PostMapping(GET_EM_CREATE_TABLE)
@Override
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java

@ -55,7 +55,7 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
log.error("alarm_query_station_is_null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList()));
return false;
}
// 步骤2.查询当天处理的告警
// 步骤2.查询1小时内处理的告警
List<String> handlers = handleService.sameDayContent();
// 步骤3.查询延后未完成的告警
List<String> delays = handleService.incompleteContent();

8
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.show.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.source.service.SystemAlarmService;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
@ -54,12 +55,13 @@ public class ShowAlarmController extends BladeController {
return R.data(alarmService.counts(alarm));
}
@GetMapping("/getVideosByStationAndRealId")
@GetMapping("/alarmVideos")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点")
public R<List<EmVideoBandingEntity>> getVideosByStationAndRealId(@ApiParam("站点编号") @RequestParam String stationCode,
public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam String stationCode,
@ApiParam("设备编号") @RequestParam String deviceCode,
@ApiParam("监测点ID") @RequestParam String realId) {
return R.data(alarmService.getVideosByStationAndRealId(stationCode,realId));
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId));
}
}

9
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.show.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import org.springblade.core.mp.base.BaseService;
import org.springframework.web.socket.TextMessage;
@ -22,11 +23,5 @@ public interface AlarmService extends BaseService<AlarmEntity> {
TextMessage majorAlarm(List<Long> depts);
/**
* 根据站点realId 获取视频列表
* @param stationCode 站点编号
* @param realId hz3000点位信息
* @return 视频列表
*/
List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode,String realId);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId);
}

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java

@ -176,7 +176,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
public List<String> sameDayContent() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,-1);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
return this.baseMapper.sameDayContent(start,end);
}

30
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -11,6 +11,7 @@ import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo;
import com.hnac.hzims.alarm.show.mapper.AlarmMapper;
import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
@ -227,7 +228,8 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
}
@Override
/* @Override
public List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode, String realId) {
R<StationEntity> stationR = stationClient.getStationByCode(stationCode);
Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData()), () -> {
@ -254,7 +256,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
throw new ServiceException("获取设备绑定视频列表失败!");
});
return videoListR.getData().stream().distinct().collect(Collectors.toList());
}
}*/
/**
* 验证设备编号是否绑定视频
@ -395,4 +397,28 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
}
}
}
/**
* 获取告警视频信息
* @param stationCode
* @param deviceCode
* @param realId
* @return
*/
@Override
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId) {
// 根据realId查找
if(StringUtil.isNotBlank(realId)){
}
// 根据设备编号查找
if(StringUtil.isNotBlank(deviceCode)){
}
// 根据站点编号查找
if(StringUtil.isNotBlank(stationCode)){
}
return new ArrayList<>();
}
}

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java

@ -0,0 +1,34 @@
package com.hnac.hzims.operational.report.controller;
import com.hnac.hzims.operational.report.service.IGenerationReportService;
import com.hnac.hzims.operational.report.vo.GenerationDeviceVo;
import com.hnac.hzims.operational.report.vo.GenerationReportTimeVo;
import com.hnac.hzims.operational.report.vo.GenerationReportVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/generation/report")
public class GenerationReportController extends BladeController {
private final IGenerationReportService service;
@GetMapping("/sameDayReport")
public R<List<GenerationDeviceVo>> sameDayReport(@RequestParam("stationId") String stationId){
return R.data(service.sameDayReport(stationId));
}
}

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.operational.report.service;
import com.hnac.hzims.operational.report.vo.GenerationDeviceVo;
import com.hnac.hzims.operational.report.vo.GenerationReportVo;
import java.util.List;
/**
* @author ysj
*/
public interface IGenerationReportService {
List<GenerationDeviceVo> sameDayReport(String stationId);
}

100
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/GenerationReportServiceImpl.java

@ -0,0 +1,100 @@
package com.hnac.hzims.operational.report.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.operational.report.service.IGenerationReportService;
import com.hnac.hzims.operational.report.vo.GenerationDeviceVo;
import com.hnac.hzims.operational.report.vo.GenerationReportTimeVo;
import com.hnac.hzims.operational.report.vo.GenerationReportVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class GenerationReportServiceImpl implements IGenerationReportService {
private final IStationService stationService;
private final IEmInfoClient deviceClient;
/**
* 当天报表
* @param stationId
* @return
*/
@Override
public List<GenerationDeviceVo> sameDayReport(String stationId) {
// 查询站点
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery().eq(StationEntity::getCode,stationId));
if(ObjectUtil.isEmpty(station)){
throw new ServiceException("未查询到站点信息!");
}
// 查询站点机组设备
List<EmInfoEntity> devices = deviceClient.crewsDevices(station.getRefDept());
if(CollectionUtil.isEmpty(devices)){
throw new ServiceException("未查询到站点机组类型设备!");
}
// FIXME 属性标识
Map<String,String> signages = new HashMap<>();
signages.put("active_power","有功功率");
signages.put("reactive_power","无功功率");
signages.put("generation_capacity","正向有功电量");
signages.put("reactive_generation_capacity","正向无功电量");
List<String> times = this.sameDayValues();
Random random = new Random();
return devices.stream().map(device->{
GenerationDeviceVo item = new GenerationDeviceVo();
item.setDeviceCode(device.getNumber());
item.setDeviceName(device.getName());
item.setAttributes(signages.entrySet().stream().map(entry->{
GenerationReportVo attribute = new GenerationReportVo();
attribute.setAttribute(entry.getKey());
attribute.setAttributeName(entry.getValue());
// FIXME : 使用随机数
attribute.setTimes(times.stream().map(time->{
GenerationReportTimeVo generation = new GenerationReportTimeVo();
generation.setTime(time);
generation.setValue(random.nextDouble() * 1000);
return generation;
}).collect(Collectors.toList()));
return attribute;
}).collect(Collectors.toList()));
return item;
}).collect(Collectors.toList());
}
/**
* 当天数据值
* @return
*/
private List<String> sameDayValues() {
Calendar calendar = Calendar.getInstance();
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
calendar.add(Calendar.MILLISECOND,-calendar.get(Calendar.MILLISECOND));
Date start = calendar.getTime();
List<String> times = new ArrayList<>();
while (start.compareTo(end) <= 0){
calendar.add(Calendar.HOUR_OF_DAY,1);
times.add(start.getHours() + "时");
start = calendar.getTime();
}
return times;
}
}
Loading…
Cancel
Save