xiatian 4 anos atrás
pai
commit
7d33fa0919

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

@@ -221,7 +221,14 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = TEExam.class)})
     public Result query(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "考试批次编码", required = false) @RequestParam(required = false) String code, @ApiParam(value = "考试批次名称", required = false) @RequestParam(required = false) String name, @ApiParam(value = "考试批次模式", required = false) @RequestParam(required = false) String mode, @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        return ResultUtil.ok(teExamService.examQuery(new Page<>(pageNumber, pageSize), userId, id, code, name, mode, enable, tbUser.getOrgId()));
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        Long uId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INSPECTION.name())) {
+        	uId = null;
+        }else {
+        	uId=userId;
+        }
+        return ResultUtil.ok(teExamService.examQuery(new Page<>(pageNumber, pageSize), uId, id, code, name, mode, enable, tbUser.getOrgId()));
     }
 
     @ApiOperation(value = "考试批次停用/启用接口")

+ 19 - 9
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeReportServiceImpl.java

@@ -47,6 +47,7 @@ import com.qmth.themis.business.entity.TEExamActivity;
 import com.qmth.themis.business.enums.BreachCancelTypeEnum;
 import com.qmth.themis.business.enums.BreachTypeEnum;
 import com.qmth.themis.business.enums.ExceptionEnum;
+import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
 import com.qmth.themis.business.enums.VerifyExceptionEnum;
 import com.qmth.themis.business.service.TEExamActivityService;
 import com.qmth.themis.business.service.TEExamService;
@@ -123,15 +124,24 @@ public class TIeReportServiceImpl implements TIeReportService {
         Map<Long, Long> absentMap = new HashMap<Long, Long>();
         Date now = new Date();
         for (Long acId : totalMap.keySet()) {
-            ExamActivityCacheBean ac = examActivityService.getExamActivityCacheBean(acId);
-            Long end = ac.getStartTime() + (ac.getOpeningSeconds() * 1000);
-            if (now.getTime() > end) {// 场次开考时间结束,未开考的都是缺考
-                Long done = doneMap.get(acId);
-                if (done == null) {
-                    done = 0L;
-                }
-                absentMap.put(acId, totalMap.get(acId) - done);
-            }
+//            ExamActivityCacheBean ac = examActivityService.getExamActivityCacheBean(acId);
+//            Long end = ac.getStartTime() + (ac.getOpeningSeconds() * 1000);
+//            if (now.getTime() > end) {// 场次开考时间结束,未开考的都是缺考
+//                Long done = doneMap.get(acId);
+//                if (done == null) {
+//                    done = 0L;
+//                }
+//                absentMap.put(acId, totalMap.get(acId) - done);
+//            }
+        	 ExamActivityCacheBean ac = examActivityService.getExamActivityCacheBean(acId);
+        	 ExamCacheBean exam=examService.getExamCacheBean(ac.getExamId());
+             if (InvigilateMonitorStatusEnum.FINISHED.equals(exam.getMonitorStatus())) {// 结束监考的,未考试的都是缺考
+                 Long done = doneMap.get(acId);
+                 if (done == null) {
+                     done = 0L;
+                 }
+                 absentMap.put(acId, totalMap.get(acId) - done);
+             }
         }
         Long absentNum = 0L;
         if (absentMap.size() > 0) {

+ 1 - 2
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -294,7 +294,7 @@
 			<if test="status == null or status == ''">
 				and (t.status = 'FIRST_PREPARE' or t.status = 'ANSWERING' or t.status = 'BREAK_OFF' or t.status = 'RESUME_PREPARE')
 			</if>
-		) t
+		) t,(SELECT @i := 0) as i
 		<where>
 			<if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
 				and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
@@ -309,7 +309,6 @@
 				and t.exceptionCount &lt;= #{maxExceptionCount}
 			</if>
 		</where>
-		,(SELECT @i := 0) as i
 		order by t.roomCode
 	</select>
 

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

@@ -143,6 +143,14 @@ public class TEStudentController {
         if (!Objects.equals(loginPassword, aesPassword)) {
             throw new BusinessException(ExceptionResultEnum.PASSWORD_ERROR);
         }
+        //判断是否有正在考试的
+        Long unFinishedRecordId=ExamingDataCacheUtil.getUnFinishedRecordId(user.getId());
+        if(unFinishedRecordId!=null) {
+        	WebsocketStatusEnum sta=ExamRecordCacheUtil.getClientWebsocketStatus(unFinishedRecordId);
+        	if(WebsocketStatusEnum.ON_LINE.equals(sta)) {
+        		throw new BusinessException("该学生正在考试,不能登录");
+        	}
+        }
         return userLoginCommon(user, examId, orgId);
     }