单点登陆修改

dongdingding
dongdingding 8 months ago
parent a76dafe03f
commit a57254ac8b

@ -5,6 +5,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult; 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.dto.response.ChiefResponse;
import com.ruoyi.jjh.declaration.single.service.SingleLoginService; import com.ruoyi.jjh.declaration.single.service.SingleLoginService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -20,6 +21,7 @@ import javax.annotation.Resource;
/** /**
* *
*
* @author du * @author du
* @since 2024/6/4 9:53 * @since 2024/6/4 9:53
*/ */
@ -44,12 +46,12 @@ public class ChiefController {
@RequestParam("timestamp") String timestamp, @RequestParam("timestamp") String timestamp,
@RequestParam("sign") String sign, @RequestParam("sign") String sign,
@RequestParam("loginType") String loginType @RequestParam("loginType") String loginType
) { ) {
String md5 = accountName+timestamp; String md5 = accountName + timestamp;
String md5Password = DigestUtils.md5DigestAsHex(md5.getBytes()); 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(); HttpResponse response = HttpUtil.createGet(url).execute();
// 获取响应状态码 // 获取响应状态码
int statusCode = response.getStatus(); int statusCode = response.getStatus();
@ -58,14 +60,13 @@ public class ChiefController {
JSONObject jsonObj = JSONUtil.parseObj(responseBody); JSONObject jsonObj = JSONUtil.parseObj(responseBody);
JSONObject dataObj = jsonObj.getJSONObject("data"); JSONObject dataObj = jsonObj.getJSONObject("data");
ChiefResponse req = JSONUtil.toBean(dataObj, ChiefResponse.class); ChiefResponse req = JSONUtil.toBean(dataObj, ChiefResponse.class);
// req.setToken(singleLoginService.singleLogin("1","2",null,"02"));
//判断几个政务端用户 //判断几个政务端用户
return AjaxResult.success(req); return AjaxResult.success(req);
} }
}else { } else {
//跳转到登录页面 throw new ServiceException("登陆失败");
} }
return null; throw new ServiceException("登陆失败");
} }
} }

Loading…
Cancel
Save