Commit 09543827 authored by 华润's avatar 华润

代码提交内置机

parent b66bd3ed
...@@ -37,10 +37,10 @@ public class ProvidentFundServicesController { ...@@ -37,10 +37,10 @@ public class ProvidentFundServicesController {
@PostMapping("ProvidentFundServices") @PostMapping("ProvidentFundServices")
public static String ProvidentFundServices() { public static String ProvidentFundServices() {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
// jsonObject.put("startTime", currenttime(0)); jsonObject.put("startTime", currenttime(0));//正式环境
// jsonObject.put("endTime", currenttime(24)); jsonObject.put("endTime", currenttime(24));//正式环境
jsonObject.put("startTime", "20210520 00:00:00"); // jsonObject.put("startTime", "20210520 00:00:00");//测试环境
jsonObject.put("endTime", "20210520 23:00:00"); // jsonObject.put("endTime", "20210520 23:00:00");//测试环境
jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186"); jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186"); jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
String str = jsonObject.toString(); String str = jsonObject.toString();
...@@ -164,8 +164,9 @@ public class ProvidentFundServicesController { ...@@ -164,8 +164,9 @@ public class ProvidentFundServicesController {
//加载数据库驱动 //加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver");
//得到Connection连接 //得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境 // Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境 // Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.33:1596:zfgjj", "gjj80", "HG80_Y9E1C5");//正式环境
//得到预编译的Statement对象 //得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
//调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程 //调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
...@@ -361,104 +362,108 @@ public class ProvidentFundServicesController { ...@@ -361,104 +362,108 @@ public class ProvidentFundServicesController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("调第二个接口了存储过程返回的list" + list); if(!list.isEmpty()){//查到数据才请求第三方接口推送
JSONObject jsonObject = new JSONObject(); System.out.println("调第二个接口了存储过程返回的list" + list);
jsonObject.put("state", "1"); JSONObject jsonObject = new JSONObject();
if (!list.isEmpty()) { jsonObject.put("state", "1");
jsonObject.put("timestamp", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime()); if (!list.isEmpty()) {
} else { jsonObject.put("timestamp", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime());
jsonObject.put("timestamp", ""); } else {
} jsonObject.put("timestamp", "");
}
if (!list.isEmpty()) { if (!list.isEmpty()) {
jsonObject.put("busId", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getBusId()); jsonObject.put("busId", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getBusId());
} else { } else {
jsonObject.put("busId", ""); jsonObject.put("busId", "");
} }
jsonObject.put("departCode", "10"); jsonObject.put("departCode", "10");
jsonObject.put("nodeList", list); jsonObject.put("nodeList", list);
String str = jsonObject.toString(); String str = jsonObject.toString();
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("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 URL url = new URL("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接 // URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(本地环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
conn = (HttpURLConnection) url.openConnection(); // 创建http 连接
// 设置允许输出 conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true); // 设置允许输出
// 设置允许输入 conn.setDoOutput(true);
conn.setDoInput(true); // 设置允许输入
// 设置不使用缓存 conn.setDoInput(true);
conn.setUseCaches(false); // 设置不使用缓存
// 设置传递方式 conn.setUseCaches(false);
conn.setRequestMethod("POST"); // 设置传递方式
// 设置维持长连接 conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive"); // 设置维持长连接
// 设置文件类型: conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json"); // 设置文件类型:
// 设置文件字符集: conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Charset", "UTF-8"); // 设置文件字符集:
// 转换为字节数组 conn.setRequestProperty("Charset", "UTF-8");
byte[] data = (str).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));
conn.connect(); // 开始连接请求
//创建写入流,写入请求的字符串 conn.connect();
out = new DataOutputStream(conn.getOutputStream()); //创建写入流,写入请求的字符串
out.write(data); out = new DataOutputStream(conn.getOutputStream());
// 请求返回的状态 out.write(data);
if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) { // 请求返回的状态
// 请求返回的数据 if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) {
InputStream is = conn.getInputStream(); // 请求返回的数据
String readLine = new String(); InputStream is = conn.getInputStream();
BufferedReader responseReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String readLine = new String();
while ((readLine = responseReader.readLine()) != null) { BufferedReader responseReader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
sb.append(readLine); while ((readLine = responseReader.readLine()) != null) {
} sb.append(readLine);
responseReader.close(); }
System.out.println("前置机返回第三方解压之后的进度推送结果" + sb.toString()); responseReader.close();
String uscc = ""; System.out.println("前置机返回第三方解压之后的进度推送结果" + sb.toString());
if (!list.isEmpty()) { String uscc = "";
uscc = list.get(0).getUscc(); if (!list.isEmpty()) {
} else { uscc = list.get(0).getUscc();
} else {
}
System.out.println(uscc);
JSONObject jsonObj = JSONObject.parseObject(sb.toString());
String success = jsonObj.getString("success");
Integer value = 0;
if ("true".equals(success)) {
value = 1;
} else if ("false".equals(success)) {
value = 0;
}
try {
zjbmfhywtosjHX(uscc, value);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(value);
return sb.toString();
} else {
System.out.println("请求失败!!!");
} }
System.out.println(uscc); } catch (IOException e) {
JSONObject jsonObj = JSONObject.parseObject(sb.toString()); e.printStackTrace();
String success = jsonObj.getString("success"); } finally {
Integer value = 0; if (out != null) {
if ("true".equals(success)) { try {
value = 1; out.flush();
} else if ("false".equals(success)) { out.close();
value = 0; } catch (IOException e) {
} }
try {
zjbmfhywtosjHX(uscc, value);
} catch (Exception e) {
e.printStackTrace();
} }
System.out.println(value); if (conn != null) {
return sb.toString(); conn.disconnect();
} else {
System.out.println("请求失败!!!");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
} }
} }
if (conn != null) {
conn.disconnect();
}
} }
return null; return null;
} }
...@@ -475,8 +480,9 @@ public class ProvidentFundServicesController { ...@@ -475,8 +480,9 @@ public class ProvidentFundServicesController {
//加载数据库驱动 //加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver");
//得到Connection连接 //得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境 // Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境 // Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.33:1596:zfgjj", "gjj80", "HG80_Y9E1C5");//正式环境
//得到预编译的Statement对象 //得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}");
//给参数赋值 //给参数赋值
...@@ -543,8 +549,9 @@ public class ProvidentFundServicesController { ...@@ -543,8 +549,9 @@ public class ProvidentFundServicesController {
//加载数据库驱动 //加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver");
//得到Connection连接 //得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境 // Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境 // Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.33:1596:zfgjj", "gjj80", "HG80_Y9E1C5");//正式环境
//得到预编译的Statement对象 //得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}");
//给参数赋值 //给参数赋值
......
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