Просмотр исходного кода

Merge branch 'dev' into release
111

wangliang 4 лет назад
Родитель
Сommit
be91042b07

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

@@ -210,7 +210,8 @@ public class TEExamController {
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @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) {
-        IPage<TEExamQueryDto> teExamQueryDtoIPage = teExamService.examQuery(new Page<>(pageNumber, pageSize), userId, id, code, name, mode, enable);
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        IPage<TEExamQueryDto> teExamQueryDtoIPage = teExamService.examQuery(new Page<>(pageNumber, pageSize), userId, id, code, name, mode, enable, tbUser.getOrgId());
         BasePage basePage = new BasePage(teExamQueryDtoIPage.getRecords(), teExamQueryDtoIPage.getCurrent(), teExamQueryDtoIPage.getSize(), teExamQueryDtoIPage.getTotal());
         return ResultUtil.ok(basePage);
     }
@@ -325,17 +326,12 @@ public class TEExamController {
         return ResultUtil.ok(Collections.singletonMap("success", true));
     }
 
-    @ApiOperation(value = "监考端获取考试批次接口")
-    @RequestMapping(value = "/list", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = TEExam.class)})
-    public Result list(@ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+    @ApiOperation(value = "监考端获取考试批次提醒接口")
+    @RequestMapping(value = "/list/count", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = Result.class)})
+    public Result listCount(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId) {
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        if (Objects.isNull(tbUser)) {
-            throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
-        }
-        IPage<TEExamQueryDto> teExamQueryDtoIPage = teExamService.examList(new Page<>(pageNumber, pageSize), tbUser.getOrgId());
-        BasePage basePage = new BasePage(teExamQueryDtoIPage.getRecords(), teExamQueryDtoIPage.getCurrent(), teExamQueryDtoIPage.getSize(), teExamQueryDtoIPage.getTotal());
-        return ResultUtil.ok(basePage);
+        return ResultUtil.ok(teExamService.examList(userId, tbUser.getOrgId()));
     }
 
     @ApiOperation(value = "考试属性统计接口")

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

