From 079041267873a043486db99671326e5323934c57 Mon Sep 17 00:00:00 2001
From: liusuyi <13324259@qq.com>
Date: 星期日, 16 七月 2023 16:16:38 +0800
Subject: [PATCH] 增加融云业务上传用户头像接口

---
 ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java |   90 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
index 9ac6470..0cb90b3 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
@@ -1,6 +1,8 @@
 package com.ruoyi.alarm.globalAlarm.service.impl;
 
 import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.alarm.accessAlarm.domain.ArdAlarmAccess;
+import com.ruoyi.alarm.accessAlarm.mapper.ArdAlarmAccessMapper;
 import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
 import com.ruoyi.alarm.cameraAlarm.mapper.ArdAlarmCameraMapper;
 import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
@@ -28,6 +30,8 @@
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.constant.CamPriority;
+import com.ruoyi.device.external.domain.ArdEquipExternal;
+import com.ruoyi.device.external.mapper.ArdEquipExternalMapper;
 import com.ruoyi.utils.tools.ArdTool;
 import com.ruoyi.utils.tools.GisTool;
 import com.ruoyi.common.utils.uuid.IdUtils;
@@ -59,6 +63,10 @@
 @Slf4j(topic = "mqtt")
 public class GlobalAlarmServiceImpl implements IGlobalAlarmService {
     //region 渚濊禆娉ㄥ叆
+    @Resource
+    private ArdEquipExternalMapper ardEquipExternalMapper;
+    @Resource
+    private ArdAlarmAccessMapper ardAlarmAccessMapper;
     @Resource
     private ArdAlarmExternalMapper ardAlarmExternalMapper;
     @Resource
@@ -110,6 +118,8 @@
         countMap.put("1007", count1007);
         int count1005 = ardAlarmExternalMapper.selectCountByAlarmTime(refreshTime, "闃插尯鎶ヨ");
         countMap.put("1005", count1005);
+        int count1006 = ardAlarmAccessMapper.selectCountByAlarmTime(refreshTime);
+        countMap.put("1006", count1006);
         int count1014 = ardAlarmTubeMapper.selectCountByAlarmTime(refreshTime);
         countMap.put("1014", count1014);
         map.put("20000", countMap);
@@ -197,6 +207,20 @@
                                     .setLatitude(ardAlarmExternal.getLatitude())
                                     .setCount(ardAlarmExternal.getCount())
                                     .setTotal(ardAlarmExternal.getTotal());
+                            return globalAlarmData;
+                        }).collect(Collectors.toList());
+            case 1006:
+                List<ArdAlarmAccess> ardAlarmAccesses = ardAlarmAccessMapper.selectListAllByCommand(refreshTime);
+                return ardAlarmAccesses.stream()
+                        .map(ardAlarmAccess -> {
+                            GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+                                    .setId(ardAlarmAccess.getId())
+                                    .setName(ardAlarmAccess.getAcsName())
+                                    .setAlarmTime(ardAlarmAccess.getAlarmTime())
+                                    .setLongitude(ardAlarmAccess.getLongitude())
+                                    .setLatitude(ardAlarmAccess.getLatitude())
+                                    .setCount(ardAlarmAccess.getCount())
+                                    .setTotal(ardAlarmAccess.getTotal());
                             return globalAlarmData;
                         }).collect(Collectors.toList());
             case 1007:
@@ -287,6 +311,13 @@
                 aae.setPageSize(pageSize);
                 aae.setAlarmType("闃插尯鎶ヨ");
                 return ardAlarmExternalMapper.selectArdAlarmExternalList(aae);
+            case 1006:
+                ArdAlarmAccess aaa = new ArdAlarmAccess();
+                aaa.setParams(params);
+                aaa.setPageNum(pageNum);
+                aaa.setPageSize(pageSize);
+                aaa.setAlarmType("闃插尯鎶ヨ");
+                return ardAlarmAccessMapper.selectArdAlarmAccessList(aaa);
             case 1014:
                 ArdAlarmTube aat = new ArdAlarmTube();
                 aat.setParams(params);
@@ -317,6 +348,14 @@
                     ardAlarmStealelecMapper.updateViewTimeByDescribe(describe, startTime, DateUtils.getTime());
                     return ardAlarmStealelec;
                 }
+            case 1002:
+                ArdAlarmCamera ardAlarmCamera = ardAlarmCameraMapper.selectArdAlarmCameraById(condition.getId());
+                if (StringUtils.isNotNull(ardAlarmCamera)) {
+                    String cameraName = ardAlarmCamera.getCameraName();
+                    String alarmTime = fmt.format(ardAlarmCamera.getAlarmTime());
+                    ardAlarmCameraMapper.updateViewTimeByCameraName(cameraName, alarmTime, DateUtils.getTime());
+                    return ardAlarmCamera;
+                }
             case 1003:
             case 1004:
             case 1007:
@@ -334,8 +373,16 @@
                     String defenseName = ardAlarmExternal.getDefenseName();
                     String alarmType = ardAlarmExternal.getAlarmType();
                     String alarmTime = fmt.format(ardAlarmExternal.getAlarmTime());
