Browse Source

考务接口修改

wangliang 5 years ago
parent
commit
685be65d8c
29 changed files with 603 additions and 269 deletions
  1. 12 18
      themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java
  2. 6 5
      themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java
  3. 6 3
      themis-backend/src/main/java/com/qmth/themis/backend/api/TBOrgController.java
  4. 19 11
      themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java
  5. 9 4
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamActivityController.java
  6. 13 13
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamController.java
  7. 7 0
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamCourseController.java
  8. 15 4
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamPaperController.java
  9. 54 6
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java
  10. 5 5
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEStudentController.java
  11. 4 4
      themis-backend/src/main/java/com/qmth/themis/backend/aspect/ApiControllerAspect.java
  12. 45 0
      themis-backend/src/main/java/com/qmth/themis/backend/constant/BackendConstant.java
  13. 3 3
      themis-backend/src/main/java/com/qmth/themis/backend/interceptor/AuthInterceptor.java
  14. 46 32
      themis-backend/src/main/java/com/qmth/themis/backend/util/ServletUtil.java
  15. 1 3
      themis-backend/src/main/resources/application.properties
  16. 2 5
      themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java
  17. 0 20
      themis-business/src/main/java/com/qmth/themis/business/domain/SysDomain.java
  18. 95 0
      themis-business/src/main/java/com/qmth/themis/business/dto/ExamStudentDtoImport.java
  19. 12 0
      themis-business/src/main/java/com/qmth/themis/business/entity/TEExamStudent.java
  20. 37 128
      themis-business/src/main/java/com/qmth/themis/business/enums/AttachmentEnum.java
  21. 67 0
      themis-business/src/main/java/com/qmth/themis/business/enums/UploadFileEnum.java
  22. 12 4
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TBAttachmentServiceImpl.java
  23. 11 0
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCallback.java
  24. 15 0
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportTemplete.java
  25. 11 0
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportCallback.java
  26. 18 0
      themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportTemplete.java
  27. 59 0
      themis-business/src/main/java/com/qmth/themis/business/templete/impl/ExamStudentTemplete.java
  28. 4 0
      themis-business/src/main/java/com/qmth/themis/business/util/ExcelUtil.java
  29. 15 1
      themis-common/src/main/java/com/qmth/themis/common/enums/ExceptionResultEnum.java

+ 12 - 18
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -2,12 +2,14 @@ package com.qmth.themis.backend.api;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.themis.backend.config.DictionaryConfig;
+import com.qmth.themis.backend.constant.BackendConstant;
 import com.qmth.themis.backend.util.ServletUtil;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.TBAttachment;
 import com.qmth.themis.business.entity.TBPrivilege;
 import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.enums.RoleEnum;
+import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBPrivilegeService;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
@@ -23,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
@@ -55,8 +56,7 @@ public class SysController {
     @RequestMapping(value = "/getMenu", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = TBPrivilege.class)})
     public Result getMenu() {
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         if (Objects.isNull(tbUser)) {
             throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
         }
@@ -78,7 +78,7 @@ public class SysController {
     @ApiResponses({@ApiResponse(code = 200, message = "环境信息", response = Result.class)})
     public Result env(@ApiParam(value = "机构id", required = true) @RequestParam Long orgId) {
         if (Objects.isNull(orgId) || Objects.equals(orgId, "")) {
-            throw new BusinessException(ExceptionResultEnum.SCHOOL_ID_IS_NULL);
+            throw new BusinessException(ExceptionResultEnum.ORG_ID_IS_NULL);
         }
 //        SchoolDto schoolDto = (SchoolDto) redisTemplate.opsForValue().get(SystemConstant.SCHOOL_CACHE + orgId);
 //        Map map = new HashMap();
@@ -91,21 +91,15 @@ public class SysController {
     @RequestMapping(value = "/file/upload", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"id\":0}", response = Result.class)})
-    public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) throws IOException {
-        HttpServletRequest request = ServletUtil.getRequest();
-        Map<String, Object> mapParameter = new HashMap<>();
-        mapParameter.put(SystemConstant.END_POINT, dictionaryConfig.aliYunOssDomain().getEndpoint());
-        mapParameter.put(SystemConstant.ACCESS_KEY_ID, dictionaryConfig.aliYunOssDomain().getAccessKeyId());
-        mapParameter.put(SystemConstant.ACCESS_KEY_SECRET, dictionaryConfig.aliYunOssDomain().getAccessKeySecret());
-        mapParameter.put(SystemConstant.BUCKET, dictionaryConfig.aliYunOssDomain().getBucket());
-        mapParameter.put(SystemConstant.OSS, dictionaryConfig.sysDomain().isOss());
-        mapParameter.put(SystemConstant.ATTACHMENT_TYPE, dictionaryConfig.sysDomain().getAttachmentType());
-        mapParameter.put(SystemConstant.LOCALHOST_PATH, dictionaryConfig.sysDomain().getLocalhostPath());
-        mapParameter.put(SystemConstant.BASEPHOTO_PATH, dictionaryConfig.sysDomain().getBasePhotoPath());
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
-        TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, request.getHeader(SystemConstant.MD5), request.getHeader(SystemConstant.PATH), mapParameter, tbUser.getOrgId(), tbUser.getId());
+    public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Integer type) throws IOException {
+        if (Objects.isNull(file) || Objects.equals(file, "")) {
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
+        }
+        Map<String, Object> mapParameter = BackendConstant.getAttachmentEnv(type);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
         if (Objects.isNull(tbAttachment)) {
-            throw new BusinessException("上传文件失败");
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_ERROR);
         }
         Map map = new HashMap();
         map.put(SystemConstant.ID, tbAttachment.getId());

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

@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -70,8 +69,7 @@ public class TBExamInvigilateUserController {
             if (userIds.length > 3) {
                 throw new BusinessException(ExceptionResultEnum.ERROR.getCode(), "一个考场最多设置3名监考员");
             }
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg(request);
+            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg();
             QueryWrapper<TBExamInvigilateUser> tbExamInvigilateUserQueryWrapper = new QueryWrapper<>();
             tbExamInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getRoomCode, roomCode);
             Long orgId = null;
