全业务考评 пре 1 година
родитељ
комит
3a31bcab7a

+ 18 - 11
ims-service/ims-eval/src/main/java/com/ims/eval/config/permission/PermissionAspect.java

@@ -133,17 +133,22 @@ public class PermissionAspect implements Interceptor {
 
 
 		//人员和部门数据为空
-		if ( user == null || dept == null ||null == post) {
-			try {
-				return invocation.proceed();
-			} catch (Exception e) {
-				log.error("数据权限隔离异常:", e);
-			}
+		if ( user == null || (dept == null && null == post)) {
+//			try {
+//				return invocation.proceed();
+//			} catch (Exception e) {
+//				log.error("数据权限隔离异常:", e);
+//			}
 			return invocation.proceed();
+//			throw new CustomException("暂无权限");
 		}
 
 		if (scope.equals(DATA_SCOPE_DEPT)) {
-			String deptId = dept.getDataKey();
+			String deptId = "";
+			if(null != dept){
+				 deptId = dept.getDataKey();
+			}
+
 			try {
 				//反射扫包会比较慢,这里做了个懒加载
 				if (classNames == null) {
@@ -194,9 +199,9 @@ public class PermissionAspect implements Interceptor {
 					// 解析并返回新的SQL语句,只处理查询sql
 					if (mappedStatement.getSqlCommandType().toString().equals("SELECT")) {
 						sql = getSql(sql, deptId);
+						// 修改sql
+						metaObject.setValue("delegate.boundSql.sql", sql);
 					}
-					// 修改sql
-					metaObject.setValue("delegate.boundSql.sql", sql);
 				}
 			} catch (Exception e) {
 				log.error("数据权限隔离异常:", e);
@@ -284,7 +289,7 @@ public class PermissionAspect implements Interceptor {
 	public DataDictionary getSysDept(MyuserResDTO user){
 		if (user != null && CacheContext.ddSuperKeyMap.containsKey(DEPT_MARK)){
 			Optional<DataDictionary> any = CacheContext.ddSuperKeyMap.get(DEPT_MARK).stream().filter(t -> t.getKeyName().equals(user.getDeptName())).findAny();
-			return any.isPresent() ?  any.get() : null;
+			return any.isPresent() ?  any.get() : CacheContext.ddMap.get("LSBM");//如果没有匹配上部门,赋予零时部门权限
 		}
 		return null;
 	}
@@ -298,7 +303,9 @@ public class PermissionAspect implements Interceptor {
 				DataDictionary maxScopeData =  list.stream().min(Comparator.comparing(DataDictionary::getScope))
 				.orElse(null);
 			return maxScopeData;
+		}else {
+			//没有查到对应的岗位,赋值一般用户岗位
+			return CacheContext.ddMap.get("61138");
 		}
-		return null;
 	}
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DeptAssessmentDeclarationController.java

@@ -279,7 +279,7 @@ public class DeptAssessmentDeclarationController {
 					DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
 					deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
 					deptAssessmentDeclarationContent.setEmployeeNo(str[0]);
-					JSONObject jsonArr = userService.pageList(1, 1000, "", "", "", "", "", "", request);
+					JSONObject jsonArr = userService.pageList(1, 1000, "", "", "", str[0], "", "", request);
 					JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
 					JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
 					List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);