@@ -245,7 +245,7 @@ public class TEExamReexamController {
 
     @ApiOperation(value = "重考待审提醒接口")
     @RequestMapping(value = "/list_not_done_notify", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result listNotDoneNotify(@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId) {
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         Integer count = teExamReexamService.reexamPageNotDoneCount(examId, tbUser.getId());

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

@@ -228,7 +228,7 @@ public class TEExamStudentController {
             if (Objects.nonNull(tbExamInvigilateUserList) && tbExamInvigilateUserList.size() > 0) {
                 Map<String, String> tbExamInvigilateUserMap = new HashMap();
                 tbExamInvigilateUserList.forEach(s -> {
-                    tbExamInvigilateUserMap.put(s.getRoomCode() + ":" + s.getRoomName(), s.getRoomCode() + ":" + s.getRoomName());
+                    tbExamInvigilateUserMap.put(s.getExamId() + ":" + s.getRoomCode() + ":" + s.getRoomName(), s.getRoomCode() + ":" + s.getRoomName());
                 });
                 transMap.put("tbExamInvigilateUserMap", tbExamInvigilateUserMap);
             }

+ 4 - 3
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamMapper.java

@@ -31,9 +31,10 @@ public interface TEExamMapper extends BaseMapper<TEExam> {
      * @param name
      * @param mode
      * @param enable
+     * @param orgId
      * @return
      */
-    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, @Param("userId") Long userId, @Param("id") Long id, @Param("code") String code, @Param("name") String name, @Param("mode") String mode, @Param("enable") Integer enable);
+    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, @Param("userId") Long userId, @Param("id") Long id, @Param("code") String code, @Param("name") String name, @Param("mode") String mode, @Param("enable") Integer enable, @Param("orgId") Long orgId);
 
     /**
      * 获取考试待考列表
@@ -48,11 +49,11 @@ public interface TEExamMapper extends BaseMapper<TEExam> {
     /**
      * 监考端获取考试批次列表
      *
-     * @param iPage
+     * @param userId
      * @param orgId
      * @return
      */
-    public IPage<TEExamQueryDto> examList(IPage<Map> iPage, @Param("orgId") Long orgId);
+    public List<Map> examList(@Param("userId") Long userId, @Param("orgId") Long orgId);
 
     /**
      * 考试批次权限过滤

+ 4 - 3
themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java

@@ -33,9 +33,10 @@ public interface TEExamService extends IService<TEExam> {
      * @param name
      * @param mode
      * @param enable
+     * @param orgId
      * @return
      */
-    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage,Long userId, Long id, String code, String name, String mode, Integer enable);
+    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, Long userId, Long id, String code, String name, String mode, Integer enable, Long orgId);
 
     /**
      * 获取考试待考列表
@@ -163,11 +164,11 @@ public interface TEExamService extends IService<TEExam> {
     /**
      * 监考端获取考试批次列表
      *
-     * @param iPage
+     * @param userId
      * @param orgId
      * @return
      */
-    public IPage<TEExamQueryDto> examList(IPage<Map> iPage, Long orgId);
+    public List<Map> examList(Long userId, Long orgId);
 
     /**
      * 发送考试轨迹消息

+ 6 - 5
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -91,11 +91,12 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
      * @param name
      * @param mode
      * @param enable
+     * @param orgId
      * @return
      */
     @Override
-    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, Long userId, Long id, String code, String name, String mode, Integer enable) {
-        return teExamMapper.examQuery(iPage, userId, id, code, name, mode, enable);
+    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, Long userId, Long id, String code, String name, String mode, Integer enable, Long orgId) {
+        return teExamMapper.examQuery(iPage, userId, id, code, name, mode, enable, orgId);
     }
 
     /**
@@ -837,13 +838,13 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
     /**
      * 监考端获取考试批次列表
      *
-     * @param iPage
+     * @param userId
      * @param orgId
      * @return
      */
     @Override
