|
@@ -1,78 +1,78 @@
|
|
|
-package com.qunzhixinxi.hnqz.admin.aspect;
|
|
|
-
|
|
|
-import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.DeptPermissionEnum;
|
|
|
-import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
|
-import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
-import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
-import org.aspectj.lang.annotation.Around;
|
|
|
-import org.aspectj.lang.annotation.Aspect;
|
|
|
-import org.aspectj.lang.annotation.Pointcut;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
-
|
|
|
-/**
|
|
|
- * 部门权限判断Aspect
|
|
|
- *
|
|
|
- * @author lixuesong
|
|
|
- * @date 2021年05月21日 17:08
|
|
|
- */
|
|
|
-@Slf4j
|
|
|
-@Aspect
|
|
|
-@Component
|
|
|
-@AllArgsConstructor
|
|
|
-@ControllerAdvice
|
|
|
-public class DeptPermissionAspect {
|
|
|
-
|
|
|
- private final SysDeptService sysDeptService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 定义切入点,切入点为com.qunzhixinxi.hnqz.admin.controller.ReportExportController下的所有方法
|
|
|
- * 以下匹配到的切入点分别对应的功能页面为:
|
|
|
- * 1.结算报告管理,结算报告审批的导出;
|
|
|
- * 2.个人承接任务-按积分值,个人承接任务-按任务量,个人承接任务-通用,个人报告管理-个人报告导出的导出;
|
|
|
- * 3.企业承接任务的导出
|
|
|
- * 4.特定任务-上传证据链的导出
|
|
|
- * 5.小程序端的导出
|
|
|
- */
|
|
|
- @Pointcut(value = "execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportNbReport(..)) " +
|
|
|
- "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbReport(..)) " +
|
|
|
- "|| execution(* com.qunzhixinxi.hnqz.admin.controller.WmTaskController.exportNba(..)) " +
|
|
|
- "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbInfoJs(..)) " +
|
|
|
- "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbInfoFormWeiNew(..))")
|
|
|
- public void controllerAspect() {
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 环绕通知:判断是否执行业务代码
|
|
|
- *
|
|
|
- * @param proceedingJoinPoint
|
|
|
- */
|
|
|
- @Around("controllerAspect()")
|
|
|
- public R doAroundControllerAspect(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
|
|
- // 获取当前登录用户所属部门
|
|
|
- Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
- // 判断用户所属部门是否有权限
|
|
|
- boolean hasPermission = false;
|
|
|
- SysDept sysDept = sysDeptService.getById(deptId);
|
|
|
- if (sysDept != null && sysDept.getDeptPermissions() != null) {
|
|
|
- String[] permissionArr = sysDept.getDeptPermissions();
|
|
|
- for (String permission : permissionArr) {
|
|
|
- // 判断部门是否有导出权限
|
|
|
- if (DeptPermissionEnum.DEPT_EXPORT.val().equals(permission.trim())) {
|
|
|
- hasPermission = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (hasPermission) {
|
|
|
- Object proceed = proceedingJoinPoint.proceed();
|
|
|
- return (R) proceed;
|
|
|
- }
|
|
|
- return R.failed("没有权限");
|
|
|
- }
|
|
|
-}
|
|
|
+// package com.qunzhixinxi.hnqz.admin.aspect;
|
|
|
+//
|
|
|
+// import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
+// import com.qunzhixinxi.hnqz.admin.api.constant.enums.DeptPermissionEnum;
|
|
|
+// import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
|
+// import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
+// import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
+// import lombok.AllArgsConstructor;
|
|
|
+// import lombok.extern.slf4j.Slf4j;
|
|
|
+// import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
+// import org.aspectj.lang.annotation.Around;
|
|
|
+// import org.aspectj.lang.annotation.Aspect;
|
|
|
+// import org.aspectj.lang.annotation.Pointcut;
|
|
|
+// import org.springframework.stereotype.Component;
|
|
|
+// import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 部门权限判断Aspect
|
|
|
+// *
|
|
|
+// * @author lixuesong
|
|
|
+// * @date 2021年05月21日 17:08
|
|
|
+// */
|
|
|
+// @Slf4j
|
|
|
+// @Aspect
|
|
|
+// @Component
|
|
|
+// @AllArgsConstructor
|
|
|
+// @ControllerAdvice
|
|
|
+// public class DeptPermissionAspect {
|
|
|
+//
|
|
|
+// private final SysDeptService sysDeptService;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 定义切入点,切入点为com.qunzhixinxi.hnqz.admin.controller.ReportExportController下的所有方法
|
|
|
+// * 以下匹配到的切入点分别对应的功能页面为:
|
|
|
+// * 1.结算报告管理,结算报告审批的导出;
|
|
|
+// * 2.个人承接任务-按积分值,个人承接任务-按任务量,个人承接任务-通用,个人报告管理-个人报告导出的导出;
|
|
|
+// * 3.企业承接任务的导出
|
|
|
+// * 4.特定任务-上传证据链的导出
|
|
|
+// * 5.小程序端的导出
|
|
|
+// */
|
|
|
+// @Pointcut(value = "execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportNbReport(..)) " +
|
|
|
+// "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbReport(..)) " +
|
|
|
+// "|| execution(* com.qunzhixinxi.hnqz.admin.controller.WmTaskController.exportNba(..)) " +
|
|
|
+// "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbInfoJs(..)) " +
|
|
|
+// "|| execution(* com.qunzhixinxi.hnqz.admin.controller.ReportExportController.exportZbInfoFormWeiNew(..))")
|
|
|
+// public void controllerAspect() {
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 环绕通知:判断是否执行业务代码
|
|
|
+// *
|
|
|
+// * @param proceedingJoinPoint
|
|
|
+// */
|
|
|
+// @Around("controllerAspect()")
|
|
|
+// public R doAroundControllerAspect(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
|
|
+// // 获取当前登录用户所属部门
|
|
|
+// Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
+// // 判断用户所属部门是否有权限
|
|
|
+// boolean hasPermission = false;
|
|
|
+// SysDept sysDept = sysDeptService.getById(deptId);
|
|
|
+// if (sysDept != null && sysDept.getDeptPermissions() != null) {
|
|
|
+// String[] permissionArr = sysDept.getDeptPermissions();
|
|
|
+// for (String permission : permissionArr) {
|
|
|
+// // 判断部门是否有导出权限
|
|
|
+// if (DeptPermissionEnum.DEPT_EXPORT.val().equals(permission.trim())) {
|
|
|
+// hasPermission = true;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (hasPermission) {
|
|
|
+// Object proceed = proceedingJoinPoint.proceed();
|
|
|
+// return (R) proceed;
|
|
|
+// }
|
|
|
+// return R.failed("没有权限");
|
|
|
+// }
|
|
|
+// }
|