Administrator
2023-08-05 8bafb39c563225acb1068a3b83462c33f4b3bab7
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
@@ -1,5 +1,6 @@
package com.ruoyi.framework.aspectj;
import com.ruoyi.common.annotation.SdkOperate;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
@@ -9,14 +10,22 @@
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import javax.annotation.Nullable;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.Date;
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
/**
 * SDK控制处理
@@ -25,6 +34,7 @@
 */
@Aspect
@Component
@Slf4j(topic = "hikSdk")
public class SdkOperateAspect {
    @Resource
@@ -39,10 +49,14 @@
    @Around("dsPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        MethodSignature signature = (MethodSignature) point.getSignature();
        Method method = signature.getMethod();
        Boolean result = controlScopeFilter(point);
        if (result) {
            log.debug("已获取相机控制权--" + method.getName());
            return point.proceed();
        } else {
            log.debug("未获取相机控制权--" + method.getName());
            return false;//代替目标方法的返回值
        }
    }
@@ -131,6 +145,5 @@
                }
            }
        }
    }
}