|
@@ -1,12 +1,15 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
+import com.ym.mec.biz.dal.mapper.StudentPlusMapper;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
+import com.ym.mec.biz.dal.wrapper.StudentWrapper;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -33,6 +36,7 @@ import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.function.BiFunction;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.enums.IndexDataType.CLOUD_NEW_STUDENT_NUM;
|
|
@@ -81,6 +85,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Autowired
|
|
|
private StudentOperatingVisitDao studentOperatingVisitDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentPlusMapper studentPlusMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Student> getDAO() {
|
|
|
return studentDao;
|
|
@@ -1292,6 +1299,51 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public IPage<StudentWrapper.StudentList> userPage(IPage<StudentWrapper.StudentList> page, StudentWrapper.StudentQuery queryInfo) {
|
|
|
+
|
|
|
+ List<StudentWrapper.StudentList> studentLists = studentPlusMapper.userPage(page, queryInfo);
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(studentLists)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+ // 设置学生姓名/头像
|
|
|
+ List<Integer> studentIds = studentLists.stream().map(StudentWrapper.StudentList::getStudentId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Integer, Student> studentMap = getMapByIds(studentIds);
|
|
|
+
|
|
|
+ studentLists.forEach(studentList -> {
|
|
|
+ Student student = studentMap.get(studentList.getStudentId());
|
|
|
+ if (student != null) {
|
|
|
+ studentList.setStudentName(student.getUsername());
|
|
|
+ studentList.setStudentAvatar(student.getAvatar());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 时间为本学期
|
|
|
+// DateUtil
|
|
|
+ // 查询考勤
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 查询作业
|
|
|
+
|
|
|
+
|
|
|
+ return page.setRecords(studentLists);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<Integer,Student> getMapByIds(List<Integer> studentIds) {
|
|
|
+ if (CollectionUtils.isEmpty(studentIds)) {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+ List<Student> students = studentPlusMapper.findStudentByIds(studentIds);
|
|
|
+ if (CollectionUtils.isEmpty(students)) {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+ Map<Integer, Student> studentMap = students.stream().collect(Collectors.toMap(Student::getUserId, Function.identity()));
|
|
|
+ return studentMap;
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public <T extends BaseStudentDto> void insertStudent(T baseStudent){
|
|
|
Student student = new Student();
|