‘liusuyi’
2023-06-25 1aad56563c6861e13f3a837eb7ef410723cc2358
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
@@ -70,6 +70,7 @@
    private IHikClientService hikClientService;
    @Resource
    private RedisCache redisCache;
    /**
     * @描述 按条件查询报警
     * @参数 [condition]
@@ -133,6 +134,7 @@
                return null;
        }
    }
    /**
     * @描述 按条件更新查看时间
     * @参数 [condition]
@@ -165,6 +167,7 @@
                return null;
        }
    }
    /**
     * @描述 异步处理接收的报警
     * @参数 [topic, message]
@@ -302,20 +305,18 @@
                double distance = GisTool.getDistance(cmd.getTargetPosition(), camPosition);
                if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) {
                    distanceMap.put(camera.getId(), distance);
                    if(StringUtils.isNull(camera.getCamAlarmGuideEnable()))
                    {
                    if (StringUtils.isNull(camera.getCamAlarmGuideEnable())) {
                        camera.setCamAlarmGuideEnable(0);
                    }
                    guideMap.put(camera.getId(),camera.getCamAlarmGuideEnable());
                    guideMap.put(camera.getId(), camera.getCamAlarmGuideEnable());
                }
            }
            if (distanceMap.size() > 0) {
                log.debug("尝试查找最近光电");
                //获取距离字典中最近的一个相机ID
                String minDistanceCameraId = ArdTool.getKeyByMinValue(distanceMap);
                log.debug("查找到最近光电:"+minDistanceCameraId+",尝试引导");
                if(guideMap.get(minDistanceCameraId).equals(0))
                {
                log.debug("查找到最近光电:" + minDistanceCameraId + ",尝试引导");
                if (guideMap.get(minDistanceCameraId).equals(0)) {
                    log.debug("该光电未开启报警引导");
                    return "";
                }
@@ -357,13 +358,69 @@
     * @修改人和其它信息
     */
    @Override
    public Map<String, Integer> selectAlarmLogsCount() {
    public Map<String, Object> selectAlarmLogsCount() {
        Map<String,Object> map=new HashMap<>();
        Map<String, Integer> countMap = new HashMap<>();
        String refreshTime = configService.selectConfigByKey("refreshTime");
        int count1001 = ardAlarmStealelecMapper.selectCountByStartTime(refreshTime);
        countMap.put("1001", count1001);
        int count1014 = ardAlarmTubeMapper.selectCountByStartTime(refreshTime);
        countMap.put("1014 ", count1014);
        return countMap;
        int count1002 = ardAlarmCameraMapper.selectCountByAlarmTime(refreshTime);
        countMap.put("1002", count1002);
        int count1014 = ardAlarmTubeMapper.selectCountByAlarmTime(refreshTime);
        countMap.put("1014", count1014);
        map.put("20000",countMap);
        return map;
    }
    @Override
    public Object selectAlarmList(Integer command, String beginTime, String endTime,Integer pageNum,Integer pageSize) {
        Map<String, Object> params = new HashMap<>();
        params.put("beginTime", beginTime);
        params.put("endTime", endTime);
        switch (command) {
            case 1001:
                ArdAlarmStealelec aas = new ArdAlarmStealelec();
                aas.setParams(params);
                aas.setPageNum(pageNum);
                aas.setPageSize(pageSize);
                List<ArdAlarmStealelec> ardAlarmStealelecs = ardAlarmStealelecMapper.selectArdAlarmStealelecList(aas);
                return ardAlarmStealelecs;
            case 1002:
                ArdAlarmCamera aac = new ArdAlarmCamera();
                aac.setParams(params);
                aac.setPageNum(pageNum);
                aac.setPageSize(pageSize);
                List<ArdAlarmCamera> ardAlarmCameras = ardAlarmCameraMapper.selectArdAlarmCameraList(aac);
                return ardAlarmCameras;
            case 1014:
                ArdAlarmTube aat = new ArdAlarmTube();
                aat.setParams(params);
                aat.setPageNum(pageNum);
                aat.setPageSize(pageSize);
                List<ArdAlarmTube> ardAlarmTubes = ardAlarmTubeMapper.selectArdAlarmTubeList(aat);
                return ardAlarmTubes;
        }
        return null;
    }
    public static void main(String[] args) {
        // 给定坐标 A
        double Ax = 0;
        double Ay = 0;
        // 给定角度(以度为单位)
        double angle = 45;
        // 给定距离
        double distance = 1.414;
        // 将角度转换为弧度
        double radians = Math.toRadians(angle);
        // 计算 B 坐标
        double Bx = Ax + distance * Math.cos(radians);
        double By = Ay + distance * Math.sin(radians);
        // 输出结果
        System.out.println("坐标 B: (" + Bx + ", " + By + ")");
    }
}