|
@@ -1,279 +1,279 @@
|
|
|
-package cn.com.qmth.markingaudit.service.impl;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.qmth.boot.core.exception.StatusException;
|
|
|
-
|
|
|
-import cn.com.qmth.markingaudit.bean.AkInfo;
|
|
|
-import cn.com.qmth.markingaudit.bean.ExamDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.ExamDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.InspectDataInfo;
|
|
|
-import cn.com.qmth.markingaudit.bean.InspectDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.InspectDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.LoginDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.LoginDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.MarkingScoreDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.MarkingScoreDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.MarkingScoreInfo;
|
|
|
-import cn.com.qmth.markingaudit.bean.MarkingScoreOperateInfo;
|
|
|
-import cn.com.qmth.markingaudit.bean.QuestionDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.QuestionDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.RejectDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.RejectDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.ScoreDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.ScoreDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.ScoreInfo;
|
|
|
-import cn.com.qmth.markingaudit.bean.StudentDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.StudentDataVo;
|
|
|
-import cn.com.qmth.markingaudit.bean.SubjectDataQuery;
|
|
|
-import cn.com.qmth.markingaudit.bean.SubjectDataVo;
|
|
|
-import cn.com.qmth.markingaudit.dao.MonitorDao;
|
|
|
-import cn.com.qmth.markingaudit.enums.SubjectiveStatus;
|
|
|
-import cn.com.qmth.markingaudit.service.MonitorService;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class MonitorServiceImpl implements MonitorService {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private MonitorDao monitorDao;
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<ExamDataVo> examData(ExamDataQuery req) {
|
|
|
- Integer schoolId = monitorDao.getSchoolId(req.getSchoolCode());
|
|
|
- if (schoolId == null) {
|
|
|
- throw new StatusException("未找到学校信息");
|
|
|
- }
|
|
|
- req.setSchoolId(schoolId);
|
|
|
- List<ExamDataVo> ret = monitorDao.examData(req);
|
|
|
- if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
- for (ExamDataVo vo : ret) {
|
|
|
- if (StringUtils.isNotBlank(vo.getSasConfig())) {
|
|
|
- JSONObject js = JSONObject.parseObject(vo.getSasConfig());
|
|
|
- if (js.containsKey("passScore")) {
|
|
|
- vo.setPassScore(js.getDouble("passScore"));
|
|
|
- }
|
|
|
- if (js.containsKey("excellentScore")) {
|
|
|
- vo.setExcellentScore(js.getDouble("excellentScore"));
|
|
|
- }
|
|
|
- vo.setSasConfig(null);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<StudentDataVo> studentData(StudentDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- return monitorDao.studentData(req);
|
|
|
- }
|
|
|
-
|
|
|
- private void checkExamIdValid(Integer examId, String schoolCode) {
|
|
|
- Integer id = monitorDao.getExamIdByIdAndSchoolCode(examId, schoolCode);
|
|
|
- if (id == null) {
|
|
|
- throw new StatusException("无效的考试id");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<SubjectDataVo> subjectData(SubjectDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- return monitorDao.subjectData(req);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<QuestionDataVo> questionData(QuestionDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- return monitorDao.questionData(req);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<MarkingScoreDataVo> markingScoreData(MarkingScoreDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- List<MarkingScoreDataVo> ret = monitorDao.markingScoreData(req);
|
|
|
- if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
- List<Integer> ids = ret.stream().filter(e -> SubjectiveStatus.MARKED.equals(e.getSubjectiveStatus()))
|
|
|
- .map(e -> e.getDataId()).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
- List<MarkingScoreInfo> infos = monitorDao.markingScoreInfo(ids);
|
|
|
- if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
- List<MarkingScoreOperateInfo> opinfos = monitorDao.markingScoreOperateInfo(ids);
|
|
|
- Map<String, List<MarkingScoreOperateInfo>> opmap = new HashMap<>();
|
|
|
- for (MarkingScoreOperateInfo info : opinfos) {
|
|
|
- String key = info.getStudentId() + "-" + info.getGroupNumber();
|
|
|
- List<MarkingScoreOperateInfo> tem = opmap.get(key);
|
|
|
- if (tem == null) {
|
|
|
- tem = new ArrayList<>();
|
|
|
- opmap.put(key, tem);
|
|
|
- }
|
|
|
- tem.add(info);
|
|
|
- }
|
|
|
- Map<Integer, List<MarkingScoreInfo>> map = new HashMap<>();
|
|
|
- for (MarkingScoreInfo info : infos) {
|
|
|
- String key = info.getStudentId() + "-" + info.getGroupNumber();
|
|
|
- fillOperateInfo(info, opmap.get(key));
|
|
|
- List<MarkingScoreInfo> tem = map.get(info.getStudentId());
|
|
|
- if (tem == null) {
|
|
|
- tem = new ArrayList<>();
|
|
|
- map.put(info.getStudentId(), tem);
|
|
|
- }
|
|
|
- tem.add(info);
|
|
|
- }
|
|
|
- for (MarkingScoreDataVo vo : ret) {
|
|
|
- vo.setExamInfo(map.get(vo.getDataId()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- private void fillOperateInfo(MarkingScoreInfo info, List<MarkingScoreOperateInfo> list) {
|
|
|
- List<String> markerAcount = new ArrayList<>();
|
|
|
- List<String> headAcount = new ArrayList<>();
|
|
|
- List<String> markerTime = new ArrayList<>();
|
|
|
- List<String> headerTime = new ArrayList<>();
|
|
|
- for (MarkingScoreOperateInfo op : list) {
|
|
|
- if (StringUtils.isNotBlank(op.getMarkerAccount())) {
|
|
|
- markerAcount.add(op.getMarkerAccount());
|
|
|
- markerTime.add(op.getMarkerTime());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(op.getHeaderAccount())) {
|
|
|
- headAcount.add(op.getHeaderAccount());
|
|
|
- headerTime.add(op.getHeaderTime());
|
|
|
- }
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(headAcount)) {
|
|
|
- info.setCreateTime(StringUtils.join(headerTime, ","));
|
|
|
- info.setId(StringUtils.join(headAcount, ","));
|
|
|
- } else {
|
|
|
- info.setCreateTime(StringUtils.join(markerTime, ","));
|
|
|
- info.setId(StringUtils.join(markerAcount, ","));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<InspectDataVo> inspectData(InspectDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- List<InspectDataVo> ret = monitorDao.inspectData(req);
|
|
|
- if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
- List<Integer> ids = ret.stream().map(e -> e.getDataId()).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
- List<InspectDataInfo> infos = monitorDao.inspectDataInfo(ids);
|
|
|
- if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
- Map<Integer, List<InspectDataInfo>> map = new HashMap<>();
|
|
|
- for (InspectDataInfo info : infos) {
|
|
|
- List<InspectDataInfo> tem = map.get(info.getStudentId());
|
|
|
- if (tem == null) {
|
|
|
- tem = new ArrayList<>();
|
|
|
- map.put(info.getStudentId(), tem);
|
|
|
- }
|
|
|
- tem.add(info);
|
|
|
- }
|
|
|
- for (InspectDataVo vo : ret) {
|
|
|
- vo.setExamInfo(map.get(vo.getDataId()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<RejectDataVo> rejectData(RejectDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- return monitorDao.rejectData(req);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<ScoreDataVo> scoreData(ScoreDataQuery req) {
|
|
|
- checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
- List<ScoreDataVo> ret = monitorDao.scoreData(req);
|
|
|
- if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
- QuestionDataQuery qreq = new QuestionDataQuery();
|
|
|
- qreq.setExamId(req.getExamId());
|
|
|
- qreq.setSubjectCode(req.getSubjectCode());
|
|
|
- List<QuestionDataVo> qs = monitorDao.questionData(qreq);
|
|
|
- for (ScoreDataVo vo : ret) {
|
|
|
- if (SubjectiveStatus.MARKED.equals(vo.getSubjectiveStatus())) {
|
|
|
- List<ScoreInfo> scores = new ArrayList<>();
|
|
|
- vo.setExamInfo(scores);
|
|
|
- int objectiveIndex = 0;
|
|
|
- int subjectiveIndex = 0;
|
|
|
- String[] objectiveStr = null;
|
|
|
- String[] subjectiveStr = null;
|
|
|
- if (StringUtils.isNotBlank(vo.getObjectiveScoreList())) {
|
|
|
- objectiveStr = vo.getObjectiveScoreList().split(";");
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(vo.getSubjectiveScoreList())) {
|
|
|
- subjectiveStr = vo.getSubjectiveScoreList().split(";");
|
|
|
- }
|
|
|
- for (QuestionDataVo q : qs) {
|
|
|
- ScoreInfo score = new ScoreInfo();
|
|
|
- scores.add(score);
|
|
|
- if (q.getIsObjective()) {
|
|
|
- score.setMajorName(q.getMajorName());
|
|
|
- score.setMajorNo(q.getMajorNo());
|
|
|
- score.setMinorNo(q.getMinorNo());
|
|
|
- score.setScore(getObjectiveScore(objectiveStr, objectiveIndex));
|
|
|
- objectiveIndex++;
|
|
|
- } else {
|
|
|
- score.setMajorName(q.getMajorName());
|
|
|
- score.setMajorNo(q.getMajorNo());
|
|
|
- score.setMinorNo(q.getMinorNo());
|
|
|
- score.setScore(getSubjectiveScore(subjectiveStr, subjectiveIndex));
|
|
|
- subjectiveIndex++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- vo.setSubjectiveScoreList(null);
|
|
|
- vo.setObjectiveScoreList(null);
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- private Double getObjectiveScore(String[] scores, int index) {
|
|
|
- if (scores == null) {
|
|
|
- return 0.0;
|
|
|
- }
|
|
|
- if (index >= scores.length) {
|
|
|
- return 0.0;
|
|
|
- }
|
|
|
- String[] tem = scores[index].split(":");
|
|
|
- return Double.valueOf(tem[1]);
|
|
|
- }
|
|
|
-
|
|
|
- private Double getSubjectiveScore(String[] scores, int index) {
|
|
|
- if (scores == null) {
|
|
|
- return 0.0;
|
|
|
- }
|
|
|
- return Double.valueOf(scores[index]);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<LoginDataVo> loginData(LoginDataQuery req) {
|
|
|
- Integer schoolId = monitorDao.getSchoolId(req.getSchoolCode());
|
|
|
- if (schoolId == null) {
|
|
|
- throw new StatusException("未找到学校信息");
|
|
|
- }
|
|
|
- req.setSchoolId(schoolId);
|
|
|
- return monitorDao.loginData(req);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public AkInfo getAk(String schoolCode) {
|
|
|
- return monitorDao.getAk(schoolCode);
|
|
|
- }
|
|
|
-
|
|
|
+package cn.com.qmth.markingaudit.service.impl;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.qmth.boot.core.exception.StatusException;
|
|
|
+import com.qmth.boot.core.solar.model.OrgInfo;
|
|
|
+
|
|
|
+import cn.com.qmth.markingaudit.bean.ExamDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.ExamDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.InspectDataInfo;
|
|
|
+import cn.com.qmth.markingaudit.bean.InspectDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.InspectDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.LoginDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.LoginDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.MarkingScoreDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.MarkingScoreDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.MarkingScoreInfo;
|
|
|
+import cn.com.qmth.markingaudit.bean.MarkingScoreOperateInfo;
|
|
|
+import cn.com.qmth.markingaudit.bean.QuestionDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.QuestionDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.RejectDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.RejectDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.ScoreDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.ScoreDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.ScoreInfo;
|
|
|
+import cn.com.qmth.markingaudit.bean.StudentDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.StudentDataVo;
|
|
|
+import cn.com.qmth.markingaudit.bean.SubjectDataQuery;
|
|
|
+import cn.com.qmth.markingaudit.bean.SubjectDataVo;
|
|
|
+import cn.com.qmth.markingaudit.dao.MonitorDao;
|
|
|
+import cn.com.qmth.markingaudit.enums.SubjectiveStatus;
|
|
|
+import cn.com.qmth.markingaudit.service.MonitorService;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class MonitorServiceImpl implements MonitorService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MonitorDao monitorDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ExamDataVo> examData(ExamDataQuery req) {
|
|
|
+ Integer schoolId = monitorDao.getSchoolId(req.getSchoolCode());
|
|
|
+ if (schoolId == null) {
|
|
|
+ throw new StatusException("未找到学校信息");
|
|
|
+ }
|
|
|
+ req.setSchoolId(schoolId);
|
|
|
+ List<ExamDataVo> ret = monitorDao.examData(req);
|
|
|
+ if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
+ for (ExamDataVo vo : ret) {
|
|
|
+ if (StringUtils.isNotBlank(vo.getSasConfig())) {
|
|
|
+ JSONObject js = JSONObject.parseObject(vo.getSasConfig());
|
|
|
+ if (js.containsKey("passScore")) {
|
|
|
+ vo.setPassScore(js.getDouble("passScore"));
|
|
|
+ }
|
|
|
+ if (js.containsKey("excellentScore")) {
|
|
|
+ vo.setExcellentScore(js.getDouble("excellentScore"));
|
|
|
+ }
|
|
|
+ vo.setSasConfig(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StudentDataVo> studentData(StudentDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ return monitorDao.studentData(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkExamIdValid(Integer examId, String schoolCode) {
|
|
|
+ Integer id = monitorDao.getExamIdByIdAndSchoolCode(examId, schoolCode);
|
|
|
+ if (id == null) {
|
|
|
+ throw new StatusException("无效的考试id");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<SubjectDataVo> subjectData(SubjectDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ return monitorDao.subjectData(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<QuestionDataVo> questionData(QuestionDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ return monitorDao.questionData(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MarkingScoreDataVo> markingScoreData(MarkingScoreDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ List<MarkingScoreDataVo> ret = monitorDao.markingScoreData(req);
|
|
|
+ if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
+ List<Integer> ids = ret.stream().filter(e -> SubjectiveStatus.MARKED.equals(e.getSubjectiveStatus()))
|
|
|
+ .map(e -> e.getDataId()).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
+ List<MarkingScoreInfo> infos = monitorDao.markingScoreInfo(ids);
|
|
|
+ if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
+ List<MarkingScoreOperateInfo> opinfos = monitorDao.markingScoreOperateInfo(ids);
|
|
|
+ Map<String, List<MarkingScoreOperateInfo>> opmap = new HashMap<>();
|
|
|
+ for (MarkingScoreOperateInfo info : opinfos) {
|
|
|
+ String key = info.getStudentId() + "-" + info.getGroupNumber();
|
|
|
+ List<MarkingScoreOperateInfo> tem = opmap.get(key);
|
|
|
+ if (tem == null) {
|
|
|
+ tem = new ArrayList<>();
|
|
|
+ opmap.put(key, tem);
|
|
|
+ }
|
|
|
+ tem.add(info);
|
|
|
+ }
|
|
|
+ Map<Integer, List<MarkingScoreInfo>> map = new HashMap<>();
|
|
|
+ for (MarkingScoreInfo info : infos) {
|
|
|
+ String key = info.getStudentId() + "-" + info.getGroupNumber();
|
|
|
+ fillOperateInfo(info, opmap.get(key));
|
|
|
+ List<MarkingScoreInfo> tem = map.get(info.getStudentId());
|
|
|
+ if (tem == null) {
|
|
|
+ tem = new ArrayList<>();
|
|
|
+ map.put(info.getStudentId(), tem);
|
|
|
+ }
|
|
|
+ tem.add(info);
|
|
|
+ }
|
|
|
+ for (MarkingScoreDataVo vo : ret) {
|
|
|
+ vo.setExamInfo(map.get(vo.getDataId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void fillOperateInfo(MarkingScoreInfo info, List<MarkingScoreOperateInfo> list) {
|
|
|
+ List<String> markerAcount = new ArrayList<>();
|
|
|
+ List<String> headAcount = new ArrayList<>();
|
|
|
+ List<String> markerTime = new ArrayList<>();
|
|
|
+ List<String> headerTime = new ArrayList<>();
|
|
|
+ for (MarkingScoreOperateInfo op : list) {
|
|
|
+ if (StringUtils.isNotBlank(op.getMarkerAccount())) {
|
|
|
+ markerAcount.add(op.getMarkerAccount());
|
|
|
+ markerTime.add(op.getMarkerTime());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(op.getHeaderAccount())) {
|
|
|
+ headAcount.add(op.getHeaderAccount());
|
|
|
+ headerTime.add(op.getHeaderTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(headAcount)) {
|
|
|
+ info.setCreateTime(StringUtils.join(headerTime, ","));
|
|
|
+ info.setId(StringUtils.join(headAcount, ","));
|
|
|
+ } else {
|
|
|
+ info.setCreateTime(StringUtils.join(markerTime, ","));
|
|
|
+ info.setId(StringUtils.join(markerAcount, ","));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<InspectDataVo> inspectData(InspectDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ List<InspectDataVo> ret = monitorDao.inspectData(req);
|
|
|
+ if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
+ List<Integer> ids = ret.stream().map(e -> e.getDataId()).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
+ List<InspectDataInfo> infos = monitorDao.inspectDataInfo(ids);
|
|
|
+ if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
+ Map<Integer, List<InspectDataInfo>> map = new HashMap<>();
|
|
|
+ for (InspectDataInfo info : infos) {
|
|
|
+ List<InspectDataInfo> tem = map.get(info.getStudentId());
|
|
|
+ if (tem == null) {
|
|
|
+ tem = new ArrayList<>();
|
|
|
+ map.put(info.getStudentId(), tem);
|
|
|
+ }
|
|
|
+ tem.add(info);
|
|
|
+ }
|
|
|
+ for (InspectDataVo vo : ret) {
|
|
|
+ vo.setExamInfo(map.get(vo.getDataId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<RejectDataVo> rejectData(RejectDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ return monitorDao.rejectData(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ScoreDataVo> scoreData(ScoreDataQuery req) {
|
|
|
+ checkExamIdValid(req.getExamId(), req.getSchoolCode());
|
|
|
+ List<ScoreDataVo> ret = monitorDao.scoreData(req);
|
|
|
+ if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
+ QuestionDataQuery qreq = new QuestionDataQuery();
|
|
|
+ qreq.setExamId(req.getExamId());
|
|
|
+ qreq.setSubjectCode(req.getSubjectCode());
|
|
|
+ List<QuestionDataVo> qs = monitorDao.questionData(qreq);
|
|
|
+ for (ScoreDataVo vo : ret) {
|
|
|
+ if (SubjectiveStatus.MARKED.equals(vo.getSubjectiveStatus())) {
|
|
|
+ List<ScoreInfo> scores = new ArrayList<>();
|
|
|
+ vo.setExamInfo(scores);
|
|
|
+ int objectiveIndex = 0;
|
|
|
+ int subjectiveIndex = 0;
|
|
|
+ String[] objectiveStr = null;
|
|
|
+ String[] subjectiveStr = null;
|
|
|
+ if (StringUtils.isNotBlank(vo.getObjectiveScoreList())) {
|
|
|
+ objectiveStr = vo.getObjectiveScoreList().split(";");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(vo.getSubjectiveScoreList())) {
|
|
|
+ subjectiveStr = vo.getSubjectiveScoreList().split(";");
|
|
|
+ }
|
|
|
+ for (QuestionDataVo q : qs) {
|
|
|
+ ScoreInfo score = new ScoreInfo();
|
|
|
+ scores.add(score);
|
|
|
+ if (q.getIsObjective()) {
|
|
|
+ score.setMajorName(q.getMajorName());
|
|
|
+ score.setMajorNo(q.getMajorNo());
|
|
|
+ score.setMinorNo(q.getMinorNo());
|
|
|
+ score.setScore(getObjectiveScore(objectiveStr, objectiveIndex));
|
|
|
+ objectiveIndex++;
|
|
|
+ } else {
|
|
|
+ score.setMajorName(q.getMajorName());
|
|
|
+ score.setMajorNo(q.getMajorNo());
|
|
|
+ score.setMinorNo(q.getMinorNo());
|
|
|
+ score.setScore(getSubjectiveScore(subjectiveStr, subjectiveIndex));
|
|
|
+ subjectiveIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setSubjectiveScoreList(null);
|
|
|
+ vo.setObjectiveScoreList(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getObjectiveScore(String[] scores, int index) {
|
|
|
+ if (scores == null) {
|
|
|
+ return 0.0;
|
|
|
+ }
|
|
|
+ if (index >= scores.length) {
|
|
|
+ return 0.0;
|
|
|
+ }
|
|
|
+ String[] tem = scores[index].split(":");
|
|
|
+ return Double.valueOf(tem[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getSubjectiveScore(String[] scores, int index) {
|
|
|
+ if (scores == null) {
|
|
|
+ return 0.0;
|
|
|
+ }
|
|
|
+ return Double.valueOf(scores[index]);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<LoginDataVo> loginData(LoginDataQuery req) {
|
|
|
+ Integer schoolId = monitorDao.getSchoolId(req.getSchoolCode());
|
|
|
+ if (schoolId == null) {
|
|
|
+ throw new StatusException("未找到学校信息");
|
|
|
+ }
|
|
|
+ req.setSchoolId(schoolId);
|
|
|
+ return monitorDao.loginData(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public OrgInfo getOrgInfo(String schoolCode) {
|
|
|
+ return monitorDao.getOrgInfo(schoolCode);
|
|
|
+ }
|
|
|
+
|
|
|
}
|