From 5f0eab13c93da93d8954994bc60fff5c954be8b5 Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 6 Nov 2020 10:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=B8=AD=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=8B=8B=E7=AB=A0=E5=88=99=E5=8E=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/redis/UserBadgeRedis.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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;