wangliang 4 ani în urmă
părinte
comite
003a6ed442

+ 45 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -32,6 +32,7 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 系统信息 前端控制器
@@ -75,6 +76,9 @@ public class SysController {
     @Resource
     TBExamInvigilateUserService tbExamInvigilateUserService;
 
+    @Resource
+    TEExamStudentService teExamStudentService;
+
     @ApiOperation(value = "菜单查询接口")
     @RequestMapping(value = "/getMenu", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = TBPrivilege.class)})
@@ -270,4 +274,45 @@ public class SysController {
     public Result examRoomQuery(@ApiParam(value = "考场名称", required = false) @RequestParam(required = false) String roomName) {
         return ResultUtil.ok(tbExamInvigilateUserService.examRoomQuery(roomName));
     }
+
+    @ApiOperation(value = "根据权限获取场次和考场接口")
+    @RequestMapping(value = "/exam/privilegeQuery", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "场次和考场信息", response = Result.class)})
+    public Result examPrivilegeQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
+        if (Objects.isNull(tbSession)) {
+            throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
+        }
+        //首先查询当前用户所要监控的roomCode
+        QueryWrapper<TBExamInvigilateUser> examInvigilateUserQueryWrapper = new QueryWrapper<>();
+        examInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
+                .eq(TBExamInvigilateUser::getUserId, tbUser.getId());
+        List<TBExamInvigilateUser> tbExamInvigilateUserList = tbExamInvigilateUserService.list(examInvigilateUserQueryWrapper);
+        Set<String> roomCodeSet = null;
+        if (Objects.nonNull(tbExamInvigilateUserList) && tbExamInvigilateUserList.size() > 0) {
+            roomCodeSet = tbExamInvigilateUserList.stream().map(s -> s.getRoomCode()).collect(Collectors.toSet());
+        }
+        //根据roomCode获取当前老师所要监考的全部应考学生数
+        QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
+        teExamStudentQueryWrapper.lambda().in(TEExamStudent::getRoomCode, roomCodeSet);
+        List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
+        Set<Long> examActivityIdSet = null;
+        List<TEExamActivity> teExamActivityList = null;
+        if (Objects.nonNull(teExamStudentList) && teExamStudentList.size() > 0) {
+            examActivityIdSet = new HashSet<>();
+            Set<Long> finalExamActivityIdSet = examActivityIdSet;
+            teExamStudentList.forEach(s -> {
+                finalExamActivityIdSet.add(s.getExamActivityId());
+            });
+            teExamActivityList = teExamActivityService.listByIds(examActivityIdSet);
+        }
+        Map map = new HashMap();
+        map.put("examActivitys", teExamActivityList);
+        map.put("examRooms", tbExamInvigilateUserList);
+        return ResultUtil.ok(map);
+    }
 }

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

@@ -72,6 +72,19 @@ public class TIeInvigilateCallMobileController {
         return ResultUtil.ok(basePage);
     }
 
+    @ApiOperation(value = "监考监控通话提醒接口")
+    @RequestMapping(value = "/call/count", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = Integer.class)})
+    public Result callCount(@ApiParam(value = "场次id", required = true) @RequestParam Long examActivityId) {
+        if (Objects.isNull(examActivityId) || Objects.equals(examActivityId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ACTIVITY_ID_IS_NULL);
+        }
+        QueryWrapper<TIeExamInvigilateCall> examInvigilateCallQueryWrapper = new QueryWrapper<>();
+        examInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCall::getExamActivityId, examActivityId).eq(TIeExamInvigilateCall::getStatus, MonitorStatusSourceEnum.START.name());
+        int count = tIeExamInvigilateCallService.count(examInvigilateCallQueryWrapper);
+        return ResultUtil.ok(Collections.singletonMap("count", count));
+    }
+
     @ApiOperation(value = "监考监控通话查询来源接口")
     @RequestMapping(value = "/call/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCall.class)})

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

@@ -164,4 +164,4 @@ prefix.url.admin=api/admin
 
 #\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/admin/user/login/account,/api/admin/sys/org/queryByOrgCode,/file/**,/upload/**,/client/**,/base_photo/**,/frontend/**,/api/admin/monitor/call/list,/api/admin/monitor/call/query
-common.system.urls=/api/admin/sys/getMenu,/api/admin/user/logout,/api/admin/sys/env,/api/admin/sys/file/upload,/api/admin/sys/file/download,/api/admin/sys/org/query,/api/admin/sys/role/query,/api/admin/sys/examActivity/query,/api/admin/sys/exam/query,/api/admin/sys/examRoom/query,/api/admin/student/photo/upload,/api/admin/report/exam_view
+common.system.urls=/api/admin/sys/getMenu,/api/admin/user/logout,/api/admin/sys/env,/api/admin/sys/file/upload,/api/admin/sys/file/download,/api/admin/sys/org/query,/api/admin/sys/role/query,/api/admin/sys/examActivity/query,/api/admin/sys/exam/query,/api/admin/sys/examRoom/query,/api/admin/sys/exam/privilegeQuery,/api/admin/student/photo/upload

+ 8 - 0
themis-business/src/main/java/com/qmth/themis/business/cache/MobileAuthCacheUtil.java

@@ -106,4 +106,12 @@ public class MobileAuthCacheUtil {
     public static String getSessionId(MobileModeEnum mode, String code) {
         return (String) redisUtil.get(RedisKeyHelper.mobileAuthCacheKey(mode, code), "sessionId");
     }
+
+    public static String getPlatformSource(MobileModeEnum mode, String code) {
+        return (String) redisUtil.get(RedisKeyHelper.mobileAuthCacheKey(mode, code), "platformSource");
+    }
+
+    public static void setPlatformSource(MobileModeEnum mode, String code, Source source) {
+        redisUtil.set(RedisKeyHelper.mobileAuthCacheKey(mode, code), "platformSource", source);
+    }
 }

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

@@ -77,13 +77,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + "::" + es.getStudentId());
         // 生成token
         String token = RandomStringUtils.randomAlphanumeric(32);
