lyhzzz пре 2 година
родитељ
комит
9a6967a23f

+ 6 - 0
pom.xml

@@ -84,6 +84,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
       <groupId>com.alibaba.cloud</groupId>
       <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
       <version>2.2.7.RELEASE</version>

+ 0 - 16
src/main/java/com/fdkankan/manage/httpClient/client/TestClient.java

@@ -1,16 +0,0 @@
-package com.fdkankan.manage.httpClient.client;
-
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.annotation.*;
-import com.fdkankan.manage.httpClient.address.FdkkAddressSource;
-
-import java.util.HashMap;
-
-/**
- * 获取,调用4dkk服务
- */
-public interface TestClient {
-
-    @Get("/ucenter/_manage/_copy_scene")
-    JSONObject copyScene( @Query HashMap<String, Object> param ,@Header("sign") String sign);
-}

+ 1 - 0
src/main/java/com/fdkankan/manage/service/impl/JySceneAuthServiceImpl.java

@@ -39,5 +39,6 @@ public class JySceneAuthServiceImpl extends ServiceImpl<IJySceneAuthMapper, JySc
         LambdaUpdateWrapper<JySceneAuth> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(JySceneAuth::getNum,num);
         wrapper.set(JySceneAuth::getAuthType,authType);
+        this.update(wrapper);
     }
 }

+ 30 - 2
src/main/java/com/fdkankan/manage/test/TestController.java

@@ -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);
+        }
     }
 
 }

+ 13 - 0
src/test/java/com/fdkankan/manage/ManageApplicationTests.java

@@ -0,0 +1,13 @@
+package com.fdkankan.manage.test;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ManageApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}

+ 42 - 0
src/test/java/com/fdkankan/manage/test/Test1.java

@@ -0,0 +1,42 @@
+package com.fdkankan.manage.test;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.manage.common.ResultData;
+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.junit.jupiter.api.Test;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+
+public class Test1 {
+
+    @org.junit.jupiter.api.Test
+    public void test1() 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);
+        }
+    }
+
+}