From a57254ac8b0c147c8c321353fd26897f0b938b66 Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Mon, 17 Jun 2024 14:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E9=99=86=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../single/controller/ChiefController.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/controller/ChiefController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/controller/ChiefController.java index 30d6087..5ed0ae6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/controller/ChiefController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/controller/ChiefController.java @@ -5,6 +5,7 @@ import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.jjh.declaration.single.dto.response.ChiefResponse; import com.ruoyi.jjh.declaration.single.service.SingleLoginService; import io.swagger.annotations.Api; @@ -20,6 +21,7 @@ import javax.annotation.Resource; /** * 政务端登录 + * * @author du * @since 2024/6/4 9:53 */ @@ -44,12 +46,12 @@ public class ChiefController { @RequestParam("timestamp") String timestamp, @RequestParam("sign") String sign, @RequestParam("loginType") String loginType - ) { - String md5 = accountName+timestamp; + ) { + String md5 = accountName + timestamp; String md5Password = DigestUtils.md5DigestAsHex(md5.getBytes()); - if(md5Password.equals(sign.toLowerCase())){ + if (md5Password.equals(sign.toLowerCase())) { //政务端获取用户信息 - String url = zwUrl + "?accountName=" + accountName +"&appkey"+appkey; + String url = zwUrl + "?accountName=" + accountName + "&appkey" + appkey; HttpResponse response = HttpUtil.createGet(url).execute(); // 获取响应状态码 int statusCode = response.getStatus(); @@ -58,14 +60,13 @@ public class ChiefController { JSONObject jsonObj = JSONUtil.parseObj(responseBody); JSONObject dataObj = jsonObj.getJSONObject("data"); ChiefResponse req = JSONUtil.toBean(dataObj, ChiefResponse.class); -// req.setToken(singleLoginService.singleLogin("1","2",null,"02")); //判断几个政务端用户 return AjaxResult.success(req); } - }else { - //跳转到登录页面 + } else { + throw new ServiceException("登陆失败"); } - return null; + throw new ServiceException("登陆失败"); } }