-                    ardAlarmRadarMapper.updateViewTimeByCondition(defenseName, alarmType, alarmTime, DateUtils.getTime());
+                    ardAlarmExternalMapper.updateViewTimeByCondition(defenseName, alarmType, alarmTime, DateUtils.getTime());
                     return ardAlarmExternal;
+                }
+            case 1006:
+                ArdAlarmAccess ardAlarmAccess = ardAlarmAccessMapper.selectArdAlarmAccessById(condition.getId());
+                if (StringUtils.isNotNull(ardAlarmAccess)) {
+                    String acsId = ardAlarmAccess.getAcsId();
+                    String alarmTime = fmt.format(ardAlarmAccess.getAlarmTime());
+                    ardAlarmAccessMapper.updateViewTimeByAcsId(acsId, alarmTime, DateUtils.getTime());
+                    return ardAlarmAccess;
                 }
             case 1014:
                 ArdAlarmTube ardAlarmTube = ardAlarmTubeMapper.selectArdAlarmTubeById(condition.getId());
@@ -536,12 +583,40 @@
                             return;
                         }
                         double[] guideCoordinate = new double[]{ardAlarmExternal.getLongitude(), ardAlarmExternal.getLatitude()};//寮曞鍧愭爣
-                        if (StringUtils.isNull(ardAlarmExternal.getLongitude()) || StringUtils.isNull(ardAlarmExternal.getLatitude())) {
-                            return;
-                        }
-                        String nearbyCameraId = getNearbyCamera(new double[]{ardAlarmExternal.getLongitude(), ardAlarmExternal.getLatitude()});//鏈�杩戠浉鏈篒D
+                        String nearbyCameraId = getNearbyCamera(guideCoordinate);//鏈�杩戠浉鏈篒D
                         if (StringUtils.isNotEmpty(nearbyCameraId)) {
                             messagesEnqueued(nearbyCameraId, ardAlarmExternal.getId(), "sys_external", ardAlarmExternal.getCreateTime(), 1, 1, guideCoordinate);
+                        }
+                        //endregion
+                    }
+                    //endregion
+                    break;
+                case "accessControl":
+                    //region 澶勭悊闂ㄧ鎶ヨ
+                    ArdAlarmAccess ardAlarmAccess = JSONObject.parseObject(message, ArdAlarmAccess.class);
+                    ardAlarmAccess.setId(IdUtils.simpleUUID());
+                    ardAlarmAccess.setCreateTime(new Date());//鎺ユ敹鏃堕棿
+                    //鏌ョ鐞嗙殑闂ㄧ涓绘満淇℃伅
+                    String acsId = ardAlarmAccess.getAcsId();
+                    ArdEquipExternal ardEquipExternal = ardEquipExternalMapper.selectArdEquipExternalById(acsId);
+                    if (StringUtils.isNotNull(ardEquipExternal)) {
+                        ardAlarmAccess.setLongitude(ardEquipExternal.getLongitude());
+                        ardAlarmAccess.setLatitude(ardEquipExternal.getLatitude());
+                        ardAlarmAccess.setAltitude(ardEquipExternal.getAltitude());
+                        ardAlarmAccess.setAcsId(ardEquipExternal.getId());
+                        ardAlarmAccess.setAcsName(ardEquipExternal.getName());
+                    }
+                    int aaa = ardAlarmAccessMapper.insertArdAlarmAccess(ardAlarmAccess);
+                    if (aaa > 0) {
+                        log.debug("external鍏ュ簱鎴愬姛锛�" + ardAlarmAccess);
+                        //region 寮曞褰曞儚
+                        if (StringUtils.isNull(ardAlarmAccess.getLongitude()) || StringUtils.isNull(ardAlarmAccess.getLatitude())) {
+                            return;
+                        }
+                        double[] guideCoordinate = new double[]{ardAlarmAccess.getLongitude(), ardAlarmAccess.getLatitude()};//寮曞鍧愭爣
+                        String nearbyCameraId = getNearbyCamera(guideCoordinate);//鏈�杩戠浉鏈篒D
+                        if (StringUtils.isNotEmpty(nearbyCameraId)) {
+                            messagesEnqueued(nearbyCameraId, ardAlarmAccess.getId(), "sys_access_control", ardAlarmAccess.getCreateTime(), 1, 1, guideCoordinate);
                         }
                         //endregion
                     }
@@ -650,7 +725,6 @@
         return minDistanceCameraId;
     }
 
-
     public static void main(String[] args) {
         Comparator<Obj> PriorityDescCom = Comparator.comparingInt(Obj::getPriority).reversed();
         Comparator<Obj> NumDescCom = Comparator.comparingInt(Obj::getNum).reversed();
@@ -671,8 +745,8 @@
         log.info("===================================================================");
         priorityQueue.add(new Obj(999, 5, "2023-07-01 16:00:01"));
         PriorityBlockingQueue queue = new PriorityBlockingQueue<>(priorityQueue);
-        while (priorityQueue.size() > 0) {
-            Obj task = priorityQueue.poll();
+        while (queue.size() > 0) {
+            Obj task = (Obj) queue.poll();
             log.info("姝e湪鎺掗槦銆恜riority銆�" + task.getPriority() + "銆恘um銆�" + task.getNum() + "銆恆larmTime銆�" + task.getAlarmTime());
         }
     }

--
Gitblit v1.9.3