Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 9 months ago
parent
commit
f1fa896677
  1. 59
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/SystemAlarmVo.java
  2. 2
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java
  3. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java
  4. 18
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java
  5. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java
  6. 1
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java
  7. 1
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/SystemAlarmService.java
  8. 12
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java
  9. 37
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java
  10. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java
  11. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  12. 2
      hzims-service/safeproduct/src/main/resources/db/2.0.0.sql.1

59
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/SystemAlarmVo.java

@ -3,44 +3,45 @@ package com.hnac.hzims.alarm.config.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
/** /**
* @author ysj * @author ysj
*/ */
@Data @Data
@ApiModel(value = "华自3000告警对象", description = "华自3000告警对象") @ApiModel(value = "华自3000告警对象", description = "华自3000告警对象")
public class SystemAlarmVo { public class SystemAlarmVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** private Long ts;
* 告警时间
*/
private String ts;
/**
* 告警ID由平台生成具有唯一性
*/
private String id;
/**
* 告警内容
*/
private String soeExplain;
/**
* 告警类型对应数据字典 soe_alarm_type
*/
private Integer soeType;
private Integer soeStatus;
/**
* 告警动作对应HZ3000的告警 {"分", "合"}, {"复归", "动作"}
*/
private Integer soeAlarmType;
/**
* 动作值
*/
private String optionvals;
/**
* 站点id
*/
private String station; private String station;
private String sid;
private String id;
private String realId;
private Integer type;
private String kind;
private String level;
private Integer state;
private String stateLabel;
private String context;
private String opvalue;
private String duration;
private Boolean trace;
private Integer traceCount;
} }

2
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java

@ -39,7 +39,7 @@ public class HygieneRecordEntity extends BaseEntity {
@ApiModelProperty("实际结束时间") @ApiModelProperty("实际结束时间")
private Date actualEndTime; private Date actualEndTime;
@Size(max = 20, message = "检查人字段长度不能超过20") @Size(max = 100, message = "检查人字段长度不能超过100")
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;

9
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java

@ -234,11 +234,12 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
//诊断成功 //诊断成功
if (3 == req.getStatus()) { if (3 == req.getStatus()) {
fdpSubmitResultDTO.setSuccess(1); fdpSubmitResultDTO.setSuccess(1);
} else if (Func.isNotEmpty(req.getReasonId())) {
fdpSubmitResultDTO.setRootCause(req.getReasonId());
} else {
return R.fail("诊断传送状态异常");
} }
// else if (Func.isNotEmpty(req.getReasonId())) {
// fdpSubmitResultDTO.setRootCause(req.getReasonId());
// } else {
// return R.fail("诊断传送状态异常");
// }
if (Func.isNotEmpty(req.getReasonId())) { if (Func.isNotEmpty(req.getReasonId())) {
fdpSubmitResultDTO.setRootCause(req.getReasonId()); fdpSubmitResultDTO.setRootCause(req.getReasonId());
} }

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

@ -1,6 +1,7 @@
package com.hnac.hzims.alarm.monitor.service.impl; package com.hnac.hzims.alarm.monitor.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
@ -51,14 +52,23 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
// 步骤2.遍历保存告警数据 // 步骤2.遍历保存告警数据
alarms.forEach(alarm->{ alarms.forEach(alarm->{
// 步骤3.根据站点查询配置标识 List<StationEntity> stations = result.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stations)){
return;
}
// 步骤3.站点参数设置
alarm.setCreateDept(stations.get(0).getCreateDept());
alarm.setStationName(stations.get(0).getName());
alarm.setTenantId(stations.get(0).getTenantId());
alarm.setStatus(0);
// 步骤4.根据站点查询配置标识
AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType()); AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType());
if(ObjectUtil.isEmpty(mark)){ if(ObjectUtil.isEmpty(mark)){
log.error("alarm obtain mark is null : {}",alarm.getAlarmId()); log.error("alarm obtain mark is null : {}",alarm.getAlarmId());
return; return;
} }
// 步骤4.告警处理标识赋值 // 步骤5.告警处理标识赋值
alarm.setIsRightTabulation(mark.getIsRightTabulation()); alarm.setIsRightTabulation(mark.getIsRightTabulation());
alarm.setIsBroadcast(mark.getIsBroadcast()); alarm.setIsBroadcast(mark.getIsBroadcast());
alarm.setIsMask(mark.getIsMask()); alarm.setIsMask(mark.getIsMask());
@ -68,14 +78,14 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
alarm.setIsShortMessage(mark.getIsShortMessage()); alarm.setIsShortMessage(mark.getIsShortMessage());
alarm.setIsWxMessage(mark.getIsWxMessage()); alarm.setIsWxMessage(mark.getIsWxMessage());
// 步骤5.保存当日告警数据 // 步骤6.保存当日告警数据
boolean isSave = alarmService.save(alarm); boolean isSave = alarmService.save(alarm);
if(!isSave){ if(!isSave){
log.error("alarm save fail : {}",alarm.getAlarmId()); log.error("alarm save fail : {}",alarm.getAlarmId());
return; return;
} }
// 步骤6.发生数据至redis告警队列 // 步骤7.发生数据至redis告警队列
stringRedisTemplate.opsForList().rightPush("hzims:queue:alarm", JSON.toJSONString(alarm)); stringRedisTemplate.opsForList().rightPush("hzims:queue:alarm", JSON.toJSONString(alarm));
}); });
return true; return true;

