deason 2 жил өмнө
parent
commit
9f5cd899ea

+ 33 - 50
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamServiceImpl.java

@@ -1,39 +1,5 @@
 package cn.com.qmth.examcloud.core.examwork.service.impl;
 
-import java.io.File;
-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.Map.Entry;
-import java.util.Optional;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.persistence.criteria.Predicate;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import org.jsoup.select.Elements;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
 import cn.com.qmth.examcloud.api.commons.enums.CURD;
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
@@ -53,16 +19,8 @@ import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
 import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
 import cn.com.qmth.examcloud.core.examwork.base.enums.CallType;
 import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
-import cn.com.qmth.examcloud.core.examwork.dao.ExamIpLimitRepo;
-import cn.com.qmth.examcloud.core.examwork.dao.ExamOrgPropertyRepo;
-import cn.com.qmth.examcloud.core.examwork.dao.ExamPropertyRepo;
-import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
-import cn.com.qmth.examcloud.core.examwork.dao.ExamSpecialSettingsRepo;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamIpLimitEntity;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamOrgPropertyEntity;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPropertyEntity;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamSpecialSettingsEntity;
+import cn.com.qmth.examcloud.core.examwork.dao.*;
+import cn.com.qmth.examcloud.core.examwork.dao.entity.*;
 import cn.com.qmth.examcloud.core.examwork.dao.enums.IpLimitType;
 import cn.com.qmth.examcloud.core.examwork.service.ExamService;
 import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
@@ -71,6 +29,7 @@ import cn.com.qmth.examcloud.core.examwork.service.bean.ExamIpLimitInfo;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamSpecialSettingsInfo;
 import cn.com.qmth.examcloud.core.examwork.service.cache.ExamPropertyCache;
 import cn.com.qmth.examcloud.core.examwork.service.cache.ExamSettingsCache;
+import cn.com.qmth.examcloud.support.CacheConstants;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
 import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
 import cn.com.qmth.examcloud.support.enums.ExamProperties;
@@ -81,6 +40,30 @@ import cn.com.qmth.examcloud.task.api.request.SyncExamReq;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.criteria.Predicate;
+import java.io.File;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 类注释
@@ -146,16 +129,16 @@ public class ExamServiceImpl implements ExamService {
         String code = examInfo.getCode();
         String name = examInfo.getName();
         ExamType examType = examInfo.getExamType();
-        CallType callType=examInfo.getCallType(); 
+        CallType callType = examInfo.getCallType();
 
         if (null == examType) {
             throw new StatusException("001005", "考试类型不能为空");
         }
-        if (!ExamType.ONLINE.equals(examType)&&!ExamType.PRACTICE.equals(examType)) {
-        	callType=CallType.WHOLE_SET;
+        if (!ExamType.ONLINE.equals(examType) && !ExamType.PRACTICE.equals(examType)) {
+            callType = CallType.WHOLE_SET;
         }
-        if(callType==null) {
-        	throw new StatusException("调卷模式不能为空");
+        if (callType == null) {
+            throw new StatusException("调卷模式不能为空");
         }
 
         if (StringUtils.isBlank(code)) {
@@ -930,7 +913,7 @@ public class ExamServiceImpl implements ExamService {
         if (centerLimit) {
             StudentCacheBean studentCache = CacheHelper.getStudent(studentId);
             Long orgId = studentCache.getOrgId();
-            String key = "IP_" + orgId;
+            String key = CacheConstants.CACHE_B_SECURITY_IP + orgId;
             String value = redisClient.get(key, String.class);
             //机构是否在时间范围内登陆过
             if (value != null) {