Parcourir la source

报表-缺考名单

xiatian il y a 4 ans
Parent
commit
a2efd0bf55

+ 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 - 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;
+	}
+
 
 }

+ 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>