|
|
@@ -98,6 +98,7 @@ public class ShowroomService {
|
|
|
}
|
|
|
showCollection.setShowroomId(show.getId());
|
|
|
showCollection.setAssetId(collection.getAssetId());
|
|
|
+ showCollection.setStatus(getStatus(collection));
|
|
|
showCollectionRepo.save(showCollection);
|
|
|
}
|
|
|
});
|
|
|
@@ -225,6 +226,7 @@ public class ShowroomService {
|
|
|
coll.setShowroomId(recordRoom.getId());
|
|
|
// 可能没有
|
|
|
coll.setAssetId(collection.getAssetId());
|
|
|
+ coll.setStatus(getStatus(collection));
|
|
|
|
|
|
showCollectionRepo.save(coll);
|
|
|
}
|
|
|
@@ -260,4 +262,26 @@ public class ShowroomService {
|
|
|
showroomRepo.save(showroom);
|
|
|
cacheService.clearShowroom();
|
|
|
}
|
|
|
+
|
|
|
+ public String getStatus(Collection collection) {
|
|
|
+ boolean salable = collection.isSalable();
|
|
|
+ LocalDateTime startTime = collection.getStartTime();
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ if (startTime.isBefore(now)) {
|
|
|
+ return "仅展示";
|
|
|
+ }
|
|
|
+ if (!salable) {
|
|
|
+ return "仅展示";
|
|
|
+ }
|
|
|
+ if (collection.getSoldOut() > 1) {
|
|
|
+ return "已售罄";
|
|
|
+ }
|
|
|
+ if (collection.isNoSoldOut()) {
|
|
|
+ return "已售罄";
|
|
|
+ }
|
|
|
+ if (collection.getSoldOut() != 1 & collection.getStock() == 0) {
|
|
|
+ return "即将售罄";
|
|
|
+ }
|
|
|
+ return "寄售中";
|
|
|
+ }
|
|
|
}
|