|
|
@@ -41,6 +41,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.ForkJoinPool;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@@ -67,7 +68,7 @@ public class AssetService {
|
|
|
private RockRecordService rockRecordService;
|
|
|
private RockRecordRepo rockRecordRepo;
|
|
|
private AssetLockRepo assetLockRepo;
|
|
|
-
|
|
|
+ private UserBalanceService userBalanceService;
|
|
|
|
|
|
public Page<Asset> all(PageQuery pageQuery) {
|
|
|
Page<Asset> all = assetRepo
|
|
|
@@ -940,4 +941,19 @@ public class AssetService {
|
|
|
.duration(duration)
|
|
|
.build());
|
|
|
}
|
|
|
+
|
|
|
+ @Async
|
|
|
+ public void giveBonus() {
|
|
|
+ List<TokenHistory> list = tokenHistoryRepo.findByOperationAndCreatedAtBefore("销毁", LocalDateTime.of(2022, 7, 23, 21, 0, 0));
|
|
|
+ list.parallelStream().forEach(tokenHistory -> {
|
|
|
+ String name = assetRepo.findFirstByTokenId(tokenHistory.getTokenId()).getName();
|
|
|
+ if (Pattern.matches(".*僵尸动物园SSR #.*", name)) {
|
|
|
+ log.info("SSR奖励 {}", name);
|
|
|
+ userBalanceService.modifyBalance(tokenHistory.getFromUserId(), new BigDecimal("1000"), BalanceType.BONUS, null, false, null);
|
|
|
+ } else if (Pattern.matches(".*僵尸动物园SR #.*", name)) {
|
|
|
+ log.info("SR奖励 {}", name);
|
|
|
+ userBalanceService.modifyBalance(tokenHistory.getFromUserId(), new BigDecimal("25"), BalanceType.BONUS, null, false, null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|