新增根据厂商查询设备信息
This commit is contained in:
parent
a1d6822176
commit
6a85d168df
|
@ -1,17 +1,21 @@
|
||||||
package com.zjyr.beidouservice.common.impl;
|
package com.zjyr.beidouservice.common.impl;
|
||||||
|
|
||||||
import com.zjyr.beidouservice.common.EnumerationBase;
|
import com.zjyr.beidouservice.common.EnumerationBase;
|
||||||
|
import com.zjyr.beidouservice.constenum.AlarmTypeEnum;
|
||||||
|
|
||||||
public enum AlarmTypeName implements EnumerationBase {
|
public enum AlarmTypeName implements EnumerationBase {
|
||||||
|
|
||||||
ALARM_TYPE_PREPARE(1, "ALARM_TYPE_PREPARE"),
|
ALARM_TYPE_PREPARE(1, "预先警报"),
|
||||||
ALARM_TYPE_AIRATTACK(2, "ALARM_TYPE_AIRATTACK"),
|
ALARM_TYPE_AIRATTACK(2, "空袭警报"),
|
||||||
ALARM_TYPE_DISASTER(3, "ALARM_TYPE_DISASTER"),
|
ALARM_TYPE_DISASTER(3, "灾情警报"),
|
||||||
|
|
||||||
ALARM_TYPE_RELIEVE_AIRATTACK(4, "ALARM_TYPE_RELIEVE_AIRATTACK"),
|
ALARM_TYPE_RELIEVE_AIRATTACK(4, "解除警报"),
|
||||||
ALARM_TYPE_RELIEVE_DISASTER(5, "ALARM_TYPE_RELIEVE_DISASTER"),
|
ALARM_TYPE_RELIEVE_DISASTER(5, "解除警报灾情"),
|
||||||
|
|
||||||
ALARM_TYPE_INTERRUPT(6, "ALARM_TYPE_INTERRUPT");
|
ALARM_TYPE_INTERRUPT(6, "中断警报"),
|
||||||
|
|
||||||
|
ALARM_TYPE_FIRE(7, "消防警报"),
|
||||||
|
SHORT_BEEP_TEST(8, "短鸣测试");
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
||||||
|
@ -29,4 +33,15 @@ public enum AlarmTypeName implements EnumerationBase {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.desc;
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getByCode(Integer code) {
|
||||||
|
AlarmTypeName[] values = AlarmTypeName.values();
|
||||||
|
for (AlarmTypeName v : values) {
|
||||||
|
if (code.equals(v.getValue())) {
|
||||||
|
return v.getDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ public interface AlarmDeviceTaskMapper {
|
||||||
|
|
||||||
void batchUpdate(@Param("list") List<AlarmDeviceTaskDO> deviceTaskList);
|
void batchUpdate(@Param("list") List<AlarmDeviceTaskDO> deviceTaskList);
|
||||||
|
|
||||||
List<AlarmDeviceTaskDO> selectAllByTaskIdStr(@Param("list") List<String> taskIdStrList);
|
List<AlarmDeviceTaskDTO> selectAllByTaskIdStr(@Param("list") List<String> taskIdStrList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,5 +73,11 @@ public class AlarmDeviceTaskListRespDTO {
|
||||||
*/
|
*/
|
||||||
@Schema(title = "设备维度", example = "37.90", description = "纬度")
|
@Schema(title = "设备维度", example = "37.90", description = "纬度")
|
||||||
private Float longitude;
|
private Float longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 警报种类 1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试
|
||||||
|
*/
|
||||||
|
@Schema(title = "警报种类", example = "2", description = "1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试")
|
||||||
|
private String alarmKind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,13 @@ public class AlarmTaskListRespDTO {
|
||||||
/**
|
/**
|
||||||
* 任务编号
|
* 任务编号
|
||||||
*/
|
*/
|
||||||
@Schema(title = "任务编号", example = "JL202308250020",description = "记录编号")
|
@Schema(title = "任务编号", example = "JL202308250020", description = "记录编号")
|
||||||
private String taskIdStr;
|
private String taskIdStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录时间
|
* 记录时间
|
||||||
*/
|
*/
|
||||||
@Schema(title = "记录时间", example = "2023-08-26 21:00:05",description = "记录时间")
|
@Schema(title = "记录时间", example = "2023-08-26 21:00:05", description = "记录时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date recodeTime;
|
private Date recodeTime;
|
||||||
|
|
||||||
|
@ -74,6 +74,12 @@ public class AlarmTaskListRespDTO {
|
||||||
*/
|
*/
|
||||||
@Schema(title = "回示率", example = "88.8", description = "设备正常个数/设备总数量")
|
@Schema(title = "回示率", example = "88.8", description = "设备正常个数/设备总数量")
|
||||||
private Double respRate;
|
private Double respRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 警报种类 1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试
|
||||||
|
*/
|
||||||
|
@Schema(title = "警报种类", example = "2", description = "1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试")
|
||||||
|
private String alarmKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,8 @@ public class AlarmDeviceTaskDTO extends AlarmDeviceTaskDO {
|
||||||
* 设备的北斗 id
|
* 设备的北斗 id
|
||||||
*/
|
*/
|
||||||
private Integer beidouId;
|
private Integer beidouId;
|
||||||
|
|
||||||
|
private Integer alarmType;
|
||||||
|
|
||||||
|
private Integer alarmKind;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,21 +38,21 @@ public class AlarmTaskReqDTO {
|
||||||
private String deviceIds;
|
private String deviceIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 警报类型 1:语言广播 2:警报发送 3:警报试鸣,默认警报发送2
|
* 警报类型 0:正常警报 1:警报试鸣(无声) 2:警报试鸣(短鸣) 3:警报试鸣(大声) 4:语音发放,默认警报发送0
|
||||||
*/
|
*/
|
||||||
@Schema(title = "警报类型", example = "2",description = "1:语言广播 2:警报发送 3:警报试鸣,默认警报发送2")
|
@Schema(title = "警报类型", example = "0",description = "0:正常警报 1:警报试鸣(无声) 2:警报试鸣(短鸣) 3:警报试鸣(大声) 4:语音发放,默认警报发送0")
|
||||||
private Integer alarmType;
|
private Integer alarmType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 警报种类 1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报
|
* 警报种类 1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试
|
||||||
*/
|
*/
|
||||||
@Schema(title = "警报种类", example = "2",description = "1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报")
|
@Schema(title = "警报种类", example = "2",description = "1:预先警报 2:空袭警报 3:灾情警报 4:解除警报 5:解除警报灾情 6:中断警报 7:消防警报 8:短鸣测试")
|
||||||
private Integer alarmKind;
|
private Integer alarmKind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 警报方式 1:人工 2:定时,默认人工
|
* 警报方式 0:定时 1:人工 默认人工
|
||||||
*/
|
*/
|
||||||
@Schema(title = "警报方式", example = "1",description = "警报方式 1:人工 2:定时,默认人工")
|
@Schema(title = "警报方式", example = "1",description = "警报方式 0:定时 1:人工,默认人工")
|
||||||
private Integer alarmMode;
|
private Integer alarmMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.zjyr.beidouservice.common.CommonEnumHandler;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmControlTypeName;
|
import com.zjyr.beidouservice.common.impl.AlarmControlTypeName;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmModeName;
|
import com.zjyr.beidouservice.common.impl.AlarmModeName;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmTypeName;
|
import com.zjyr.beidouservice.common.impl.AlarmTypeName;
|
||||||
import com.zjyr.beidouservice.common.impl.ControlChannelStatus;
|
|
||||||
import com.zjyr.beidouservice.common.impl.SensorControlTunnelName;
|
import com.zjyr.beidouservice.common.impl.SensorControlTunnelName;
|
||||||
import com.zjyr.beidouservice.common.impl.TaskStatusName;
|
import com.zjyr.beidouservice.common.impl.TaskStatusName;
|
||||||
import com.zjyr.beidouservice.constenum.ApprovalStatusEnum;
|
import com.zjyr.beidouservice.constenum.ApprovalStatusEnum;
|
||||||
|
@ -27,6 +26,7 @@ import com.zjyr.beidouservice.pojo.dto.AlarmDeviceTaskListRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.AlarmTaskListRespDTO;
|
import com.zjyr.beidouservice.pojo.dto.AlarmTaskListRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceByLocationDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceByLocationDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceInfoDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceInfoDTO;
|
||||||
|
import com.zjyr.beidouservice.pojo.dto.task.AlarmDeviceTaskDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.task.AlarmDeviceTaskListReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.task.AlarmDeviceTaskListReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.task.AlarmTaskListReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.task.AlarmTaskListReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.task.AlarmTaskReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.task.AlarmTaskReqDTO;
|
||||||
|
@ -144,10 +144,11 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
.taskIdStr(s.getTaskIdStr())
|
.taskIdStr(s.getTaskIdStr())
|
||||||
.id(s.getId())
|
.id(s.getId())
|
||||||
.recodeTime(s.getSendTime())
|
.recodeTime(s.getSendTime())
|
||||||
|
.alarmKind(AlarmTypeName.getByCode(s.getAlarmKind()))
|
||||||
.build())
|
.build())
|
||||||
.toList();
|
.toList();
|
||||||
//聚合控制通道
|
//聚合控制通道
|
||||||
List<AlarmDeviceTaskDO> deviceTaskList = getAggregatedAlarmDeviceTaskDOS(
|
List<AlarmDeviceTaskDTO> deviceTaskList = getAggregatedAlarmDeviceTaskDOS(
|
||||||
alarmTaskDOList.stream()
|
alarmTaskDOList.stream()
|
||||||
.map(AlarmTaskListRespDTO.AlarmTaskRespDTO::getTaskIdStr)
|
.map(AlarmTaskListRespDTO.AlarmTaskRespDTO::getTaskIdStr)
|
||||||
.distinct()
|
.distinct()
|
||||||
|
@ -181,7 +182,7 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
Integer pageSize = alarmDeviceTaskListReqDTO.getPageSize();
|
Integer pageSize = alarmDeviceTaskListReqDTO.getPageSize();
|
||||||
List<String> taskIdStrList = alarmDeviceTaskListReqDTO.getTaskIdStrList();
|
List<String> taskIdStrList = alarmDeviceTaskListReqDTO.getTaskIdStrList();
|
||||||
|
|
||||||
List<AlarmDeviceTaskDO> result = getAggregatedAlarmDeviceTaskDOS(taskIdStrList);
|
List<AlarmDeviceTaskDTO> result = getAggregatedAlarmDeviceTaskDOS(taskIdStrList);
|
||||||
// 执行中的不展示在详情页
|
// 执行中的不展示在详情页
|
||||||
result = result.stream().filter(s -> !TaskStatusName.TASK_EXECUTING.getValue().equals(s.getStatus())).collect(Collectors.toList());
|
result = result.stream().filter(s -> !TaskStatusName.TASK_EXECUTING.getValue().equals(s.getStatus())).collect(Collectors.toList());
|
||||||
if(result.isEmpty()){
|
if(result.isEmpty()){
|
||||||
|
@ -207,6 +208,7 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
dto.setReportTime(s.getReportTime());
|
dto.setReportTime(s.getReportTime());
|
||||||
dto.setDeviceId(s.getDeviceId());
|
dto.setDeviceId(s.getDeviceId());
|
||||||
dto.setTaskId(s.getTaskId());
|
dto.setTaskId(s.getTaskId());
|
||||||
|
dto.setAlarmKind(AlarmTypeName.getByCode(s.getAlarmKind()));
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
@ -217,17 +219,17 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AlarmDeviceTaskDO> getAggregatedAlarmDeviceTaskDOS(List<String> taskIdStrList) {
|
private List<AlarmDeviceTaskDTO> getAggregatedAlarmDeviceTaskDOS(List<String> taskIdStrList) {
|
||||||
if (taskIdStrList.isEmpty()) {
|
if (taskIdStrList.isEmpty()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<AlarmDeviceTaskDO> alarmDeviceTaskList = alarmDeviceTaskMapper.selectAllByTaskIdStr(taskIdStrList);
|
List<AlarmDeviceTaskDTO> alarmDeviceTaskList = alarmDeviceTaskMapper.selectAllByTaskIdStr(taskIdStrList);
|
||||||
// 刷新每个device的任务状态
|
// 刷新每个device的任务状态
|
||||||
Map<String, List<AlarmDeviceTaskDO>> deviceTaskMap = alarmDeviceTaskList.stream()
|
Map<String, List<AlarmDeviceTaskDTO>> deviceTaskMap = alarmDeviceTaskList.stream()
|
||||||
.collect(Collectors.groupingBy(s -> String.format("%s-%s", s.getTaskId(), s.getDeviceId())));
|
.collect(Collectors.groupingBy(s -> String.format("%s-%s", s.getTaskId(), s.getDeviceId())));
|
||||||
List<AlarmDeviceTaskDO> result = new LinkedList<>();
|
List<AlarmDeviceTaskDTO> result = new LinkedList<>();
|
||||||
for (Map.Entry<String, List<AlarmDeviceTaskDO>> entry : deviceTaskMap.entrySet()) {
|
for (Map.Entry<String, List<AlarmDeviceTaskDTO>> entry : deviceTaskMap.entrySet()) {
|
||||||
List<AlarmDeviceTaskDO> relatedDOS = entry.getValue();
|
List<AlarmDeviceTaskDTO> relatedDOS = entry.getValue();
|
||||||
if (relatedDOS.size() == 1) {
|
if (relatedDOS.size() == 1) {
|
||||||
result.addAll(relatedDOS);
|
result.addAll(relatedDOS);
|
||||||
continue;
|
continue;
|
||||||
|
@ -237,7 +239,7 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
// 所有都超时的,视为超时
|
// 所有都超时的,视为超时
|
||||||
boolean allTimeout = relatedDOS.stream().allMatch(s -> TaskStatusName.TASK_TIMEOUT.getValue().equals(s.getStatus()));
|
boolean allTimeout = relatedDOS.stream().allMatch(s -> TaskStatusName.TASK_TIMEOUT.getValue().equals(s.getStatus()));
|
||||||
boolean allExecuting = relatedDOS.stream().allMatch(s -> TaskStatusName.TASK_EXECUTING.getValue().equals(s.getStatus()));
|
boolean allExecuting = relatedDOS.stream().allMatch(s -> TaskStatusName.TASK_EXECUTING.getValue().equals(s.getStatus()));
|
||||||
AlarmDeviceTaskDO resultDO = relatedDOS.get(0);
|
AlarmDeviceTaskDTO resultDO = relatedDOS.get(0);
|
||||||
if (hasSucceedDeviceTask) {
|
if (hasSucceedDeviceTask) {
|
||||||
resultDO.setStatus(TaskStatusName.TASK_OK.getValue());
|
resultDO.setStatus(TaskStatusName.TASK_OK.getValue());
|
||||||
} else if (allTimeout) {
|
} else if (allTimeout) {
|
||||||
|
|
|
@ -65,7 +65,8 @@ public class AlarmStatusTask {
|
||||||
.filter(s -> s.getTaskInfo() != null)
|
.filter(s -> s.getTaskInfo() != null)
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
s -> String.format("%s-%s-%s", s.getTaskInfo().getTaskId(), s.getTaskInfo().getSensorId(), s.getTaskInfo().getChannel().getValue()),
|
s -> String.format("%s-%s-%s", s.getTaskInfo().getTaskId(), s.getTaskInfo().getSensorId(), s.getTaskInfo().getChannel().getValue()),
|
||||||
s -> s
|
s -> s,
|
||||||
|
(s1, s2) -> s1
|
||||||
));
|
));
|
||||||
|
|
||||||
deviceList.forEach(alarmDeviceTaskDO -> {
|
deviceList.forEach(alarmDeviceTaskDO -> {
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="alarm_device_task_dto" type="com.zjyr.beidouservice.pojo.dto.task.AlarmDeviceTaskDTO" extends="alarm_device_task">
|
<resultMap id="alarm_device_task_dto" type="com.zjyr.beidouservice.pojo.dto.task.AlarmDeviceTaskDTO" extends="alarm_device_task">
|
||||||
<result property="beidouId" column="beidou_id" jdbcType="INTEGER"/>
|
<result property="beidouId" column="beidou_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="alarmType" column="alarm_type" jdbcType="INTEGER"/>
|
||||||
|
<result property="alarmKind" column="alarm_kind" jdbcType="INTEGER"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,8 +55,8 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectAllByTaskIdStr" resultMap="alarm_device_task">
|
<select id="selectAllByTaskIdStr" resultMap="alarm_device_task_dto">
|
||||||
select adt.* from alarm_device_task adt
|
select adt.*, atk.alarm_type, atk.alarm_kind from alarm_device_task adt
|
||||||
join alarm_task atk on adt.task_id = atk.id
|
join alarm_task atk on adt.task_id = atk.id
|
||||||
where 1 = 1
|
where 1 = 1
|
||||||
<if test="list != null and !list.isEmpty()">
|
<if test="list != null and !list.isEmpty()">
|
||||||
|
|
Loading…
Reference in New Issue