|
@@ -1,21 +1,22 @@
|
|
package com.keao.edu.user.service.impl;
|
|
package com.keao.edu.user.service.impl;
|
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
+import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
|
|
+import com.keao.edu.auth.api.entity.SysUser;
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
-import com.keao.edu.common.page.PageInfo;
|
|
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
|
|
+import com.keao.edu.user.api.entity.Student;
|
|
import com.keao.edu.user.dao.ExamCertificationDao;
|
|
import com.keao.edu.user.dao.ExamCertificationDao;
|
|
|
|
+import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
|
|
import com.keao.edu.user.dto.ExamCertificationDto;
|
|
import com.keao.edu.user.dto.ExamCertificationDto;
|
|
|
|
+import com.keao.edu.user.dto.NeedCheckingDetailDto;
|
|
import com.keao.edu.user.entity.ExamCertification;
|
|
import com.keao.edu.user.entity.ExamCertification;
|
|
-import com.keao.edu.user.page.ExamCertificationQueryInfo;
|
|
|
|
import com.keao.edu.user.service.ExamCertificationService;
|
|
import com.keao.edu.user.service.ExamCertificationService;
|
|
-import com.keao.edu.util.collection.MapUtil;
|
|
|
|
|
|
+import com.keao.edu.user.service.ExamRoomStudentRelationService;
|
|
|
|
+import com.keao.edu.user.service.StudentService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -25,6 +26,12 @@ public class ExamCertificationServiceImpl extends BaseServiceImpl<Long, ExamCert
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ExamCertificationDao examCertificationDao;
|
|
private ExamCertificationDao examCertificationDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamRoomStudentRelationDao examRoomStudentRelationDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private StudentService studentService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Long, ExamCertification> getDAO() {
|
|
public BaseDAO<Long, ExamCertification> getDAO() {
|
|
@@ -37,36 +44,32 @@ public class ExamCertificationServiceImpl extends BaseServiceImpl<Long, ExamCert
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public PageInfo<ExamCertificationDto> queryCertificationPage(ExamCertificationQueryInfo queryInfo) {
|
|
|
|
- PageInfo<ExamCertificationDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- MapUtil.populateMap(params, queryInfo);
|
|
|
|
-
|
|
|
|
- List<ExamCertificationDto> dataList = null;
|
|
|
|
- int count = this.findCount(params);
|
|
|
|
- if (count > 0) {
|
|
|
|
- pageInfo.setTotal(count);
|
|
|
|
- params.put("offset", pageInfo.getOffset());
|
|
|
|
- dataList = JSON.parseArray(JSON.toJSONString(this.getDAO().queryPage(params)),ExamCertificationDto.class);
|
|
|
|
- List<Long> basicIds = dataList.stream().map(e -> e.getExaminationBasicId()).collect(Collectors.toList());
|
|
|
|
- List<Integer> studentIds = dataList.stream().map(e -> e.getStudentId()).collect(Collectors.toList());
|
|
|
|
- List<Integer> subjectIds = dataList.stream().map(e -> e.getSubjectId()).collect(Collectors.toList());
|
|
|
|
- Map<Integer, String> basicNameMap = this.getMap("examination_basic", "id_", "name_", basicIds, Integer.class, String.class);
|
|
|
|
- Map<Integer, String> subjectNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
|
|
|
|
- Map<String, Object> paramMap = new HashMap<>();
|
|
|
|
- paramMap.put("examination_basic_id_",basicIds);
|
|
|
|
- paramMap.put("student_id_",studentIds);
|
|
|
|
- Map<Integer, Integer> finishedExamMap = this.getMap("student_exam_result", "examination_basic_id_", "is_finished_exam_", paramMap, Integer.class, Integer.class);
|
|
|
|
- dataList.forEach(e->{
|
|
|
|
- e.setSubjectName(subjectNameMap.get(e.getSubjectId()));
|
|
|
|
- e.setExamBaseName(basicNameMap.get(e.getExaminationBasicId()));
|
|
|
|
- e.setFinishedExam(finishedExamMap.get(e.getExaminationBasicId()));
|
|
|
|
- });
|
|
|
|
|
|
+ public List<ExamCertificationDto> queryCertificationPage() {
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+ List<ExamCertificationDto> dataList = examCertificationDao.queryExamCertificationDtoPage(sysUser.getId());
|
|
|
|
+ if(dataList == null || dataList.size() < 0){
|
|
|
|
+ return dataList;
|
|
}
|
|
}
|
|
- if (count == 0) {
|
|
|
|
- dataList = new ArrayList<>();
|
|
|
|
- }
|
|
|
|
- pageInfo.setRows(dataList);
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ List<Integer> subjectIds = dataList.stream().map(e -> e.getSubjectId()).collect(Collectors.toList());
|
|
|
|
+ Map<Integer, String> subjectNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
|
|
|
|
+ Student student = studentService.get(sysUser.getId());
|
|
|
|
+ dataList.forEach(e->{
|
|
|
|
+ e.setSubjectName(subjectNameMap.get(e.getSubjectId()));
|
|
|
|
+ e.setRealName(sysUser.getRealName());
|
|
|
|
+ e.setGender(sysUser.getGender());
|
|
|
|
+ e.setCertificatePhoto(student.getCertificatePhoto());
|
|
|
|
+ });
|
|
|
|
+ return dataList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public NeedCheckingDetailDto needCheckingDetail(Long examRegistrationId) {
|
|
|
|
+ NeedCheckingDetailDto needCheckingDetailDto = examCertificationDao.needCheckingDetail(examRegistrationId);
|
|
|
|
+ //等待学员数
|
|
|
|
+ String signInTime = needCheckingDetailDto.getSignInTime();
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+ Integer waitNum = examRoomStudentRelationDao.sumWaitNum(examRegistrationId,signInTime,sysUser.getId());
|
|
|
|
+ needCheckingDetailDto.setWaitNum(waitNum);
|
|
|
|
+ return needCheckingDetailDto;
|
|
}
|
|
}
|
|
}
|
|
}
|