Commit d65819ed authored by 张俊's avatar 张俊

提取配置文件

parent 4b2bf51a
......@@ -35,11 +35,14 @@ public class ProvidentFundServicesController {
private static String user;
private static String password;
private static String frontEndProcessorServer;
static {
Properties prop = PropertyqUtil.getConfig("application.properties");
url = JasyptConfig.encryptStr(PropertyqUtil.getPropValue(prop, "url"));
user = JasyptConfig.encryptStr(PropertyqUtil.getPropValue(prop, "user"));
password = JasyptConfig.encryptStr(PropertyqUtil.getPropValue(prop, "password"));
frontEndProcessorServer = PropertyqUtil.getPropValue(prop, "frontEndProcessorServer");
}
/**
......@@ -54,12 +57,12 @@ public class ProvidentFundServicesController {
Properties prop = PropertyqUtil.getConfig("application.properties");
JSONObject jsonObject = new JSONObject();
String type = PropertyqUtil.getPropValue(prop, "timetype");
if ("1".equals(type)) {//表示正式环境
jsonObject.put("startTime", currenttime(0));//正式环境
jsonObject.put("endTime", currenttime(24));//正式环境
} else if ("2".equals(type)) {//表示测试环境或本地环境
jsonObject.put("startTime", PropertyqUtil.getPropValue(prop, "startTime"));//测试环境或本地环境
jsonObject.put("endTime", PropertyqUtil.getPropValue(prop, "endTime"));//测试环境或本地环境
if ("1".equals(type)) {// 表示正式环境
jsonObject.put("startTime", currenttime(0));// 正式环境
jsonObject.put("endTime", currenttime(24));// 正式环境
} else if ("2".equals(type)) {// 表示测试环境或本地环境
jsonObject.put("startTime", PropertyqUtil.getPropValue(prop, "startTime"));// 测试环境或本地环境
jsonObject.put("endTime", PropertyqUtil.getPropValue(prop, "endTime"));// 测试环境或本地环境
}
jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
......@@ -69,7 +72,7 @@ public class ProvidentFundServicesController {
OutputStream out = null;
try {
// 创建url 资源
URL url = new URL("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices");//(测试环境地址)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
URL url = new URL(frontEndProcessorServer + "/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices");//(测试环境地址)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices");//(本地测试地址)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接
conn = (HttpURLConnection) url.openConnection();
......@@ -93,7 +96,7 @@ public class ProvidentFundServicesController {
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 开始连接请求
conn.connect();
//创建写入流,写入请求的字符串
// 创建写入流,写入请求的字符串
out = new DataOutputStream(conn.getOutputStream());
out.write(data);
// 请求返回的状态
......@@ -173,7 +176,7 @@ public class ProvidentFundServicesController {
@PostMapping("gjjxtfwjk")
public static void gjjxtfwjk() throws Exception {
Properties prop = PropertyqUtil.getConfig("application.properties");
//1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
// 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String jsoninfom = ProvidentFundServices();
System.out.println("拿到第一个接口返回的第三方数据,准备调第一个存储过程" + jsoninfom);
Json jsonentity = JSONObject.parseObject(jsoninfom, Json.class);
......@@ -181,31 +184,31 @@ public class ProvidentFundServicesController {
if (!isNullOrEmpty(jsonentity)) {
bills = jsonentity.getData();
}
//2.内置机处理返回的业务数据,调用oracle存储过程
//加载数据库驱动
// 2.内置机处理返回的业务数据,调用oracle存储过程
// 加载数据库驱动
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.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的Statement对象
Connection connection = DriverManager.getConnection(url, user, password);// 正式环境
// 得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
//调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
// 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
CallableStatement pstm2 = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_SAVE()}");
// System.out.println(""+bills);
//给参数赋值
// 给参数赋值
// pstm.getString(1);
//421102
//421121
//421122
//421123
//421124
//421125
//421126
//421127
//421181
//421182
//421101
// 421102
// 421121
// 421122
// 421123
// 421124
// 421125
// 421126
// 421127
// 421181
// 421182
// 421101
if (!bills.isEmpty()) {
for (UnitAccountOpeningInformation uniInfom : bills) {
......@@ -320,9 +323,9 @@ public class ProvidentFundServicesController {
}
pstm.registerOutParameter(19, oracle.jdbc.OracleTypes.VARCHAR);
pstm.registerOutParameter(20, oracle.jdbc.OracleTypes.VARCHAR);
//执行数据库查询操作
// 执行数据库查询操作
pstm.execute();
//输出结果[第二个参数]
// 输出结果[第二个参数]
System.out.println(pstm.getString(19));
System.out.println(pstm.getString(20));
if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) {
......@@ -343,7 +346,7 @@ public class ProvidentFundServicesController {
} else {
System.out.println("第三方返回的报文中data数据为空!");
}
//释放资源
// 释放资源
pstm.close();
pstm2.close();
connection.close();
......@@ -392,7 +395,7 @@ public class ProvidentFundServicesController {
@PostMapping("BusinessProcessing")
public static String BusinessProcessing() {
System.out.println("调第二个接口了");
//调oracle存储过程拿到进度推进的数据集合
// 调oracle存储过程拿到进度推进的数据集合
List<BusinessProcessing> list = null;
try {
list = zjbmfhywtosj();
......@@ -422,7 +425,7 @@ public class ProvidentFundServicesController {
OutputStream out = null;
try {
// 创建url 资源
URL url = new URL("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
URL url = new URL(frontEndProcessorServer + "/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(本地环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接
conn = (HttpURLConnection) url.openConnection();
......@@ -446,7 +449,7 @@ public class ProvidentFundServicesController {
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 开始连接请求
conn.connect();
//创建写入流,写入请求的字符串
// 创建写入流,写入请求的字符串
out = new DataOutputStream(conn.getOutputStream());
out.write(data);
// 请求返回的状态
......@@ -514,22 +517,22 @@ public class ProvidentFundServicesController {
@PostMapping("zjbmfhywtosj")
public static List<BusinessProcessing> zjbmfhywtosj() throws Exception {
Properties prop = PropertyqUtil.getConfig("application.properties");
//1.调用oracle存储过程,拿到业务办理进度数据
//加载数据库驱动
// 1.调用oracle存储过程,拿到业务办理进度数据
// 加载数据库驱动
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.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的Statement对象
Connection connection = DriverManager.getConnection(url, user, password);// 正式环境
// 得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}");
//给参数赋值
// 给参数赋值
// pstm.setString(1,"914205007146986289");
pstm.registerOutParameter(1, OracleTypes.CURSOR);
//执行数据库查询操作
// 执行数据库查询操作
pstm.execute();
//输出结果[第二个参数]
ResultSet rs = (ResultSet) pstm.getObject(1);//此处的2要与存储过程中cursor的问题对应
// 输出结果[第二个参数]
ResultSet rs = (ResultSet) pstm.getObject(1);// 此处的2要与存储过程中cursor的问题对应
List<BusinessProcessing> list = new ArrayList<>();
while (rs.next()) {
BusinessProcessing b = new BusinessProcessing();
......@@ -575,7 +578,7 @@ public class ProvidentFundServicesController {
list.add(b);
}
System.out.println(list);
//释放资源
// 释放资源
pstm.close();
connection.close();
return list;
......@@ -584,23 +587,23 @@ public class ProvidentFundServicesController {
public static void zjbmfhywtosjHX(String uscc, Integer value) throws Exception {
Properties prop = PropertyqUtil.getConfig("application.properties");
//1.调用oracle存储过程,拿到业务办理进度数据
//加载数据库驱动
// 1.调用oracle存储过程,拿到业务办理进度数据
// 加载数据库驱动
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.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的Statement对象
Connection connection = DriverManager.getConnection(url, user, password);// 正式环境
// 得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}");
//给参数赋值
// 给参数赋值
pstm.setString(1, uscc);
pstm.setInt(2, value);
// pstm.registerOutParameter(1, OracleTypes.CURSOR);
//执行数据库查询操作
// 执行数据库查询操作
pstm.execute();
//输出结果[第二个参数]
//释放资源
// 输出结果[第二个参数]
// 释放资源
pstm.close();
connection.close();
}
......
......@@ -15,3 +15,6 @@ user:7MSN/YEwcQpKaVmXkrQtI5zBlPm6ThDA
password:b6/rlcEodaunlW9hS3Uuigr6oiNIXV7ezgbK2ZAuuIo=
frontEndProcessorServer: http://192.168.1.252:8888
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