|
@@ -1,71 +1,38 @@
|
|
package com.qmth.themis.backend.api;
|
|
package com.qmth.themis.backend.api;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Collections;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
-import java.util.function.Function;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
-
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
|
+import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
|
|
import com.qmth.themis.business.dto.response.TEExamStudentDto;
|
|
import com.qmth.themis.business.dto.response.TEExamStudentDto;
|
|
-import com.qmth.themis.business.entity.TBAttachment;
|
|
|
|
-import com.qmth.themis.business.entity.TBExamInvigilateUser;
|
|
|
|
-import com.qmth.themis.business.entity.TBOrg;
|
|
|
|
-import com.qmth.themis.business.entity.TBTaskHistory;
|
|
|
|
-import com.qmth.themis.business.entity.TBUser;
|
|
|
|
-import com.qmth.themis.business.entity.TEExam;
|
|
|
|
-import com.qmth.themis.business.entity.TEExamActivity;
|
|
|
|
-import com.qmth.themis.business.entity.TEExamStudent;
|
|
|
|
-import com.qmth.themis.business.entity.TEStudent;
|
|
|
|
-import com.qmth.themis.business.enums.MqTagEnum;
|
|
|
|
-import com.qmth.themis.business.enums.MqTopicEnum;
|
|
|
|
-import com.qmth.themis.business.enums.TaskStatusEnum;
|
|
|
|
-import com.qmth.themis.business.enums.TaskTypeEnum;
|
|
|
|
-import com.qmth.themis.business.enums.UploadFileEnum;
|
|
|
|
-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.service.TEExamActivityService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
|
-import com.qmth.themis.business.service.TEStudentService;
|
|
|
|
|
|
+import com.qmth.themis.business.entity.*;
|
|
|
|
+import com.qmth.themis.business.enums.*;
|
|
|
|
+import com.qmth.themis.business.service.*;
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
|
|
+import io.swagger.annotations.*;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
|
-import io.swagger.annotations.ApiResponses;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 考生库 前端控制器
|
|
* @Description: 考生库 前端控制器
|
|
@@ -107,26 +74,29 @@ public class TEExamStudentController {
|
|
@Resource
|
|
@Resource
|
|
TEStudentService teStudentService;
|
|
TEStudentService teStudentService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamCourseService teExamCourseService;
|
|
|
|
+
|
|
@ApiOperation(value = "考生导出")
|
|
@ApiOperation(value = "考生导出")
|
|
@RequestMapping(value = "/export", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/export", method = RequestMethod.POST)
|
|
public Result export(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
|
|
public Result export(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
|
|
- @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
|
|
|
|
- @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
|
|
|
|
- @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
|
|
|
|
- @ApiParam(value = "考场代码", required = false) @RequestParam(required = false) String roomCode,
|
|
|
|
- @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
|
|
|
|
- @ApiParam(value = "年级", required = false) @RequestParam(required = false) String grade,
|
|
|
|
- @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable,
|
|
|
|
- @ApiParam(value = "教学班级", required = false) @RequestParam(required = false) String classNo,
|
|
|
|
- @ApiParam(value = "底照是否上传", required = false) @RequestParam(required = false) Integer hasPhoto) throws Exception {
|
|
|
|
- TBTaskHistory tbTaskHistory = null;
|
|
|
|
|
|
+ @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
|
|
|
|
+ @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
|
|
|
|
+ @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
|
|
|
|
+ @ApiParam(value = "考场代码", required = false) @RequestParam(required = false) String roomCode,
|
|
|
|
+ @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
|
|
|
|
+ @ApiParam(value = "年级", required = false) @RequestParam(required = false) String grade,
|
|
|
|
+ @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable,
|
|
|
|
+ @ApiParam(value = "教学班级", required = false) @RequestParam(required = false) String classNo,
|
|
|
|
+ @ApiParam(value = "底照是否上传", required = false) @RequestParam(required = false) Integer hasPhoto) throws Exception {
|
|
|
|
+ TBTaskHistory tbTaskHistory = null;
|
|
Map<String, Object> transMap = new HashMap<String, Object>();
|
|
Map<String, Object> transMap = new HashMap<String, Object>();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
//往任务表里插一条数据
|
|
//往任务表里插一条数据
|
|
tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_EXAM_STUDENT, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId());
|
|
tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_EXAM_STUDENT, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId());
|
|
taskHistoryService.save(tbTaskHistory);
|
|
taskHistoryService.save(tbTaskHistory);
|
|
transMap.put("tbTaskHistory", tbTaskHistory);
|
|
transMap.put("tbTaskHistory", tbTaskHistory);
|
|
-
|
|
|
|
|
|
+
|
|
transMap.put("examId", examId);
|
|
transMap.put("examId", examId);
|
|
transMap.put("activityId", activityId);
|
|
transMap.put("activityId", activityId);
|
|
transMap.put("identity", identity);
|
|
transMap.put("identity", identity);
|
|
@@ -137,12 +107,12 @@ public class TEExamStudentController {
|
|
transMap.put("enable", enable);
|
|
transMap.put("enable", enable);
|
|
transMap.put("classNo", classNo);
|
|
transMap.put("classNo", classNo);
|
|
transMap.put("hasPhoto", hasPhoto);
|
|
transMap.put("hasPhoto", hasPhoto);
|
|
-
|
|
|
|
|
|
+
|
|
transMap.put("createId", tbUser.getId());
|
|
transMap.put("createId", tbUser.getId());
|
|
|
|
|
|
//mq发送消息start
|
|
//mq发送消息start
|
|
MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_EXPORT.name(), transMap, MqTagEnum.EXAM_STUDENT_EXPORT, String.valueOf(tbTaskHistory.getId()), tbUser.getName());
|
|
MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_EXPORT.name(), transMap, MqTagEnum.EXAM_STUDENT_EXPORT, String.valueOf(tbTaskHistory.getId()), tbUser.getName());
|
|
-
|
|
|
|
|
|
+
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
//mq发送消息end
|
|
//mq发送消息end
|
|
Map<String, Long> map = new HashMap<String, Long>();
|
|
Map<String, Long> map = new HashMap<String, Long>();
|
|
@@ -243,9 +213,23 @@ public class TEExamStudentController {
|
|
teStudentUpdateWrapper.lambda().set(TEStudent::getName, s.getName()).eq(TEStudent::getIdentity,
|
|
teStudentUpdateWrapper.lambda().set(TEStudent::getName, s.getName()).eq(TEStudent::getIdentity,
|
|
s.getIdentity());
|
|
s.getIdentity());
|
|
teStudentService.update(teStudentUpdateWrapper);
|
|
teStudentService.update(teStudentUpdateWrapper);
|
|
-
|
|
|
|
s.setUpdateId(tbUser.getId());
|
|
s.setUpdateId(tbUser.getId());
|
|
}
|
|
}
|
|
|
|
+ ExamCourseCacheBean examCourseCacheBean = teExamCourseService.getExamCourseCacheBean(s.getExamId(), s.getCourseCode());
|
|
|
|
+ if (Objects.isNull(examCourseCacheBean)) {
|
|
|
|
+ throw new BusinessException("考试科目不存在");
|
|
|
|
+ }
|
|
|
|
+ s.setCourseName(examCourseCacheBean.getCourseName());
|
|
|
|
+ List<RoomCodeQueryDto> roomCodeQueryDtoList = teExamStudentService.examRoomQuery(null);
|
|
|
|
+ if (Objects.nonNull(roomCodeQueryDtoList)) {
|
|
|
|
+ Map<String, RoomCodeQueryDto> roomCodeQueryDtoMap = roomCodeQueryDtoList.stream()
|
|
|
|
+ .collect(Collectors.toMap(RoomCodeQueryDto::getRoomCode, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
+ String roomName = roomCodeQueryDtoMap.get(s.getRoomCode()).getRoomName();
|
|
|
|
+ if (Objects.isNull(roomName)) {
|
|
|
|
+ throw new BusinessException("考场不存在");
|
|
|
|
+ }
|
|
|
|
+ s.setRoomName(roomCodeQueryDtoMap.get(s.getRoomCode()).getRoomName());
|
|
|
|
+ }
|
|
});
|
|
});
|
|
teExamStudentService.saveOrUpdateBatch(teExamStudentList);
|
|
teExamStudentService.saveOrUpdateBatch(teExamStudentList);
|
|
teExamStudentList.forEach(s -> {
|
|
teExamStudentList.forEach(s -> {
|