|
@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -36,12 +37,14 @@ import cn.com.qmth.mps.entity.PaperEntity;
|
|
|
import cn.com.qmth.mps.enums.Role;
|
|
|
import cn.com.qmth.mps.service.CourseService;
|
|
|
import cn.com.qmth.mps.service.ExamService;
|
|
|
+import cn.com.qmth.mps.service.PaperDetailService;
|
|
|
import cn.com.qmth.mps.service.PaperGroupService;
|
|
|
import cn.com.qmth.mps.service.PaperService;
|
|
|
import cn.com.qmth.mps.util.BatchSetDataUtil;
|
|
|
import cn.com.qmth.mps.util.PageUtil;
|
|
|
import cn.com.qmth.mps.vo.exam.ExamPaperCountVo;
|
|
|
import cn.com.qmth.mps.vo.paper.GroupCountVo;
|
|
|
+import cn.com.qmth.mps.vo.paper.PaperInfoVo;
|
|
|
import cn.com.qmth.mps.vo.paper.PaperQuery;
|
|
|
import cn.com.qmth.mps.vo.paper.PaperVo;
|
|
|
|
|
@@ -55,6 +58,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
private CourseService courseService;
|
|
|
@Autowired
|
|
|
private PaperGroupService paperGroupService;
|
|
|
+ @Autowired
|
|
|
+ private PaperDetailService paperDetailService;
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
@@ -214,6 +219,25 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
return this.baseMapper.list(examId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PaperInfoVo info(Long id, User user) {
|
|
|
+ PaperEntity paper=this.getById(id);
|
|
|
+ if(paper==null) {
|
|
|
+ throw new StatusException("未找到试卷结构信息");
|
|
|
+ }
|
|
|
+ if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
|
+ throw new StatusException("没有权限");
|
|
|
+ }
|
|
|
+ PaperInfoVo vo=new PaperInfoVo();
|
|
|
+ BeanUtils.copyProperties(paper, vo);
|
|
|
+ CourseEntity course=courseService.getById(vo.getCourseId());
|
|
|
+ vo.setCourseCode(course.getCode());
|
|
|
+ vo.setCourseName(course.getName());
|
|
|
+ vo.setStructInfo(paperDetailService.getStructInfo(vo.getId()));
|
|
|
+ vo.setGroupInfo(paperGroupService.getGroupInfo(vo.getId()));
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|