|
@@ -107,21 +107,21 @@ public class TbAssetBorrowRecordServiceImpl implements ITbAssetBorrowRecordServi
|
|
|
// 判断是否已借出
|
|
|
TbAssetBorrowRecord isLentRecord = tbAssetBorrowRecordMapper.selectLentRecordByAssetId(assetId);
|
|
|
if (isLentRecord != null) {
|
|
|
- return 0;
|
|
|
+ throw new RuntimeException("资产已借出");
|
|
|
}
|
|
|
|
|
|
TbAssetInformation tbAssetInformation;
|
|
|
if (assetId != null) {
|
|
|
tbAssetInformation = assetInformationMapper.selectTbAssetInformationById(assetId);
|
|
|
if (tbAssetInformation == null) {
|
|
|
- return 0;
|
|
|
+ throw new RuntimeException("资产不存在");
|
|
|
}
|
|
|
} else {
|
|
|
String assetNumber = tbAssetBorrowRecord.getAssetNumber();
|
|
|
tbAssetInformation = assetInformationMapper.selectTbAssetInformationByAssetNumber(assetNumber);
|
|
|
|
|
|
if (tbAssetInformation == null) {
|
|
|
- return 0;
|
|
|
+ throw new RuntimeException("资产不存在");
|
|
|
}
|
|
|
tbAssetBorrowRecord.setAssetId(tbAssetInformation.getId());
|
|
|
}
|
|
@@ -160,8 +160,8 @@ public class TbAssetBorrowRecordServiceImpl implements ITbAssetBorrowRecordServi
|
|
|
// 根据资产Id判断是否已借出
|
|
|
TbAssetBorrowRecord isLentRecord = tbAssetBorrowRecordMapper.selectLentRecordByAssetId(tbAssetBorrowRecord.getAssetId());
|
|
|
// 判断是否非同一个
|
|
|
- if (!tbAssetBorrowRecord.getId().equals(isLentRecord.getId())) {
|
|
|
- return 0;
|
|
|
+ if (isLentRecord != null && !tbAssetBorrowRecord.getId().equals(isLentRecord.getId())) {
|
|
|
+ throw new RuntimeException("资产已借出");
|
|
|
}
|
|
|
|
|
|
// 已设置归还时间
|