parent
acd4eae5d9
commit
fc8ab788d1
|
@ -4,13 +4,12 @@ import com.zjyr.beidouservice.common.EnumerationBase;
|
||||||
|
|
||||||
public enum AlarmTypeName implements EnumerationBase {
|
public enum AlarmTypeName implements EnumerationBase {
|
||||||
|
|
||||||
ALARM_TYPE_AIRATTACK(0, "ALARM_TYPE_AIRATTACK"),
|
ALARM_TYPE_PREPARE(1, "ALARM_TYPE_PREPARE"),
|
||||||
ALARM_TYPE_DISASTER(1, "ALARM_TYPE_DISASTER"),
|
ALARM_TYPE_AIRATTACK(2, "ALARM_TYPE_AIRATTACK"),
|
||||||
ALARM_TYPE_PREPARE(2, "ALARM_TYPE_PREPARE"),
|
|
||||||
ALARM_TYPE_RELIEVE_AIRATTACK(3, "ALARM_TYPE_RELIEVE_AIRATTACK"),
|
ALARM_TYPE_RELIEVE_AIRATTACK(3, "ALARM_TYPE_RELIEVE_AIRATTACK"),
|
||||||
ALARM_TYPE_RELIEVE_DISASTER(4, "ALARM_TYPE_RELIEVE_DISASTER"),
|
ALARM_TYPE_RELIEVE_DISASTER(4, "ALARM_TYPE_RELIEVE_DISASTER"),
|
||||||
|
ALARM_TYPE_DISASTER(5, "ALARM_TYPE_DISASTER"),
|
||||||
;
|
ALARM_TYPE_INTERRUPT(6, "ALARM_TYPE_INTERRUPT");
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.zjyr.beidouservice.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.zjyr.beidouservice.pojo.MyResp;
|
import com.zjyr.beidouservice.pojo.MyResp;
|
||||||
|
import com.zjyr.beidouservice.pojo.dto.DeviceByIdRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceSearchDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceSearchDTO;
|
||||||
|
@ -48,8 +49,8 @@ public class DeviceController {
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "根据deviceId获取设备信息")
|
@Operation(summary = "根据deviceId获取设备信息")
|
||||||
@PostMapping("device/info/deviceId")
|
@PostMapping("device/info/deviceId")
|
||||||
public MyResp<DeviceRespDTO> getDeviceByDeviceId(@RequestBody DeviceSearchDTO deviceSearchDTO) {
|
public MyResp<DeviceByIdRespDTO> getDeviceByDeviceId(@RequestBody DeviceSearchDTO deviceSearchDTO) {
|
||||||
DeviceRespDTO deviceRespDTO = deviceService.getDeviceByDeviceId(deviceSearchDTO);
|
DeviceByIdRespDTO deviceRespDTO = deviceService.getDeviceByDeviceId(deviceSearchDTO);
|
||||||
return MyResp.success(deviceRespDTO);
|
return MyResp.success(deviceRespDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.zjyr.beidouservice.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class DevMaunDTO {
|
|
||||||
private Long deviceId;
|
|
||||||
|
|
||||||
private Integer alarmManufacturer;
|
|
||||||
|
|
||||||
private Integer controlManufacturer;
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.zjyr.beidouservice.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class DevTaskExecRespDTO {
|
|
||||||
List<TaskExecRespContentDTO> data;
|
|
||||||
}
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.zjyr.beidouservice.pojo.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.zjyr.beidouservice.constenum.DeviceAlarmStatusEnum;
|
||||||
|
import com.zjyr.beidouservice.pojo.dataobject.DeviceDO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(name = "设备请求返回体")
|
||||||
|
public class DeviceByIdRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@Schema(title = "设备id", example = "123")
|
||||||
|
private Integer deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端名称
|
||||||
|
*/
|
||||||
|
@Schema(title = "设备名称", example = "大运河002")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
@Schema(title = "设备经度", example = "372.12")
|
||||||
|
private Float latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
@Schema(title = "设备维度", example = "37.90")
|
||||||
|
private Float longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属区县
|
||||||
|
*/
|
||||||
|
@Schema(title = "区县代码", example = "90")
|
||||||
|
private Integer countyCode;
|
||||||
|
/**
|
||||||
|
* 所属地市
|
||||||
|
*/
|
||||||
|
@Schema(title = "所属地市", example = "1")
|
||||||
|
private Integer cityCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属省份
|
||||||
|
*/
|
||||||
|
@Schema(title = "所属省份", example = "33")
|
||||||
|
private Integer provinceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装地址
|
||||||
|
*/
|
||||||
|
@Schema(title = "安装地址", example = "余杭区五常街道")
|
||||||
|
private String installSite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否告警中
|
||||||
|
*/
|
||||||
|
@Schema(title = "是否告警中", example = "false", description = "false为非告警中,true为告警中")
|
||||||
|
private Boolean isAlarming;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式
|
||||||
|
*/
|
||||||
|
@Schema(title = "联系方式", example = "18867111100")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*安装时间
|
||||||
|
*/
|
||||||
|
@Schema(title = "安装时间", example = "2023-08-26 21:00:05", description = "安装时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date installTime;
|
||||||
|
|
||||||
|
|
||||||
|
public static DeviceByIdRespDTO fromDO(DeviceDO deviceDO) {
|
||||||
|
DeviceByIdRespDTO resp = new DeviceByIdRespDTO();
|
||||||
|
resp.setDeviceId(deviceDO.getDeviceId());
|
||||||
|
resp.setDeviceName(deviceDO.getDeviceName());
|
||||||
|
resp.setCountyCode(deviceDO.getCountyCode());
|
||||||
|
resp.setCityCode(deviceDO.getCityCode());
|
||||||
|
resp.setProvinceCode(deviceDO.getProvinceCode());
|
||||||
|
resp.setLatitude(deviceDO.getLatitude());
|
||||||
|
resp.setLongitude(deviceDO.getLongitude());
|
||||||
|
resp.setInstallSite(deviceDO.getInstallSite());
|
||||||
|
resp.setIsAlarming(DeviceAlarmStatusEnum.ALARMING.getCode().equals(deviceDO.getAlarmStatus()));
|
||||||
|
resp.setMobile(deviceDO.getMobile());
|
||||||
|
resp.setInstallTime(deviceDO.getInstallTime());
|
||||||
|
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
package com.zjyr.beidouservice.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ManufacturerContentDTO {
|
|
||||||
|
|
||||||
private String ManufacturerName;
|
|
||||||
|
|
||||||
private Integer ManufacturerType;
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.zjyr.beidouservice.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ManufacturerRespDTO {
|
|
||||||
|
|
||||||
|
|
||||||
List<ManufacturerContentDTO> data;
|
|
||||||
}
|
|
|
@ -44,9 +44,9 @@ public class AlarmTaskReqDTO {
|
||||||
private Integer alarmType;
|
private Integer alarmType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 警报种类 1:预先警报 2:空袭警报 3:灾情警 4:解除警报灾 5:解除警报
|
* 警报种类 1:预先警报 2:空袭警报 3:灾情警 4:解除警报灾 5:解除警报 6:中断警报
|
||||||
*/
|
*/
|
||||||
@Schema(title = "警报种类", example = "2",description = "1:预先警报 2:空袭警报 3:灾情警 4:解除警报灾 5:解除警报")
|
@Schema(title = "警报种类", example = "2",description = "1:预先警报 2:空袭警报 3:灾情警报 4:解除警报灾情 5:解除警报 6:中断警报")
|
||||||
private Integer alarmKind;
|
private Integer alarmKind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.zjyr.beidouservice.service;
|
||||||
|
|
||||||
|
|
||||||
import com.zjyr.beidouservice.pojo.dataobject.AlarmDeviceTaskDO;
|
import com.zjyr.beidouservice.pojo.dataobject.AlarmDeviceTaskDO;
|
||||||
|
import com.zjyr.beidouservice.pojo.dto.DeviceByIdRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceSearchDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceSearchDTO;
|
||||||
|
@ -21,7 +22,7 @@ public interface DeviceService {
|
||||||
*
|
*
|
||||||
* @return 设备
|
* @return 设备
|
||||||
*/
|
*/
|
||||||
DeviceRespDTO getDeviceByDeviceId(DeviceSearchDTO deviceSearchDTO);
|
DeviceByIdRespDTO getDeviceByDeviceId(DeviceSearchDTO deviceSearchDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备任务更新设备告警状态
|
* 根据设备任务更新设备告警状态
|
||||||
|
|
|
@ -99,7 +99,9 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
.approvalStatus(ApprovalStatusEnum.APPROVAL_SUCCESS.getCode()).build();
|
.approvalStatus(ApprovalStatusEnum.APPROVAL_SUCCESS.getCode()).build();
|
||||||
|
|
||||||
//入库
|
//入库
|
||||||
Long generatedId = alarmTaskMapper.addAlarmTask(alarmTaskDO);
|
alarmTaskMapper.addAlarmTask(alarmTaskDO);
|
||||||
|
Long generatedId = alarmTaskDO.getId();
|
||||||
|
log.info("generatedId:[{}]", generatedId);
|
||||||
|
|
||||||
List<AlarmDeviceTaskDO> alarmDeviceTaskDOS = getAlarmDeviceTaskDOS(alarmTaskReqDTO, deviceInfo, generatedId);
|
List<AlarmDeviceTaskDO> alarmDeviceTaskDOS = getAlarmDeviceTaskDOS(alarmTaskReqDTO, deviceInfo, generatedId);
|
||||||
alarmDeviceTaskMapper.addAlarmDevTaskInfoList(alarmDeviceTaskDOS);
|
alarmDeviceTaskMapper.addAlarmDevTaskInfoList(alarmDeviceTaskDOS);
|
||||||
|
@ -173,10 +175,13 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
List<AlarmDeviceTaskDO> result = getAggregatedAlarmDeviceTaskDOS(taskIdStrList);
|
List<AlarmDeviceTaskDO> 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()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
PageInfoVO pageInfoVO = new PageInfoVO((long) result.size(), pageSize, pageNum);
|
PageInfoVO pageInfoVO = new PageInfoVO((long) result.size(), pageSize, pageNum);
|
||||||
// 分页
|
// 分页
|
||||||
result = result.stream().skip((long) pageSize * (pageNum -1)).limit(pageSize).collect(Collectors.toList());
|
result = result.stream().skip((long) pageSize * (pageNum - 1)).limit(pageSize).collect(Collectors.toList());
|
||||||
|
|
||||||
List<Integer> deviceIdList = result.stream().map(AlarmDeviceTaskDO::getDeviceId).distinct().toList();
|
List<Integer> deviceIdList = result.stream().map(AlarmDeviceTaskDO::getDeviceId).distinct().toList();
|
||||||
// 查询设备信息
|
// 查询设备信息
|
||||||
|
@ -246,6 +251,7 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
PageHelper.clearPage();
|
PageHelper.clearPage();
|
||||||
return pgInfo;
|
return pgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<AlarmDeviceTaskDO> getAlarmDeviceTaskDOS(AlarmTaskReqDTO alarmTaskReqDTO, DeviceInfoDTO deviceInfo, Long taskId) {
|
private static List<AlarmDeviceTaskDO> getAlarmDeviceTaskDOS(AlarmTaskReqDTO alarmTaskReqDTO, DeviceInfoDTO deviceInfo, Long taskId) {
|
||||||
List<AlarmDeviceTaskDO> alarmDeviceTaskDOS = new ArrayList<>();
|
List<AlarmDeviceTaskDO> alarmDeviceTaskDOS = new ArrayList<>();
|
||||||
List<Integer> deviceIds = deviceInfo.getDeviceIds();
|
List<Integer> deviceIds = deviceInfo.getDeviceIds();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.zjyr.beidouservice.constenum.DeviceAlarmStatusEnum;
|
||||||
import com.zjyr.beidouservice.mapper.DeviceMapper;
|
import com.zjyr.beidouservice.mapper.DeviceMapper;
|
||||||
import com.zjyr.beidouservice.pojo.dataobject.AlarmDeviceTaskDO;
|
import com.zjyr.beidouservice.pojo.dataobject.AlarmDeviceTaskDO;
|
||||||
import com.zjyr.beidouservice.pojo.dataobject.DeviceDO;
|
import com.zjyr.beidouservice.pojo.dataobject.DeviceDO;
|
||||||
|
import com.zjyr.beidouservice.pojo.dto.DeviceByIdRespDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceByLocationDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceByLocationDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
import com.zjyr.beidouservice.pojo.dto.DeviceRespDTO;
|
||||||
|
@ -55,7 +56,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceRespDTO getDeviceByDeviceId(DeviceSearchDTO deviceSearchDTO) {
|
public DeviceByIdRespDTO getDeviceByDeviceId(DeviceSearchDTO deviceSearchDTO) {
|
||||||
log.info("get device info by deviceId: [{}]", deviceSearchDTO.getDeviceId());
|
log.info("get device info by deviceId: [{}]", deviceSearchDTO.getDeviceId());
|
||||||
|
|
||||||
List<DeviceDO> deviceDOList = deviceMapper.selectDeviceByDeviceIds(Collections.singletonList(deviceSearchDTO.getDeviceId()));
|
List<DeviceDO> deviceDOList = deviceMapper.selectDeviceByDeviceIds(Collections.singletonList(deviceSearchDTO.getDeviceId()));
|
||||||
|
@ -64,7 +65,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeviceRespDTO.fromDO(deviceDOList.get(0));
|
return DeviceByIdRespDTO.fromDO(deviceDOList.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue