From 281eea72e14d95667de82fb47b8a54cff98b6fd3 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 22 Aug 2024 11:47:06 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=8E=86=E5=8F=B2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/alarm/config/vo/AlarmHistoryVo.java | 47 ++++++++++++++++++++++ .../hzims/alarm/show/vo/AlarmHistoryParamVo.java | 28 +++++++++++++ .../controller/DeviceHistoryController.java | 8 ++++ .../history/service/IHistoryDeviceService.java | 1 + .../service/impl/HistoryDeviceServiceImpl.java | 10 +++++ .../alarm/show/controller/ShowAlarmController.java | 9 +++++ .../hnac/hzims/alarm/show/mapper/AlarmMapper.java | 5 +++ .../hnac/hzims/alarm/show/mapper/AlarmMapper.xml | 23 +++++++++++ .../hzims/alarm/show/service/AlarmService.java | 5 ++- .../alarm/show/service/impl/AlarmServiceImpl.java | 15 ++++++- .../controller/UserDeptConfigController.java | 4 +- .../station/service/UserDeptConfigService.java | 2 + .../service/impl/UserDeptConfigServiceImpl.java | 41 +++++++++++++++++++ 13 files changed, 193 insertions(+), 5 deletions(-) create mode 100644 hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java create mode 100644 hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java new file mode 100644 index 0000000..c353134 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java new file mode 100644 index 0000000..5660404 --- /dev/null +++ b/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; +} + diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java index df8ae59..8efc43e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java @@ -73,4 +73,12 @@ public class DeviceHistoryController extends BladeController { public R> historyCurve(@RequestBody HistoryDataParamVo param) { return R.data(service.historyCurve(param)); } + + @PostMapping("/history_tabulation") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表") + public R> historyTabulation(@RequestBody HistoryDataParamVo param) { + return R.data(service.historyTabulation(param)); + } + } \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java index f8e47df..3634011 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java @@ -27,4 +27,5 @@ public interface IHistoryDeviceService { Map historyCurve(HistoryDataParamVo param); + Map historyTabulation(HistoryDataParamVo param); } \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java index 9184934..1fbc4ad 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java +++ b/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 historyTabulation(HistoryDataParamVo param) { + return null; + } + /** * 计算查询数据维度 diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java index c1d24d0..0b5fe63 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java +++ b/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> history(AlarmHistoryParamVo param, Query query) { + return R.data(alarmService.pageCondition(param,Condition.getPage(query))); + } + } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java index d6519c2..ae2a948 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java +++ b/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 { + IPage pageCondition(@Param(value="param") AlarmHistoryParamVo param, IPage page); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml index 3fd4b39..7f86437 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml @@ -2,4 +2,27 @@ + diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java index 2d142a7..46abe4b 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java +++ b/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 { TextMessage majorAlarm(List stations); List alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType); + + IPage pageCondition(AlarmHistoryParamVo param, IPage page); } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 9981857..063d5b5 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/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 impl throw new ServiceException("未查询到告警视频信息!"); } + /** *查询站点绑定视频信息 * @param stationCode @@ -544,4 +546,15 @@ public class AlarmServiceImpl extends ServiceImpl impl return alarmVideo; }).collect(Collectors.toList()); } + + /** + * 告警历史分页查询 + * @param param + * @param page + * @return + */ + @Override + public IPage pageCondition(AlarmHistoryParamVo param, IPage page) { + return this.baseMapper.pageCondition(param,page); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java index b4baff8..827a881 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java +++ b/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.lambdaQuery() - .eq(UserDeptConfigEntity::getCreateUser,userId) - )); + return R.data(userDeptConfigService.queryByUserId(userId)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java index 7da046f..cfd8e1b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java +++ b/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 { boolean submit(UserDeptConfigEntity entity); + + UserDeptConfigEntity queryByUserId(String userId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java index 75849f0..50cfb2a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java +++ b/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 ServiceImpllambdaQuery() + .eq(UserDeptConfigEntity::getCreateUser,userId) + ); + if(ObjectUtil.isNotEmpty(config)){ + return config; + } + config = new UserDeptConfigEntity(); + R> depts = sysClient.getDeptByCurrentUser(); + if(depts.isSuccess() && ObjectUtil.isNotEmpty(depts.getData())){ + Optional 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.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; + } } \ No newline at end of file