Jelajahi Sumber

报警推送添加 推送图片

sunhh 1 tahun lalu
induk
melakukan
e851cf1688

+ 8 - 1
business-service/src/main/java/com/ozs/entity/vo/MsgAlarmResp.java

@@ -99,9 +99,16 @@ public class MsgAlarmResp implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date alarmTime;
 
-    /** 报警图片地址 */
+    /**
+     * 报警图片地址
+     */
     private List<String> imageUrls;
 
+    /**
+     * 1图片;2声音;3视频;4.录制视频的地址
+     */
+    private Integer alarmAttType;
+
     /**
      * 所属工务段编码(单位名称)
      */

+ 17 - 2
vehicle-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketCommon.java

@@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.utils.AppendUtils;
 import com.ozs.common.utils.StringUtils;
+import com.ozs.entity.BaseCameraManagement;
 import com.ozs.entity.MsgAlarm;
+import com.ozs.entity.MsgAlarmExt;
 import com.ozs.entity.MsgWebPush;
 import com.ozs.entity.vo.MsgAlarmResp;
 import com.ozs.service.BaseRailwayManagementService;
 import com.ozs.service.BaseUserService;
+import com.ozs.service.MsgAlarmExtService;
 import com.ozs.service.MsgWebPushService;
 import com.ozs.system.service.ISysDictDataService;
 import com.ozs.system.service.ISysUserService;
@@ -42,6 +45,8 @@ public class WebSocketCommon {
     private BaseUserService baseUserService;
     @Autowired
     private ISysDictDataService dictDataService;
+    @Autowired
+    private MsgAlarmExtService msgAlarmExtService;
 
     public Map publish(@RequestBody MsgAlarm msgAlarm) {
         String endMile = null;
@@ -73,8 +78,18 @@ public class WebSocketCommon {
         msgAlarmResp.setLineDirStr(msgAlarm.getLineDir() == 1 ? "上行" : "下行");
         msgAlarmResp.setAlarmTime(msgAlarm.getAlarmTime() != null ? msgAlarm.getAlarmTime() : new Date());
         // 图片
-        if (!StringUtils.isEmptySunhh(msgAlarm.getImageUrls())) {
-            msgAlarmResp.setImageUrls(msgAlarm.getImageUrls());
+        LambdaQueryWrapper<MsgAlarmExt> wrapper = new LambdaQueryWrapper<>();
+        if (!ObjectUtils.isEmpty(msgAlarm.getAlarmId())) {
+            wrapper.eq(MsgAlarmExt::getAlarmId, msgAlarm.getAlarmId());
+        }
+        MsgAlarmExt msgAlarmExt = msgAlarmExtService.getOne(wrapper);
+        if (!StringUtils.isEmptySunhh(msgAlarmExt) && !StringUtils.isEmptySunhh(msgAlarmExt.getAlarmAttType())
+                && !StringUtils.isEmptySunhh(msgAlarmExt.getAlarmAttPath())) {
+            String[] split = msgAlarmExt.getAlarmAttPath().split(";");
+            ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
+            log.info("publish--------" + objects);
+            msgAlarmResp.setImageUrls(objects);
+            msgAlarmResp.setAlarmAttType(msgAlarmExt.getAlarmAttType());
         }
         if (!StringUtils.isEmptySunhh(msgAlarm.getId())) {
             msgAlarmResp.setId(msgAlarm.getId());