Commit f3e26f73 authored by 华润's avatar 华润

跨省单位开户公积金服务接口

parent 833b3b27
...@@ -7,20 +7,15 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -7,20 +7,15 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static net.cdkj.gjj.adapter.domain.GzipUtil.unzipString; import static net.cdkj.gjj.adapter.domain.GzipUtil.unzipString;
import static net.cdkj.gjj.adapter.domain.GzipUtil.zipString; import static net.cdkj.gjj.adapter.domain.GzipUtil.zipString;
...@@ -54,27 +49,21 @@ public class ProvidentFundServicesController { ...@@ -54,27 +49,21 @@ public class ProvidentFundServicesController {
} }
String str = json.toString(); String str = json.toString();
System.out.println("内置机传给前置机的json数据:"+json.toString()); System.out.println("内置机传给前置机的公积金系统服务json数据:"+json.toString());
//----------------------------------------------------- //-----------------------------------------------------
String token = null; String token = null;
token = huoqutoken();//调用获取token的方法 token = huoqutoken();//调用获取token的方法
// JSONObject jsonObject = new JSONObject(); // System.out.println("内置机传给前置机的json数据:"+str);
// jsonObject.put("startTime", currenttime(0)); System.out.println("zip压缩处理之前要发送给第三方的公积金系统服务报文:" + str);
// jsonObject.put("endTime", currenttime(24)); // String s = zipString(str);//进行zip压缩
// jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186"); // System.out.println("zip压缩处理之后发送给第三方的公积金系统服务报文:" + s);
// jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
// String str = jsonObject.toString();
// String str = jsonstr;
System.out.println("zip压缩处理之前要发送给第三方的报文:" + str);
String s = zipString(str);//进行zip压缩
System.out.println("zip压缩处理之后发送给第三方的报文:" + s);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
HttpURLConnection conn = null; HttpURLConnection conn = null;
OutputStream out = null; OutputStream out = null;
try { try {
// 创建url 资源 // 创建url 资源
// URL url = new URL("https://scjg.hubei.gov.cn/sjzt/api/dx/e39a08e0a52b413897f9d23359540b27/GJJ?access_token="+token);//正式第三方地址 URL url = new URL("http://59.208.149.225:18080/sjzt/api/dx/e39a08e0a52b413897f9d23359540b27/GJJ?access_token="+token);//正式第三方地址
URL url = new URL("http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices2?access_token=" + token);//测试第三方地址 // URL url = new URL("http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices2?access_token=" + token);//测试第三方地址
// 创建http 连接 // 创建http 连接
conn = (HttpURLConnection) url.openConnection(); conn = (HttpURLConnection) url.openConnection();
// 设置允许输出 // 设置允许输出
...@@ -92,7 +81,7 @@ public class ProvidentFundServicesController { ...@@ -92,7 +81,7 @@ public class ProvidentFundServicesController {
// 设置文件字符集: // 设置文件字符集:
conn.setRequestProperty("Charset", "UTF-8"); conn.setRequestProperty("Charset", "UTF-8");
// 转换为字节数组 // 转换为字节数组
byte[] data = (s).getBytes("UTF-8"); byte[] data = (str).getBytes("UTF-8");
// 设置文件长度 // 设置文件长度
conn.setRequestProperty("Content-Length", String.valueOf(data.length)); conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 开始连接请求 // 开始连接请求
...@@ -110,9 +99,9 @@ public class ProvidentFundServicesController { ...@@ -110,9 +99,9 @@ public class ProvidentFundServicesController {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println("第三方返回的zip压缩过的报文:" + sb.toString()); System.out.println("公积金服务第三方返回的zip压缩过的报文:" + sb.toString());
String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩 String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩
System.out.println("第三方返回的zip解压缩之后的报文:" + s1); System.out.println("公积金服务第三方返回的zip解压缩之后的报文:" + s1);
return s1; return s1;
} else { } else {
System.out.println("请求失败!!!"); System.out.println("请求失败!!!");
...@@ -131,7 +120,6 @@ public class ProvidentFundServicesController { ...@@ -131,7 +120,6 @@ public class ProvidentFundServicesController {
conn.disconnect(); conn.disconnect();
} }
} }
return null; return null;
} }
...@@ -157,9 +145,9 @@ public class ProvidentFundServicesController { ...@@ -157,9 +145,9 @@ public class ProvidentFundServicesController {
System.out.println(e.toString()); System.out.println(e.toString());
} }
String str1 = json.toString(); String str1 = json.toString();
System.out.println("第三方接收的参数解压之前"+str1); System.out.println("第三方接收的公积金服务接口参数解压之前"+str1);
String str2 = unzipString(str1);//解压缩 String str2 = unzipString(str1);//解压缩
System.out.println("第三方接收的参数解压之后"+str2); System.out.println("第三方接收的公积金服务接口参数解压之后"+str2);
//----------------------------------------------------- //-----------------------------------------------------
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0); jsonObject.put("code", 0);
...@@ -167,9 +155,9 @@ public class ProvidentFundServicesController { ...@@ -167,9 +155,9 @@ public class ProvidentFundServicesController {
List<UnitAccountOpeningInformation> list = new ArrayList<>(); List<UnitAccountOpeningInformation> list = new ArrayList<>();
UnitAccountOpeningInformation openingInformation = new UnitAccountOpeningInformation(); UnitAccountOpeningInformation openingInformation = new UnitAccountOpeningInformation();
openingInformation.setBusId("332090890"); openingInformation.setBusId("332090890");
openingInformation.setUscc("914205007146987789"); openingInformation.setUscc("914205007146987888");
openingInformation.setEntName("湖北稻花香酒业股份有限公司(华润测试)"); openingInformation.setEntName("湖北稻花香酒业股份有限公司(华润测试)");
openingInformation.setDom("湖北省宜昌市龙泉镇圣诞快乐房价数量的方式独立开发huahua7789"); openingInformation.setDom("湖北省宜昌市龙泉镇圣诞快乐房价数量的方式独立开发huahua7888");
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
openingInformation.setEstDate(new Date()); openingInformation.setEstDate(new Date());
openingInformation.setLerep("蔡开云"); openingInformation.setLerep("蔡开云");
...@@ -188,9 +176,9 @@ public class ProvidentFundServicesController { ...@@ -188,9 +176,9 @@ public class ProvidentFundServicesController {
//------------------------------------- //-------------------------------------
UnitAccountOpeningInformation openingInformation2 = new UnitAccountOpeningInformation(); UnitAccountOpeningInformation openingInformation2 = new UnitAccountOpeningInformation();
openingInformation2.setBusId("332090891"); openingInformation2.setBusId("332090891");
openingInformation2.setUscc("914205007146987790"); openingInformation2.setUscc("914205007146987889");
openingInformation2.setEntName("湖北稻花香酒业股份有限公司(华润测试)"); openingInformation2.setEntName("湖北稻花香酒业股份有限公司(华润测试)");
openingInformation2.setDom("湖北省宜昌市龙泉镇圣诞快乐房价数量的方式独立开发huahua7790"); openingInformation2.setDom("湖北省宜昌市龙泉镇圣诞快乐房价数量的方式独立开发huahua7889");
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
openingInformation2.setEstDate(new Date()); openingInformation2.setEstDate(new Date());
openingInformation2.setLerep("蔡开云"); openingInformation2.setLerep("蔡开云");
...@@ -355,27 +343,20 @@ public class ProvidentFundServicesController { ...@@ -355,27 +343,20 @@ public class ProvidentFundServicesController {
} }
String str = json.toString(); String str = json.toString();
System.out.println(json.toString()); System.out.println("内置机传给前置机的进度接口参数json数据"+json.toString());
//----------------------------------------------------- //-----------------------------------------------------
String token = null; String token = null;
token = huoqutoken();//调用获取token的方法 token = huoqutoken();//调用获取token的方法
// JSONObject jsonObject = new JSONObject(); System.out.println("zip压缩处理之前要发送给第三方的进度参数报文:" + str);
// jsonObject.put("startTime", currenttime(0)); // String s = zipString(str);//进行zip压缩
// jsonObject.put("endTime", currenttime(24)); // System.out.println("zip压缩处理之后发送给第三方的进度参数报文:" + s);
// jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
// jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
// String str = jsonObject.toString();
// String str = jsonstr;
System.out.println("zip压缩处理之前要发送给第三方的报文:" + str);
String s = zipString(str);//进行zip压缩
System.out.println("zip压缩处理之后发送给第三方的报文:" + s);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
HttpURLConnection conn = null; HttpURLConnection conn = null;
OutputStream out = null; OutputStream out = null;
try { try {
// 创建url 资源 // 创建url 资源
// URL url = new URL("https://scjg.hubei.gov.cn/sjzt/api/testretGjjProgData?access_token="+token);//正式第三方地址 URL url = new URL("http://59.208.149.225:18080/sjzt/api/testretGjjProgData?access_token="+token);//正式第三方地址
URL url = new URL("http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing2?access_token=" + token);//测试第三方地址 // URL url = new URL("http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing2?access_token=" + token);//测试第三方地址
// 创建http 连接 // 创建http 连接
conn = (HttpURLConnection) url.openConnection(); conn = (HttpURLConnection) url.openConnection();
// 设置允许输出 // 设置允许输出
...@@ -411,9 +392,9 @@ public class ProvidentFundServicesController { ...@@ -411,9 +392,9 @@ public class ProvidentFundServicesController {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println("第三方返回的zip压缩过的报文:" + sb.toString()); System.out.println("第三方返回的zip压缩过的进度结果报文:" + sb.toString());
String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩 String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩
System.out.println("第三方返回的zip解压缩之后的报文:" + s1); System.out.println("第三方返回的zip解压缩之后的进度结果报文:" + s1);
return s1; return s1;
} else { } else {
System.out.println("请求失败!!!"); System.out.println("请求失败!!!");
...@@ -446,7 +427,7 @@ public class ProvidentFundServicesController { ...@@ -446,7 +427,7 @@ public class ProvidentFundServicesController {
@PostMapping("BusinessProcessing2") @PostMapping("BusinessProcessing2")
public String BusinessProcessing2() { public String BusinessProcessing2() {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("success", "false"); jsonObject.put("success", "true");
jsonObject.put("msg", "系统内部错误"); jsonObject.put("msg", "系统内部错误");
String str = jsonObject.toString(); String str = jsonObject.toString();
String s = zipString(str);//进行zip压缩 String s = zipString(str);//进行zip压缩
......
...@@ -32,9 +32,9 @@ public class TokenAcquisitionController { ...@@ -32,9 +32,9 @@ public class TokenAcquisitionController {
jsonObject.put("grant_type", "ip"); jsonObject.put("grant_type", "ip");
jsonObject.put("userid", "gjj"); jsonObject.put("userid", "gjj");
String str = jsonObject.toString(); String str = jsonObject.toString();
System.out.println("zip压缩处理之前要发送给第三方的报文:" + str); System.out.println("鉴权参数zip压缩处理之前要发送给第三方的报文:" + str);
String s = zipString(str);//进行zip压缩 // String s = zipString(str);//进行zip压缩
System.out.println("zip压缩处理之后发送给第三方的报文:" + s); // System.out.println("鉴权参数zip压缩处理之后发送给第三方的报文:" + str);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
HttpURLConnection conn = null; HttpURLConnection conn = null;
OutputStream out = null; OutputStream out = null;
...@@ -59,7 +59,7 @@ public class TokenAcquisitionController { ...@@ -59,7 +59,7 @@ public class TokenAcquisitionController {
// 设置文件字符集: // 设置文件字符集:
conn.setRequestProperty("Charset", "UTF-8"); conn.setRequestProperty("Charset", "UTF-8");
// 转换为字节数组 // 转换为字节数组
byte[] data = (s).getBytes("UTF-8"); byte[] data = (str).getBytes("UTF-8");
// 设置文件长度 // 设置文件长度
conn.setRequestProperty("Content-Length", String.valueOf(data.length)); conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 开始连接请求 // 开始连接请求
...@@ -77,9 +77,9 @@ public class TokenAcquisitionController { ...@@ -77,9 +77,9 @@ public class TokenAcquisitionController {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println("第三方返回的zip压缩过的报文:" + sb.toString()); System.out.println("鉴权参数第三方返回的zip压缩过的报文:" + sb.toString());
String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩 String s1 = unzipString(sb.toString());//将第三方返回的压缩过的json字符串解压缩
System.out.println("第三方返回的zip解压缩之后的报文:" + s1); System.out.println("鉴权参数第三方返回的zip解压缩之后的报文:" + s1);
return s1; return s1;
} else { } else {
System.out.println("请求失败!!!"); System.out.println("请求失败!!!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment