|
|
@@ -29,10 +29,7 @@ import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
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.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.entity.*;
|
|
|
import com.xjrsoft.module.textbook.mapper.TextbookMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.TextbookStudentClaimMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.WfTextbookClaimItemMapper;
|
|
|
@@ -41,6 +38,8 @@ 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.collections.CollectionUtils;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
@@ -226,34 +225,31 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
MPJLambdaWrapper<BaseClassAdminCourse> courseMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
courseMPJLambdaWrapper
|
|
|
.disableSubLogicDel()
|
|
|
- .selectAs(WfTextbookClaimItem::getTextbookId, HeadTeaLookClassBookCategoryDetailVo::getTextbookId)
|
|
|
+ .selectAs(BaseClassCourse::getTextbookId, HeadTeaLookClassBookCategoryDetailVo::getTextbookId)
|
|
|
.selectAs(Textbook::getBookName, HeadTeaLookClassBookCategoryDetailVo::getBookName)
|
|
|
.selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
.selectAs(Textbook::getTextbookType, HeadTeaLookClassBookCategoryDetailVo::getTextbookType)
|
|
|
+ .select("1 as claim_num")
|
|
|
+ .select("3 as is_claim")
|
|
|
.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())
|
|
|
+ .eq(BaseClassAdminCourse::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(BaseClassAdminCourse::getClassId, result.getClassId())
|
|
|
;
|
|
|
List<HeadTeaLookClassBookCategoryDetailVo> courselList = baseClassAdminCourseMapper.selectJoinList(HeadTeaLookClassBookCategoryDetailVo.class, courseMPJLambdaWrapper);
|
|
|
|
|
|
-
|
|
|
- // 学生查看自己的教材来源于两个方面,一个是班级申领教材,一个是个人申领的教材
|
|
|
+ // 学生查看自己待领取的教材来源于两个方面,一个是班级申领教材,一个是个人申领的教材
|
|
|
// 班级申领教材
|
|
|
MPJLambdaWrapper<WfTextbookClaimItem> classMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
classMPJLambdaWrapper
|
|
|
.disableSubLogicDel()
|
|
|
.selectAs(WfTextbookClaimItem::getTextbookId, HeadTeaLookClassBookCategoryDetailVo::getTextbookId)
|
|
|
.selectAs(Textbook::getBookName, HeadTeaLookClassBookCategoryDetailVo::getBookName)
|
|
|
- .selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
+// .selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
.selectAs(Textbook::getTextbookType, HeadTeaLookClassBookCategoryDetailVo::getTextbookType)
|
|
|
.selectAs(WfTextbookClaimItem::getCreateDate, HeadTeaLookClassBookCategoryDetailVo::getClaimTime)
|
|
|
.selectAs(WfTextbookClaim::getClaimType, HeadTeaLookClassBookCategoryDetailVo::getClaimType)
|
|
|
@@ -282,7 +278,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
.disableSubLogicDel()
|
|
|
.selectAs(WfTextbookClaimItem::getTextbookId, HeadTeaLookClassBookCategoryDetailVo::getTextbookId)
|
|
|
.selectAs(Textbook::getBookName, HeadTeaLookClassBookCategoryDetailVo::getBookName)
|
|
|
- .selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
+// .selectAs(Textbook::getPrice, HeadTeaLookClassBookCategoryDetailVo::getPrice)
|
|
|
.selectAs(Textbook::getTextbookType, HeadTeaLookClassBookCategoryDetailVo::getTextbookType)
|
|
|
.selectAs(WfTextbookClaimItem::getCreateDate, HeadTeaLookClassBookCategoryDetailVo::getClaimTime)
|
|
|
.selectAs(WfTextbookClaim::getClaimType, HeadTeaLookClassBookCategoryDetailVo::getClaimType)
|
|
|
@@ -305,7 +301,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
;
|
|
|
List<HeadTeaLookClassBookCategoryDetailVo> personalList = wfTextbookClaimItemMapper.selectJoinList(HeadTeaLookClassBookCategoryDetailVo.class, personalMPJLambdaWrapper);
|
|
|
|
|
|
- // 合并两个列表,如果有个人领取记录,应该保留个人的,移除班级的
|
|
|
+ // 合并两个列表,如果有个人申领记录,应该保留个人的,移除班级的
|
|
|
List<HeadTeaLookClassBookCategoryDetailVo> mergedDistinctList = new ArrayList<>(Stream.concat(classList.stream(), personalList.stream())
|
|
|
.collect(Collectors.toMap(
|
|
|
// 使用唯一标识作为 key
|
|
|
@@ -316,6 +312,13 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
))
|
|
|
.values()); // 转换回 List
|
|
|
|
|
|
+ // 如果申领教材列表为空,应该使用基础数据维护的
|
|
|
+ boolean isCourseFlag = false;
|
|
|
+ if(CollectionUtils.isEmpty(mergedDistinctList)){
|
|
|
+ isCourseFlag = true;
|
|
|
+ mergedDistinctList = courselList;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取当前学生当前学期所有已经领取的数据
|
|
|
LambdaQueryWrapper<TextbookStudentClaim> textbookStudentClaimLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
textbookStudentClaimLambdaQueryWrapper
|
|
|
@@ -352,16 +355,18 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
|
|
|
categoryTotalPrice = BigDecimal.ZERO;
|
|
|
for (HeadTeaLookClassBookCategoryDetailVo vo : value) {
|
|
|
- textbookStudentClaim = byTextbookId.get(vo.getTextbookId());
|
|
|
- if (ObjectUtils.isNotEmpty(textbookStudentClaim)) {
|
|
|
- vo.setTextbookStudentClaimId(textbookStudentClaim.getId());
|
|
|
- vo.setIsClaim(textbookStudentClaim.getIsClaim());
|
|
|
- } else {
|
|
|
- vo.setIsClaim(0);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(vo.getPrice())) {
|
|
|
- vo.setPrice(BigDecimal.ZERO);
|
|
|
+ if(!isCourseFlag){
|
|
|
+ textbookStudentClaim = byTextbookId.get(vo.getTextbookId());
|
|
|
+ if (ObjectUtils.isNotEmpty(textbookStudentClaim)) {
|
|
|
+ vo.setTextbookStudentClaimId(textbookStudentClaim.getId());
|
|
|
+ vo.setIsClaim(textbookStudentClaim.getIsClaim());
|
|
|
+ vo.setPrice(textbookStudentClaim.getPrice());
|
|
|
+ } else {
|
|
|
+ vo.setIsClaim(0);
|
|
|
+ vo.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
categoryTotalPrice = categoryTotalPrice.add(vo.getPrice().multiply(BigDecimal.valueOf(vo.getClaimNum())));
|
|
|
totalPrice = totalPrice.add(vo.getPrice().multiply(BigDecimal.valueOf(vo.getClaimNum())));
|
|
|
}
|
|
|
@@ -512,9 +517,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
.collect(Collectors.toList()); // 转换为 List
|
|
|
|
|
|
for(Long textbookId : mergedKeyList){
|
|
|
- StudentSemesterTextbookVo studentClaimVo = studentClaimSemesterMap.get(textbookId);
|
|
|
- // 当教材没有确认领取记录的时候当前学期状态应该是待领取
|
|
|
- if(ObjectUtils.isEmpty(studentClaimVo)){
|
|
|
+ if(ObjectUtils.isEmpty(studentClaimSemesterMap) || ObjectUtils.isEmpty(studentClaimSemesterMap.get(textbookId))){
|
|
|
status = 1;
|
|
|
break;
|
|
|
}
|
|
|
@@ -820,6 +823,22 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Map<String, TextbookStudentClaim> byUserIdAndTextbookId = textbookStudentClaimList.stream()
|
|
|
.collect(Collectors.toMap(t -> "" + t.getStudentUserId() + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
+ // 处理确认领取教材的价格
|
|
|
+ // 根据学期,班级获取申领教材信息
|
|
|
+ MPJLambdaWrapper<WfTextbookClaim> wfTextbookClaimLambdaQueryWrapper = new MPJLambdaWrapper<>();
|
|
|
+ wfTextbookClaimLambdaQueryWrapper
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, ClassClaimTextbookIssuePrice::getTextbookId)
|
|
|
+ .selectAs(TextbookWarehouseRecord::getSubtotal, ClassClaimTextbookIssuePrice::getPrice)
|
|
|
+ .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
|
|
|
+ .innerJoin(TextbookIssueRecord.class, TextbookIssueRecord::getDataItemId, WfTextbookClaimItem::getId)
|
|
|
+ .innerJoin(TextbookWarehouseRecord.class, TextbookWarehouseRecord::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .eq(WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(WfTextbookClaim::getClassId, dto.getClassId())
|
|
|
+ ;
|
|
|
+ List<ClassClaimTextbookIssuePrice> classClaimTextbookIssuePrices = wfTextbookClaimMapper.selectJoinList(ClassClaimTextbookIssuePrice.class, wfTextbookClaimLambdaQueryWrapper);
|
|
|
+
|
|
|
+ Map<Long, BigDecimal> textBookPriceMap = classClaimTextbookIssuePrices.stream()
|
|
|
+ .collect(Collectors.toMap(ClassClaimTextbookIssuePrice::getTextbookId, ClassClaimTextbookIssuePrice::getPrice, (p1, p2) -> p2));
|
|
|
|
|
|
List<TextbookStudentClaim> insertList = new ArrayList<>();
|
|
|
List<TextbookStudentClaim> updateList = new ArrayList<>();
|
|
|
@@ -830,13 +849,26 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
for (Long textbookId : dto.getTextbookIds()) {
|
|
|
for (Long userId : dto.getUserIds()) {
|
|
|
+ BigDecimal price = BigDecimal.ZERO;
|
|
|
+ if(MapUtils.isNotEmpty(textBookPriceMap) && ObjectUtils.isNotEmpty(textBookPriceMap.get(textbookId))){
|
|
|
+ price = textBookPriceMap.get(textbookId);
|
|
|
+ }
|
|
|
oldTextbookStudentClaim = byUserIdAndTextbookId.get("" + userId + textbookId);
|
|
|
- if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)
|
|
|
+ && (ObjectUtils.isEmpty(oldTextbookStudentClaim.getClaimSource()) || oldTextbookStudentClaim.getClaimSource() != 1)
|
|
|
+ ) {
|
|
|
updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
updateTextbookStudentClaim.setId(oldTextbookStudentClaim.getId());
|
|
|
updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ updateTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ updateTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ updateTextbookStudentClaim.setClaimSource(2);
|
|
|
updateList.add(updateTextbookStudentClaim);
|
|
|
} else {
|
|
|
insertTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
@@ -847,6 +879,13 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
insertTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
insertTextbookStudentClaim.setCreateDate(nowDate);
|
|
|
insertTextbookStudentClaim.setCreateUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ insertTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ insertTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ insertTextbookStudentClaim.setClaimSource(2);
|
|
|
insertList.add(insertTextbookStudentClaim);
|
|
|
}
|
|
|
}
|
|
|
@@ -903,6 +942,25 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Map<String, TextbookStudentClaim> byUserIdAndTextbookId = textbookStudentClaimList.stream()
|
|
|
.collect(Collectors.toMap(t -> "" + t.getBaseSemesterId() + t.getClassId() + t.getStudentUserId() + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
+ Map<Long, TextbookStudentClaim> byClaimSource = textbookStudentClaimList.stream()
|
|
|
+ .collect(Collectors.toMap(TextbookStudentClaim::getId , t -> t, (t1, t2) -> t1));
|
|
|
+
|
|
|
+ // 根据学期,班级获取申领教材信息
|
|
|
+ MPJLambdaWrapper<WfTextbookClaim> wfTextbookClaimLambdaQueryWrapper = new MPJLambdaWrapper<>();
|
|
|
+ wfTextbookClaimLambdaQueryWrapper
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, ClassClaimTextbookIssuePrice::getTextbookId)
|
|
|
+ .selectAs(TextbookWarehouseRecord::getSubtotal, ClassClaimTextbookIssuePrice::getPrice)
|
|
|
+ .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
|
|
|
+ .innerJoin(TextbookIssueRecord.class, TextbookIssueRecord::getDataItemId, WfTextbookClaimItem::getId)
|
|
|
+ .innerJoin(TextbookWarehouseRecord.class, TextbookWarehouseRecord::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .in(WfTextbookClaim::getBaseSemesterId, baseSemesterIds)
|
|
|
+ .in(WfTextbookClaim::getClassId, classIds)
|
|
|
+ ;
|
|
|
+
|
|
|
+ List<ClassClaimTextbookIssuePrice> classClaimTextbookIssuePrices = wfTextbookClaimMapper.selectJoinList(ClassClaimTextbookIssuePrice.class, wfTextbookClaimLambdaQueryWrapper);
|
|
|
+
|
|
|
+ Map<Long, BigDecimal> textBookPriceMap = classClaimTextbookIssuePrices.stream()
|
|
|
+ .collect(Collectors.toMap(ClassClaimTextbookIssuePrice::getTextbookId, ClassClaimTextbookIssuePrice::getPrice, (p1, p2) -> p2));
|
|
|
|
|
|
List<TextbookStudentClaim> insertList = new ArrayList<>();
|
|
|
List<TextbookStudentClaim> updateList = new ArrayList<>();
|
|
|
@@ -912,21 +970,46 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Date nowDate = new Date();
|
|
|
Long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
for (TeacherConfirmDto dto : dtos) {
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getTextbookStudentClaimId()) && dto.getTextbookStudentClaimId() != 0) {
|
|
|
- updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
- updateTextbookStudentClaim.setId(dto.getTextbookStudentClaimId());
|
|
|
- updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
- updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
- updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
- updateList.add(updateTextbookStudentClaim);
|
|
|
+ BigDecimal price = BigDecimal.ZERO;
|
|
|
+ if(MapUtils.isNotEmpty(textBookPriceMap) && ObjectUtils.isNotEmpty(textBookPriceMap.get(dto.getTextbookId()))){
|
|
|
+ price = textBookPriceMap.get(dto.getTextbookId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(dto.getTextbookStudentClaimId())
|
|
|
+ && dto.getTextbookStudentClaimId() != 0) {
|
|
|
+ oldTextbookStudentClaim = byClaimSource.get(dto.getTextbookStudentClaimId());
|
|
|
+ if(ObjectUtils.isNotEmpty(oldTextbookStudentClaim)
|
|
|
+ && (ObjectUtils.isEmpty(oldTextbookStudentClaim.getClaimSource()) || oldTextbookStudentClaim.getClaimSource() != 1)) {
|
|
|
+ updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ updateTextbookStudentClaim.setId(dto.getTextbookStudentClaimId());
|
|
|
+ updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
+ updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
+ if (dto.getIsClaim() == 0) {
|
|
|
+ updateTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (dto.getIsClaim() == 1) {
|
|
|
+ updateTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ updateTextbookStudentClaim.setClaimSource(2);
|
|
|
+ updateList.add(updateTextbookStudentClaim);
|
|
|
+ }
|
|
|
} else {
|
|
|
oldTextbookStudentClaim = byUserIdAndTextbookId.get("" + dto.getBaseSemesterId() + dto.getClassId() + dto.getStudentUserId() + dto.getTextbookId());
|
|
|
- if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)
|
|
|
+ && (ObjectUtils.isEmpty(oldTextbookStudentClaim.getClaimSource()) || oldTextbookStudentClaim.getClaimSource() != 1)
|
|
|
+ ) {
|
|
|
updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
updateTextbookStudentClaim.setId(oldTextbookStudentClaim.getId());
|
|
|
updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ updateTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ updateTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ updateTextbookStudentClaim.setClaimSource(2);
|
|
|
updateList.add(updateTextbookStudentClaim);
|
|
|
} else {
|
|
|
insertTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
@@ -937,6 +1020,13 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
insertTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
insertTextbookStudentClaim.setCreateDate(nowDate);
|
|
|
insertTextbookStudentClaim.setCreateUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ insertTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ insertTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ insertTextbookStudentClaim.setClaimSource(2);
|
|
|
insertList.add(insertTextbookStudentClaim);
|
|
|
}
|
|
|
}
|
|
|
@@ -994,6 +1084,25 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Map<String, TextbookStudentClaim> byUserIdAndTextbookId = textbookStudentClaimList.stream()
|
|
|
.collect(Collectors.toMap(t -> "" + t.getStudentUserId() + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
+ Map<Long, TextbookStudentClaim> byClaimSource = textbookStudentClaimList.stream()
|
|
|
+ .collect(Collectors.toMap(TextbookStudentClaim::getId , t -> t, (t1, t2) -> t1));
|
|
|
+
|
|
|
+ // 根据学期,班级获取申领教材信息
|
|
|
+ MPJLambdaWrapper<WfTextbookClaim> wfTextbookClaimLambdaQueryWrapper = new MPJLambdaWrapper<>();
|
|
|
+ wfTextbookClaimLambdaQueryWrapper
|
|
|
+ .selectAs(WfTextbookClaimItem::getTextbookId, ClassClaimTextbookIssuePrice::getTextbookId)
|
|
|
+ .selectAs(TextbookWarehouseRecord::getSubtotal, ClassClaimTextbookIssuePrice::getPrice)
|
|
|
+ .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
|
|
|
+ .innerJoin(TextbookIssueRecord.class, TextbookIssueRecord::getDataItemId, WfTextbookClaimItem::getId)
|
|
|
+ .innerJoin(TextbookWarehouseRecord.class, TextbookWarehouseRecord::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .eq(WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(WfTextbookClaim::getClassId, baseStudentSchoolRoll.getClassId())
|
|
|
+ ;
|
|
|
+ List<ClassClaimTextbookIssuePrice> classClaimTextbookIssuePrices = wfTextbookClaimMapper.selectJoinList(ClassClaimTextbookIssuePrice.class, wfTextbookClaimLambdaQueryWrapper);
|
|
|
+
|
|
|
+ Map<Long, BigDecimal> textBookPriceMap = classClaimTextbookIssuePrices.stream()
|
|
|
+ .collect(Collectors.toMap(ClassClaimTextbookIssuePrice::getTextbookId, ClassClaimTextbookIssuePrice::getPrice, (p1, p2) -> p2));
|
|
|
+
|
|
|
List<TextbookStudentClaim> insertList = new ArrayList<>();
|
|
|
List<TextbookStudentClaim> updateList = new ArrayList<>();
|
|
|
TextbookStudentClaim oldTextbookStudentClaim;
|
|
|
@@ -1002,21 +1111,45 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Date nowDate = new Date();
|
|
|
Long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
for (StudentConfirmDetailDto studentConfirmDetailDto : dto.getStudentConfirmDetail()) {
|
|
|
- if (ObjectUtils.isNotEmpty(studentConfirmDetailDto.getTextbookStudentClaimId()) && studentConfirmDetailDto.getTextbookStudentClaimId() != 0) {
|
|
|
- updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
- updateTextbookStudentClaim.setId(studentConfirmDetailDto.getTextbookStudentClaimId());
|
|
|
- updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
- updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
- updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
- updateList.add(updateTextbookStudentClaim);
|
|
|
+ BigDecimal price = BigDecimal.ZERO;
|
|
|
+ if(MapUtils.isNotEmpty(textBookPriceMap) && ObjectUtils.isNotEmpty(textBookPriceMap.get(studentConfirmDetailDto.getTextbookId()))){
|
|
|
+ price = textBookPriceMap.get(studentConfirmDetailDto.getTextbookId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(studentConfirmDetailDto.getTextbookStudentClaimId())
|
|
|
+ && studentConfirmDetailDto.getTextbookStudentClaimId() != 0
|
|
|
+ ) {
|
|
|
+ oldTextbookStudentClaim = byClaimSource.get(studentConfirmDetailDto.getTextbookStudentClaimId());
|
|
|
+ if(ObjectUtils.isNotEmpty(oldTextbookStudentClaim)
|
|
|
+ && (ObjectUtils.isEmpty(oldTextbookStudentClaim.getClaimSource()) || oldTextbookStudentClaim.getClaimSource() != 1)){
|
|
|
+ updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ updateTextbookStudentClaim.setId(studentConfirmDetailDto.getTextbookStudentClaimId());
|
|
|
+ updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
+ updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ updateTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ updateTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ updateTextbookStudentClaim.setClaimSource(2);
|
|
|
+ updateList.add(updateTextbookStudentClaim);
|
|
|
+ }
|
|
|
} else {
|
|
|
oldTextbookStudentClaim = byUserIdAndTextbookId.get("" + baseStudentSchoolRoll.getUserId() + studentConfirmDetailDto.getTextbookId());
|
|
|
- if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim) && (ObjectUtils.isEmpty(oldTextbookStudentClaim.getClaimSource()) || oldTextbookStudentClaim.getClaimSource() != 1)) {
|
|
|
updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
updateTextbookStudentClaim.setId(oldTextbookStudentClaim.getId());
|
|
|
updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ updateTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ updateTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ updateTextbookStudentClaim.setClaimSource(2);
|
|
|
updateList.add(updateTextbookStudentClaim);
|
|
|
} else {
|
|
|
insertTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
@@ -1027,6 +1160,13 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
insertTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
insertTextbookStudentClaim.setCreateDate(nowDate);
|
|
|
insertTextbookStudentClaim.setCreateUserId(loginUserId);
|
|
|
+ if(dto.getIsClaim() == 0){
|
|
|
+ insertTextbookStudentClaim.setPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(dto.getIsClaim() == 1){
|
|
|
+ insertTextbookStudentClaim.setPrice(price);
|
|
|
+ }
|
|
|
+ insertTextbookStudentClaim.setClaimSource(2);
|
|
|
insertList.add(insertTextbookStudentClaim);
|
|
|
}
|
|
|
}
|
|
|
@@ -1044,7 +1184,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|