diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index dcac2a8d9b..0b57fcbb9f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -1,7 +1,7 @@ package com.epmet.redis; -import cn.hutool.json.JSONUtil; + import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; @@ -10,7 +10,6 @@ import com.epmet.constant.BadgeConstant; import com.epmet.constant.UserRedisKeys; import com.epmet.dao.BadgeDao; import com.epmet.dto.form.UserBadgeUnitFormDTO; -import com.epmet.dto.result.BadgeListResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.service.UserBadgeService; import lombok.extern.slf4j.Slf4j; @@ -130,9 +129,8 @@ public class UserBadgeRedis { Object badgeObj = getCustomerBadge(customerId); List badgePool = - null == badgeObj ? null : - Optional.ofNullable(JSON.parseArray(badgeObj.toString(), UserBadgeListResultDTO.class)) - .orElse(badgeDao.selectCustomerBadgePool(customerId)); + null == badgeObj ? badgeDao.selectCustomerBadgePool(customerId) : JSON.parseArray(badgeObj.toString(), UserBadgeListResultDTO.class); + if (CollectionUtils.isEmpty(badgePool)) { log.error("com.epmet.redis.UserBadgeRedis.pushOrRemoveUserBadge4List,缓存中客户{}下的徽章池为空", customerId); return NumConstant.ZERO;