From e8a5205acec61a431868c9b083fb62c2f187dd34 Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期二, 12 九月 2023 18:53:59 +0800
Subject: [PATCH] 提交上海嘉定配置信息
---
src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 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..0f062fa 100644
--- a/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java
+++ b/src/main/java/com/fzzy/push/shjdjw2023/Shjdjw2023HttpClientUtil.java
@@ -1,21 +1,14 @@
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 +25,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 +68,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