|
@@ -4,6 +4,7 @@ import java.util.List;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
|
+import cn.com.qmth.stmms.common.enums.TrialMode;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -48,6 +49,8 @@ public class SystemCache {
|
|
|
|
|
|
private boolean enableStudentSheetCount;
|
|
|
|
|
|
+ private TrialMode trialMode;
|
|
|
+
|
|
|
@Value("${qmth.solar.host}")
|
|
|
private String host;
|
|
|
|
|
@@ -65,6 +68,7 @@ public class SystemCache {
|
|
|
Auth = true;
|
|
|
doubleTrack = true;
|
|
|
groupDeleteWarn = false;
|
|
|
+ trialMode = TrialMode.SHARE;
|
|
|
}
|
|
|
} else if (s != null && SystemAuthType.OFFLINE.equals(s.getType())) {
|
|
|
JSONObject json = AppLicenseUtil.parseLicense(ByteArray.fromBase64(s.getDescription()).value());
|
|
@@ -73,11 +77,12 @@ public class SystemCache {
|
|
|
Auth = false;
|
|
|
doubleTrack = false;
|
|
|
groupDeleteWarn = false;
|
|
|
+ trialMode = TrialMode.SHARE;
|
|
|
}
|
|
|
fileServer = configService.findByType(ConfigType.FILE_SERVER);
|
|
|
markTime = Long.parseLong(configService.findByType(ConfigType.MARK_TIME));
|
|
|
String studentSheetCount = configService.findByType(ConfigType.STUDENT_SHEET_COUNT);
|
|
|
- enableStudentSheetCount = studentSheetCount!=null&&studentSheetCount.equals("on");
|
|
|
+ enableStudentSheetCount = studentSheetCount != null && studentSheetCount.equals("on");
|
|
|
}
|
|
|
|
|
|
public boolean isAuth() {
|
|
@@ -136,6 +141,14 @@ public class SystemCache {
|
|
|
this.enableStudentSheetCount = enableStudentSheetCount;
|
|
|
}
|
|
|
|
|
|
+ public TrialMode getTrialMode() {
|
|
|
+ return trialMode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTrialMode(TrialMode trialMode) {
|
|
|
+ this.trialMode = trialMode;
|
|
|
+ }
|
|
|
+
|
|
|
public void parseJson(JSONObject json) {
|
|
|
if (json != null) {
|
|
|
Auth = true;
|
|
@@ -170,11 +183,23 @@ public class SystemCache {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ this.trialMode = TrialMode.SHARE;
|
|
|
+ if (json.has("control") && json.getJSONObject("control").has("custom")
|
|
|
+ && json.getJSONObject("control").getJSONObject("custom").has("trial_mode")) {
|
|
|
+ try {
|
|
|
+ this.trialMode = TrialMode.findByName(json.getJSONObject("control").getJSONObject("custom")
|
|
|
+ .getString("trial_mode"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
Auth = false;
|
|
|
doubleTrack = false;
|
|
|
groupDeleteWarn = false;
|
|
|
expireTime = null;
|
|
|
+ trialMode = TrialMode.SHARE;
|
|
|
}
|
|
|
}
|
|
|
|