Forráskód Böngészése

新增授权是否允许研究生客观题卡

yin 9 hónapja
szülő
commit
b66e260517

+ 24 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/config/service/impl/SystemCache.java

@@ -51,6 +51,8 @@ public class SystemCache {
 
     private TrialMode trialMode;
 
+    private boolean yjsObjectiveEnable;
+
     @Value("${qmth.solar.host}")
     private String host;
 
@@ -68,6 +70,7 @@ public class SystemCache {
                 Auth = true;
                 doubleTrack = true;
                 groupDeleteWarn = false;
+                yjsObjectiveEnable = false;
                 trialMode = TrialMode.SHARE;
             }
         } else if (s != null && SystemAuthType.OFFLINE.equals(s.getType())) {
@@ -77,6 +80,7 @@ public class SystemCache {
             Auth = false;
             doubleTrack = false;
             groupDeleteWarn = false;
+            yjsObjectiveEnable = false;
             trialMode = TrialMode.SHARE;
         }
         fileServer = configService.findByType(ConfigType.FILE_SERVER);
@@ -149,6 +153,14 @@ public class SystemCache {
         this.trialMode = trialMode;
     }
 
+    public boolean isYjsObjectiveEnable() {
+        return yjsObjectiveEnable;
+    }
+
+    public void setYjsObjectiveEnable(boolean yjsObjectiveEnable) {
+        this.yjsObjectiveEnable = yjsObjectiveEnable;
+    }
+
     public void parseJson(JSONObject json) {
         if (json != null) {
             Auth = true;
@@ -194,10 +206,22 @@ public class SystemCache {
                     e.printStackTrace();
                 }
             }
+
+            this.yjsObjectiveEnable = false;
+            if (json.has("control") && json.getJSONObject("control").has("custom")
+                    && json.getJSONObject("control").getJSONObject("custom").has("yjs_objective_enable")) {
+                try {
+                    this.yjsObjectiveEnable = json.getJSONObject("control").getJSONObject("custom")
+                            .getBoolean("yjs_objective_enable");
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
         } else {
             Auth = false;
             doubleTrack = false;
             groupDeleteWarn = false;
+            yjsObjectiveEnable = false;
             expireTime = null;
             trialMode = TrialMode.SHARE;
         }

+ 1 - 0
stmms-web/src/main/java/cn/com/qmth/stmms/api/controller/LoginController.java

@@ -62,6 +62,7 @@ public class LoginController extends BaseApiController {
         obj.accumulate("fileServer", fileService.getFileServer());
         School school = schoolService.findById(user.getSchoolId());
         obj.accumulate("doubleTrack", systemCache.isDoubleTrack() && school.isDoubleTrack());
+        obj.accumulate("yjsObjectiveEnable", systemCache.isYjsObjectiveEnable());
         JSONArray array = new JSONArray();
         if (user.getUserData() != null && Role.SUBJECT_HEADER.equals(user.getRole())) {
             Set<String> set = subjectUserService.findSubjectCode(user.getUserData().getId());