@@ -109,7 +107,10 @@ public class TBExamInvigilateUserController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Integer type) {
+        if (Objects.isNull(file) || Objects.equals(file, "")) {
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
+        }
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
 
@@ -117,7 +118,7 @@ public class TBExamInvigilateUserController {
     @RequestMapping(value = "/export", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result export(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
+    public Result export() {
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
 }

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

@@ -9,6 +9,8 @@ import com.qmth.themis.business.service.TBOrgService;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.contanst.Constants;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
+import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
@@ -16,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -74,8 +75,10 @@ public class TBOrgController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result save(@ApiParam(value = "机构信息", required = true) @RequestBody TBOrg tbOrg) {
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        if (Objects.isNull(tbOrg)) {
+            throw new BusinessException(ExceptionResultEnum.ORG_INFO_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         if (Objects.isNull(tbOrg.getId())) {
             tbOrg.setId(Constants.idGen.next());
             tbOrg.setCreateId(tbUser.getId());

+ 19 - 11
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -41,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
 
@@ -80,6 +79,9 @@ public class TBUserController {
     @RequestMapping(value = "/login/account", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUser.class)})
     public Result login(@ApiParam(value = "用户信息", required = true) @RequestBody TBUser tbUser) throws NoSuchAlgorithmException {
+        if (Objects.isNull(tbUser)) {
+            throw new BusinessException(ExceptionResultEnum.USER_INFO_IS_NULL);
+        }
         if (Objects.isNull(tbUser.getLoginName()) || Objects.equals(tbUser.getLoginName(), "")) {
             throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
         }
@@ -137,13 +139,12 @@ public class TBUserController {
      * @throws NoSuchAlgorithmException
      */
     public Result userLoginCommon(TBUser user) throws NoSuchAlgorithmException {
-        HttpServletRequest request = ServletUtil.getRequest();
         //停用
         if (user.getEnable().intValue() == 0) {
             throw new BusinessException(ExceptionResultEnum.USER_ENABLE);
         }
-        Platform platform = Platform.valueOf(ServletUtil.getRequestPlatform(request));
-        String deviceId = ServletUtil.getRequestDeviceId(request);
+        Platform platform = Platform.valueOf(ServletUtil.getRequestPlatform());
+        String deviceId = ServletUtil.getRequestDeviceId();
         //添加用户鉴权缓存
         AuthDto authDto = ehcacheService.addAccountCache(user);
         //生成token
@@ -154,7 +155,7 @@ public class TBUserController {
         String sessionId = SessionUtil.digest(user.getId(), authDto.getRoleCodes().toString().replaceAll(",", "&&").replaceAll(" ", ""), platform.getSource());
 
         Date expire = SystemConstant.getExpireTime(platform);
-        TBSession tbSession = new TBSession(sessionId, String.valueOf(user.getId()), authDto.getRoleCodes().toString(), platform.getSource(), platform.name(), deviceId, request.getLocalAddr(), token, expire);
+        TBSession tbSession = new TBSession(sessionId, String.valueOf(user.getId()), authDto.getRoleCodes().toString(), platform.getSource(), platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token, expire);
         redisUtil.setUserSession(sessionId, tbSession);
         //mq发送消息start
         mqDtoService.assembleSendOneWayMsg(dictionaryConfig.mqConfigDomain().getSessionTopic(), platform.getSource(), tbSession, MqEnum.SESSION.name(), tbSession.getId(), user.getLoginName());
@@ -483,9 +484,8 @@ public class TBUserController {
     @RequestMapping(value = "/logout", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result logout() throws NoSuchAlgorithmException {
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
-        TBSession tbSession = (TBSession) ServletUtil.getRequestSession(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
         AuthDto authDto = (AuthDto) EhcacheUtil.get(SystemConstant.AUTH_CACHE, tbUser.getId());
         if (Objects.isNull(tbSession)) {
             throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
@@ -535,6 +535,9 @@ public class TBUserController {
             @ApiJsonProperty(key = "mobileNumber", description = "手机号"),
             @ApiJsonProperty(key = "roles", description = "角色")
     }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {
+        if (Objects.isNull(mapParameter)) {
+            throw new BusinessException(ExceptionResultEnum.USER_INFO_IS_NULL);
+        }
         Gson gson = new Gson();
         TBUser tbUser = gson.fromJson(gson.toJson(mapParameter), TBUser.class);
         List<String> roleList = (List<String>) mapParameter.get("role");
@@ -543,10 +546,9 @@ public class TBUserController {
             roleSet = new HashSet<>(roleList);
         }
         if (Objects.isNull(tbUser.getId())) {
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg(request);
+            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg();
             tbUser.setId(Constants.idGen.next());
-            if(Objects.nonNull(tbOrg)) {
+            if (Objects.nonNull(tbOrg)) {
                 tbUser.setOrgId(tbOrg.getId());
             }
             tbUser.setCreateId(tbUser.getId());
@@ -577,6 +579,9 @@ public class TBUserController {
     @RequestMapping(value = "/getVerifyCode", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"verifyCode\":123456}", response = Result.class)})
     public Result getVerifyCode(@ApiParam(value = "登录名", required = true) @RequestParam String loginName) {
+        if (Objects.isNull(loginName) || Objects.equals(loginName, "")) {
+            throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
+        }
         Map map = new HashMap();
         return ResultUtil.ok(map);
     }
@@ -585,6 +590,9 @@ public class TBUserController {
     @RequestMapping(value = "/validate/verifyCode", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result validateVerifyCode(@ApiParam(value = "验证码", required = true) @RequestParam String verifyCode) {
+        if (Objects.isNull(verifyCode) || Objects.equals(verifyCode, "")) {
+            throw new BusinessException(ExceptionResultEnum.VERIFYCODE_IS_NULL);
+        }
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
 

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

@@ -10,6 +10,7 @@ import com.qmth.themis.business.enums.FieldUniqueEnum;
 import com.qmth.themis.business.service.TEExamActivityService;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.common.contanst.Constants;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
@@ -19,8 +20,10 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * @Description: 考试场次 前端控制器
@@ -42,9 +45,11 @@ public class TEExamActivityController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result save(@ApiParam(value = "考试场次信息", required = true) @RequestBody List<TEExamActivity> teExamActivityList) {
+        if (Objects.isNull(teExamActivityList) || teExamActivityList.size() == 0) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_INFO_IS_NULL);
+        }
         try {
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             teExamActivityList.forEach(s -> {
                 if (Objects.nonNull(s.getId())) {
                     s.setUpdateId(tbUser.getId());

+ 13 - 13
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamController.java

@@ -1,6 +1,5 @@
 package com.qmth.themis.backend.api;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -22,13 +21,11 @@ import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
-import org.checkerframework.checker.units.qual.s;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -57,10 +54,12 @@ public class TEExamController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result save(@ApiParam(value = "考试批次信息", required = true) @RequestBody TEExam teExam) {
+        if (Objects.isNull(teExam) || Objects.equals(teExam, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_INFO_IS_NULL);
+        }
         try {
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
-            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg(request);
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+            TBOrg tbOrg = (TBOrg) ServletUtil.getRequestOrg();
             if (Objects.nonNull(tbOrg)) {
                 teExam.setOrgId(tbOrg.getId());
             }
@@ -122,9 +121,9 @@ public class TEExamController {
     @Transactional
     public Result toggle(
             @ApiJsonObject(name = "examToggle", value = {
-            @ApiJsonProperty(key = "id", type = "long", example = "1", description = "考试批次ID"),
-            @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "是否启用")
-    })
+                    @ApiJsonProperty(key = "id", type = "long", example = "1", description = "考试批次ID"),
+                    @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "是否启用")
+            })
             @ApiParam(value = "考试批次信息", required = true) @RequestBody Map<String, Object> mapParameter) {
         if (Objects.isNull(mapParameter.get("id")) || Objects.equals(mapParameter.get("id"), "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
@@ -138,8 +137,7 @@ public class TEExamController {
         if (Objects.isNull(teExam)) {
             throw new BusinessException(ExceptionResultEnum.EXAM_NO);
         }
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         teExam.setEnable(enable);
         teExam.setUpdateId(tbUser.getId());
         teExamService.updateById(teExam);
@@ -150,6 +148,9 @@ public class TEExamController {
     @RequestMapping(value = "/detail", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = TEExam.class)})
     public Result detail(@ApiParam(value = "考试批次id", required = true) @RequestParam Long id) {
+        if (Objects.isNull(id) || Objects.equals(id, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
         TEExam teExam = teExamService.getById(id);
         if (Objects.isNull(teExam)) {
             throw new BusinessException(ExceptionResultEnum.EXAM_NO);
@@ -188,8 +189,7 @@ public class TEExamController {
             teExam.setId(null);
             teExam.setUpdateId(null);
             teExam.setUpdateTime(null);
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             teExam.setCreateId(tbUser.getId());
             teExam.setCode(code);
             teExam.setName(name);

+ 7 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamCourseController.java

@@ -8,6 +8,7 @@ import com.qmth.themis.business.enums.FieldUniqueEnum;
 import com.qmth.themis.business.service.TEExamCourseService;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.common.contanst.Constants;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
@@ -41,6 +42,9 @@ public class TEExamCourseController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result save(@ApiParam(value = "考试科目信息", required = true) @RequestBody TEExamCourse teExamCourse) {
+        if (Objects.isNull(teExamCourse) || Objects.equals(teExamCourse, "")) {
+            throw new BusinessException(ExceptionResultEnum.COURSE_INFO_IS_NULL);
+        }
         try {
             if (Objects.isNull(teExamCourse.getId())) {
                 teExamCourse.setId(Constants.idGen.next());
@@ -65,6 +69,9 @@ public class TEExamCourseController {
     @RequestMapping(value = "/query", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "考试科目信息", response = TEExamCourse.class)})
     public Result query(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId, @ApiParam(value = "科目编码", required = false) @RequestParam(required = false) String courseCode, @ApiParam(value = "科目名称", required = false) @RequestParam(required = false) String courseName, @ApiParam(value = "是否已绑定试卷", required = false) @RequestParam(required = false) Integer hasPaper, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
         IPage<TEExamCourse> teExamActivityIPage = teExamCourseService.examCourseQuery(new Page<>(pageNumber, pageSize), examId, courseCode, courseName, hasPaper);
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, teExamActivityIPage);

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

@@ -9,6 +9,7 @@ import com.qmth.themis.business.enums.FieldUniqueEnum;
 import com.qmth.themis.business.service.TEExamPaperService;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.common.contanst.Constants;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
@@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -44,6 +44,12 @@ public class TEExamPaperController {
     @RequestMapping(value = "/query", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "考试科目信息", response = TEExamPaper.class)})
     public Result query(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId, @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        if (Objects.isNull(courseCode) || Objects.equals(courseCode, "")) {
+            throw new BusinessException(ExceptionResultEnum.COURSE_CODE_IS_NULL);
+        }
         QueryWrapper<TEExamPaper> teExamPaperQueryWrapper = new QueryWrapper<>();
         teExamPaperQueryWrapper.lambda().eq(TEExamPaper::getExamId, examId).eq(TEExamPaper::getCourseCode, courseCode);
         List<TEExamPaper> teExamPaperList = teExamPaperService.list(teExamPaperQueryWrapper);
@@ -57,9 +63,11 @@ public class TEExamPaperController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result save(@ApiParam(value = "考试试卷信息", required = true) @RequestBody List<TEExamPaper> teExamPaperList) {
+        if (Objects.isNull(teExamPaperList) || teExamPaperList.size() == 0) {
+            throw new BusinessException(ExceptionResultEnum.PAPER_INFO_IS_NULL);
+        }
         try {
-            HttpServletRequest request = ServletUtil.getRequest();
-            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             teExamPaperList.forEach(s -> {
                 if (Objects.nonNull(s.getId())) {
                     s.setUpdateId(tbUser.getId());
@@ -88,7 +96,10 @@ public class TEExamPaperController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Integer type) {
+        if (Objects.isNull(file) || Objects.equals(file, "")) {
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
+        }
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
 }

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

@@ -2,25 +2,34 @@ package com.qmth.themis.backend.api;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.themis.backend.constant.BackendConstant;
 import com.qmth.themis.backend.util.ServletUtil;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.entity.TBAttachment;
 import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TEExamStudent;
+import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TEExamStudentService;
+import com.qmth.themis.business.templete.TaskImportTemplete;
+import com.qmth.themis.business.templete.impl.ExamStudentTemplete;
+import com.qmth.themis.business.util.ExcelUtil;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 import java.util.*;
 
 /**
@@ -34,14 +43,21 @@ import java.util.*;
 @RestController
 @RequestMapping("/${prefix.url.admin}/examStudent")
 public class TEExamStudentController {
+    private final static Logger log = LoggerFactory.getLogger(TEExamStudentController.class);
 
     @Resource
     TEExamStudentService teExamStudentService;
 
+    @Resource
+    TBAttachmentService tbAttachmentService;
+
     @ApiOperation(value = "考生查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TEExamStudent.class)})
     public Result query(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId, @ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long activityId, @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity, @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name, @ApiParam(value = "考场代码", required = false) @RequestParam(required = false) String roomCode, @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode, @ApiParam(value = "年级", required = false) @RequestParam String grade, @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
         IPage<Map> teExamStudentIPage = teExamStudentService.examStudentQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, roomCode, courseCode, grade, enable);
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, teExamStudentIPage);
@@ -59,8 +75,7 @@ public class TEExamStudentController {
         if (Objects.isNull(mapParameter) || mapParameter.size() == 0) {
             throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_INFO_IS_NULL);
         }
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         List<TEExamStudent> teExamStudentList = new ArrayList<>();
         for (int i = 0; i < mapParameter.size(); i++) {
             Map map = mapParameter.get(i);
@@ -81,7 +96,7 @@ public class TEExamStudentController {
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
     public Result save(@ApiParam(value = "考生信息", required = true) @RequestBody List<TEExamStudent> teExamStudentList) {
-        if (Objects.isNull(teExamStudentList)) {
+        if (Objects.isNull(teExamStudentList) || teExamStudentList.size() == 0) {
             throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_INFO_IS_NULL);
         }
         teExamStudentService.updateBatchById(teExamStudentList);
@@ -93,7 +108,7 @@ public class TEExamStudentController {
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
     public Result delete(@ApiParam(value = "考生id", required = true) @RequestBody List<Long> ids) {
-        if (Objects.isNull(ids)) {
+        if (Objects.isNull(ids) || ids.size() == 0) {
             throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_ID_IS_NULL);
         }
         teExamStudentService.removeByIds(ids);
@@ -104,7 +119,40 @@ public class TEExamStudentController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Integer type) throws IOException {
+        if (Objects.isNull(file) || Objects.equals(file, "")) {
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
+        }
+        log.info("开始考生导入");
+        long start = System.currentTimeMillis();
+        Map<String, Object> mapParameter = BackendConstant.getAttachmentEnv(type);
+        TBAttachment tbAttachment = null;
+        try {
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+            tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
+            if (Objects.isNull(tbAttachment)) {
+                throw new BusinessException(ExceptionResultEnum.ATTACHMENT_ERROR);
+            }
+            TaskImportTemplete examStudentTemplete = new ExamStudentTemplete();
+            examStudentTemplete.importTask(file);
+            long end = System.currentTimeMillis();
+            log.info("考生导入结束,============耗时============:{}秒", (end - start) / 1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+            if (Objects.nonNull(tbAttachment)) {
+                tbAttachmentService.deleteAttachment(mapParameter, tbAttachment);
+            }
+            if (e instanceof DuplicateKeyException) {
+//                String errorColumn = e.getCause().toString();
+//                String column = errorColumn.substring(errorColumn.indexOf("'") + 1, errorColumn.lastIndexOf("-"));
+//                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+//                throw new BusinessException(AttachmentErrorEnum.convertToCode(columnStr) + "-" + column + ",数据不允许重复插入");
+            } else if (e instanceof BusinessException) {
+                throw new BusinessException(e.getMessage());
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
 }

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

@@ -20,7 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -70,8 +69,7 @@ public class TEStudentController {
         if (Objects.isNull(teStudent)) {
             throw new BusinessException(ExceptionResultEnum.STUDENT_NO);
         }
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         teStudent.setEnable(enable);
         teStudent.setUpdateId(tbUser.getId());
         teStudentService.updateById(teStudent);
@@ -98,8 +96,7 @@ public class TEStudentController {
         if (Objects.isNull(teStudent)) {
             throw new BusinessException(ExceptionResultEnum.STUDENT_INFO_IS_NULL);
         }
-        HttpServletRequest request = ServletUtil.getRequest();
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount(request);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         teStudent.setPassword(password);
         teStudent.setUpdateId(tbUser.getId());
         teStudentService.updateById(teStudent);
@@ -110,6 +107,9 @@ public class TEStudentController {
     @RequestMapping(value = "/studentExamRecordQuery", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TEExamStudent.class)})
     public Result studentExamRecordQuery(@ApiParam(value = "学生id", required = true) @RequestParam Long id, @ApiParam(value = "批次名称", required = false) @RequestParam(required = false) String name, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(id) || Objects.equals(id, "")) {
+            throw new BusinessException(ExceptionResultEnum.STUDENT_ID_IS_NULL);
+        }
         IPage<Map> studentExamRecordQuery = teStudentService.studentExamRecordQuery(new Page<>(pageNumber, pageSize), id, name);
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, studentExamRecordQuery);

+ 4 - 4
themis-backend/src/main/java/com/qmth/themis/backend/aspect/ApiControllerAspect.java

@@ -56,10 +56,10 @@ public class ApiControllerAspect {
                 log.info("============参数key:{},参数value===========:{}", paramsName[i], args[i]);
             }
 //            log.info("============参数key:{},参数value===========:{}", JSONObject.toJSONString(paramsName), JSONObject.toJSONString(args));
-            log.info("============platform===========:{}", ServletUtil.getRequestPlatform(request));
-            log.info("============deviceId===========:{}", ServletUtil.getRequestDeviceId(request));
-            log.info("============Authorization===========:{}", ServletUtil.getRequestAuthorization(request));
-            log.info("============time===========:{}", ServletUtil.getRequestTime(request));
+            log.info("============platform===========:{}", ServletUtil.getRequestPlatform());
+            log.info("============deviceId===========:{}", ServletUtil.getRequestDeviceId());
+            log.info("============Authorization===========:{}", ServletUtil.getRequestAuthorization());
+            log.info("============time===========:{}", ServletUtil.getRequestTime());
             Object proceed = joinPoint.proceed();
             long end = System.currentTimeMillis();
             log.info("============耗时============:{}秒", (end - start) / 1000);

+ 45 - 0
themis-backend/src/main/java/com/qmth/themis/backend/constant/BackendConstant.java

@@ -0,0 +1,45 @@
+package com.qmth.themis.backend.constant;
+
+import com.qmth.themis.backend.config.DictionaryConfig;
+import com.qmth.themis.business.constant.SpringContextHolder;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.enums.UploadFileEnum;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
+import com.qmth.themis.common.exception.BusinessException;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @Description: 后台系统常量
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/15
+ */
+public class BackendConstant {
+
+    /**
+     * 获取系统上传环境
+     *
+     * @param type
+     * @return
+     */
+    public static Map<String, Object> getAttachmentEnv(Integer type) {
+        if (Objects.isNull(type) || Objects.equals(type, "")) {
+            throw new BusinessException(ExceptionResultEnum.ATTACHMENT_TYPE_IS_NULL);
+        }
+        DictionaryConfig dictionaryConfig = SpringContextHolder.getBean(DictionaryConfig.class);
+        Map<String, Object> mapParameter = new HashMap<>();
+        mapParameter.put(SystemConstant.END_POINT, dictionaryConfig.aliYunOssDomain().getEndpoint());
+        mapParameter.put(SystemConstant.ACCESS_KEY_ID, dictionaryConfig.aliYunOssDomain().getAccessKeyId());
+        mapParameter.put(SystemConstant.ACCESS_KEY_SECRET, dictionaryConfig.aliYunOssDomain().getAccessKeySecret());
+        mapParameter.put(SystemConstant.BUCKET, dictionaryConfig.aliYunOssDomain().getBucket());
+        mapParameter.put(SystemConstant.OSS, dictionaryConfig.sysDomain().isOss());
+        mapParameter.put(SystemConstant.ATTACHMENT_TYPE, dictionaryConfig.sysDomain().getAttachmentType());
+        String uploadType = UploadFileEnum.convertToName(type);
+        mapParameter.put(SystemConstant.UPLOAD_TYPE, uploadType);
+        return mapParameter;
+    }
+}

+ 3 - 3
themis-backend/src/main/java/com/qmth/themis/backend/interceptor/AuthInterceptor.java

@@ -57,8 +57,8 @@ public class AuthInterceptor implements HandlerInterceptor {
         log.info("HandlerInterceptor preHandle is come in");
         String url = request.getServletPath();
         String method = request.getMethod();
-        Platform platform = Platform.valueOf(ServletUtil.getRequestPlatform(request));
-        String deviceId = ServletUtil.getRequestDeviceId(request);
+        Platform platform = Platform.valueOf(ServletUtil.getRequestPlatform());
+        String deviceId = ServletUtil.getRequestDeviceId();
         if (Objects.isNull(platform) || Objects.equals(platform, "")) {
             throw new BusinessException(ExceptionResultEnum.PLATFORM_INVALID);
         }
@@ -81,7 +81,7 @@ public class AuthInterceptor implements HandlerInterceptor {
 //                    .parse(method, url, timestamp, ServletUtil.getRequestAuthorization(request));
         //测试
         final SignatureInfo info = SignatureInfo
-                .parse(ServletUtil.getRequestAuthorization(request));
+                .parse(ServletUtil.getRequestAuthorization());
         if (Objects.nonNull(info) && info.getType() == SignatureType.TOKEN) {
             String sessionId = info.getInvoker();
             TBSession tbSession = (TBSession) redisUtil.getUserSession(sessionId);

+ 46 - 32
themis-backend/src/main/java/com/qmth/themis/backend/util/ServletUtil.java

@@ -25,29 +25,28 @@ public class ServletUtil {
     /**
      * 输出错误
      *
-     * @param response
      * @param code
      * @param message
      * @throws IOException
      */
-    public static void responseError(HttpServletResponse response, String code, String message) throws IOException {
+    public static void responseError(String code, String message) throws IOException {
         Result result = ResultUtil.error(code, message);
         String json = JacksonUtil.parseJson(result);
-        response.getWriter().print(json);
+        getResponse().getWriter().print(json);
     }
 
     /**
      * 获取请求的accessToken
      *
-     * @param httpRequest
      * @return
      */
-    public static String getRequestToken(HttpServletRequest httpRequest) {
+    public static String getRequestToken() {
+        HttpServletRequest request = getRequest();
         // 从header中获取token
-        String token = httpRequest.getHeader(SystemConstant.ACCESS_TOKEN);
+        String token = request.getHeader(SystemConstant.ACCESS_TOKEN);
         // 如果header中不存在token,则从参数中获取token
         if (Objects.isNull(token)) {
-            token = httpRequest.getParameter(SystemConstant.ACCESS_TOKEN);
+            token = request.getParameter(SystemConstant.ACCESS_TOKEN);
         }
         return token;
     }
@@ -55,15 +54,15 @@ public class ServletUtil {
     /**
      * 获取请求的platform
      *
-     * @param httpRequest
      * @return
      */
-    public static String getRequestPlatform(HttpServletRequest httpRequest) {
+    public static String getRequestPlatform() {
+        HttpServletRequest request = getRequest();
         // 从header中获取platform
-        String platform = httpRequest.getHeader(Constants.HEADER_PLATFORM);
+        String platform = request.getHeader(Constants.HEADER_PLATFORM);
         // 如果header中不存在platform,则从参数中获取platform
         if (Objects.isNull(platform)) {
-            platform = httpRequest.getParameter(Constants.HEADER_PLATFORM);
+            platform = request.getParameter(Constants.HEADER_PLATFORM);
         }
         return platform;
     }
@@ -71,15 +70,15 @@ public class ServletUtil {
     /**
      * 获取请求的deviceId
      *
-     * @param httpRequest
      * @return
      */
-    public static String getRequestDeviceId(HttpServletRequest httpRequest) {
+    public static String getRequestDeviceId() {
+        HttpServletRequest request = getRequest();
         // 从header中获取deviceId
-        String deviceId = httpRequest.getHeader(Constants.HEADER_DEVICE_ID);
+        String deviceId = request.getHeader(Constants.HEADER_DEVICE_ID);
         // 如果header中不存在deviceId,则从参数中获取deviceId
         if (Objects.isNull(deviceId)) {
-            deviceId = httpRequest.getParameter(Constants.HEADER_DEVICE_ID);
+            deviceId = request.getParameter(Constants.HEADER_DEVICE_ID);
         }
         return deviceId;
     }
@@ -87,15 +86,15 @@ public class ServletUtil {
     /**
      * 获取请求的time
      *
-     * @param httpRequest
      * @return
      */
-    public static String getRequestTime(HttpServletRequest httpRequest) {
+    public static String getRequestTime() {
+        HttpServletRequest request = getRequest();
         // 从header中获取time
-        String time = httpRequest.getHeader(Constants.HEADER_TIME);
+        String time = request.getHeader(Constants.HEADER_TIME);
         // 如果header中不存在time,则从参数中获取time
         if (Objects.isNull(time)) {
-            time = httpRequest.getParameter(Constants.HEADER_TIME);
+            time = request.getParameter(Constants.HEADER_TIME);
         }
         return time;
     }
@@ -103,47 +102,62 @@ public class ServletUtil {
     /**
      * 获取请求的Authorization
      *
-     * @param httpRequest
      * @return
      */
-    public static String getRequestAuthorization(HttpServletRequest httpRequest) {
+    public static String getRequestAuthorization() {
+        HttpServletRequest request = getRequest();
         // 从header中获取authorization
-        String authorization = httpRequest.getHeader(Constants.HEADER_AUTHORIZATION);
+        String authorization = request.getHeader(Constants.HEADER_AUTHORIZATION);
         // 如果header中不存在authorization,则从参数中获取authorization
         if (Objects.isNull(authorization)) {
-            authorization = httpRequest.getParameter(Constants.HEADER_AUTHORIZATION);
+            authorization = request.getParameter(Constants.HEADER_AUTHORIZATION);
         }
         return authorization;
     }
 
+    /**
+     * 获取请求的md5
+     *
+     * @return
+     */
+    public static String getRequestMd5() {
+        return getRequest().getHeader(SystemConstant.MD5);
+    }
+
+    /**
+     * 获取请求的path
+     *
+     * @return
+     */
+    public static String getRequestPath() {
+        return getRequest().getHeader(SystemConstant.PATH);
+    }
+
     /**
      * 获取请求的Session
      *
-     * @param httpRequest
      * @return
      */
-    public static Object getRequestSession(HttpServletRequest httpRequest) {
-        return httpRequest.getAttribute(SystemConstant.SESSION);
+    public static Object getRequestSession() {
+        return getRequest().getAttribute(SystemConstant.SESSION);
     }
 
     /**
      * 获取请求的account
      *
-     * @param httpRequest
      * @return
      */
-    public static Object getRequestAccount(HttpServletRequest httpRequest) {
-        return httpRequest.getAttribute(SystemConstant.ACCOUNT);
+    public static Object getRequestAccount() {
+        return getRequest().getAttribute(SystemConstant.ACCOUNT);
     }
 
     /**
      * 获取请求的org
      *
-     * @param httpRequest
      * @return
      */
-    public static Object getRequestOrg(HttpServletRequest httpRequest) {
-        return httpRequest.getAttribute(SystemConstant.ORG);
+    public static Object getRequestOrg() {
+        return getRequest().getAttribute(SystemConstant.ORG);
     }
 
     /**

+ 1 - 3
themis-backend/src/main/resources/application.properties

@@ -118,9 +118,7 @@ aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
 
 #\u7CFB\u7EDF\u914D\u7F6E
 sys.config.oss=false
-sys.config.localhostPath=upload
-sys.config.basePhotoPath=base_photo
-sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html
+sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip
 sys.config.serverUpload=/Users/king/git/themis-server/
 #\u7F51\u5173accessKey\u548Csecret,\u6D4B\u8BD5\u7528
 #sys.config.gatewayAccessKey=LTAI4FhEmrrhh27vzPGh25xe

+ 2 - 5
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -3,8 +3,6 @@ package com.qmth.themis.business.constant;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.enums.Source;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 
 import java.util.Calendar;
 import java.util.Date;
@@ -55,8 +53,7 @@ public class SystemConstant {
     public static final String ID = "id";
     public static final String MD5 = "md5";
     public static final String ATTACHMENT_TYPE = "attachmentType";
-    public static final String LOCALHOST_PATH = "localhostPath";
-    public static final String BASEPHOTO_PATH = "basePhotoPath";
+    public static final String UPLOAD_TYPE = "uploadType";
     public static final String DEFAULT_PASSWORD = "123456";
     /**
      * session过期时间
@@ -70,7 +67,7 @@ public class SystemConstant {
      */
     public static final long REDIS_EXPIRE_TIME = 60L * 1440L;//过期时间24小时
     public static final long REDIS_REFRESH_EXPIRE_TIME = 60L * 60L;//刷新时间1小时,理论上说24小时还不睡觉也已经快不行了
-    public static final long REFRESH_EXPIRE_TIME = 60L * 5L;//过期剩余时间5分钟
+//    public static final long REFRESH_EXPIRE_TIME = 60L * 5L;//过期剩余时间5分钟
     /**
      * rocket mq
      */

+ 0 - 20
themis-business/src/main/java/com/qmth/themis/business/domain/SysDomain.java

@@ -13,10 +13,6 @@ public class SysDomain {
 
     boolean oss;
 
-    String localhostPath;
-
-    String basePhotoPath;
-
     List<String> attachmentType;
 
     String serverUpload;
@@ -29,22 +25,6 @@ public class SysDomain {
         this.oss = oss;
     }
 
-    public String getLocalhostPath() {
-        return localhostPath;
-    }
-
-    public void setLocalhostPath(String localhostPath) {
-        this.localhostPath = localhostPath;
-    }
-
-    public String getBasePhotoPath() {
-        return basePhotoPath;
-    }
-
-    public void setBasePhotoPath(String basePhotoPath) {
-        this.basePhotoPath = basePhotoPath;
-    }
-
     public List<String> getAttachmentType() {
         return attachmentType;
     }

+ 95 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/ExamStudentDtoImport.java

@@ -0,0 +1,95 @@
+package com.qmth.themis.business.dto;
+
+import java.io.Serializable;
+
+/** 
+* @Description: 考生导入dto
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/7/15 
+*/ 
+public class ExamStudentDtoImport implements Serializable {
+
+    private String name; //姓名
+    private String identity; //证件号
+    private String courseCode; //科目代码
+    private String courseName; //科目名称
+    private String grade; //年级
+    private String classNo; //教学班级
+    private String examActivityCode; //场次
+    private String roomCode; //考场代码
+    private String roomName; //考场名称
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIdentity() {
+        return identity;
+    }
+
+    public void setIdentity(String identity) {
+        this.identity = identity;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getGrade() {
+        return grade;
+    }
+
+    public void setGrade(String grade) {
+        this.grade = grade;
+    }
+
+    public String getClassNo() {
+        return classNo;
+    }
+
+    public void setClassNo(String classNo) {
+        this.classNo = classNo;
+    }
+
+    public String getExamActivityCode() {
+        return examActivityCode;
+    }
+
+    public void setExamActivityCode(String examActivityCode) {
+        this.examActivityCode = examActivityCode;
+    }
+
+    public String getRoomCode() {
+        return roomCode;
+    }
+
+    public void setRoomCode(String roomCode) {
+        this.roomCode = roomCode;
+    }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
+}

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamStudent.java

@@ -75,6 +75,18 @@ public class TEExamStudent extends BaseEntity {
     @TableField(value = "class_no")
     private String classNo;
 
+    @ApiModelProperty(value = "科目名称")
+    @TableField(value = "course_name")
+    private String courseName;
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
     public String getClassNo() {
         return classNo;
     }

+ 37 - 128
themis-business/src/main/java/com/qmth/themis/business/enums/AttachmentEnum.java

@@ -10,79 +10,24 @@ import java.util.Objects;
  * @Date: 2020/4/18
  */
 public enum AttachmentEnum {
-    /**
-     * 用户名
-     */
-    loginName("用户名"),
-    /**
-     * 姓名
-     */
-    name("姓名"),
-    /**
-     * 角色编码
-     */
-    roleCode("角色编码"),
-    /**
-     * 角色名称
-     */
-    roleName("角色名称"),
-    /**
-     * 科目编码
-     */
-    courseCode("科目编码"),
-
-    /**
-     * 科目名称
-     */
-    courseName("科目名称"),
-
-    /**
-     * 场次开始时间
-     */
-    startTime("场次开始时间"),
-
-    /**
-     * 场次结束时间
-     */
-    endTime("场次结束时间"),
 
-    /**
-     * 场次名称
-     */
-    sceneNumberName("场次名称"),
-
-    /**
-     * 场次id
-     */
-    sceneNumberId("场次ID"),
+    name("姓名"),
 
-    /**
-     * 考点名称
-     */
-    examSite("考点名称"),
+    identity("证件号"),
 
-    /**
-     * 考场名称
-     */
-    examRoom("考场名称"),
+    courseCode("科目代码"),
 
-    /**
-     * 考场id
-     */
-    examRoomId("考场ID"),
+    courseName("科目名称"),
 
-    /**
-     * 学号
-     */
-    studentCode("学号"),
+    grade("年级"),
 
-    gender("性别"),
+    classNo("教学班级"),
 
-    cardId("身份证号"),
+    examActivityCode("场次"),
 
-    examNumber("考号"),
+    roomCode("考场代码"),
 
-    siteNumber("座位号"),
+    roomName("考场名称"),
 
     extendColumn("扩展字段");
 
@@ -99,44 +44,26 @@ public enum AttachmentEnum {
      * @return
      */
     public static String convertToName(String value) {
-        if (Objects.equals(value.trim(), loginName.code)) {
-            return loginName.name();
-        } else if (Objects.equals(value.trim(), name.code)) {
+        if (Objects.equals(value.trim(), name.code)) {
             return name.name();
-        } else if (Objects.equals(value.trim(), roleCode.code)) {
-            return roleCode.name();
-        } else if (Objects.equals(value.trim(), roleName.code)) {
-            return roleName.name();
         } else if (Objects.equals(value.trim(), courseCode.code)) {
             return courseCode.name();
-        } else if (Objects.equals(value.trim(), startTime.code)) {
-            return startTime.name();
-        } else if (Objects.equals(value.trim(), endTime.code)) {
-            return endTime.name();
-        } else if (Objects.equals(value.trim(), sceneNumberName.code)) {
-            return sceneNumberName.name();
-        } else if (Objects.equals(value.trim(), sceneNumberId.code)) {
-            return sceneNumberId.name();
-        } else if (Objects.equals(value.trim(), examSite.code)) {
-            return examSite.name();
-        } else if (Objects.equals(value.trim(), examRoom.code)) {
-            return examRoom.name();
-        } else if (Objects.equals(value.trim(), examRoomId.code)) {
-            return examRoomId.name();
-        } else if (Objects.equals(value.trim(), studentCode.code)) {
-            return studentCode.name();
         } else if (Objects.equals(value.trim(), courseName.code)) {
             return courseName.name();
-        } else if (Objects.equals(value.trim(), gender.code)) {
-            return gender.name();
-        } else if (Objects.equals(value.trim(), cardId.code)) {
-            return cardId.name();
-        } else if (Objects.equals(value.trim(), examNumber.code)) {
-            return examNumber.name();
-        } else if (Objects.equals(value.trim(), siteNumber.code)) {
-            return siteNumber.name();
-        } else {
+        } else if (Objects.equals(value.trim(), extendColumn.code)) {
             return extendColumn.name();
+        } else if (Objects.equals(value.trim(), grade.code)) {
+            return grade.name();
+        } else if (Objects.equals(value.trim(), classNo.code)) {
+            return classNo.name();
+        } else if (Objects.equals(value.trim(), examActivityCode.code)) {
+            return examActivityCode.name();
+        } else if (Objects.equals(value.trim(), roomCode.code)) {
+            return roomCode.name();
+        } else if (Objects.equals(value.trim(), roomName.code)) {
+            return roomName.name();
+        } else {
+            return identity.name();
         }
     }
 
@@ -147,44 +74,26 @@ public enum AttachmentEnum {
      * @return
      */
     public static String convertToCode(String value) {
-        if (Objects.equals(value.trim(), loginName.name())) {
-            return loginName.code;
-        } else if (Objects.equals(value.trim(), name.name())) {
+        if (Objects.equals(value.trim(), name.name())) {
             return name.code;
-        } else if (Objects.equals(value.trim(), roleCode.name())) {
-            return roleCode.code;
-        } else if (Objects.equals(value.trim(), roleName.name())) {
-            return roleName.code;
         } else if (Objects.equals(value.trim(), courseCode.name())) {
             return courseCode.code;
-        } else if (Objects.equals(value.trim(), startTime.name())) {
-            return startTime.code;
-        } else if (Objects.equals(value.trim(), endTime.name())) {
-            return endTime.code;
-        } else if (Objects.equals(value.trim(), sceneNumberName.name())) {
-            return sceneNumberName.code;
-        } else if (Objects.equals(value.trim(), sceneNumberId.name())) {
-            return sceneNumberId.code;
-        } else if (Objects.equals(value.trim(), examSite.name())) {
-            return examSite.code;
-        } else if (Objects.equals(value.trim(), examRoom.name())) {
-            return examRoom.code;
-        } else if (Objects.equals(value.trim(), examRoomId.name())) {
-            return examRoomId.code;
-        } else if (Objects.equals(value.trim(), studentCode.name())) {
-            return studentCode.code;
         } else if (Objects.equals(value.trim(), courseName.name())) {
             return courseName.code;
-        } else if (Objects.equals(value.trim(), gender.name())) {
-            return gender.code;
-        } else if (Objects.equals(value.trim(), cardId.name())) {
-            return cardId.code;
-        } else if (Objects.equals(value.trim(), examNumber.name())) {
-            return examNumber.code;
-        } else if (Objects.equals(value.trim(), siteNumber.name())) {
-            return siteNumber.code;
-        } else {
+        } else if (Objects.equals(value.trim(), extendColumn.name())) {
             return extendColumn.code;
+        } else if (Objects.equals(value.trim(), grade.name())) {
+            return grade.code;
+        } else if (Objects.equals(value.trim(), classNo.name())) {
+            return classNo.code;
+        } else if (Objects.equals(value.trim(), examActivityCode.name())) {
+            return examActivityCode.code;
+        } else if (Objects.equals(value.trim(), roomCode.name())) {
+            return roomCode.code;
+        } else if (Objects.equals(value.trim(), roomName.name())) {
+            return roomName.code;
+        } else {
+            return identity.code;
         }
     }
 

+ 67 - 0
themis-business/src/main/java/com/qmth/themis/business/enums/UploadFileEnum.java

@@ -0,0 +1,67 @@
+package com.qmth.themis.business.enums;
+
+import java.util.Objects;
+
+/**
+ * @Description: 上传文件类型
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/15
+ */
+public enum UploadFileEnum {
+
+    client(0),
+
+    base_photo(1),
+
+    upload(2),
+
+    file(3);
+
+    private int id;
+
+    private UploadFileEnum(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * 状态转换 toId
+     *
+     * @param value
+     * @return
+     */
+    public static int convertToId(String value) {
+        if (Objects.equals(value.trim(), client.name())) {
+            return client.getId();
+        } else if (Objects.equals(value.trim(), base_photo.name())) {
+            return base_photo.getId();
+        } else if (Objects.equals(value.trim(), upload.name())) {
+            return upload.getId();
+        } else {
+            return file.getId();
+        }
+    }
+
+    /**
+     * 状态转换 toName
+     *
+     * @param value
+     * @return
+     */
+    public static String convertToName(int value) {
+        if (value == client.getId()) {
+            return client.name();
+        } else if (value == base_photo.getId()) {
+            return base_photo.name();
+        } else if (value == upload.getId()) {
+            return upload.name();
+        } else {
+            return file.name();
+        }
+    }
+}

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TBAttachmentMapper;
 import com.qmth.themis.business.entity.TBAttachment;
+import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.common.exception.BusinessException;
@@ -93,10 +94,17 @@ public class TBAttachmentServiceImpl extends ServiceImpl<TBAttachmentMapper, TBA
 
             boolean oss = (boolean) map.get(SystemConstant.OSS);
             LocalDateTime nowTime = LocalDateTime.now();
-            StringJoiner stringJoiner = new StringJoiner("")
-                    .add(String.valueOf(map.get(SystemConstant.LOCALHOST_PATH)))
-                    .add(File.separator).add(String.valueOf(orgId))
-                    .add(File.separator).add(String.valueOf(nowTime.getYear()))
+            StringJoiner stringJoiner = new StringJoiner("");
+            String uploadType = String.valueOf(map.get(SystemConstant.UPLOAD_TYPE));
+            if (Objects.isNull(uploadType)) {
+                throw new BusinessException("请上传文件类型");
+            } else if (Objects.equals(uploadType, UploadFileEnum.base_photo.name())) {
+                stringJoiner.add(uploadType)
+                        .add(File.separator).add(String.valueOf(orgId));
+            } else {
+                stringJoiner.add(uploadType);
+            }
+            stringJoiner.add(File.separator).add(String.valueOf(nowTime.getYear()))
                     .add(File.separator).add(String.valueOf(nowTime.getMonthValue()))
                     .add(File.separator).add(String.valueOf(nowTime.getDayOfMonth()));
             if (oss) {//上传至oss

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCallback.java

@@ -0,0 +1,11 @@
+package com.qmth.themis.business.templete;
+
+/** 
+* @Description: 导出任务回调
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/7/15 
+*/ 
+public interface TaskExportCallback {
+}

+ 15 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportTemplete.java

@@ -0,0 +1,15 @@
+package com.qmth.themis.business.templete;
+
+import com.qmth.themis.common.util.Result;
+
+/**
+ * @Description: 导出任务模版
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/15
+ */
+public interface TaskExportTemplete {
+
+    Result exportTask();
+}

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportCallback.java

@@ -0,0 +1,11 @@
+package com.qmth.themis.business.templete;
+
+/** 
+* @Description: 导入任务回调
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/7/15 
+*/ 
+public interface TaskImportCallback {
+}

+ 18 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportTemplete.java

@@ -0,0 +1,18 @@
+package com.qmth.themis.business.templete;
+
+import com.qmth.themis.common.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+/**
+ * @Description: 导入任务模版
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/15
+ */
+public interface TaskImportTemplete {
+
+    Result importTask(MultipartFile file) throws IOException;
+}

+ 59 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/impl/ExamStudentTemplete.java

@@ -0,0 +1,59 @@
+package com.qmth.themis.business.templete.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import com.qmth.themis.business.dto.ExamStudentDtoImport;
+import com.qmth.themis.business.templete.TaskImportTemplete;
+import com.qmth.themis.business.threadPool.MyThreadPool;
+import com.qmth.themis.business.util.ExcelCallback;
+import com.qmth.themis.business.util.ExcelError;
+import com.qmth.themis.business.util.ExcelUtil;
+import com.qmth.themis.common.exception.BusinessException;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 考生导入模版
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/15
+ */
+public class ExamStudentTemplete implements TaskImportTemplete {
+
+    @Override
+    public Result importTask(MultipartFile file) throws IOException {
+        List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(file.getInputStream(), Lists.newArrayList(ExamStudentDtoImport.class), new ExcelCallback() {
+            @Override
+            public List<LinkedMultiValueMap<Integer, Object>> callback(List<LinkedMultiValueMap<Integer, Object>> finalList, List<LinkedMultiValueMap<Integer, String>> finalColumnNameList) throws IllegalAccessException {
+                List<ExcelError> excelErrorList = new ArrayList<>();
+                for (int i = 0; i < finalList.size(); i++) {
+                    LinkedMultiValueMap<Integer, Object> map = finalList.get(i);
+                    List<Object> examStudentDtoImportList = map.get(i);
+                    for (int y = 0; y < examStudentDtoImportList.size(); y++) {
+                        ExamStudentDtoImport examStudentDtoImport = (ExamStudentDtoImport) examStudentDtoImportList.get(y);
+                        List<ExcelError> excelErrorTemp = ExcelUtil.checkExcelField(examStudentDtoImport, y, i);
+                        if (excelErrorTemp.size() > 0) {
+                            excelErrorList.addAll(excelErrorTemp);
+                        }
+                    }
+                }
+                if (excelErrorList.size() > 0) {
+                    throw new BusinessException(JSONObject.toJSONString(excelErrorList));
+                }
+                return finalList;
+            }
+        });
+        Map map = new HashMap<>();
+        return ResultUtil.ok(map);
+    }
+}

+ 4 - 0
themis-business/src/main/java/com/qmth/themis/business/util/ExcelUtil.java

@@ -37,6 +37,8 @@ public class ExcelUtil {
      */
     public static List<LinkedMultiValueMap<Integer, Object>> excelReader(InputStream inputStream, List<Class<?>> clazz, ExcelCallback callback) throws IOException {
         try {
+            log.info("开始读取excel里的数据");
+            long start = System.currentTimeMillis();
             //用流的方式先读取到你想要的excel的文件
             //获取整个excel
             XSSFWorkbook xb = new XSSFWorkbook(inputStream);
@@ -104,6 +106,8 @@ public class ExcelUtil {
                     finalColumnNameList.add(columnNameList);
                 }
             }
+            long end = System.currentTimeMillis();
+            log.info("读取excel里的数据结束,============耗时============:{}秒", (end - start) / 1000);
             return callback.callback(finalOList, finalColumnNameList);
         } catch (Exception e) {
             e.printStackTrace();

+ 15 - 1
themis-common/src/main/java/com/qmth/themis/common/enums/ExceptionResultEnum.java

@@ -26,6 +26,8 @@ public enum ExceptionResultEnum {
 
     EXAM_ID_IS_NULL("102", "考试批次id不能为空"),
 
+    EXAM_INFO_IS_NULL("102", "考试批次信息不能为空"),
+
     EXAM_IS_NULL("102", "考试不能为空"),
 
     EXAM_STUDENT_ID_IS_NULL("102", "考生id不能为空"),
@@ -46,12 +48,18 @@ public enum ExceptionResultEnum {
 
     VERIFYCODE_IS_NULL("102", "验证码不能为空"),
 
-    SCHOOL_ID_IS_NULL("102", "学校id不能为空"),
+    ORG_INFO_IS_NULL("102", "机构信息不能为空"),
+
+    ORG_ID_IS_NULL("102", "机构id不能为空"),
+
+    USER_INFO_IS_NULL("102", "用户信息不能为空"),
 
     MD5_IS_NULL("102", "附件MD5不能为空"),
 
     ATTACHMENT_IS_NULL("102", "请上传附件"),
 
+    ATTACHMENT_TYPE_IS_NULL("102", "请上传文件类型"),
+
     PASSWORD_NO("102", "密码不正确"),
 
     USER_NO("102", "用户不存在"),
@@ -90,6 +98,10 @@ public enum ExceptionResultEnum {
 
     EXAM_ROOM_ID_IS_NULL("102", "考场id不能为空"),
 
+    COURSE_INFO_IS_NULL("102", "科目信息不能为空"),
+
+    PAPER_INFO_IS_NULL("102", "试卷信息不能为空"),
+
     COURSE_ID_IS_NULL("102", "科目id不能为空"),
 
     COURSE_CODE_IS_NULL("102", "科目编码不能为空"),
@@ -110,6 +122,8 @@ public enum ExceptionResultEnum {
 
     SERVICE_NOT_FOUND("500", "服务器错误"),
 
+    ATTACHMENT_ERROR("500", "上传文件失败"),
+
     UN_AUTHORIZATION("401", "没有权限"),
 
     AUTHORIZATION_ERROR("401", "签名验证失败"),