|
@@ -1,15 +1,27 @@
|
|
|
package com.fdkankan.manage.test;
|
|
|
|
|
|
+import cn.hutool.Hutool;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.manage.common.ResultData;
|
|
|
import com.fdkankan.common.util.SecurityUtil;
|
|
|
import com.fdkankan.manage.common.FilePath;
|
|
|
import com.fdkankan.manage.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage.util.Dateutils;
|
|
|
+import com.fdkankan.manage.util.RsaUtils;
|
|
|
+import org.apache.http.HttpEntity;
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
+import org.apache.http.entity.StringEntity;
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
|
@RestController
|
|
@@ -20,8 +32,24 @@ public class TestController {
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- System.out.println( SecurityUtil.MD5("E\u0005\u0015\u000EG107"));
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
+ String url = "http://192.168.0.25/service/manage/external/getByRyId";
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("ryId","13800138001");
|
|
|
+ String encipher = RsaUtils.encipher(jsonObject.toJSONString());
|
|
|
+
|
|
|
+ HttpPost httpPost = new HttpPost(url);
|
|
|
+ CloseableHttpClient client = HttpClients.createDefault();
|
|
|
+ StringEntity entity = new StringEntity(encipher,"utf-8");//解决中文乱码问题
|
|
|
+ entity.setContentEncoding("utf-8");
|
|
|
+ entity.setContentType("application/json");
|
|
|
+ httpPost.setEntity(entity);
|
|
|
+ HttpResponse response = client.execute(httpPost);
|
|
|
+ if(response.getStatusLine().getStatusCode() == 200){
|
|
|
+ HttpEntity httpEntity = response.getEntity();
|
|
|
+ String result = EntityUtils.toString(httpEntity, "utf-8");
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|