From 3f90ce6e85b6668141f2bf4243d2e85df52f9c3d Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 24 Feb 2021 17:03:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=9B=E5=87=BA=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/SsoServiceImpl.java | 4 ++ .../apiservice/pyld/PyldApiService.java | 49 +++++++++---------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index fc45907a5c..282108736d 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.thirdplat.apiservice.AbstractApiService; import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; +import com.epmet.commons.thirdplat.constants.PyldConstants; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; @@ -144,6 +145,9 @@ public class SsoServiceImpl implements SsoService { } catch (Exception e) { throw new RenException(e.getMessage()); } + if (thirdUser == null) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN); + } //获取用户信息 GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO(); form.setCustomerId(thirdUser.getCustomerId()); diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java index ee148fb8e0..c5bc39b88c 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java @@ -46,32 +46,29 @@ public class PyldApiService extends AbstractApiService { logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); - try { - JSONObject jsonParam = new JSONObject(); - jsonParam.put(PyldConstants.PLAT_PARAM_TOKEN, platformToken); - jsonParam.put(PyldConstants.PLAT_PARAM_MANAGEMENTKEY, PyldConstants.PLAT_PARAM_MANAGEMENTKEY_VALUE); - - String domain = pyldThirdplatProps.getDomain(); - Result result = HttpClientManager.getInstance().sendPost( - domain.concat(PyldConstants.METHOD_CHECK_LOGIN), - domain.startsWith("https://"), - jsonParam.toJSONString(), - buildHeaders()); - - logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); - - logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); - - PyldUserInfoResultDTO resultDTO = this.parseResult(result); - - ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); - userInfo.setMobile(resultDTO.getMobile()); - userInfo.setCustomerId(resultDTO.getReserved()); - return userInfo; - } catch (Exception e) { - logger.error("getUserInfoByTicket exception", e); - } - return null; + + JSONObject jsonParam = new JSONObject(); + jsonParam.put(PyldConstants.PLAT_PARAM_TOKEN, platformToken); + jsonParam.put(PyldConstants.PLAT_PARAM_MANAGEMENTKEY, PyldConstants.PLAT_PARAM_MANAGEMENTKEY_VALUE); + + String domain = pyldThirdplatProps.getDomain(); + Result result = HttpClientManager.getInstance().sendPost( + domain.concat(PyldConstants.METHOD_CHECK_LOGIN), + domain.startsWith("https://"), + jsonParam.toJSONString(), + buildHeaders()); + + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); + + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); + + PyldUserInfoResultDTO resultDTO = this.parseResult(result); + + ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); + userInfo.setMobile(resultDTO.getMobile()); + userInfo.setCustomerId(resultDTO.getReserved()); + return userInfo; + }