-        String source = null;
-        if (mode.equals(MobileModeEnum.MOBILE_MONITOR)) {
-            Source sourceEnum = MobileAuthCacheUtil.getSource(mode, code);
-            source = sourceEnum.name();
-        } else if (mode.equals(MobileModeEnum.PHOTO_UPLOAD) || mode.equals(MobileModeEnum.AUDIO_UPLOAD)) {
-            source = Source.OE_ANSWER.name();
-        }
+        String source = MobileAuthCacheUtil.getPlatformSource(mode, code);
         String sessionId = MobileAuthCacheUtil.getSessionId(mode, code);
         Map<String, Object> expireMap = SystemConstant.getExpireTime(platform);
         Date expire = (Date) expireMap.get("date");
@@ -132,6 +126,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + "::" + es.getStudentId());
         String sessionId = SessionUtil.digest(es.getIdentity(), Math.abs(authDto.getRoleCodes().toString().hashCode()), source);
         objectMap.put("sessionId", sessionId);
+        objectMap.put("platformSource", source);
         redisUtil.setForHash(RedisKeyHelper.mobileAuthCacheKey(mode, code), objectMap);
         if (Objects.nonNull(userType) && userType.contains(RoleEnum.STUDENT.name())) {
             ret.setMonitorUserId("s_" + sessionId);
@@ -163,6 +158,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + "::" + es.getStudentId());
         String sessionId = SessionUtil.digest(es.getIdentity(), Math.abs(authDto.getRoleCodes().toString().hashCode()), source);
         objectMap.put("sessionId", sessionId);
+        objectMap.put("platformSource", source);
         redisUtil.setForHash(RedisKeyHelper.mobileAuthCacheKey(mode, code), objectMap);
         MobileAuthorizationUploadBean ret = new MobileAuthorizationUploadBean();
         ret.setRecordId(recordId);
@@ -175,7 +171,6 @@ public class TEMobileServiceImpl implements TEMobileService {
     @Override
     public MobileAnswerSubmitReponseBean answerSubmit(Long studentId, Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex,
                                                       String answer) {
-
         // 校验当前登录用户和参数一致性
         if (ExamRecordCacheUtil.getId(recordId) == null) {
             throw new BusinessException("未找到考试记录");

+ 2 - 0
themis-business/src/main/resources/db/init.sql

@@ -698,6 +698,8 @@ INSERT INTO `t_b_role_privilege` VALUES (155, 'ADMIN', 22);
 INSERT INTO `t_b_role_privilege` VALUES (156, 'ADMIN', 24);
 INSERT INTO `t_b_role_privilege` VALUES (157, 'ADMIN', 25);
 INSERT INTO `t_b_role_privilege` VALUES (158, 'INVIGILATE', 142);
+INSERT INTO `t_b_role_privilege` VALUES (159, 'INSPECTION', 11);
+INSERT INTO `t_b_role_privilege` VALUES (160, 'INSPECTION', 13);
 COMMIT;
 
 -- ----------------------------

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

@@ -126,6 +126,8 @@ public enum ExceptionResultEnum {
 
     MESSAGE_TYPE_IS_NULL(400, 400049, "消息类型不能为空"),
 
+    EXAM_ACTIVITY_ID_IS_NULL(400, 400050, "考试场次id不能为空"),
+
     /**
      * 401
      */