版本迭代
This commit is contained in:
parent
fba665ec49
commit
3dc584ead8
|
@ -0,0 +1,111 @@
|
||||||
|
package com.bootdo.datasend.dianxin.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电动车预警(BaseElectricCarRecord)Domain
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-11-19 19:10:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName(value = "base_electric_car_record")
|
||||||
|
public class BaseElectricCarRecord {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标编码
|
||||||
|
*/
|
||||||
|
private String gbsChannelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NVR设备编号
|
||||||
|
*/
|
||||||
|
private String serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
private Integer channelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控大类
|
||||||
|
*/
|
||||||
|
private Integer parentMonitoringType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
private Integer deviceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备能力集
|
||||||
|
*/
|
||||||
|
private String structuredCameraType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
private String deviceAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备方位
|
||||||
|
*/
|
||||||
|
private Integer orientation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
private String deviceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多维设备SN
|
||||||
|
*/
|
||||||
|
private String geminiSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所编码
|
||||||
|
*/
|
||||||
|
private String placeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抓拍图路径
|
||||||
|
*/
|
||||||
|
private String highThrowImgurl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抓拍时间
|
||||||
|
*/
|
||||||
|
private Long passTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否发送
|
||||||
|
*/
|
||||||
|
private Integer isSend;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bootdo.datasend.dianxin.domain.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Auther: cyFeng
|
||||||
|
* @Date: 2024/11/18 14:23
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class ElectricCarDto {
|
||||||
|
|
||||||
|
@JSONField(name = "requestData")
|
||||||
|
private RequestDataDTO requestData;
|
||||||
|
|
||||||
|
}
|
|
@ -14,6 +14,6 @@ import lombok.NoArgsConstructor;
|
||||||
public class HighThrowDto {
|
public class HighThrowDto {
|
||||||
|
|
||||||
@JSONField(name = "requestData")
|
@JSONField(name = "requestData")
|
||||||
private HighThrowRequestDataDTO requestData;
|
private RequestDataDTO requestData;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ import java.util.List;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public class HighThrowRequestDataDTO {
|
public class RequestDataDTO {
|
||||||
@JSONField(name = "requestFlag")
|
@JSONField(name = "requestFlag")
|
||||||
private String requestFlag;
|
private String requestFlag;
|
||||||
@JSONField(name = "requestDataList")
|
@JSONField(name = "requestDataList")
|
||||||
private List<HighThrowRequestDataListDTO> requestDataList;
|
private List<RequestDataListDTO> requestDataList;
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public class HighThrowRequestDataListDTO {
|
public class RequestDataListDTO {
|
||||||
@JSONField(name = "gatewaySN")
|
@JSONField(name = "gatewaySN")
|
||||||
private String gatewaySN;
|
private String gatewaySN;
|
||||||
@JSONField(name = "warnType")
|
@JSONField(name = "warnType")
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bootdo.datasend.dianxin.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bootdo.datasend.dianxin.domain.BaseElectricCarRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电动车预警(BaseElectricCarRecord)Mapper
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-11-19 19:10:33
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BaseElectricCarRecordMapper extends BaseMapper<BaseElectricCarRecord> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.bootdo.datasend.dianxin.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bootdo.datasend.dianxin.domain.BaseElectricCarRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电动车预警(BaseElectricCarRecord)Service
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-11-19 19:10:33
|
||||||
|
*/
|
||||||
|
public interface BaseElectricCarRecordService extends IService<BaseElectricCarRecord> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bootdo.datasend.dianxin.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bootdo.datasend.dianxin.domain.BaseElectricCarRecord;
|
||||||
|
import com.bootdo.datasend.dianxin.mapper.BaseElectricCarRecordMapper;
|
||||||
|
import com.bootdo.datasend.dianxin.service.BaseElectricCarRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电动车预警(BaseElectricCarRecord)ServiceImpl
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-11-19 19:10:33
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BaseElectricCarRecordServiceImpl extends ServiceImpl<BaseElectricCarRecordMapper, BaseElectricCarRecord> implements BaseElectricCarRecordService {
|
||||||
|
|
||||||
|
}
|
|
@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.parser.Feature;
|
import com.alibaba.fastjson.parser.Feature;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.bootdo.datasend.dianxin.cache.DeviceCache;
|
import com.bootdo.datasend.dianxin.cache.DeviceCache;
|
||||||
|
import com.bootdo.datasend.dianxin.domain.BaseElectricCarRecord;
|
||||||
import com.bootdo.datasend.dianxin.domain.BaseHighThrowRecord;
|
import com.bootdo.datasend.dianxin.domain.BaseHighThrowRecord;
|
||||||
import com.bootdo.datasend.dianxin.domain.DevopsDeviceInfo;
|
import com.bootdo.datasend.dianxin.domain.DevopsDeviceInfo;
|
||||||
|
import com.bootdo.datasend.dianxin.domain.dto.ElectricCarDto;
|
||||||
import com.bootdo.datasend.dianxin.domain.dto.HighThrowDto;
|
import com.bootdo.datasend.dianxin.domain.dto.HighThrowDto;
|
||||||
import com.bootdo.datasend.dianxin.domain.dto.HighThrowRequestDataDTO;
|
import com.bootdo.datasend.dianxin.domain.dto.RequestDataDTO;
|
||||||
import com.bootdo.datasend.dianxin.domain.dto.HighThrowRequestDataListDTO;
|
import com.bootdo.datasend.dianxin.domain.dto.RequestDataListDTO;
|
||||||
|
import com.bootdo.datasend.dianxin.service.BaseElectricCarRecordService;
|
||||||
import com.bootdo.datasend.dianxin.service.BaseHighThrowRecordService;
|
import com.bootdo.datasend.dianxin.service.BaseHighThrowRecordService;
|
||||||
import com.bootdo.util.Base64Util;
|
import com.bootdo.util.Base64Util;
|
||||||
import com.bootdo.util.StringKit;
|
import com.bootdo.util.StringKit;
|
||||||
|
@ -29,16 +32,18 @@ public class StandardTask {
|
||||||
|
|
||||||
private final RabbitTemplate rabbitTemplate;
|
private final RabbitTemplate rabbitTemplate;
|
||||||
private final BaseHighThrowRecordService highThrowRecordService;
|
private final BaseHighThrowRecordService highThrowRecordService;
|
||||||
|
private final BaseElectricCarRecordService electricCarRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能描述: 设备发送
|
* 功能描述: 高抛发送
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0/5 * * * * ? ")
|
@Scheduled(cron = "0/5 * * * * ? ")
|
||||||
public void sendDevice() {
|
public void sendHighThrow() {
|
||||||
|
|
||||||
//获取高抛记录
|
//获取高抛记录
|
||||||
List<BaseHighThrowRecord> highThrowRecords = highThrowRecordService.list(new QueryWrapper<BaseHighThrowRecord>()
|
List<BaseHighThrowRecord> highThrowRecords = highThrowRecordService.list(new QueryWrapper<BaseHighThrowRecord>()
|
||||||
.eq("is_send", "0")
|
.eq("is_send", "0")
|
||||||
|
.last("limit 100")
|
||||||
);
|
);
|
||||||
|
|
||||||
for (BaseHighThrowRecord h : highThrowRecords) {
|
for (BaseHighThrowRecord h : highThrowRecords) {
|
||||||
|
@ -55,10 +60,10 @@ public class StandardTask {
|
||||||
|
|
||||||
HighThrowDto dto = new HighThrowDto();
|
HighThrowDto dto = new HighThrowDto();
|
||||||
|
|
||||||
HighThrowRequestDataDTO dataDTO = new HighThrowRequestDataDTO();
|
RequestDataDTO dataDTO = new RequestDataDTO();
|
||||||
dataDTO.setRequestFlag("1");
|
dataDTO.setRequestFlag("1");
|
||||||
|
|
||||||
HighThrowRequestDataListDTO requestDataListDTO = new HighThrowRequestDataListDTO();
|
RequestDataListDTO requestDataListDTO = new RequestDataListDTO();
|
||||||
if (deviceInfo != null) {
|
if (deviceInfo != null) {
|
||||||
requestDataListDTO.setGatewaySN(deviceInfo.getGeminiSn());
|
requestDataListDTO.setGatewaySN(deviceInfo.getGeminiSn());
|
||||||
}
|
}
|
||||||
|
@ -68,7 +73,7 @@ public class StandardTask {
|
||||||
requestDataListDTO.setEventName("高抛报警");
|
requestDataListDTO.setEventName("高抛报警");
|
||||||
requestDataListDTO.setWarnTime(StringKit.toString(h.getPassTime()));
|
requestDataListDTO.setWarnTime(StringKit.toString(h.getPassTime()));
|
||||||
requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getHighThrowImgurl()));
|
requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getHighThrowImgurl()));
|
||||||
List<HighThrowRequestDataListDTO> list = new ArrayList<>();
|
List<RequestDataListDTO> list = new ArrayList<>();
|
||||||
list.add(requestDataListDTO);
|
list.add(requestDataListDTO);
|
||||||
dataDTO.setRequestDataList(list);
|
dataDTO.setRequestDataList(list);
|
||||||
dto.setRequestData(dataDTO);
|
dto.setRequestData(dataDTO);
|
||||||
|
@ -83,6 +88,60 @@ public class StandardTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述: 发送电瓶车预警
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0/5 * * * * ? ")
|
||||||
|
public void sendElectricCar() {
|
||||||
|
|
||||||
|
//获取高抛记录
|
||||||
|
List<BaseElectricCarRecord> lists = electricCarRecordService.list(new QueryWrapper<BaseElectricCarRecord>()
|
||||||
|
.eq("is_send", "0")
|
||||||
|
.last("limit 100")
|
||||||
|
);
|
||||||
|
|
||||||
|
for (BaseElectricCarRecord h : lists) {
|
||||||
|
|
||||||
|
String deviceId = h.getDeviceIp();
|
||||||
|
String deviceCacheStr = DeviceCache.get(deviceId);
|
||||||
|
DevopsDeviceInfo deviceInfo = null;
|
||||||
|
if ("".equals(StringKit.toString(deviceCacheStr))) {
|
||||||
|
logger.info("当前设备缓存中不存在:" + deviceId);
|
||||||
|
} else {
|
||||||
|
logger.info("当前设备获取到缓存:" + deviceId);
|
||||||
|
deviceInfo = JSON.parseObject(deviceCacheStr, DevopsDeviceInfo.class, Feature.IgnoreNotMatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
ElectricCarDto dto = new ElectricCarDto();
|
||||||
|
|
||||||
|
RequestDataDTO dataDTO = new RequestDataDTO();
|
||||||
|
dataDTO.setRequestFlag("1");
|
||||||
|
|
||||||
|
RequestDataListDTO requestDataListDTO = new RequestDataListDTO();
|
||||||
|
if (deviceInfo != null) {
|
||||||
|
requestDataListDTO.setGatewaySN(deviceInfo.getGeminiSn());
|
||||||
|
}
|
||||||
|
requestDataListDTO.setWarnType("1002");
|
||||||
|
requestDataListDTO.setDeviceType("302");
|
||||||
|
requestDataListDTO.setDeviceSN(h.getGbsChannelNo());
|
||||||
|
requestDataListDTO.setEventName("电动车入侵");
|
||||||
|
requestDataListDTO.setWarnTime(StringKit.toString(h.getPassTime()));
|
||||||
|
requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getHighThrowImgurl()));
|
||||||
|
List<RequestDataListDTO> list = new ArrayList<>();
|
||||||
|
list.add(requestDataListDTO);
|
||||||
|
dataDTO.setRequestDataList(list);
|
||||||
|
dto.setRequestData(dataDTO);
|
||||||
|
|
||||||
|
//循环发送mq
|
||||||
|
boolean b = sendElectricCarMq(dto);
|
||||||
|
if (b) {
|
||||||
|
h.setIsSend(1);
|
||||||
|
electricCarRecordService.saveOrUpdate(h);
|
||||||
|
logger.info("电动车入侵记录发送成功:" + h.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean sendHighThrowMq(HighThrowDto bean) {
|
public boolean sendHighThrowMq(HighThrowDto bean) {
|
||||||
try {
|
try {
|
||||||
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
|
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
|
||||||
|
@ -92,5 +151,14 @@ public class StandardTask {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean sendElectricCarMq(ElectricCarDto bean) {
|
||||||
|
try {
|
||||||
|
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue