|
|
@@ -2,10 +2,7 @@ package com.uas.eis.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.uas.eis.dao.BaseDao;
|
|
|
-import com.uas.eis.utils.BaseUtil;
|
|
|
-import com.uas.eis.utils.HttpUtil;
|
|
|
-import com.uas.eis.utils.JacksonUtil;
|
|
|
-import com.uas.eis.utils.RedisUtil;
|
|
|
+import com.uas.eis.utils.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -15,8 +12,11 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import sun.misc.BASE64Decoder;
|
|
|
+import sun.misc.BASE64Encoder;
|
|
|
|
|
|
import java.net.Socket;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
@@ -37,6 +37,8 @@ public class TestController {
|
|
|
|
|
|
@Autowired
|
|
|
BaseDao baseDao;
|
|
|
+ static BASE64Encoder encoder = new BASE64Encoder();
|
|
|
+ static BASE64Decoder decoder = new BASE64Decoder();
|
|
|
|
|
|
@GetMapping(value = "/test/redis")
|
|
|
public void testJdbc(){
|
|
|
@@ -44,6 +46,36 @@ public class TestController {
|
|
|
System.out.println("redisResult11:"+redisUtils.get("redisTest").toString());
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/test/testPostInOut")
|
|
|
+ public void testPostInOut(){
|
|
|
+ try {
|
|
|
+ HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ HashMap<String, String> headParams = new HashMap<String, String>();
|
|
|
+ String timestamp = String.valueOf(System.currentTimeMillis());
|
|
|
+
|
|
|
+// String items ="{\n" +
|
|
|
+// " \"items\": [\n" +
|
|
|
+// " {\n" +
|
|
|
+// " \"actualNum\": 19995,\n" +
|
|
|
+// " \"detailNo\": 1\n" +
|
|
|
+// " }\n" +
|
|
|
+// " ]\n" +
|
|
|
+// "}";
|
|
|
+ //Base64加密
|
|
|
+// final byte[] textByte = items.getBytes("UTF-8");
|
|
|
+// final String encodedText = encoder.encode(textByte);
|
|
|
+ //请求地址+时间戳+dataURL编码+master
|
|
|
+ String urlMessage="http://10.1.80.104:8008/EIS_T/openapi/applicant/postInOutInfo.action?_timestamp="+timestamp+"&inOutId=50735442&master=XX_TEST2&dealDate=2020-06-01&items=";
|
|
|
+ //Hmac加密作为签名
|
|
|
+ String Url=urlMessage+"&_signature="+HmacUtils.encode(urlMessage);
|
|
|
+
|
|
|
+ HttpUtil.Response response = HttpUtil.sendPostRequest(Url,headParams,params,false,null);
|
|
|
+ System.out.println(response.getResponseText());
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/test/jdbc")
|
|
|
public String testJdbc(Integer id){
|
|
|
String res = "1";
|