Selaa lähdekoodia

配置文件修改

wangliang 3 vuotta sitten
vanhempi
commit
5d4e0f4350

+ 2 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/SsoServiceImpl.java

@@ -116,12 +116,11 @@ public class SsoServiceImpl implements SsoService {
         map.computeIfAbsent("time", v -> timestamp);
         map.computeIfAbsent("authorization", v -> accessToken);
 
+        SystemConstant.getLocalFileHost(dictionaryConfig.reportOpenDomain().getHostUrl());
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
 
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         map.put("redirectUrl", hostUrl + dictionaryConfig.reportOpenDomain().getSsoLoginApi());
         return map;
     }

+ 5 - 5
distributed-print/src/main/resources/application-dev.properties

@@ -61,15 +61,15 @@ com.qmth.fss.private.config=oss://key:secret@teachcloud-print-dev-private.oss-ap
 com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
 
 #\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=true
+sys.config.oss=false
 sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
 sys.config.serverUpload=
 #sys.config.fileHost=localhost:7001
 #sys.config.serverHost=localhost:7001
-sys.config.fileHost=http://127.0.0.1
-sys.config.serverHost=http://127.0.0.1
+sys.config.fileHost=http://127.0.0.1:7001
+sys.config.serverHost=http://127.0.0.1:7001
 #sys.config.accessKey=0bce69d94a7b4aef8bc0badf150351a9
 #sys.config.accessSecret=LdUwb5X4etmjW7fDn0KAdoXG0Yt7AkDu
 sys.config.accessKey=274f823e5f59410f8b3bb6edcd8e2b6e
@@ -160,8 +160,8 @@ sync.config.groupCountUrl=/api/exam/mark_group/count
 sync.config.groupDeleteUrl=/api/exam/mark_group/delete
 sync.config.markerSaveUrl=/api/exam/marker/save
 
-com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
-com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
+#com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
+#com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 
 sms.config.smsNormalCode=qmth

+ 5 - 5
distributed-print/src/main/resources/application-offline.properties

@@ -61,13 +61,13 @@ com.qmth.fss.private.config=oss://key:secret@teachcloud-dps-dev-private.oss-api.
 com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-dps-dev-private
 
 #\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=false
+sys.config.oss=true
 sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
 sys.config.serverUpload=
-sys.config.fileHost=192.168.10.138:7781
-sys.config.serverHost=192.168.10.138:7781
+sys.config.fileHost=http://*.teachcloud-print-wl-test.cn
+sys.config.serverHost=http://*.teachcloud-print-wl-test.cn
 #sys.config.accessKey=0bce69d94a7b4aef8bc0badf150351a9
 #sys.config.accessSecret=LdUwb5X4etmjW7fDn0KAdoXG0Yt7AkDu
 sys.config.accessKey=918d0878ee7944beb448980b011ff804
@@ -157,8 +157,8 @@ sync.config.groupCountUrl=/api/exam/mark_group/count
 sync.config.groupDeleteUrl=/api/exam/mark_group/delete
 sync.config.markerSaveUrl=/api/exam/marker/save
 
-#com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
-#com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
+com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
+com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Users/king/Downloads/tc-dev-wl.lic
 
 sms.config.smsNormalCode=8635

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

