Sfoglia il codice sorgente

fix: 修复未中奖时候,空指针的异常

seamew 1 anno fa
parent
commit
fbab236f09

File diff suppressed because it is too large
+ 275 - 19428
logs/log_all.log


BIN
logs/log_all.log.2023-03-05.0.gz


+ 2 - 1
lottery-domain/src/main/java/com/seamew/lottery/domain/strategy/service/draw/AbstractDrawBase.java

@@ -8,6 +8,7 @@ import com.seamew.lottery.domain.strategy.model.res.DrawResult;
 import com.seamew.lottery.domain.strategy.model.vo.*;
 import com.seamew.lottery.domain.strategy.service.algorithm.IDrawAlgorithm;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -94,7 +95,7 @@ public abstract class AbstractDrawBase extends DrawStrategySupport implements ID
      * @return 中奖结果
      */
     private DrawResult buildDrawResult(String uId, Long strategyId, DrawAlgorithmResult drawAlgorithmResult, StrategyBriefVO strategy) {
-        if ("-1".equals(drawAlgorithmResult.getAwardId())) {
+        if (ObjectUtils.isEmpty(drawAlgorithmResult) || "-1".equals(drawAlgorithmResult.getAwardId())) {
             log.info("执行策略抽奖完成【未中奖】,用户:{} 策略ID:{}", uId, strategyId);
             return new DrawResult(uId, strategyId, Constants.DrawState.FAIL.getCode());
         }

+ 0 - 6
lottery-infrastructure/src/main/java/com/seamew/lottery/infrastructure/util/RedisUtil.java

@@ -1,17 +1,11 @@
 package com.seamew.lottery.infrastructure.util;
 
-import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisCallback;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
 
-import javax.annotation.Resource;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Objects;
 
 /**

Some files were not shown because too many files changed in this diff