zero 1 år sedan
förälder
incheckning
1443c0157d

+ 14 - 0
src/main/java/cn/cslg/pas/service/test/EncryptionFunctionVO.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.service.test;
+
+import lombok.Data;
+
+@Data
+public class EncryptionFunctionVO {
+
+    //权限
+    private String permission;
+
+    //加密后的权限对应的模块化代码
+    private String encryptionModuleCode;
+
+}

+ 33 - 1
src/main/java/cn/cslg/pas/service/test/PermissionService2.java

@@ -22,6 +22,38 @@ public class PermissionService2 {
     public String LogFromPCS(EncryptionLoginDTO encryptionLoginDTO) throws IOException {
         String param = new Gson().toJson(encryptionLoginDTO);
         RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        OkHttpClient okHttpClient = new OkHttpClient();
+        Request request = new Request.Builder()
+                .url("http://47.116.194.135:8085" + "/api/permission/api/admin/loginByEncryption")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
+
+    public String getPermission(String token) throws IOException {
+        String appKey = "4e95e3d926a2a4befa5d913acc0aa9f5";
+        EncryptionFunctionDTO encryptionFunctionDTO =new EncryptionFunctionDTO();
+        long currentTimeMillis = System.currentTimeMillis();
+        encryptionFunctionDTO.setCurrentTimeMillis(currentTimeMillis);
+        encryptionFunctionDTO.setAppKey(appKey);
+        String appSecret = appKey + currentTimeMillis / 1000;
+        String md5Sign = SecureUtil.md5(appSecret);
+        encryptionFunctionDTO.setSign(md5Sign);
+        String param = new Gson().toJson(encryptionFunctionDTO);
+
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        OkHttpClient okHttpClient = new OkHttpClient();
+        Request request = new Request.Builder()
+                .url("http://47.116.194.135:8085" + "/api/permission/api/admin/functionByEncryption")
+                .addHeader("Cookie", "token="+token)
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
+
+    public String LogFromPCS1(EncryptionLoginDTO encryptionLoginDTO) throws IOException {
+        String param = new Gson().toJson(encryptionLoginDTO);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
         OkHttpClient okHttpClient = new OkHttpClient.Builder()
                 .connectTimeout(60, TimeUnit.SECONDS)
                 .writeTimeout(60, TimeUnit.SECONDS)
@@ -34,7 +66,7 @@ public class PermissionService2 {
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
-    public String getPermission(String token) throws IOException {
+    public String getPermission1(String token) throws IOException {
         String appKey = "4e95e3d926a2a4befa5d913acc0aa9f5";
         EncryptionFunctionDTO encryptionFunctionDTO =new EncryptionFunctionDTO();
         long currentTimeMillis = System.currentTimeMillis();

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 59 - 22
src/test/java/cn/cslg/pas/test/TempServiceTests.java