|
|
|
|
|
|
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private JsonResult checkPermission(User user, List<Inspection> inspectionList) { |
|
|
private JsonResult checkPermission(User user, List<Inspection> inspectionList) { |
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
|
|
return JsonResult.success(user); |
|
|
|
|
|
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { |
|
|
|
|
|
for (Inspection inspection : inspectionList) { |
|
|
|
|
|
if (!user.getDeptId().equals(inspection.getDeptId())) { |
|
|
|
|
|
return JsonResult.error(GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getCode(), GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return JsonResult.success(user); |
|
|
|
|
|
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
|
|
return JsonResult.error(GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getCode(), GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
return JsonResult.error(); |
|
|
|
|
|
|
|
|
// if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
|
|
// return JsonResult.success(user); |
|
|
|
|
|
// } else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { |
|
|
|
|
|
// for (Inspection inspection : inspectionList) { |
|
|
|
|
|
// if (!user.getDeptId().equals(inspection.getDeptId())) { |
|
|
|
|
|
// return JsonResult.error(GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getCode(), GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getMsg()); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// return JsonResult.success(user); |
|
|
|
|
|
// } else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
|
|
// return JsonResult.error(GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getCode(), GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getMsg()); |
|
|
|
|
|
// } |
|
|
|
|
|
return JsonResult.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |