From 8f432dc748b977cbf7f0f80a8da4ff83569df363 Mon Sep 17 00:00:00 2001
From: 陈战涛 <chenzhantao7055@sina.com>
Date: 星期二, 09 五月 2023 20:57:15 +0800
Subject: [PATCH] 提交上海嘉定纪委-单位接口信息

---
 src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java b/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java
index bb7f07f..49eff43 100644
--- a/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java
+++ b/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java
@@ -1,21 +1,15 @@
 package com.fzzy.push.shjdjw2023;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.TypeReference;
 import com.fzzy.api.entity.ApiConfs;
 import com.fzzy.api.utils.AESUtils;
-import com.fzzy.api.utils.MyMD5Util;
-import com.fzzy.api.utils.SnowflakeIdWorker;
-import com.fzzy.push.gd2022.dto.GD2022AuthToken;
 import com.fzzy.push.gd2022.dto.GD2022ResponseDto;
+import com.fzzy.push.shjdjw2023.dto.ShjdjwRespDto;
 import lombok.extern.slf4j.Slf4j;
-
+import org.apache.commons.lang.StringUtils;
 import java.io.*;
-import java.lang.reflect.Type;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.Map;
-import java.util.UUID;
 
 /**
  * 涓婃捣鍢夊畾绾鐩戠骞冲彴-涓婁紶鏁版嵁鏈嶅姟绫�
@@ -32,16 +26,16 @@
      * @throws Exception
      */
     @SuppressWarnings("resource")
-    public static GD2022ResponseDto postPushData(String url, String data , ApiConfs apiConfs) throws Exception {
+    public static ShjdjwRespDto postPushData(String url, String data , ApiConfs apiConfs) throws Exception {
         log.info("---------鎺ュ彛璇锋眰鍦板潃锛�" +url+ "----------鍙傛暟锛�" + data +"---------");
         BufferedReader in = null;
         URL urls = new URL(url);
         HttpURLConnection connection = null;
         OutputStream outputStream = null;
         String rs = "";
-        GD2022ResponseDto responseDto;
+        ShjdjwRespDto responseDto = null;
         try {
-            String md = AESUtils.encryptByEcb(data, apiConfs.getPublicKey());
+            String md = AESUtils.encrypt(data, apiConfs.getPublicKey());
             log.info("---------鎺ュ彛璇锋眰鍦板潃锛�" +url+ "----------瀵嗘枃鍙傛暟锛�" + md +"---------");
             connection = (HttpURLConnection) urls.openConnection();
             connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
@@ -75,11 +69,17 @@
                 System.out.println("鍙戠敓寮傚父");
                 log.error(e.getMessage(),e);
                 rs = null;
-                return new GD2022ResponseDto(99,e.getMessage());
+                return new ShjdjwRespDto(99,e.getMessage());
             }
-            log.info("---------鎺ュ彛杩斿洖锛�" + rs +"---------");
-            responseDto = JSON.parseObject(rs,GD2022ResponseDto.class);
-            if(responseDto == null )   return new GD2022ResponseDto(99,"鎺ュ彛璇锋眰鍙戠敓鏈煡閿欒");
+            if(StringUtils.isNotEmpty(rs)){
+                rs = rs.replaceAll("\"", "");
+                log.info("---------鎺ュ彛杩斿洖锛岀鏂囷細" + rs +"---------");
+                rs = AESUtils.decrypt(rs, apiConfs.getPublicKey());
+                log.info("---------鎺ュ彛杩斿洖锛岃В鏋愬悗锛�" + rs +"---------");
+                responseDto = JSON.parseObject(rs, ShjdjwRespDto.class);
+            }
+
+            if(responseDto == null )   return new ShjdjwRespDto(99,"鎺ュ彛璇锋眰鍙戠敓鏈煡閿欒");
             return responseDto;
         } finally {
             try {

--
Gitblit v1.9.3