tokenGainUrlGetTest.jsp 2.38 KB
<%--
  Created by IntelliJ IDEA.
  User: zhaiyaqi
  Date: 2020/3/15
  Time: 7:34 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.cntytz.HttpUtils" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>

<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    response.setContentType("application/json;charset=utf-8");
    out.clear();
    writeLog("【the start interface ....】:");
    JSONObject result = new JSONObject(true);
    User user = HrmUserVarify.getUser(request,response);
    String url = request.getParameter("url");
    writeLog("【the start interface ....】url={}"+url);
    String oAUrl = request.getParameter("oAUrl");
    writeLog("【the start interface ....】oAUrl={}"+oAUrl);
    JSONObject json = new JSONObject();
    String loginid ="";
    writeLog("user=========================" + JSONObject.toJSONString(user));
    try {
        loginid = user.getLoginid();
        //正式
//        String tokenGainurl = "https://ty.cntytz.com/uasSign/sign/authentication";
        //测试
        String tokenGainurl = "http://192.168.150.192:28879/uasSign/sign/authentication";
        writeLog("json =============url " + url);
        json.put("url",url);
        json.put("oAUrl",oAUrl);
        json.put("userLoginName",loginid);
        writeLog("json =============url " + JSONObject.toJSONString(json));
        JSONObject jsonObject = HttpUtils.doPost(tokenGainurl, json);
        writeLog("===================="+jsonObject);
        String url1 = jsonObject.get("url").toString();
        writeLog("===================="+url1);
        response.sendRedirect(url1);
    } catch (Exception e) {
        result.put("code", -1);
        result.put("message", "用户信息不完善,请联系管理员进一步完善,谢谢");
        out.print("用户信息不完善,请联系管理员进一步完善,谢谢");
        return;
    }
    out.print(result.toJSONString());
%>
<%!
    private void writeLog(Object o) {
        Log var3 = LogFactory.getLog(this.getClass().getName());
        if(o instanceof Exception) {
            var3.info(this.getClass().getName(), (Exception)o);
        } else {
            var3.info(o);
        }
    }

%>