Преглед на файлове

task_题库引入配置修改

wangliang преди 2 години
родител
ревизия
e12a8862f6

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradeBatchServiceImpl.java

@@ -278,7 +278,7 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
         OutputStream output = response.getOutputStream();
         response.reset();
         response.setCharacterEncoding("ISO-8859-1");
-        response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
+        response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME));
         response.setContentType("application/vnd.ms-excel;charset=utf-8");
         wb.write(output);
         output.flush();

+ 5 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/SsoServiceImpl.java

@@ -17,19 +17,15 @@ import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
-import org.apache.commons.text.StringEscapeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @Date: 2021/5/20.
@@ -53,12 +49,6 @@ public class SsoServiceImpl implements SsoService {
     @Resource
     SysOrgService sysOrgService;
 
-    @Value("${cas.config.questionLoginUri}")
-    String questionLoginUri;
-
-    @Value("${cas.config.questionHostUrl}")
-    String questionHostUrl;
-
     @Resource
     SysRoleService sysRoleService;
 
@@ -148,7 +138,7 @@ public class SsoServiceImpl implements SsoService {
 //                    throw ExceptionResultEnum.ERROR.exception("未找到顶级学校信息");
 //                }
 //            }
-            if (Objects.isNull(sysOrg)){
+            if (Objects.isNull(sysOrg)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到顶级机构");
             }
         } else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUserCas.getOrgId())) {
@@ -195,7 +185,7 @@ public class SsoServiceImpl implements SsoService {
      * @throws IOException
      */
     @Override
-    public Map<String, Object> questionLibraryLogin(String loginName,String realName, RoleTypeEnum role, String returnUrl, String params) throws IOException {
+    public Map<String, Object> questionLibraryLogin(String loginName, String realName, RoleTypeEnum role, String returnUrl, String params) throws IOException {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         BasicSchool basicSchool = commonCacheService.schoolCache(sysUser.getSchoolId());
 
@@ -217,10 +207,10 @@ public class SsoServiceImpl implements SsoService {
         Optional.ofNullable(sysUserRole).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("用户没有该角色"));
 
         long timestamp = System.currentTimeMillis();
-        String questionLoginUrl = questionHostUrl + questionLoginUri;
-        String path = questionLoginUri;
+        String questionLoginUrl = dictionaryConfig.casDomain().getQuestionHostUrl() + dictionaryConfig.casDomain().getQuestionLoginUri();
+        String path = dictionaryConfig.casDomain().getQuestionLoginUri();
         String signature = SignatureEntity.build(SignatureType.SECRET, SystemConstant.GET, path, timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
-        signature = URLEncoder.encode(signature,"utf-8");
+        signature = URLEncoder.encode(signature, SystemConstant.CHARSET_NAME);
 
         StringJoiner stringJoiner = new StringJoiner("")
                 .add(questionLoginUrl)

+ 15 - 5
teachcloud-common/src/main/java/com/qmth/teachcloud/common/domain/CasDomain.java

@@ -11,13 +11,23 @@ import java.io.Serializable;
  */
 public class CasDomain implements Serializable {
 
-    String questionLoginUrl;
+    String questionHostUrl;
 
-    public String getQuestionLoginUrl() {
-        return questionLoginUrl;
+    String questionLoginUri;
+
+    public String getQuestionHostUrl() {
+        return questionHostUrl;
+    }
+
+    public void setQuestionHostUrl(String questionHostUrl) {
+        this.questionHostUrl = questionHostUrl;
+    }
+
+    public String getQuestionLoginUri() {
+        return questionLoginUri;
     }
 
-    public void setQuestionLoginUrl(String questionLoginUrl) {
-        this.questionLoginUrl = questionLoginUrl;
+    public void setQuestionLoginUri(String questionLoginUri) {
+        this.questionLoginUri = questionLoginUri;
     }
 }

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

@@ -105,7 +105,7 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
             byte[] buf = new byte[1024];
             int len = 0;
 
-            String fName = URLEncoder.encode(fileName, "UTF-8");
+            String fName = URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME);
 
             response.reset();
             response.setContentType("application/x-msdownload");

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java

@@ -364,7 +364,7 @@ public class ConvertUtil {
 
     public static void outputFile(HttpServletResponse response, ByteArrayOutputStream baos, String fileName) throws Exception {
         try {
-            String fName = URLEncoder.encode(fileName, "UTF-8");
+            String fName = URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME);
 
             response.reset();
             response.setContentType("application/x-msdownload");