|
@@ -12,7 +12,9 @@ import com.keao.edu.user.entity.ExamCertification;
|
|
|
import com.keao.edu.user.entity.ExamRegistration;
|
|
|
import com.keao.edu.user.entity.ExaminationBasic;
|
|
|
import com.keao.edu.user.enums.ExamStatusEnum;
|
|
|
+import com.keao.edu.user.page.ExamRegistrationQueryInfo;
|
|
|
import com.keao.edu.user.service.ExamRegistrationService;
|
|
|
+import com.keao.edu.user.service.OrganizationService;
|
|
|
import com.keao.edu.util.collection.MapUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,38 +36,14 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
|
|
|
private ExaminationBasicDao examinationBasicDao;
|
|
|
@Autowired
|
|
|
private SysUserDao sysUserDao;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, ExamRegistration> getDAO() {
|
|
|
return examRegistrationDao;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public PageInfo<ExamRegistration> queryPage(QueryInfo queryInfo) {
|
|
|
- PageInfo<ExamRegistration> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- MapUtil.populateMap(params, queryInfo);
|
|
|
-
|
|
|
- List<ExamRegistration> dataList = Collections.EMPTY_LIST;
|
|
|
- int count = this.findCount(params);
|
|
|
- if (count > 0) {
|
|
|
- pageInfo.setTotal(count);
|
|
|
- params.put("offset", pageInfo.getOffset());
|
|
|
- dataList = this.getDAO().queryPage(params);
|
|
|
- List<Integer> organIds = dataList.stream().map(ExamRegistration::getOrganId).collect(Collectors.toList());
|
|
|
- Map<Integer, String> organIdNameMap = this.getMap("organization", "id_", "name_", organIds, Integer.class, String.class);
|
|
|
- List<Integer> subjectIds = dataList.stream().map(ExamRegistration::getSubjectId).collect(Collectors.toList());
|
|
|
- Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
|
|
|
- for (ExamRegistration examRegistration : dataList) {
|
|
|
- examRegistration.getOrganization().setName(organIdNameMap.get(examRegistration.getOrganId()));
|
|
|
- examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getStudentId()));
|
|
|
- }
|
|
|
- }
|
|
|
- pageInfo.setRows(dataList);
|
|
|
-
|
|
|
- return pageInfo;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public ExamRegistration addRegistration(ExamRegistration examRegistration) {
|
|
@@ -96,4 +74,33 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
|
|
|
examCertificationDao.insert(examCertification);
|
|
|
return examRegistration;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo<ExamRegistration> queryExamRegistrationStudents(ExamRegistrationQueryInfo queryInfo) {
|
|
|
+ PageInfo<ExamRegistration> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+
|
|
|
+ List<Integer> nextLevelOrganIds = organizationService.getNextLevelOrganIds(queryInfo.getOrganId(), true);
|
|
|
+ params.put("organIds", nextLevelOrganIds);
|
|
|
+
|
|
|
+ List<ExamRegistration> dataList = Collections.EMPTY_LIST;
|
|
|
+ int count = this.findCount(params);
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = this.getDAO().queryPage(params);
|
|
|
+ List<Integer> organIds = dataList.stream().map(ExamRegistration::getOrganId).collect(Collectors.toList());
|
|
|
+ Map<Integer, String> organIdNameMap = this.getMap("organization", "id_", "name_", organIds, Integer.class, String.class);
|
|
|
+ List<Integer> subjectIds = dataList.stream().map(ExamRegistration::getSubjectId).collect(Collectors.toList());
|
|
|
+ Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
|
|
|
+ for (ExamRegistration examRegistration : dataList) {
|
|
|
+ examRegistration.getOrganization().setName(organIdNameMap.get(examRegistration.getOrganId()));
|
|
|
+ examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getStudentId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
}
|