Browse Source

更改教务处老师访问教研分析时的机构判断

caozixuan 2 năm trước cách đây
mục cha
commit
c1236056e2

+ 15 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/SsoController.java

@@ -113,9 +113,22 @@ public class SsoController {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("角色不能为空");
         }
         Long schoolId = SystemConstant.convertIdToLong(String.valueOf(ServletUtil.getRequestHeaderSchoolId()));
-        SysOrg sysOrg = sysOrgService.findCollegeLevelOrgByOrgId(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
+
+        SysOrg sysOrg = sysOrgService.getOne(new QueryWrapper<SysOrg>()
+                .lambda()
                 .eq(SysOrg::getSchoolId,schoolId)
-                .eq(SysOrg::getName,orgName)).getId());
+                .eq(SysOrg::getName,orgName));
+        if (Objects.isNull(sysOrg)){
+            throw ExceptionResultEnum.ERROR.exception("机构不存在");
+        }
+
+        // 不是教务处老师查询开课学院
+        if (!RoleTypeEnum.OFFICE_TEACHER.equals(role)){
+            sysOrg = sysOrgService.findCollegeLevelOrgByOrgId(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
+                    .eq(SysOrg::getSchoolId,schoolId)
+                    .eq(SysOrg::getName,orgName)).getId());
+        }
+
         if (Objects.isNull(orgName) || Objects.equals(orgName, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("学院名称不能为空");
         }