Explorar o código

Merge branch 'dev' of xiongzhu/raex_back into master

xubinhui %!s(int64=2) %!d(string=hai) anos
pai
achega
ef61bad2be

+ 11 - 27
src/main/java/com/izouma/nineth/domain/Rice.java

@@ -35,16 +35,14 @@ public class Rice extends BaseEntity {
     @Searchable(mode = SearchMode.EXACT)
     private String phone;
 
-
     @ApiModelProperty("等级")
     private Long level;
 
-
     @ApiModelProperty("签到次数")
     private Long signCount;
 
     @ApiModelProperty("助力次数")
-    private Long helpCount =0L;
+    private Long helpCount = 0L;
 
     @ApiModelProperty("上次签到时间")
     private Long lastSignInTime;
@@ -59,53 +57,43 @@ public class Rice extends BaseEntity {
     private Long empiricalValue;
 
     @Column(name = "exchange_count", columnDefinition = "int(11) DEFAULT 0 COMMENT '今日已兑换次数'")
-    private int exchangeCount =0;
+    private int exchangeCount = 0;
 
     @Column(name = "Invite_count", columnDefinition = "int(11) DEFAULT 0 COMMENT '今日已邀请次数'")
     private int InviteCount = 0;
 
-
-
     @ApiModelProperty("水滴之签到")
-    private Long numberOfSingnIn=0L ;
+    private Long numberOfSingnIn = 0L;
 
     @ApiModelProperty("水滴之邀请")
-    private Long numberOfInviteFriends= 0L;
+    private Long numberOfInviteFriends = 0L;
 
     @ApiModelProperty("水滴之助力")
-    private Long numberOfHelpOthers= 0L;
+    private Long numberOfHelpOthers = 0L;
 
     @ApiModelProperty("水滴之积分兑换")
-    private Long numberOfScoreExchanged= 0L;
+    private Long numberOfScoreExchanged = 0L;
 
     @ApiModelProperty("水滴之活动")
-    private Long numberOfActivity= 0L;
-
+    private Long numberOfActivity = 0L;
 
     @ApiModelProperty("今日用户获得积分")
-    private Long earnPointsEveryDay= 0L;
-
-
-
+    private Long earnPointsEveryDay = 0L;
 
     @ApiModelProperty("测试Long")
-    private Long testL =0L;
+    private Long testL = 0L;
 
     @ApiModelProperty("测试Long")
-    private int testI =0;
-
-
-
-
+    private int testI = 0;
 
     public Long getTestL() {
         return testL == null ? 0L : testL;
     }
 
-
     public Long getEarnPointsEveryDay() {
         return earnPointsEveryDay == null ? 0L : earnPointsEveryDay;
     }
+
     public Long getNumberOfSingnIn() {
         return numberOfSingnIn == null ? 0L : numberOfSingnIn;
     }
@@ -126,7 +114,6 @@ public class Rice extends BaseEntity {
         return numberOfActivity == null ? 0L : numberOfActivity;
     }
 
-
     public Long getLevel() {
         return level == null ? 0L : level;
     }
@@ -139,7 +126,4 @@ public class Rice extends BaseEntity {
         return helpCount == null ? 0L : helpCount;
     }
 
-
-
-
 }

+ 13 - 8
src/main/java/com/izouma/nineth/service/RiceService.java

@@ -1,6 +1,7 @@
 package com.izouma.nineth.service;
 
 import com.alipay.mychain.sdk.vm.abi.datatype.Int;
+import com.izouma.nineth.annotations.RedisLock;
 import com.izouma.nineth.domain.*;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.dto.R;
@@ -17,6 +18,7 @@ import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,11 +35,13 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.ZoneOffset;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 import static com.izouma.nineth.enums.RiceWaterType.ACTIVITY_AWARD;
 
 @Service
 @AllArgsConstructor
+@EnableScheduling
 public class RiceService {
 
     private static final int                         MAX_NICKNAME_LENGTH = 6;
@@ -835,14 +839,14 @@ public class RiceService {
 
 
     //@Scheduled(cron = "0 0 0 * * ?")
-    @Scheduled(cron = "0 * * * * ?")
-    public void resetTestL() {
-        List<Rice> riceList = riceRepo.findAll();
-        for (Rice rice : riceList) {
-            rice.setTestL(0L);
-        }
-        riceRepo.saveAll(riceList);
-    }
+//    @Scheduled(cron = "0 * * * * ?")
+//    public void resetTestL() {
+//        List<Rice> riceList = riceRepo.findAll();
+//        for (Rice rice : riceList) {
+//            rice.setTestL(0L);
+//        }
+//        riceRepo.saveAll(riceList);
+//    }
 
 
 
@@ -852,6 +856,7 @@ public class RiceService {
         List<Rice> riceList = riceRepo.findAll();
         for (Rice rice : riceList) {
             rice.setTestI(0);
+            rice.setTestL(0L);
         }
         riceRepo.saveAll(riceList);
     }