From 13404133d225ecd0f31f367d2b705ee331461612 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 20 Sep 2022 16:29:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/ThirdLoginServiceImpl.java | 14 +++++++++++++- .../com/epmet/commons/tools/redis/RedisKeys.java | 7 +++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 01c844a156..f8d40394da 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.rocketmq.messages.LoginMQMsg; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; @@ -620,6 +621,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol } //2、密码是否正确 List customerStaffList=customerStaffResult.getData(); + if (CollectionUtils.isEmpty(customerStaffList)){ + throw new EpmetException(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } //3、查询用户所有的组织信息 List customerIdList = new ArrayList<>(); //是否设置过密码 @@ -652,11 +656,19 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount())); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); } + CustomerStaffDTO customerStaffDTO = customerStaffList.get(0); + String tempKey = RedisKeys.getCustomerStaffTempKey(customerStaffDTO.getUserId()); + List redisTemp = (List)redisUtils.get(tempKey); + if (redisTemp != null){ + return redisTemp; + } StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); staffOrgFormDTO.setCustomerIdList(customerIdList); Result> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO); if(result.success()&&null!=result.getData()){ - return result.getData(); + List data = result.getData(); + redisUtils.set(tempKey,data,30*60); + return data; } logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER, diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 4d371d366f..08f7f9cb01 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -883,4 +883,11 @@ public class RedisKeys { } return rootPrefix.concat("third:customerInfo:appId:")+appId; } + + public static String getCustomerStaffTempKey(String staffId) { + if (StringUtils.isBlank(staffId)){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误"); + } + return rootPrefix.concat("gov:staff:temp:staffId:")+staffId; + } }