|
@@ -3,22 +3,35 @@ package com.keao.edu.user.service.impl;
|
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
import com.keao.edu.common.exception.BizException;
|
|
|
+import com.keao.edu.common.page.PageInfo;
|
|
|
+import com.keao.edu.common.page.QueryInfo;
|
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
|
import com.keao.edu.im.api.client.ImFeignService;
|
|
|
import com.keao.edu.im.api.entity.ImResult;
|
|
|
import com.keao.edu.im.api.entity.ImUserModel;
|
|
|
import com.keao.edu.user.dao.StudentDao;
|
|
|
+import com.keao.edu.user.dao.StudentExamResultDao;
|
|
|
import com.keao.edu.user.dao.SysUserDao;
|
|
|
import com.keao.edu.user.api.entity.Student;
|
|
|
+import com.keao.edu.user.dto.StudentExamPaymentDto;
|
|
|
import com.keao.edu.user.entity.Organization;
|
|
|
import com.keao.edu.user.enums.YesOrNoEnum;
|
|
|
+import com.keao.edu.user.page.StudentApplyQueryInfo;
|
|
|
import com.keao.edu.user.service.OrganizationService;
|
|
|
import com.keao.edu.user.service.StudentService;
|
|
|
+import com.keao.edu.util.collection.MapUtil;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
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.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @Author Joburgess
|
|
|
* @Date 2020.06.18
|
|
@@ -31,6 +44,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Autowired
|
|
|
private SysUserDao sysUserDao;
|
|
|
@Autowired
|
|
|
+ private StudentExamResultDao studentExamResultDao;
|
|
|
+ @Autowired
|
|
|
private OrganizationService organizationService;
|
|
|
@Autowired
|
|
|
private ImFeignService imFeignService;
|
|
@@ -88,4 +103,39 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
sysUserDao.update(sysUser);
|
|
|
studentDao.update(student);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo<Student> queryStudentPage(QueryInfo queryInfo) {
|
|
|
+ PageInfo<Student> studentPageInfo = queryPage(queryInfo);
|
|
|
+ List<Student> rows = studentPageInfo.getRows();
|
|
|
+ if(rows != null && rows.size() > 0){
|
|
|
+ List<Integer> studentIds = rows.stream().map(e -> e.getUserId()).collect(Collectors.toList());
|
|
|
+ //获取考试次数
|
|
|
+ Map<Integer,Integer> examNumMap = MapUtil.convertIntegerMap(studentExamResultDao.countExamNum(studentIds, queryInfo.getTenantId()));
|
|
|
+ rows.forEach(e->{
|
|
|
+ e.setExamNum(examNumMap.get(e.getUserId()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return studentPageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo<StudentExamPaymentDto> queryApplyList(StudentApplyQueryInfo queryInfo) {
|
|
|
+ PageInfo<StudentExamPaymentDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+
|
|
|
+ List<StudentExamPaymentDto> dataList = null;
|
|
|
+ int count = studentDao.countApplyList(params);
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = studentDao.queryApplyList(params);
|
|
|
+ }
|
|
|
+ if (count == 0) {
|
|
|
+ dataList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
}
|