|
@@ -10,6 +10,7 @@ import com.gyee.boot.base.api.api.dto.PagingReqDTO;
|
|
|
import com.gyee.boot.base.api.exception.ServiceException;
|
|
|
import com.gyee.boot.base.api.utils.BeanMapper;
|
|
|
import com.gyee.exam.modules.course.dto.request.CheckUserCourseStatDTO;
|
|
|
+import com.gyee.exam.modules.ectotal.dto.response.ExamAndCourseDepartTotalDTO;
|
|
|
import com.gyee.exam.modules.exam.dto.response.*;
|
|
|
import com.gyee.exam.modules.stat.course.dto.response.StatCourseLearnDTO;
|
|
|
import com.gyee.exam.modules.stat.course.service.StatCourseService;
|
|
@@ -35,7 +36,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -252,9 +256,39 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
|
|
@Override
|
|
|
public List<ExamDepartTotalDTO> examDepartTotal(BaseQueryReqDTO reqDTO) {
|
|
|
|
|
|
- List<ExamDepartTotalDTO> dtos = baseMapper.examDepartTotal(reqDTO);
|
|
|
-
|
|
|
- return dtos;
|
|
|
+ List<ExamDepartTotalDTO> examList = baseMapper.examDepartTotal(reqDTO);
|
|
|
+ List<ExamDepartTotalDTO> userList = baseMapper.selectUserTotal(reqDTO);
|
|
|
+ List<String> exams = examList.stream().map(ExamDepartTotalDTO::getDeptCode).collect(Collectors.toList());
|
|
|
+ List<String> users = userList.stream().map(ExamDepartTotalDTO::getDeptCode).collect(Collectors.toList());
|
|
|
+// exams.addAll(users);
|
|
|
+// List<String> listAll = exams.stream().distinct().collect(Collectors.toList());
|
|
|
+//
|
|
|
+// List<ExamDepartTotalDTO> allDtos = new ArrayList<>();
|
|
|
+ ExamDepartTotalDTO totalDTO = null;
|
|
|
+ Map<String, List<ExamDepartTotalDTO>> groupexam = examList.stream().collect(Collectors.groupingBy(ExamDepartTotalDTO::getDeptCode));
|
|
|
+ Map<String, List<ExamDepartTotalDTO>> groupuser = examList.stream().collect(Collectors.groupingBy(ExamDepartTotalDTO::getDeptCode));
|
|
|
+// for(int i = 0; i < listAll.size(); i++){
|
|
|
+//
|
|
|
+// totalDTO = new ExamDepartTotalDTO();
|
|
|
+// List<ExamDepartTotalDTO> dept = groupexam.get(i) == null ? null :groupexam.get(i);
|
|
|
+// if (null != dept && dept.size() == 1){
|
|
|
+// totalDTO.setDeptCode(groupexam.get(i).get(0).getDeptCode());
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+ examList.addAll(userList);
|
|
|
+ List<String> intersection = exams.stream().filter(users::contains).collect(Collectors.toList());
|
|
|
+ for (int i = 0; i < intersection.size(); i++){
|
|
|
+ totalDTO = new ExamDepartTotalDTO();
|
|
|
+ totalDTO.setDeptCode(groupexam.get(i).get(0).getDeptCode());
|
|
|
+ totalDTO.setDeptName(groupexam.get(i).get(0).getDeptName());
|
|
|
+ totalDTO.setEeActualUser(groupexam.get(i).get(0).getEeActualUser()+groupuser.get(i).get(0).getEeActualUser());
|
|
|
+ totalDTO.setEePassUser(groupexam.get(i).get(0).getEePassUser()+groupuser.get(i).get(0).getEePassUser());
|
|
|
+ totalDTO.setEeTotalUser(groupexam.get(i).get(0).getEeTotalUser()+groupuser.get(i).get(0).getEeTotalUser());
|
|
|
+ examList.add(totalDTO);
|
|
|
+ }
|
|
|
+ return examList;
|
|
|
}
|
|
|
|
|
|
@Override
|