wangliang 4 年之前
父节点
当前提交
16ea42932c

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

@@ -111,7 +111,9 @@ public class TBUserController {
         if (Objects.isNull(tbOrg)) {
             throw new BusinessException(ExceptionResultEnum.ORG_NO);
         }
-
+        if (Objects.nonNull(tbOrg.getEnable()) && tbOrg.getEnable().intValue() == 0) {
+            throw new BusinessException(ExceptionResultEnum.ORG_ENABLE);
+        }
         QueryWrapper<TBUser> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(TBUser::getLoginName, loginName).eq(TBUser::getOrgId, tbOrg.getId());
         TBUser user = tbUserService.getOne(wrapper);

+ 16 - 13
themis-backend/src/main/resources/ehcache.xml

@@ -7,30 +7,33 @@
     <!--overflowToDisk:是否保存到磁盘,当系统宕机时-->
     <!--diskPersistent:是否在磁盘上持久化。指重启jvm后,数据是否有效。默认为false。-->
     <defaultCache
-            eternal="false"
-            maxElementsInMemory="10000"
-            overflowToDisk="false"
-            diskPersistent="false"
+            eternal="true"
+            maxElementsInMemory="1"
+            maxElementsOnDisk="0"
+            overflowToDisk="true"
+            diskPersistent="true"
             timeToIdleSeconds="0"
-            timeToLiveSeconds="2400"
+            timeToLiveSeconds="43200"
             memoryStoreEvictionPolicy="LRU" />
 
     <cache
             name="org_code_cache"
-            eternal="false"
-            maxElementsInMemory="1000"
-            overflowToDisk="false"
-            diskPersistent="false"
+            eternal="true"
+            maxElementsInMemory="1"
+            maxElementsOnDisk="0"
+            overflowToDisk="true"
+            diskPersistent="true"
             timeToIdleSeconds="0"
             timeToLiveSeconds="43200"
             memoryStoreEvictionPolicy="LRU" />
 
     <cache
             name="role_cache"
-            eternal="false"
-            maxElementsInMemory="1000"
-            overflowToDisk="false"
-            diskPersistent="false"
+            eternal="true"
+            maxElementsInMemory="1"
+            maxElementsOnDisk="0"
+            overflowToDisk="true"
+            diskPersistent="true"
             timeToIdleSeconds="0"
             timeToLiveSeconds="43200"
             memoryStoreEvictionPolicy="LRU" />

+ 2 - 0
themis-common/src/main/java/com/qmth/themis/common/enums/ExceptionResultEnum.java

@@ -207,6 +207,8 @@ public enum ExceptionResultEnum {
 
     EXAM_ACTIVITY_NO(500, 500003, "考试场次信息不存在"),
 
+    ORG_ENABLE(500, 500004, "机构已停用"),
+
     ORG_NO(500, 500005, "机构信息不存在"),
 
     TASK_NO(500, 500006, "任务不存在"),

+ 16 - 0
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -18,6 +18,7 @@ import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.response.TEExamActivityDto;
 import com.qmth.themis.business.dto.response.TEExamDto;
 import com.qmth.themis.business.dto.response.TEExamResultDto;
+import com.qmth.themis.business.entity.TBOrg;
 import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.entity.TEConfig;
 import com.qmth.themis.business.entity.TEStudent;
@@ -95,6 +96,9 @@ public class TEStudentController {
     @Resource
     TOeExamRecordService tOeExamRecordService;
 
+    @Resource
+    TBOrgService tbOrgService;
+
     @ApiOperation(value = "学生登录接口")
     @RequestMapping(value = "/login", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEExamResultDto.class)})
@@ -118,12 +122,24 @@ public class TEStudentController {
             orgId = Long.parseLong(String.valueOf(mapParameter.get("orgId")));
         }
         Long examId = null;
+        TBOrg tbOrg = null;
         if (Objects.nonNull(mapParameter.get("examId"))) {
             examId = Long.parseLong(String.valueOf(mapParameter.get("examId")));
+            ExamCacheBean ec = teExamService.getExamCacheBean(examId);
+            tbOrg = Objects.isNull(redisUtil.getOrg(ec.getOrgId())) ? tbOrgService.getById(ec.getOrgId()) : (TBOrg) redisUtil.getOrg(ec.getOrgId());
         }
         if (Objects.isNull(orgId) && Objects.isNull(examId)) {
             throw new BusinessException(ExceptionResultEnum.ORG_ID_OR_EXAM_ID_NOT_CHOOSE);
         }
+        if (Objects.nonNull(orgId)) {
+            tbOrg = Objects.isNull(redisUtil.getOrg(orgId)) ? tbOrgService.getById(orgId) : (TBOrg) redisUtil.getOrg(orgId);
+        }
+        if (Objects.isNull(tbOrg)) {
+            throw new BusinessException(ExceptionResultEnum.ORG_NO);
+        }
+        if (Objects.nonNull(tbOrg.getEnable()) && tbOrg.getEnable().intValue() == 0) {
+            throw new BusinessException(ExceptionResultEnum.ORG_ENABLE);
+        }
         String identity = String.valueOf(mapParameter.get("identity"));
         String password = String.valueOf(mapParameter.get("password"));