ソースを参照

Merge branch 'dev'
111

wangliang 4 年 前
コミット
b492e00120

+ 8 - 5
themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java

@@ -16,7 +16,6 @@ import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBExamInvigilateUserService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
-import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
@@ -62,8 +61,8 @@ public class TBExamInvigilateUserController {
     @ApiOperation(value = "监考员查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考员信息", response = TBExamInvigilateUserDto.class)})
-    public Result query(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,@ApiParam(value = "考场代码", required = false) @RequestParam(required = false) String roomCode, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
-        IPage<TBExamInvigilateUserDto> examInvigilateUserDtoIPage = tbExamInvigilateUserService.examInvigilateUserQuery(new Page<>(pageNumber, pageSize), examId,roomCode, userId);
+    public Result query(@ApiParam(value = "考试批次id", required = true) @RequestParam(required = false) Long examId, @ApiParam(value = "考场代码", required = false) @RequestParam(required = false) String roomCode, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        IPage<TBExamInvigilateUserDto> examInvigilateUserDtoIPage = tbExamInvigilateUserService.examInvigilateUserQuery(new Page<>(pageNumber, pageSize), examId, roomCode, userId);
         BasePage basePage = new BasePage(examInvigilateUserDtoIPage.getRecords(), examInvigilateUserDtoIPage.getCurrent(), examInvigilateUserDtoIPage.getSize(), examInvigilateUserDtoIPage.getTotal());
         return ResultUtil.ok(basePage);
     }
@@ -126,10 +125,13 @@ public class TBExamInvigilateUserController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "考试批次id", required = true) @RequestParam Long examId) {
         if (Objects.isNull(file) || Objects.equals(file, "")) {
             throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
         }
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
         Map<String, Object> mapParameter = systemConfig.getOssEnv(UploadFileEnum.file.getId());
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
@@ -141,10 +143,11 @@ public class TBExamInvigilateUserController {
                 throw new BusinessException(ExceptionResultEnum.ATTACHMENT_ERROR);
             } else {
                 //往任务表里插一条数据
-                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_INVIGILATE_USER, tbAttachment.getId(), TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
+                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_INVIGILATE_USER, examId, TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }
+            transMap.put("examId", examId);
             transMap.put("createId", tbUser.getId());
             transMap.put("orgId", tbUser.getOrgId());
             transMap.put("remark", tbAttachment.getRemark());

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

@@ -127,7 +127,7 @@ public class TEExamPaperController {
                 throw new BusinessException(ExceptionResultEnum.ATTACHMENT_ERROR);
             } else {
                 //往任务表里插一条数据
-                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_PAPER, tbAttachment.getId(), TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
+                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_PAPER, examId, TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }

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

@@ -186,7 +186,7 @@ public class TEExamStudentController {
                 throw new BusinessException(ExceptionResultEnum.ATTACHMENT_ERROR);
             } else {
                 //往任务表里插一条数据
-                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_STUDENT, tbAttachment.getId(), TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
+                tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_STUDENT, examId, TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId());
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }

+ 15 - 3
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeReportController.java

@@ -2,8 +2,6 @@ package com.qmth.themis.backend.api;
 
 import javax.annotation.Resource;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -28,7 +26,6 @@ import io.swagger.annotations.ApiResponses;
 @RestController
 @RequestMapping("/${prefix.url.admin}/report")
 public class TIeReportController {
-    private final static Logger log = LoggerFactory.getLogger(TIeReportController.class);
     
     @Resource
     private TIeReportService reportService;
@@ -58,4 +55,19 @@ public class TIeReportController {
                              @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         return ResultUtil.ok(reportService.examViewCount(examId, examActivityId, roomCode, courseCode, name, identity,pageNumber,pageSize));
     }
+    
+    
+    @ApiOperation(value = "缺考名单")
+    @RequestMapping(value = "/exam_deficiency_list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
+    public Result examDeficiencyList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                             @ApiParam(value = "考场场次id", required = false) @RequestParam Long examActivityId,
+                             @ApiParam(value = "虚拟考场代码", required = false) @RequestParam String roomCode,
+                             @ApiParam(value = "科目编码", required = false) @RequestParam String courseCode,
+                             @ApiParam(value = "姓名", required = false) @RequestParam String name,
+                             @ApiParam(value = "唯一码", required = false) @RequestParam String identity,
+                             @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                             @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        return ResultUtil.ok(reportService.examDeficiencyList(examId, examActivityId, roomCode, courseCode, name, identity,pageNumber,pageSize));
+    }
 }

