zhangnaisong
2024-07-24 675075c8e140ee0882c5277bd68468fe6194b207
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
@@ -1,5 +1,6 @@
package com.ruoyi.framework.aspectj;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
@@ -29,7 +30,7 @@
 */
@Aspect
@Component
@Slf4j(topic = "hikSdk")
@Slf4j(topic = "sdk")
public class SdkOperateAspect {
    @Resource
@@ -49,10 +50,11 @@
        Boolean result = controlScopeFilter(point);
        if (result) {
            log.debug("已获取相机控制权--" + method.getName());
            // 执行目标方法
            return point.proceed();
        } else {
            log.debug("未获取相机控制权--" + method.getName());
            return false;//代替目标方法的返回值
            return AjaxResult.error("未获取相机控制权--" + method.getName());//代替目标方法的返回值
        }
    }
@@ -100,7 +102,11 @@
                    } else {
                        /*当前控制者为普通用户*/
                        SysUser sysUser = sysUserService.selectUserById(currentOperator);
                        currentLevel = sysUser.getCameraPriority();
                        if(StringUtils.isNull(sysUser))
                        {
                            return true;
                        }
                        currentLevel = Integer.valueOf(sysUser.getCameraPriority());
                    }
                    Integer operatorLevel = 0;//获取申请者的优先级
                    String operatorPriority = DictUtils.getDictValue("cameras_priority", operator);
@@ -111,7 +117,7 @@
                        /*否则申请控制者为当前登录用户*/
                        LoginUser loginUser = SecurityUtils.getLoginUser();
                        SysUser user = loginUser.getUser();//获取登录用户的信息
                        operatorLevel = user.getCameraPriority();
                        operatorLevel = Integer.valueOf(user.getCameraPriority());
                    }
                    /*申请者未控则判断优先级*/
                    if (operatorLevel > currentLevel) {