|
@@ -17,6 +17,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -28,14 +29,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.CourseProgressInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentEntityConvert;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentExcel;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentFinishedStatistic;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentOrgStatistic;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentQuery;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentUnFinishedExcel;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.JsonMapper;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.excel.ExportUtils;
|
|
@@ -60,36 +53,36 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
private ExamStudentService examStudentService;
|
|
|
@Autowired
|
|
|
private GainBaseDataService gainBaseDataService;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询课程本地缓存
|
|
|
*/
|
|
|
- private static Map<Long,CourseBean> courseBeanLocalCache;
|
|
|
-
|
|
|
+ private static Map<Long, CourseBean> courseBeanLocalCache;
|
|
|
+
|
|
|
private static Timer timer;
|
|
|
-
|
|
|
- static{
|
|
|
- courseBeanLocalCache = new ConcurrentHashMap<Long, CourseBean>();
|
|
|
- timer = new Timer();
|
|
|
+
|
|
|
+ static {
|
|
|
+ courseBeanLocalCache = new ConcurrentHashMap<Long, CourseBean>();
|
|
|
+ timer = new Timer();
|
|
|
}
|
|
|
-
|
|
|
- class CleanCourseBeanCacheTask extends TimerTask{
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- courseBeanLocalCache.clear();
|
|
|
- }
|
|
|
+
|
|
|
+ class CleanCourseBeanCacheTask extends TimerTask {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ courseBeanLocalCache.clear();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- public ExamStudentController(){
|
|
|
- long delay = 10*60*1000;//10分钟后开始
|
|
|
- long period = 30*60*1000;//30分钟清理一次
|
|
|
- timer.schedule(new CleanCourseBeanCacheTask(),delay,period);
|
|
|
+
|
|
|
+ public ExamStudentController() {
|
|
|
+ long delay = 10 * 60 * 1000;//10分钟后开始
|
|
|
+ long period = 30 * 60 * 1000;//30分钟清理一次
|
|
|
+ timer.schedule(new CleanCourseBeanCacheTask(), delay, period);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/examScheduling/list")
|
|
|
@ApiOperation(value = "查询“考试进度详情”列表(分页)")
|
|
|
public Page<ExamStudentInfo> getExamScheduling(@RequestBody ExamStudentQuery query) {
|
|
|
- Check.isNull(query, "查询参数不能为空!");
|
|
|
+ Check.isNull(query, "查询参数不能为空!");
|
|
|
Check.isNull(query.getExamId(), "考试批次不能为空!");
|
|
|
return examStudentService.getExamStudentListPage(query);
|
|
|
}
|
|
@@ -108,7 +101,7 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@PostMapping("/unfinished/list")
|
|
|
@ApiOperation(value = "查询“缺考登记”列表(分页)")
|
|
|
public Page<ExamStudentInfo> getExamStudentUnFinishedList(@RequestBody ExamStudentQuery query) {
|
|
|
- Check.isNull(query, "查询参数不能为空!");
|
|
|
+ Check.isNull(query, "查询参数不能为空!");
|
|
|
Check.isNull(query.getExamId(), "考试批次不能为空!");
|
|
|
query.setFinished(0);
|
|
|
return examStudentService.getExamStudentListPage(query);
|
|
@@ -130,62 +123,76 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@PostMapping("/reexamine/list")
|
|
|
@ApiOperation(value = "查询重考考生列表(分页)")
|
|
|
public Page<ExamStudentInfo> getReExamineStudentList(@RequestBody ExamStudentQuery query) {
|
|
|
- Check.isNull(query, "查询参数不能为空!");
|
|
|
+ Check.isNull(query, "查询参数不能为空!");
|
|
|
Check.isNull(query.getExamId(), "考试批次不能为空!");
|
|
|
return examStudentService.getReExamineStudentList(query);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@PostMapping("/reexamine")
|
|
|
@ApiOperation(value = "设置重考")
|
|
|
- public void setReexamine(@RequestParam Long examStudentId){
|
|
|
- if(examStudentId == null){
|
|
|
- return;
|
|
|
- }
|
|
|
- examStudentService.setReexamine(examStudentId);
|
|
|
+ public void setReexamine(@RequestParam Long examStudentId) {
|
|
|
+ if (examStudentId == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ examStudentService.setReexamine(examStudentId);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/statistic/by/finished")
|
|
|
@ApiOperation(value = "考试概况-按考试完成进度统计")
|
|
|
public ExamStudentFinishedStatistic getExamStudentStatisticByFinished(@RequestParam Long examId) {
|
|
|
- if(examId == null){
|
|
|
- return null;
|
|
|
- }
|
|
|
+ if (examId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
return examStudentService.getExamStudentStatisticByFinished(examId);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/statistic/by/org")
|
|
|
@ApiOperation(value = "考试概况-按学习中心统计")
|
|
|
public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(@RequestParam Long examId, @RequestParam(required = false) Long orgId) {
|
|
|
- if(examId == null){
|
|
|
- return null;
|
|
|
- }
|
|
|
+ if (examId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
return examStudentService.getExamStudentStatisticByOrg(examId, orgId);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @GetMapping("/statistic/by/org/export")
|
|
|
+ @ApiOperation(value = "导出“考试概况-按学习中心统计”列表(Excel)")
|
|
|
+ public void exportExamStudentStatisticByOrg(@RequestParam Long examId,
|
|
|
+ @RequestParam(required = false) Long orgId,
|
|
|
+ HttpServletResponse response) throws Exception {
|
|
|
+ Check.isNull(examId, "请选择考试批次!");
|
|
|
+ List<ExamStudentOrgStatistic> examStudentStatisticByOrgList = examStudentService.getExamStudentStatisticByOrg(examId, orgId);
|
|
|
+ List<OrgCompleteProgressExcel> resultList =
|
|
|
+ ExamStudentEntityConvert.copyFromExamStudentOrgStatistic(examStudentStatisticByOrgList);
|
|
|
+ ExportUtils.exportEXCEL("学习中心完成进度", OrgCompleteProgressExcel.class, resultList, response);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询课程
|
|
|
+ *
|
|
|
* @param examId
|
|
|
* @param orgId
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/findCoursesByExamIdAndOrgId")
|
|
|
@ApiOperation(value = "查询课程")
|
|
|
- public List<CourseBean> findCoursesByExamIdAndOrgId(@RequestParam Long examId, @RequestParam(required=false) Long orgId){
|
|
|
- if(examId == null){
|
|
|
- return null;
|
|
|
- }
|
|
|
- User user = getAccessUser();
|
|
|
- List<Long> courseIdList = examStudentService.findCoursesFromExamStudent(examId, orgId);
|
|
|
- List<CourseBean> courseBeanList = new ArrayList<CourseBean>();
|
|
|
- for(Long courseId:courseIdList){
|
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
|
|
|
- courseBeanList.add(courseBean);
|
|
|
- }
|
|
|
- return courseBeanList;
|
|
|
+ public List<CourseBean> findCoursesByExamIdAndOrgId(@RequestParam Long examId, @RequestParam(required = false) Long orgId) {
|
|
|
+ if (examId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ User user = getAccessUser();
|
|
|
+ List<Long> courseIdList = examStudentService.findCoursesFromExamStudent(examId, orgId);
|
|
|
+ List<CourseBean> courseBeanList = new ArrayList<CourseBean>();
|
|
|
+ for (Long courseId : courseIdList) {
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
|
|
|
+ courseBeanList.add(courseBean);
|
|
|
+ }
|
|
|
+ return courseBeanList;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 课程完成进度
|
|
|
+ *
|
|
|
* @param examId
|
|
|
* @param courseId
|
|
|
* @return
|
|
@@ -193,22 +200,42 @@ public class ExamStudentController extends ControllerSupport {
|
|
|
@GetMapping("/courseProgress/list")
|
|
|
@ApiOperation(value = "课程完成进度")
|
|
|
public List<CourseProgressInfo> queryCourseProgressInfos(@RequestParam Long examId,
|
|
|
- @RequestParam(required=false) Long courseId,
|
|
|
- @RequestParam(required=false) String orderColumn){
|
|
|
- if(examId == null){
|
|
|
- return null;
|
|
|
- }
|
|
|
- List<CourseProgressInfo> courseProgressInfoList = examStudentService.queryCourseProgressInfos(examId,courseId,orderColumn);
|
|
|
- if(courseProgressInfoList!=null && courseProgressInfoList.size()>0){
|
|
|
- for(CourseProgressInfo courseProgressInfo:courseProgressInfoList){
|
|
|
- long key = courseProgressInfo.getCourseId();
|
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(key);
|
|
|
- courseProgressInfo.setCourseCode(courseBean.getCode());
|
|
|
- courseProgressInfo.setCourseName(courseBean.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- return courseProgressInfoList;
|
|
|
+ @RequestParam(required = false) Long courseId,
|
|
|
+ @RequestParam(required = false) String orderColumn) {
|
|
|
+ if (examId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<CourseProgressInfo> courseProgressInfoList = examStudentService.queryCourseProgressInfos(examId, courseId, orderColumn);
|
|
|
+ if (courseProgressInfoList != null && courseProgressInfoList.size() > 0) {
|
|
|
+ for (CourseProgressInfo courseProgressInfo : courseProgressInfoList) {
|
|
|
+ long key = courseProgressInfo.getCourseId();
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(key);
|
|
|
+ courseProgressInfo.setCourseCode(courseBean.getCode());
|
|
|
+ courseProgressInfo.setCourseName(courseBean.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return courseProgressInfoList;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ @GetMapping("/courseProgress/list/export")
|
|
|
+ @ApiOperation(value = "导出“课程完成进度”列表(Excel)")
|
|
|
+ public void exportCourseProgressInfos(@RequestParam Long examId,
|
|
|
+ @RequestParam(required = false) Long courseId,
|
|
|
+ @RequestParam(required = false) String orderColumn,
|
|
|
+ HttpServletResponse response) throws Exception {
|
|
|
+ Check.isNull(examId, "请选择考试批次!");
|
|
|
+ List<CourseProgressInfo> courseProgressInfoList = examStudentService.queryCourseProgressInfos(examId, courseId, orderColumn);
|
|
|
+ if (courseProgressInfoList != null && courseProgressInfoList.size() > 0) {
|
|
|
+ for (CourseProgressInfo courseProgressInfo : courseProgressInfoList) {
|
|
|
+ long key = courseProgressInfo.getCourseId();
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(key);
|
|
|
+ courseProgressInfo.setCourseCode(courseBean.getCode());
|
|
|
+ courseProgressInfo.setCourseName(courseBean.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<CourseCompleteProgressExcel> resultList =
|
|
|
+ ExamStudentEntityConvert.copyFromCourseProgressInfo(courseProgressInfoList);
|
|
|
+ ExportUtils.exportEXCEL("课程完成进度", CourseCompleteProgressExcel.class, resultList, response);
|
|
|
+ }
|
|
|
+
|
|
|
}
|