+ 117 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ExamDeficiencyListBean.java

@@ -0,0 +1,117 @@
+package com.qmth.themis.business.bean.backend;
+
+import java.io.Serializable;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("报表-缺考名单返回对象")
+public class ExamDeficiencyListBean implements Serializable {
+
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1997861915329030074L;
+
+	@ApiModelProperty(name = "考试名称")
+    private String examName;
+	
+	@ApiModelProperty(name = "考试id")
+    private Long examId;
+
+    @ApiModelProperty(name = "场次id")
+    private Long examActivityId;
+
+    @ApiModelProperty(name = "虚拟考场代码")
+    private String roomCode;
+
+    @ApiModelProperty(name = "虚拟考场名称")
+    private String roomName;
+
+    @ApiModelProperty(name = "唯一码")
+    private String identity;
+    
+    @ApiModelProperty(name = "姓名")
+    private String name;
+    
+    @ApiModelProperty(name = "科目名称")
+    private String courseCode;
+    
+    @ApiModelProperty(name = "科目编码")
+    private String courseName;
+
+	public String getExamName() {
+		return examName;
+	}
+
+	public void setExamName(String examName) {
+		this.examName = examName;
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public Long getExamActivityId() {
+		return examActivityId;
+	}
+
+	public void setExamActivityId(Long examActivityId) {
+		this.examActivityId = examActivityId;
+	}
+
+	public String getRoomCode() {
+		return roomCode;
+	}
+
+	public void setRoomCode(String roomCode) {
+		this.roomCode = roomCode;
+	}
+
+	public String getRoomName() {
+		return roomName;
+	}
+
+	public void setRoomName(String roomName) {
+		this.roomName = roomName;
+	}
+
+	public String getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(String identity) {
+		this.identity = identity;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+    
+    
+}

+ 11 - 5
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamStudentMapper.java

@@ -1,16 +1,18 @@
 package com.qmth.themis.business.dao;
 
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.themis.business.bean.backend.ExamDeficiencyListBean;
 import com.qmth.themis.business.bean.backend.ExamViewCountListBean;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
 import com.qmth.themis.business.entity.TEExamStudent;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 考生库 Mapper 接口
@@ -59,4 +61,8 @@ public interface TEExamStudentMapper extends BaseMapper<TEExamStudent> {
      * @return
      */
     public List<RoomCodeQueryDto> examRoomQuery(@Param("roomName") String roomName);
+    
+    public IPage<ExamDeficiencyListBean> getExamDeficiencyPage(IPage<ExamDeficiencyListBean> iPage, @Param("examId") Long examId,
+			@Param("activityId") Long activityId, @Param("roomCode") String roomCode,
+			@Param("courseCode") String courseCode, @Param("name") String name, @Param("identity") String identity,@Param("activityIds") List<Long> activityIds);
 }

+ 3 - 2
themis-business/src/main/java/com/qmth/themis/business/entity/TEExam.java

@@ -1,5 +1,6 @@
 package com.qmth.themis.business.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.qmth.themis.business.base.BaseEntity;
 import com.qmth.themis.business.dto.request.TEExamDto;
@@ -46,7 +47,7 @@ public class TEExam extends BaseEntity {
     private Date endTime;
 
     @ApiModelProperty(value = "考试口令")
-    @TableField(value = "short_code")
+    @TableField(value = "short_code", updateStrategy = FieldStrategy.IGNORED)
     private String shortCode;
 
     @ApiModelProperty(value = "提前多长时间开始候考(分钟)")
@@ -162,7 +163,7 @@ public class TEExam extends BaseEntity {
     private ObjectiveScorePolicyEnum objectiveScorePolicy;
 
     @ApiModelProperty(value = "开启监控的视频源")
-    @TableField(value = "monitor_video_source")
+    @TableField(value = "monitor_video_source", updateStrategy = FieldStrategy.IGNORED)
     private String monitorVideoSource;
 
     @ApiModelProperty(value = "是否开始监控转录,0:开启,1:不开启")

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TIeReportService.java

@@ -10,4 +10,7 @@ public interface TIeReportService {
 
 	public BasePage examViewCount(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
 			String identity, int pageNumber, int pageSize);
+
+	public BasePage examDeficiencyList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
+			String identity, int pageNumber, int pageSize);
 }

+ 40 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeReportServiceImpl.java

@@ -11,14 +11,19 @@ import javax.annotation.Resource;
 
 import org.springframework.stereotype.Service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
 import com.qmth.themis.business.base.BasePage;
+import com.qmth.themis.business.bean.backend.ExamDeficiencyListBean;
 import com.qmth.themis.business.bean.backend.ExamViewCountListBean;
 import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.dao.TEExamStudentMapper;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
+import com.qmth.themis.business.entity.TEExamActivity;
 import com.qmth.themis.business.service.TEExamActivityService;
 import com.qmth.themis.business.service.TEExamService;
 import com.qmth.themis.business.service.TIeReportService;
@@ -158,5 +163,40 @@ public class TIeReportServiceImpl implements TIeReportService {
 		return basePage;
 	}
 
+	@Override
+	public BasePage examDeficiencyList(Long examId, Long examActivityId, String roomCode, String courseCode,
+			String name, String identity, int pageNumber, int pageSize) {
+		Page<ExamDeficiencyListBean> ipage=new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("t.exam_activity_id"));
+		ipage.addOrder(OrderItem.asc("t.room_code"));
+		QueryWrapper<TEExamActivity> wp = new QueryWrapper<>();
+		wp.lambda().eq(TEExamActivity::getExamId, examId);
+        List<TEExamActivity> acs= examActivityService.list(wp);
+        List<Long> absentActivityIds=new ArrayList<>();
+		Date now = new Date();
+		for(TEExamActivity ac:acs) {
+			Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000L);
+	        if (now.getTime() > end) {//场次开考时间结束,未开考的都是缺考
+	        	absentActivityIds.add(ac.getId());
+	        }
+		}
+		if(absentActivityIds.size()==0) {
+        	BasePage basePage = new BasePage(Lists.newArrayList(), 1, pageSize, 0);
+        	return basePage;
+        }
+		IPage<ExamDeficiencyListBean> total = examStudentMapper.getExamDeficiencyPage(ipage,examId, examActivityId, roomCode, courseCode,name,identity,absentActivityIds);
+        List<ExamDeficiencyListBean> data=total.getRecords();
+        if(data==null||data.size()==0) {
+        	BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+        	return basePage;
+        }
+        ExamCacheBean exam=examService.getExamCacheBean(examId);
+		for(ExamDeficiencyListBean b:data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+        return basePage;
+	}
+
 
 }

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

@@ -17,7 +17,7 @@
             tbth.finish_time as finishTime,
             tbth.create_id as createId,
             tbth.import_file_name as importFileName,
-            (select tba.name from t_b_attachment tba where tba.id = tbth.entity_id) as entityName,
+            (select tee.name from t_e_exam tee where tba.id = tbth.entity_id) as entityName,
             (
             select
                 tbu.name

+ 34 - 0
themis-business/src/main/resources/mapper/TEExamStudentMapper.xml

@@ -124,4 +124,38 @@
             </if>
         </where>
     </select>
+    
+    <select id="getExamDeficiencyPage"
+		resultType="com.qmth.themis.business.bean.backend.ExamDeficiencyListBean">
+		select t.exam_id examId,t.exam_activity_id
+		examActivityId,t.room_code
+		roomCode,t.course_code courseCode,t.course_name
+		courseName,t.name,t.identity
+		,t.room_name roomName from
+		t_e_exam_student t
+		left join t_e_exam_activity f on
+		t.exam_activity_id=f.id
+		where t.exam_id = #{examId} and
+		t.current_record_id is null
+		and t.exam_activity_id in
+		<foreach collection="activityIds" item="acid" index="index"
+			open="(" close=")" separator=",">
+			#{acid}
+		</foreach>
+		<if test="activityId != null and activityId != ''">
+			and t.exam_activity_id = #{activityId}
+		</if>
+		<if test="roomCode != null and roomCode != ''">
+			and t.room_code =#{roomCode}
+		</if>
+		<if test="courseCode != null and courseCode != ''">
+			and t.course_code = #{courseCode}
+		</if>
+		<if test="identity != null and identity != ''">
+			and t.identity like concat(#{identity},'%')
+		</if>
+		<if test="name != null and name != ''">
+			and t.name like concat(#{name},'%')
+		</if>
+	</select>
 </mapper>

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

@@ -224,7 +224,7 @@
            toer.status as statusCode,
            IFNULL(toer.warning_count,0) as warningCount,
            IFNULL(toer.breach_status,1) as breachStatus,
-           toer.client_last_sync_time as updateTime
+           toer.client_last_sync_time as updateTime,
            tiiwi.approve_status as approveStatus
            ,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = toer.id and tiiwi.`type` =
             'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount