|
|
@@ -32,6 +32,7 @@ import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
|
|
import vip.xiaonuo.common.exception.CommonException;
|
|
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
|
|
import vip.xiaonuo.dev.api.DevJobApi;
|
|
|
+import vip.xiaonuo.disk.api.NetDiskApi;
|
|
|
import vip.xiaonuo.exam.domain.CourseChapterPaper;
|
|
|
import vip.xiaonuo.exam.domain.ExamPaper;
|
|
|
import vip.xiaonuo.exam.domain.TExam;
|
|
|
@@ -45,9 +46,8 @@ import vip.xiaonuo.exam.mapper.TExamMapper;
|
|
|
import vip.xiaonuo.exam.service.ExamPaperService;
|
|
|
import vip.xiaonuo.exam.service.TExamService;
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
import vip.xiaonuo.exam.utility.DateTimeUtil;
|
|
|
|
|
|
/**
|
|
|
@@ -69,6 +69,9 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
@Resource
|
|
|
private DevJobApi devJobApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private NetDiskApi netDiskApi;
|
|
|
+
|
|
|
@Override
|
|
|
public Page<TExam> page(TExamPageParam tExamPageParam) {
|
|
|
QueryWrapper<TExam> queryWrapper = new QueryWrapper<>();
|
|
|
@@ -109,7 +112,42 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
tExamAddParam.setEndTime(examPaper.getLimitEndTime());
|
|
|
}
|
|
|
TExam tExam = BeanUtil.toBean(tExamAddParam, TExam.class);
|
|
|
- tExam.setStudentIds("1935565895337304066");
|
|
|
+
|
|
|
+ boolean query = false;
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if(tExamAddParam.getChapterId() != null && !tExamAddParam.getChapterId().isEmpty()){
|
|
|
+ map.put("chapterId",tExamAddParam.getChapterId());
|
|
|
+ query = true;
|
|
|
+ }
|
|
|
+ if(tExamAddParam.getGradesId() != null && !tExamAddParam.getGradesId().isEmpty()){
|
|
|
+ map.put("gradesId",tExamAddParam.getGradesId());
|
|
|
+ query = true;
|
|
|
+ }
|
|
|
+ if(tExamAddParam.getCourseId() != null && !tExamAddParam.getCourseId().isEmpty()){
|
|
|
+ map.put("courseId",tExamAddParam.getCourseId());
|
|
|
+ query = true;
|
|
|
+ }
|
|
|
+ if(tExamAddParam.getHourId() != null && !tExamAddParam.getHourId().isEmpty()){
|
|
|
+ map.put("hourId",tExamAddParam.getHourId());
|
|
|
+ query = true;
|
|
|
+ }
|
|
|
+ if(query){
|
|
|
+ JSONObject students = netDiskApi.downList(map);
|
|
|
+ if(students != null && students.getIntValue("code") == 200){
|
|
|
+ List<String> studentIds = new ArrayList<String>();
|
|
|
+ if(!students.getJSONArray("data").isEmpty()){
|
|
|
+ students.getJSONArray("data").forEach(item -> {
|
|
|
+ JSONObject student = (JSONObject) item;
|
|
|
+ studentIds.add(student.getString("ACCOUNT"));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ String studentIdsStr = String.join(",", studentIds);
|
|
|
+ tExam.setStudentIds(studentIdsStr);
|
|
|
+ }else{
|
|
|
+ throw new CommonException("没有找到学生信息!!!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(tExam.getExamType() == null){
|
|
|
if(examPaper.getPaperType() == ExamPaperTypeEnum.Survey.getCode()){
|
|
|
tExam.setExamType("3"); // 调查问卷
|
|
|
@@ -161,6 +199,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
cp.setChapterId(tExamEditParam.getChapterId());
|
|
|
cp.setPaperId(tExamEditParam.getPaperId());
|
|
|
courseChapterPaperMapper.add(cp);
|
|
|
+ tExam.setExamType("2"); // 2 章节测验
|
|
|
}
|
|
|
|
|
|
if(tExamEditParam.getPaperId() != null && !tExamEditParam.getPaperId().isEmpty()){
|
|
|
@@ -170,6 +209,9 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
tExamEditParam.setEndTime(examPaper.getLimitEndTime());
|
|
|
updateJob = true;
|
|
|
}
|
|
|
+ if(ExamPaperTypeEnum.Survey.getCode() == examPaper.getPaperType()){
|
|
|
+ tExam.setExamType("3"); // 3 调查问卷
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if(updateJob){
|