9
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java

@ -6,9 +6,11 @@ import com.hnac.hzims.alarm.source.service.SystemAlarmService;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
import com.hnac.hzinfo.subscribe.SubscribeCallBack; import com.hnac.hzinfo.subscribe.SubscribeCallBack;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -26,10 +28,9 @@ public class HZ300MqttConsumer implements SubscribeCallBack {
private AlarmSaveService alarmSaveService; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
System.out.println("监听到消息"+data.toString()); log.error("HZ3000队列监听到消息 : {}",data);
String s = JSONObject.toJSONString(data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data));
//统一数据处理 //统一数据处理
try { try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
@ -37,4 +38,4 @@ public class HZ300MqttConsumer implements SubscribeCallBack {
log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e); log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e);
} }
} }
} }

1
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java

@ -30,6 +30,7 @@ public class MqttConfig {
HZ300MqttConsumer hz300MqttConsumer; HZ300MqttConsumer hz300MqttConsumer;
@Autowired @Autowired
VideoMqttConsumer videoMqttConsumer; VideoMqttConsumer videoMqttConsumer;
@Value("${hzims.mqtt.url}") @Value("${hzims.mqtt.url}")
private String mqtt_fdp_url; private String mqtt_fdp_url;
@Value("${hzims.mqtt.group}") @Value("${hzims.mqtt.group}")

1
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/SystemAlarmService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.source.service;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 告警处理接口 * 告警处理接口

12
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java

@ -74,10 +74,6 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
return new ArrayList<>(); return new ArrayList<>();
} }
AlarmEntity entity = getAlarmEntity(alarms); AlarmEntity entity = getAlarmEntity(alarms);
// List<AlarmEntity> res = alarms.stream().map(s -> {
// AlarmEntity entity = getAlarmEntity(s);
// return entity;
// }).collect(Collectors.toList());
return Collections.singletonList(entity); return Collections.singletonList(entity);
} }
@ -87,6 +83,7 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
entity.setRealId(item.getFaultId()); entity.setRealId(item.getFaultId());
entity.setAlarmTime(item.getCreateTime()); entity.setAlarmTime(item.getCreateTime());
entity.setAlarmContext(item.getFinfo()); entity.setAlarmContext(item.getFinfo());
entity.setAlarmSource(EARLY_WARNING);
entity.setAlarmType(EARLY); entity.setAlarmType(EARLY);
entity.setDeviceCode(item.getDeviceId()); entity.setDeviceCode(item.getDeviceId());
entity.setDeviceName(item.getDeviceName()); entity.setDeviceName(item.getDeviceName());
@ -95,13 +92,6 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());
entity.setDiagReason(item.getDiagReason()); entity.setDiagReason(item.getDiagReason());
entity.setDiagSolution(item.getDiagSolution()); entity.setDiagSolution(item.getDiagSolution());
entity.setAlarmSource(EARLY_WARNING);
entity.setTenantId("200000");
R<StationEntity> stationByCode = stationClient.getStationByCode(item.getStation());
if (stationByCode.isSuccess()&& ObjectUtils.isNotEmpty(stationByCode.getData())){
entity.setCreateDept(stationByCode.getData().getCreateDept());
entity.setStationName(stationByCode.getData().getName());
}
return entity; return entity;
} }

