wangqifan 3 tahun lalu
induk
melakukan
9460133c08

+ 1 - 1
src/main/java/com/izouma/nineth/repo/CollectionRepo.java

@@ -148,7 +148,7 @@ public interface CollectionRepo extends JpaRepository<Collection, Long>, JpaSpec
     Integer getVipQuota(Long id);
 
 
-    List<Collection> findAllByStartTimeGreaterThanAndsAndStartTimeGreaterThanEqual(LocalDateTime startTime,LocalDateTime endTime);
+    List<Collection> findAllByStartTimeGreaterThanAndStartTimeGreaterThanEqual(LocalDateTime startTime,LocalDateTime endTime);
 
     List<Collection> findAllByEndTimeGreaterThanAndEndTimeGreaterThanEqual(LocalDateTime startTime, LocalDateTime endTime);
 

+ 11 - 6
src/main/java/com/izouma/nineth/service/scheduledTask/SubscribeTask.java

@@ -28,7 +28,7 @@ public class SubscribeTask {
     @Autowired
     private CollectionRepo collectionRepo;
     @Autowired
-    private SubscribeRepo subscribeRepo;
+    private SubscribeRepo  subscribeRepo;
 
     @Scheduled(cron = "0/5 * * * * ? *")
     public void subscriberTask() {
@@ -37,7 +37,8 @@ public class SubscribeTask {
         //获取5秒钟以后的时间
         LocalDateTime endTime = startTime.plusSeconds(5);
         //根据开始时间和结束时间去数据库把这两个时间段中 符合的预约发布时间中获取藏品
-        List<Collection> ongoingList = collectionRepo.findAllByStartTimeGreaterThanAndsAndStartTimeGreaterThanEqual(startTime, endTime);
+        List<Collection> ongoingList = collectionRepo
+                .findAllByStartTimeGreaterThanAndStartTimeGreaterThanEqual(startTime, endTime);
         //预约发布时间判断
         if (!Collections.isEmpty(ongoingList)) {
             for (Collection collection : ongoingList) {
@@ -48,7 +49,8 @@ public class SubscribeTask {
             }
         }
         //预约结束时间判断
-        List<Collection> subscribeEndingList = collectionRepo.findAllByEndTimeGreaterThanAndEndTimeGreaterThanEqual(startTime, endTime);
+        List<Collection> subscribeEndingList = collectionRepo
+                .findAllByEndTimeGreaterThanAndEndTimeGreaterThanEqual(startTime, endTime);
         if (!Collections.isEmpty(subscribeEndingList)) {
             for (Collection collection : subscribeEndingList) {
                 if (collection.getEndTime().isAfter(startTime) && collection.getEndTime().isAfter(endTime)) {
@@ -58,7 +60,8 @@ public class SubscribeTask {
             }
         }
         //进行购买资格筛选
-        List<Collection> collectionList = collectionRepo.findAllByEndTimeLessThanEqualAndPublishTimeGreaterThan(startTime, endTime);
+        List<Collection> collectionList = collectionRepo
+                .findAllByEndTimeLessThanEqualAndPublishTimeGreaterThan(startTime, endTime);
         if (!Collections.isEmpty(collectionList)) {
             for (Collection collection : collectionList) {
                 List<Subscribe> subscribeList = subscribeRepo.findAllByCollectionId(collection.getId());
@@ -79,7 +82,8 @@ public class SubscribeTask {
             }
         }
         //购买资格公布时间
-        List<Collection> announcingList = collectionRepo.findAllByPublishTimeGreaterThanAndPublishTimeGreaterThanEqual(startTime, endTime);
+        List<Collection> announcingList = collectionRepo
+                .findAllByPublishTimeGreaterThanAndPublishTimeGreaterThanEqual(startTime, endTime);
         if (!Collections.isEmpty(announcingList)) {
             for (Collection collection : announcingList) {
                 if (collection.getPublishTime().isAfter(startTime) && collection.getPublishTime().isAfter(endTime)) {
@@ -89,7 +93,8 @@ public class SubscribeTask {
             }
         }
         //购买时间
-        List<Collection> onSaleList = collectionRepo.findAllByPurchaseTimeGreaterThanAndPurchaseTimeGreaterThanEqual(startTime, endTime);
+        List<Collection> onSaleList = collectionRepo
+                .findAllByPurchaseTimeGreaterThanAndPurchaseTimeGreaterThanEqual(startTime, endTime);
         if (!Collections.isEmpty(onSaleList)) {
             for (Collection collection : onSaleList) {
                 if (collection.getPurchaseTime().isAfter(startTime) && collection.getPurchaseTime().isAfter(endTime)) {