| | |
| | | package com.gkhy.exam.institutionalaccess.service.serviceImpl; |
| | | |
| | | |
| | | import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; |
| | | import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; |
| | | import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; |
| | | import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail; |
| | | import com.gkhy.exam.institutionalaccess.entity.*; |
| | | import com.gkhy.exam.institutionalaccess.enums.FinishStatus; |
| | | import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; |
| | | import com.gkhy.exam.institutionalaccess.model.resp.ThBatchCourseRespDTO; |
| | | import com.gkhy.exam.institutionalaccess.model.resp.ThCourseChapterRespDTO; |
| | | import com.gkhy.exam.institutionalaccess.model.resp.ThStudentCourseRespDTO; |
| | | import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO; |
| | | import com.gkhy.exam.institutionalaccess.model.vo.*; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("ThBatchManagerService") |
| | |
| | | private ThStudyDetailService thStudyDetailService; |
| | | @Autowired |
| | | private ThBatchCourseChapterService thBatchCourseChapterService; |
| | | @Autowired |
| | | private ThSubjectTypeService subjectTypeService; |
| | | |
| | | @Override |
| | | public List<ThBatchVO> listByPage(ThBatchQuery query) { |
| | |
| | | List<ThBatchCourseChapter> chapterList = thBatchCourseChapterService.getListByBatchUuids(batchUuids); |
| | | |
| | | for (ThBatchVO thBatchVO : thBatchVOS) { |
| | | thBatchVO.setSubjectName(getObtainSuperiors(thBatchVO.getSubjectCode())); |
| | | //课程 |
| | | List<ThBatchCourseVO> collect = batchCourseList.stream() |
| | | .filter(bc -> bc.getBatchUuid().equals(thBatchVO.getUuid())) |
| | |
| | | } |
| | | return respDTOS; |
| | | } |
| | | |
| | | public String getObtainSuperiors(String code){ |
| | | List<ThSubjectType> subjectTypeList = subjectTypeService.getSubjectTypeList(); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return "未知"; |
| | | } |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | String subjectName = "未知"; |
| | | ThSubjectType currentSubject = getThSubejctInfoByCode(subjectTypeList,code); |
| | | if(currentSubject != null){ |
| | | subjectName = currentSubject.getName(); |
| | | } |
| | | //一级 |
| | | if(code.length() == 1){ |
| | | stringBuffer.append(subjectName); |
| | | } |
| | | //二级 |
| | | if(code.length() == 3){ |
| | | ThSubjectType parentSubject = getThSubejctInfoByCode(subjectTypeList,currentSubject.getParentCode()); |
| | | stringBuffer.append(parentSubject.getName()).append("/").append(subjectName); |
| | | } |
| | | //三级 |
| | | if(code.length() == 5){ |
| | | ThSubjectType parentSubject = getThSubejctInfoByCode(subjectTypeList,currentSubject.getParentCode()); |
| | | ThSubjectType grandpaSubject = getThSubejctInfoByCode(subjectTypeList,parentSubject.getParentCode()); |
| | | stringBuffer.append(grandpaSubject.getName()).append("/").append(parentSubject.getName()).append("/").append(subjectName); |
| | | } |
| | | return stringBuffer.toString(); |
| | | } |
| | | public ThSubjectType getThSubejctInfoByCode(List<ThSubjectType> list, String code){ |
| | | List<ThSubjectType> selectList = list.stream().filter(subjectType -> subjectType.getCode().equals(code)).collect(Collectors.toList()); |
| | | if(selectList.size() > 0){ |
| | | return selectList.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | } |