Browse Source

超管同步配置修改

wangliang 2 years ago
parent
commit
22dcca4f76

+ 18 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/SysAdminSetController.java

@@ -89,9 +89,9 @@ public class SysAdminSetController {
             syncServicePath = sysConfigSyncServicePath.getConfigValue();
         } else {
             JSONObject jsonObject = new JSONObject();
-            jsonObject.put(SystemConstant.QUESTION, "");
-            jsonObject.put(SystemConstant.CLOUD_MARK, "");
-            jsonObject.put(SystemConstant.REPORT, "");
+            jsonObject.put(SystemConstant.QUESTION_HOST_URL, "");
+            jsonObject.put(SystemConstant.CLOUDMARK_HOST_URL, "");
+            jsonObject.put(SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "");
             syncServicePath = jsonObject.toString();
         }
         return ResultUtil.ok(new SysAdminSetResult(schoolId, syncServicePath));
@@ -110,6 +110,21 @@ public class SysAdminSetController {
         SysConfig sysConfigSyncServicePath = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.SYNC_SERVICE_PATH);
         if (Objects.isNull(sysConfigSyncServicePath)) {
             sysConfigSyncServicePath = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.SYNC_SERVICE_PATH, "同步配置地址", sysAdminSetParam.getSyncServicePath());
+            JSONObject jsonObject = JSONObject.parseObject(sysConfigSyncServicePath.getConfigValue());
+            SysConfig sysConfigQuestionHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
+            sysConfigQuestionHostUrl.setConfigValue(jsonObject.getString(SystemConstant.QUESTION_HOST_URL));
+
+            SysConfig sysConfigCloudmarkHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
+            sysConfigCloudmarkHostUrl.setConfigValue(jsonObject.getString(SystemConstant.CLOUDMARK_HOST_URL));
+
+            SysConfig sysConfigTeachcloudReportHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
+            sysConfigQuestionHostUrl.setConfigValue(jsonObject.getString(SystemConstant.TEACHCLOUD_REPORT_HOST_URL));
+
+            sysConfigService.saveOrUpdateBatch(Arrays.asList(sysConfigQuestionHostUrl, sysConfigCloudmarkHostUrl, sysConfigTeachcloudReportHostUrl));
+
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
         } else {
             sysConfigSyncServicePath.setConfigValue(sysAdminSetParam.getSyncServicePath());
         }

+ 3 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -42,9 +42,9 @@ public class SystemConstant {
     public static final String ACCOUNT_SMS_VERIFY = "account.sms.verify";
     public static final String TEACHCLOUD_EXCHANGE_SERVICE_PATH = "teachcloud.exchange.serive.path";
     public static final String SYNC_SERVICE_PATH = "sync.service.path";
-    public static final String QUESTION = "question";
-    public static final String CLOUD_MARK = "cloudmark";
-    public static final String REPORT = "report";
+    public static final String QUESTION_HOST_URL = "question.host.url";
+    public static final String CLOUDMARK_HOST_URL = "cloudmark.host.url";
+    public static final String TEACHCLOUD_REPORT_HOST_URL = "teachcloud.report.host.url";
     public static final String CHARSET_NAME = "UTF-8";
     //    public static final String CHARSET_GB2312 = "gb2312";
     public static final String CHARSET_GBK = "gbk";