Sfoglia il codice sorgente

Merge branch 'dev'
1

wangliang 4 anni fa
parent
commit
907a8d3d5d
38 ha cambiato i file con 1608 aggiunte e 1356 eliminazioni
  1. 25 21
      themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java
  2. 3 3
      themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java
  3. 1 0
      themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java
  4. 3 3
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamPaperController.java
  5. 4 4
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java
  6. 3 3
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEStudentController.java
  7. 3 7
      themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateCallMobileController.java
  8. 3 3
      themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java
  9. 11 0
      themis-backend/src/main/java/com/qmth/themis/backend/config/DictionaryConfig.java
  10. 4 8
      themis-backend/src/main/resources/application.properties
  11. 0 103
      themis-business/src/main/java/com/qmth/themis/business/config/SystemConfig.java
  12. 1 0
      themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java
  13. 104 0
      themis-business/src/main/java/com/qmth/themis/business/domain/AliYunOssPrivateDomain.java
  14. 107 0
      themis-business/src/main/java/com/qmth/themis/business/domain/AliYunOssPublicDomain.java
  15. 43 0
      themis-business/src/main/java/com/qmth/themis/business/domain/ClientDomain.java
  16. 16 6
      themis-business/src/main/java/com/qmth/themis/business/domain/TencentYunDomain.java
  17. 31 0
      themis-business/src/main/java/com/qmth/themis/business/domain/WxappDomain.java
  18. 24 28
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamPaperServiceImpl.java
  19. 13 14
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java
  20. 3 10
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEMobileServiceImpl.java
  21. 331 344
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEOpenServiceImpl.java
  22. 4 4
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEQrcodeServiceImpl.java
  23. 3 4
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEStudentServiceImpl.java
  24. 4 3
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java
  25. 2 4
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCommon.java
  26. 2 3
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportCommon.java
  27. 702 722
      themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskExamPaperImportTemplete.java
  28. 46 7
      themis-business/src/main/java/com/qmth/themis/business/util/OssUtil.java
  29. 14 9
      themis-business/src/main/java/com/qmth/themis/business/util/TencentYunUtil.java
  30. 30 0
      themis-business/src/main/java/com/qmth/themis/business/util/WxappUtil.java
  31. 0 9
      themis-exam/src/main/java/com/qmth/themis/exam/ThemisExamApplication.java
  32. 3 7
      themis-exam/src/main/java/com/qmth/themis/exam/api/SysController.java
  33. 4 6
      themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java
  34. 22 0
      themis-exam/src/main/java/com/qmth/themis/exam/config/DictionaryConfig.java
  35. 6 9
      themis-exam/src/main/resources/application.properties
  36. 23 0
      themis-task/src/main/java/com/qmth/themis/task/config/DictionaryConfig.java
  37. 0 3
      themis-task/src/main/java/com/qmth/themis/task/listener/service/impl/MqTaskLogicServiceImpl.java
  38. 10 9
      themis-task/src/main/resources/application.properties

+ 25 - 21
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.reflect.TypeToken;
 import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.qmth.themis.backend.config.DictionaryConfig;
 import com.qmth.themis.backend.config.DictionaryConfig;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
