| | |
| | | package com.ruoyi.framework.aspectj; |
| | | |
| | | import com.ruoyi.common.annotation.SdkOperate; |
| | | 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.utils.SecurityUtils; |
| | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | 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.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * SDK控制处理 |
| | |
| | | |
| | | @Around("dsPointCut()") |
| | | public Object around(ProceedingJoinPoint point) throws Throwable { |
| | | |
| | | Boolean resultMap = dataScopeFilter(point); |
| | | if (resultMap) { |
| | | return point.proceed(); |
| | |
| | | * @param joinPoint 切点 |
| | | */ |
| | | public Boolean dataScopeFilter(ProceedingJoinPoint joinPoint) { |
| | | |
| | | //获取请求控制相机的信息 |
| | | CameraCmd cmd = (CameraCmd) joinPoint.getArgs()[0]; |
| | | ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cmd.getCameraId()); |
| | | if (StringUtils.isNull(ardCameras)) { |
| | | return false; |
| | | } |
| | | //优先级比对 |
| | | Date operatorExpired = ardCameras.getOperatorExpired(); |
| | | Date now = new Date(); |
| | | if (now.before(operatorExpired)) { |
| | | //未过期 |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (StringUtils.isNull(loginUser)) { |
| | | return false;//当前登录用户为空不可以控制 |