-    public IPage<TEExamQueryDto> examList(IPage<Map> iPage, Long orgId) {
-        return teExamMapper.examList(iPage, orgId);
+    public List<Map> examList(Long userId, Long orgId) {
+        return teExamMapper.examList(userId, orgId);
     }
 
     /**

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java

@@ -187,7 +187,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                             .eq(TEExamStudent::getIdentity, examStudentImportDto.getIdentity());
                     teExamStudentService.update(teExamStudentUpdateWrapper);
                     teExamStudentService.saveOrUpdate(teExamStudent);
-                    roomCodeAndNameSet.add(teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());
+                    roomCodeAndNameSet.add(examId + ":" + teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());
                     teExamStudentList.add(teExamStudent);
                 }
                 txtList = this.importProgress(max, min, size, txtList, tbTaskHistory, timeFormat);
@@ -210,7 +210,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
             roomCodeAndNameSet.forEach(s -> {
                 if (Objects.isNull(tbExamInvigilateUserMap) || (Objects.nonNull(tbExamInvigilateUserMap) && Objects.isNull(tbExamInvigilateUserMap.get(s)))) {
                     String[] strs = s.split(":");
-                    TBExamInvigilateUser tbExamInvigilateUser = new TBExamInvigilateUser(examId, orgId, strs[0], strs[1]);
+                    TBExamInvigilateUser tbExamInvigilateUser = new TBExamInvigilateUser(Long.parseLong(strs[0]), orgId, strs[1], strs[2]);
                     tbExamInvigilateUserService.save(tbExamInvigilateUser);
                     tbExamInvigilateUserList.add(tbExamInvigilateUser);
                     count.getAndIncrement();

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

@@ -498,7 +498,7 @@ INSERT INTO `t_b_privilege` VALUES (131, '报表-撤销违纪名单', '/api/admi
 INSERT INTO `t_b_privilege` VALUES (132, '报表-撤销违纪名单明细', '/api/admin/report/exam_revoke_breach_list_detail', 'LINK', 24, 10, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (133, '报表-考生日志', '/api/admin/report/exam_student_log_list', 'LINK', 25, 1, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (134, '报表-考生日志明细', '/api/admin/report/exam_student_log_list_detail', 'LINK', 25, 2, NULL, '2020-08-01 12:08:31');
-INSERT INTO `t_b_privilege` VALUES (135, '监考考试批次列表', '/api/admin/exam/list', 'LINK', 10, 5, NULL, '2020-08-01 12:08:31');
+INSERT INTO `t_b_privilege` VALUES (135, '监考端获取考试批次提醒', '/api/admin/exam/list/count', 'LINK', 10, 5, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (136, '进度查询导出', '/api/admin/invigilate/progress/export', 'LINK', 14, 11, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (137, '拍照/录音答题就绪', '/api/mobile/answer/ready', 'LINK', 60, 32, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (138, '拍照/录音提交', '/api/mobile/answer/submit', 'LINK', 60, 33, NULL, '2020-08-01 12:08:31');
@@ -506,9 +506,10 @@ INSERT INTO `t_b_privilege` VALUES (139, '监考端撤销通话申请', '/api/ad
 INSERT INTO `t_b_privilege` VALUES (140, '结束监考', '/api/admin/invigilate/exam/finish', 'LINK', 14, 12, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (141, '导入导出任务', 'ImportExportTask', 'MENU', 4, 7, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (142, '监考获取monitorKey', '/api/admin/monitor/getMonitorKey', 'LINK', 60, 28, NULL, '2020-08-01 12:08:31');
-INSERT INTO `t_b_privilege` VALUES (143, '监考监控通话提醒', '/api/admin/monitor/call/count', 'LINK', 60, 29, NULL, '2020-08-01 12:08:31');
+INSERT INTO `t_b_privilege` VALUES (143, '监考监控通话提醒接口', '/api/admin/monitor/call/count', 'LINK', 60, 29, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (144, '监考监控通话查询', '/api/admin/monitor/call/list', 'LINK', 60, 30, NULL, '2020-08-01 12:08:31');
 INSERT INTO `t_b_privilege` VALUES (145, '监考监控通话查询来源', '/api/admin/monitor/call/query', 'LINK', 60, 31, NULL, '2020-08-01 12:08:31');
+INSERT INTO `t_b_privilege` VALUES (146, '重考待审提醒', '/api/admin/invigilate/reexam/list_not_done_notify', 'LINK', 60, 32, NULL, '2020-08-01 12:08:31');
 COMMIT;
 
 -- ----------------------------
@@ -716,6 +717,8 @@ INSERT INTO `t_b_role_privilege` VALUES (169, 'ADMIN', 145);
 INSERT INTO `t_b_role_privilege` VALUES (170, 'INVIGILATE', 145);
 INSERT INTO `t_b_role_privilege` VALUES (171, 'INSPECTION', 145);
 INSERT INTO `t_b_role_privilege` VALUES (172, 'INVIGILATE', 107);
+INSERT INTO `t_b_role_privilege` VALUES (173, 'ADMIN', 146);
+INSERT INTO `t_b_role_privilege` VALUES (174, 'ADMIN', 135);
 COMMIT;
 
 -- ----------------------------

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

@@ -121,8 +121,8 @@
             tee.opening_seconds as openingSeconds,
             teea.opening_seconds as activityOpeningSeconds,
             UNIX_TIMESTAMP(date_sub(teea.start_time, interval IFNULL(teea.prepare_seconds, tee.prepare_seconds) second)) * 1000 as prepareTime,
-            UNIX_TIMESTAMP(date_add(teea.start_time, interval tee.min_duration_seconds second)) * 1000 as minStartTime,
-            UNIX_TIMESTAMP(date_add(teea.start_time, interval IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) second)) * 1000 as maxStartTime,
+            UNIX_TIMESTAMP(IFNULL(teea.start_time, tee.start_time)) * 1000 as minStartTime,
+            UNIX_TIMESTAMP(date_add(teea.start_time, interval IFNULL(teea.opening_seconds, tee.opening_seconds) second)) * 1000 as maxStartTime
             IF(tee.mode = 'TOGETHER', UNIX_TIMESTAMP(IFNULL(teea.finish_time , tee.end_time)) * 1000, null) as maxFinishTime,
             tee.monitor_video_source as monitorVideoSourceStr,
             tee.prepare_seconds as prepareSeconds,

+ 20 - 10
themis-business/src/main/resources/mapper/TEExamMapper.xml

@@ -2,17 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TEExamMapper">
 
-    <select id="examList" resultType="com.qmth.themis.business.dto.response.TEExamQueryDto">
+    <select id="examList" resultType="java.util.HashMap">
         select
-        t.id,
-        t.code,
-        t.name,
-        t.tag,
-        t.mode,
-        t.enable,
-        t.start_time as startTime,
-        t.end_time as endTime,
-        t.progress
+        t.id as examId
         from
         t_e_exam t
         <where>
@@ -22,6 +14,18 @@
             <if test="orgId != null and orgId != ''">
                 and t.org_id = #{orgId}
             </if>
+            <if test="userId != null and userId != ''">
+                and EXISTS(
+                select
+                DISTINCT tees.exam_id
+                from
+                t_b_exam_invigilate_user tbeiu
+                left join t_e_exam_student tees on
+                tees.room_code = tbeiu.room_code
+                where
+                tbeiu.user_id = #{userId}
+                and t.id = tees.exam_id)
+            </if>
         </where>
     </select>
 
@@ -66,6 +70,9 @@
         from t_e_exam t
         <where> 1 = 1
             <if test="userId != null and userId != ''">
+                and t.start_time <![CDATA[ <= ]]> now()
+                and t.end_time <![CDATA[ >= ]]> now()
+                and t.enable = 1
                 and EXISTS(
                 select
                 DISTINCT tees.exam_id
@@ -77,6 +84,9 @@
                 tbeiu.user_id = #{userId}
                 and t.id = tees.exam_id)
             </if>
+            <if test="orgId != null and orgId != ''">
+                and t.org_id = #{orgId}
+            </if>
             <if test="id != null and id != ''">
                 and t.id = #{id}
             </if>

+ 1 - 3
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -1,7 +1,6 @@
 package com.qmth.themis.exam.api;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
@@ -21,7 +20,6 @@ import com.qmth.themis.business.dto.response.TEExamDto;
 import com.qmth.themis.business.dto.response.TEExamResultDto;
 import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.entity.TEConfig;
-import com.qmth.themis.business.entity.TEExamStudent;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
@@ -219,7 +217,7 @@ public class TEStudentController {
             Integer leftBreakResumeCount = Objects.isNull(ExamRecordCacheUtil.getLeftBreakResumeCount(recordId)) ? 0 : ExamRecordCacheUtil.getLeftBreakResumeCount(recordId);
             //如果断点时间大于整体断点时间,则强制交卷
             if (Objects.equals(status, ExamRecordStatusEnum.ANSWERING) || Objects.equals(status, ExamRecordStatusEnum.BREAK_OFF) || Objects.equals(status, ExamRecordStatusEnum.RESUME_PREPARE)) {
-                if (Objects.nonNull(clientLastSyncTime) && (System.currentTimeMillis() - clientLastSyncTime.getTime() / 1000) > ec.getBreakExpireSeconds()) {
+                if (Objects.nonNull(clientLastSyncTime) && (System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000 > ec.getBreakExpireSeconds()) {
                     teExamService.finish(teStudentCacheDto.getId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
                     List<TEExamDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, orgId);
                     if (Objects.nonNull(list) && list.size() > 0) {