Commit 75ad70ec authored by 明松's avatar 明松

配置文件加解密处理

parent 3faadd44
Pipeline #132 failed with stages
...@@ -55,7 +55,11 @@ ...@@ -55,7 +55,11 @@
<artifactId>ojdbc7</artifactId> <artifactId>ojdbc7</artifactId>
<version>12.1.0.1.0</version> <version>12.1.0.1.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
......
...@@ -12,41 +12,47 @@ import java.util.Date; ...@@ -12,41 +12,47 @@ import java.util.Date;
/** /**
* 定时任务类 * 定时任务类
* @author huarun
* *
* @author huarun
*/ */
@Component @Component
@EnableScheduling @EnableScheduling
//@Async //@Async
public class AlarmTask { public class AlarmTask {
//系统服务定时器 //系统服务定时器
/**第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次*/
@Scheduled(initialDelay = 5*1000, fixedDelay = 60*1000) /**
public void run3(){ * 第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次
String dqsj = ""; */
Date dt = new Date(); @Scheduled(initialDelay = 5 * 1000, fixedDelay = 60 * 1000)
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); public void run3() {
dqsj = sdf.format(dt); String dqsj = "";
System.out.println("第一个接口开始时间"+dqsj); Date dt = new Date();
try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
ProvidentFundServicesController.gjjxtfwjk(); dqsj = sdf.format(dt);
} catch (Exception e) { System.out.println("第一个接口开始时间" + dqsj);
e.printStackTrace(); try {
} ProvidentFundServicesController.gjjxtfwjk();
} } catch (Exception e) {
e.printStackTrace();
}
}
//进度数据定时器 //进度数据定时器
/**第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次*/
@Scheduled(initialDelay = 20*1000, fixedDelay = 60*1000) /**
public void run4(){ * 第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次
String dqsj = ""; */
Date dt = new Date(); @Scheduled(initialDelay = 20 * 1000, fixedDelay = 60 * 1000)
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); public void run4() {
dqsj = sdf.format(dt); String dqsj = "";
System.out.println("第二个接口开始时间"+dqsj); Date dt = new Date();
ProvidentFundServicesController.BusinessProcessing(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
dqsj = sdf.format(dt);
System.out.println("第二个接口开始时间" + dqsj);
ProvidentFundServicesController.BusinessProcessing();
} }
} }
package net.cdkj.gjj.adapter.controller; package net.cdkj.gjj.adapter.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import net.cdkj.gjj.adapter.encryptor.JasyptConfig;
import net.cdkj.gjj.adapter.domain.BusinessProcessing; import net.cdkj.gjj.adapter.domain.BusinessProcessing;
import net.cdkj.gjj.adapter.domain.Json; import net.cdkj.gjj.adapter.domain.Json;
import net.cdkj.gjj.adapter.domain.PropertyqUtil; import net.cdkj.gjj.adapter.domain.PropertyqUtil;
...@@ -12,13 +12,16 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -12,13 +12,16 @@ 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 java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.sql.*; import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.Date;
/** /**
...@@ -28,6 +31,17 @@ import java.util.Date; ...@@ -28,6 +31,17 @@ import java.util.Date;
@RequestMapping(value = "InternalLogic") @RequestMapping(value = "InternalLogic")
public class ProvidentFundServicesController { public class ProvidentFundServicesController {
private static String url;
private static String user;
private static String password;
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"));
}
/** /**
* 公积金系统服务接口内置机调前置机中间接口 * 公积金系统服务接口内置机调前置机中间接口
* *
...@@ -39,13 +53,13 @@ public class ProvidentFundServicesController { ...@@ -39,13 +53,13 @@ public class ProvidentFundServicesController {
public static String ProvidentFundServices() { public static String ProvidentFundServices() {
Properties prop = PropertyqUtil.getConfig("application.properties"); Properties prop = PropertyqUtil.getConfig("application.properties");
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String type= PropertyqUtil.getPropValue( prop ,"timetype"); String type = PropertyqUtil.getPropValue(prop, "timetype");
if("1".equals(type)){//表示正式环境 if ("1".equals(type)) {//表示正式环境
jsonObject.put("startTime", currenttime(0));//正式环境 jsonObject.put("startTime", currenttime(0));//正式环境
jsonObject.put("endTime", currenttime(24));//正式环境 jsonObject.put("endTime", currenttime(24));//正式环境
}else if("2".equals(type)){//表示测试环境或本地环境 } else if ("2".equals(type)) {//表示测试环境或本地环境
jsonObject.put("startTime", PropertyqUtil.getPropValue( prop ,"startTime"));//测试环境或本地环境 jsonObject.put("startTime", PropertyqUtil.getPropValue(prop, "startTime"));//测试环境或本地环境
jsonObject.put("endTime", PropertyqUtil.getPropValue( prop ,"endTime"));//测试环境或本地环境 jsonObject.put("endTime", PropertyqUtil.getPropValue(prop, "endTime"));//测试环境或本地环境
} }
jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186"); jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186"); jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
...@@ -173,7 +187,7 @@ public class ProvidentFundServicesController { ...@@ -173,7 +187,7 @@ public class ProvidentFundServicesController {
//得到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(PropertyqUtil.getPropValue( prop ,"url"), PropertyqUtil.getPropValue( prop ,"user"), PropertyqUtil.getPropValue( prop ,"password"));//正式环境 Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的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存储过程
...@@ -192,7 +206,7 @@ public class ProvidentFundServicesController { ...@@ -192,7 +206,7 @@ public class ProvidentFundServicesController {
//421181 //421181
//421182 //421182
//421101 //421101
List<String> wo=new ArrayList<>(); List<String> wo = new ArrayList<>();
wo.add("421102"); wo.add("421102");
wo.add("421121"); wo.add("421121");
wo.add("421122"); wo.add("421122");
...@@ -207,138 +221,138 @@ public class ProvidentFundServicesController { ...@@ -207,138 +221,138 @@ public class ProvidentFundServicesController {
if (!bills.isEmpty()) { if (!bills.isEmpty()) {
for (UnitAccountOpeningInformation uniInfom : bills) { for (UnitAccountOpeningInformation uniInfom : bills) {
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) { if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) {
if(wo.contains(uniInfom.getOplocdistrict())){ if (wo.contains(uniInfom.getOplocdistrict())) {
System.out.println("oplocdistrict"+"在规定的值里面,调imp过程"); System.out.println("oplocdistrict" + "在规定的值里面,调imp过程");
if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) { if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) {
pstm.setString(1, uniInfom.getBusId()); pstm.setString(1, uniInfom.getBusId());
} else { } else {
pstm.setString(1, ""); pstm.setString(1, "");
} }
if (!"".equals(uniInfom.getUscc()) && uniInfom.getUscc() != null) { if (!"".equals(uniInfom.getUscc()) && uniInfom.getUscc() != null) {
pstm.setString(2, uniInfom.getUscc()); pstm.setString(2, uniInfom.getUscc());
} else { } else {
pstm.setString(2, ""); pstm.setString(2, "");
} }
if (!"".equals(uniInfom.getEntName()) && uniInfom.getEntName() != null) { if (!"".equals(uniInfom.getEntName()) && uniInfom.getEntName() != null) {
pstm.setString(3, uniInfom.getEntName()); pstm.setString(3, uniInfom.getEntName());
} else { } else {
pstm.setString(3, ""); pstm.setString(3, "");
} }
if (!"".equals(uniInfom.getDom()) && uniInfom.getDom() != null) { if (!"".equals(uniInfom.getDom()) && uniInfom.getDom() != null) {
pstm.setString(4, uniInfom.getDom()); pstm.setString(4, uniInfom.getDom());
} else { } else {
pstm.setString(4, ""); pstm.setString(4, "");
} }
if (!"".equals(uniInfom.getEstDate()) && uniInfom.getEstDate() != null) { if (!"".equals(uniInfom.getEstDate()) && uniInfom.getEstDate() != null) {
pstm.setDate(5, new java.sql.Date(uniInfom.getEstDate().getTime())); pstm.setDate(5, new java.sql.Date(uniInfom.getEstDate().getTime()));
} else { } else {
pstm.setString(5, ""); pstm.setString(5, "");
} }
if (!"".equals(uniInfom.getLerep()) && uniInfom.getLerep() != null) { if (!"".equals(uniInfom.getLerep()) && uniInfom.getLerep() != null) {
pstm.setString(6, uniInfom.getLerep()); pstm.setString(6, uniInfom.getLerep());
} else { } else {
pstm.setString(6, ""); pstm.setString(6, "");
} }
if (!"".equals(uniInfom.getCerType()) && uniInfom.getCerType() != null) { if (!"".equals(uniInfom.getCerType()) && uniInfom.getCerType() != null) {
pstm.setString(7, uniInfom.getCerType()); pstm.setString(7, uniInfom.getCerType());
} else { } else {
pstm.setString(7, ""); pstm.setString(7, "");
} }
if (!"".equals(uniInfom.getCerNo()) && uniInfom.getCerNo() != null) { if (!"".equals(uniInfom.getCerNo()) && uniInfom.getCerNo() != null) {
pstm.setString(8, uniInfom.getCerNo()); pstm.setString(8, uniInfom.getCerNo());
} else { } else {
pstm.setString(8, ""); pstm.setString(8, "");
} }
if (!"".equals(uniInfom.getOperatorName()) && uniInfom.getOperatorName() != null) { if (!"".equals(uniInfom.getOperatorName()) && uniInfom.getOperatorName() != null) {
pstm.setString(9, uniInfom.getOperatorName()); pstm.setString(9, uniInfom.getOperatorName());
} else { } else {
pstm.setString(9, ""); pstm.setString(9, "");
} }
if (!"".equals(uniInfom.getOperatorCerNo()) && uniInfom.getOperatorCerNo() != null) { if (!"".equals(uniInfom.getOperatorCerNo()) && uniInfom.getOperatorCerNo() != null) {
pstm.setString(10, uniInfom.getOperatorCerNo()); pstm.setString(10, uniInfom.getOperatorCerNo());
} else { } else {
pstm.setString(10, ""); pstm.setString(10, "");
} }
if (!"".equals(uniInfom.getOperatorPhone()) && uniInfom.getOperatorPhone() != null) { if (!"".equals(uniInfom.getOperatorPhone()) && uniInfom.getOperatorPhone() != null) {
pstm.setString(11, uniInfom.getOperatorPhone()); pstm.setString(11, uniInfom.getOperatorPhone());
} else { } else {
pstm.setString(11, ""); pstm.setString(11, "");
} }
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) { if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) {
pstm.setString(12, uniInfom.getOplocdistrict()); pstm.setString(12, uniInfom.getOplocdistrict());
} else { } else {
pstm.setString(12, ""); pstm.setString(12, "");
} }
if (!"".equals(uniInfom.getUnitNature()) && uniInfom.getUnitNature() != null) { if (!"".equals(uniInfom.getUnitNature()) && uniInfom.getUnitNature() != null) {
pstm.setString(13, uniInfom.getUnitNature()); pstm.setString(13, uniInfom.getUnitNature());
} else { } else {
pstm.setString(13, ""); pstm.setString(13, "");
} }
if (!"".equals(uniInfom.getEconomicType()) && uniInfom.getEconomicType() != null) { if (!"".equals(uniInfom.getEconomicType()) && uniInfom.getEconomicType() != null) {
pstm.setString(14, uniInfom.getEconomicType()); pstm.setString(14, uniInfom.getEconomicType());
} else { } else {
pstm.setString(14, ""); pstm.setString(14, "");
} }
if (!"".equals(uniInfom.getIndustryphy()) && uniInfom.getIndustryphy() != null) { if (!"".equals(uniInfom.getIndustryphy()) && uniInfom.getIndustryphy() != null) {
pstm.setString(15, uniInfom.getIndustryphy()); pstm.setString(15, uniInfom.getIndustryphy());
} else { } else {
pstm.setString(15, ""); pstm.setString(15, "");
} }
if (!"".equals(uniInfom.getUnitPayDay()) && uniInfom.getUnitPayDay() != null) { if (!"".equals(uniInfom.getUnitPayDay()) && uniInfom.getUnitPayDay() != null) {
pstm.setString(16, uniInfom.getUnitPayDay()); pstm.setString(16, uniInfom.getUnitPayDay());
} else { } else {
pstm.setString(16, ""); pstm.setString(16, "");
} }
if (!"".equals(uniInfom.getUnitDepPro()) && uniInfom.getUnitDepPro() != null) { if (!"".equals(uniInfom.getUnitDepPro()) && uniInfom.getUnitDepPro() != null) {
pstm.setString(17, uniInfom.getUnitDepPro()); pstm.setString(17, uniInfom.getUnitDepPro());
} else { } else {
pstm.setString(17, ""); pstm.setString(17, "");
} }
if (!"".equals(uniInfom.getPersonalDepPro()) && uniInfom.getPersonalDepPro() != null) { if (!"".equals(uniInfom.getPersonalDepPro()) && uniInfom.getPersonalDepPro() != null) {
pstm.setString(18, uniInfom.getPersonalDepPro()); pstm.setString(18, uniInfom.getPersonalDepPro());
} else { } else {
pstm.setString(18, ""); pstm.setString(18, "");
} }
pstm.registerOutParameter(19, oracle.jdbc.OracleTypes.VARCHAR); pstm.registerOutParameter(19, oracle.jdbc.OracleTypes.VARCHAR);
pstm.registerOutParameter(20, oracle.jdbc.OracleTypes.VARCHAR); pstm.registerOutParameter(20, oracle.jdbc.OracleTypes.VARCHAR);
//执行数据库查询操作 //执行数据库查询操作
pstm.execute(); pstm.execute();
//输出结果[第二个参数] //输出结果[第二个参数]
System.out.println(pstm.getString(19)); System.out.println(pstm.getString(19));
System.out.println(pstm.getString(20)); System.out.println(pstm.getString(20));
if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) { if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) {
break; break;
} else { } else {
try { try {
// 避免批量插入高并发,此处设置每次停顿5秒 // 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000); Thread.currentThread().sleep(2000);
System.out.println("间隔2秒传一条数据调一次存储过程"); System.out.println("间隔2秒传一条数据调一次存储过程");
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else{ } else {
System.out.println("oplocdistrict"+"不在规定的值里面,不调imp过程"); System.out.println("oplocdistrict" + "不在规定的值里面,不调imp过程");
} }
}
} }
}
pstm2.execute(); pstm2.execute();
} else { } else {
...@@ -401,105 +415,105 @@ public class ProvidentFundServicesController { ...@@ -401,105 +415,105 @@ public class ProvidentFundServicesController {
e.printStackTrace(); e.printStackTrace();
} }
// if(!list.isEmpty()){//查到数据才请求第三方接口推送 // if(!list.isEmpty()){//查到数据才请求第三方接口推送
System.out.println("调第二个接口了存储过程返回的list" + list); System.out.println("调第二个接口了存储过程返回的list" + list);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("state", "1"); jsonObject.put("state", "1");
if (!list.isEmpty()) { if (!list.isEmpty()) {
jsonObject.put("timestamp", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime()); jsonObject.put("timestamp", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime());
} else { } else {
jsonObject.put("timestamp", ""); 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数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(本地环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 // URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//(本地环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接 // 创建http 连接
conn = (HttpURLConnection) url.openConnection(); 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 = new DataOutputStream(conn.getOutputStream());
out.write(data); out.write(data);
// 请求返回的状态 // 请求返回的状态
if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) { if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) {
// 请求返回的数据 // 请求返回的数据
InputStream is = conn.getInputStream(); InputStream is = conn.getInputStream();
String readLine = new String(); String readLine = new String();
BufferedReader responseReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); BufferedReader responseReader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((readLine = responseReader.readLine()) != null) { while ((readLine = responseReader.readLine()) != null) {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println("前置机返回第三方解压之后的进度推送结果" + sb.toString()); System.out.println("前置机返回第三方解压之后的进度推送结果" + sb.toString());
String uscc = ""; String uscc = "";
if (!list.isEmpty()) { if (!list.isEmpty()) {
uscc = list.get(0).getUscc(); 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 { } else {
System.out.println("请求失败!!!");
} }
} catch (IOException e) { System.out.println(uscc);
e.printStackTrace(); JSONObject jsonObj = JSONObject.parseObject(sb.toString());
} finally { String success = jsonObj.getString("success");
if (out != null) { Integer value = 0;
try { if ("true".equals(success)) {
out.flush(); value = 1;
out.close(); } else if ("false".equals(success)) {
} catch (IOException e) { value = 0;
}
} }
if (conn != null) { try {
conn.disconnect(); zjbmfhywtosjHX(uscc, value);
} catch (Exception e) {
e.printStackTrace();
} }
System.out.println(value);
return sb.toString();
} 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;
...@@ -521,7 +535,7 @@ public class ProvidentFundServicesController { ...@@ -521,7 +535,7 @@ public class ProvidentFundServicesController {
//得到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(PropertyqUtil.getPropValue( prop ,"url"), PropertyqUtil.getPropValue( prop ,"user"), PropertyqUtil.getPropValue( prop ,"password"));//正式环境 Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的Statement对象 //得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}");
//给参数赋值 //给参数赋值
...@@ -591,7 +605,7 @@ public class ProvidentFundServicesController { ...@@ -591,7 +605,7 @@ public class ProvidentFundServicesController {
//得到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(PropertyqUtil.getPropValue( prop ,"url"), PropertyqUtil.getPropValue( prop ,"user"), PropertyqUtil.getPropValue( prop ,"password"));//正式环境 Connection connection = DriverManager.getConnection(url, user, password);//正式环境
//得到预编译的Statement对象 //得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}");
//给参数赋值 //给参数赋值
......
package net.cdkj.gjj.adapter.encryptor;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/encrypt")
@CrossOrigin(origins = "*", maxAge = 3600)
public class EncryptController {
@PostMapping("/jasyptEnc")
public String encrypt(@RequestParam String encStr) throws Exception {
StringEncryptor encryptor = new JasyptConfig().stringEncryptor();
return encryptor.encrypt(encStr);
}
@PostMapping("/jasyptDec")
public String decrypt(@RequestParam String decStr) throws Exception {
StringEncryptor encryptor = new JasyptConfig().stringEncryptor();
return encryptor.decrypt(decStr);
}
}
package net.cdkj.gjj.adapter.encryptor;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.StandardPBEByteEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Jasypt 配置
*/
@Configuration
public class JasyptConfig {
@Bean("jasyptStringEncryptor")
public StringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
// 加密盐值
config.setPassword("gjjcdgs856177110");
// 加密算法
config.setAlgorithm(StandardPBEByteEncryptor.DEFAULT_ALGORITHM);
// key迭代次数
config.setKeyObtentionIterations("1000");
// 池大小
config.setPoolSize("1");
config.setProviderName("SunJCE");
// 随机盐生成器
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
// 加密后输出字符串编码方式
config.setStringOutputType("base64");
encryptor.setConfig(config);
return encryptor;
}
public static String encryptStr(String decryptStr) {
StringEncryptor encryptor = new JasyptConfig().stringEncryptor();
return encryptor.decrypt(decryptStr);
}
}
...@@ -10,9 +10,9 @@ timetype:1 ...@@ -10,9 +10,9 @@ timetype:1
#endTime:20210520 23:00:00 #endTime:20210520 23:00:00
#数据库(正式环境) #数据库(正式环境)
url:jdbc:oracle:thin:@192.168.1.33:1596:zfgjj #url:jdbc:oracle:thin:@192.168.1.33:1596:zfgjj
user:gjj80 #user:gjj80
password:HG80_Y9E1C5 #password:HG80_Y9E1C5
#数据库(测试环境) #数据库(测试环境)
#url:jdbc:oracle:thin:@192.168.1.36:1521:zfgjj #url:jdbc:oracle:thin:@192.168.1.36:1521:zfgjj
...@@ -20,7 +20,7 @@ password:HG80_Y9E1C5 ...@@ -20,7 +20,7 @@ password:HG80_Y9E1C5
#password:GJJ80 #password:GJJ80
#数据库(本地环境) #数据库(本地环境)
#url:jdbc:oracle:thin:@192.168.101.194:1521:zfgjj url:75DhD+XOzqnR0zqzR5qjr0iDdvT+n0oXo2eJOu5Hf6folEOl21MdF4Up8AszcxhxGQNsaR8fClxBOH4ZQ3l6mQ==
#user:HG2020 user:m28AAzNwsW76djvPXGA34gg9FtY6iqxM
#password:HG2020 password:m28AAzNwsW76djvPXGA34gg9FtY6iqxM
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