Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 5 months ago
parent
commit
5ca3775578
  1. 28
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/ShowQueryVo.java
  2. 21
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/ws/alart/vo/AlartParamVo.java
  3. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java
  4. 23
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  5. 12
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  6. 246
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  7. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java
  8. 26
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  9. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  10. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml
  11. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  12. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

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

@ -0,0 +1,28 @@
package com.hnac.hzims.alarm.show.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author ysj
* @date 2023/03/17 10:02:33
* @version 4.0.0
*/
@Data
public class ShowQueryVo {
@ApiModelProperty(value = "站点编号")
private String stationId;
@ApiModelProperty(value = "站点类型")
private Integer serveType;
@ApiModelProperty(value = "告警类型 :0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警 5-开关机告警")
private Integer alarmSource;
@ApiModelProperty(value = "告警子类")
private Integer alarmType;
}

21
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/ws/alart/vo/AlartParamVo.java

@ -0,0 +1,21 @@
package com.hnac.hzims.business.ws.alart.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "告警弹框参数", description = "")
public class AlartParamVo {
@ApiModelProperty("站点类型: 2-云服务 1-代运维")
private Integer serveType;
@ApiModelProperty("用户权限机构集合")
private List<Long> depts;
}

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/** /**
* @author liwen * @author liwen
@ -78,4 +79,7 @@ public class CarMilesYearVO {
@ExcelProperty(value = "合计里程/km", order = 15) @ExcelProperty(value = "合计里程/km", order = 15)
@ApiModelProperty("合计里程数") @ApiModelProperty("合计里程数")
private BigDecimal sumMiles; private BigDecimal sumMiles;
@ApiModelProperty("创建时间")
private Date createTime;
} }

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo; import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.SystemAlarmService; import com.hnac.hzims.alarm.source.service.SystemAlarmService;
import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
@ -37,31 +38,33 @@ public class ShowAlarmController extends BladeController {
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "播报告警", notes = "传入:时间区间") @ApiOperation(value = "播报告警", notes = "传入:时间区间")
public R<List<AlarmEntity>> broadcast(@ApiParam(value = "开始时间") String startTime, public R<List<AlarmEntity>> broadcast(@ApiParam(value = "开始时间") String startTime,
@ApiParam(value = "结束时间", required = true) String endTime) { @ApiParam(value = "结束时间", required = true) String endTime,
return R.data(alarmService.broadcast(startTime,endTime)); @ApiParam(value = "站点类型") Integer serveType) {
return R.data(alarmService.broadcast(startTime,endTime,serveType));
} }
@PostMapping("/show") @PostMapping("/show")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "告警列表分页", notes = "传入: AlarmConfigEntity对象,分页参数") @ApiOperation(value = "告警列表分页", notes = "传入: AlarmConfigEntity对象,分页参数")
public R<IPage<AlarmEntity>> alarms(AlarmEntity alarm, Query query) { public R<IPage<AlarmEntity>> alarms(ShowQueryVo showQuery, Query query) {
return R.data(alarmService.alarms(alarm,Condition.getPage(query))); return R.data(alarmService.alarms(showQuery,Condition.getPage(query)));
} }
@PostMapping("/count") @PostMapping("/count")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "告警分类数量", notes = "不需要传入参数") @ApiOperation(value = "告警分类数量", notes = "不需要传入参数")
public R<List<AlarmCountVo>> counts(@RequestBody AlarmEntity alarm) { public R<List<AlarmCountVo>> counts(@RequestBody ShowQueryVo showCount) {
return R.data(alarmService.counts(alarm)); return R.data(alarmService.counts(showCount));
} }
@GetMapping("/alarmVideos") @GetMapping("/alarmVideos")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "站点") @ApiOperation(value = "站点")
public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam String stationCode, public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam(required = false) String stationCode,
@ApiParam("设备编号") @RequestParam String deviceCode, @ApiParam("设备编号") @RequestParam(required = false) String deviceCode,
@ApiParam("监测点ID") @RequestParam String realId) { @ApiParam("监测点ID") @RequestParam(required = false) String realId,
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId)); @ApiParam("告警类型") @RequestParam Integer alarmType) {
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId,alarmType));
} }
} }

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

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo; 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 com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
@ -15,13 +17,13 @@ import java.util.List;
*/ */
public interface AlarmService extends BaseService<AlarmEntity> { public interface AlarmService extends BaseService<AlarmEntity> {
IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page); IPage<AlarmEntity> alarms(ShowQueryVo showQuery, IPage<AlarmEntity> page);
List<AlarmCountVo> counts(AlarmEntity alarm); List<AlarmCountVo> counts(ShowQueryVo showCount);
List<AlarmEntity> broadcast(String startTime, String endTime); List<AlarmEntity> broadcast(String startTime, String endTime,Integer serveType);
TextMessage majorAlarm(List<Long> depts); TextMessage majorAlarm(AlartParamVo param);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId); List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType);
} }

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