37
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzims.alarm.source.service.impl; package com.hnac.hzims.alarm.source.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
@ -14,6 +15,7 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import lombok.RequiredArgsConstructor; 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.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
@ -22,9 +24,7 @@ import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -73,33 +73,28 @@ public class SystemAlarmServiceImpl implements SystemAlarmService {
@Override @Override
public List<AlarmEntity> receiveMessage(String message) { public List<AlarmEntity> receiveMessage(String message) {
// 对象转换 // 对象转换
List<SystemAlarmVo> alarms = JSONObject.parseArray(message, SystemAlarmVo.class); SystemAlarmVo systemAlarm = JSONObject.parseObject(message, SystemAlarmVo.class);
if (CollectionUtil.isEmpty(alarms)) { log.error("HZ3000告警对象转换后:{}",systemAlarm);
if (ObjectUtils.isEmpty(systemAlarm)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<AlarmEntity> res = alarms.stream().map(s -> { return Collections.singletonList(this.getAlarmEntity(systemAlarm));
AlarmEntity entity = getAlarmEntity(s);
return entity;
}).collect(Collectors.toList());
return res;
} }
private AlarmEntity getAlarmEntity(SystemAlarmVo item) { private AlarmEntity getAlarmEntity(SystemAlarmVo item) {
AlarmEntity entity = new AlarmEntity(); AlarmEntity entity = new AlarmEntity();
entity.setAlarmId(item.getId()); entity.setAlarmId(item.getId());
entity.setAlarmTime(DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s")); Date date = new Date();
entity.setAlarmContext(item.getSoeExplain()); date.setTime(item.getTs());
entity.setAlarmType(item.getSoeAlarmType()); entity.setAlarmTime(DateUtil.parse(DateUtil.format(date,DateUtil.PATTERN_DATETIME),DateUtil.PATTERN_DATETIME));
entity.setAlarmStatus(item.getSoeStatus()); entity.setAlarmContext(item.getContext());
entity.setAlarmValue(item.getOptionvals()); entity.setAlarmType(item.getType());
entity.setAlarmStatus(item.getState());
entity.setAlarmValue(item.getOpvalue());
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());
entity.setAlarmCount(item.getTraceCount());
entity.setRealId(item.getRealId());
entity.setAlarmSource(AlarmConstants.HZ3000_ALARM); entity.setAlarmSource(AlarmConstants.HZ3000_ALARM);
entity.setTenantId("200000");
R<StationEntity> stationByCode = stationClient.getStationByCode(item.getStation());
if (stationByCode.isSuccess() && ObjectUtils.isNotEmpty(stationByCode.getData())) {
entity.setCreateDept(stationByCode.getData().getCreateDept());
entity.setStationName(stationByCode.getData().getName());
}
return entity; return entity;
} }
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java

@ -609,9 +609,6 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMap
List<CheckVoteChartVo> res = new ArrayList<>(); List<CheckVoteChartVo> res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) { if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) {
CheckVoteChartVo all = getCheckVoteChartVo(operPhenomenonEntities);
all.setName("总计");
res.add(all);
Map<Long, List<OperPhenomenonEntity>> collect = Optional.ofNullable(operPhenomenonEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getCreateDept)); Map<Long, List<OperPhenomenonEntity>> collect = Optional.ofNullable(operPhenomenonEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getCreateDept));
for (Map.Entry<Long, List<OperPhenomenonEntity>> longListEntry : collect.entrySet()) { for (Map.Entry<Long, List<OperPhenomenonEntity>> longListEntry : collect.entrySet()) {
CheckVoteChartVo chartVo= getCheckVoteChartVo(longListEntry.getValue()); CheckVoteChartVo chartVo= getCheckVoteChartVo(longListEntry.getValue());
@ -619,6 +616,9 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMap
chartVo.setName(deptName.isSuccess() ? deptName.getData() : ""); chartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(chartVo); res.add(chartVo);
} }
CheckVoteChartVo all = getCheckVoteChartVo(operPhenomenonEntities);
all.setName("总计");
res.add(all);
} else { } else {
CheckVoteChartVo all = new CheckVoteChartVo(); CheckVoteChartVo all = new CheckVoteChartVo();
all.setName("总计"); all.setName("总计");

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java

@ -162,11 +162,17 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) { public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) {
boolean deleteFlag = carCheckItemService.removeRelativeCarCheckItem(carCheckRecordDTO.getId());
if (!deleteFlag){
return false;
}
// 更新检查项 // 更新检查项
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList(); List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
boolean updateItem = carCheckItemService.updateBatchById(itemList); itemList.forEach(x -> {x.setCarCheckRecordId(carCheckRecordDTO.getId());
// 若更新检查项成功,则更新车检记录 x.setId(null);});
if (updateItem) { boolean b = carCheckItemService.saveBatch(itemList);
if (b) {
// 若更新检查项成功,则更新车检记录
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity();
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity);
return this.updateById(carCheckRecordEntity); return this.updateById(carCheckRecordEntity);

2
hzims-service/safeproduct/src/main/resources/db/2.0.0.sql.1

@ -222,7 +222,7 @@ CREATE TABLE `HZIMS_HYGIENE_RECORD` (
`ACTUAL_START_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间', `ACTUAL_START_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间',
`ACTUAL_END_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间', `ACTUAL_END_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间',
`CHECK_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '检查时间', `CHECK_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '检查时间',
`CHECK_USER` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '检查人', `CHECK_USER` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '检查人',
`HYGIENE_ZONE_IDS` VARCHAR(1000) NOT NULL COMMENT '卫生自查区域ID', `HYGIENE_ZONE_IDS` VARCHAR(1000) NOT NULL COMMENT '卫生自查区域ID',
`CHECK_RESULT` MEDIUMTEXT NOT NULL COMMENT '检查结果', `CHECK_RESULT` MEDIUMTEXT NOT NULL COMMENT '检查结果',
`COMPREHENSIVE_SCORE` VARCHAR(500) NOT NULL COMMENT '综合评分', `COMPREHENSIVE_SCORE` VARCHAR(500) NOT NULL COMMENT '综合评分',

Loading…
Cancel
Save