|
@@ -1,449 +1,450 @@
|
|
|
-package cn.com.qmth.examcloud.core.examwork.api.controller;
|
|
|
-
|
|
|
-import java.io.File;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
-import javax.persistence.criteria.Predicate;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
-import org.springframework.data.domain.Sort;
|
|
|
-import org.springframework.data.domain.Sort.Direction;
|
|
|
-import org.springframework.data.jpa.domain.Specification;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
|
|
|
-import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
|
|
|
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.request.SaveStudentReq;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.response.SaveStudentResp;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamStudentDomain;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
-/**
|
|
|
- * 考生服务API Created by songyue on 17/1/13.
|
|
|
- */
|
|
|
-@Transactional
|
|
|
-@RestController
|
|
|
-@RequestMapping("${$rmp.ctr.examwork}/exam_student")
|
|
|
-public class ExamStudentController extends ControllerSupport {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamStudentRepo examStudentRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamStudentService examStudentService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamRepo examRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StudentCloudService studentCloudService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- CourseCloudService courseCloudService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- OrgCloudService orgCloudService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamRecordCloudService examRecordCloudService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param studentId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询学生的所有考试")
|
|
|
- @GetMapping("byStudentId/{studentId}")
|
|
|
- public List<ExamStudentEntity> getExamStudentListByStudentId(@PathVariable Long studentId) {
|
|
|
-
|
|
|
- return examStudentRepo.findByStudentId(studentId);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 重构
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examCriteria
|
|
|
- * @param curPage
|
|
|
- * @param pageSize
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询考试学生带条件和分页", notes = "带条件带分页")
|
|
|
- @GetMapping("examStudentPage/{curPage}/{pageSize}")
|
|
|
- public PageInfo<ExamStudentDomain> getExamStudentPage(@PathVariable Integer curPage,
|
|
|
- @PathVariable Integer pageSize, @RequestParam(required = false) Long orgId,
|
|
|
- @RequestParam(required = false) Long examId,
|
|
|
- @RequestParam(required = false) String studentName,
|
|
|
- @RequestParam(required = false) String studentCode,
|
|
|
- @RequestParam(required = false) Long courseId,
|
|
|
- @RequestParam(required = false) String courseCode,
|
|
|
- @RequestParam(required = false) String courseLevel,
|
|
|
- @RequestParam(required = false) String courseName,
|
|
|
- @RequestParam(required = false) String examSite,
|
|
|
- @RequestParam(required = false) String identityNumber,
|
|
|
- @RequestParam(required = false) Boolean identityNumberLike,
|
|
|
- @RequestParam(required = false) String specialtyName,
|
|
|
- @RequestParam(required = false) String infoCollector,
|
|
|
- @RequestParam(required = false) Boolean withStarted) {
|
|
|
-
|
|
|
- User accessUser = getAccessUser();
|
|
|
-
|
|
|
- final Boolean finalIdentityNumberLike = null == identityNumberLike
|
|
|
- ? true
|
|
|
- : identityNumberLike;
|
|
|
-
|
|
|
- Specification<ExamStudentEntity> specification = (root, query, cb) -> {
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
|
|
|
-
|
|
|
- if (null != orgId) {
|
|
|
- predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
- }
|
|
|
-
|
|
|
- if (null != examId) {
|
|
|
- predicates.add(cb.equal(root.get("examId"), examId));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(studentName)) {
|
|
|
- predicates.add(cb.like(root.get("name"), toSqlSearchPattern(studentName)));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(studentCode)) {
|
|
|
- predicates.add(cb.like(root.get("studentCode"), toSqlSearchPattern(studentCode)));
|
|
|
- }
|
|
|
- if (null != courseId) {
|
|
|
- predicates.add(cb.equal(root.get("courseId"), courseId));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(courseCode)) {
|
|
|
- predicates.add(cb.equal(root.get("courseCode"), courseCode));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(courseLevel)) {
|
|
|
- predicates.add(cb.equal(root.get("courseLevel"), courseLevel));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(courseName)) {
|
|
|
- predicates.add(cb.like(root.get("courseName"), toSqlSearchPattern(courseName)));
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(examSite)) {
|
|
|
- predicates.add(cb.like(root.get("examSite"), toSqlSearchPattern(examSite)));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(identityNumber)) {
|
|
|
- if (finalIdentityNumberLike) {
|
|
|
- predicates.add(cb.like(root.get("identityNumber"),
|
|
|
- toSqlSearchPattern(identityNumber)));
|
|
|
- } else {
|
|
|
- predicates.add(cb.equal(root.get("identityNumber"), identityNumber));
|
|
|
- }
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(specialtyName)) {
|
|
|
- predicates
|
|
|
- .add(cb.like(root.get("specialtyName"), toSqlSearchPattern(specialtyName)));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(infoCollector)) {
|
|
|
- predicates
|
|
|
- .add(cb.like(root.get("infoCollector"), toSqlSearchPattern(infoCollector)));
|
|
|
- }
|
|
|
-
|
|
|
- return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
- };
|
|
|
-
|
|
|
- PageRequest pageRequest = new PageRequest(curPage, pageSize,
|
|
|
- new Sort(Direction.DESC, "updateTime"));
|
|
|
-
|
|
|
- Page<ExamStudentEntity> examStudents = examStudentRepo.findAll(specification, pageRequest);
|
|
|
-
|
|
|
- List<ExamStudentDomain> ret = Lists.newArrayList();
|
|
|
-
|
|
|
- for (ExamStudentEntity cur : examStudents) {
|
|
|
- ExamEntity exam = examRepo.findOne(cur.getExamId());
|
|
|
-
|
|
|
- GetOrgReq getOrgReq = new GetOrgReq();
|
|
|
- getOrgReq.setOrgId(cur.getOrgId());
|
|
|
- GetOrgResp getOrgResp = orgCloudService.getOrg(getOrgReq);
|
|
|
- OrgBean org = getOrgResp.getOrg();
|
|
|
-
|
|
|
- GetStudentReq getStudentReq = new GetStudentReq();
|
|
|
- getStudentReq.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- getStudentReq.setIdentityNumber(cur.getIdentityNumber());
|
|
|
- GetStudentResp getStudentResp = studentCloudService.getStudent(getStudentReq);
|
|
|
- StudentBean studentBean = getStudentResp.getStudentInfo();
|
|
|
-
|
|
|
- Boolean started = null;
|
|
|
- if (null != withStarted && withStarted) {
|
|
|
- CheckExamIsStartedReq checkExamIsStartedReq = new CheckExamIsStartedReq();
|
|
|
- checkExamIsStartedReq.setExamId(exam.getId());
|
|
|
- checkExamIsStartedReq.setCourseId(cur.getCourseId());
|
|
|
- checkExamIsStartedReq.setStudentId(studentBean.getId());
|
|
|
- checkExamIsStartedReq.setExamId(exam.getId());
|
|
|
- try {
|
|
|
- CheckExamIsStartedResp checkExamIsStartedResp = examRecordCloudService
|
|
|
- .checkExamIsStarted(checkExamIsStartedReq);
|
|
|
- started = checkExamIsStartedResp.getIsStarted();
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("fail to invoke remote method: checkExamIsStarted()", e);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- ExamStudentDomain bean = new ExamStudentDomain();
|
|
|
- bean.setRootOrgId(cur.getRootOrgId());
|
|
|
- bean.setId(cur.getId());
|
|
|
- bean.setExamId(exam.getId());
|
|
|
- bean.setExamName(exam.getName());
|
|
|
- bean.setStudentId(cur.getStudentId());
|
|
|
- bean.setStudentName(cur.getName());
|
|
|
- bean.setStudentCode(cur.getStudentCode());
|
|
|
- bean.setIdentityNumber(cur.getIdentityNumber());
|
|
|
- bean.setCourseId(cur.getCourseId());
|
|
|
- bean.setCourseCode(cur.getCourseCode());
|
|
|
- bean.setCourseName(cur.getCourseName());
|
|
|
- bean.setCourseLevel(cur.getCourseLevel());
|
|
|
- bean.setInfoCollector(cur.getInfoCollector());
|
|
|
- bean.setOrgId(cur.getOrgId());
|
|
|
- bean.setOrgCode(org.getCode());
|
|
|
- bean.setOrgName(org.getName());
|
|
|
- bean.setPaperType(cur.getPaperType());
|
|
|
- bean.setPhone(studentBean.getPhoneNumber());
|
|
|
- bean.setGrade(cur.getGrade());
|
|
|
- bean.setSpecialtyName(cur.getSpecialtyName());
|
|
|
- bean.setExamSite(cur.getExamSite());
|
|
|
- bean.setExamType(exam.getExamType().name());
|
|
|
- bean.setUpdateTime(cur.getUpdateTime());
|
|
|
- bean.setEnable(cur.getEnable());
|
|
|
- bean.setLocked(
|
|
|
- null == exam.getExamStudentLocked() ? false : exam.getExamStudentLocked());
|
|
|
- bean.setStarted(started);
|
|
|
-
|
|
|
- bean.setExt1(cur.getExt1());
|
|
|
- bean.setExt2(cur.getExt2());
|
|
|
- bean.setExt3(cur.getExt3());
|
|
|
- bean.setExt4(cur.getExt4());
|
|
|
- bean.setExt5(cur.getExt5());
|
|
|
- ret.add(bean);
|
|
|
- }
|
|
|
- return new PageInfo<ExamStudentDomain>(examStudents, ret);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "按ID查询考试学生", notes = "ID查询")
|
|
|
- @GetMapping("{id}")
|
|
|
- public ExamStudentEntity getExamStudentById(@PathVariable Long id) {
|
|
|
- ExamStudentEntity es = examStudentRepo.findOne(id);
|
|
|
- if (null == es) {
|
|
|
- throw new StatusException("E-520001", "考生不存在");
|
|
|
- }
|
|
|
- return es;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examStudent
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Transactional
|
|
|
- @ApiOperation(value = "新增考试学生", notes = "新增")
|
|
|
- @PostMapping()
|
|
|
- public ExamStudentDomain addExamStudent(@RequestBody ExamStudentDomain examStudent) {
|
|
|
- trim(examStudent);
|
|
|
- Long rootOrgId = getRootOrgId();
|
|
|
- examStudent.setRootOrgId(rootOrgId);
|
|
|
- examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
- return saveExamStudent(examStudent);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examStudent
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Transactional
|
|
|
- @ApiOperation(value = "更新考试学生", notes = "更新")
|
|
|
- @PutMapping()
|
|
|
- public ExamStudentDomain updateExamStudent(@RequestBody ExamStudentDomain examStudent) {
|
|
|
- trim(examStudent);
|
|
|
- Long rootOrgId = getRootOrgId();
|
|
|
- examStudent.setRootOrgId(rootOrgId);
|
|
|
- examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
- return saveExamStudent(examStudent);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examStudent
|
|
|
- * @return
|
|
|
- */
|
|
|
- private ExamStudentDomain saveExamStudent(ExamStudentDomain examStudent) {
|
|
|
- SaveStudentReq saveStudentReq = new SaveStudentReq();
|
|
|
- saveStudentReq.setIdentityNumber(examStudent.getIdentityNumber().toUpperCase(Locale.US));
|
|
|
- saveStudentReq.setName(examStudent.getStudentName());
|
|
|
- saveStudentReq.setPhoneNumber(examStudent.getPhone());
|
|
|
- saveStudentReq.setOrgId(examStudent.getOrgId());
|
|
|
- saveStudentReq.setRemark(examStudent.getRemark());
|
|
|
- saveStudentReq.setRootOrgId(examStudent.getRootOrgId());
|
|
|
- saveStudentReq.setStudentCode(examStudent.getStudentCode());
|
|
|
-
|
|
|
- SaveStudentResp saveStudentResp = studentCloudService.saveStudent(saveStudentReq);
|
|
|
-
|
|
|
- Long studentId = saveStudentResp.getStudentId();
|
|
|
-
|
|
|
- ExamStudentInfo info = new ExamStudentInfo();
|
|
|
- info.setCourseId(examStudent.getCourseId());
|
|
|
- info.setExamId(examStudent.getExamId());
|
|
|
- info.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
- info.setPaperType(examStudent.getPaperType());
|
|
|
- info.setRootOrgId(examStudent.getRootOrgId());
|
|
|
- info.setStudentCode(examStudent.getStudentCode());
|
|
|
- info.setStudentName(examStudent.getStudentName());
|
|
|
- info.setStudentId(studentId);
|
|
|
- info.setInfoCollector(examStudent.getInfoCollector());
|
|
|
- info.setGrade(examStudent.getGrade());
|
|
|
- info.setExamSite(examStudent.getExamSite());
|
|
|
- info.setSpecialtyName(examStudent.getSpecialtyName());
|
|
|
- info.setRemark(examStudent.getRemark());
|
|
|
-
|
|
|
- info.setExt1(examStudent.getExt1());
|
|
|
- info.setExt2(examStudent.getExt2());
|
|
|
- info.setExt3(examStudent.getExt3());
|
|
|
- info.setExt4(examStudent.getExt4());
|
|
|
- info.setExt5(examStudent.getExt5());
|
|
|
-
|
|
|
- ExamStudentInfo savedExamStudent = examStudentService.saveExamStudent(info);
|
|
|
-
|
|
|
- ExamStudentDomain ret = new ExamStudentDomain();
|
|
|
- ret.setId(savedExamStudent.getId());
|
|
|
- ret.setStudentId(studentId);
|
|
|
- ret.setStudentCode(savedExamStudent.getStudentCode());
|
|
|
- ret.setStudentName(savedExamStudent.getStudentName());
|
|
|
- ret.setCourseCode(savedExamStudent.getCourseCode());
|
|
|
- ret.setCourseName(savedExamStudent.getCourseName());
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Transactional
|
|
|
- @ApiOperation(value = "按ID删除考试学生", notes = "删除")
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public List<Long> deleteExamStudent(@PathVariable String ids) {
|
|
|
- List<Long> idList = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- examStudentService.deleteExamStudentsByStudentIds(idList);
|
|
|
- return idList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param examId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "按考试删除考试学生", notes = "按考试删除")
|
|
|
- @Transactional
|
|
|
- @DeleteMapping("exam/{examId}")
|
|
|
- public Long deleteExamStudents(@PathVariable Long examId) {
|
|
|
- examStudentService.deleteExamStudentsByExamId(examId);
|
|
|
- return examId;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "下载导入模板", notes = "下载导入模板")
|
|
|
- @GetMapping("/downloadTemplate")
|
|
|
- public void downloadTemplate(HttpServletResponse response) {
|
|
|
- String resoucePath = PathUtil.getResoucePath("templates/studentImportTemplate.xlsx");
|
|
|
- exportFile("考生导入模板.xlsx", new File(resoucePath));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "启用考生")
|
|
|
- @PutMapping("enable/{ids}")
|
|
|
- public List<String> enableStudent(@PathVariable String ids) {
|
|
|
- List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<String> ret = Lists.newArrayList();
|
|
|
- for (Long cur : examStuIds) {
|
|
|
- ExamStudentEntity s = examStudentRepo.findOne(cur);
|
|
|
- s.setEnable(true);
|
|
|
- examStudentRepo.save(s);
|
|
|
- ret.add(s.getId() + ":" + s.getName());
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 方法注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "禁用考生")
|
|
|
- @PutMapping("disable/{ids}")
|
|
|
- public List<String> disableStudent(@PathVariable String ids) {
|
|
|
- List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<String> ret = Lists.newArrayList();
|
|
|
- for (Long cur : examStuIds) {
|
|
|
- ExamStudentEntity s = examStudentRepo.findOne(cur);
|
|
|
- s.setEnable(false);
|
|
|
- examStudentRepo.save(s);
|
|
|
- ret.add(s.getId() + ":" + s.getName());
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.com.qmth.examcloud.core.examwork.api.controller;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.data.domain.Sort.Direction;
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.commons.base.util.PathUtil;
|
|
|
+import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
|
|
|
+import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.SaveStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.SaveStudentResp;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamStudentDomain;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 考生服务API Created by songyue on 17/1/13.
|
|
|
+ */
|
|
|
+@Transactional
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp.ctr.examwork}/exam_student")
|
|
|
+public class ExamStudentController extends ControllerSupport {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamStudentRepo examStudentRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamStudentService examStudentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamRepo examRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ StudentCloudService studentCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CourseCloudService courseCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ OrgCloudService orgCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamRecordCloudService examRecordCloudService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param studentId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询学生的所有考试")
|
|
|
+ @GetMapping("byStudentId/{studentId}")
|
|
|
+ public List<ExamStudentEntity> getExamStudentListByStudentId(@PathVariable Long studentId) {
|
|
|
+
|
|
|
+ return examStudentRepo.findByStudentId(studentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重构
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examCriteria
|
|
|
+ * @param curPage
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询考试学生带条件和分页", notes = "带条件带分页")
|
|
|
+ @GetMapping("examStudentPage/{curPage}/{pageSize}")
|
|
|
+ public PageInfo<ExamStudentDomain> getExamStudentPage(@PathVariable Integer curPage,
|
|
|
+ @PathVariable Integer pageSize, @RequestParam(required = false) Long orgId,
|
|
|
+ @RequestParam(required = false) Long examId,
|
|
|
+ @RequestParam(required = false) String studentName,
|
|
|
+ @RequestParam(required = false) String studentCode,
|
|
|
+ @RequestParam(required = false) Long courseId,
|
|
|
+ @RequestParam(required = false) String courseCode,
|
|
|
+ @RequestParam(required = false) String courseLevel,
|
|
|
+ @RequestParam(required = false) String courseName,
|
|
|
+ @RequestParam(required = false) String examSite,
|
|
|
+ @RequestParam(required = false) String identityNumber,
|
|
|
+ @RequestParam(required = false) Boolean identityNumberLike,
|
|
|
+ @RequestParam(required = false) String specialtyName,
|
|
|
+ @RequestParam(required = false) String infoCollector,
|
|
|
+ @RequestParam(required = false) Boolean withStarted) {
|
|
|
+
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+
|
|
|
+ final Boolean finalIdentityNumberLike = null == identityNumberLike
|
|
|
+ ? true
|
|
|
+ : identityNumberLike;
|
|
|
+
|
|
|
+ Specification<ExamStudentEntity> specification = (root, query, cb) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
|
|
|
+
|
|
|
+ if (null != orgId) {
|
|
|
+ predicates.add(cb.equal(root.get("orgId"), orgId));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != examId) {
|
|
|
+ predicates.add(cb.equal(root.get("examId"), examId));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(studentName)) {
|
|
|
+ predicates.add(cb.like(root.get("name"), toSqlSearchPattern(studentName)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(studentCode)) {
|
|
|
+ predicates.add(cb.like(root.get("studentCode"), toSqlSearchPattern(studentCode)));
|
|
|
+ }
|
|
|
+ if (null != courseId) {
|
|
|
+ predicates.add(cb.equal(root.get("courseId"), courseId));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(courseCode)) {
|
|
|
+ predicates.add(cb.equal(root.get("courseCode"), courseCode));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(courseLevel)) {
|
|
|
+ predicates.add(cb.equal(root.get("courseLevel"), courseLevel));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(courseName)) {
|
|
|
+ predicates.add(cb.like(root.get("courseName"), toSqlSearchPattern(courseName)));
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(examSite)) {
|
|
|
+ predicates.add(cb.like(root.get("examSite"), toSqlSearchPattern(examSite)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(identityNumber)) {
|
|
|
+ if (finalIdentityNumberLike) {
|
|
|
+ predicates.add(cb.like(root.get("identityNumber"),
|
|
|
+ toSqlSearchPattern(identityNumber)));
|
|
|
+ } else {
|
|
|
+ predicates.add(cb.equal(root.get("identityNumber"), identityNumber));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(specialtyName)) {
|
|
|
+ predicates
|
|
|
+ .add(cb.like(root.get("specialtyName"), toSqlSearchPattern(specialtyName)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(infoCollector)) {
|
|
|
+ predicates
|
|
|
+ .add(cb.like(root.get("infoCollector"), toSqlSearchPattern(infoCollector)));
|
|
|
+ }
|
|
|
+
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+
|
|
|
+ PageRequest pageRequest = new PageRequest(curPage, pageSize,
|
|
|
+ new Sort(Direction.DESC, "updateTime"));
|
|
|
+
|
|
|
+ Page<ExamStudentEntity> examStudents = examStudentRepo.findAll(specification, pageRequest);
|
|
|
+
|
|
|
+ List<ExamStudentDomain> ret = Lists.newArrayList();
|
|
|
+
|
|
|
+ for (ExamStudentEntity cur : examStudents) {
|
|
|
+ ExamEntity exam = examRepo.findOne(cur.getExamId());
|
|
|
+
|
|
|
+ GetOrgReq getOrgReq = new GetOrgReq();
|
|
|
+ getOrgReq.setOrgId(cur.getOrgId());
|
|
|
+ GetOrgResp getOrgResp = orgCloudService.getOrg(getOrgReq);
|
|
|
+ OrgBean org = getOrgResp.getOrg();
|
|
|
+
|
|
|
+ GetStudentReq getStudentReq = new GetStudentReq();
|
|
|
+ getStudentReq.setRootOrgId(accessUser.getRootOrgId());
|
|
|
+ getStudentReq.setIdentityNumber(cur.getIdentityNumber());
|
|
|
+ GetStudentResp getStudentResp = studentCloudService.getStudent(getStudentReq);
|
|
|
+ StudentBean studentBean = getStudentResp.getStudentInfo();
|
|
|
+
|
|
|
+ Boolean started = null;
|
|
|
+ if (null != withStarted && withStarted) {
|
|
|
+ CheckExamIsStartedReq checkExamIsStartedReq = new CheckExamIsStartedReq();
|
|
|
+ checkExamIsStartedReq.setExamId(exam.getId());
|
|
|
+ checkExamIsStartedReq.setCourseId(cur.getCourseId());
|
|
|
+ checkExamIsStartedReq.setStudentId(studentBean.getId());
|
|
|
+ checkExamIsStartedReq.setExamId(exam.getId());
|
|
|
+ try {
|
|
|
+ CheckExamIsStartedResp checkExamIsStartedResp = examRecordCloudService
|
|
|
+ .checkExamIsStarted(checkExamIsStartedReq);
|
|
|
+ started = checkExamIsStartedResp.getIsStarted();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("fail to invoke remote method: checkExamIsStarted()", e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamStudentDomain bean = new ExamStudentDomain();
|
|
|
+ bean.setRootOrgId(cur.getRootOrgId());
|
|
|
+ bean.setId(cur.getId());
|
|
|
+ bean.setExamId(exam.getId());
|
|
|
+ bean.setExamName(exam.getName());
|
|
|
+ bean.setStudentId(cur.getStudentId());
|
|
|
+ bean.setStudentName(cur.getName());
|
|
|
+ bean.setStudentCode(cur.getStudentCode());
|
|
|
+ bean.setIdentityNumber(cur.getIdentityNumber());
|
|
|
+ bean.setCourseId(cur.getCourseId());
|
|
|
+ bean.setCourseCode(cur.getCourseCode());
|
|
|
+ bean.setCourseName(cur.getCourseName());
|
|
|
+ bean.setCourseLevel(cur.getCourseLevel());
|
|
|
+ bean.setInfoCollector(cur.getInfoCollector());
|
|
|
+ bean.setOrgId(cur.getOrgId());
|
|
|
+ bean.setOrgCode(org.getCode());
|
|
|
+ bean.setOrgName(org.getName());
|
|
|
+ bean.setPaperType(cur.getPaperType());
|
|
|
+ bean.setPhone(studentBean.getPhoneNumber());
|
|
|
+ bean.setGrade(cur.getGrade());
|
|
|
+ bean.setSpecialtyName(cur.getSpecialtyName());
|
|
|
+ bean.setExamSite(cur.getExamSite());
|
|
|
+ bean.setExamType(exam.getExamType().name());
|
|
|
+ bean.setUpdateTime(cur.getUpdateTime());
|
|
|
+ bean.setEnable(cur.getEnable());
|
|
|
+ bean.setLocked(
|
|
|
+ null == exam.getExamStudentLocked() ? false : exam.getExamStudentLocked());
|
|
|
+ bean.setStarted(started);
|
|
|
+ bean.setPhotoPath(studentBean.getPhotoPath());
|
|
|
+
|
|
|
+ bean.setExt1(cur.getExt1());
|
|
|
+ bean.setExt2(cur.getExt2());
|
|
|
+ bean.setExt3(cur.getExt3());
|
|
|
+ bean.setExt4(cur.getExt4());
|
|
|
+ bean.setExt5(cur.getExt5());
|
|
|
+ ret.add(bean);
|
|
|
+ }
|
|
|
+ return new PageInfo<ExamStudentDomain>(examStudents, ret);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "按ID查询考试学生", notes = "ID查询")
|
|
|
+ @GetMapping("{id}")
|
|
|
+ public ExamStudentEntity getExamStudentById(@PathVariable Long id) {
|
|
|
+ ExamStudentEntity es = examStudentRepo.findOne(id);
|
|
|
+ if (null == es) {
|
|
|
+ throw new StatusException("E-520001", "考生不存在");
|
|
|
+ }
|
|
|
+ return es;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @ApiOperation(value = "新增考试学生", notes = "新增")
|
|
|
+ @PostMapping()
|
|
|
+ public ExamStudentDomain addExamStudent(@RequestBody ExamStudentDomain examStudent) {
|
|
|
+ trim(examStudent);
|
|
|
+ Long rootOrgId = getRootOrgId();
|
|
|
+ examStudent.setRootOrgId(rootOrgId);
|
|
|
+ examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
+ return saveExamStudent(examStudent);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @ApiOperation(value = "更新考试学生", notes = "更新")
|
|
|
+ @PutMapping()
|
|
|
+ public ExamStudentDomain updateExamStudent(@RequestBody ExamStudentDomain examStudent) {
|
|
|
+ trim(examStudent);
|
|
|
+ Long rootOrgId = getRootOrgId();
|
|
|
+ examStudent.setRootOrgId(rootOrgId);
|
|
|
+ examStudent.setInfoCollector(examStudent.getInfoCollector());
|
|
|
+ return saveExamStudent(examStudent);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examStudent
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ExamStudentDomain saveExamStudent(ExamStudentDomain examStudent) {
|
|
|
+ SaveStudentReq saveStudentReq = new SaveStudentReq();
|
|
|
+ saveStudentReq.setIdentityNumber(examStudent.getIdentityNumber().toUpperCase(Locale.US));
|
|
|
+ saveStudentReq.setName(examStudent.getStudentName());
|
|
|
+ saveStudentReq.setPhoneNumber(examStudent.getPhone());
|
|
|
+ saveStudentReq.setOrgId(examStudent.getOrgId());
|
|
|
+ saveStudentReq.setRemark(examStudent.getRemark());
|
|
|
+ saveStudentReq.setRootOrgId(examStudent.getRootOrgId());
|
|
|
+ saveStudentReq.setStudentCode(examStudent.getStudentCode());
|
|
|
+
|
|
|
+ SaveStudentResp saveStudentResp = studentCloudService.saveStudent(saveStudentReq);
|
|
|
+
|
|
|
+ Long studentId = saveStudentResp.getStudentId();
|
|
|
+
|
|
|
+ ExamStudentInfo info = new ExamStudentInfo();
|
|
|
+ info.setCourseId(examStudent.getCourseId());
|
|
|
+ info.setExamId(examStudent.getExamId());
|
|
|
+ info.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
+ info.setPaperType(examStudent.getPaperType());
|
|
|
+ info.setRootOrgId(examStudent.getRootOrgId());
|
|
|
+ info.setStudentCode(examStudent.getStudentCode());
|
|
|
+ info.setStudentName(examStudent.getStudentName());
|
|
|
+ info.setStudentId(studentId);
|
|
|
+ info.setInfoCollector(examStudent.getInfoCollector());
|
|
|
+ info.setGrade(examStudent.getGrade());
|
|
|
+ info.setExamSite(examStudent.getExamSite());
|
|
|
+ info.setSpecialtyName(examStudent.getSpecialtyName());
|
|
|
+ info.setRemark(examStudent.getRemark());
|
|
|
+
|
|
|
+ info.setExt1(examStudent.getExt1());
|
|
|
+ info.setExt2(examStudent.getExt2());
|
|
|
+ info.setExt3(examStudent.getExt3());
|
|
|
+ info.setExt4(examStudent.getExt4());
|
|
|
+ info.setExt5(examStudent.getExt5());
|
|
|
+
|
|
|
+ ExamStudentInfo savedExamStudent = examStudentService.saveExamStudent(info);
|
|
|
+
|
|
|
+ ExamStudentDomain ret = new ExamStudentDomain();
|
|
|
+ ret.setId(savedExamStudent.getId());
|
|
|
+ ret.setStudentId(studentId);
|
|
|
+ ret.setStudentCode(savedExamStudent.getStudentCode());
|
|
|
+ ret.setStudentName(savedExamStudent.getStudentName());
|
|
|
+ ret.setCourseCode(savedExamStudent.getCourseCode());
|
|
|
+ ret.setCourseName(savedExamStudent.getCourseName());
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @ApiOperation(value = "按ID删除考试学生", notes = "删除")
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public List<Long> deleteExamStudent(@PathVariable String ids) {
|
|
|
+ List<Long> idList = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ examStudentService.deleteExamStudentsByStudentIds(idList);
|
|
|
+ return idList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "按考试删除考试学生", notes = "按考试删除")
|
|
|
+ @Transactional
|
|
|
+ @DeleteMapping("exam/{examId}")
|
|
|
+ public Long deleteExamStudents(@PathVariable Long examId) {
|
|
|
+ examStudentService.deleteExamStudentsByExamId(examId);
|
|
|
+ return examId;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "下载导入模板", notes = "下载导入模板")
|
|
|
+ @GetMapping("/downloadTemplate")
|
|
|
+ public void downloadTemplate(HttpServletResponse response) {
|
|
|
+ String resoucePath = PathUtil.getResoucePath("templates/studentImportTemplate.xlsx");
|
|
|
+ exportFile("考生导入模板.xlsx", new File(resoucePath));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "启用考生")
|
|
|
+ @PutMapping("enable/{ids}")
|
|
|
+ public List<String> enableStudent(@PathVariable String ids) {
|
|
|
+ List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
+ for (Long cur : examStuIds) {
|
|
|
+ ExamStudentEntity s = examStudentRepo.findOne(cur);
|
|
|
+ s.setEnable(true);
|
|
|
+ examStudentRepo.save(s);
|
|
|
+ ret.add(s.getId() + ":" + s.getName());
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "禁用考生")
|
|
|
+ @PutMapping("disable/{ids}")
|
|
|
+ public List<String> disableStudent(@PathVariable String ids) {
|
|
|
+ List<Long> examStuIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
+ for (Long cur : examStuIds) {
|
|
|
+ ExamStudentEntity s = examStudentRepo.findOne(cur);
|
|
|
+ s.setEnable(false);
|
|
|
+ examStudentRepo.save(s);
|
|
|
+ ret.add(s.getId() + ":" + s.getName());
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|