|
@@ -209,24 +209,25 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
}
|
|
|
|
|
|
//判断总发放数量是否超出该申请像的申请数量
|
|
|
- Integer stock = textbook.getStock();
|
|
|
+ Integer stock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock() ;
|
|
|
if (stock < textbookClaimItem.getConfirmNumber()) {
|
|
|
throw new MyException(textbook.getBookName() + "库存不足");
|
|
|
}
|
|
|
|
|
|
//更新教材管理中的库存数量
|
|
|
- Textbook newTextbook = new Textbook();
|
|
|
- newTextbook.setId(textbook.getId());
|
|
|
- newTextbook.setStock(stock - textbookClaimItem.getConfirmNumber());
|
|
|
- textbookService.updateById(newTextbook);
|
|
|
+ textbookService.updateById(new Textbook(){{
|
|
|
+ setId(textbook.getId());
|
|
|
+ setStock(stock - textbookClaimItem.getConfirmNumber());
|
|
|
+ }});
|
|
|
|
|
|
//TODO 增加出库记录
|
|
|
|
|
|
//更新申领项中的已经发放数量
|
|
|
- WfTextbookClaimItem newWfTextbookClaimItem = new WfTextbookClaimItem();
|
|
|
- newWfTextbookClaimItem.setId(wfTextbookClaimItem.getId());
|
|
|
- newWfTextbookClaimItem.setIssueNumber(wfTextbookClaimItem.getIssueNumber() + textbookClaimItem.getConfirmNumber());
|
|
|
- wfTextbookClaimWfTextbookClaimItemMapper.updateById(newWfTextbookClaimItem);
|
|
|
+ wfTextbookClaimWfTextbookClaimItemMapper.updateById(new WfTextbookClaimItem(){{
|
|
|
+ setId(wfTextbookClaimItem.getId());
|
|
|
+ setIssueNumber(issueNumber + textbookClaimItem.getConfirmNumber());
|
|
|
+ }});
|
|
|
+
|
|
|
|
|
|
//为班级每个学生生成领取(确认信息)认领记录
|
|
|
//查出班上的所有学生id
|