@ -1,6 +1,7 @@
package com.hnac.hzims.alarm.show.service.impl; package com.hnac.hzims.alarm.show.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmConstants;
@ -12,29 +13,37 @@ import com.hnac.hzims.alarm.show.mapper.AlarmMapper;
import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo; 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.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.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IEmVideoClient; import com.hnac.hzims.equipment.feign.IEmVideoClient;
import com.hnac.hzims.fdp.util.HttpRequestUtil;
import com.hnac.hzims.message.dto.MailMessageDTO; import com.hnac.hzims.message.dto.MailMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import lombok.AllArgsConstructor; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceEventVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import java.util.*; import java.util.*;
@ -43,7 +52,7 @@ import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
*/ */
@AllArgsConstructor @RequiredArgsConstructor
@Service @Service
@Slf4j @Slf4j
public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> implements AlarmService { public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> implements AlarmService {
@ -59,19 +68,27 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
private final IStationClient stationClient; private final IStationClient stationClient;
private final IMessageClient messageClient; private final IMessageClient messageClient;
private final IEmInfoClient emInfoClient; private final IEmInfoClient emInfoClient;
private final DeviceClient deviceClient; private final DeviceClient deviceClient;
private final IEmVideoClient emVideoClient; private final IEmVideoClient emVideoClient;
private final IStationVideoTypeClient stationVideoTypeClient;
@Value("${hzims.url.getFaultGraphInfo}")
private String FAULTGRAPH_INFO_PATH;
/** /**
* 查询告警列表 * 查询告警列表
* @param alarm * @param showQuery
* @param page * @param page
* @return * @return
*/ */
@Override @Override
public IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page) { public IPage<AlarmEntity> alarms(ShowQueryVo showQuery, IPage<AlarmEntity> page) {
List<StationEntity> stations = this.stations(); List<StationEntity> stations = this.stations(showQuery.getServeType());
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return page; return page;
} }
@ -82,14 +99,14 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
wrapper.eq("IS_RIGHT_TABULATION",0); wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.eq("STATUS",0); wrapper.eq("STATUS",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){ if(!StringUtil.isEmpty(showQuery.getStationId())){
wrapper.eq("STATION_ID",alarm.getStationId()); wrapper.eq("STATION_ID",showQuery.getStationId());
} }
if(!StringUtil.isEmpty(alarm.getAlarmSource())){ if(!StringUtil.isEmpty(showQuery.getAlarmSource())){
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); wrapper.eq("ALARM_SOURCE",showQuery.getAlarmSource());
} }
if(!StringUtil.isEmpty(alarm.getAlarmType())){ if(!StringUtil.isEmpty(showQuery.getAlarmType())){
wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); wrapper.eq("ALARM_TYPE",showQuery.getAlarmType());
} }
// 处理告警过滤 :当天处理告警 // 处理告警过滤 :当天处理告警
@ -106,9 +123,11 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* 获取权限站点 * 获取权限站点
* @return * @return
*/ */
private List<StationEntity> stations() { private List<StationEntity> stations(Integer serveType) {
StationEntity station = new StationEntity(); StationEntity station = new StationEntity();
station.setServeType("2"); if(ObjectUtil.isNotEmpty(serveType)){
station.setServeType(String.valueOf(serveType));
}
station.setType(0); station.setType(0);
R<List<StationEntity>> result = stationClient.list(station); R<List<StationEntity>> result = stationClient.list(station);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
@ -122,9 +141,9 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* @return * @return
*/ */
@Override @Override
public List<AlarmCountVo> counts(AlarmEntity alarm) { public List<AlarmCountVo> counts(ShowQueryVo showCount) {
// 站点查询 // 站点查询
List<StationEntity> stations = this.stations(); List<StationEntity> stations = this.stations(showCount.getServeType());
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return AlarmConstants.ALARAM_SOURCE.stream().map(source->{ return AlarmConstants.ALARAM_SOURCE.stream().map(source->{
AlarmCountVo count = new AlarmCountVo(); AlarmCountVo count = new AlarmCountVo();
@ -139,14 +158,14 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
wrapper.eq("IS_RIGHT_TABULATION",0); wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.eq("STATUS",0); wrapper.eq("STATUS",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){ if(!StringUtil.isEmpty(showCount.getStationId())){
wrapper.eq("STATION_ID",alarm.getStationId()); wrapper.eq("STATION_ID",showCount.getStationId());
} }
if(!StringUtil.isEmpty(alarm.getAlarmSource())){ if(!StringUtil.isEmpty(showCount.getAlarmSource())){
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); wrapper.eq("ALARM_SOURCE",showCount.getAlarmSource());
} }
if(!StringUtil.isEmpty(alarm.getAlarmType())){ if(!StringUtil.isEmpty(showCount.getAlarmType())){
wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); wrapper.eq("ALARM_TYPE",showCount.getAlarmType());
} }
// 处理告警过滤 :当天处理告警 // 处理告警过滤 :当天处理告警
List<String> handles = alarmHandleService.handles(); List<String> handles = alarmHandleService.handles();
@ -176,9 +195,9 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* @return * @return
*/ */
@Override @Override
public List<AlarmEntity> broadcast(String startTime, String endTime) { public List<AlarmEntity> broadcast(String startTime, String endTime,Integer serveType) {
// 站点查询 // 站点查询
List<StationEntity> stations = this.stations(); List<StationEntity> stations = this.stations(serveType);
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -196,17 +215,17 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
/** /**
* 弹框告警 * 弹框告警
* @param depts * @param param
* @return * @return
*/ */
@Override @Override
public TextMessage majorAlarm(List<Long> depts) { public TextMessage majorAlarm(AlartParamVo param) {
// 站点查询 // 站点查询
List<StationEntity> stations = this.stations(); List<StationEntity> stations = this.stations(param.getServeType());
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations) || CollectionUtil.isEmpty(param.getDepts())){
return new TextMessage(new ArrayList().toString()); return new TextMessage(new ArrayList().toString());
} }
List<String> effectives = stations.stream().filter(station->depts.contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList()); List<String> effectives = stations.stream().filter(station->param.getDepts().contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(effectives)){ if(CollectionUtil.isEmpty(effectives)){
return new TextMessage(new ArrayList().toString()); return new TextMessage(new ArrayList().toString());
} }
@ -274,9 +293,20 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* @return 绑定结果 * @return 绑定结果
*/ */
private Boolean isRealIdBanding(String realId,String emCode) { private Boolean isRealIdBanding(String realId,String emCode) {
R<List<DeviceInstanceAttrVO>> deviceAttrR = deviceClient.getOnlineAttr(emCode); // 属性
if(deviceAttrR.isSuccess() && CollectionUtil.isNotEmpty(deviceAttrR.getData())) { R<List<DeviceInstanceAttrVO>> attrs = deviceClient.getOnlineAttr(emCode);
return deviceAttrR.getData().stream().anyMatch(attr -> realId.equals(attr.getFacDeviceAttrId())); if(attrs.isSuccess() && CollectionUtil.isNotEmpty(attrs.getData())) {
return attrs.getData().stream().anyMatch(attr -> realId.equals(attr.getFacDeviceAttrId()));
}
// 事件
R<List<DeviceInstanceEventVO>> events = deviceClient.getOnlineEvent(emCode);
if(events.isSuccess() && CollectionUtil.isNotEmpty(events.getData())) {
return events.getData().stream().anyMatch(event -> realId.equals(event.getFacDeviceEventId()));
}
// 功能
R<List<DeviceInstanceFuncVO>> funcs = deviceClient.getOnlineFunc(emCode);
if(funcs.isSuccess() && CollectionUtil.isNotEmpty(funcs.getData())) {
return funcs.getData().stream().anyMatch(func -> realId.equals(func.getSourceAttrSignage()));
} }
return false; return false;
} }
@ -406,19 +436,155 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* @return * @return
*/ */
@Override @Override
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId) { public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType) {
// 根据realId查找 // 步骤1、根据设备编号查询视频信息
if(StringUtil.isNotBlank(deviceCode)){
return this.deviceVideos(stationCode,deviceCode);
}
// 步骤2、根据采集点查询视频信息
if(StringUtil.isNotBlank(realId)){ if(StringUtil.isNotBlank(realId)){
// 智能预警
if(AlarmConstants.EARLY.equals(alarmType)){
return this.earlyVideos(stationCode,realId);
// 通讯中断、通讯异常查询站点视频
}else if(AlarmConstants.INTERRUPT.equals(alarmType) || AlarmConstants.ABNORMAL.equals(alarmType)){
return this.stationVideos(stationCode);
// 其他告警
}else{
return this.realIdVideos(stationCode,realId);
}
}
// 步骤3.根据站点编号查询视频信息
if(StringUtil.isNotBlank(stationCode)){
return this.stationVideos(stationCode);
}
throw new ServiceException("未查询到告警视频信息!");
}
/**
*查询站点绑定视频信息
* @param stationCode
*/
private List<AlarmVideoVo> stationVideos(String stationCode) {
List<StationVideoTypeEntity> videos = stationVideoTypeClient.listByStationId(stationCode);
if(CollectionUtil.isEmpty(videos)){
throw new ServiceException("站点暂无视频信息!");
}
return videos.stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getName());
alarmVideo.setVideoAppKey(video.getAppKey());
alarmVideo.setVideoAppSecret(video.getAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
} }
// 根据设备编号查找
if(StringUtil.isNotBlank(deviceCode)){
/**
* 查询设备绑定视频信息
* @param deviceCode
* @return
*/
private List<AlarmVideoVo> deviceVideos(String stationCode,String deviceCode) {
// 查询设备绑定视频点位
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCode);
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){
// 查询站点
R<StationEntity> station = stationClient.getStationByCode(stationCode);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
throw new ServiceException("未查询到设备绑定视频信息!");
}
// 查询设备
R<EmInfoEntity> device = emInfoClient.getEmInfoByEmCode(deviceCode);
if(!device.isSuccess() || ObjectUtil.isEmpty(device.getData())){
throw new ServiceException("未查询到设备绑定视频信息!");
}
throw new ServiceException("请在设备信息菜单绑定" + station.getData().getName() + "-" + device.getData().getName() + "视频信息!");
}
return videos.getData().stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getVideoName());
alarmVideo.setVideoAppKey(video.getVideoAppKey());
alarmVideo.setVideoAppSecret(video.getVideoAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
} }
// 根据站点编号查找
if(StringUtil.isNotBlank(stationCode)){
/**
* 查询智能预警视频信息
* @param stationCode
* @param faultId
*/
private List<AlarmVideoVo> earlyVideos(String stationCode, String faultId) {
// 调用FDP接口查询设备编号
Map<String, Object> param = new HashMap<>();
param.put("faultId", faultId);
String result = HttpRequestUtil.postCall(param, FAULTGRAPH_INFO_PATH, "POST");
if (StringUtil.isBlank(result)) {
throw new ServiceException("未查询到智能预警设备信息!");
}
HashMap<String, Object> map = JSONObject.parseObject(result, new TypeReference<HashMap<String, Object>>() {
});
if (ObjectUtil.isEmpty(map)) {
throw new ServiceException("未查询到智能预警设备信息!");
} }
return new ArrayList<>(); List<HashMap<String, Object>> data = JSONObject.parseObject(MapUtils.getString(map, "data"), new TypeReference<List<HashMap<String, Object>>>() {
});
if (CollectionUtil.isEmpty(data)) {
throw new ServiceException("未查询到智能预警设备信息!");
}
String deviceCode = (String) data.get(0).get("TAOS_INSTANCE");
if(StringUtil.isBlank(deviceCode)){
throw new ServiceException("未查询到智能预警设备信息!");
}
return this.deviceVideos(stationCode,deviceCode);
}
/**
* 查询采集点绑定视频信息
* @param stationCode
* @param realId
*/
private List<AlarmVideoVo> realIdVideos(String stationCode, String realId) {
// 查询站点
R<StationEntity> station = stationClient.getStationByCode(stationCode);
if(!station.isSuccess() || ObjectUtil.isEmpty(station)){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
EmInfoEntity param = new EmInfoEntity();
param.setDepartment(station.getData().getRefDept());
// 查询设备
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(param);
if(!devices.isSuccess() || CollectionUtil.isEmpty(devices.getData())){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
String deviceCodes = devices.getData().stream().parallel()
.filter(this::isBandingVideoByEmCode)
.filter(this::isDeviceCodeExist)
.map(EmInfoEntity::getNumber)
.filter(number -> this.isRealIdBanding(realId, number))
.collect(Collectors.joining(","));
if(StringUtil.isEmpty(deviceCodes)){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
// 查询设备绑定视频点位
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCodes);
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){
throw new ServiceException("请在设备信息菜单绑定" + station.getData().getName() + "的设备视频绑定信息!");
}
return videos.getData().stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getVideoName());
alarmVideo.setVideoAppKey(video.getVideoAppKey());
alarmVideo.setVideoAppSecret(video.getVideoAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
} }
} }

9
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java

@ -2,8 +2,8 @@ package com.hnac.hzims.alarm.ws.alart;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -13,7 +13,6 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler; import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @author ysj * @author ysj
@ -57,11 +56,11 @@ public class AlarmHandler extends TextWebSocketHandler {
if(StringUtil.isBlank(message)){ if(StringUtil.isBlank(message)){
return; return;
} }
List<Long> depts = JSONObject.parseArray(message,Long.class); AlartParamVo param = JSONObject.parseObject(message,AlartParamVo.class);
if(CollectionUtil.isEmpty(depts)){ if(ObjectUtil.isEmpty(param)){
return; return;
} }
TextMessage sendMessage = alarmService.majorAlarm(depts); TextMessage sendMessage = alarmService.majorAlarm(param);
session.sendMessage(sendMessage); session.sendMessage(sendMessage);
} }
} }

