|
@@ -7,6 +7,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.ClaimTypeEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
@@ -16,8 +17,11 @@ import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
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.TeacherCheckByStuDto;
|
|
|
import com.xjrsoft.module.textbook.dto.TeacherCheckByclassDto;
|
|
|
+import com.xjrsoft.module.textbook.dto.TeacherCheckStuClaimDto;
|
|
|
import com.xjrsoft.module.textbook.dto.TextbookClaimStudentConfirmDto;
|
|
|
+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;
|
|
@@ -25,10 +29,7 @@ import com.xjrsoft.module.textbook.mapper.TextbookStudentClaimMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.WfTextbookClaimItemMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.WfTextbookClaimMapper;
|
|
|
import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
|
|
|
-import com.xjrsoft.module.textbook.vo.TeacherCheckByclassVo;
|
|
|
-import com.xjrsoft.module.textbook.vo.TextbookClaimStudentConfirmVo;
|
|
|
-import com.xjrsoft.module.textbook.vo.TextbookClaimVO;
|
|
|
-import com.xjrsoft.module.textbook.vo.TextbookStudentSemesterVo;
|
|
|
+import com.xjrsoft.module.textbook.vo.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -134,6 +135,11 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
//将班上所有发放的教材进行分组,查询出list集合
|
|
|
List<TeacherCheckByclassVo> teacherCheckByclassVoList = textbookStudentClaimMapper.getTeacherCheckByclassList(classId);
|
|
|
|
|
|
+ if(ObjectUtil.isNull(teacherCheckByclassVoList) || teacherCheckByclassVoList.size() == 0){
|
|
|
+ throw new MyException("未找到教材领取数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ //为每种教材添加统计值
|
|
|
//实际领取教材数量
|
|
|
//根据班主任ID和班级ID找到所有班主任为该班申请的教材的所有申领记录,申领类型应该为学生
|
|
|
LambdaQueryWrapper<WfTextbookClaim> queryWrapperWfTextbookClaim = new LambdaQueryWrapper<>();
|
|
@@ -171,14 +177,111 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
queryWrapperTextbookStudentClaimCount
|
|
|
.in(TextbookStudentClaim::getClassId,classId)
|
|
|
.eq(TextbookStudentClaim::getTextbookId, t.getTextbookId())
|
|
|
- .eq(TextbookStudentClaim::getIsClaim, 1);
|
|
|
+ .eq(TextbookStudentClaim::getIsClaim, 1);;
|
|
|
Long count = this.count(queryWrapperTextbookStudentClaimCount);
|
|
|
t.setActualClaimNum(count);
|
|
|
}
|
|
|
|
|
|
+ Integer claimStatus = 1;
|
|
|
+ //根据领取情况入参返回不同状态的数据
|
|
|
+ if(ObjectUtil.isNotNull(dto.getClaimStatus())){
|
|
|
+ claimStatus = dto.getClaimStatus();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TeacherCheckByclassVo> result = new ArrayList<>();
|
|
|
+
|
|
|
+ if (claimStatus == 2){
|
|
|
+ for (TeacherCheckByclassVo t : teacherCheckByclassVoList) {
|
|
|
+ if (t.getClassStudentNum().compareTo(t.getActualReceivedNum()) == 0 && Long.valueOf(t.getClassStudentNum()).compareTo(t.getActualClaimNum()) == 0){
|
|
|
+ result.add(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (claimStatus == 3){
|
|
|
+ for (TeacherCheckByclassVo t : teacherCheckByclassVoList) {
|
|
|
+ if (t.getClassStudentNum().compareTo(t.getActualReceivedNum()) > 0 || Long.valueOf(t.getClassStudentNum()).compareTo(t.getActualClaimNum()) > 0){
|
|
|
+ result.add(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return teacherCheckByclassVoList;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<TeacherCheckByStuVo> getTeacherCheckByStuList(TeacherCheckByStuDto dto) {
|
|
|
+ //根据当前班主任用户查出所管理的班级Id
|
|
|
+ LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperClassId
|
|
|
+ .eq(BaseClass::getTeacherId,StpUtil.getLoginIdAsLong());
|
|
|
+ BaseClass baseClass = baseClassService.getOne(queryWrapperClassId);
|
|
|
+ if(ObjectUtil.isNull(baseClass)){
|
|
|
+ throw new MyException("班级信息获取失败");
|
|
|
+ }
|
|
|
+ Long classId = baseClass.getId();
|
|
|
+
|
|
|
+ dto.setClassId(classId);
|
|
|
+
|
|
|
+ //将班上所有学生进行分组,查询出list集合
|
|
|
+ List<TeacherCheckByStuVo> teacherCheckByStuVoList = textbookStudentClaimMapper.getTeacherCheckByStuList(dto);
|
|
|
+
|
|
|
+ if(ObjectUtil.isNull(teacherCheckByStuVoList) || teacherCheckByStuVoList.size() == 0){
|
|
|
+ throw new MyException("未找到学生数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ //为每个学生添加教材领取记录集合
|
|
|
+ for (TeacherCheckByStuVo t: teacherCheckByStuVoList) {
|
|
|
+ List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(classId,t.getStudentUserId());
|
|
|
+ t.setTextbookClaimVOList(textbookClaimVOList);
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer claimStatus = 1;
|
|
|
+ //根据领取情况入参返回不同状态的数据
|
|
|
+ if(ObjectUtil.isNotNull(dto.getClaimStatus())){
|
|
|
+ claimStatus = dto.getClaimStatus();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TeacherCheckByStuVo> result = new ArrayList<>();
|
|
|
+
|
|
|
+ if (claimStatus == 2){
|
|
|
+ for (TeacherCheckByStuVo t : teacherCheckByStuVoList) {
|
|
|
+ int claimNum = 0;
|
|
|
+ for (TextbookClaimVO textbookClaimVO : t.getTextbookClaimVOList()) {
|
|
|
+ if (textbookClaimVO.getIsClaim() == 1){
|
|
|
+ claimNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(claimNum == t.getTextbookClaimVOList().size()){//全部领取
|
|
|
+ result.add(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (claimStatus == 3){
|
|
|
+ for (TeacherCheckByStuVo t : teacherCheckByStuVoList) {
|
|
|
+ int claimNum = 0;
|
|
|
+ for (TextbookClaimVO textbookClaimVO : t.getTextbookClaimVOList()) {
|
|
|
+ if (textbookClaimVO.getIsClaim() == 1){
|
|
|
+ claimNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(claimNum < t.getTextbookClaimVOList().size()){//部分未领取
|
|
|
+ result.add(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ return teacherCheckByStuVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean updateByIds(List<Long> textbookStudentClaimIds) {
|
|
@@ -190,4 +293,36 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TeacherCheckStuClaimVo> getTeacherCheckStuClaimList(TeacherCheckStuClaimDto dto) {
|
|
|
+ //根据当前班主任用户查出所管理的班级Id
|
|
|
+ LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperClassId
|
|
|
+ .eq(BaseClass::getTeacherId,StpUtil.getLoginIdAsLong());
|
|
|
+ BaseClass baseClass = baseClassService.getOne(queryWrapperClassId);
|
|
|
+ if(ObjectUtil.isNull(baseClass)){
|
|
|
+ throw new MyException("班级信息获取失败");
|
|
|
+ }
|
|
|
+ Long classId = baseClass.getId();
|
|
|
+
|
|
|
+ dto.setClassId(classId);
|
|
|
+
|
|
|
+ List<TeacherCheckStuClaimVo> teacherCheckStuClaimVos = textbookStudentClaimMapper.getTeacherCheckStuClaimList(dto);
|
|
|
+ return teacherCheckStuClaimVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TextbookClaimVO> getTeacherGetStuNoClaimList( Long studentUserId) {
|
|
|
+ MPJLambdaWrapper<TextbookStudentClaim> queryTextbookClaimVOList = new MPJLambdaWrapper<>();
|
|
|
+ queryTextbookClaimVOList
|
|
|
+ .selectAs(TextbookStudentClaim::getId, TextbookClaimVO::getTextbookStudentClaimId)
|
|
|
+ .selectAs(Textbook::getBookName, TextbookClaimVO::getBookName)
|
|
|
+ .select(TextbookStudentClaim.class, x -> VoToColumnUtil.fieldsToColumns(TextbookClaimVO.class).contains(x.getProperty()))
|
|
|
+ .leftJoin(Textbook.class, Textbook::getId, TextbookStudentClaim::getTextbookId)
|
|
|
+ .eq(TextbookStudentClaim::getStudentUserId, studentUserId)
|
|
|
+ .disableSubLogicDel();
|
|
|
+ List<TextbookClaimVO> textbookClaimVOList = this.selectJoinList(TextbookClaimVO.class, queryTextbookClaimVOList);
|
|
|
+ return textbookClaimVOList;
|
|
|
+ }
|
|
|
}
|