|
|
@@ -1,13 +1,16 @@
|
|
|
package com.xjrsoft.module.textbook.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
import com.xjrsoft.common.enums.ClaimTypeEnum;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
@@ -21,12 +24,17 @@ import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
import com.xjrsoft.module.base.service.IBaseSemesterService;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
|
|
|
import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
import com.xjrsoft.module.teacher.entity.AttendanceRecord;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import com.xjrsoft.module.teacher.mapper.XjrUserMapper;
|
|
|
import com.xjrsoft.module.textbook.dto.*;
|
|
|
-import com.xjrsoft.module.textbook.entity.*;
|
|
|
+import com.xjrsoft.module.textbook.entity.Textbook;
|
|
|
+import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
|
|
|
+import com.xjrsoft.module.textbook.entity.WfTextbookClaim;
|
|
|
+import com.xjrsoft.module.textbook.entity.WfTextbookClaimItem;
|
|
|
+import com.xjrsoft.module.textbook.mapper.TextbookMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.TextbookStudentClaimMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.WfTextbookClaimItemMapper;
|
|
|
import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
|
|
|
@@ -68,6 +76,10 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
|
|
|
private final WfTextbookClaimItemMapper wfTextbookClaimItemMapper;
|
|
|
|
|
|
+ private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
|
|
|
+
|
|
|
+ private final TextbookMapper textbookMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public HeadTeaLookClassBookVo headTeaLookClassBook(HeadTeaLookClassBookDto dto) {
|
|
|
HeadTeaLookClassBookVo result = new HeadTeaLookClassBookVo();
|
|
|
@@ -177,7 +189,16 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
public TextbookClaimStudentConfirmVo getStudentConfirmList(TextbookClaimStudentConfirmDto dto) {
|
|
|
//获取当前登录学生的信息
|
|
|
MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
- queryUser.selectAs(XjrUser::getName, TextbookClaimStudentConfirmVo::getStudentName).selectAs(BaseStudent::getStudentId, TextbookClaimStudentConfirmVo::getStudentId).selectAs(BaseClass::getName, TextbookClaimStudentConfirmVo::getClassCN).leftJoin(BaseStudent.class, BaseStudent::getUserId, XjrUser::getId).leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId).leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId).eq(XjrUser::getId, StpUtil.getLoginIdAsLong()).disableSubLogicDel().orderByDesc(AttendanceRecord::getId);
|
|
|
+ queryUser
|
|
|
+ .selectAs(XjrUser::getName, TextbookClaimStudentConfirmVo::getStudentName)
|
|
|
+ .selectAs(BaseStudent::getStudentId, TextbookClaimStudentConfirmVo::getStudentId)
|
|
|
+ .selectAs(BaseClass::getName, TextbookClaimStudentConfirmVo::getClassCN)
|
|
|
+ .leftJoin(BaseStudent.class, BaseStudent::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
|
|
|
+ .eq(XjrUser::getId, StpUtil.getLoginIdAsLong())
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .orderByDesc(AttendanceRecord::getId);
|
|
|
TextbookClaimStudentConfirmVo textbookClaimStudentConfirmVo = xjrUserMapper.selectJoinOne(TextbookClaimStudentConfirmVo.class, queryUser);
|
|
|
if (ObjectUtil.isNull(textbookClaimStudentConfirmVo)) {
|
|
|
throw new MyException("登录信息出错,请重新登录");
|
|
|
@@ -226,21 +247,26 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
|
|
|
@Override
|
|
|
public IPage<TeacherCheckByclassVo> getTeacherCheckByclassList(TeacherCheckByclassDto dto) {
|
|
|
- //根据当前班主任用户查出所管理的班级Id
|
|
|
- LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperClassId.eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong());
|
|
|
- List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
- if (ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0) {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ // 如果没有传入班级id
|
|
|
+ if(ObjectUtils.isEmpty(dto.getClassIdList())){
|
|
|
+ //根据当前班主任用户查出所管理的班级Id
|
|
|
+ LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperClassId
|
|
|
+ .eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
|
|
|
+ .eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ ;
|
|
|
+ List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
+ if (ObjectUtils.isEmpty(baseClassList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- List<Long> classIdList = new ArrayList<>();
|
|
|
- for (BaseClass baseClass : baseClassList) {
|
|
|
- classIdList.add(baseClass.getId());
|
|
|
- }
|
|
|
- dto.setClassIdList(classIdList);
|
|
|
+ List<Long> classIdList = new ArrayList<>();
|
|
|
+ for (BaseClass baseClass : baseClassList) {
|
|
|
+ classIdList.add(baseClass.getId());
|
|
|
+ }
|
|
|
|
|
|
- IPage<TeacherCheckByclassVo> teacherCheckByclassVoList = textbookStudentClaimMapper.getTeacherCheckByclassList(ConventPage.getPage(dto), dto);
|
|
|
+ dto.setClassIdList(classIdList);
|
|
|
+ }
|
|
|
|
|
|
//为每本书添加数据
|
|
|
// for (TeacherCheckByclassVo t : teacherCheckByclassVoList.getRecords()) {
|
|
|
@@ -263,27 +289,105 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
// Long actualClaimNum = this.count(queryActualClaimNum);
|
|
|
// t.setActualClaimNum(actualClaimNum);
|
|
|
// }
|
|
|
- return teacherCheckByclassVoList;
|
|
|
+ return textbookStudentClaimMapper.getTeacherCheckByclassList(ConventPage.getPage(dto), dto);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public IPage<TeacherCheckByStuVo> getTeacherCheckByStuList(TeacherCheckByStuDto dto) {
|
|
|
- //根据当前班主任用户查出所管理的班级Id
|
|
|
- LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperClassId.eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong());
|
|
|
- List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
- if (ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0) {
|
|
|
- return null;
|
|
|
+ // 如果没有传入班级id
|
|
|
+ if(ObjectUtils.isEmpty(dto.getClassIdList())) {
|
|
|
+ //根据当前班主任用户查出所管理的班级Id
|
|
|
+ LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperClassId.eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong());
|
|
|
+ List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
+ if (ObjectUtil.isNull(baseClassList) && baseClassList.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> classIdList = new ArrayList<>();
|
|
|
+ for (BaseClass baseClass : baseClassList) {
|
|
|
+ classIdList.add(baseClass.getId());
|
|
|
+ }
|
|
|
+ dto.setClassIdList(classIdList);
|
|
|
}
|
|
|
|
|
|
- List<Long> classIdList = new ArrayList<>();
|
|
|
- for (BaseClass baseClass : baseClassList) {
|
|
|
- classIdList.add(baseClass.getId());
|
|
|
+ // 获取班级申领的所有教材
|
|
|
+ MPJLambdaWrapper<WfTextbookClaimItem> wfTextbookClaimItemMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ wfTextbookClaimItemMPJLambdaWrapper
|
|
|
+ .selectAs(WfTextbookClaim::getClassId, TextbookClaimVO::getTextbookStudentClaimId)
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, TextbookClaimVO::getTextbookId)
|
|
|
+ .selectAs(Textbook::getBookName, TextbookClaimVO::getBookName)
|
|
|
+ .innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .leftJoin(Textbook.class, Textbook::getId, WfTextbookClaimItem::getTextbookId)
|
|
|
+ .in(WfTextbookClaim::getClassId, dto.getClassIdList())
|
|
|
+ .eq(WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ ;
|
|
|
+ List<TextbookClaimVO> textbookClaimVOList = wfTextbookClaimItemMapper.selectJoinList(TextbookClaimVO.class, wfTextbookClaimItemMPJLambdaWrapper);
|
|
|
+
|
|
|
+ Map<Long, List<TextbookClaimVO>> textbookByClassIdMap = textbookClaimVOList.stream()
|
|
|
+ .collect(Collectors.groupingBy(TextbookClaimVO::getTextbookStudentClaimId));
|
|
|
+
|
|
|
+ // 查询已有领取记录
|
|
|
+ LambdaQueryWrapper<TextbookStudentClaim> textbookStudentClaimLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ textbookStudentClaimLambdaQueryWrapper
|
|
|
+ .eq(TextbookStudentClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .in(TextbookStudentClaim::getClassId, dto.getClassIdList())
|
|
|
+ .eq(TextbookStudentClaim::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ ;
|
|
|
+ List<TextbookStudentClaim> textbookStudentClaimList = textbookStudentClaimMapper.selectList(textbookStudentClaimLambdaQueryWrapper);
|
|
|
+
|
|
|
+ Map<String, TextbookStudentClaim> byClassIdAndUserIdAndBook = textbookStudentClaimList.stream()
|
|
|
+ .collect(Collectors.toMap(t -> "" + t.getStudentUserId() + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
+
|
|
|
+// Map<Long, List<TextbookStudentClaim>> groupByUserId = textbookStudentClaimList.stream()
|
|
|
+// .collect(Collectors.groupingBy(TextbookStudentClaim::get))
|
|
|
+//
|
|
|
+// List<Long> userIds = recordsInPage.stream()
|
|
|
+// .map(TeacherCheckByStuVo::getStudentUserId)
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// if(ObjectUtils.isNotEmpty(dto.getClaimStatus())
|
|
|
+// && dto.getClaimStatus() != 1
|
|
|
+// ){
|
|
|
+// // 获取已经完全领取的学生的id
|
|
|
+// // 获取所有学生已经领取的教材的数量
|
|
|
+// MPJLambdaWrapper<>
|
|
|
+// }
|
|
|
+
|
|
|
+ // 获取班上所有在读学生
|
|
|
+ MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ baseStudentSchoolRollMPJLambdaWrapper
|
|
|
+ .selectAs(BaseStudentSchoolRoll::getClassId, TeacherCheckByStuVo::getClassId)
|
|
|
+ .selectAs(BaseStudentSchoolRoll::getUserId, TeacherCheckByStuVo::getStudentUserId)
|
|
|
+ .selectAs(XjrUser::getName, TeacherCheckByStuVo::getStudentUserIdCN)
|
|
|
+ .selectAs(BaseStudent::getStudentId, TeacherCheckByStuVo::getStudentId)
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, BaseStudentSchoolRoll::getUserId)
|
|
|
+ .leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentSchoolRoll::getUserId)
|
|
|
+ .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
|
|
|
+ .in(BaseStudentSchoolRoll::getClassId, dto.getClassIdList())
|
|
|
+ .eq(ObjectUtils.isNotEmpty(dto.getStudentUserId()), BaseStudentSchoolRoll::getUserId, dto.getStudentUserId())
|
|
|
+ ;
|
|
|
+ IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = baseStudentSchoolRollMapper.selectJoinPage(ConventPage.getPage(dto), TeacherCheckByStuVo.class, baseStudentSchoolRollMPJLambdaWrapper);
|
|
|
+
|
|
|
+ TextbookStudentClaim oldTextbookStudentClaim;
|
|
|
+ for (TeacherCheckByStuVo vo : teacherCheckByStuVoList.getRecords()){
|
|
|
+ List<TextbookClaimVO> stuTextbooks = textbookByClassIdMap.get(vo.getClassId());
|
|
|
+ for (TextbookClaimVO textbookClaimVO : stuTextbooks){
|
|
|
+ textbookClaimVO.setTextbookStudentClaimId(null);
|
|
|
+ textbookClaimVO.setStudentUserId(vo.getStudentUserId());
|
|
|
+ String key = "" + vo.getStudentUserId() + textbookClaimVO.getTextbookId();
|
|
|
+ oldTextbookStudentClaim = byClassIdAndUserIdAndBook.get(key);
|
|
|
+ if(ObjectUtils.isNotEmpty(oldTextbookStudentClaim)){
|
|
|
+ textbookClaimVO.setTextbookStudentClaimId(oldTextbookStudentClaim.getId());
|
|
|
+ textbookClaimVO.setIsClaim(oldTextbookStudentClaim.getIsClaim());
|
|
|
+ }else {
|
|
|
+ textbookClaimVO.setIsClaim(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setTextbookClaimVOList(stuTextbooks);
|
|
|
}
|
|
|
- dto.setClassIdList(classIdList);
|
|
|
|
|
|
- //将班上所有学生进行分组,查询出list集合
|
|
|
- IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = textbookStudentClaimMapper.getTeacherCheckByStuList(ConventPage.getPage(dto), dto);
|
|
|
+// //将班上所有学生进行分组,查询出list集合
|
|
|
+// IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = textbookStudentClaimMapper.getTeacherCheckByStuList(ConventPage.getPage(dto), dto);
|
|
|
|
|
|
//为每个学生添加教材领取记录集合
|
|
|
//学生id集合
|
|
|
@@ -295,15 +399,14 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
// if(stuIdList.size() > 0){
|
|
|
// List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(stuIdList);
|
|
|
// }
|
|
|
-
|
|
|
- for (TeacherCheckByStuVo t : teacherCheckByStuVoList.getRecords()) {
|
|
|
- List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(t.getStudentUserId());
|
|
|
- t.setTextbookClaimVOList(textbookClaimVOList);
|
|
|
- }
|
|
|
+//
|
|
|
+// for (TeacherCheckByStuVo t : teacherCheckByStuVoList.getRecords()) {
|
|
|
+// List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(t.getStudentUserId());
|
|
|
+// t.setTextbookClaimVOList(textbookClaimVOList);
|
|
|
+// }
|
|
|
return teacherCheckByStuVoList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean updateByIds(List<Long> textbookStudentClaimIds) {
|
|
|
@@ -326,8 +429,68 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
|
|
|
@Override
|
|
|
public List<TeacherCheckStuClaimVo> getTeacherCheckStuClaimList(TeacherCheckStuClaimDto dto) {
|
|
|
- List<TeacherCheckStuClaimVo> teacherCheckStuClaimVos = textbookStudentClaimMapper.getTeacherCheckStuClaimList(dto);
|
|
|
- return teacherCheckStuClaimVos;
|
|
|
+// List<TeacherCheckStuClaimVo> teacherCheckStuClaimVos = textbookStudentClaimMapper.getTeacherCheckStuClaimList(dto);
|
|
|
+ Textbook textbook = textbookMapper.selectById(dto.getTextbookId());
|
|
|
+ if(ObjectUtils.isEmpty(textbook)){
|
|
|
+ throw new MyException("教材不存在,请刷新重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TeacherCheckStuClaimVo> result = new ArrayList<>();
|
|
|
+ // 获取一个班级的学生
|
|
|
+ MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ baseStudentSchoolRollMPJLambdaWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .selectAs(BaseStudentSchoolRoll::getUserId, TeacherCheckStuClaimVo::getStudentUserId)
|
|
|
+ .selectAs(XjrUser::getName, TeacherCheckStuClaimVo::getStudentName)
|
|
|
+ .selectAs(BaseStudent::getStudentId, TeacherCheckStuClaimVo::getStudentId)
|
|
|
+ .select("0 as is_claim")
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, BaseStudentSchoolRoll::getUserId)
|
|
|
+ .leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentSchoolRoll::getUserId)
|
|
|
+ .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
|
|
|
+ .eq(BaseStudentSchoolRoll::getClassId, dto.getClassId())
|
|
|
+ .orderByAsc(BaseStudent::getStudentId)
|
|
|
+ ;
|
|
|
+ List<TeacherCheckStuClaimVo> stuList = baseStudentSchoolRollMapper.selectJoinList(TeacherCheckStuClaimVo.class, baseStudentSchoolRollMPJLambdaWrapper);
|
|
|
+
|
|
|
+ // 获取当前班级已经领取的记录
|
|
|
+ MPJLambdaWrapper<TextbookStudentClaim> textbookStudentClaimMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ textbookStudentClaimMPJLambdaWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .selectAs(TextbookStudentClaim::getId, TeacherCheckStuClaimVo::getTextbookStudentClaimId)
|
|
|
+ .selectAs(TextbookStudentClaim::getTextbookId, TeacherCheckStuClaimVo::getTextbookId)
|
|
|
+ .selectAs(Textbook::getBookName, TeacherCheckStuClaimVo::getBookName)
|
|
|
+ .selectAs(TextbookStudentClaim::getStudentUserId, TeacherCheckStuClaimVo::getStudentUserId)
|
|
|
+ .selectAs(TextbookStudentClaim::getIsClaim, TeacherCheckStuClaimVo::getIsClaim)
|
|
|
+ .leftJoin(Textbook.class, Textbook::getId, TextbookStudentClaim::getTextbookId)
|
|
|
+ .eq(TextbookStudentClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(TextbookStudentClaim::getTextbookId, dto.getTextbookId())
|
|
|
+ .eq(TextbookStudentClaim::getClassId, dto.getClassId())
|
|
|
+ ;
|
|
|
+ List<TeacherCheckStuClaimVo> isClaimList = textbookStudentClaimMapper.selectJoinList(TeacherCheckStuClaimVo.class, textbookStudentClaimMPJLambdaWrapper);
|
|
|
+
|
|
|
+ Map<Long, TeacherCheckStuClaimVo> isClaimByUserIdMap = isClaimList.stream()
|
|
|
+ .collect(Collectors.toMap(TeacherCheckStuClaimVo::getStudentUserId, t -> t, (t1, t2) -> t1));
|
|
|
+
|
|
|
+ for (TeacherCheckStuClaimVo stu : stuList){
|
|
|
+ stu.setTextbookId(textbook.getId());
|
|
|
+ stu.setBookName(textbook.getBookName());
|
|
|
+
|
|
|
+ TeacherCheckStuClaimVo isClaim = isClaimByUserIdMap.get(stu.getStudentUserId());
|
|
|
+ if(ObjectUtils.isNotEmpty(isClaim)){
|
|
|
+ stu.setTextbookStudentClaimId(isClaim.getTextbookStudentClaimId());
|
|
|
+ stu.setIsClaim(isClaim.getIsClaim());
|
|
|
+ if(isClaim.getIsClaim() == 1){
|
|
|
+ result.add(stu);
|
|
|
+ }else {
|
|
|
+ result.add(0, stu);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ stu.setIsClaim(0);
|
|
|
+ result.add(0, stu);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -337,4 +500,73 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
List<TextbookClaimVO> textbookClaimVOList = this.selectJoinList(TextbookClaimVO.class, queryTextbookClaimVOList);
|
|
|
return textbookClaimVOList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Boolean teacherConfirmBatchBytTextbook(List<TeacherConfirmBatchByTextbookDto> dtos) {
|
|
|
+ List<TextbookStudentClaim> insertList = new ArrayList<>();
|
|
|
+ TextbookStudentClaim textbookStudentClaim;
|
|
|
+ for (TeacherConfirmBatchByTextbookDto dto : dtos) {
|
|
|
+ // 根据当前教材和当前班级获取到没有领取的学生
|
|
|
+ MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ baseStudentSchoolRollMPJLambdaWrapper
|
|
|
+ .select(BaseStudentSchoolRoll::getId)
|
|
|
+ .select(BaseStudentSchoolRoll.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentSchoolRoll.class).contains(x.getProperty()))
|
|
|
+ .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
|
|
|
+ .eq(BaseStudentSchoolRoll::getClassId, dto.getClassId())
|
|
|
+ .notExists("SELECT 1" +
|
|
|
+ " FROM textbook_student_claim t1" +
|
|
|
+ " WHERE t1.student_user_id = t.user_id" +
|
|
|
+ " AND t1.base_semester_id = {0}" +
|
|
|
+ " AND t1.textbook_id = {1}" +
|
|
|
+ " AND t1.class_id = {2}", dto.getBaseSemesterId(), dto.getTextbookId(), dto.getClassId())
|
|
|
+ ;
|
|
|
+ List<BaseStudentSchoolRoll> baseStudentSchoolRolls = baseStudentSchoolRollMapper.selectJoinList(BaseStudentSchoolRoll.class, baseStudentSchoolRollMPJLambdaWrapper);
|
|
|
+ if(ObjectUtils.isEmpty(baseStudentSchoolRolls)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (BaseStudentSchoolRoll baseStudentSchoolRoll : baseStudentSchoolRolls){
|
|
|
+ textbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ textbookStudentClaim.setBaseSemesterId(dto.getBaseSemesterId());
|
|
|
+ textbookStudentClaim.setTextbookId(dto.getTextbookId());
|
|
|
+ textbookStudentClaim.setClassId(dto.getClassId());
|
|
|
+ textbookStudentClaim.setStudentUserId(baseStudentSchoolRoll.getUserId());
|
|
|
+ textbookStudentClaim.setIsClaim(ObjectUtils.isNotEmpty(dto.getIsClaim()) ? dto.getIsClaim() : 1);
|
|
|
+ textbookStudentClaim.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ textbookStudentClaim.setCreateDate(new Date());
|
|
|
+ insertList.add(textbookStudentClaim);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isNotEmpty(insertList)){
|
|
|
+ for (TextbookStudentClaim insert : insertList){
|
|
|
+ textbookStudentClaimMapper.insert(insert);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Boolean teacherConfirm(List<TeacherConfirmDto> dtos) {
|
|
|
+ TextbookStudentClaim textbookStudentClaim;
|
|
|
+ for (TeacherConfirmDto dto : dtos){
|
|
|
+ if(ObjectUtils.isNotEmpty(dto.getTextbookStudentClaimId()) && dto.getTextbookStudentClaimId() != 0){
|
|
|
+ textbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ textbookStudentClaim.setId(dto.getTextbookStudentClaimId());
|
|
|
+ textbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
+ textbookStudentClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ textbookStudentClaim.setModifyDate(new Date());
|
|
|
+ textbookStudentClaimMapper.updateById(textbookStudentClaim);
|
|
|
+ }else {
|
|
|
+ textbookStudentClaim = BeanUtil.toBean(dto, TextbookStudentClaim.class);
|
|
|
+ textbookStudentClaim.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ textbookStudentClaim.setCreateDate(new Date());
|
|
|
+ textbookStudentClaimMapper.insert(textbookStudentClaim);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|