26
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -127,7 +127,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
// 创建线程池 // 创建线程池
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
@Override @Override
public void loadEmInfo(String param) { public void loadEmInfo(String param) {
@ -281,7 +281,10 @@ public class RealTargetServiceImpl implements RealTargetService {
// 水电站设备 // 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){
targets.addAll(devices.stream().map(device->{ CountDownLatch countDownLatch = new CountDownLatch(devices.size());
for(EminfoAndEmParamVo device : devices) {
pool.submit(() -> {
try{
HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); HydropowerUnitTargetVo target = new HydropowerUnitTargetVo();
target.setDeptId(device.getCreateDept()); target.setDeptId(device.getCreateDept());
target.setDeviceCode(device.getEmCode()); target.setDeviceCode(device.getEmCode());
@ -297,8 +300,19 @@ public class RealTargetServiceImpl implements RealTargetService {
target.setActivePowerVoList(this.getLoadsByDay(device)); target.setActivePowerVoList(this.getLoadsByDay(device));
// 30天发电量 // 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device)); target.setGenerationPowerVoList(this.getGenerationPowerList(device));
return target; targets.add(target);
}).collect(Collectors.toList())); countDownLatch.countDown();
}catch (Exception exception){
countDownLatch.countDown();
}
});
}
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
} }
// 站点指标数据为空 // 站点指标数据为空
if(CollectionUtil.isEmpty(targets)){ if(CollectionUtil.isEmpty(targets)){
@ -1253,6 +1267,7 @@ public class RealTargetServiceImpl implements RealTargetService {
CountDownLatch countDownLatch = new CountDownLatch(limits.size()); CountDownLatch countDownLatch = new CountDownLatch(limits.size());
for(List<StationEntity> item : limits){ for(List<StationEntity> item : limits){
pool.submit(()->{ pool.submit(()->{
try{
item.forEach(station->{ item.forEach(station->{
// 站点设备集合 // 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
@ -1263,6 +1278,9 @@ public class RealTargetServiceImpl implements RealTargetService {
powerMap.put(station.getId(),generateMap); powerMap.put(station.getId(),generateMap);
}); });
countDownLatch.countDown(); countDownLatch.countDown();
}catch (Exception exception){
countDownLatch.countDown();
}
log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
}); });

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -334,9 +334,12 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<String> fileJson = new ArrayList<>(); List<String> fileJson = new ArrayList<>();
// 查询当天数据(条件) // 查询当天数据(条件)
String currentDate = DateUtil.formatDateTime(DateUtil.now()); String currentDate = DateUtil.formatDateTime(DateUtil.now());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH,-1);
// 巡检任务ID集合 // 巡检任务ID集合
List<TaskUserEntity> taskUsers = this.taskUserService.list(new LambdaQueryWrapper<TaskUserEntity>() {{ List<TaskUserEntity> taskUsers = this.taskUserService.list(new LambdaQueryWrapper<TaskUserEntity>() {{
eq(TaskUserEntity::getUserId, user.getUserId()); eq(TaskUserEntity::getUserId, user.getUserId());
ge(TaskUserEntity::getCreateTime, DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE));
}}); }});
if(CollectionUtil.isEmpty(taskUsers)){ if(CollectionUtil.isEmpty(taskUsers)){
throw new ServiceException("巡检用户数据不存在!"); throw new ServiceException("巡检用户数据不存在!");
@ -398,9 +401,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 离线任务任务 // 离线任务任务
List<OfflineTaskEntity> offlines = this.tasksData(taskId,fileList); List<OfflineTaskEntity> offlines = this.tasksData(taskId,fileList);
fileJson.add(JsonUtil.toJson(offlines)); fileJson.add(JsonUtil.toJson(offlines));
if(fileJson.isEmpty()){
return;
}
// 文件写入 // 文件写入
for (int i=0; i < fileJson.size();i++){ for (int i=0; i < fileJson.size();i++){
TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i)); TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i));

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml

@ -4,7 +4,7 @@
<select id="selectCarByYear" resultType="com.hnac.hzims.safeproduct.vo.CarMilesYearVO"> <select id="selectCarByYear" resultType="com.hnac.hzims.safeproduct.vo.CarMilesYearVO">
SELECT SELECT
DISTINCT t1.unit, t1.car_brand, t1.plate_number, t1.create_user, t1.create_dept DISTINCT t1.unit, t1.car_brand, t1.plate_number, t1.create_time
FROM FROM
hzims_car t1 hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id
@ -22,8 +22,7 @@
<select id="selectMilesByCar" resultType="com.hnac.hzims.safeproduct.dto.CarMilesYearDTO"> <select id="selectMilesByCar" resultType="com.hnac.hzims.safeproduct.dto.CarMilesYearDTO">
SELECT SELECT
t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles, t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles
t1.create_user, t1.create_dept
FROM FROM
hzims_car t1 hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java

@ -15,6 +15,7 @@ import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.mapper.CarMapper; import com.hnac.hzims.safeproduct.mapper.CarMapper;
import com.hnac.hzims.safeproduct.service.*; import com.hnac.hzims.safeproduct.service.*;
import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; import com.hnac.hzims.safeproduct.vo.CarMilesYearVO;
import org.apache.commons.collections4.map.HashedMap;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -29,6 +30,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -71,7 +73,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
} }
List<String> carList = records.stream().map(CarMilesYearVO::getPlateNumber).collect(Collectors.toList()); List<String> carList = records.stream().map(CarMilesYearVO::getPlateNumber).collect(Collectors.toList());
List<CarMilesYearDTO> milesList = baseMapper.selectMilesByCar(carList, year); List<CarMilesYearDTO> milesList = baseMapper.selectMilesByCar(carList, year);
List<CarMilesYearVO> res = new ArrayList<>(); HashedMap<String, CarMilesYearVO> map = new HashedMap<>();
milesList.forEach(data -> { milesList.forEach(data -> {
CarMilesYearVO carMilesYearVO = records.stream().filter(x -> x.getPlateNumber().equals(data.getPlateNumber())) CarMilesYearVO carMilesYearVO = records.stream().filter(x -> x.getPlateNumber().equals(data.getPlateNumber()))
.collect(Collectors.toList()).get(0); .collect(Collectors.toList()).get(0);
@ -127,11 +129,14 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
carMilesYearVO.setSumMiles(sum.add(data.getMiles())); carMilesYearVO.setSumMiles(sum.add(data.getMiles()));
} }
if (!carMilesYearVO.getSumMiles().equals(new BigDecimal(0))) { if (!carMilesYearVO.getSumMiles().equals(new BigDecimal(0))) {
res.add(carMilesYearVO); map.put(carMilesYearVO.getPlateNumber(), carMilesYearVO);
} }
}); });
List<CarMilesYearVO> list = new ArrayList<>(map.values());
List<CarMilesYearVO> res = list.stream().sorted(Comparator.comparing(CarMilesYearVO::getCreateTime).reversed())
.collect(Collectors.toList());
page.setRecords(res); page.setRecords(res);
page.setTotal(res.size()); page.setTotal(carPage.getTotal());
return page; return page;
} }

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -144,10 +144,10 @@ public class BaseUtil {
} }
} }
// 表格处理 // 表格处理
if (templatePath.equals("template/卫生自查表.docx")) { if ("template/卫生自查表.docx".equals(templatePath)) {
formatHygieneRecordTable(xwpfDocument); formatHygieneRecordTable(xwpfDocument);
} }
if (templatePath.equals("template/车辆检查表.docx")) { if ("template/车辆检查表.docx".equals(templatePath)) {
formatCarCheckRecordTable(xwpfDocument); formatCarCheckRecordTable(xwpfDocument);
} }
} catch (Exception e) { } catch (Exception e) {
@ -225,13 +225,18 @@ public class BaseUtil {
List<XWPFTableRow> rows = table.getRows(); List<XWPFTableRow> rows = table.getRows();
// 第三行到倒数第二行为需合并区域 // 第三行到倒数第二行为需合并区域
for (int row = 3; row < rows.size() - 1;) { for (int row = 3; row < rows.size() - 1;) {
XWPFTableCell startCell = rows.get(row).getCell(0); // 判断责任区和责任人是否完全一致,一致则合并
String startText = startCell.getText(); XWPFTableCell startFirstCell = rows.get(row).getCell(0);
String startFirstText = startFirstCell.getText();
XWPFTableCell startSecondCell = rows.get(row).getCell(1);
String startSecondText = startSecondCell.getText();
int index = row + 1; int index = row + 1;
for (; index < rows.size(); index++) { for (; index < rows.size(); index++) {
XWPFTableCell endCell = rows.get(index).getCell(0); XWPFTableCell endFirstCell = rows.get(index).getCell(0);
String endText = endCell.getText(); String endFirstText = endFirstCell.getText();
if (!startText.equals(endText)) { XWPFTableCell endSecondCell = rows.get(index).getCell(1);
String endSecondText = endSecondCell.getText();
if (!startFirstText.equals(endFirstText) || !startSecondText.equals(endSecondText)) {
break; break;
} }
} }

Loading…
Cancel
Save