wangliang 3 سال پیش
والد
کامیت
b05cfafe11
1فایلهای تغییر یافته به همراه20 افزوده شده و 5 حذف شده
  1. 20 5
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/sync/TeachCloudReportTaskUtils.java

+ 20 - 5
teachcloud-common/src/main/java/com/qmth/teachcloud/common/sync/TeachCloudReportTaskUtils.java

@@ -52,7 +52,10 @@ public class TeachCloudReportTaskUtils {
     public Long syncSemester(Long schoolId, Long thirdSemesterId, String semesterName, Long startTime, Long endTime, Boolean enable) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        if (hostUrl.contains("*")) {
+            hostUrl = hostUrl.replace("*", basicSchool.getCode());
+        }
         String saveUrl = dictionaryConfig.reportOpenDomain().getSemesterApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -99,7 +102,10 @@ public class TeachCloudReportTaskUtils {
     public Long syncExam(Long schoolId, Long id, String examName, Long examTime, String semesterId, Boolean enable) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        if (hostUrl.contains("*")) {
+            hostUrl = hostUrl.replace("*", basicSchool.getCode());
+        }
         String saveUrl = dictionaryConfig.reportOpenDomain().getExamApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -144,7 +150,10 @@ public class TeachCloudReportTaskUtils {
                               String paperType, String teachCollegeName, Boolean enable) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        if (hostUrl.contains("*")) {
+            hostUrl = hostUrl.replace("*", basicSchool.getCode());
+        }
         String saveUrl = dictionaryConfig.reportOpenDomain().getCourseEditApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -186,7 +195,10 @@ public class TeachCloudReportTaskUtils {
     public boolean startCalc(Long schoolId, Long examId, List<String> courseCodes) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        if (hostUrl.contains("*")) {
+            hostUrl = hostUrl.replace("*", basicSchool.getCode());
+        }
         String saveUrl = dictionaryConfig.reportOpenDomain().getCalculateApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -228,7 +240,10 @@ public class TeachCloudReportTaskUtils {
     public boolean publish(Long schoolId, Long thirdExamId, String gradeCourseCode, boolean publishStatus) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        if (hostUrl.contains("*")) {
+            hostUrl = hostUrl.replace("*", basicSchool.getCode());
+        }
         String saveUrl = dictionaryConfig.reportOpenDomain().getPublishApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);