|
@@ -39,9 +39,11 @@ 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.*;
|
|
|
+import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -196,6 +198,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Long loginId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
dto.setStudentUserId(loginId);
|
|
|
+
|
|
|
|
|
|
MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
baseStudentSchoolRollMPJLambdaWrapper
|
|
@@ -219,6 +222,30 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
result.setBaseSemesterCN(baseSemester.getName());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ MPJLambdaWrapper<BaseClassAdminCourse> courseMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ courseMPJLambdaWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, HeadTeaLookClassBookCategoryDetailVo::getTextbookId)
|
|
|
+ .selectAs(Textbook::getBookName, HeadTeaLookClassBookCategoryDetailVo::getBookName)
|
|
|
+ .selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
+ .selectAs(Textbook::getTextbookType, HeadTeaLookClassBookCategoryDetailVo::getTextbookType)
|
|
|
+ .innerJoin(BaseClassCourse.class, BaseClassCourse::getClassId, BaseClassAdminCourse::getId)
|
|
|
+ .innerJoin(Textbook.class, Textbook::getId, BaseClassCourse::getTextbookId)
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(DictionaryDetail::getName, HeadTeaLookClassBookCategoryDetailVo::getTextbookTypeCn)
|
|
|
+ )
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfTextbookClaim::getClaimType,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(DictionaryDetail::getName, HeadTeaLookClassBookCategoryDetailVo::getClaimTypeCn)
|
|
|
+ )
|
|
|
+ .eq(WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(WfTextbookClaim::getClassId, result.getClassId())
|
|
|
+ ;
|
|
|
+ List<HeadTeaLookClassBookCategoryDetailVo> courselList = baseClassAdminCourseMapper.selectJoinList(HeadTeaLookClassBookCategoryDetailVo.class, courseMPJLambdaWrapper);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
MPJLambdaWrapper<WfTextbookClaimItem> classMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
@@ -232,6 +259,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
.selectAs(WfTextbookClaim::getClaimType, HeadTeaLookClassBookCategoryDetailVo::getClaimType)
|
|
|
.select("1 as claim_num")
|
|
|
.innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
|
|
|
+ .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
|
|
|
.innerJoin(Textbook.class, Textbook::getId, WfTextbookClaimItem::getTextbookId)
|
|
|
.leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
|
|
|
wrapper -> wrapper
|
|
@@ -259,6 +288,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
.selectAs(WfTextbookClaim::getClaimType, HeadTeaLookClassBookCategoryDetailVo::getClaimType)
|
|
|
.select("1 as claim_num")
|
|
|
.innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
|
|
|
+ .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
|
|
|
.innerJoin(Textbook.class, Textbook::getId, WfTextbookClaimItem::getTextbookId)
|
|
|
.leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
|
|
|
wrapper -> wrapper
|
|
@@ -275,7 +306,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
List<HeadTeaLookClassBookCategoryDetailVo> personalList = wfTextbookClaimItemMapper.selectJoinList(HeadTeaLookClassBookCategoryDetailVo.class, personalMPJLambdaWrapper);
|
|
|
|
|
|
|
|
|
- List<HeadTeaLookClassBookCategoryDetailVo> mergedList = new ArrayList<>(Stream.concat(classList.stream(), personalList.stream())
|
|
|
+ List<HeadTeaLookClassBookCategoryDetailVo> mergedDistinctList = new ArrayList<>(Stream.concat(classList.stream(), personalList.stream())
|
|
|
.collect(Collectors.toMap(
|
|
|
|
|
|
HeadTeaLookClassBookCategoryDetailVo::getTextbookId,
|
|
@@ -285,15 +316,6 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
))
|
|
|
.values());
|
|
|
|
|
|
-
|
|
|
- List<HeadTeaLookClassBookCategoryDetailVo> distinctList = new ArrayList<>(mergedList.stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- HeadTeaLookClassBookCategoryDetailVo::getTextbookId,
|
|
|
- vo -> vo,
|
|
|
- (existing, replacement) -> existing
|
|
|
- ))
|
|
|
- .values());
|
|
|
-
|
|
|
|
|
|
LambdaQueryWrapper<TextbookStudentClaim> textbookStudentClaimLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
textbookStudentClaimLambdaQueryWrapper
|
|
@@ -306,10 +328,10 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Map<Long, TextbookStudentClaim> byTextbookId = textbookStudentClaimList.stream()
|
|
|
.collect(Collectors.toMap(TextbookStudentClaim::getTextbookId, t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(distinctList)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(mergedDistinctList)) {
|
|
|
|
|
|
|
|
|
- Map<String, List<HeadTeaLookClassBookCategoryDetailVo>> detailByCategoryMap = distinctList.stream()
|
|
|
+ Map<String, List<HeadTeaLookClassBookCategoryDetailVo>> detailByCategoryMap = mergedDistinctList.stream()
|
|
|
.filter(detail -> StringUtils.isNotEmpty(detail.getTextbookType()))
|
|
|
.collect(Collectors.groupingBy(HeadTeaLookClassBookCategoryDetailVo::getTextbookType));
|
|
|
|
|
@@ -357,67 +379,165 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
|
|
|
@Override
|
|
|
public List<TextbookStudentSemesterVo> getStudentSemesterList() {
|
|
|
+ Long loginId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
BaseStudentSchoolRoll baseStudentSchoolRoll = baseStudentSchoolRollMapper.selectOne(
|
|
|
Wrappers.lambdaQuery(BaseStudentSchoolRoll.class)
|
|
|
.eq(BaseStudentSchoolRoll::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
- .eq(BaseStudentSchoolRoll::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
+ .eq(BaseStudentSchoolRoll::getUserId, loginId)
|
|
|
);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(baseStudentSchoolRoll)) {
|
|
|
throw new MyException("用户信息错误,请重新登录");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ MPJLambdaWrapper<BaseClassAdminCourse> courseMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ courseMPJLambdaWrapper
|
|
|
+ .selectAs(BaseClassAdminCourse::getBaseSemesterId, TextbookStudentSemesterVo::getBaseSemesterId)
|
|
|
+ .selectAs(BaseSemester::getName, TextbookStudentSemesterVo::getBaseSemesterIdCN)
|
|
|
+ .select("3 as status")
|
|
|
+ .leftJoin(BaseSemester.class, BaseSemester::getId, BaseClassAdminCourse::getBaseSemesterId)
|
|
|
+ .eq(BaseClassAdminCourse::getClassId, baseStudentSchoolRoll.getClassId())
|
|
|
+ ;
|
|
|
+ List<TextbookStudentSemesterVo> courselList = baseClassAdminCourseMapper.selectJoinList(TextbookStudentSemesterVo.class, courseMPJLambdaWrapper);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ MPJLambdaWrapper<TextbookStudentClaim> textbookStudentClaimMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ textbookStudentClaimMPJLambdaWrapper
|
|
|
+ .selectAs(TextbookStudentClaim::getBaseSemesterId, StudentSemesterTextbookVo::getBaseSemesterId)
|
|
|
+ .selectAs(TextbookStudentClaim::getTextbookId, StudentSemesterTextbookVo::getTextbookId)
|
|
|
+ .eq(TextbookStudentClaim::getStudentUserId, loginId)
|
|
|
+ .ne(TextbookStudentClaim::getIsClaim, 0)
|
|
|
+ .eq(TextbookStudentClaim::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ ;
|
|
|
+ List<StudentSemesterTextbookVo> studentClaimList = textbookStudentClaimMapper.selectJoinList(StudentSemesterTextbookVo.class, textbookStudentClaimMPJLambdaWrapper);
|
|
|
+
|
|
|
+ Map<Long, Map<Long, StudentSemesterTextbookVo>> studentClaimMap = studentClaimList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ StudentSemesterTextbookVo::getBaseSemesterId,
|
|
|
+ Collectors.toMap(
|
|
|
+ StudentSemesterTextbookVo::getTextbookId,
|
|
|
+ claim -> claim,
|
|
|
+ (existing, replacement) -> existing
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
MPJLambdaWrapper<WfTextbookClaim> classMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
classMPJLambdaWrapper
|
|
|
- .selectAs(WfTextbookClaim::getBaseSemesterId, TextbookStudentSemesterVo::getBaseSemesterId)
|
|
|
- .selectAs(BaseSemester::getName, TextbookStudentSemesterVo::getBaseSemesterIdCN)
|
|
|
+ .selectAs(WfTextbookClaim::getBaseSemesterId, StudentSemesterTextbookVo::getBaseSemesterId)
|
|
|
+ .selectAs(BaseSemester::getName, StudentSemesterTextbookVo::getBaseSemesterIdCN)
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, StudentSemesterTextbookVo::getTextbookId)
|
|
|
+ .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
|
|
|
+ .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
|
|
|
.leftJoin(BaseSemester.class, BaseSemester::getId, WfTextbookClaim::getBaseSemesterId)
|
|
|
+ .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
|
|
|
.eq(WfTextbookClaim::getClassId, baseStudentSchoolRoll.getClassId())
|
|
|
.eq(WfTextbookClaim::getClaimType, ClaimTypeEnum.ClaimClass.getCode())
|
|
|
- ;
|
|
|
- List<TextbookStudentSemesterVo> classList = wfTextbookClaimMapper.selectJoinList(TextbookStudentSemesterVo.class, classMPJLambdaWrapper);
|
|
|
+ ;
|
|
|
+ List<StudentSemesterTextbookVo> classList = wfTextbookClaimMapper.selectJoinList(StudentSemesterTextbookVo.class, classMPJLambdaWrapper);
|
|
|
+
|
|
|
+ Map<Long, Map<Long, StudentSemesterTextbookVo>> classMap = classList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ StudentSemesterTextbookVo::getBaseSemesterId,
|
|
|
+ Collectors.toMap(
|
|
|
+ StudentSemesterTextbookVo::getTextbookId,
|
|
|
+ claim -> claim,
|
|
|
+ (existing, replacement) -> existing
|
|
|
+ )
|
|
|
+ ));
|
|
|
|
|
|
|
|
|
MPJLambdaWrapper<WfTextbookClaim> personalMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
personalMPJLambdaWrapper
|
|
|
- .selectAs(WfTextbookClaim::getBaseSemesterId, TextbookStudentSemesterVo::getBaseSemesterId)
|
|
|
- .selectAs(BaseSemester::getName, TextbookStudentSemesterVo::getBaseSemesterIdCN)
|
|
|
+ .selectAs(WfTextbookClaim::getBaseSemesterId, StudentSemesterTextbookVo::getBaseSemesterId)
|
|
|
+ .selectAs(BaseSemester::getName, StudentSemesterTextbookVo::getBaseSemesterIdCN)
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, StudentSemesterTextbookVo::getTextbookId)
|
|
|
+ .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
|
|
|
+ .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
|
|
|
.leftJoin(BaseSemester.class, BaseSemester::getId, WfTextbookClaim::getBaseSemesterId)
|
|
|
- .eq(WfTextbookClaim::getApplicantUserId, baseStudentSchoolRoll.getUserId())
|
|
|
+ .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
|
|
|
+ .eq(WfTextbookClaim::getApplicantUserId, loginId)
|
|
|
.eq(WfTextbookClaim::getClaimType, ClaimTypeEnum.ClaimStudent.getCode())
|
|
|
;
|
|
|
- List<TextbookStudentSemesterVo> personalList = wfTextbookClaimMapper.selectJoinList(TextbookStudentSemesterVo.class, personalMPJLambdaWrapper);
|
|
|
+ List<StudentSemesterTextbookVo> personalList = wfTextbookClaimMapper.selectJoinList(StudentSemesterTextbookVo.class, personalMPJLambdaWrapper);
|
|
|
+
|
|
|
+ Map<Long, Map<Long, StudentSemesterTextbookVo>> personalMap = personalList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ StudentSemesterTextbookVo::getBaseSemesterId,
|
|
|
+ Collectors.toMap(
|
|
|
+ StudentSemesterTextbookVo::getTextbookId,
|
|
|
+ claim -> claim,
|
|
|
+ (existing, replacement) -> existing
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+
|
|
|
+ List<StudentSemesterTextbookVo> mergedDistinctList = new ArrayList<>(Stream.concat(classList.stream(), personalList.stream())
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+
|
|
|
+ StudentSemesterTextbookVo::getBaseSemesterId,
|
|
|
+
|
|
|
+ vo -> vo,
|
|
|
+ (classVo, personalVo) -> personalVo
|
|
|
+ ))
|
|
|
+ .values());
|
|
|
|
|
|
-
|
|
|
- List<TextbookStudentSemesterVo> mergedList = Stream.concat(classList.stream(), personalList.stream())
|
|
|
- .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<TextbookStudentSemesterVo> resultList = new ArrayList<>();
|
|
|
+ TextbookStudentSemesterVo result;
|
|
|
+ List<Long> mergedKeyList;
|
|
|
+ int status = 2;
|
|
|
+ for(StudentSemesterTextbookVo vo : mergedDistinctList){
|
|
|
+ result = new TextbookStudentSemesterVo();
|
|
|
+ Long semester = vo.getBaseSemesterId();
|
|
|
+ result.setBaseSemesterId(semester);
|
|
|
+ result.setBaseSemesterIdCN(vo.getBaseSemesterIdCN());
|
|
|
+ Map<Long, StudentSemesterTextbookVo> classSemesterMap = classMap.get(semester);
|
|
|
+ Map<Long, StudentSemesterTextbookVo> personalSemesterMap = personalMap.get(semester);
|
|
|
+ Map<Long, StudentSemesterTextbookVo> studentClaimSemesterMap = studentClaimMap.get(semester);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Set<Long> classKeys = (classSemesterMap != null) ? classSemesterMap.keySet() : Collections.emptySet();
|
|
|
+ Set<Long> personalKeys = (personalSemesterMap != null) ? personalSemesterMap.keySet() : Collections.emptySet();
|
|
|
+
|
|
|
+
|
|
|
+ mergedKeyList = Stream.concat(classKeys.stream(), personalKeys.stream())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for(Long textbookId : mergedKeyList){
|
|
|
+ StudentSemesterTextbookVo studentClaimVo = studentClaimSemesterMap.get(textbookId);
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(studentClaimVo)){
|
|
|
+ status = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setStatus(status);
|
|
|
+ resultList.add(result);
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- List<TextbookStudentSemesterVo> distinctList = new ArrayList<>(mergedList.stream()
|
|
|
+
|
|
|
+ List<TextbookStudentSemesterVo> lastMergedDistinctList = new ArrayList<>(Stream.concat(courselList.stream(), resultList.stream())
|
|
|
.collect(Collectors.toMap(
|
|
|
- TextbookStudentSemesterVo::getBaseSemesterId,
|
|
|
- vo -> vo,
|
|
|
- (existing, replacement) -> existing
|
|
|
+
|
|
|
+ TextbookStudentSemesterVo::getBaseSemesterId,
|
|
|
+
|
|
|
+ vo -> vo,
|
|
|
+ (courseVo, resultVo) -> resultVo
|
|
|
))
|
|
|
- .values());
|
|
|
+ .values());
|
|
|
|
|
|
|
|
|
- distinctList.sort(Comparator.comparing(TextbookStudentSemesterVo::getBaseSemesterIdCN));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return distinctList;
|
|
|
+ lastMergedDistinctList.sort(Comparator.comparing(TextbookStudentSemesterVo::getBaseSemesterIdCN));
|
|
|
+
|
|
|
+ return lastMergedDistinctList;
|
|
|
}
|
|
|
|
|
|
@Override
|