@@ -63,7 +62,7 @@ public class SysController {
     DictionaryConfig dictionaryConfig;
     DictionaryConfig dictionaryConfig;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     TBOrgService tbOrgService;
     TBOrgService tbOrgService;
@@ -122,7 +121,12 @@ public class SysController {
         if (Objects.isNull(type) || Objects.equals(type, "")) {
         if (Objects.isNull(type) || Objects.equals(type, "")) {
             throw new BusinessException(ExceptionResultEnum.FILE_TYPE_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.FILE_TYPE_IS_NULL);
         }
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(type.getId());
+        Map<String, Object> mapParameter = null;
+        if (type.getId() == UploadFileEnum.file.getId()) {
+            mapParameter = ossUtil.getAliYunOssPrivateDomain().getMap();
+        } else {
+            mapParameter = ossUtil.getAliYunOssPublicDomain().getMap();
+        }
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
         TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
         if (Objects.isNull(tbAttachment)) {
         if (Objects.isNull(tbAttachment)) {
@@ -192,7 +196,7 @@ public class SysController {
                 String[] strs = filePath.split("/");
                 String[] strs = filePath.split("/");
                 Integer fileId = UploadFileEnum.convertToId(strs[0]);
                 Integer fileId = UploadFileEnum.convertToId(strs[0]);
                 if (fileId == 3) {
                 if (fileId == 3) {
-                    url = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), filePath);
+                    url = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath);
                 } else {
                 } else {
                     url = dictionaryConfig.aliYunOssDomain().getPublicUrl() + File.separator + filePath;
                     url = dictionaryConfig.aliYunOssDomain().getPublicUrl() + File.separator + filePath;
                 }
                 }
@@ -282,29 +286,29 @@ public class SysController {
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
         List<TEExam> teExamList = null;
         List<TEExam> teExamList = null;
         if (authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())
         if (authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())
-        		||authDto.getRoleCodes().toString().contains(RoleEnum.SUPER_ADMIN.name())) {//管理员
-        	QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
+                || authDto.getRoleCodes().toString().contains(RoleEnum.SUPER_ADMIN.name())) {//管理员
+            QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
             teExamQueryWrapper.lambda().eq(TEExam::getOrgId, tbUser.getOrgId()).eq(TEExam::getEnable, 1);
             teExamQueryWrapper.lambda().eq(TEExam::getOrgId, tbUser.getOrgId()).eq(TEExam::getEnable, 1);
             if (Objects.nonNull(name) && !Objects.equals(name, "")) {
             if (Objects.nonNull(name) && !Objects.equals(name, "")) {
                 teExamQueryWrapper.lambda().like(TEExam::getName, name);
                 teExamQueryWrapper.lambda().like(TEExam::getName, name);
             }
             }
             teExamQueryWrapper.lambda().orderByDesc(TEExam::getCreateTime);
             teExamQueryWrapper.lambda().orderByDesc(TEExam::getCreateTime);
             teExamList = teExamService.list(teExamQueryWrapper);
             teExamList = teExamService.list(teExamQueryWrapper);
-        }else {
-	        if (Objects.nonNull(userId) && !Objects.equals(userId, "")) {
-	            teExamList = teExamService.examPrivilegeQuery(userId, tbUser.getOrgId(), type);
-	        } else {
-	            QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
-	            teExamQueryWrapper.lambda().eq(TEExam::getOrgId, tbUser.getOrgId());
-	            if (Objects.nonNull(name) && !Objects.equals(name, "")) {
-	                teExamQueryWrapper.lambda().like(TEExam::getName, name);
-	            }
-	            if (Objects.nonNull(type) && !Objects.equals(type, "") && Objects.equals(type, "monitor")) {
-	                teExamQueryWrapper.lambda().ne(TEExam::getMonitorStatus, InvigilateMonitorStatusEnum.FINISHED.name());
-	            }
-	            teExamQueryWrapper.lambda().orderByDesc(TEExam::getCreateTime);
-	            teExamList = teExamService.list(teExamQueryWrapper);
-	        }
+        } else {
+            if (Objects.nonNull(userId) && !Objects.equals(userId, "")) {
+                teExamList = teExamService.examPrivilegeQuery(userId, tbUser.getOrgId(), type);
+            } else {
+                QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
+                teExamQueryWrapper.lambda().eq(TEExam::getOrgId, tbUser.getOrgId());
+                if (Objects.nonNull(name) && !Objects.equals(name, "")) {
+                    teExamQueryWrapper.lambda().like(TEExam::getName, name);
+                }
+                if (Objects.nonNull(type) && !Objects.equals(type, "") && Objects.equals(type, "monitor")) {
+                    teExamQueryWrapper.lambda().ne(TEExam::getMonitorStatus, InvigilateMonitorStatusEnum.FINISHED.name());
+                }
+                teExamQueryWrapper.lambda().orderByDesc(TEExam::getCreateTime);
+                teExamList = teExamService.list(teExamQueryWrapper);
+            }
         }
         }
         List<TEExamQueryDto> teExamQueryDtoList = null;
         List<TEExamQueryDto> teExamQueryDtoList = null;
         if (Objects.nonNull(teExamList)) {
         if (Objects.nonNull(teExamList)) {

+ 3 - 3
themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.response.TBExamInvigilateUserDto;
 import com.qmth.themis.business.dto.response.TBExamInvigilateUserDto;
@@ -14,6 +13,7 @@ import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBExamInvigilateUserService;
 import com.qmth.themis.business.service.TBExamInvigilateUserService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.exception.BusinessException;
@@ -57,7 +57,7 @@ public class TBExamInvigilateUserController {
     TBAttachmentService tbAttachmentService;
     TBAttachmentService tbAttachmentService;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @ApiOperation(value = "监考员查询接口")
     @ApiOperation(value = "监考员查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @RequestMapping(value = "/query", method = RequestMethod.POST)
@@ -137,7 +137,7 @@ public class TBExamInvigilateUserController {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(UploadFileEnum.file.getId());
+        Map<String, Object> mapParameter = ossUtil.getAliYunOssPrivateDomain().getMap();
         TBAttachment tbAttachment = null;
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
         TBTaskHistory tbTaskHistory = null;
         Map transMap = new HashMap();
         Map transMap = new HashMap();

+ 1 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -19,6 +19,7 @@ import com.qmth.themis.business.enums.MqTagEnum;
 import com.qmth.themis.business.enums.MqTopicEnum;
 import com.qmth.themis.business.enums.MqTopicEnum;
 import com.qmth.themis.business.enums.SystemOperationEnum;
 import com.qmth.themis.business.enums.SystemOperationEnum;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.SessionUtil;
 import com.qmth.themis.business.util.SessionUtil;

+ 3 - 3
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamPaperController.java

@@ -2,12 +2,12 @@ package com.qmth.themis.backend.api;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.exception.BusinessException;
@@ -53,7 +53,7 @@ public class TEExamPaperController {
     MqDtoService mqDtoService;
     MqDtoService mqDtoService;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     TEExamCourseService examCourseService;
     TEExamCourseService examCourseService;
@@ -124,7 +124,7 @@ public class TEExamPaperController {
         if (examId == null) {
         if (examId == null) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(3);
+        Map<String, Object> mapParameter = ossUtil.getAliYunOssPrivateDomain().getMap();
         TBAttachment tbAttachment = null;
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
         TBTaskHistory tbTaskHistory = null;
         Map<String, Object> transMap = new HashMap<String, Object>();
         Map<String, Object> transMap = new HashMap<String, Object>();

+ 4 - 4
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -8,7 +8,6 @@ import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
@@ -17,6 +16,7 @@ import com.qmth.themis.business.dto.response.TEExamStudentDto;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.exception.BusinessException;
@@ -71,7 +71,7 @@ public class TEExamStudentController {
     MqDtoService mqDtoService;
     MqDtoService mqDtoService;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     TEStudentService teStudentService;
     TEStudentService teStudentService;
@@ -147,7 +147,7 @@ public class TEExamStudentController {
         if (teExamStudentIPage.getRecords() != null && teExamStudentIPage.getRecords().size() > 0) {
         if (teExamStudentIPage.getRecords() != null && teExamStudentIPage.getRecords().size() > 0) {
             for (TEExamStudentDto dto : teExamStudentIPage.getRecords()) {
             for (TEExamStudentDto dto : teExamStudentIPage.getRecords()) {
                 if (StringUtils.isNotBlank(dto.getBasePhotoUrl())) {
                 if (StringUtils.isNotBlank(dto.getBasePhotoUrl())) {
-                    dto.setBasePhotoUrl(systemConfig.getProperty("aliyun.oss.publicUrl") + "/" + dto.getBasePhotoUrl());
+                    dto.setBasePhotoUrl(ossUtil.getAliYunOssPublicDomain().getPublicUrl() + "/" + dto.getBasePhotoUrl());
                 }
                 }
             }
             }
         }
         }
@@ -273,7 +273,7 @@ public class TEExamStudentController {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(UploadFileEnum.file.getId());
+        Map<String, Object> mapParameter = ossUtil.getAliYunOssPrivateDomain().getMap();
         TBAttachment tbAttachment = null;
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
         TBTaskHistory tbTaskHistory = null;
         Map transMap = new HashMap();
         Map transMap = new HashMap();

+ 3 - 3
themis-backend/src/main/java/com/qmth/themis/backend/api/TEStudentController.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.response.TEStudentDto;
 import com.qmth.themis.business.dto.response.TEStudentDto;
@@ -13,6 +12,7 @@ import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.service.TEStudentService;
 import com.qmth.themis.business.service.TEStudentService;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
@@ -49,7 +49,7 @@ public class TEStudentController {
     RedisUtil redisUtil;
     RedisUtil redisUtil;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @ApiOperation(value = "学生查询接口")
     @ApiOperation(value = "学生查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @RequestMapping(value = "/query", method = RequestMethod.POST)
@@ -60,7 +60,7 @@ public class TEStudentController {
         if (teExamStudentIPage.getRecords() != null && teExamStudentIPage.getRecords().size() > 0) {
         if (teExamStudentIPage.getRecords() != null && teExamStudentIPage.getRecords().size() > 0) {
             for (TEStudentDto dto : teExamStudentIPage.getRecords()) {
             for (TEStudentDto dto : teExamStudentIPage.getRecords()) {
                 if (StringUtils.isNotBlank(dto.getBasePhotoPath())) {
                 if (StringUtils.isNotBlank(dto.getBasePhotoPath())) {
-                    dto.setBasePhotoPath(systemConfig.getProperty("aliyun.oss.publicUrl") + "/" + dto.getBasePhotoPath());
+                    dto.setBasePhotoPath(ossUtil.getAliYunOssPublicDomain().getPublicUrl() + "/" + dto.getBasePhotoPath());
                 }
                 }
             }
             }
         }
         }

+ 3 - 7
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateCallMobileController.java

@@ -11,7 +11,6 @@ import com.qmth.themis.business.bean.mobile.MobileAuthorizationMonitorBean;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
@@ -19,10 +18,7 @@ import com.qmth.themis.business.dto.response.TIeExamInvigilateCallDto;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
-import com.qmth.themis.business.util.RedisUtil;
-import com.qmth.themis.business.util.ServletUtil;
-import com.qmth.themis.business.util.SessionUtil;
-import com.qmth.themis.business.util.TencentYunUtil;
+import com.qmth.themis.business.util.*;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Source;
 import com.qmth.themis.common.enums.Source;
@@ -69,7 +65,7 @@ public class TIeInvigilateCallMobileController {
     TencentYunUtil tencentYunUtil;
     TencentYunUtil tencentYunUtil;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     DictionaryConfig dictionaryConfig;
     DictionaryConfig dictionaryConfig;
@@ -103,7 +99,7 @@ public class TIeInvigilateCallMobileController {
         }
         }
         IPage<TIeExamInvigilateCallDto> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examId, userId, tbUser.getOrgId(), MonitorStatusSourceEnum.START.name(), callStatus);
         IPage<TIeExamInvigilateCallDto> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examId, userId, tbUser.getOrgId(), MonitorStatusSourceEnum.START.name(), callStatus);
         tIeExamInvigilateCallIPage.getRecords().forEach(s -> {
         tIeExamInvigilateCallIPage.getRecords().forEach(s -> {
-            s.setBasePhotoPath(systemConfig.getProperty("aliyun.oss.publicUrl") + File.separator + s.getBasePhotoPath());
+            s.setBasePhotoPath(ossUtil.getAliYunOssPublicDomain().getPublicUrl() + File.separator + s.getBasePhotoPath());
             try {
             try {
                 s.setSourceUserId(this.getSourceUserId(s.getExamRecordId()));
                 s.setSourceUserId(this.getSourceUserId(s.getExamRecordId()));
             } catch (NoSuchAlgorithmException e) {
             } catch (NoSuchAlgorithmException e) {

+ 3 - 3
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java

@@ -13,7 +13,6 @@ import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamActivityRecordCacheBean;
 import com.qmth.themis.business.cache.bean.ExamActivityRecordCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.ExamPropCountDto;
 import com.qmth.themis.business.dto.ExamPropCountDto;
@@ -23,6 +22,7 @@ import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.excel.ExportUtils;
 import com.qmth.themis.business.excel.ExportUtils;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.JacksonUtil;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
@@ -94,7 +94,7 @@ public class TIeInvigilateController {
     TEStudentService teStudentService;
     TEStudentService teStudentService;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @ApiOperation(value = "实时监控台视频列表接口")
     @ApiOperation(value = "实时监控台视频列表接口")
     @RequestMapping(value = "/list/video", method = RequestMethod.POST)
     @RequestMapping(value = "/list/video", method = RequestMethod.POST)
@@ -281,7 +281,7 @@ public class TIeInvigilateController {
         }
         }
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
         TEStudent teStudent = teStudentService.getById(examStudentCacheBean.getStudentId());
         TEStudent teStudent = teStudentService.getById(examStudentCacheBean.getStudentId());
-        String basePhotoPath = systemConfig.getProperty("aliyun.oss.publicUrl") + File.separator + teStudent.getBasePhotoPath();
+        String basePhotoPath = ossUtil.getAliYunOssPublicDomain().getPublicUrl() + File.separator + teStudent.getBasePhotoPath();
         String identity = examStudentCacheBean.getIdentity();
         String identity = examStudentCacheBean.getIdentity();
         String examStudentName = examStudentCacheBean.getName();
         String examStudentName = examStudentCacheBean.getName();
         String courseNameCode = examStudentCacheBean.getCourseName() + "(" + examStudentCacheBean.getCourseCode() + ")";
         String courseNameCode = examStudentCacheBean.getCourseName() + "(" + examStudentCacheBean.getCourseCode() + ")";

+ 11 - 0
themis-backend/src/main/java/com/qmth/themis/backend/config/DictionaryConfig.java

@@ -80,4 +80,15 @@ public class DictionaryConfig {
     public TencentYunDomain tencentYunDomain() {
     public TencentYunDomain tencentYunDomain() {
         return new TencentYunDomain();
         return new TencentYunDomain();
     }
     }
+
+    /**
+     * 微信配置
+     *
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "wxapp.upload", ignoreUnknownFields = false)
+    public WxappDomain wxappDomain() {
+        return new WxappDomain();
+    }
 }
 }

+ 4 - 8
themis-backend/src/main/resources/application.properties

@@ -109,22 +109,18 @@ spring.jackson.time-zone=GMT+8
 
 
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.publicEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicEndpoint=http://${aliyun.oss.publicName}
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicBucket=qmth-test
 aliyun.oss.publicBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.publicUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicUrl=http://${aliyun.oss.publicBucket}.${aliyun.oss.publicName}
 
 
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.privateEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateEndpoint=http://${aliyun.oss.privateName}
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateBucket=qmth-test
 aliyun.oss.privateBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.privateUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateUrl=http://${aliyun.oss.privateBucket}.${aliyun.oss.privateName}
 
 
 #\u817E\u8BAF\u4E91\u914D\u7F6E
 #\u817E\u8BAF\u4E91\u914D\u7F6E
 tencentyun.sdk.appId=1400411036
 tencentyun.sdk.appId=1400411036

+ 0 - 103
themis-business/src/main/java/com/qmth/themis/business/config/SystemConfig.java

@@ -1,103 +0,0 @@
-package com.qmth.themis.business.config;
-
-import com.qmth.themis.business.constant.SystemConstant;
-import com.qmth.themis.business.enums.UploadFileEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PropertiesLoaderUtils;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @Description: 读取系统配置文件
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2020/7/22
- */
-@Component
-public class SystemConfig {
-    private final static Logger log = LoggerFactory.getLogger(SystemConfig.class);
-    private Properties props = null;
-
-    public SystemConfig() {
-        try {
-            Resource resource = new ClassPathResource("/application.properties");
-            props = PropertiesLoaderUtils.loadProperties(resource);
-        } catch (IOException e) {
-            log.error("请求出错", e);
-        }
-    }
-
-    /**
-     * 获取属性
-     *
-     * @param key
-     * @return
-     */
-    public String getProperty(String key) {
-        return Objects.isNull(props) ? null : props.getProperty(key);
-    }
-
-    /**
-     * 获取属性
-     *
-     * @param key
-     * @param defaultValue
-     * @return
-     */
-    public String getProperty(String key, String defaultValue) {
-        return Objects.isNull(props) ? null : props.getProperty(key, defaultValue);
-    }
-
-    /**
-     * 获取properyies属性
-     *
-     * @return
-     */
-    public Properties getProperties() {
-        return props;
-    }
-
-    /**
-     * 获取oss环境
-     *
-     * @param type
-     * @return
-     */
-    public Map<String, Object> getOssEnv(Integer type) {
-        Map<String, Object> mapParameter = new HashMap<>();
-        if (Objects.nonNull(type) && type == 3) {
-            mapParameter.put(SystemConstant.END_POINT, props.getProperty("aliyun.oss.privateEndpoint", "aliyun.oss.privateName"));
-            mapParameter.put(SystemConstant.ACCESS_KEY_ID, props.getProperty("aliyun.oss.privateAccessKeyId"));
-            mapParameter.put(SystemConstant.ACCESS_KEY_SECRET, props.getProperty("aliyun.oss.privateAccessKeySecret"));
-            mapParameter.put(SystemConstant.BUCKET, props.getProperty("aliyun.oss.privateBucket"));
-        } else {
-            mapParameter.put(SystemConstant.END_POINT, props.getProperty("aliyun.oss.publicEndpoint", "aliyun.oss.publicName"));
-            mapParameter.put(SystemConstant.ACCESS_KEY_ID, props.getProperty("aliyun.oss.publicAccessKeyId"));
-            mapParameter.put(SystemConstant.ACCESS_KEY_SECRET, props.getProperty("aliyun.oss.publicAccessKeySecret"));
-            mapParameter.put(SystemConstant.BUCKET, props.getProperty("aliyun.oss.publicBucket"));
-        }
-        mapParameter.put(SystemConstant.OSS, Boolean.valueOf(props.getProperty("sys.config.oss")));
-        mapParameter.put(SystemConstant.ATTACHMENT_TYPE, Arrays.asList(props.getProperty("sys.config.attachmentType").split(",")));
-        String uploadType = UploadFileEnum.convertToName(type);
-        mapParameter.put(SystemConstant.UPLOAD_TYPE, uploadType);
-        return mapParameter;
-    }
-
-    /**
-     * 获取腾讯云环境
-     *
-     * @return
-     */
-    public Map<String, Object> getTencentYunEnv() {
-        Map<String, Object> mapParameter = new HashMap<>();
-        mapParameter.put(SystemConstant.TENCENT_APPID, props.getProperty("tencentyun.sdk.appId"));
-        mapParameter.put(SystemConstant.TENCENT_KEY, props.getProperty("tencentyun.sdk.key"));
-        return mapParameter;
-    }
-}

+ 1 - 0
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -28,6 +28,7 @@ public class SystemConstant {
     public static final String ACCESS_KEY_ID = "accessKeyId";
     public static final String ACCESS_KEY_ID = "accessKeyId";
     public static final String ACCESS_KEY_SECRET = "accessKeySecret";
     public static final String ACCESS_KEY_SECRET = "accessKeySecret";
     public static final String BUCKET = "bucket";
     public static final String BUCKET = "bucket";
+    public static final String URL = "url";
     /**
     /**
      * 腾讯云
      * 腾讯云
      */
      */

+ 104 - 0
themis-business/src/main/java/com/qmth/themis/business/domain/AliYunOssPrivateDomain.java

@@ -0,0 +1,104 @@
+package com.qmth.themis.business.domain;
+
+import com.qmth.themis.business.constant.SystemConstant;
+import org.springframework.context.annotation.Configuration;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: 阿里云private oss config
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/3/30
+ */
+public class AliYunOssPrivateDomain implements Serializable {
+
+    private String privateEndpoint;
+
+    private String privateName;
+
+    private String privateAccessKeyId;
+
+    private String privateAccessKeySecret;
+
+    private String privateBucket;
+
+    private String privateUrl;
+
+    private Map<String, Object> map;
+
+    public AliYunOssPrivateDomain(String privateEndpoint, String privateName, String privateAccessKeyId, String privateAccessKeySecret, String privateBucket, String privateUrl) {
+        this.privateEndpoint = privateEndpoint;
+        this.privateName = privateName;
+        this.privateAccessKeyId = privateAccessKeyId;
+        this.privateAccessKeySecret = privateAccessKeySecret;
+        this.privateBucket = privateBucket;
+        this.privateUrl = privateUrl;
+        map = new HashMap<>();
+        map.put(SystemConstant.END_POINT, this.privateEndpoint);
+        map.put(SystemConstant.ACCESS_KEY_ID, this.privateAccessKeyId);
+        map.put(SystemConstant.ACCESS_KEY_SECRET, this.privateAccessKeySecret);
+        map.put(SystemConstant.BUCKET, this.privateBucket);
+        map.put(SystemConstant.NAME, this.privateName);
+        map.put(SystemConstant.URL, this.privateUrl);
+    }
+
+    public Map<String, Object> getMap() {
+        return map;
+    }
+
+    public void setMap(Map<String, Object> map) {
+        this.map = map;
+    }
+
+    public String getPrivateEndpoint() {
+        return privateEndpoint;
+    }
+
+    public void setPrivateEndpoint(String privateEndpoint) {
+        this.privateEndpoint = privateEndpoint;
+    }
+
+    public String getPrivateName() {
+        return privateName;
+    }
+
+    public void setPrivateName(String privateName) {
+        this.privateName = privateName;
+    }
+
+    public String getPrivateAccessKeyId() {
+        return privateAccessKeyId;
+    }
+
+    public void setPrivateAccessKeyId(String privateAccessKeyId) {
+        this.privateAccessKeyId = privateAccessKeyId;
+    }
+
+    public String getPrivateAccessKeySecret() {
+        return privateAccessKeySecret;
+    }
+
+    public void setPrivateAccessKeySecret(String privateAccessKeySecret) {
+        this.privateAccessKeySecret = privateAccessKeySecret;
+    }
+
+    public String getPrivateBucket() {
+        return privateBucket;
+    }
+
+    public void setPrivateBucket(String privateBucket) {
+        this.privateBucket = privateBucket;
+    }
+
+    public String getPrivateUrl() {
+        return privateUrl;
+    }
+
+    public void setPrivateUrl(String privateUrl) {
+        this.privateUrl = privateUrl;
+    }
+}

+ 107 - 0
themis-business/src/main/java/com/qmth/themis/business/domain/AliYunOssPublicDomain.java

@@ -0,0 +1,107 @@
+package com.qmth.themis.business.domain;
+
+import com.qmth.themis.business.constant.SystemConstant;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: 阿里云public oss config
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/3/30
+ */
+public class AliYunOssPublicDomain implements Serializable {
+
+    private String publicEndpoint;
+
+    private String publicName;
+
+    private String publicAccessKeyId;
+
+    private String publicAccessKeySecret;
+
+    private String publicBucket;
+
+    private String publicUrl;
+
+    private Map<String, Object> map;
+
+    public AliYunOssPublicDomain() {
+
+    }
+
+    public AliYunOssPublicDomain(String publicEndpoint, String publicName, String publicAccessKeyId, String publicAccessKeySecret, String publicBucket, String publicUrl) {
+        this.publicEndpoint = publicEndpoint;
+        this.publicName = publicName;
+        this.publicAccessKeyId = publicAccessKeyId;
+        this.publicAccessKeySecret = publicAccessKeySecret;
+        this.publicBucket = publicBucket;
+        this.publicUrl = publicUrl;
+        map = new HashMap<>();
+        map.put(SystemConstant.END_POINT, this.publicEndpoint);
+        map.put(SystemConstant.ACCESS_KEY_ID, this.publicAccessKeyId);
+        map.put(SystemConstant.ACCESS_KEY_SECRET, this.publicAccessKeySecret);
+        map.put(SystemConstant.BUCKET, this.publicBucket);
+        map.put(SystemConstant.NAME, this.publicName);
+        map.put(SystemConstant.URL, this.publicUrl);
+    }
+
+    public Map<String, Object> getMap() {
+        return map;
+    }
+
+    public void setMap(Map<String, Object> map) {
+        this.map = map;
+    }
+
+    public String getPublicEndpoint() {
+        return publicEndpoint;
+    }
+
+    public void setPublicEndpoint(String publicEndpoint) {
+        this.publicEndpoint = publicEndpoint;
+    }
+
+    public String getPublicName() {
+        return publicName;
+    }
+
+    public void setPublicName(String publicName) {
+        this.publicName = publicName;
+    }
+
+    public String getPublicAccessKeyId() {
+        return publicAccessKeyId;
+    }
+
+    public void setPublicAccessKeyId(String publicAccessKeyId) {
+        this.publicAccessKeyId = publicAccessKeyId;
+    }
+
+    public String getPublicAccessKeySecret() {
+        return publicAccessKeySecret;
+    }
+
+    public void setPublicAccessKeySecret(String publicAccessKeySecret) {
+        this.publicAccessKeySecret = publicAccessKeySecret;
+    }
+
+    public String getPublicBucket() {
+        return publicBucket;
+    }
+
+    public void setPublicBucket(String publicBucket) {
+        this.publicBucket = publicBucket;
+    }
+
+    public String getPublicUrl() {
+        return publicUrl;
+    }
+
+    public void setPublicUrl(String publicUrl) {
+        this.publicUrl = publicUrl;
+    }
+}

+ 43 - 0
themis-business/src/main/java/com/qmth/themis/business/domain/ClientDomain.java

@@ -0,0 +1,43 @@
+package com.qmth.themis.business.domain;
+
+import java.io.Serializable;
+
+/** 
+* @Description: 客户端 config
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/11/4 
+*/ 
+public class ClientDomain implements Serializable {
+
+    String version;
+
+    Integer value;
+
+    String url;
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    public void setValue(Integer value) {
+        this.value = value;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+}

+ 16 - 6
themis-business/src/main/java/com/qmth/themis/business/domain/TencentYunDomain.java

@@ -4,18 +4,28 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
-* @Description: 腾讯云 domain
-* @Param:  
-* @return:  
-* @Author: wangliang
-* @Date: 2020/8/21 
-*/ 
+ * @Description: 腾讯云 domain
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/21
+ */
 public class TencentYunDomain implements Serializable {
 public class TencentYunDomain implements Serializable {
 
 
     private String appId;
     private String appId;
     private String key;
     private String key;
     private List urls;
     private List urls;
 
 
+    public TencentYunDomain() {
+
+    }
+
+    public TencentYunDomain(String appId, String key, List urls) {
+        this.appId = appId;
+        this.key = key;
+        this.urls = urls;
+    }
+
     public List getUrls() {
     public List getUrls() {
         return urls;
         return urls;
     }
     }

+ 31 - 0
themis-business/src/main/java/com/qmth/themis/business/domain/WxappDomain.java

@@ -0,0 +1,31 @@
+package com.qmth.themis.business.domain;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 微信app config
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/11/4
+ */
+public class WxappDomain implements Serializable {
+
+    String url;
+
+    public WxappDomain() {
+
+    }
+
+    public WxappDomain(String url) {
+        this.url = url;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+}

+ 24 - 28
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamPaperServiceImpl.java

@@ -1,28 +1,11 @@
 package com.qmth.themis.business.service.impl;
 package com.qmth.themis.business.service.impl;
 
 
-import java.io.File;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
 import com.qmth.themis.business.cache.bean.ObjectiveAnswerCacheBean;
 import com.qmth.themis.business.cache.bean.ObjectiveAnswerCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TEExamPaperMapper;
 import com.qmth.themis.business.dao.TEExamPaperMapper;
@@ -31,6 +14,16 @@ import com.qmth.themis.business.service.TEExamPaperService;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.FileUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.*;
 
 
 /**
 /**
  * @Description: 考试试卷 服务实现类
  * @Description: 考试试卷 服务实现类
@@ -42,7 +35,7 @@ import com.qmth.themis.common.util.FileUtil;
 @Service
 @Service
 public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExamPaper> implements TEExamPaperService {
 public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExamPaper> implements TEExamPaperService {
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
     @Resource
     @Resource
     TEExamPaperMapper teExamPaperMapper;
     TEExamPaperMapper teExamPaperMapper;
 
 
@@ -123,6 +116,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
         ret.setPaperViewPath(ep.getPaperViewPath());
         ret.setPaperViewPath(ep.getPaperViewPath());
         return ret;
         return ret;
     }
     }
+
     /**
     /**
      * 删除客观题标答缓存
      * 删除客观题标答缓存
      *
      *
@@ -133,6 +127,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
     public void deleteObjectiveAnswerCacheBean(Long paperId) {
     public void deleteObjectiveAnswerCacheBean(Long paperId) {
 
 
     }
     }
+
     @Cacheable(value = "objective_answer", key = "#paperId", unless = "#result == null")
     @Cacheable(value = "objective_answer", key = "#paperId", unless = "#result == null")
     @Override
     @Override
     public Map<String, ObjectiveAnswerCacheBean> getObjectiveAnswerCacheBean(Long paperId) {
     public Map<String, ObjectiveAnswerCacheBean> getObjectiveAnswerCacheBean(Long paperId) {
@@ -140,11 +135,11 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
         if (ep == null) {
         if (ep == null) {
             return null;
             return null;
         }
         }
-        if(StringUtils.isBlank(ep.getAnswerPath())) {//没有答案文件
-        	return null;
+        if (StringUtils.isBlank(ep.getAnswerPath())) {//没有答案文件
+            return null;
         }
         }
-        String structUrl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath());
-        String answerUrl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getAnswerPath());
+        String structUrl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getStructPath());
+        String answerUrl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getAnswerPath());
         String tempDir = SystemConstant.TEMP_FILES_DIR;
         String tempDir = SystemConstant.TEMP_FILES_DIR;
         String dir = tempDir + "/" + uuid() + "/";
         String dir = tempDir + "/" + uuid() + "/";
         File dfile = new File(dir);
         File dfile = new File(dir);
@@ -245,7 +240,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
     @Transactional
     @Transactional
     @Override
     @Override
     public void savePaperWeight(Map<Long, Double> map) {
     public void savePaperWeight(Map<Long, Double> map) {
-    	TEExamPaperService examPaperService = SpringContextHolder.getBean(TEExamPaperService.class);
+        TEExamPaperService examPaperService = SpringContextHolder.getBean(TEExamPaperService.class);
         for (Long id : map.keySet()) {
         for (Long id : map.keySet()) {
             teExamPaperMapper.updateWeight(id, map.get(id));
             teExamPaperMapper.updateWeight(id, map.get(id));
             examPaperService.deleteExamPaperCacheBean(id);
             examPaperService.deleteExamPaperCacheBean(id);
@@ -253,7 +248,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
             examPaperService.deletePaperStructCacheBean(id);
             examPaperService.deletePaperStructCacheBean(id);
         }
         }
     }
     }
-    
+
     /**
     /**
      * 删除试卷结构缓存
      * 删除试卷结构缓存
      *
      *
@@ -264,6 +259,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
     public void deletePaperStructCacheBean(Long paperId) {
     public void deletePaperStructCacheBean(Long paperId) {
 
 
     }
     }
+
     @Cacheable(value = "paper_struct", key = "#paperId", unless = "#result == null")
     @Cacheable(value = "paper_struct", key = "#paperId", unless = "#result == null")
     @Override
     @Override
     public Map<String, Integer> getPaperStructCacheBean(Long paperId) {
     public Map<String, Integer> getPaperStructCacheBean(Long paperId) {
@@ -271,10 +267,10 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
         if (ep == null) {
         if (ep == null) {
             return null;
             return null;
         }
         }
-        if(StringUtils.isBlank(ep.getStructPath())) {//没有试卷结构文件
-        	return null;
+        if (StringUtils.isBlank(ep.getStructPath())) {//没有试卷结构文件
+            return null;
         }
         }
-        String structUrl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath());
+        String structUrl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getStructPath());
         String tempDir = SystemConstant.TEMP_FILES_DIR;
         String tempDir = SystemConstant.TEMP_FILES_DIR;
         String dir = tempDir + "/" + uuid() + "/";
         String dir = tempDir + "/" + uuid() + "/";
         File dfile = new File(dir);
         File dfile = new File(dir);
@@ -288,7 +284,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
             FileUtil.deleteFolder(dir);
             FileUtil.deleteFolder(dir);
         }
         }
     }
     }
-    
+
     private Map<String, Integer> buildPaperStructCache(String structStr) {
     private Map<String, Integer> buildPaperStructCache(String structStr) {
         Map<String, Integer> map = new LinkedHashMap<String, Integer>();
         Map<String, Integer> map = new LinkedHashMap<String, Integer>();
         JSONObject structJson = JSONObject.parseObject(structStr);
         JSONObject structJson = JSONObject.parseObject(structStr);

+ 13 - 14
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -11,7 +11,6 @@ import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.ExamingDataCacheUtil;
 import com.qmth.themis.business.cache.ExamingDataCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.*;
 import com.qmth.themis.business.cache.bean.*;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TEExamMapper;
 import com.qmth.themis.business.dao.TEExamMapper;
@@ -84,7 +83,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
     RedisUtil redisUtil;
     RedisUtil redisUtil;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     MqDtoService mqDtoService;
     MqDtoService mqDtoService;
@@ -244,11 +243,11 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         (ec.getObjectiveShuffle() == null || ec.getObjectiveShuffle().intValue() == 0 ? false : true));
                         (ec.getObjectiveShuffle() == null || ec.getObjectiveShuffle().intValue() == 0 ? false : true));
                 prepare.setOptionShuffle(
                 prepare.setOptionShuffle(
                         (ec.getOptionShuffle() == null || ec.getOptionShuffle().intValue() == 0 ? false : true));
                         (ec.getOptionShuffle() == null || ec.getOptionShuffle().intValue() == 0 ? false : true));
-                String paperurl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getPaperPath());
-                String structurl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath());
+                String paperurl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getPaperPath());
+                String structurl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getStructPath());
                 prepare.setPaperUrl(paperurl);
                 prepare.setPaperUrl(paperurl);
                 prepare.setStructUrl(structurl);
                 prepare.setStructUrl(structurl);
-                prepare.setMonitorAppId(systemConfig.getProperty("tencentyun.sdk.appId"));
+                prepare.setMonitorAppId(tencentYunUtil.getTencentYunDomain().getAppId());
                 prepare.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
                 prepare.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
                 prepare.setMonitorUserId("s_" + tbSession.getId());
                 prepare.setMonitorUserId("s_" + tbSession.getId());
                 prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
                 prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
@@ -328,11 +327,11 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                 (ec.getObjectiveShuffle() == null || ec.getObjectiveShuffle().intValue() == 0 ? false : true));
                 (ec.getObjectiveShuffle() == null || ec.getObjectiveShuffle().intValue() == 0 ? false : true));
         prepare.setOptionShuffle(
         prepare.setOptionShuffle(
                 (ec.getOptionShuffle() == null || ec.getOptionShuffle().intValue() == 0 ? false : true));
                 (ec.getOptionShuffle() == null || ec.getOptionShuffle().intValue() == 0 ? false : true));
-        String paperurl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getPaperPath());
-        String structurl = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath());
+        String paperurl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getPaperPath());
+        String structurl = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getStructPath());
         prepare.setPaperUrl(paperurl);
         prepare.setPaperUrl(paperurl);
         prepare.setStructUrl(structurl);
         prepare.setStructUrl(structurl);
-        prepare.setMonitorAppId(systemConfig.getProperty("tencentyun.sdk.appId"));
+        prepare.setMonitorAppId(tencentYunUtil.getTencentYunDomain().getAppId());
         prepare.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
         prepare.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
         prepare.setMonitorUserId("s_" + tbSession.getId());
         prepare.setMonitorUserId("s_" + tbSession.getId());
         prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
         prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
@@ -717,8 +716,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                 throw new BusinessException("文件md5不一致");
                 throw new BusinessException("文件md5不一致");
             }
             }
             in = file.getInputStream();
             in = file.getInputStream();
-            OssUtil.ossUploadStream(systemConfig.getOssEnv(3), filePath, in);
-            String url = systemConfig.getProperty("aliyun.oss.privateUrl") + File.separator + filePath;
+            OssUtil.ossUploadStream(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, in);
+            String url = ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + File.separator + filePath;
             ExamFileUploadBean ret = new ExamFileUploadBean();
             ExamFileUploadBean ret = new ExamFileUploadBean();
             ret.setUrl(url);
             ret.setUrl(url);
             ret.setUploadTime(System.currentTimeMillis());
             ret.setUploadTime(System.currentTimeMillis());
@@ -785,11 +784,11 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         }
         }
         ret = new ExamResumeBean();
         ret = new ExamResumeBean();
         ret.setDurationSeconds(ExamRecordCacheUtil.getDurationSeconds(recordId));
         ret.setDurationSeconds(ExamRecordCacheUtil.getDurationSeconds(recordId));
-        ret.setPaperUrl(OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getPaperPath()));
-        ret.setStructUrl(OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), ep.getStructPath()));
+        ret.setPaperUrl(OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getPaperPath()));
+        ret.setStructUrl(OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), ep.getStructPath()));
         ret.setHasAudio((ep.getHasAudio() != null && ep.getHasAudio().intValue() == 1 ? true : false));
         ret.setHasAudio((ep.getHasAudio() != null && ep.getHasAudio().intValue() == 1 ? true : false));
         ret.setAudioPlayCount(ep.getAudioPlayCount());
         ret.setAudioPlayCount(ep.getAudioPlayCount());
-        ret.setMonitorAppId(systemConfig.getProperty("tencentyun.sdk.appId"));
+        ret.setMonitorAppId(tencentYunUtil.getTencentYunDomain().getAppId());
         ret.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
         ret.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
         ret.setMonitorUserId("s_" + tbSession.getId());
         ret.setMonitorUserId("s_" + tbSession.getId());
         ret.setMonitorUserSig(tencentYunUtil.getSign(ret.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
         ret.setMonitorUserSig(tencentYunUtil.getSign(ret.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
@@ -1244,7 +1243,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             String reportFilePath = "file/" + sdf.format(new Date()) + "/" + uuid() + SystemConstant.TXT_PREFIX;
             String reportFilePath = "file/" + sdf.format(new Date()) + "/" + uuid() + SystemConstant.TXT_PREFIX;
             json.put("path", reportFilePath);
             json.put("path", reportFilePath);
             json.put("type", SystemConstant.OSS);
             json.put("type", SystemConstant.OSS);
-            OssUtil.ossUploadContent(systemConfig.getOssEnv(3), reportFilePath, e.getMessage());
+            OssUtil.ossUploadContent(ossUtil.getAliYunOssPrivateDomain().getMap(), reportFilePath, e.getMessage());
             task.setReportFilePath(json.toJSONString());
             task.setReportFilePath(json.toJSONString());
         } finally {
         } finally {
             redisUtil.releaseLock(lockKey);
             redisUtil.releaseLock(lockKey);

+ 3 - 10
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEMobileServiceImpl.java

@@ -10,7 +10,6 @@ import com.qmth.themis.business.cache.MobileAuthCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamStudentAnswerCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentAnswerCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
@@ -19,10 +18,7 @@ import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.TEExamStudentService;
 import com.qmth.themis.business.service.TEExamStudentService;
 import com.qmth.themis.business.service.TEMobileService;
 import com.qmth.themis.business.service.TEMobileService;
-import com.qmth.themis.business.util.RedisUtil;
-import com.qmth.themis.business.util.ServletUtil;
-import com.qmth.themis.business.util.SessionUtil;
-import com.qmth.themis.business.util.TencentYunUtil;
+import com.qmth.themis.business.util.*;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Source;
 import com.qmth.themis.common.enums.Source;
@@ -53,9 +49,6 @@ public class TEMobileServiceImpl implements TEMobileService {
     @Resource
     @Resource
     MqDtoService mqDtoService;
     MqDtoService mqDtoService;
 
 
-    @Resource
-    SystemConfig systemConfig;
-
     @Override
     @Override
     public MobileAuthorizationBean authorization(MobileAuthorizationParamBean param) throws NoSuchAlgorithmException {
     public MobileAuthorizationBean authorization(MobileAuthorizationParamBean param) throws NoSuchAlgorithmException {
         MobileModeEnum mode = MobileModeEnum.valueOf(param.getMode().toUpperCase());
         MobileModeEnum mode = MobileModeEnum.valueOf(param.getMode().toUpperCase());
@@ -117,7 +110,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         }
         }
         MobileAuthorizationMonitorBean ret = new MobileAuthorizationMonitorBean();
         MobileAuthorizationMonitorBean ret = new MobileAuthorizationMonitorBean();
         ret.setRecordId(recordId);
         ret.setRecordId(recordId);
-        ret.setMonitorAppId(systemConfig.getProperty("tencentyun.sdk.appId"));
+        ret.setMonitorAppId(tencentYunUtil.getTencentYunDomain().getAppId());
         ret.setMonitorKey(monitorKey);
         ret.setMonitorKey(monitorKey);
         ret.setMonitorVideoSource(monitorVideoSource);
         ret.setMonitorVideoSource(monitorVideoSource);
         ret.setMonitorAudioEnable(monitorAudioEnable);
         ret.setMonitorAudioEnable(monitorAudioEnable);
@@ -149,7 +142,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         Integer mainNumber = MobileAuthCacheUtil.getMainNumber(mode, code);
         Integer mainNumber = MobileAuthCacheUtil.getMainNumber(mode, code);
         Integer subNumber = MobileAuthCacheUtil.getSubNumber(mode, code);
         Integer subNumber = MobileAuthCacheUtil.getSubNumber(mode, code);
         Integer subIndex = MobileAuthCacheUtil.getSubIndex(mode, code);
         Integer subIndex = MobileAuthCacheUtil.getSubIndex(mode, code);
-        String questionNumber=MobileAuthCacheUtil.getQuestionNumber(mode, code);
+        String questionNumber = MobileAuthCacheUtil.getQuestionNumber(mode, code);
         if (MobileAuthCacheUtil.getMode(mode, code) == null) {
         if (MobileAuthCacheUtil.getMode(mode, code) == null) {
             throw new BusinessException(ExceptionResultEnum.QR_CODE_EXPIRE);
             throw new BusinessException(ExceptionResultEnum.QR_CODE_EXPIRE);
         }
         }

+ 331 - 344
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEOpenServiceImpl.java

@@ -1,20 +1,5 @@
 package com.qmth.themis.business.service.impl;
 package com.qmth.themis.business.service.impl;
 
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -26,366 +11,368 @@ import com.qmth.themis.business.bean.backend.OpenRecordAnswerBean;
 import com.qmth.themis.business.bean.backend.OpenRecordNeedMarkBean;
 import com.qmth.themis.business.bean.backend.OpenRecordNeedMarkBean;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
 import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
-import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
 import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
 import com.qmth.themis.business.enums.RecordSelectStrategyEnum;
 import com.qmth.themis.business.enums.RecordSelectStrategyEnum;
-import com.qmth.themis.business.service.TEExamCourseService;
-import com.qmth.themis.business.service.TEExamPaperService;
-import com.qmth.themis.business.service.TEExamService;
-import com.qmth.themis.business.service.TEExamStudentService;
-import com.qmth.themis.business.service.TEOpenService;
-import com.qmth.themis.business.service.TOeExamAnswerService;
-import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.business.service.*;
+import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.FileUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 public class TEOpenServiceImpl implements TEOpenService {
 public class TEOpenServiceImpl implements TEOpenService {
 
 
     @Resource
     @Resource
     TEExamService examService;
     TEExamService examService;
-    
+
     @Resource
     @Resource
     TEExamCourseService examCourseService;
     TEExamCourseService examCourseService;
-    
+
     @Resource
     @Resource
     TEExamPaperService examPaperService;
     TEExamPaperService examPaperService;
-    
+
     @Resource
     @Resource
     TOeExamRecordService examRecordService;
     TOeExamRecordService examRecordService;
-    
+
     @Resource
     @Resource
     TOeExamAnswerService examAnswerService;
     TOeExamAnswerService examAnswerService;
-    
+
     @Resource
     @Resource
     TEExamStudentService examStudentService;
     TEExamStudentService examStudentService;
-	
-	
-	@Override
-	public List<OpenExamBean> examQueryPage(Long examId, String examCode, int pageNumber, int pageSize) {
-		Page<OpenExamBean> ipage = new Page<>(pageNumber, pageSize);
+
+    @Resource
+    OssUtil ossUtil;
+
+    @Override
+    public List<OpenExamBean> examQueryPage(Long examId, String examCode, int pageNumber, int pageSize) {
+        Page<OpenExamBean> ipage = new Page<>(pageNumber, pageSize);
         ipage.addOrder(OrderItem.desc("t.id"));
         ipage.addOrder(OrderItem.desc("t.id"));
-        IPage<OpenExamBean> ret=examService.examQueryForOpen(ipage, examId, examCode);
-		return ret.getRecords();
-	}
+        IPage<OpenExamBean> ret = examService.examQueryForOpen(ipage, examId, examCode);
+        return ret.getRecords();
+    }
 
 
 
 
-	@Override
-	public List<OpenExamCourseBean> examCourseQueryPage(Long examId, String courseCode, Boolean hasPaper,
-			int pageNumber, int pageSize) {
-		Page<OpenExamCourseBean> ipage = new Page<>(pageNumber, pageSize);
+    @Override
+    public List<OpenExamCourseBean> examCourseQueryPage(Long examId, String courseCode, Boolean hasPaper,
+                                                        int pageNumber, int pageSize) {
+        Page<OpenExamCourseBean> ipage = new Page<>(pageNumber, pageSize);
         ipage.addOrder(OrderItem.desc("t.id"));
         ipage.addOrder(OrderItem.desc("t.id"));
-        IPage<OpenExamCourseBean> ret=examCourseService.examCourseQueryForOpen(ipage, examId,courseCode, hasPaper);
-		return ret.getRecords();
-	}
+        IPage<OpenExamCourseBean> ret = examCourseService.examCourseQueryForOpen(ipage, examId, courseCode, hasPaper);
+        return ret.getRecords();
+    }
+
+
+    @Override
+    public JSONObject examPaperDetail(Long paperId, String filter) {
+        String tempDir = SystemConstant.TEMP_FILES_DIR;
+        String dir = tempDir + "/" + uuid() + "/";
+        File dfile = new File(dir);
+
+        try {
+            ExamPaperCacheBean paper = examPaperService.getExamPaperCacheBean(paperId);
+            if (paper == null) {
+                throw new BusinessException("未找到试卷信息");
+            }
+            checkExam(paper.getExamId());
+            dfile.mkdirs();
+            String paperPath = paper.getPaperViewPath();
+            String anwserPath = paper.getAnswerPath();
+            File paperFile = new File(dir + uuid() + ".json");
+            File anwserFile = new File(dir + uuid() + ".json");
+            FileUtil.saveUrlAsFile(ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + "/" + paperPath, paperFile);
+            FileUtil.saveUrlAsFile(ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + "/" + anwserPath, anwserFile);
+            JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(anwserFile));
+            JSONArray answerdetails = answerJson.getJSONArray("details");
+            JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
+            structJson.put("id", paperId);
+            structJson.put("code", paper.getCode());
+            JSONArray structdetails = structJson.getJSONArray("details");
+            for (int i = 0; i < answerdetails.size(); i++) {
+                JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
+                JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
+                for (int j = 0; j < structdetailquestions.size(); j++) {
+                    JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
+                    JSONObject structquestion = structdetailquestions.getJSONObject(j);
+                    if ("objective".equals(filter)) {
+                        if (structquestion.getInteger("structType").intValue() == 1
+                                || structquestion.getInteger("structType").intValue() == 2
+                                || structquestion.getInteger("structType").intValue() == 3) {
+                            if (structquestion.getInteger("structType").intValue() == 3) {
+                                structquestion.put("answer", answerquestion.getBoolean("answer"));
+                            } else {
+                                structquestion.put("answer", answerquestion.getJSONArray("answer"));
+                            }
+                        } else {
+                            if (structquestion.getInteger("structType").intValue() == 6) {
+                                JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
+                                JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                                for (int k = 0; k < structsubQuestions.size(); k++) {
+                                    JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
+                                    JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                                    if (structsubquestion.getInteger("structType").intValue() == 1
+                                            || structsubquestion.getInteger("structType").intValue() == 2
+                                            || structsubquestion.getInteger("structType").intValue() == 3) {
+                                        if (structsubquestion.getInteger("structType").intValue() == 3) {
+                                            structsubquestion.put("answer", answersubquestion.getBoolean("answer"));
+                                        } else {
+                                            structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
+                                        }
+                                    } else {
+                                        structsubQuestions.remove(k);
+                                        k--;
+                                    }
+                                }
+                            } else {
+                                structdetailquestions.remove(j);
+                                j--;
+                            }
+                        }
+
+                    } else if ("subjective".equals(filter)) {
+                        if (structquestion.getInteger("structType").intValue() != 1
+                                && structquestion.getInteger("structType").intValue() != 2
+                                && structquestion.getInteger("structType").intValue() != 3) {
+                            structquestion.put("answer", answerquestion.getJSONArray("answer"));
+                        } else {
+                            if (structquestion.getInteger("structType").intValue() == 6) {
+                                JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
+                                JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                                for (int k = 0; k < structsubQuestions.size(); k++) {
+                                    JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
+                                    JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                                    if (structsubquestion.getInteger("structType").intValue() != 1
+                                            && structsubquestion.getInteger("structType").intValue() != 2
+                                            && structsubquestion.getInteger("structType").intValue() != 3) {
+                                        structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
+                                    } else {
+                                        structsubQuestions.remove(k);
+                                        k--;
+                                    }
+                                }
+                            } else {
+                                structdetailquestions.remove(j);
+                                j--;
+                            }
+                        }
+                    } else {
+                        if (structquestion.getInteger("structType").intValue() != 6) {
+                            if (structquestion.getInteger("structType").intValue() == 3) {
+                                structquestion.put("answer", answerquestion.getBoolean("answer"));
+                            } else {
+                                structquestion.put("answer", answerquestion.getJSONArray("answer"));
+                            }
+                        } else {
+                            JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
+                            JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                            for (int k = 0; k < structsubQuestions.size(); k++) {
+                                JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
+                                JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                                if (structsubquestion.getInteger("structType").intValue() == 3) {
+                                    structsubquestion.put("answer", answersubquestion.getBoolean("answer"));
+                                } else {
+                                    structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
+                                }
+                            }
+                        }
+                    }
+
+                }
+            }
+            return structJson;
+        } finally {
+            FileUtil.deleteFolder(dir);
+        }
+    }
+
+    private String uuid() {
+        return UUID.randomUUID().toString().replaceAll("-", "");
+    }
 
 
+    private void checkExam(Long examId) {
+        TEExam exam = examService.getById(examId);
+        if (exam == null) {
+            throw new BusinessException("未找到考试信息");
+        }
+        if (exam.getEnable() == null || exam.getEnable().intValue() == 0) {
+            throw new BusinessException("考试批次已禁用");
+        }
+        if (!InvigilateMonitorStatusEnum.FINISHED.equals(exam.getMonitorStatus())) {
+            throw new BusinessException("考试批次监考未结束");
+        }
+        List<TEExamCourse> courses = examCourseService.findByExamId(examId);
+        if (courses == null || courses.size() == 0) {
+            throw new BusinessException("考试批次下没有课程");
+        }
+        for (TEExamCourse course : courses) {
+            if (course.getHasAnswer() == null || course.getHasAnswer().intValue() == 0) {
+                throw new BusinessException("考试批次下标答未齐全");
+            }
+        }
+    }
 
 
-	@Override
-	public JSONObject examPaperDetail(Long paperId, String filter) {
-		String tempDir = SystemConstant.TEMP_FILES_DIR;
-		String dir = tempDir + "/" + uuid() + "/";
-		File dfile = new File(dir);
-		
-		try {
-			ExamPaperCacheBean paper=examPaperService.getExamPaperCacheBean(paperId);
-			if(paper==null) {
-				throw new BusinessException("未找到试卷信息");
-			}
-			checkExam(paper.getExamId());
-			dfile.mkdirs();
-			String paperPath = paper.getPaperViewPath();
-			String anwserPath = paper.getAnswerPath();
-			SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-			File paperFile = new File(dir + uuid() + ".json");
-			File anwserFile = new File(dir + uuid() + ".json");
-			FileUtil.saveUrlAsFile(systemConfig.getProperty("aliyun.oss.privateUrl") + "/"+paperPath, paperFile);
-			FileUtil.saveUrlAsFile(systemConfig.getProperty("aliyun.oss.privateUrl") + "/"+anwserPath, anwserFile);
-			JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(anwserFile));
-			JSONArray answerdetails = answerJson.getJSONArray("details");
-			JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
-			structJson.put("id", paperId);
-			structJson.put("code", paper.getCode());
-			JSONArray structdetails = structJson.getJSONArray("details");
-			for (int i = 0; i < answerdetails.size(); i++) {
-				JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
-				JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
-				for (int j = 0; j < structdetailquestions.size(); j++) {
-					JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
-					JSONObject structquestion = structdetailquestions.getJSONObject(j);
-					if("objective".equals(filter)) {
-						if (structquestion.getInteger("structType").intValue() == 1
-								|| structquestion.getInteger("structType").intValue() == 2
-									|| structquestion.getInteger("structType").intValue() == 3) {
-							if(structquestion.getInteger("structType").intValue() == 3) {
-								structquestion.put("answer", answerquestion.getBoolean("answer"));
-							}else {
-								structquestion.put("answer", answerquestion.getJSONArray("answer"));
-							}
-						}else {
-							if (structquestion.getInteger("structType").intValue() == 6) {
-								JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
-								JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-								for (int k = 0; k < structsubQuestions.size(); k++) {
-									JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
-									JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-									if (structsubquestion.getInteger("structType").intValue() == 1
-											|| structsubquestion.getInteger("structType").intValue() == 2
-												|| structsubquestion.getInteger("structType").intValue() == 3) {
-										if (structsubquestion.getInteger("structType").intValue() == 3) {
-											structsubquestion.put("answer", answersubquestion.getBoolean("answer"));
-										}else {
-											structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
-										}
-									}else {
-										structsubQuestions.remove(k);
-										k--;
-									}
-								}
-							}else {
-								structdetailquestions.remove(j);
-								j--;
-							}
-						}
-						
-					}else if("subjective".equals(filter)) {
-						if (structquestion.getInteger("structType").intValue() != 1
-								&& structquestion.getInteger("structType").intValue() != 2
-									&& structquestion.getInteger("structType").intValue() != 3) {
-							structquestion.put("answer", answerquestion.getJSONArray("answer"));
-						}else {
-							if (structquestion.getInteger("structType").intValue() == 6) {
-								JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
-								JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-								for (int k = 0; k < structsubQuestions.size(); k++) {
-									JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
-									JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-									if (structsubquestion.getInteger("structType").intValue() != 1
-											&& structsubquestion.getInteger("structType").intValue() != 2
-												&& structsubquestion.getInteger("structType").intValue() != 3) {
-										structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
-									}else {
-										structsubQuestions.remove(k);
-										k--;
-									}
-								}
-							}else {
-								structdetailquestions.remove(j);
-								j--;
-							}
-						}
-					}else {
-						if (structquestion.getInteger("structType").intValue() != 6) {
-							if(structquestion.getInteger("structType").intValue() == 3) {
-								structquestion.put("answer", answerquestion.getBoolean("answer"));
-							}else {
-								structquestion.put("answer", answerquestion.getJSONArray("answer"));
-							}
-						}else {
-							JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
-							JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-							for (int k = 0; k < structsubQuestions.size(); k++) {
-								JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
-								JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-								if (structsubquestion.getInteger("structType").intValue() == 3) {
-									structsubquestion.put("answer", answersubquestion.getBoolean("answer"));
-								}else {
-									structsubquestion.put("answer", answersubquestion.getJSONArray("answer"));
-								}
-							}
-						}
-					}
-					
-				}
-			}
-			return structJson;
-		} finally {
-			FileUtil.deleteFolder(dir);
-		}
-	}
-	private String uuid() {
-		return UUID.randomUUID().toString().replaceAll("-", "");
-	}
-	
-	private void checkExam(Long examId) {
-		TEExam exam=examService.getById(examId);
-		if(exam==null) {
-			throw new BusinessException("未找到考试信息");
-		}
-		if(exam.getEnable()==null||exam.getEnable().intValue()==0) {
-			throw new BusinessException("考试批次已禁用");
-		}
-		if(!InvigilateMonitorStatusEnum.FINISHED.equals(exam.getMonitorStatus())) {
-			throw new BusinessException("考试批次监考未结束");
-		}
-		List<TEExamCourse> courses=examCourseService.findByExamId(examId);
-		if(courses==null||courses.size()==0) {
-			throw new BusinessException("考试批次下没有课程");
-		}
-		for(TEExamCourse course:courses) {
-			if(course.getHasAnswer()==null||course.getHasAnswer().intValue()==0) {
-				throw new BusinessException("考试批次下标答未齐全");
-			}
-		}
-	}
 
 
+    @Override
+    public JSONArray examRecordNeedMark(Long examId, String courseCode, Long idGt,
+                                        Integer count) {
+        checkExam(examId);
+        List<OpenRecordNeedMarkBean> list;
+        for (; ; ) {
+            List<Long> examStudentIds = examStudentService.findExamStudentIdsNeedMark(examId, courseCode, idGt, count);
+            if (examStudentIds == null || examStudentIds.size() == 0) {
+                return null;
+            }
+            list = findExamRecordNeedMark(examId, examStudentIds);
+            if (list == null || list.size() == 0) {
+                idGt = examStudentIds.get(examStudentIds.size() - 1);
+            } else {
+                break;
+            }
+        }
+        List<Long> ids = list.stream().map(dto -> dto.getExamRecordId()).collect(Collectors.toList());
+        List<OpenRecordAnswerBean> answers = examAnswerService.findByRecordIds(ids);
+        if (answers != null && answers.size() > 0) {
+            for (int i = 0; i < answers.size(); i++) {//剔除客观题答案
+                OpenRecordAnswerBean answer = answers.get(i);
+                Map<String, Integer> struct = examPaperService.getPaperStructCacheBean(answer.getPaperId());
+                Integer type = struct.get(RedisKeyHelper.examAnswerHashKey(answer.getMainNumber(), answer.getSubNumber(), answer.getSubIndex()));
+                if (type == 1 || type == 2 || type == 3) {
+                    answers.remove(i);
+                    i--;
+                }
+            }
+        }
+        if (answers != null && answers.size() > 0) {
+            Map<Long, Integer> map = new HashMap<>();
+            for (int i = 0; i < list.size(); i++) {
+                map.put(list.get(i).getExamRecordId(), i);
+            }
+            for (OpenRecordAnswerBean anwser : answers) {
+                OpenRecordNeedMarkBean mark = list.get(map.get(anwser.getRecordId()));
+                List<OpenRecordAnswerBean> ans = mark.getAnswers();
+                if (ans == null) {
+                    ans = new ArrayList<OpenRecordAnswerBean>();
+                    mark.setAnswers(ans);
+                }
+                ans.add(anwser);
+            }
+        }
+        JSONArray ja = JSONArray.parseArray(JSONArray.toJSONString(list));
+        for (int i = 0; i < ja.size(); i++) {
+            JSONObject job = ja.getJSONObject(i);
+            JSONArray answersJa = job.getJSONArray("answers");
+            if (answersJa != null) {
+                for (int j = 0; j < answersJa.size(); j++) {
+                    JSONObject answersJob = answersJa.getJSONObject(j);
+                    answersJob.remove("recordId");
+                    answersJob.remove("paperId");
+                    String answerStr = answersJob.getString("answer");
+                    if (StringUtils.isNotBlank(answerStr)) {
+                        if (answerStr.toLowerCase().startsWith("true") || answerStr.toLowerCase().startsWith("false")) {
+                            answersJob.put("answer", Boolean.getBoolean(answerStr.replaceAll("\n", "")));
+                        } else {
+                            answersJob.put("answer", answersJob.getJSONArray("answer"));
+                        }
+                    }
+                }
+            }
+        }
+        return ja;
+    }
 
 
-	@Override
-	public JSONArray examRecordNeedMark(Long examId, String courseCode, Long idGt,
-			Integer count) {
-		checkExam(examId);
-		List<OpenRecordNeedMarkBean> list;
-		for(;;) {
-			List<Long> examStudentIds=examStudentService.findExamStudentIdsNeedMark(examId,courseCode,idGt,count);
-			if(examStudentIds==null||examStudentIds.size()==0) {
-				return null;
-			}
-			list=findExamRecordNeedMark(examId,examStudentIds);
-			if(list==null||list.size()==0) {
-				idGt=examStudentIds.get(examStudentIds.size()-1);
-			}else {
-				break;
-			}
-		}
-		List<Long> ids = list.stream().map(dto -> dto.getExamRecordId()).collect(Collectors.toList());
-		List<OpenRecordAnswerBean> answers=examAnswerService.findByRecordIds(ids);
-		if(answers!=null&&answers.size()>0) {
-			for(int i=0;i<answers.size();i++) {//剔除客观题答案
-				OpenRecordAnswerBean answer=answers.get(i);
-				Map<String, Integer> struct=examPaperService.getPaperStructCacheBean(answer.getPaperId());
-				Integer type=struct.get(RedisKeyHelper.examAnswerHashKey(answer.getMainNumber(), answer.getSubNumber(), answer.getSubIndex()));
-				if(type==1||type==2||type==3) {
-					answers.remove(i);
-					i--;
-				}
-			}
-		}
-		if(answers!=null&&answers.size()>0) {
-			Map<Long,Integer> map=new HashMap<>();
-			for(int i=0;i<list.size();i++) {
-				map.put(list.get(i).getExamRecordId(), i);
-			}
-			for(OpenRecordAnswerBean anwser:answers) {
-				OpenRecordNeedMarkBean mark=list.get(map.get(anwser.getRecordId()));
-				List<OpenRecordAnswerBean> ans=mark.getAnswers();
-				if(ans==null) {
-					ans=new ArrayList<OpenRecordAnswerBean>();
-					mark.setAnswers(ans);
-				}
-				ans.add(anwser);
-			}
-		}
-		JSONArray  ja = JSONArray.parseArray(JSONArray.toJSONString(list));
-		for(int i=0;i<ja.size();i++) {
-			JSONObject job=ja.getJSONObject(i);
-			JSONArray answersJa=job.getJSONArray("answers");
-			if(answersJa!=null) {
-				for(int j=0;j<answersJa.size();j++) {
-					JSONObject answersJob=answersJa.getJSONObject(j);
-					answersJob.remove("recordId");
-					answersJob.remove("paperId");
-					String answerStr=answersJob.getString("answer");
-					if(StringUtils.isNotBlank(answerStr)) {
-						if(answerStr.toLowerCase().startsWith("true")||answerStr.toLowerCase().startsWith("false")) {
-							answersJob.put("answer", Boolean.getBoolean(answerStr.replaceAll("\n","")));
-						}else {
-							answersJob.put("answer", answersJob.getJSONArray("answer"));
-						}
-					}
-				}
-			}
-		}
-		return ja;
-	}
-	
-	private List<OpenRecordNeedMarkBean> findExamRecordNeedMark(Long examId, List<Long> examStudentIds){
-		List<OpenRecordNeedMarkBean> list=examRecordService.findExamRecordNeedMark(examId,examStudentIds);
-		if(list==null||list.size()==0) {
-			return null;
-		}
-		for(int i=0;i<list.size();i++) {//剔除没有主观题的试卷考试记录
-			ExamPaperCacheBean paper=examPaperService.getExamPaperCacheBean(list.get(i).getPaperId());
-			if(paper.getTotalSubjectiveScore()==0) {
-				list.remove(i);
-				i--;
-			}
-		}
-		if(list==null||list.size()==0) {
-			return null;
-		}
-		TEExam exam=examService.getById(examId);
-		if(RecordSelectStrategyEnum.HIGHEST_TOTAL_SCORE.equals(exam.getRecordSelectStrategy())) {//全阅
-			return list;
-		}else if(RecordSelectStrategyEnum.HIGHEST_OBJECTIVE_SCORE.equals(exam.getRecordSelectStrategy())) {//客观分最高,相同则都阅
-			Map<Long,List<OpenRecordNeedMarkBean>> map=new HashMap<>();
-			for(OpenRecordNeedMarkBean bean:list) {
-				List<OpenRecordNeedMarkBean> temList=map.get(bean.getExamStudentId());
-				if(temList==null) {
-					temList=new ArrayList<OpenRecordNeedMarkBean>();
-					temList.add(bean);
-					map.put(bean.getExamStudentId(), temList);
-				}else {
-					if(temList.get(0).getObjectiveScore()==bean.getObjectiveScore()) {
-						temList.add(bean);
-					}else if(temList.get(0).getObjectiveScore()<bean.getObjectiveScore()) {
-						temList=new ArrayList<OpenRecordNeedMarkBean>();
-						temList.add(bean);
-						map.put(bean.getExamStudentId(), temList);
-					}
-				}
-			}
-			List<OpenRecordNeedMarkBean> ret= new ArrayList<OpenRecordNeedMarkBean>();
-			for(List<OpenRecordNeedMarkBean> tem:map.values()) {
-				for(OpenRecordNeedMarkBean bean:tem) {
-					ret.add(bean);
-				}
-			}
-			Collections.sort(ret, new Comparator<OpenRecordNeedMarkBean>() {
-				@Override
-				public int compare(OpenRecordNeedMarkBean o1, OpenRecordNeedMarkBean o2) {
-					Long c1 = o1.getExamStudentId();
-					Long c2 = o2.getExamStudentId();
-					if (c1 > c2) {
-						return 1;
-					} else if (c1 < c2) {
-						return -1;
-					} else {
-						return 0;
-					}
-				}
+    private List<OpenRecordNeedMarkBean> findExamRecordNeedMark(Long examId, List<Long> examStudentIds) {
+        List<OpenRecordNeedMarkBean> list = examRecordService.findExamRecordNeedMark(examId, examStudentIds);
+        if (list == null || list.size() == 0) {
+            return null;
+        }
+        for (int i = 0; i < list.size(); i++) {//剔除没有主观题的试卷考试记录
+            ExamPaperCacheBean paper = examPaperService.getExamPaperCacheBean(list.get(i).getPaperId());
+            if (paper.getTotalSubjectiveScore() == 0) {
+                list.remove(i);
+                i--;
+            }
+        }
+        if (list == null || list.size() == 0) {
+            return null;
+        }
+        TEExam exam = examService.getById(examId);
+        if (RecordSelectStrategyEnum.HIGHEST_TOTAL_SCORE.equals(exam.getRecordSelectStrategy())) {//全阅
+            return list;
+        } else if (RecordSelectStrategyEnum.HIGHEST_OBJECTIVE_SCORE.equals(exam.getRecordSelectStrategy())) {//客观分最高,相同则都阅
+            Map<Long, List<OpenRecordNeedMarkBean>> map = new HashMap<>();
+            for (OpenRecordNeedMarkBean bean : list) {
+                List<OpenRecordNeedMarkBean> temList = map.get(bean.getExamStudentId());
+                if (temList == null) {
+                    temList = new ArrayList<OpenRecordNeedMarkBean>();
+                    temList.add(bean);
+                    map.put(bean.getExamStudentId(), temList);
+                } else {
+                    if (temList.get(0).getObjectiveScore() == bean.getObjectiveScore()) {
+                        temList.add(bean);
+                    } else if (temList.get(0).getObjectiveScore() < bean.getObjectiveScore()) {
+                        temList = new ArrayList<OpenRecordNeedMarkBean>();
+                        temList.add(bean);
+                        map.put(bean.getExamStudentId(), temList);
+                    }
+                }
+            }
+            List<OpenRecordNeedMarkBean> ret = new ArrayList<OpenRecordNeedMarkBean>();
+            for (List<OpenRecordNeedMarkBean> tem : map.values()) {
+                for (OpenRecordNeedMarkBean bean : tem) {
+                    ret.add(bean);
+                }
+            }
+            Collections.sort(ret, new Comparator<OpenRecordNeedMarkBean>() {
+                @Override
+                public int compare(OpenRecordNeedMarkBean o1, OpenRecordNeedMarkBean o2) {
+                    Long c1 = o1.getExamStudentId();
+                    Long c2 = o2.getExamStudentId();
+                    if (c1 > c2) {
+                        return 1;
+                    } else if (c1 < c2) {
+                        return -1;
+                    } else {
+                        return 0;
+                    }
+                }
 
 
-			});
-			return ret;
-		}else if(RecordSelectStrategyEnum.LATEST.equals(exam.getRecordSelectStrategy())) {//最后一次提交
-			Map<Long,OpenRecordNeedMarkBean> map=new HashMap<>();
-			for(OpenRecordNeedMarkBean bean:list) {
-				OpenRecordNeedMarkBean old=map.get(bean.getExamStudentId());
-				if(old==null||old.getFinishTime()<bean.getFinishTime()) {
-					map.put(bean.getExamStudentId(), bean);
-				}
-			}
-			List<OpenRecordNeedMarkBean> ret= map.values().stream().collect(Collectors.toList());
-			Collections.sort(ret, new Comparator<OpenRecordNeedMarkBean>() {
-				@Override
-				public int compare(OpenRecordNeedMarkBean o1, OpenRecordNeedMarkBean o2) {
-					Long c1 = o1.getExamStudentId();
-					Long c2 = o2.getExamStudentId();
-					if (c1 > c2) {
-						return 1;
-					} else if (c1 < c2) {
-						return -1;
-					} else {
-						return 0;
-					}
-				}
+            });
+            return ret;
+        } else if (RecordSelectStrategyEnum.LATEST.equals(exam.getRecordSelectStrategy())) {//最后一次提交
+            Map<Long, OpenRecordNeedMarkBean> map = new HashMap<>();
+            for (OpenRecordNeedMarkBean bean : list) {
+                OpenRecordNeedMarkBean old = map.get(bean.getExamStudentId());
+                if (old == null || old.getFinishTime() < bean.getFinishTime()) {
+                    map.put(bean.getExamStudentId(), bean);
+                }
+            }
+            List<OpenRecordNeedMarkBean> ret = map.values().stream().collect(Collectors.toList());
+            Collections.sort(ret, new Comparator<OpenRecordNeedMarkBean>() {
+                @Override
+                public int compare(OpenRecordNeedMarkBean o1, OpenRecordNeedMarkBean o2) {
+                    Long c1 = o1.getExamStudentId();
+                    Long c2 = o2.getExamStudentId();
+                    if (c1 > c2) {
+                        return 1;
+                    } else if (c1 < c2) {
+                        return -1;
+                    } else {
+                        return 0;
+                    }
+                }
 
 
-			});
-			return ret;
-		}else {
-			throw new BusinessException("考试批次阅卷类型未定义");
-		}
-	}
+            });
+            return ret;
+        } else {
+            throw new BusinessException("考试批次阅卷类型未定义");
+        }
+    }
 }
 }

+ 4 - 4
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEQrcodeServiceImpl.java

@@ -7,7 +7,6 @@ import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.MobileAuthCacheUtil;
 import com.qmth.themis.business.cache.MobileAuthCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.enums.MobileModeEnum;
 import com.qmth.themis.business.enums.MobileModeEnum;
 import com.qmth.themis.business.enums.MonitorVideoSourceEnum;
 import com.qmth.themis.business.enums.MonitorVideoSourceEnum;
@@ -15,6 +14,7 @@ import com.qmth.themis.business.enums.RoleEnum;
 import com.qmth.themis.business.service.TEExamService;
 import com.qmth.themis.business.service.TEExamService;
 import com.qmth.themis.business.service.TEQrcodeService;
 import com.qmth.themis.business.service.TEQrcodeService;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
+import com.qmth.themis.business.util.WxappUtil;
 import com.qmth.themis.common.enums.Source;
 import com.qmth.themis.common.enums.Source;
 import org.apache.commons.lang3.time.DateUtils;
 import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -34,11 +34,11 @@ public class TEQrcodeServiceImpl implements TEQrcodeService {
     @Resource
     @Resource
     RedisUtil redisUtil;
     RedisUtil redisUtil;
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    WxappUtil wxappUtil;
 
 
     @Override
     @Override
     public QrResponseBean mobileMonitor(QrMobileMonitorParamBean param) throws NoSuchAlgorithmException {
     public QrResponseBean mobileMonitor(QrMobileMonitorParamBean param) throws NoSuchAlgorithmException {
-        String domain = systemConfig.getProperty("wxapp.upload.url");
+        String domain = wxappUtil.getWxappDomain().getUrl();
         String code = uuid();
         String code = uuid();
         MobileModeEnum mode = MobileModeEnum.MOBILE_MONITOR;
         MobileModeEnum mode = MobileModeEnum.MOBILE_MONITOR;
         Set<String> roleCodes = new HashSet<>();
         Set<String> roleCodes = new HashSet<>();
@@ -78,7 +78,7 @@ public class TEQrcodeServiceImpl implements TEQrcodeService {
 
 
     @Override
     @Override
     public QrResponseBean upload(QrUploadParamBean param, MobileModeEnum mode) {
     public QrResponseBean upload(QrUploadParamBean param, MobileModeEnum mode) {
-        String domain = systemConfig.getProperty("wxapp.upload.url");
+        String domain = wxappUtil.getWxappDomain().getUrl();
         String code = uuid();
         String code = uuid();
         MobileAuthCacheUtil.setMode(mode, code);
         MobileAuthCacheUtil.setMode(mode, code);
         MobileAuthCacheUtil.setCode(mode, code);
         MobileAuthCacheUtil.setCode(mode, code);

+ 3 - 4
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEStudentServiceImpl.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.qmth.themis.business.bean.backend.StudentPhotoUploadResponseBean;
 import com.qmth.themis.business.bean.backend.StudentPhotoUploadResponseBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.dao.TEStudentMapper;
 import com.qmth.themis.business.dao.TEStudentMapper;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.response.TEStudentDto;
 import com.qmth.themis.business.dto.response.TEStudentDto;
@@ -40,7 +39,7 @@ public class TEStudentServiceImpl extends ServiceImpl<TEStudentMapper, TEStudent
     TEStudentMapper teStudentMapper;
     TEStudentMapper teStudentMapper;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     RedisUtil redisUtil;
     RedisUtil redisUtil;
@@ -99,8 +98,8 @@ public class TEStudentServiceImpl extends ServiceImpl<TEStudentMapper, TEStudent
             TEStudentCacheDto teStudentCacheDto = gson.fromJson(gson.toJson(student), TEStudentCacheDto.class);
             TEStudentCacheDto teStudentCacheDto = gson.fromJson(gson.toJson(student), TEStudentCacheDto.class);
             redisUtil.setStudent(student.getId(), teStudentCacheDto);
             redisUtil.setStudent(student.getId(), teStudentCacheDto);
             in = file.getInputStream();
             in = file.getInputStream();
-            OssUtil.ossUploadStream(systemConfig.getOssEnv(3), filePath, in);
-            String url = systemConfig.getProperty("aliyun.oss.publicUrl") + File.separator + filePath;
+            OssUtil.ossUploadStream(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, in);
+            String url = ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + File.separator + filePath;
             StudentPhotoUploadResponseBean ret = new StudentPhotoUploadResponseBean();
             StudentPhotoUploadResponseBean ret = new StudentPhotoUploadResponseBean();
             ret.setPhotoUrl(url);
             ret.setPhotoUrl(url);
             return ret;
             return ret;

+ 4 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -9,7 +9,6 @@ import com.qmth.themis.business.cache.ExamActivityRecordCacheUtil;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.*;
 import com.qmth.themis.business.cache.bean.*;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
@@ -78,6 +77,9 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
     @Resource
     @Resource
     TEExamStudentService teExamStudentService;
     TEExamStudentService teExamStudentService;
 
 
+    @Resource
+    OssUtil ossUtil;
+
     /**
     /**
      * 获取考试未完列表
      * 获取考试未完列表
      *
      *
@@ -412,8 +414,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             if (struct != null) {
             if (struct != null) {
                 File structFile = new File(dir + "struct.json");
                 File structFile = new File(dir + "struct.json");
                 FileUtil.saveAsFile(structFile.getAbsolutePath(), struct.getContent());
                 FileUtil.saveAsFile(structFile.getAbsolutePath(), struct.getContent());
-                SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-                OssUtil.ossUpload(systemConfig.getOssEnv(3), structFilePath, structFile);
+                OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), structFilePath, structFile);
             }
             }
         } finally {
         } finally {
             FileUtil.deleteFolder(dir);
             FileUtil.deleteFolder(dir);

+ 2 - 4
themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCommon.java

@@ -3,12 +3,10 @@ package com.qmth.themis.business.templete;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.TBTaskHistory;
 import com.qmth.themis.business.entity.TBTaskHistory;
 import com.qmth.themis.business.enums.TaskStatusEnum;
 import com.qmth.themis.business.enums.TaskStatusEnum;
-import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.OssUtil;
@@ -55,14 +53,14 @@ public class TaskExportCommon {
      * 初始化
      * 初始化
      */
      */
     public void init() {
     public void init() {
-        SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
+        OssUtil ossUtil = SpringContextHolder.getBean(OssUtil.class);
         Gson gson = new Gson();
         Gson gson = new Gson();
         if (Objects.nonNull(this.map.get("orgId"))) {
         if (Objects.nonNull(this.map.get("orgId"))) {
             this.orgId = Long.parseLong(String.valueOf(this.map.get("orgId")));
             this.orgId = Long.parseLong(String.valueOf(this.map.get("orgId")));
         }
         }
         this.createId = Long.parseLong(String.valueOf(this.map.get("createId")));
         this.createId = Long.parseLong(String.valueOf(this.map.get("createId")));
         this.ossUtil = SpringContextHolder.getBean(OssUtil.class);
         this.ossUtil = SpringContextHolder.getBean(OssUtil.class);
-        this.ossEnv = systemConfig.getOssEnv(UploadFileEnum.file.ordinal());
+        this.ossEnv = ossUtil.getAliYunOssPrivateDomain().getMap();
         this.type = (boolean) this.ossEnv.get("oss") ? SystemConstant.OSS : SystemConstant.LOCAL;
         this.type = (boolean) this.ossEnv.get("oss") ? SystemConstant.OSS : SystemConstant.LOCAL;
         Map tbTaskHistoryMap = (Map) this.map.get("tbTaskHistory");
         Map tbTaskHistoryMap = (Map) this.map.get("tbTaskHistory");
         this.tbTaskHistory = gson.fromJson(gson.toJson(tbTaskHistoryMap), TBTaskHistory.class);
         this.tbTaskHistory = gson.fromJson(gson.toJson(tbTaskHistoryMap), TBTaskHistory.class);

+ 2 - 3
themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportCommon.java

@@ -3,7 +3,6 @@ package com.qmth.themis.business.templete;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.TBTaskHistory;
 import com.qmth.themis.business.entity.TBTaskHistory;
@@ -55,7 +54,7 @@ public class TaskImportCommon {
      * 初始化
      * 初始化
      */
      */
     public void init() {
     public void init() {
-        SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
+        OssUtil ossUtil = SpringContextHolder.getBean(OssUtil.class);
         Gson gson = new Gson();
         Gson gson = new Gson();
         if (Objects.nonNull(this.map.get("mode"))) {
         if (Objects.nonNull(this.map.get("mode"))) {
             this.mode = String.valueOf(this.map.get("mode"));
             this.mode = String.valueOf(this.map.get("mode"));
@@ -72,7 +71,7 @@ public class TaskImportCommon {
         this.path = String.valueOf(remarkJs.get("path"));
         this.path = String.valueOf(remarkJs.get("path"));
         this.uploadType = Integer.parseInt(String.valueOf(remarkJs.get("uploadType")));
         this.uploadType = Integer.parseInt(String.valueOf(remarkJs.get("uploadType")));
         this.ossUtil = SpringContextHolder.getBean(OssUtil.class);
         this.ossUtil = SpringContextHolder.getBean(OssUtil.class);
-        this.ossEnv = systemConfig.getOssEnv(this.uploadType);
+        this.ossEnv = ossUtil.getAliYunOssPrivateDomain().getMap();
         Map tbTaskHistoryMap = (Map) this.map.get("tbTaskHistory");
         Map tbTaskHistoryMap = (Map) this.map.get("tbTaskHistory");
         this.tbTaskHistory = gson.fromJson(gson.toJson(tbTaskHistoryMap), TBTaskHistory.class);
         this.tbTaskHistory = gson.fromJson(gson.toJson(tbTaskHistoryMap), TBTaskHistory.class);
         this.tbTaskHistoryService = SpringContextHolder.getBean(TBTaskHistoryService.class);
         this.tbTaskHistoryService = SpringContextHolder.getBean(TBTaskHistoryService.class);

+ 702 - 722
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskExamPaperImportTemplete.java

@@ -1,33 +1,8 @@
 package com.qmth.themis.business.templete.impl;
 package com.qmth.themis.business.templete.impl;
 
 
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
-import com.qmth.themis.business.config.SystemConfig;
-import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
@@ -50,10 +25,23 @@ import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import com.qmth.themis.common.util.ResultUtil;
-
-import cn.hutool.core.date.DateUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import sun.misc.BASE64Decoder;
 import sun.misc.BASE64Decoder;
 
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
 /**
 /**
  * @Description: 试卷导入
  * @Description: 试卷导入
  * @Author: xiatian
  * @Author: xiatian
@@ -61,704 +49,696 @@ import sun.misc.BASE64Decoder;
  */
  */
 @Service("taskExamPaperImportTemplete")
 @Service("taskExamPaperImportTemplete")
 public class TaskExamPaperImportTemplete implements TaskImportTemplete {
 public class TaskExamPaperImportTemplete implements TaskImportTemplete {
-	private final static Logger log = LoggerFactory.getLogger(TaskExamPaperImportTemplete.class);
-	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
-	@Resource
-	TEExamService teExamService;
-	@Resource
-	SystemConfig systemConfig;
-	@Resource
-	TEExamCourseService teExamCourseService;
-	@Resource
-	TEExamPaperService teExamPaperService;
-	
-	@Resource
-	TOeExamRecordService examRecordService;
-	
+    private final static Logger log = LoggerFactory.getLogger(TaskExamPaperImportTemplete.class);
+    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
+    @Resource
+    TEExamService teExamService;
+    @Resource
+    OssUtil ossUtil;
+    @Resource
+    TEExamCourseService teExamCourseService;
+    @Resource
+    TEExamPaperService teExamPaperService;
+
+    @Resource
+    TOeExamRecordService examRecordService;
+
 
 
     @Resource
     @Resource
     RedisUtil redisUtil;
     RedisUtil redisUtil;
 
 
-	@Override
-	@Transactional
-	public Result importTask(Map<String, Object> map) throws IOException {
-		long start = System.currentTimeMillis();
-		TaskImportCommon taskImportCommon = new TaskImportCommon(map);
-		taskImportCommon.init();
-		StringBuilder result = new StringBuilder();
-		String timeFormat = taskImportCommon.getTimeFormat();
-		addResult(result, DateUtil.format(new Date(), timeFormat) + "处理开始");
-		File file = null;
-		try {
-			file = taskImportCommon.getUploadFile();
-			dispose(file, map, result);
-			taskImportCommon.getTbTaskHistory().setSummary("处理成功");
-		} catch (Exception e) {
-			taskImportCommon.setException(true);
-			log.error("处理出错 ", e);
-			addResult(result, "处理出错 " + e.getMessage());
-			taskImportCommon.getTbTaskHistory().setSummary("处理出错");
-		} finally {
-			if (file != null) {
-				file.delete();
-			}
-			addResult(result, DateUtil.format(new Date(), timeFormat) + "处理结束");
-			long end = System.currentTimeMillis();
-			addResult(result, "耗时(秒):" + ((end - start) / 1000));
-			taskImportCommon.getTbTaskHistory().setFinishTime(System.currentTimeMillis());
-			taskImportCommon.getTbTaskHistory().setStatus(TaskStatusEnum.FINISH);
-			taskImportCommon.getTbTaskHistory().setProgress(100.0d);
-			taskImportCommon.writeImportResultTxt(result.toString(), file);
-		}
-		return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
-	}
-
-	private void dispose(File file, Map<String, Object> map, StringBuilder result) throws IOException {
-		
-		Long examId = (Long) map.get("examId");
-
-		TEExam teExam = teExamService.getById(examId);
-		if (Objects.isNull(teExam)) {
-			throw new BusinessException(ExceptionResultEnum.EXAM_NO);
-		}
-
-		String tempDir = SystemConstant.TEMP_FILES_DIR;
-		String dir = tempDir + "/" + uuid() + "/";
-		File dfile = new File(dir);
-		
-		String lockKey = SystemConstant.REDIS_LOCK_PAPER_IMPORT_PREFIX + examId;
-		
-		String multLockKey = SystemConstant.REDIS_LOCK_CALCULATE_SCORE_PAPER_IMPORT_PREFIX + examId;
-		try {
-			int timeOutSecond = 60 * 60;
-			//试卷导入锁
-	        Boolean lock = redisUtil.lock(lockKey, timeOutSecond);
-	        if (!lock) {
-	        	throw new BusinessException("该考试批次有正在进行的试卷导入");
-	        }
-	        
-	        //重新算分和试卷导入互斥锁
-	        Boolean multLock = redisUtil.lock(multLockKey, timeOutSecond);
-	        if (!multLock) {
-	        	throw new BusinessException("该考试批次有正在进行的重新算分");
-	        }
-			
-			dfile.mkdirs();
-			FileUtil.unZip(dfile, file);
-			if (!hasErr(map, dir, examId, dfile, result)) {
-				for (File courseDir : dfile.listFiles()) {
-					if (courseDir.isDirectory()) {
-						disposeCourseDir(dir, teExam, courseDir, map);
-					}
-				}
-			} else {
-				throw new BusinessException("校验失败");
-			}
-			TOeExamRecord er=examRecordService.findOneByExamId(examId, null);
-			Boolean processAnswer = (Boolean) map.get("processAnswer");
-			if(er!=null&&processAnswer) {
-				teExamService.updateScoreStatus(ScoreStatusEnum.NEED_CALCULATE, examId);
-			}
-		} finally {
-			redisUtil.releaseLock(lockKey);
-			redisUtil.releaseLock(multLockKey);
-			FileUtil.deleteFolder(dir);
-		}
-	}
-
-	private void disposeCourseDir(String rootDir, TEExam teExam, File courseDir, Map<String, Object> map) {
-		String courseCode = courseDir.getName();
-		TEExamCourse course = teExamCourseService.findByExamIdAndCourseCode(teExam.getId(), courseCode);
-		if (course == null) {
-			throw new BusinessException("科目编码不存在 " + courseCode);
-		}
-		File[] childs = courseDir.listFiles();
-		for (File paperDir : childs) {
-			if (paperDir.isDirectory()) {
-				disposePaperDir(rootDir, teExam, course, paperDir, map);
-			}
-		}
-		Boolean objectiveShuffle = (Boolean) map.get("objectiveShuffle");
-		Boolean optionShuffle = (Boolean) map.get("optionShuffle");
-		Integer audioPlayCount = (Integer) map.get("audioPlayCount");
-		if (objectiveShuffle != null) {
-			course.setObjectiveShuffle(objectiveShuffle ? 1 : 0);
-		}
-		if (optionShuffle != null) {
-			course.setOptionShuffle(optionShuffle ? 1 : 0);
-		}
-		if (audioPlayCount != null) {
-			course.setAudioPlayCount(audioPlayCount);
-		}
-		List<TEExamPaper> list = teExamPaperService.findByExamIdAndCourseCode(teExam.getId(), courseCode);
-		int hasAnswer = 1;
-		for (TEExamPaper p : list) {
-			if (StringUtils.isBlank(p.getAnswerPath())) {
-				hasAnswer = 0;
-				break;
-			}
-		}
-		course.setPaperCount(list.size());
-		course.setHasAnswer(hasAnswer);
-		int hasAudio = 0;
-		for (TEExamPaper p : list) {
-			if (p.getHasAudio() != null && p.getHasAudio().intValue() == 1) {
-				hasAudio = 1;
-				break;
-			}
-		}
-		course.setHasAudio(hasAudio);
-		teExamCourseService.saveOrUpdate(course);
-		// 设置调卷比例
-		teExamPaperService.savePaperWeight(paperWeight(list));
-		
-		//清除考试科目缓存
-		teExamCourseService.deleteExamCourseCacheBean(teExam.getId(), courseCode);
-	}
-
-	private Map<Long, Double> paperWeight(List<TEExamPaper> list) {
-		BigDecimal b1 = new BigDecimal(100.0);// 基数总数
-		BigDecimal b2 = new BigDecimal(list.size());// 份数
-		BigDecimal b3 = b1.divide(b2, 0, BigDecimal.ROUND_FLOOR);// 平均数
-		BigDecimal b4 = b1.subtract(b3.multiply(b2).setScale(0, BigDecimal.ROUND_FLOOR));// 余数
-		Map<Long, Double> map = new HashMap<Long, Double>();
-		for (int i = 0; i < list.size(); i++) {
-			TEExamPaper p = list.get(i);
-			if (i == list.size() - 1) {
-				map.put(p.getId(), b3.add(b4).doubleValue());
-			} else {
-				map.put(p.getId(), b3.doubleValue());
-			}
-		}
-		return map;
-	}
-
-	private void disposePaperDir(String rootDir, TEExam teExam, TEExamCourse course, File paperDir,
-			Map<String, Object> map) {
-		String paperCode = paperDir.getName();
-		File[] childs = paperDir.listFiles();
-
-		File paperFile = null;
-		File answerFile = null;
-		File attachmentDir = null;
-		for (File cfile : childs) {
-			if ("paper.json".equals(cfile.getName()) && cfile.isFile()) {
-				paperFile = cfile;
-			}
-			if ("answer.json".equals(cfile.getName()) && cfile.isFile()) {
-				answerFile = cfile;
-			}
-			if ("attachment".equals(cfile.getName()) && cfile.isDirectory()) {
-				if (cfile.listFiles() != null && cfile.listFiles().length != 0) {
-					attachmentDir = cfile;
-				}
-			}
-		}
-		TEExamPaper paper = teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(teExam.getId(),
-				course.getCourseCode(), paperCode);
-		if (paper == null) {
-			paper = new TEExamPaper();
-			String createId = map.get("createId").toString();
-			JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
-			paper.setId(Constants.idGen.next());
-			paper.setName(paperJson.getString("name"));
-			paper.setTotalScore(paperJson.getDouble("totalScore"));
-			paper.setDecryptSecret(RandomStringUtils.randomAlphanumeric(16));
-			paper.setEncryptMode(EncryptModeEnum.AUTO);
-			paper.setExamId(teExam.getId());
-			paper.setCode(paperCode);
-			paper.setHasAudio(paperJson.getInteger("hasAudio"));
-			paper.setCreateId(Long.parseLong(createId));
-			paper.setCourseCode(course.getCourseCode());
-			paper.setDecryptVector(RandomStringUtils.randomAlphanumeric(16));
-		}
-		Boolean processPaper = (Boolean) map.get("processPaper");
-		Boolean processAnswer = (Boolean) map.get("processAnswer");
-		if (processPaper) {
-			disposePaper(rootDir, paper, paperFile, attachmentDir);
-			disposeStruct(rootDir, paper, paperFile);
-			disposeViewPaper(rootDir, paper, paperFile, attachmentDir);
-		}
-		if (processAnswer) {
-			File structFile;
-			if(processPaper) {
-				structFile=paperFile;
-			}else {
-				String structPath = paper.getStructPath();
-				SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-				String url = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), structPath);
-				structFile = new File(rootDir + uuid() + ".json");
-				FileUtil.saveUrlAsFile(url, structFile);
-			}
-			disposeAnswer(rootDir, paper, answerFile,structFile,attachmentDir);
-		}
-		Integer audioPlayCount = (Integer) map.get("audioPlayCount");
-		paper.setAudioPlayCount(audioPlayCount);
-		teExamPaperService.saveOrUpdate(paper);
-	}
-
-	private void disposeViewPaper(String rootDir, TEExamPaper paper, File paperFile, File attachmentDir) {
-		File urlPaperFile = new File(rootDir + uuid() + ".json");
-		JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
-		JSONArray structdetails = structJson.getJSONArray("details");
-		if(structdetails==null||structdetails.size()==0) {
-			return;
-		}
-		for (int i = 0; i < structdetails.size(); i++) {
-			JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
-			if(structdetailquestions!=null&&structdetailquestions.size()>=0) {
-				for (int j = 0; j < structdetailquestions.size(); j++) {
-					JSONObject structquestion = structdetailquestions.getJSONObject(j);
-					JSONObject body = structquestion.getJSONObject("body");
-					disposeQuestionBodyUrl(rootDir, body, paper.getId(), attachmentDir);
-					JSONArray options = structquestion.getJSONArray("options");
-					disposeQuestionOptionsUrl(rootDir, options, paper.getId(), attachmentDir);
-					if (structquestion.getInteger("structType").intValue() == 6) {
-						JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-						for (int k = 0; k < structsubQuestions.size(); k++) {
-							JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-								JSONObject subbody = structsubquestion.getJSONObject("body");
-								disposeQuestionBodyUrl(rootDir, subbody, paper.getId(), attachmentDir);
-								JSONArray suboptions = structsubquestion.getJSONArray("options");
-								disposeQuestionOptionsUrl(rootDir, suboptions, paper.getId(), attachmentDir);
-						}
-					}
-				}
-			}
-		}
-		FileUtil.saveAsFile(urlPaperFile.getAbsolutePath(), structJson.toJSONString());
-		String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
-		paper.setPaperViewPath(filePath);
-		SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-		OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, urlPaperFile);
-	}
-	
-	private void disposeQuestionBodyUrl(String rootDir,JSONObject body,Long paperId,File attachmentDir) {
-		if(body==null) {
-			return;
-		}
-		JSONArray sections = body.getJSONArray("sections");
-		if(sections==null||sections.size()==0) {
-			return;
-		}
-		for(int j=0;j<sections.size();j++) {
-			JSONObject block = sections.getJSONObject(j);
-			if(block!=null) {
-				JSONArray blocks = block.getJSONArray("blocks");
-				if(blocks!=null&&blocks.size()>0) {
-					for(int m=0;m<blocks.size();m++) {
-						JSONObject blockInfo = blocks.getJSONObject(m);
-						uploadImageAndAudio(rootDir,blockInfo, paperId, attachmentDir);
-					}
-				}
-			}
-		}
-	}
-	
-	private void disposeQuestionOptionsUrl(String rootDir,JSONArray options,Long paperId,File attachmentDir) {
-		if(options==null||options.size()==0) {
-			return;
-		}
-		for(int i=0;i<options.size();i++) {
-			JSONObject option = options.getJSONObject(i);
-			if(option!=null) {
-				JSONObject body = option.getJSONObject("body");
-				if(body!=null) {
-					JSONArray sections = body.getJSONArray("sections");
-					if(sections!=null&&sections.size()>0) {
-						for(int j=0;j<sections.size();j++) {
-							JSONObject block = sections.getJSONObject(j);
-							if(block!=null) {
-								JSONArray blocks = block.getJSONArray("blocks");
-								if(blocks!=null&&blocks.size()>0) {
-									for(int m=0;m<blocks.size();m++) {
-										JSONObject blockInfo = blocks.getJSONObject(m);
-										uploadImageAndAudio(rootDir,blockInfo, paperId, attachmentDir);
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	private void disposePaper(String rootDir, TEExamPaper paper, File paperFile, File attachmentDir) {
-		if (paperFile == null) {
-			return;
-		}
-		File zip = new File(rootDir + uuid() + ".zip");
-		List<File> files = new ArrayList<File>();
-		files.add(paperFile);
-		if (attachmentDir != null) {
-			files.add(attachmentDir);
-		}
-		FileUtil.doZip(zip, files);
-		File encryptZip = new File(rootDir + uuid() + ".zip");
-		FileUtil.encryptFile(zip, encryptZip, paper.getDecryptSecret(), paper.getDecryptVector());
-		String filePath = sdf.format(new Date()) + "/" + uuid() + ".zip";
-		paper.setPaperPath(filePath);
-		SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-		OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, encryptZip);
-	}
-
-	private void disposeStruct(String rootDir, TEExamPaper paper, File paperFile) {
-		BigDecimal obTotal = new BigDecimal(0);
-		BigDecimal subTotal = new BigDecimal(0);
-		if (paperFile == null) {
-			return;
-		}
-		JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
-		JSONArray details = paperJson.getJSONArray("details");
-		for (int i = 0; i < details.size(); i++) {
-			JSONArray questions = details.getJSONObject(i).getJSONArray("questions");
-			for (int j = 0; j < questions.size(); j++) {
-				JSONObject question = questions.getJSONObject(j);
-				question.remove("body");
-				question.remove("options");
-				Double score = question.getDouble("score");
-				if(score==null) {
-					score=0.0;
-				}
-				Integer structType = question.getInteger("structType");
-				if (structType.intValue() != 1
-						&& structType.intValue() != 2
-								&& structType.intValue() != 3&&structType.intValue() != 6) {//主观题
-					subTotal=subTotal.add(new BigDecimal(score));
-				}else {//客观题
-					obTotal=obTotal.add(new BigDecimal(score));
-				}
-				if (structType.intValue() == 6) {
-					JSONArray subQuestions = question.getJSONArray("subQuestions");
-					for (int k = 0; k < subQuestions.size(); k++) {
-						JSONObject subquestion = subQuestions.getJSONObject(k);
-						subquestion.remove("body");
-						subquestion.remove("options");
-						Double subScore = subquestion.getDouble("score");
-						if(subScore==null) {
-							subScore=0.0;
-						}
-						Integer subStructType = subquestion.getInteger("structType");
-						if (subStructType.intValue() != 1
-								&& subStructType.intValue() != 2
-										&& subStructType.intValue() != 3) {//主观题
-							subTotal=subTotal.add(new BigDecimal(subScore));
-						}else {//客观题
-							obTotal=obTotal.add(new BigDecimal(subScore));
-						}
-					}
-				}
-			}
-		}
-
-		File file = new File(rootDir + uuid() + ".json");
-		FileUtil.saveAsFile(file.getAbsolutePath(), paperJson.toJSONString());
-		String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
-		paper.setStructPath(filePath);
-		paper.setTotalObjectiveScore(obTotal.doubleValue());
-		paper.setTotalSubjectiveScore(subTotal.doubleValue());
-		SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-		OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, file);
-	}
-
-	private void disposeAnswer(String rootDir, TEExamPaper paper, File answerFile,File structFile,File attachmentDir) {
-		if (answerFile == null) {
-			return;
-		}
-		File urlAnswerFile = new File(rootDir + uuid() + ".json");
-		JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(answerFile));
-		JSONArray answerdetails = answerJson.getJSONArray("details");
-		JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(structFile));
-		JSONArray structdetails = structJson.getJSONArray("details");
-		for (int i = 0; i < answerdetails.size(); i++) {
-			JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
-			JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
-			for (int j = 0; j < answerdetailquestions.size(); j++) {
-				JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
-				JSONObject structquestion = structdetailquestions.getJSONObject(j);
-				if (structquestion.getInteger("structType").intValue() != 1
-						&& structquestion.getInteger("structType").intValue() != 2
-							&& structquestion.getInteger("structType").intValue() != 3
-								&& structquestion.getInteger("structType").intValue() != 6) {
-					JSONArray answer = answerquestion.getJSONArray("answer");
-					disposeAnswerUrl(rootDir,answer, paper.getId(), attachmentDir);
-				}
-				if (structquestion.getInteger("structType").intValue() == 6) {
-					JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
-					JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-					for (int k = 0; k < answersubQuestions.size(); k++) {
-						JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
-						JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-						if (structsubquestion.getInteger("structType").intValue() != 1
-								&& structsubquestion.getInteger("structType").intValue() != 2
-									&& structsubquestion.getInteger("structType").intValue() != 3) {
-							JSONArray answer = answersubquestion.getJSONArray("answer");
-							disposeAnswerUrl(rootDir,answer, paper.getId(), attachmentDir);
-						}
-					}
-				}
-			}
-		}
-		FileUtil.saveAsFile(urlAnswerFile.getAbsolutePath(), answerJson.toJSONString());
-		String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
-		paper.setAnswerPath(filePath);
-		SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-		OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, urlAnswerFile);
-	}
-
-	private void disposeAnswerUrl(String rootDir,JSONArray answer,Long paperId,File attachmentDir) {
-		if(answer!=null&&answer.size()>0) {
-			for(int i=0;i<answer.size();i++) {
-				JSONObject section = answer.getJSONObject(i);
-				if(section!=null) {
-					JSONArray sections = section.getJSONArray("sections");
-					if(sections!=null&&sections.size()>0) {
-						for(int j=0;j<sections.size();j++) {
-							JSONObject block = sections.getJSONObject(j);
-							if(block!=null) {
-								JSONArray blocks = block.getJSONArray("blocks");
-								if(blocks!=null&&blocks.size()>0) {
-									for(int m=0;m<blocks.size();m++) {
-										JSONObject blockInfo = blocks.getJSONObject(m);
-										uploadImageAndAudio(rootDir,blockInfo, paperId, attachmentDir);
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	private void uploadImageAndAudio(String rootDir,JSONObject blockInfo,Long paperId,File attachmentDir) {
-		String type=blockInfo.getString("type");
-		String value=blockInfo.getString("value");
-		if(("image".equals(type)||"audio".equals(type))
-				&&StringUtils.isNotBlank(value)
-				&&!value.toLowerCase().startsWith("https://")
-				&&!value.toLowerCase().startsWith("http://")) {
-			if("image".equals(type)&&value.contains("data:image")) {
-            	String suff=value.substring(11, value.indexOf(";"));
-            	File iamgeFile = new File(rootDir+uuid()+"."+suff);
+    @Override
+    @Transactional
+    public Result importTask(Map<String, Object> map) throws IOException {
+        long start = System.currentTimeMillis();
+        TaskImportCommon taskImportCommon = new TaskImportCommon(map);
+        taskImportCommon.init();
+        StringBuilder result = new StringBuilder();
+        String timeFormat = taskImportCommon.getTimeFormat();
+        addResult(result, DateUtil.format(new Date(), timeFormat) + "处理开始");
+        File file = null;
+        try {
+            file = taskImportCommon.getUploadFile();
+            dispose(file, map, result);
+            taskImportCommon.getTbTaskHistory().setSummary("处理成功");
+        } catch (Exception e) {
+            taskImportCommon.setException(true);
+            log.error("处理出错 ", e);
+            addResult(result, "处理出错 " + e.getMessage());
+            taskImportCommon.getTbTaskHistory().setSummary("处理出错");
+        } finally {
+            if (file != null) {
+                file.delete();
+            }
+            addResult(result, DateUtil.format(new Date(), timeFormat) + "处理结束");
+            long end = System.currentTimeMillis();
+            addResult(result, "耗时(秒):" + ((end - start) / 1000));
+            taskImportCommon.getTbTaskHistory().setFinishTime(System.currentTimeMillis());
+            taskImportCommon.getTbTaskHistory().setStatus(TaskStatusEnum.FINISH);
+            taskImportCommon.getTbTaskHistory().setProgress(100.0d);
+            taskImportCommon.writeImportResultTxt(result.toString(), file);
+        }
+        return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
+    }
+
+    private void dispose(File file, Map<String, Object> map, StringBuilder result) throws IOException {
+
+        Long examId = (Long) map.get("examId");
+
+        TEExam teExam = teExamService.getById(examId);
+        if (Objects.isNull(teExam)) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_NO);
+        }
+
+        String tempDir = SystemConstant.TEMP_FILES_DIR;
+        String dir = tempDir + "/" + uuid() + "/";
+        File dfile = new File(dir);
+
+        String lockKey = SystemConstant.REDIS_LOCK_PAPER_IMPORT_PREFIX + examId;
+
+        String multLockKey = SystemConstant.REDIS_LOCK_CALCULATE_SCORE_PAPER_IMPORT_PREFIX + examId;
+        try {
+            int timeOutSecond = 60 * 60;
+            //试卷导入锁
+            Boolean lock = redisUtil.lock(lockKey, timeOutSecond);
+            if (!lock) {
+                throw new BusinessException("该考试批次有正在进行的试卷导入");
+            }
+
+            //重新算分和试卷导入互斥锁
+            Boolean multLock = redisUtil.lock(multLockKey, timeOutSecond);
+            if (!multLock) {
+                throw new BusinessException("该考试批次有正在进行的重新算分");
+            }
+
+            dfile.mkdirs();
+            FileUtil.unZip(dfile, file);
+            if (!hasErr(map, dir, examId, dfile, result)) {
+                for (File courseDir : dfile.listFiles()) {
+                    if (courseDir.isDirectory()) {
+                        disposeCourseDir(dir, teExam, courseDir, map);
+                    }
+                }
+            } else {
+                throw new BusinessException("校验失败");
+            }
+            TOeExamRecord er = examRecordService.findOneByExamId(examId, null);
+            Boolean processAnswer = (Boolean) map.get("processAnswer");
+            if (er != null && processAnswer) {
+                teExamService.updateScoreStatus(ScoreStatusEnum.NEED_CALCULATE, examId);
+            }
+        } finally {
+            redisUtil.releaseLock(lockKey);
+            redisUtil.releaseLock(multLockKey);
+            FileUtil.deleteFolder(dir);
+        }
+    }
+
+    private void disposeCourseDir(String rootDir, TEExam teExam, File courseDir, Map<String, Object> map) {
+        String courseCode = courseDir.getName();
+        TEExamCourse course = teExamCourseService.findByExamIdAndCourseCode(teExam.getId(), courseCode);
+        if (course == null) {
+            throw new BusinessException("科目编码不存在 " + courseCode);
+        }
+        File[] childs = courseDir.listFiles();
+        for (File paperDir : childs) {
+            if (paperDir.isDirectory()) {
+                disposePaperDir(rootDir, teExam, course, paperDir, map);
+            }
+        }
+        Boolean objectiveShuffle = (Boolean) map.get("objectiveShuffle");
+        Boolean optionShuffle = (Boolean) map.get("optionShuffle");
+        Integer audioPlayCount = (Integer) map.get("audioPlayCount");
+        if (objectiveShuffle != null) {
+            course.setObjectiveShuffle(objectiveShuffle ? 1 : 0);
+        }
+        if (optionShuffle != null) {
+            course.setOptionShuffle(optionShuffle ? 1 : 0);
+        }
+        if (audioPlayCount != null) {
+            course.setAudioPlayCount(audioPlayCount);
+        }
+        List<TEExamPaper> list = teExamPaperService.findByExamIdAndCourseCode(teExam.getId(), courseCode);
+        int hasAnswer = 1;
+        for (TEExamPaper p : list) {
+            if (StringUtils.isBlank(p.getAnswerPath())) {
+                hasAnswer = 0;
+                break;
+            }
+        }
+        course.setPaperCount(list.size());
+        course.setHasAnswer(hasAnswer);
+        int hasAudio = 0;
+        for (TEExamPaper p : list) {
+            if (p.getHasAudio() != null && p.getHasAudio().intValue() == 1) {
+                hasAudio = 1;
+                break;
+            }
+        }
+        course.setHasAudio(hasAudio);
+        teExamCourseService.saveOrUpdate(course);
+        // 设置调卷比例
+        teExamPaperService.savePaperWeight(paperWeight(list));
+
+        //清除考试科目缓存
+        teExamCourseService.deleteExamCourseCacheBean(teExam.getId(), courseCode);
+    }
+
+    private Map<Long, Double> paperWeight(List<TEExamPaper> list) {
+        BigDecimal b1 = new BigDecimal(100.0);// 基数总数
+        BigDecimal b2 = new BigDecimal(list.size());// 份数
+        BigDecimal b3 = b1.divide(b2, 0, BigDecimal.ROUND_FLOOR);// 平均数
+        BigDecimal b4 = b1.subtract(b3.multiply(b2).setScale(0, BigDecimal.ROUND_FLOOR));// 余数
+        Map<Long, Double> map = new HashMap<Long, Double>();
+        for (int i = 0; i < list.size(); i++) {
+            TEExamPaper p = list.get(i);
+            if (i == list.size() - 1) {
+                map.put(p.getId(), b3.add(b4).doubleValue());
+            } else {
+                map.put(p.getId(), b3.doubleValue());
+            }
+        }
+        return map;
+    }
+
+    private void disposePaperDir(String rootDir, TEExam teExam, TEExamCourse course, File paperDir,
+                                 Map<String, Object> map) {
+        String paperCode = paperDir.getName();
+        File[] childs = paperDir.listFiles();
+
+        File paperFile = null;
+        File answerFile = null;
+        File attachmentDir = null;
+        for (File cfile : childs) {
+            if ("paper.json".equals(cfile.getName()) && cfile.isFile()) {
+                paperFile = cfile;
+            }
+            if ("answer.json".equals(cfile.getName()) && cfile.isFile()) {
+                answerFile = cfile;
+            }
+            if ("attachment".equals(cfile.getName()) && cfile.isDirectory()) {
+                if (cfile.listFiles() != null && cfile.listFiles().length != 0) {
+                    attachmentDir = cfile;
+                }
+            }
+        }
+        TEExamPaper paper = teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(teExam.getId(),
+                course.getCourseCode(), paperCode);
+        if (paper == null) {
+            paper = new TEExamPaper();
+            String createId = map.get("createId").toString();
+            JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
+            paper.setId(Constants.idGen.next());
+            paper.setName(paperJson.getString("name"));
+            paper.setTotalScore(paperJson.getDouble("totalScore"));
+            paper.setDecryptSecret(RandomStringUtils.randomAlphanumeric(16));
+            paper.setEncryptMode(EncryptModeEnum.AUTO);
+            paper.setExamId(teExam.getId());
+            paper.setCode(paperCode);
+            paper.setHasAudio(paperJson.getInteger("hasAudio"));
+            paper.setCreateId(Long.parseLong(createId));
+            paper.setCourseCode(course.getCourseCode());
+            paper.setDecryptVector(RandomStringUtils.randomAlphanumeric(16));
+        }
+        Boolean processPaper = (Boolean) map.get("processPaper");
+        Boolean processAnswer = (Boolean) map.get("processAnswer");
+        if (processPaper) {
+            disposePaper(rootDir, paper, paperFile, attachmentDir);
+            disposeStruct(rootDir, paper, paperFile);
+            disposeViewPaper(rootDir, paper, paperFile, attachmentDir);
+        }
+        if (processAnswer) {
+            File structFile;
+            if (processPaper) {
+                structFile = paperFile;
+            } else {
+                String structPath = paper.getStructPath();
+                String url = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), structPath);
+                structFile = new File(rootDir + uuid() + ".json");
+                FileUtil.saveUrlAsFile(url, structFile);
+            }
+            disposeAnswer(rootDir, paper, answerFile, structFile, attachmentDir);
+        }
+        Integer audioPlayCount = (Integer) map.get("audioPlayCount");
+        paper.setAudioPlayCount(audioPlayCount);
+        teExamPaperService.saveOrUpdate(paper);
+    }
+
+    private void disposeViewPaper(String rootDir, TEExamPaper paper, File paperFile, File attachmentDir) {
+        File urlPaperFile = new File(rootDir + uuid() + ".json");
+        JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
+        JSONArray structdetails = structJson.getJSONArray("details");
+        if (structdetails == null || structdetails.size() == 0) {
+            return;
+        }
+        for (int i = 0; i < structdetails.size(); i++) {
+            JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
+            if (structdetailquestions != null && structdetailquestions.size() >= 0) {
+                for (int j = 0; j < structdetailquestions.size(); j++) {
+                    JSONObject structquestion = structdetailquestions.getJSONObject(j);
+                    JSONObject body = structquestion.getJSONObject("body");
+                    disposeQuestionBodyUrl(rootDir, body, paper.getId(), attachmentDir);
+                    JSONArray options = structquestion.getJSONArray("options");
+                    disposeQuestionOptionsUrl(rootDir, options, paper.getId(), attachmentDir);
+                    if (structquestion.getInteger("structType").intValue() == 6) {
+                        JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                        for (int k = 0; k < structsubQuestions.size(); k++) {
+                            JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                            JSONObject subbody = structsubquestion.getJSONObject("body");
+                            disposeQuestionBodyUrl(rootDir, subbody, paper.getId(), attachmentDir);
+                            JSONArray suboptions = structsubquestion.getJSONArray("options");
+                            disposeQuestionOptionsUrl(rootDir, suboptions, paper.getId(), attachmentDir);
+                        }
+                    }
+                }
+            }
+        }
+        FileUtil.saveAsFile(urlPaperFile.getAbsolutePath(), structJson.toJSONString());
+        String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
+        paper.setPaperViewPath(filePath);
+        OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, urlPaperFile);
+    }
+
+    private void disposeQuestionBodyUrl(String rootDir, JSONObject body, Long paperId, File attachmentDir) {
+        if (body == null) {
+            return;
+        }
+        JSONArray sections = body.getJSONArray("sections");
+        if (sections == null || sections.size() == 0) {
+            return;
+        }
+        for (int j = 0; j < sections.size(); j++) {
+            JSONObject block = sections.getJSONObject(j);
+            if (block != null) {
+                JSONArray blocks = block.getJSONArray("blocks");
+                if (blocks != null && blocks.size() > 0) {
+                    for (int m = 0; m < blocks.size(); m++) {
+                        JSONObject blockInfo = blocks.getJSONObject(m);
+                        uploadImageAndAudio(rootDir, blockInfo, paperId, attachmentDir);
+                    }
+                }
+            }
+        }
+    }
+
+    private void disposeQuestionOptionsUrl(String rootDir, JSONArray options, Long paperId, File attachmentDir) {
+        if (options == null || options.size() == 0) {
+            return;
+        }
+        for (int i = 0; i < options.size(); i++) {
+            JSONObject option = options.getJSONObject(i);
+            if (option != null) {
+                JSONObject body = option.getJSONObject("body");
+                if (body != null) {
+                    JSONArray sections = body.getJSONArray("sections");
+                    if (sections != null && sections.size() > 0) {
+                        for (int j = 0; j < sections.size(); j++) {
+                            JSONObject block = sections.getJSONObject(j);
+                            if (block != null) {
+                                JSONArray blocks = block.getJSONArray("blocks");
+                                if (blocks != null && blocks.size() > 0) {
+                                    for (int m = 0; m < blocks.size(); m++) {
+                                        JSONObject blockInfo = blocks.getJSONObject(m);
+                                        uploadImageAndAudio(rootDir, blockInfo, paperId, attachmentDir);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private void disposePaper(String rootDir, TEExamPaper paper, File paperFile, File attachmentDir) {
+        if (paperFile == null) {
+            return;
+        }
+        File zip = new File(rootDir + uuid() + ".zip");
+        List<File> files = new ArrayList<File>();
+        files.add(paperFile);
+        if (attachmentDir != null) {
+            files.add(attachmentDir);
+        }
+        FileUtil.doZip(zip, files);
+        File encryptZip = new File(rootDir + uuid() + ".zip");
+        FileUtil.encryptFile(zip, encryptZip, paper.getDecryptSecret(), paper.getDecryptVector());
+        String filePath = sdf.format(new Date()) + "/" + uuid() + ".zip";
+        paper.setPaperPath(filePath);
+        OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, encryptZip);
+    }
+
+    private void disposeStruct(String rootDir, TEExamPaper paper, File paperFile) {
+        BigDecimal obTotal = new BigDecimal(0);
+        BigDecimal subTotal = new BigDecimal(0);
+        if (paperFile == null) {
+            return;
+        }
+        JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
+        JSONArray details = paperJson.getJSONArray("details");
+        for (int i = 0; i < details.size(); i++) {
+            JSONArray questions = details.getJSONObject(i).getJSONArray("questions");
+            for (int j = 0; j < questions.size(); j++) {
+                JSONObject question = questions.getJSONObject(j);
+                question.remove("body");
+                question.remove("options");
+                Double score = question.getDouble("score");
+                if (score == null) {
+                    score = 0.0;
+                }
+                Integer structType = question.getInteger("structType");
+                if (structType.intValue() != 1
+                        && structType.intValue() != 2
+                        && structType.intValue() != 3 && structType.intValue() != 6) {//主观题
+                    subTotal = subTotal.add(new BigDecimal(score));
+                } else {//客观题
+                    obTotal = obTotal.add(new BigDecimal(score));
+                }
+                if (structType.intValue() == 6) {
+                    JSONArray subQuestions = question.getJSONArray("subQuestions");
+                    for (int k = 0; k < subQuestions.size(); k++) {
+                        JSONObject subquestion = subQuestions.getJSONObject(k);
+                        subquestion.remove("body");
+                        subquestion.remove("options");
+                        Double subScore = subquestion.getDouble("score");
+                        if (subScore == null) {
+                            subScore = 0.0;
+                        }
+                        Integer subStructType = subquestion.getInteger("structType");
+                        if (subStructType.intValue() != 1
+                                && subStructType.intValue() != 2
+                                && subStructType.intValue() != 3) {//主观题
+                            subTotal = subTotal.add(new BigDecimal(subScore));
+                        } else {//客观题
+                            obTotal = obTotal.add(new BigDecimal(subScore));
+                        }
+                    }
+                }
+            }
+        }
+
+        File file = new File(rootDir + uuid() + ".json");
+        FileUtil.saveAsFile(file.getAbsolutePath(), paperJson.toJSONString());
+        String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
+        paper.setStructPath(filePath);
+        paper.setTotalObjectiveScore(obTotal.doubleValue());
+        paper.setTotalSubjectiveScore(subTotal.doubleValue());
+        OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, file);
+    }
+
+    private void disposeAnswer(String rootDir, TEExamPaper paper, File answerFile, File structFile, File attachmentDir) {
+        if (answerFile == null) {
+            return;
+        }
+        File urlAnswerFile = new File(rootDir + uuid() + ".json");
+        JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(answerFile));
+        JSONArray answerdetails = answerJson.getJSONArray("details");
+        JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(structFile));
+        JSONArray structdetails = structJson.getJSONArray("details");
+        for (int i = 0; i < answerdetails.size(); i++) {
+            JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
+            JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
+            for (int j = 0; j < answerdetailquestions.size(); j++) {
+                JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
+                JSONObject structquestion = structdetailquestions.getJSONObject(j);
+                if (structquestion.getInteger("structType").intValue() != 1
+                        && structquestion.getInteger("structType").intValue() != 2
+                        && structquestion.getInteger("structType").intValue() != 3
+                        && structquestion.getInteger("structType").intValue() != 6) {
+                    JSONArray answer = answerquestion.getJSONArray("answer");
+                    disposeAnswerUrl(rootDir, answer, paper.getId(), attachmentDir);
+                }
+                if (structquestion.getInteger("structType").intValue() == 6) {
+                    JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
+                    JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                    for (int k = 0; k < answersubQuestions.size(); k++) {
+                        JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
+                        JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                        if (structsubquestion.getInteger("structType").intValue() != 1
+                                && structsubquestion.getInteger("structType").intValue() != 2
+                                && structsubquestion.getInteger("structType").intValue() != 3) {
+                            JSONArray answer = answersubquestion.getJSONArray("answer");
+                            disposeAnswerUrl(rootDir, answer, paper.getId(), attachmentDir);
+                        }
+                    }
+                }
+            }
+        }
+        FileUtil.saveAsFile(urlAnswerFile.getAbsolutePath(), answerJson.toJSONString());
+        String filePath = sdf.format(new Date()) + "/" + uuid() + ".json";
+        paper.setAnswerPath(filePath);
+        OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, urlAnswerFile);
+    }
+
+    private void disposeAnswerUrl(String rootDir, JSONArray answer, Long paperId, File attachmentDir) {
+        if (answer != null && answer.size() > 0) {
+            for (int i = 0; i < answer.size(); i++) {
+                JSONObject section = answer.getJSONObject(i);
+                if (section != null) {
+                    JSONArray sections = section.getJSONArray("sections");
+                    if (sections != null && sections.size() > 0) {
+                        for (int j = 0; j < sections.size(); j++) {
+                            JSONObject block = sections.getJSONObject(j);
+                            if (block != null) {
+                                JSONArray blocks = block.getJSONArray("blocks");
+                                if (blocks != null && blocks.size() > 0) {
+                                    for (int m = 0; m < blocks.size(); m++) {
+                                        JSONObject blockInfo = blocks.getJSONObject(m);
+                                        uploadImageAndAudio(rootDir, blockInfo, paperId, attachmentDir);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private void uploadImageAndAudio(String rootDir, JSONObject blockInfo, Long paperId, File attachmentDir) {
+        String type = blockInfo.getString("type");
+        String value = blockInfo.getString("value");
+        if (("image".equals(type) || "audio".equals(type))
+                && StringUtils.isNotBlank(value)
+                && !value.toLowerCase().startsWith("https://")
+                && !value.toLowerCase().startsWith("http://")) {
+            if ("image".equals(type) && value.contains("data:image")) {
+                String suff = value.substring(11, value.indexOf(";"));
+                File iamgeFile = new File(rootDir + uuid() + "." + suff);
                 BASE64Decoder decoder = new BASE64Decoder();
                 BASE64Decoder decoder = new BASE64Decoder();
                 try {
                 try {
-					byte[] bytes = decoder.decodeBuffer(value.substring(value.indexOf(",") + 1));
-					FileUtils.writeByteArrayToFile(iamgeFile, bytes);
-				} catch (IOException e) {
-					throw new BusinessException("媒体文件上传处理出错:"+blockInfo.toJSONString()+" errmsg:"+e.getMessage() );
-				}
-                String filePath = "upload/paper_file/"+paperId+"/" + uuid() +"."+ suff;
-                SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-				OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, iamgeFile);
-				blockInfo.put("value", systemConfig.getProperty("aliyun.oss.privateUrl") + "/" +filePath);
-			}else{
-				String suff=value.substring(value.indexOf("."));
-				String filePath = "upload/paper_file/"+paperId+"/" + uuid() + suff;
-				File audioFile=new File(attachmentDir.getAbsolutePath()+"/"+value);
-				SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-				OssUtil.ossUpload(systemConfig.getOssEnv(3), filePath, audioFile);
-				blockInfo.put("value", systemConfig.getProperty("aliyun.oss.privateUrl") + "/" +filePath);
-			}
-		}
-	}
-	
-	private void addResult(StringBuilder result, String msg) {
-		result.append(msg).append("\r\n");
-	}
-
-	private boolean hasErr(Map<String, Object> map, String rootDir, Long examId, File dfile, StringBuilder result) {
-		Boolean processPaper = (Boolean) map.get("processPaper");
-		Boolean processAnswer = (Boolean) map.get("processAnswer");
-		boolean hasErr = false;
-		for (File courseDir : dfile.listFiles()) {// 校验每一个科目
-			if (courseDir.isDirectory()) {
-				String courseCode = courseDir.getName();
-				TEExamCourse course = teExamCourseService.findByExamIdAndCourseCode(examId, courseCode);
-				if (course == null) {
-					addResult(result, "科目编码不存在 " + courseCode);
-					hasErr = true;
-					continue;
-				}
-				File[] childs = courseDir.listFiles();
-				if (childs == null || childs.length == 0) {
-					addResult(result, "科目 " + courseCode + " 没有需要导入的文件");
-					hasErr = true;
-					continue;
-				}
-				for (File paperDir : childs) {// 校验每一套试卷
-					if (paperDir.isDirectory()) {
-						String paperCode = paperDir.getName();
-						File[] paperDirChilds = paperDir.listFiles();
-						if (paperDirChilds == null || paperDirChilds.length == 0) {
-							addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有需要导入的文件");
-							hasErr = true;
-							continue;
-						}
-						if (processPaper) {
-							if(checkPaperHasExamRecord(examId, courseCode, paperCode)) {
-								addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 已有考试记录,不能再上传试卷");
-								hasErr = true;
-								continue;
-							}
-							String[] ps = paperDir.list(new FilenameFilter() {
-
-								@Override
-								public boolean accept(File dir, String name) {
-									return name.equals("paper.json");
-								}
-							});
-							if (ps == null || ps.length == 0) {
-								addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有试卷文件");
-								hasErr = true;
-								continue;
-							}
-						}
-						if (processAnswer) {
-							String[] ps = paperDir.list(new FilenameFilter() {
-
-								@Override
-								public boolean accept(File dir, String name) {
-									return name.equals("answer.json");
-								}
-							});
-							if (ps == null || ps.length == 0) {
-								addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有答案文件");
-								hasErr = true;
-								continue;
-							}
-						}
-						try {
-							// 校验答案
-							checkAnswerFile(rootDir, paperDirChilds, examId, courseCode, paperCode);
-						} catch (Exception e) {
-							addResult(result, e.getMessage());
-							hasErr = true;
-							continue;
-						}
-					}
-				}
-			}
-		}
-		return hasErr;
-	}
-
-	private boolean checkPaperHasExamRecord(Long examId, String courseCode, String paperCode) {
-		TEExamPaper paper=teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(examId, courseCode, paperCode);
-		if(paper==null) {
-			return false;
-		}
-		TOeExamRecord rd=examRecordService.findOneByPaperId(paper.getId());
-		if(rd!=null) {
-			return true;
-		}
-		return false;
-	}
-
-	private void checkAnswerFile(String rootDir, File[] paperDirChilds, Long examId, String courseCode,
-			String paperCode) {
-		File paperFile = null;
-		File answerFile = null;
-		for (File cfile : paperDirChilds) {// 校验试卷下的答案
-			if ("paper.json".equals(cfile.getName()) && cfile.isFile()) {
-				paperFile = cfile;
-			}
-			if ("answer.json".equals(cfile.getName()) && cfile.isFile()) {
-				answerFile = cfile;
-			}
-		}
-		if (answerFile != null) {
-			if (paperFile == null) {// 没有试卷信息,不能先导入答案
-				TEExamPaper paper = teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(examId, courseCode,
-						paperCode);
-				if (paper == null) {
-					throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 没有试卷信息,不能先导入答案");
-				}
-				String structPath = paper.getStructPath();
-				SystemConfig systemConfig = SpringContextHolder.getBean(SystemConfig.class);
-				String url = OssUtil.getUrlForPrivateBucket(systemConfig.getOssEnv(3), structPath);
-				String name = structPath.substring(structPath.lastIndexOf("/") + 1);
-				File structFile = new File(rootDir + name);
-				try {
-					FileUtil.saveUrlAsFile(url, structFile);
-					compareAnswerAndPaper(courseCode, paperCode, answerFile, structFile);
-				} finally {
-					if (structFile.exists()) {
-						structFile.delete();
-					}
-				}
-			} else {
-				compareAnswerAndPaper(courseCode, paperCode, answerFile, paperFile);
-			}
-		}
-	}
-
-	private void compareAnswerAndPaper(String courseCode, String paperCode, File answerFile, File structFile) {
-		JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(answerFile));
-		JSONArray answerdetails = answerJson.getJSONArray("details");
-		JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(structFile));
-		JSONArray structdetails = structJson.getJSONArray("details");
-		if (answerdetails.size() != structdetails.size()) {
-			throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷大题数量不一致");
-		}
-		for (int i = 0; i < answerdetails.size(); i++) {
-			JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
-			JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
-			if (answerdetailquestions.size() != structdetailquestions.size()) {
-				throw new BusinessException(
-						"科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1) + "大题的小题数量不一致");
-			}
-			for (int j = 0; j < answerdetailquestions.size(); j++) {
-				JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
-				JSONObject structquestion = structdetailquestions.getJSONObject(j);
-				if (structquestion.getInteger("structType").intValue() == 1
-						|| structquestion.getInteger("structType").intValue() == 2) {
-					JSONArray answer = answerquestion.getJSONArray("answer");
-					if (answer == null || answer.size() == 0) {
-						throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
-								+ "大题第" + (j + 1) + "小题没有答案");
-					}
-				}
-				if (structquestion.getInteger("structType").intValue() == 3) {
-					Boolean answer = answerquestion.getBoolean("answer");
-					if (answer == null) {
-						throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
-								+ "大题第" + (j + 1) + "小题没有答案");
-					}
-				}
-				if (structquestion.getInteger("structType").intValue() == 6) {
-					JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
-					JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
-					if (answersubQuestions.size() != structsubQuestions.size()) {
-						throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
-								+ "大题第" + (j + 1) + "小题子题数量不一致");
-					}
-					for (int k = 0; k < answersubQuestions.size(); k++) {
-						JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
-						JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
-						if (structsubquestion.getInteger("structType").intValue() == 1
-								|| structsubquestion.getInteger("structType").intValue() == 2) {
-							JSONArray answer = answersubquestion.getJSONArray("answer");
-							if (answer == null || answer.size() == 0) {
-								throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第"
-										+ (i + 1) + "大题第" + (j + 1) + "小题第" + (k + 1) + "子题没有答案");
-							}
-						}
-						if (structsubquestion.getInteger("structType").intValue() == 3) {
-							Boolean answer = answersubquestion.getBoolean("answer");
-							if (answer == null) {
-								throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第"
-										+ (i + 1) + "大题第" + (j + 1) + "小题第" + (k + 1) + "子题没有答案");
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-
-	private String uuid() {
-		return UUID.randomUUID().toString().replaceAll("-", "");
-	}
+                    byte[] bytes = decoder.decodeBuffer(value.substring(value.indexOf(",") + 1));
+                    FileUtils.writeByteArrayToFile(iamgeFile, bytes);
+                } catch (IOException e) {
+                    throw new BusinessException("媒体文件上传处理出错:" + blockInfo.toJSONString() + " errmsg:" + e.getMessage());
+                }
+                String filePath = "upload/paper_file/" + paperId + "/" + uuid() + "." + suff;
+                OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, iamgeFile);
+                blockInfo.put("value", ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + "/" + filePath);
+            } else {
+                String suff = value.substring(value.indexOf("."));
+                String filePath = "upload/paper_file/" + paperId + "/" + uuid() + suff;
+                File audioFile = new File(attachmentDir.getAbsolutePath() + "/" + value);
+                OssUtil.ossUpload(ossUtil.getAliYunOssPrivateDomain().getMap(), filePath, audioFile);
+                blockInfo.put("value", ossUtil.getAliYunOssPrivateDomain().getPrivateUrl() + "/" + filePath);
+            }
+        }
+    }
+
+    private void addResult(StringBuilder result, String msg) {
+        result.append(msg).append("\r\n");
+    }
+
+    private boolean hasErr(Map<String, Object> map, String rootDir, Long examId, File dfile, StringBuilder result) {
+        Boolean processPaper = (Boolean) map.get("processPaper");
+        Boolean processAnswer = (Boolean) map.get("processAnswer");
+        boolean hasErr = false;
+        for (File courseDir : dfile.listFiles()) {// 校验每一个科目
+            if (courseDir.isDirectory()) {
+                String courseCode = courseDir.getName();
+                TEExamCourse course = teExamCourseService.findByExamIdAndCourseCode(examId, courseCode);
+                if (course == null) {
+                    addResult(result, "科目编码不存在 " + courseCode);
+                    hasErr = true;
+                    continue;
+                }
+                File[] childs = courseDir.listFiles();
+                if (childs == null || childs.length == 0) {
+                    addResult(result, "科目 " + courseCode + " 没有需要导入的文件");
+                    hasErr = true;
+                    continue;
+                }
+                for (File paperDir : childs) {// 校验每一套试卷
+                    if (paperDir.isDirectory()) {
+                        String paperCode = paperDir.getName();
+                        File[] paperDirChilds = paperDir.listFiles();
+                        if (paperDirChilds == null || paperDirChilds.length == 0) {
+                            addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有需要导入的文件");
+                            hasErr = true;
+                            continue;
+                        }
+                        if (processPaper) {
+                            if (checkPaperHasExamRecord(examId, courseCode, paperCode)) {
+                                addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 已有考试记录,不能再上传试卷");
+                                hasErr = true;
+                                continue;
+                            }
+                            String[] ps = paperDir.list(new FilenameFilter() {
+
+                                @Override
+                                public boolean accept(File dir, String name) {
+                                    return name.equals("paper.json");
+                                }
+                            });
+                            if (ps == null || ps.length == 0) {
+                                addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有试卷文件");
+                                hasErr = true;
+                                continue;
+                            }
+                        }
+                        if (processAnswer) {
+                            String[] ps = paperDir.list(new FilenameFilter() {
+
+                                @Override
+                                public boolean accept(File dir, String name) {
+                                    return name.equals("answer.json");
+                                }
+                            });
+                            if (ps == null || ps.length == 0) {
+                                addResult(result, "科目 " + courseCode + " 试卷 " + paperCode + " 没有答案文件");
+                                hasErr = true;
+                                continue;
+                            }
+                        }
+                        try {
+                            // 校验答案
+                            checkAnswerFile(rootDir, paperDirChilds, examId, courseCode, paperCode);
+                        } catch (Exception e) {
+                            addResult(result, e.getMessage());
+                            hasErr = true;
+                            continue;
+                        }
+                    }
+                }
+            }
+        }
+        return hasErr;
+    }
+
+    private boolean checkPaperHasExamRecord(Long examId, String courseCode, String paperCode) {
+        TEExamPaper paper = teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(examId, courseCode, paperCode);
+        if (paper == null) {
+            return false;
+        }
+        TOeExamRecord rd = examRecordService.findOneByPaperId(paper.getId());
+        if (rd != null) {
+            return true;
+        }
+        return false;
+    }
+
+    private void checkAnswerFile(String rootDir, File[] paperDirChilds, Long examId, String courseCode,
+                                 String paperCode) {
+        File paperFile = null;
+        File answerFile = null;
+        for (File cfile : paperDirChilds) {// 校验试卷下的答案
+            if ("paper.json".equals(cfile.getName()) && cfile.isFile()) {
+                paperFile = cfile;
+            }
+            if ("answer.json".equals(cfile.getName()) && cfile.isFile()) {
+                answerFile = cfile;
+            }
+        }
+        if (answerFile != null) {
+            if (paperFile == null) {// 没有试卷信息,不能先导入答案
+                TEExamPaper paper = teExamPaperService.findByExamIdAndCourseCodeAndPaperCode(examId, courseCode,
+                        paperCode);
+                if (paper == null) {
+                    throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 没有试卷信息,不能先导入答案");
+                }
+                String structPath = paper.getStructPath();
+                String url = OssUtil.getUrlForPrivateBucket(ossUtil.getAliYunOssPrivateDomain().getMap(), structPath);
+                String name = structPath.substring(structPath.lastIndexOf("/") + 1);
+                File structFile = new File(rootDir + name);
+                try {
+                    FileUtil.saveUrlAsFile(url, structFile);
+                    compareAnswerAndPaper(courseCode, paperCode, answerFile, structFile);
+                } finally {
+                    if (structFile.exists()) {
+                        structFile.delete();
+                    }
+                }
+            } else {
+                compareAnswerAndPaper(courseCode, paperCode, answerFile, paperFile);
+            }
+        }
+    }
+
+    private void compareAnswerAndPaper(String courseCode, String paperCode, File answerFile, File structFile) {
+        JSONObject answerJson = JSONObject.parseObject(FileUtil.readFileContent(answerFile));
+        JSONArray answerdetails = answerJson.getJSONArray("details");
+        JSONObject structJson = JSONObject.parseObject(FileUtil.readFileContent(structFile));
+        JSONArray structdetails = structJson.getJSONArray("details");
+        if (answerdetails.size() != structdetails.size()) {
+            throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷大题数量不一致");
+        }
+        for (int i = 0; i < answerdetails.size(); i++) {
+            JSONArray answerdetailquestions = answerdetails.getJSONObject(i).getJSONArray("questions");
+            JSONArray structdetailquestions = structdetails.getJSONObject(i).getJSONArray("questions");
+            if (answerdetailquestions.size() != structdetailquestions.size()) {
+                throw new BusinessException(
+                        "科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1) + "大题的小题数量不一致");
+            }
+            for (int j = 0; j < answerdetailquestions.size(); j++) {
+                JSONObject answerquestion = answerdetailquestions.getJSONObject(j);
+                JSONObject structquestion = structdetailquestions.getJSONObject(j);
+                if (structquestion.getInteger("structType").intValue() == 1
+                        || structquestion.getInteger("structType").intValue() == 2) {
+                    JSONArray answer = answerquestion.getJSONArray("answer");
+                    if (answer == null || answer.size() == 0) {
+                        throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
+                                + "大题第" + (j + 1) + "小题没有答案");
+                    }
+                }
+                if (structquestion.getInteger("structType").intValue() == 3) {
+                    Boolean answer = answerquestion.getBoolean("answer");
+                    if (answer == null) {
+                        throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
+                                + "大题第" + (j + 1) + "小题没有答案");
+                    }
+                }
+                if (structquestion.getInteger("structType").intValue() == 6) {
+                    JSONArray answersubQuestions = answerquestion.getJSONArray("subQuestions");
+                    JSONArray structsubQuestions = structquestion.getJSONArray("subQuestions");
+                    if (answersubQuestions.size() != structsubQuestions.size()) {
+                        throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第" + (i + 1)
+                                + "大题第" + (j + 1) + "小题子题数量不一致");
+                    }
+                    for (int k = 0; k < answersubQuestions.size(); k++) {
+                        JSONObject answersubquestion = answersubQuestions.getJSONObject(k);
+                        JSONObject structsubquestion = structsubQuestions.getJSONObject(k);
+                        if (structsubquestion.getInteger("structType").intValue() == 1
+                                || structsubquestion.getInteger("structType").intValue() == 2) {
+                            JSONArray answer = answersubquestion.getJSONArray("answer");
+                            if (answer == null || answer.size() == 0) {
+                                throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第"
+                                        + (i + 1) + "大题第" + (j + 1) + "小题第" + (k + 1) + "子题没有答案");
+                            }
+                        }
+                        if (structsubquestion.getInteger("structType").intValue() == 3) {
+                            Boolean answer = answersubquestion.getBoolean("answer");
+                            if (answer == null) {
+                                throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 答案和试卷第"
+                                        + (i + 1) + "大题第" + (j + 1) + "小题第" + (k + 1) + "子题没有答案");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private String uuid() {
+        return UUID.randomUUID().toString().replaceAll("-", "");
+    }
 }
 }

+ 46 - 7
themis-business/src/main/java/com/qmth/themis/business/util/OssUtil.java

@@ -4,10 +4,18 @@ import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
 import com.aliyun.oss.OSSClientBuilder;
 import com.aliyun.oss.model.*;
 import com.aliyun.oss.model.*;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.domain.AliYunOssDomain;
+import com.qmth.themis.business.domain.AliYunOssPrivateDomain;
+import com.qmth.themis.business.domain.AliYunOssPublicDomain;
+import com.qmth.themis.business.domain.TencentYunDomain;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import javax.annotation.Resource;
+import javax.swing.*;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
@@ -28,6 +36,30 @@ import java.util.Map;
 public class OssUtil {
 public class OssUtil {
     private final static Logger log = LoggerFactory.getLogger(OssUtil.class);
     private final static Logger log = LoggerFactory.getLogger(OssUtil.class);
 
 
+    private AliYunOssPublicDomain aliYunOssPublicDomain;
+
+    private AliYunOssPrivateDomain aliYunOssPrivateDomain;
+
+    @Bean
+    public AliYunOssPublicDomain publicOssEnv(AliYunOssDomain aliYunOssDomain) {
+        aliYunOssPublicDomain = new AliYunOssPublicDomain(aliYunOssDomain.getPublicEndpoint(), aliYunOssDomain.getPublicName(), aliYunOssDomain.getPublicAccessKeyId(), aliYunOssDomain.getPublicAccessKeySecret(), aliYunOssDomain.getPublicBucket(), aliYunOssDomain.getPublicUrl());
+        return aliYunOssPublicDomain;
+    }
+
+    @Bean
+    public AliYunOssPrivateDomain privateOssEnv(AliYunOssDomain aliYunOssDomain) {
+        aliYunOssPrivateDomain = new AliYunOssPrivateDomain(aliYunOssDomain.getPrivateEndpoint(), aliYunOssDomain.getPrivateName(), aliYunOssDomain.getPrivateAccessKeyId(), aliYunOssDomain.getPrivateAccessKeySecret(), aliYunOssDomain.getPrivateBucket(), aliYunOssDomain.getPrivateUrl());
+        return aliYunOssPrivateDomain;
+    }
+
+    public AliYunOssPublicDomain getAliYunOssPublicDomain() {
+        return aliYunOssPublicDomain;
+    }
+
+    public AliYunOssPrivateDomain getAliYunOssPrivateDomain() {
+        return aliYunOssPrivateDomain;
+    }
+
     /**
     /**
      * oss上传文件
      * oss上传文件
      *
      *
@@ -51,6 +83,7 @@ public class OssUtil {
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream);
         PutObjectResult por = ossClient.putObject(putObjectRequest);
         PutObjectResult por = ossClient.putObject(putObjectRequest);
         log.info("objectName:{},requestid:{}", objectName, por.getRequestId());
         log.info("objectName:{},requestid:{}", objectName, por.getRequestId());
+        ossClient.shutdown();
     }
     }
 
 
     /**
     /**
@@ -76,6 +109,7 @@ public class OssUtil {
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, new ByteArrayInputStream(content.getBytes()));
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, new ByteArrayInputStream(content.getBytes()));
         PutObjectResult por = ossClient.putObject(putObjectRequest);
         PutObjectResult por = ossClient.putObject(putObjectRequest);
         log.info("objectName:{},requestid:{}", objectName, por.getRequestId());
         log.info("objectName:{},requestid:{}", objectName, por.getRequestId());
+        ossClient.shutdown();
     }
     }
 
 
     /**
     /**
@@ -182,8 +216,10 @@ public class OssUtil {
         // 关闭OSSClient。
         // 关闭OSSClient。
         ossClient.shutdown();
         ossClient.shutdown();
     }
     }
-    
-    /** 获取私有bucket文件访问url,一分钟有效
+
+    /**
+     * 获取私有bucket文件访问url,一分钟有效
+     *
      * @param map
      * @param map
      * @param objectPath
      * @param objectPath
      * @param inputStream
      * @param inputStream
@@ -196,13 +232,13 @@ public class OssUtil {
         String bucketName = String.valueOf(map.get(SystemConstant.BUCKET));
         String bucketName = String.valueOf(map.get(SystemConstant.BUCKET));
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         Date expiration = new Date(System.currentTimeMillis() + 60 * 1000);
         Date expiration = new Date(System.currentTimeMillis() + 60 * 1000);
-        GeneratePresignedUrlRequest generatePresignedUrlRequest ;
-        generatePresignedUrlRequest =new GeneratePresignedUrlRequest(bucketName, objectPath);
+        GeneratePresignedUrlRequest generatePresignedUrlRequest;
+        generatePresignedUrlRequest = new GeneratePresignedUrlRequest(bucketName, objectPath);
         generatePresignedUrlRequest.setExpiration(expiration);
         generatePresignedUrlRequest.setExpiration(expiration);
         URL url = ossClient.generatePresignedUrl(generatePresignedUrlRequest);
         URL url = ossClient.generatePresignedUrl(generatePresignedUrlRequest);
         return url.toString();
         return url.toString();
     }
     }
-    
+
     public static void ossUpload(Map<String, Object> map, String path, File file) {
     public static void ossUpload(Map<String, Object> map, String path, File file) {
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
@@ -211,8 +247,9 @@ public class OssUtil {
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, file);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, file);
         ossClient.putObject(putObjectRequest);
         ossClient.putObject(putObjectRequest);
+        ossClient.shutdown();
     }
     }
-    
+
     public static void ossUploadStream(Map<String, Object> map, String path, InputStream inputStream) {
     public static void ossUploadStream(Map<String, Object> map, String path, InputStream inputStream) {
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
@@ -221,8 +258,9 @@ public class OssUtil {
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, inputStream);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, inputStream);
         ossClient.putObject(putObjectRequest);
         ossClient.putObject(putObjectRequest);
+        ossClient.shutdown();
     }
     }
-    
+
     public static void ossUploadContent(Map<String, Object> map, String path, String fileContent) {
     public static void ossUploadContent(Map<String, Object> map, String path, String fileContent) {
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String endpoint = String.valueOf(map.get(SystemConstant.END_POINT));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
         String accessKeyId = String.valueOf(map.get(SystemConstant.ACCESS_KEY_ID));
@@ -231,5 +269,6 @@ public class OssUtil {
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, new ByteArrayInputStream(fileContent.getBytes()));
         PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, new ByteArrayInputStream(fileContent.getBytes()));
         ossClient.putObject(putObjectRequest);
         ossClient.putObject(putObjectRequest);
+        ossClient.shutdown();
     }
     }
 }
 }

+ 14 - 9
themis-business/src/main/java/com/qmth/themis/business/util/TencentYunUtil.java

@@ -1,13 +1,10 @@
 package com.qmth.themis.business.util;
 package com.qmth.themis.business.util;
 
 
-import com.qmth.themis.business.config.SystemConfig;
-import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.domain.TencentYunDomain;
 import com.tencentyun.TLSSigAPIv2;
 import com.tencentyun.TLSSigAPIv2;
+import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
-import javax.annotation.Resource;
-import java.util.Map;
-
 /**
 /**
  * @Description: 腾讯云util
  * @Description: 腾讯云util
  * @Param:
  * @Param:
@@ -18,8 +15,13 @@ import java.util.Map;
 @Component
 @Component
 public class TencentYunUtil {
 public class TencentYunUtil {
 
 
-    @Resource
-    SystemConfig systemConfig;
+    private TencentYunDomain tencentYunDomain;
+
+    @Bean
+    public TencentYunDomain tencentYunEnv(TencentYunDomain tencentYunDomain) {
+        this.tencentYunDomain = new TencentYunDomain(tencentYunDomain.getAppId(), tencentYunDomain.getKey(), tencentYunDomain.getUrls());
+        return this.tencentYunDomain;
+    }
 
 
     /**
     /**
      * 获取签名
      * 获取签名
@@ -29,8 +31,11 @@ public class TencentYunUtil {
      * @return
      * @return
      */
      */
     public String getSign(String sessionId, Long expireTime) {
     public String getSign(String sessionId, Long expireTime) {
-        Map<String, Object> map = systemConfig.getTencentYunEnv();
-        TLSSigAPIv2 api = new TLSSigAPIv2(Long.parseLong(String.valueOf(map.get(SystemConstant.TENCENT_APPID))), String.valueOf(map.get(SystemConstant.TENCENT_KEY)));
+        TLSSigAPIv2 api = new TLSSigAPIv2(Long.parseLong(this.tencentYunDomain.getAppId()), this.tencentYunDomain.getKey());
         return api.genSig(sessionId, expireTime);
         return api.genSig(sessionId, expireTime);
     }
     }
+
+    public TencentYunDomain getTencentYunDomain() {
+        return tencentYunDomain;
+    }
 }
 }

+ 30 - 0
themis-business/src/main/java/com/qmth/themis/business/util/WxappUtil.java

@@ -0,0 +1,30 @@
+package com.qmth.themis.business.util;
+
+import com.qmth.themis.business.domain.TencentYunDomain;
+import com.qmth.themis.business.domain.WxappDomain;
+import com.tencentyun.TLSSigAPIv2;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 腾讯云util
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/21
+ */
+@Component
+public class WxappUtil {
+
+    private WxappDomain wxappDomain;
+
+    @Bean
+    public WxappDomain wxappEnv(WxappDomain wxappDomain) {
+        this.wxappDomain = new WxappDomain(wxappDomain.getUrl());
+        return this.wxappDomain;
+    }
+
+    public WxappDomain getWxappDomain() {
+        return wxappDomain;
+    }
+}

+ 0 - 9
themis-exam/src/main/java/com/qmth/themis/exam/ThemisExamApplication.java

@@ -1,22 +1,13 @@
 package com.qmth.themis.exam;
 package com.qmth.themis.exam;
 
 
-import com.qmth.themis.business.config.SystemConfig;
-import com.qmth.themis.business.constant.SpringContextHolder;
-import com.qmth.themis.common.contanst.Constants;
-
-import java.io.File;
-
 import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.web.multipart.MultipartResolver;
-import org.springframework.web.multipart.commons.CommonsMultipartResolver;
 
 
 @SpringBootApplication
 @SpringBootApplication
 @ComponentScan(basePackages = {"com.qmth.themis"})
 @ComponentScan(basePackages = {"com.qmth.themis"})

+ 3 - 7
themis-exam/src/main/java/com/qmth/themis/exam/api/SysController.java

@@ -5,7 +5,6 @@ import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.bean.exam.EnvBean;
 import com.qmth.themis.business.bean.exam.EnvBean;
 import com.qmth.themis.business.bean.exam.OrgInfoBean;
 import com.qmth.themis.business.bean.exam.OrgInfoBean;
 import com.qmth.themis.business.bean.exam.VersionBean;
 import com.qmth.themis.business.bean.exam.VersionBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.entity.TBOrg;
 import com.qmth.themis.business.entity.TBOrg;
 import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.TBOrgService;
 import com.qmth.themis.business.service.TBOrgService;
@@ -38,9 +37,6 @@ public class SysController {
     @Resource
     @Resource
     DictionaryConfig dictionaryConfig;
     DictionaryConfig dictionaryConfig;
 
 
-    @Resource
-    SystemConfig systemConfig;
-
     @ApiOperation(value = "获取环境接口")
     @ApiOperation(value = "获取环境接口")
     @RequestMapping(value = "/env", method = RequestMethod.POST)
     @RequestMapping(value = "/env", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "环境信息", response = Result.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "环境信息", response = Result.class)})
@@ -64,9 +60,9 @@ public class SysController {
         }
         }
         env.setCurrentTime(System.currentTimeMillis());
         env.setCurrentTime(System.currentTimeMillis());
         VersionBean v = new VersionBean();
         VersionBean v = new VersionBean();
-        v.setName(systemConfig.getProperty("client.config.version"));
-        v.setValue(Integer.parseInt(systemConfig.getProperty("client.config.value")));
-        v.setUrl(systemConfig.getProperty("client.config.url"));
+        v.setName(dictionaryConfig.clientDomain().getVersion());
+        v.setValue(dictionaryConfig.clientDomain().getValue());
+        v.setUrl(dictionaryConfig.clientDomain().getUrl());
         env.setVersion(v);
         env.setVersion(v);
         boolean oss = dictionaryConfig.sysDomain().isOss();
         boolean oss = dictionaryConfig.sysDomain().isOss();
         String url = null;
         String url = null;

+ 4 - 6
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -12,8 +12,8 @@ import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.domain.ClientDomain;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
@@ -26,9 +26,7 @@ import com.qmth.themis.business.entity.TEConfig;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.service.*;
-import com.qmth.themis.business.util.RedisUtil;
-import com.qmth.themis.business.util.ServletUtil;
-import com.qmth.themis.business.util.SessionUtil;
+import com.qmth.themis.business.util.*;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Platform;
@@ -93,7 +91,7 @@ public class TEStudentController {
     TEExamCourseService teExamCourseService;
     TEExamCourseService teExamCourseService;
 
 
     @Resource
     @Resource
-    SystemConfig systemConfig;
+    OssUtil ossUtil;
 
 
     @Resource
     @Resource
     TOeExamRecordService tOeExamRecordService;
     TOeExamRecordService tOeExamRecordService;
@@ -153,7 +151,7 @@ public class TEStudentController {
             throw new BusinessException(ExceptionResultEnum.STUDENT_NO);
             throw new BusinessException(ExceptionResultEnum.STUDENT_NO);
         }
         }
         if (StringUtils.isNotBlank(user.getBasePhotoPath())) {
         if (StringUtils.isNotBlank(user.getBasePhotoPath())) {
-            user.setBasePhotoPath(systemConfig.getProperty("aliyun.oss.publicUrl") + File.separator + user.getBasePhotoPath());
+            user.setBasePhotoPath(ossUtil.getAliYunOssPublicDomain().getPublicUrl() + File.separator + user.getBasePhotoPath());
         }
         }
         String loginPassword = AesUtil.decryptCs7(password, Constants.AES_RULE);
         String loginPassword = AesUtil.decryptCs7(password, Constants.AES_RULE);
         //密码错误
         //密码错误

+ 22 - 0
themis-exam/src/main/java/com/qmth/themis/exam/config/DictionaryConfig.java

@@ -80,4 +80,26 @@ public class DictionaryConfig {
     public TencentYunDomain tencentYunDomain() {
     public TencentYunDomain tencentYunDomain() {
         return new TencentYunDomain();
         return new TencentYunDomain();
     }
     }
+
+    /**
+     * 微信配置
+     *
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "wxapp.upload", ignoreUnknownFields = false)
+    public WxappDomain wxappDomain() {
+        return new WxappDomain();
+    }
+
+    /**
+     * 客户端配置
+     *
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "client.config", ignoreUnknownFields = false)
+    public ClientDomain clientDomain() {
+        return new ClientDomain();
+    }
 }
 }

+ 6 - 9
themis-exam/src/main/resources/application.properties

@@ -121,26 +121,23 @@ rocketmq.producer.enable-msg-trace=true
 
 
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.publicEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicEndpoint=http://${aliyun.oss.publicName}
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicBucket=qmth-test
 aliyun.oss.publicBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.publicUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicUrl=http://${aliyun.oss.publicBucket}.${aliyun.oss.publicName}
 
 
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.privateEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateEndpoint=http://${aliyun.oss.privateName}
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateBucket=qmth-test
 aliyun.oss.privateBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.privateUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateUrl=http://${aliyun.oss.privateBucket}.${aliyun.oss.privateName}
 
 
 #\u817E\u8BAF\u4E91\u914D\u7F6E
 #\u817E\u8BAF\u4E91\u914D\u7F6E
 tencentyun.sdk.appId=1400411036
 tencentyun.sdk.appId=1400411036
 tencentyun.sdk.key=d78004c94473cb1cf78af33d333e18b731132e527e829e44e2ab133945243b11
 tencentyun.sdk.key=d78004c94473cb1cf78af33d333e18b731132e527e829e44e2ab133945243b11
+tencentyun.sdk.urls=https://live1.qmth.com.cn,https://live2.qmth.com.cn,https://live3.qmth.com.cn,https://live4.qmth.com.cn,https://live5.qmth.com.cn,https://live6.qmth.com.cn
 
 
 #\u7CFB\u7EDF\u914D\u7F6E
 #\u7CFB\u7EDF\u914D\u7F6E
 sys.config.oss=true
 sys.config.oss=true
@@ -163,7 +160,7 @@ wxapp.upload.url=https://mobile-test.online-exam.cn
 
 
 client.config.version=1.0.0
 client.config.version=1.0.0
 client.config.value=10
 client.config.value=10
-client.config.url=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/client/1.0.0/index.json
+client.config.url=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/client/${client.config.version}/index.json
 
 
 #\u65E0\u9700\u9274\u6743\u7684url
 #\u65E0\u9700\u9274\u6743\u7684url
 no.auth.urls=/webjars/**,/druid/**,/swagger-ui.html,/doc.html,/swagger-resources/**,/v2/api-docs,/webjars/springfox-swagger-ui/**,/api/oe/student/login,/api/oe/sys/env,/file/**,/upload/**,/client/**,/base_photo/**,/frontend/**,/api/oe/exam/short_code,/api/mobile/authorization
 no.auth.urls=/webjars/**,/druid/**,/swagger-ui.html,/doc.html,/swagger-resources/**,/v2/api-docs,/webjars/springfox-swagger-ui/**,/api/oe/student/login,/api/oe/sys/env,/file/**,/upload/**,/client/**,/base_photo/**,/frontend/**,/api/oe/exam/short_code,/api/mobile/authorization

+ 23 - 0
themis-task/src/main/java/com/qmth/themis/task/config/DictionaryConfig.java

@@ -3,6 +3,7 @@ package com.qmth.themis.task.config;
 import com.qmth.themis.business.domain.AliYunOssDomain;
 import com.qmth.themis.business.domain.AliYunOssDomain;
 import com.qmth.themis.business.domain.SysDomain;
 import com.qmth.themis.business.domain.SysDomain;
 import com.qmth.themis.business.domain.TencentYunDomain;
 import com.qmth.themis.business.domain.TencentYunDomain;
+import com.qmth.themis.business.domain.WxappDomain;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
@@ -38,4 +39,26 @@ public class DictionaryConfig {
     public AliYunOssDomain aliYunOssDomain() {
     public AliYunOssDomain aliYunOssDomain() {
         return new AliYunOssDomain();
         return new AliYunOssDomain();
     }
     }
+
+    /**
+     * 腾讯云配置
+     *
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "tencentyun.sdk", ignoreUnknownFields = false)
+    public TencentYunDomain tencentYunDomain() {
+        return new TencentYunDomain();
+    }
+
+    /**
+     * 微信配置
+     *
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "wxapp.upload", ignoreUnknownFields = false)
+    public WxappDomain wxappDomain() {
+        return new WxappDomain();
+    }
 }
 }

+ 0 - 3
themis-task/src/main/java/com/qmth/themis/task/listener/service/impl/MqTaskLogicServiceImpl.java

@@ -49,9 +49,6 @@ public class MqTaskLogicServiceImpl implements MqTaskLogicService {
     @Resource
     @Resource
     QuartzService quartzService;
     QuartzService quartzService;
 
 
-    @Resource
-    TEExamService teExamService;
-
     /**
     /**
      * mq最大重试次数逻辑
      * mq最大重试次数逻辑
      *
      *

+ 10 - 9
themis-task/src/main/resources/application.properties

@@ -101,22 +101,18 @@ spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/MET
 
 
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 #\u963F\u91CC\u4E91OSS\u914D\u7F6E
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.publicName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.publicEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicEndpoint=http://${aliyun.oss.publicName}
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.publicBucket=qmth-test
 aliyun.oss.publicBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.publicUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.publicUrl=http://${aliyun.oss.publicBucket}.${aliyun.oss.publicName}
 
 
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
 aliyun.oss.privateName=oss-cn-shenzhen.aliyuncs.com
-#aliyun.oss.endpoint=http://${aliyun.oss.name}
-aliyun.oss.privateEndpoint=http://oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateEndpoint=http://${aliyun.oss.privateName}
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeyId=LTAI4FnJ2pgV6aGceYcCkeEi
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateAccessKeySecret=ktrMEVE7PfoxRPeJUPDFeygOIH4aU7
 aliyun.oss.privateBucket=qmth-test
 aliyun.oss.privateBucket=qmth-test
-#aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
-aliyun.oss.privateUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com
+aliyun.oss.privateUrl=http://${aliyun.oss.privateBucket}.${aliyun.oss.privateName}
 #============================================================================
 #============================================================================
 # \u914D\u7F6EJobStore
 # \u914D\u7F6EJobStore
 #============================================================================
 #============================================================================
@@ -178,4 +174,9 @@ rocketmq.producer.secret-key=SK
 #\u542F\u7528\u6D88\u606F\u8F68\u8FF9\uFF0C\u9ED8\u8BA4\u503Ctrue
 #\u542F\u7528\u6D88\u606F\u8F68\u8FF9\uFF0C\u9ED8\u8BA4\u503Ctrue
 rocketmq.producer.enable-msg-trace=true
 rocketmq.producer.enable-msg-trace=true
 #\u81EA\u5B9A\u4E49\u7684\u6D88\u606F\u8F68\u8FF9\u4E3B\u9898
 #\u81EA\u5B9A\u4E49\u7684\u6D88\u606F\u8F68\u8FF9\u4E3B\u9898
-#rocketmq.producer.customized-trace-topic=my-trace-topic
+#rocketmq.producer.customized-trace-topic=my-trace-topic
+
+#\u817E\u8BAF\u4E91\u914D\u7F6E
+tencentyun.sdk.appId=1400411036
+tencentyun.sdk.key=d78004c94473cb1cf78af33d333e18b731132e527e829e44e2ab133945243b11
+tencentyun.sdk.urls=https://live1.qmth.com.cn,https://live2.qmth.com.cn,https://live3.qmth.com.cn,https://live4.qmth.com.cn,https://live5.qmth.com.cn,https://live6.qmth.com.cn