|
|
@@ -73,6 +73,9 @@ public class MqttService {
|
|
|
private SasDeviceService deviceService;
|
|
|
@Autowired
|
|
|
private SasGisMapper gisMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SasPicMapper sasPicMapper;
|
|
|
|
|
|
// Event Code Mappers
|
|
|
@Autowired
|
|
|
@@ -279,6 +282,24 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getEventPic() != null) {
|
|
|
+ UsbEventMessage.PicInfo picInfo = message.getEventPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
usbEventService.save(event);
|
|
|
|
|
|
// WebSocket 推送
|
|
|
@@ -286,6 +307,14 @@ public class MqttService {
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasUsbEventCode code = usbEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -327,12 +356,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getSnapPic() != null) {
|
|
|
+ SnapEventMessage.PicInfo picInfo = message.getSnapPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setEventPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
snapEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 如果前面已经设置了eventUrl,这里需要保持
|
|
|
+ if (info.getEventUrl() == null && event.getEventPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getEventPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasSnapTypeCode code = snapTypeCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -374,12 +429,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getEntrancePic() != null) {
|
|
|
+ EntranceEventMessage.PicInfo picInfo = message.getEntrancePic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
entranceEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasEntranceEventCode code = entranceEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -420,12 +501,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getPlatePic() != null) {
|
|
|
+ ParkingEventMessage.PicInfo picInfo = message.getPlatePic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置车牌图片ID
|
|
|
+ event.setPlatePicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
parkingEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPlatePicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPlatePicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasParkingEventCode code = parkingEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -466,12 +573,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getRoadblockPic() != null) {
|
|
|
+ RoadblockEventMessage.PicInfo picInfo = message.getRoadblockPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
roadblockEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasRoadblockEventCode code = roadblockEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -512,12 +645,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getAlarmPic() != null) {
|
|
|
+ AlarsasEventMessage.PicInfo picInfo = message.getAlarmPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
alarsasEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasAlarsasEventCode code = alarsasEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -558,12 +717,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getPatrolPic() != null) {
|
|
|
+ PatrolEventMessage.PicInfo picInfo = message.getPatrolPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
patrolEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasPatrolEventCode code = patrolEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -604,12 +789,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getAcquisitionPic() != null) {
|
|
|
+ AcquisitionEventMessage.PicInfo picInfo = message.getAcquisitionPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
acquisitionEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasAcquisitionEventCode code = acquisitionEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -650,12 +861,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getPerceptionPic() != null) {
|
|
|
+ PerceptionEventMessage.PicInfo picInfo = message.getPerceptionPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
perceptionEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasPerceptionEventCode code = perceptionEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|
|
|
@@ -696,12 +933,38 @@ public class MqttService {
|
|
|
event.setTriggerTime(parseTime(message.getTriggerTime()));
|
|
|
event.setCreateTime(LocalDateTime.now());
|
|
|
event.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 处理图片信息
|
|
|
+ if (message.getCollectionPic() != null) {
|
|
|
+ CollectionEventMessage.PicInfo picInfo = message.getCollectionPic();
|
|
|
+ if (picInfo != null && StrUtil.isNotBlank(picInfo.getUrl()) && StrUtil.isNotBlank(picInfo.getPath())) {
|
|
|
+ SasPic pic = new SasPic();
|
|
|
+ pic.setId(IdUtil.randomUUID());
|
|
|
+ pic.setUrl(picInfo.getUrl());
|
|
|
+ pic.setPath(picInfo.getPath());
|
|
|
+ pic.setCreateTime(LocalDateTime.now());
|
|
|
+ pic.setUpdateTime(LocalDateTime.now());
|
|
|
+ sasPicMapper.insert(pic);
|
|
|
+
|
|
|
+ // 设置事件图片ID
|
|
|
+ event.setPicId(pic.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
collectionEventService.save(event);
|
|
|
|
|
|
BrieflyEventInfo info = BeanUtil.toBean(event, BrieflyEventInfo.class);
|
|
|
info.setTriggerTime(message.getTriggerTime());
|
|
|
info.setCreateTime(LocalDateTime.now().format(formatter));
|
|
|
|
|
|
+ // 设置图片URL(如果有)
|
|
|
+ if (event.getPicId() != null) {
|
|
|
+ SasPic pic = sasPicMapper.selectById(event.getPicId());
|
|
|
+ if (pic != null && StrUtil.isNotBlank(pic.getUrl()) && StrUtil.isNotBlank(pic.getPath())) {
|
|
|
+ info.setEventUrl(pic.getUrl() + pic.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SasCollectionEventCode code = collectionEventCodeMapper.selectById(event.getEventCode());
|
|
|
if (code != null) {
|
|
|
info.setEventTypeName(code.getName());
|