|
|
@@ -3,8 +3,12 @@ package test;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.uas.sso.ResultWrap;
|
|
|
import com.uas.sso.common.util.HttpUtil;
|
|
|
+import com.uas.sso.entity.UserSpaceView;
|
|
|
import com.uas.sso.entity.UserView;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
|
|
import static com.alibaba.fastjson.JSON.parseObject;
|
|
|
|
|
|
@@ -15,22 +19,30 @@ import static com.alibaba.fastjson.JSON.parseObject;
|
|
|
**/
|
|
|
public class Test {
|
|
|
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
- String url = "http://10.1.51.50:8081/api/user";
|
|
|
- url = url + "/info";
|
|
|
- ModelMap data = new ModelMap();
|
|
|
- data.put("userUU", 10000L);
|
|
|
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
|
|
|
- if (!res.isSuccess()) {
|
|
|
- throw new Exception(res.getContent());
|
|
|
- } else {
|
|
|
- ResultWrap result = parseObject(res.getContent(), ResultWrap.class);
|
|
|
- if (!result.isSuccess()) {
|
|
|
- throw new Exception(result.getErrMsg());
|
|
|
- } else if (result.getContent() != null) {
|
|
|
- UserView userView = JSON.parseObject(result.getContent().toString(), UserView.class);
|
|
|
- System.out.println(userView);
|
|
|
- }
|
|
|
- }
|
|
|
+// public static void main(String[] args) throws Exception {
|
|
|
+// String url = "http://10.1.51.37:3001/api/user";
|
|
|
+// if (!StringUtils.isEmpty(url)) {
|
|
|
+// url = url + "/info";
|
|
|
+// ModelMap data = new ModelMap();
|
|
|
+// data.put("userUU", 10316L);
|
|
|
+// HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
|
|
|
+// if (!res.isSuccess()) {
|
|
|
+// throw new Exception(res.getContent());
|
|
|
+// } else {
|
|
|
+// ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
|
|
|
+// if (!result.isSuccess()) {
|
|
|
+// throw new Exception(result.getErrMsg());
|
|
|
+// } else if (result.getContent() != null) {
|
|
|
+// UserView userView = JSON.parseObject(result.getContent().toString(), UserView.class);
|
|
|
+// System.out.println(userView.getName());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws UnsupportedEncodingException {
|
|
|
+ String url = "鍑虹幇寮傚父";
|
|
|
+ System.out.println(new String(url.getBytes("GBK"), "utf-8"));
|
|
|
}
|
|
|
+
|
|
|
}
|