修复空指针报错
This commit is contained in:
@@ -200,7 +200,7 @@ public class LuckyGiftRewardAdminServiceImpl implements LuckyGiftRewardAdminServ
|
||||
.eq(LuckyGiftReward::getIsDefault, Constant.Yes1No0.NO)
|
||||
.ne(id != null, LuckyGiftReward::getId, id));
|
||||
if (CollectionUtil.isNotEmpty(configs)) {
|
||||
total = configs.stream().mapToDouble(LuckyGiftReward::getRewardRate).sum();
|
||||
total = configs.stream().filter(v -> v.getRewardRate() != null).mapToDouble(LuckyGiftReward::getRewardRate).sum();
|
||||
}
|
||||
if ((total + rewardRate) > ONE_HUNDRED) {
|
||||
throw new ServiceException("中奖总概率超过100%,无法保存。");
|
||||
@@ -219,9 +219,13 @@ public class LuckyGiftRewardAdminServiceImpl implements LuckyGiftRewardAdminServ
|
||||
config.setRewardPrice(gift.getGoldPrice());
|
||||
}
|
||||
} else if (LuckyGiftRewardTypeEnum.DIAMOND.ordinal() == rewardType) {
|
||||
Long rewardValue = config.getRewardValue();
|
||||
if (rewardValue == null) {
|
||||
throw new ServiceException("所需钻石不能为空");
|
||||
}
|
||||
config.setRewardName("钻石");
|
||||
config.setRewardIcon(diamondIcon);
|
||||
config.setRewardPrice(config.getRewardValue());
|
||||
config.setRewardPrice(rewardValue);
|
||||
}
|
||||
if (id == null) {
|
||||
config.setCreateTime(now);
|
||||
|
Reference in New Issue
Block a user