@@ -629,10 +629,12 @@ public class SystemConstant {
      * @param filePath
      * @return
      */
-    public static String getLocalFilePath(String filePath) {
-        if (filePath.contains(SystemConstant.FILE_TEMP)) {
+    public static String getLocalFilePath(String hostUrl, String filePath) {
+        Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置hostUrl"));
+        String[] hostArray = hostUrl.split(":");
+        if (hostArray.length == 2 && filePath.contains(SystemConstant.FILE_TEMP)) {
             filePath = filePath.substring(filePath.indexOf(SystemConstant.FILE_TEMP), filePath.length());
-        } else if (filePath.contains(SystemConstant.PDF_TEMP)) {
+        } else if (hostArray.length == 2 && filePath.contains(SystemConstant.PDF_TEMP)) {
             filePath = filePath.substring(filePath.indexOf(SystemConstant.PDF_TEMP), filePath.length());
         }
         return filePath;

+ 3 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/AttachmentCommonServiceImpl.java

@@ -62,7 +62,7 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
         UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            filePath = SystemConstant.getLocalFilePath(filePath);
+            filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
             url = hostUrl + File.separator + filePath;
         } else {
             url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
@@ -87,7 +87,7 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
         String pathUrl;
         if (Objects.equals(type, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            path = SystemConstant.getLocalFilePath(path);
+            path = SystemConstant.getLocalFilePath(hostUrl, path);
             pathUrl = hostUrl + File.separator + path;
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
@@ -120,7 +120,7 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
 
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            filePath = SystemConstant.getLocalFilePath(filePath);
+            filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
             pathUrl = hostUrl + File.separator + filePath;
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());

+ 4 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -124,7 +124,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                 .eq(SysPrivilege::getEnable, true).eq(SysPrivilege::getFrontDisplay, true)
                 .orderByAsc(SysPrivilege::getSequence);
 
-        if (!privilegeIds.isEmpty()){
+        if (!privilegeIds.isEmpty()) {
             sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds);
         }
         List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
@@ -590,7 +590,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            filePath = SystemConstant.getLocalFilePath(filePath);
+            filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
             url = hostUrl + File.separator + filePath;
         } else {
             url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
@@ -614,7 +614,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         String pathUrl;
         if (Objects.equals(type, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            path = SystemConstant.getLocalFilePath(path);
+            path = SystemConstant.getLocalFilePath(hostUrl, path);
             pathUrl = hostUrl + File.separator + path;
         } else {
             if (isExpire) {
@@ -651,7 +651,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
 
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
-            filePath = SystemConstant.getLocalFilePath(filePath);
+            filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
             pathUrl = hostUrl + File.separator + filePath;
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());

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

@@ -52,10 +52,7 @@ 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"));
-        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         String saveUrl = dictionaryConfig.reportOpenDomain().getSemesterApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -102,10 +99,7 @@ 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"));
-        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         String saveUrl = dictionaryConfig.reportOpenDomain().getExamApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -150,10 +144,7 @@ public class TeachCloudReportTaskUtils {
                               String paperType, String teachCollegeName, Boolean enable) {
         String hostUrl = dictionaryConfig.reportOpenDomain().getHostUrl();
         Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置教研分析host"));
-        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         String saveUrl = dictionaryConfig.reportOpenDomain().getCourseEditApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -195,10 +186,7 @@ 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"));
-        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         String saveUrl = dictionaryConfig.reportOpenDomain().getCalculateApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);
@@ -240,10 +228,7 @@ 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"));
-        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        if (hostUrl.contains("*")) {
-            hostUrl = hostUrl.replace("*", basicSchool.getCode());
-        }
+        hostUrl = SystemConstant.getLocalFileHost(hostUrl);
         String saveUrl = dictionaryConfig.reportOpenDomain().getPublishApi();
         validUrl(hostUrl, saveUrl);
         String postUrl = hostUrl.concat(saveUrl);

+ 2 - 2
teachcloud-report/src/main/resources/application-offline.properties

@@ -42,8 +42,8 @@ sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
 sys.config.serverUpload=
-sys.config.fileHost=192.168.10.136:7783
-sys.config.serverHost=192.168.10.136:7783
+sys.config.fileHost=http://192.168.10.136:7783
+sys.config.serverHost=http://192.168.10.136:7783
 #sys.config.accessKey=274f823e5f59410f8b3bb6edcd8e2b6e
 #sys.config.accessSecret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 sys.config.accessKey=

+ 2 - 2
teachcloud-task/src/main/resources/application-task_offline.properties

@@ -67,8 +67,8 @@ sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
 sys.config.serverUpload=
-sys.config.fileHost=192.168.10.83:8005
-sys.config.serverHost=192.168.10.83:8005
+sys.config.fileHost=http://192.168.10.138:7781
+sys.config.serverHost=http://192.168.10.138:7781
 #sys.config.accessKey=0bce69d94a7b4aef8bc0badf150351a9
 #sys.config.accessSecret=LdUwb5X4etmjW7fDn0KAdoXG0Yt7AkDu
 sys.config.accessKey=918d0878ee7944beb448980b011ff804