Browse Source

#告警历史数据查询

zhongwei
yang_shj 3 months ago
parent
commit
281eea72e1
  1. 47
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java
  2. 28
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java
  3. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  4. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  5. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  6. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  7. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java
  8. 23
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml
  9. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  10. 15
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  11. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java
  12. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java
  13. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java

47
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java

@ -0,0 +1,47 @@
package com.hnac.hzims.alarm.config.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AlarmHistoryVo {
@ApiModelProperty(value = "站点编号")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "告警类型")
private Integer alarmType;
@ApiModelProperty(value = "告警内容")
private String alarmContext;
@ApiModelProperty("处理人")
private Long handleUser;
@ApiModelProperty("处理人名称")
private Long handleUserName;
@ApiModelProperty(value = "告警时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private LocalDateTime alarmTime;
@ApiModelProperty("处理时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date handleTime;
}

28
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.alarm.show.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/03/17 10:02:33
* @version 4.0.0
*/
@Data
public class AlarmHistoryParamVo {
@ApiModelProperty(value = "站点编号")
private String stationId;
@ApiModelProperty(value = "告警日期 : yyyy-MM-dd")
private String alarmTime;
@ApiModelProperty(value = "告警类型")
private Integer alarmType;
@ApiModelProperty(value = "处理方式")
private Long handleWay;
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java

@ -73,4 +73,12 @@ public class DeviceHistoryController extends BladeController {
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param));
}
@PostMapping("/history_tabulation")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表")
public R<Map<String, Object>> historyTabulation(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyTabulation(param));
}
}

1
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java

@ -27,4 +27,5 @@ public interface IHistoryDeviceService {
Map<String, Object> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyTabulation(HistoryDataParamVo param);
}

10
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -191,6 +191,16 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
return result.getData();
}
/**
* 获取设备历史数据列表
* @param param
* @return
*/
@Override
public Map<String, Object> historyTabulation(HistoryDataParamVo param) {
return null;
}
/**
* 计算查询数据维度

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

@ -4,7 +4,9 @@ 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.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.SystemAlarmService;
@ -66,4 +68,11 @@ public class ShowAlarmController extends BladeController {
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId,alarmType));
}
@GetMapping ("/history")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "告警列表分页", notes = "传入: AlarmConfigEntity对象,分页参数")
public R<IPage<AlarmHistoryVo>> history(AlarmHistoryParamVo param, Query query) {
return R.data(alarmService.pageCondition(param,Condition.getPage(query)));
}
}

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java

@ -1,7 +1,11 @@
package com.hnac.hzims.alarm.show.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import org.apache.ibatis.annotations.Param;
/**
* @author ysj
@ -9,4 +13,5 @@ import com.hnac.hzims.alarm.config.entity.AlarmEntity;
public interface AlarmMapper extends BaseMapper<AlarmEntity> {
IPage<AlarmHistoryVo> pageCondition(@Param(value="param") AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page);
}

23
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml

@ -2,4 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.alarm.show.mapper.AlarmMapper">
<select id="pageCondition" resultType="com.hnac.hzims.alarm.config.vo.AlarmHistoryVo">
SELECT ALARM.STATION_ID,ALARM.STATION_NAME,ALARM.ALARM_TYPE,ALARM.ALARM_CONTEXT,
HANDLE.HANDLE_WAY,HANDLE.CREATE_USER HANDLE_USER,HANDLE.CREATE_USER_NAME HANDLE_USER_NAME,ALARM.ALARM_TIME,
HANDLE.CREATE_TIME HANDLE_TIME
FROM HZIMS_ALARM ALARM
LEFT JOIN HZIMS_ALARM_HANDLE HANDLE
ON ALARM.ALARM_ID = HANDLE.ALARM_ID
<where>
ALARM.IS_DELETED = 0
<if test="param.stationId != null and param.stationId != ''">
AND ALARM.STATION_ID = #{param.stationId}
</if>
<if test="param.alarmTime != null and param.alarmTime != ''">
AND ALARM.ALARM_TIME like CONCAT('%',#{param.alarmTime}, '%')
</if>
<if test="param.alarmType != null and param.alarmType != ''">
AND ALARM.ALARM_TYPE = #{param.alarmType}
</if>
<if test="param.handleWay != null and param.handleWay != ''">
AND HANDLE.HANDLE_WAY = #{param.handleWay}
</if>
</where>
</select>
</mapper>

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

@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.alarm.config.entity.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import org.springframework.web.socket.TextMessage;
import java.util.List;
@ -25,4 +26,6 @@ public interface AlarmService extends IService<AlarmEntity> {
TextMessage majorAlarm(List<String> stations);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType);
IPage<AlarmHistoryVo> pageCondition(AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page);
}

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

@ -9,14 +9,15 @@ import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
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.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
@ -418,6 +419,7 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
throw new ServiceException("未查询到告警视频信息!");
}
/**
*查询站点绑定视频信息
* @param stationCode
@ -544,4 +546,15 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
return alarmVideo;
}).collect(Collectors.toList());
}
/**
* 告警历史分页查询
* @param param
* @param page
* @return
*/
@Override
public IPage<AlarmHistoryVo> pageCondition(AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page) {
return this.baseMapper.pageCondition(param,page);
}
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java

@ -38,9 +38,7 @@ public class UserDeptConfigController extends BladeController {
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询站点用户机构配置保存记录", notes = "传入userId")
public R query(@RequestParam("userId") String userId) {
return R.data(userDeptConfigService.getOne(Wrappers.<UserDeptConfigEntity>lambdaQuery()
.eq(UserDeptConfigEntity::getCreateUser,userId)
));
return R.data(userDeptConfigService.queryByUserId(userId));
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java

@ -8,4 +8,6 @@ import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity;
*/
public interface UserDeptConfigService extends IService<UserDeptConfigEntity> {
boolean submit(UserDeptConfigEntity entity);
UserDeptConfigEntity queryByUserId(String userId);
}

41
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java

@ -9,12 +9,18 @@ import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.service.UserDeptConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
/**
* @author 86187
*/
@ -61,4 +67,39 @@ public class UserDeptConfigServiceImpl extends ServiceImpl<UserDeptConfigMapper,
return super.saveOrUpdate(entity);
}
@Override
public UserDeptConfigEntity queryByUserId(String userId) {
UserDeptConfigEntity config = this.getOne(Wrappers.<UserDeptConfigEntity>lambdaQuery()
.eq(UserDeptConfigEntity::getCreateUser,userId)
);
if(ObjectUtil.isNotEmpty(config)){
return config;
}
config = new UserDeptConfigEntity();
R<List<Dept>> depts = sysClient.getDeptByCurrentUser();
if(depts.isSuccess() && ObjectUtil.isNotEmpty(depts.getData())){
Optional<Dept> optional = depts.getData().stream().min(Comparator.comparing(Dept::getDeptCategory));
if(optional.isPresent()){
config.setDeptId(optional.get().getId());
config.setDeptName(optional.get().getDeptName());
if(optional.get().getDeptCategory() == 4){
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getRefDept,optional.get().getId())
);
if(ObjectUtil.isNotEmpty(station)){
config.setStationId(station.getCode());
config.setStationName(station.getName());
}else{
config.setStationId(null);
config.setStationName(null);
}
}else{
config.setStationId(null);
config.setStationName(null);
}
}
}
return config;
}
}
Loading…
Cancel
Save