|
|
@@ -869,18 +869,14 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
throw new MyException("征订项已经被修改,刷新重试");
|
|
|
}
|
|
|
|
|
|
- MPJLambdaWrapper<TextbookSubscription> textbookSubscriptionMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
- textbookSubscriptionMPJLambdaWrapper
|
|
|
- .select(TextbookSubscription.class, x -> VoToColumnUtil.fieldsToColumns(TextbookSubscription.class).contains(x.getProperty()))
|
|
|
- .eq(TextbookSubscriptionItem::getId, dto.getId())
|
|
|
- .innerJoin(TextbookSubscriptionItem.class, TextbookSubscriptionItem::getTextbookSubscriptionId, TextbookSubscription::getId)
|
|
|
- ;
|
|
|
+ TextbookSubscription textbookSubscription = this.getById(old.getTextbookSubscriptionId());
|
|
|
|
|
|
- TextbookSubscription textbookSubscription = this.selectJoinOne(TextbookSubscription.class, textbookSubscriptionMPJLambdaWrapper);
|
|
|
+ if(ObjectUtils.isEmpty(textbookSubscription)){
|
|
|
+ throw new MyException("征订已经被修改,刷新重试");
|
|
|
+ }
|
|
|
|
|
|
// 判断变更状态
|
|
|
int alterationType = 0;
|
|
|
- TextbookSubscription updateTotalNum = new TextbookSubscription();
|
|
|
if(!old.getStudentNum().equals(dto.getStudentNum())
|
|
|
|| !old.getTeacherNum().equals(dto.getTeacherNum())
|
|
|
){
|
|
|
@@ -891,7 +887,9 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
alterationType = 2;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 变更征订总数量
|
|
|
+ TextbookSubscription updateTotalNum = new TextbookSubscription();
|
|
|
if(ObjectUtils.isNotEmpty(textbookSubscription)){
|
|
|
updateTotalNum.setId(textbookSubscription.getId());
|
|
|
updateTotalNum.setSum((ObjectUtils.isNotEmpty(textbookSubscription.getSum()) ? textbookSubscription.getSum() : 0)
|
|
|
@@ -900,6 +898,7 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
+ ((ObjectUtils.isNotEmpty(dto.getTeacherNum()) ? dto.getTeacherNum() : 0)
|
|
|
- (ObjectUtils.isNotEmpty(old.getTeacherNum()) ? old.getTeacherNum() : 0))
|
|
|
);
|
|
|
+ updateTotalNum.setModifyDate(new Date());
|
|
|
this.updateById(updateTotalNum);
|
|
|
}
|
|
|
|