|
@@ -39,11 +39,11 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
-* @title: 学生教材认领记录
|
|
|
-* @Author szs
|
|
|
-* @Date: 2023-12-26
|
|
|
-* @Version 1.0
|
|
|
-*/
|
|
|
+ * @title: 学生教材认领记录
|
|
|
+ * @Author szs
|
|
|
+ * @Date: 2023-12-26
|
|
|
+ * @Version 1.0
|
|
|
+ */
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<TextbookStudentClaimMapper, TextbookStudentClaim> implements ITextbookStudentClaimService {
|
|
@@ -63,18 +63,9 @@ 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)){
|
|
|
+ if (ObjectUtil.isNull(textbookClaimStudentConfirmVo)) {
|
|
|
throw new MyException("登录信息出错,请重新登录");
|
|
|
}
|
|
|
|
|
@@ -94,22 +85,15 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
public List<TextbookStudentSemesterVo> getStudentSemesterList() {
|
|
|
//获取当前学生领取记录的所有学期
|
|
|
MPJLambdaWrapper<TextbookStudentClaim> qwerySemester = new MPJLambdaWrapper<>();
|
|
|
- qwerySemester
|
|
|
- .disableSubLogicDel()
|
|
|
- .selectAs(BaseSemester::getName,TextbookStudentSemesterVo::getBaseSemesterIdCN)
|
|
|
- .leftJoin(BaseSemester.class,BaseSemester::getId,TextbookStudentClaim::getBaseSemesterId)
|
|
|
- .eq(TextbookStudentClaim::getStudentUserId,StpUtil.getLoginIdAsLong());
|
|
|
- List<TextbookStudentSemesterVo> textbookStudentSemesterVoList = this.selectJoinList(TextbookStudentSemesterVo.class,qwerySemester);
|
|
|
- if(ObjectUtil.isNull(textbookStudentSemesterVoList) && textbookStudentSemesterVoList.size() == 0){
|
|
|
+ qwerySemester.disableSubLogicDel().selectAs(BaseSemester::getName, TextbookStudentSemesterVo::getBaseSemesterIdCN).leftJoin(BaseSemester.class, BaseSemester::getId, TextbookStudentClaim::getBaseSemesterId).eq(TextbookStudentClaim::getStudentUserId, StpUtil.getLoginIdAsLong());
|
|
|
+ List<TextbookStudentSemesterVo> textbookStudentSemesterVoList = this.selectJoinList(TextbookStudentSemesterVo.class, qwerySemester);
|
|
|
+ if (ObjectUtil.isNull(textbookStudentSemesterVoList) && textbookStudentSemesterVoList.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
//为每个学期添加未领取人数
|
|
|
for (TextbookStudentSemesterVo textbookStudentSemesterVo : textbookStudentSemesterVoList) {
|
|
|
LambdaQueryWrapper<TextbookStudentClaim> queryWrapperNotClaimNum = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperNotClaimNum
|
|
|
- .eq(TextbookStudentClaim::getStudentUserId,StpUtil.getLoginIdAsLong())
|
|
|
- .eq(TextbookStudentClaim::getBaseSemesterId,textbookStudentSemesterVo.getBaseSemesterId())
|
|
|
- .eq(TextbookStudentClaim::getIsClaim,0);
|
|
|
+ queryWrapperNotClaimNum.eq(TextbookStudentClaim::getStudentUserId, StpUtil.getLoginIdAsLong()).eq(TextbookStudentClaim::getBaseSemesterId, textbookStudentSemesterVo.getBaseSemesterId()).eq(TextbookStudentClaim::getIsClaim, 0);
|
|
|
Long notClaimNum = this.count(queryWrapperNotClaimNum);
|
|
|
textbookStudentSemesterVo.setNotClaimNum(notClaimNum);
|
|
|
}
|
|
@@ -120,10 +104,9 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
public IPage<TeacherCheckByclassVo> getTeacherCheckByclassList(TeacherCheckByclassDto dto) {
|
|
|
//根据当前班主任用户查出所管理的班级Id
|
|
|
LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperClassId
|
|
|
- .eq(BaseClass::getTeacherId,StpUtil.getLoginIdAsLong());
|
|
|
+ queryWrapperClassId.eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong());
|
|
|
List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
- if(ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0){
|
|
|
+ if (ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -133,25 +116,18 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
}
|
|
|
dto.setClassIdList(classIdList);
|
|
|
|
|
|
- IPage<TeacherCheckByclassVo> teacherCheckByclassVoList = textbookStudentClaimMapper.getTeacherCheckByclassList(ConventPage.getPage(dto),dto);
|
|
|
+ IPage<TeacherCheckByclassVo> teacherCheckByclassVoList = textbookStudentClaimMapper.getTeacherCheckByclassList(ConventPage.getPage(dto), dto);
|
|
|
|
|
|
//为每本书添加数据
|
|
|
- for (TeacherCheckByclassVo t: teacherCheckByclassVoList.getRecords()) {
|
|
|
+ for (TeacherCheckByclassVo t : teacherCheckByclassVoList.getRecords()) {
|
|
|
MPJLambdaWrapper<WfTextbookClaim> qweryActualReceivedNum = new MPJLambdaWrapper<>();
|
|
|
- qweryActualReceivedNum
|
|
|
- .disableSubLogicDel()
|
|
|
- .selectSum(WfTextbookClaimItem::getIssueNumber,TeacherCheckByclassVo::getActualReceivedNum)
|
|
|
- .leftJoin(WfTextbookClaimItem.class,WfTextbookClaimItem::getWfTextbookClaimId,WfTextbookClaim::getId)
|
|
|
- .eq(WfTextbookClaim::getClassId,t.getClassId())
|
|
|
- .eq(WfTextbookClaimItem::getTextbookId,t.getTextbookId());
|
|
|
- TeacherCheckByclassVo teacherCheckByclassVo = wfTextbookClaimMapper.selectJoinOne(TeacherCheckByclassVo.class,qweryActualReceivedNum);
|
|
|
+ qweryActualReceivedNum.disableSubLogicDel().selectSum(WfTextbookClaimItem::getIssueNumber, TeacherCheckByclassVo::getActualReceivedNum).leftJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId).eq(WfTextbookClaim::getClassId, t.getClassId()).eq(WfTextbookClaimItem::getTextbookId, t.getTextbookId());
|
|
|
+ TeacherCheckByclassVo teacherCheckByclassVo = wfTextbookClaimMapper.selectJoinOne(TeacherCheckByclassVo.class, qweryActualReceivedNum);
|
|
|
|
|
|
t.setActualReceivedNum(teacherCheckByclassVo.getActualReceivedNum());
|
|
|
|
|
|
LambdaQueryWrapper<TextbookStudentClaim> queryActualClaimNum = new LambdaQueryWrapper<>();
|
|
|
- queryActualClaimNum
|
|
|
- .eq(TextbookStudentClaim::getClassId, t.getClassId())
|
|
|
- .eq(TextbookStudentClaim::getTextbookId, t.getTextbookId());
|
|
|
+ queryActualClaimNum.eq(TextbookStudentClaim::getClassId, t.getClassId()).eq(TextbookStudentClaim::getTextbookId, t.getTextbookId());
|
|
|
Long actualClaimNum = this.count(queryActualClaimNum);
|
|
|
t.setActualClaimNum(actualClaimNum);
|
|
|
}
|
|
@@ -162,10 +138,9 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
public IPage<TeacherCheckByStuVo> getTeacherCheckByStuList(TeacherCheckByStuDto dto) {
|
|
|
//根据当前班主任用户查出所管理的班级Id
|
|
|
LambdaQueryWrapper<BaseClass> queryWrapperClassId = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperClassId
|
|
|
- .eq(BaseClass::getTeacherId,StpUtil.getLoginIdAsLong());
|
|
|
+ queryWrapperClassId.eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong());
|
|
|
List<BaseClass> baseClassList = baseClassService.list(queryWrapperClassId);
|
|
|
- if(ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0){
|
|
|
+ if (ObjectUtil.isNull(baseClassList) && baseClassList.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -176,10 +151,10 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
dto.setClassIdList(classIdList);
|
|
|
|
|
|
//将班上所有学生进行分组,查询出list集合
|
|
|
- IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = textbookStudentClaimMapper.getTeacherCheckByStuList(ConventPage.getPage(dto),dto);
|
|
|
+ IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = textbookStudentClaimMapper.getTeacherCheckByStuList(ConventPage.getPage(dto), dto);
|
|
|
|
|
|
//为每个学生添加教材领取记录集合
|
|
|
- for (TeacherCheckByStuVo t: teacherCheckByStuVoList.getRecords()) {
|
|
|
+ for (TeacherCheckByStuVo t : teacherCheckByStuVoList.getRecords()) {
|
|
|
List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(t.getStudentUserId());
|
|
|
t.setTextbookClaimVOList(textbookClaimVOList);
|
|
|
}
|
|
@@ -192,7 +167,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
@Transactional
|
|
|
public Boolean updateByIds(List<Long> textbookStudentClaimIds) {
|
|
|
for (Long textbookStudentClaimId : textbookStudentClaimIds) {
|
|
|
- this.updateById(new TextbookStudentClaim(){{
|
|
|
+ this.updateById(new TextbookStudentClaim() {{
|
|
|
setId(textbookStudentClaimId);
|
|
|
setIsClaim(1);
|
|
|
}});
|
|
@@ -207,15 +182,9 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TextbookClaimVO> getTeacherGetStuNoClaimList( Long studentUserId) {
|
|
|
+ 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();
|
|
|
+ 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;
|
|
|
}
|