Explorar o código

预约流程代码优化

ouyang %!s(int64=3) %!d(string=hai) anos
pai
achega
6ffc0d1fda

+ 3 - 3
src/main/java/com/izouma/nineth/service/SubscribeService.java

@@ -24,9 +24,9 @@ public class SubscribeService {
 
 
     public void create(Subscribe record) {
     public void create(Subscribe record) {
         Collection collection = collectionRepo.findById(record.getCollectionId()).orElseThrow(new BusinessException("查无此藏品"));
         Collection collection = collectionRepo.findById(record.getCollectionId()).orElseThrow(new BusinessException("查无此藏品"));
-//        if (ObjectUtil.isEmpty(collection.getStartTime()) && ObjectUtil.isEmpty(collection.getEndTime())) {
-//            throw new BusinessException("此藏品没有开启预约");
-//        }
+        if (ObjectUtil.isEmpty(collection.getStartTime()) && ObjectUtil.isEmpty(collection.getEndTime())) {
+            throw new BusinessException("此藏品没有开启预约");
+        }
         if (!collection.getStartTime().isBefore(LocalDateTime.now())) {
         if (!collection.getStartTime().isBefore(LocalDateTime.now())) {
             throw new BusinessException("还未到预约时间");
             throw new BusinessException("还未到预约时间");
         }
         }