|
@@ -17,6 +17,7 @@ import org.apache.commons.lang.time.DateUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -784,4 +785,76 @@ public class RiceService {
|
|
|
LocalDateTime localDateTime = LocalDateTime.of(localDate, LocalTime.MAX);
|
|
LocalDateTime localDateTime = LocalDateTime.of(localDate, LocalTime.MAX);
|
|
|
return localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
return localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 定时任务
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //@Scheduled(cron = "0 * * * * ?")
|
|
|
|
|
+ @Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
|
+ public void resetExchangeCount() {
|
|
|
|
|
+ List<Rice> riceList = riceRepo.findAll();
|
|
|
|
|
+ for (Rice rice : riceList) {
|
|
|
|
|
+ rice.setExchangeCount(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ riceRepo.saveAll(riceList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
|
+ public void resetInviteCount() {
|
|
|
|
|
+ List<Rice> riceList = riceRepo.findAll();
|
|
|
|
|
+ for (Rice rice : riceList) {
|
|
|
|
|
+ rice.setInviteCount(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ riceRepo.saveAll(riceList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
|
+ public void resetHelpCount() {
|
|
|
|
|
+ List<Rice> riceList = riceRepo.findAll();
|
|
|
|
|
+ for (Rice rice : riceList) {
|
|
|
|
|
+ rice.setHelpCount(0L);
|
|
|
|
|
+ }
|
|
|
|
|
+ riceRepo.saveAll(riceList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //@Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
|
+ @Scheduled(cron = "0 * * * * ?")
|
|
|
|
|
+ public void resetEarnPointsEveryDay() {
|
|
|
|
|
+ List<Rice> riceList = riceRepo.findAll();
|
|
|
|
|
+ for (Rice rice : riceList) {
|
|
|
|
|
+ rice.setEarnPointsEveryDay(0L);
|
|
|
|
|
+ }
|
|
|
|
|
+ riceRepo.saveAll(riceList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //@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 0 0 * * ?")
|
|
|
|
|
+ @Scheduled(cron = "0 * * * * ?")
|
|
|
|
|
+ public void resetTestI() {
|
|
|
|
|
+ List<Rice> riceList = riceRepo.findAll();
|
|
|
|
|
+ for (Rice rice : riceList) {
|
|
|
|
|
+ rice.setTestI(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ riceRepo.saveAll(riceList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|