From 257435ba6715180b0b6dbdebf1fb15cd5bca135f Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Fri, 4 Sep 2020 12:43:56 +0800 Subject: [PATCH] fix cache --- .../service/cuser/wx/WxCUserServiceAdapter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java index 88d6aa25d..a7e29ad36 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java @@ -1,14 +1,12 @@ package com.iformall.service.cuser.wx; -import java.util.Map; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.serializer.SerializerFeature; +import com.iformall.common.ErrorCode; import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.base.BaseCUserEntity; +import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCUserMapper; import com.iformall.service.cuser.CUserServiceApapter; @@ -24,13 +22,16 @@ public class WxCUserServiceAdapter implements CUserServiceApapter{ entity.setExpireTime(wxCUser.getExpireTime()); entity.setUserId(wxCUser.getUserId()); entity.setToken(wxCUser.getToken()); - entity.setRealUser(JSON.parseObject(JSON.toJSONString(wxCUser, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteMapNullValue), Map.class)); + entity.setRealUser(wxCUser); return entity; } @Override public BaseCUserEntity getByToken(String token) { WxCUser wxCUser = wxCUserMapper.findByToken(token); + if (null == wxCUser) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "WxCUserServiceAdapter token失效"); + } return generateBaseEntity(wxCUser); }