|
@@ -10,12 +10,17 @@ import com.keao.edu.user.dao.ExamSongDao;
|
|
import com.keao.edu.user.dao.ExamSubjectDao;
|
|
import com.keao.edu.user.dao.ExamSubjectDao;
|
|
import com.keao.edu.user.dao.ExamSubjectSongDao;
|
|
import com.keao.edu.user.dao.ExamSubjectSongDao;
|
|
import com.keao.edu.user.dao.ExaminationBasicDao;
|
|
import com.keao.edu.user.dao.ExaminationBasicDao;
|
|
|
|
+import com.keao.edu.user.dto.ExamSubjectSongDto;
|
|
import com.keao.edu.user.entity.ExamSong;
|
|
import com.keao.edu.user.entity.ExamSong;
|
|
import com.keao.edu.user.entity.ExamSubject;
|
|
import com.keao.edu.user.entity.ExamSubject;
|
|
import com.keao.edu.user.entity.ExamSubjectSong;
|
|
import com.keao.edu.user.entity.ExamSubjectSong;
|
|
import com.keao.edu.user.entity.ExaminationBasic;
|
|
import com.keao.edu.user.entity.ExaminationBasic;
|
|
import com.keao.edu.user.enums.ExamStatusEnum;
|
|
import com.keao.edu.user.enums.ExamStatusEnum;
|
|
|
|
+import com.keao.edu.user.page.ExamSubjectSongQueryInfo;
|
|
import com.keao.edu.user.service.ExamSubjectSongService;
|
|
import com.keao.edu.user.service.ExamSubjectSongService;
|
|
|
|
+import com.keao.edu.util.collection.MapUtil;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
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 org.springframework.transaction.annotation.Isolation;
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
@@ -103,7 +108,68 @@ public class ExamSubjectSongServiceImpl extends BaseServiceImpl<Long, ExamSubjec
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public PageInfo<ExamSubjectSongDto> queryExamSubjectSongs(ExamSubjectSongQueryInfo queryInfo) {
|
|
|
|
+ PageInfo<ExamSubjectSongDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
|
+
|
|
|
|
+ List<ExamSubjectSongDto> dataList = new ArrayList<>();
|
|
|
|
+ int count = examSubjectSongDao.countExamSubjectSongs(params);
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ pageInfo.setTotal(count);
|
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
|
+ dataList = examSubjectSongDao.queryExamSubjectSongs(params);
|
|
|
|
+ List<Integer> examSongIds=new ArrayList<>();
|
|
|
|
+ if(!CollectionUtils.isEmpty(dataList)){
|
|
|
|
+ for (ExamSubjectSongDto examSubjectSongDto : dataList) {
|
|
|
|
+ if(StringUtils.isNotBlank(examSubjectSongDto.getPracticeSongIdList())){
|
|
|
|
+ for (String s : examSubjectSongDto.getPracticeSongIdList().split(",")) {
|
|
|
|
+ if(!examSongIds.contains(Integer.valueOf(s))){
|
|
|
|
+ examSongIds.add(Integer.valueOf(s));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(examSubjectSongDto.getPerformSongIdList())){
|
|
|
|
+ for (String s : examSubjectSongDto.getPerformSongIdList().split(",")) {
|
|
|
|
+ if(!examSongIds.contains(Integer.valueOf(s))){
|
|
|
|
+ examSongIds.add(Integer.valueOf(s));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<ExamSong> examSongs = new ArrayList<>();
|
|
|
|
+ if(!CollectionUtils.isEmpty(examSongIds)){
|
|
|
|
+ examSongs = examSongDao.getWithIds(examSongIds);
|
|
|
|
+ }
|
|
|
|
+ Map<Integer, ExamSong> idExamSongMap = examSongs.stream().collect(Collectors.toMap(ExamSong::getId, e -> e));
|
|
|
|
+ for (ExamSubjectSongDto examSubjectSongDto : dataList) {
|
|
|
|
+ if(StringUtils.isNotBlank(examSubjectSongDto.getPracticeSongIdList())){
|
|
|
|
+ List<String> songNames=new ArrayList<>();
|
|
|
|
+ for (String s : examSubjectSongDto.getPracticeSongIdList().split(",")) {
|
|
|
|
+ if(idExamSongMap.containsKey(Integer.valueOf(s))){
|
|
|
|
+ songNames.add(idExamSongMap.get(Integer.valueOf(s)).getSongName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examSubjectSongDto.setPracticeSongNames(StringUtils.join(songNames, ","));
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(examSubjectSongDto.getPerformSongIdList())){
|
|
|
|
+ List<String> songNames=new ArrayList<>();
|
|
|
|
+ for (String s : examSubjectSongDto.getPerformSongIdList().split(",")) {
|
|
|
|
+ if(examSongIds.contains(Integer.valueOf(s))){
|
|
|
|
+ songNames.add(idExamSongMap.get(Integer.valueOf(s)).getSongName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examSubjectSongDto.setPerformSongNames(StringUtils.join(songNames, ","));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
|
+ return pageInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public List<ExamSong> getExamSubjectSong(Integer examinationBasicId,Long examSubjectId, Integer level) {
|
|
public List<ExamSong> getExamSubjectSong(Integer examinationBasicId,Long examSubjectId, Integer level) {
|
|
List<ExamSong> examSongs = new ArrayList<>();
|
|
List<ExamSong> examSongs = new ArrayList<>();
|
|
ExamSubjectSong examSubjectSong = examSubjectSongDao.getExamSubjectSong(examinationBasicId,examSubjectId, level);
|
|
ExamSubjectSong examSubjectSong = examSubjectSongDao.getExamSubjectSong(examinationBasicId,examSubjectId, level);
|