Commit ad7f1adf authored by 华润's avatar 华润

代码提交内置机

parent 70f38a14
package net.cdkj.gjj.adapter.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 定时任务类
* @author huarun
*
*/
@Component
@EnableScheduling
//@Async
public class AlarmTask {
//系统服务定时器
/**第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次*/
@Scheduled(initialDelay = 5*1000, fixedDelay = 60*1000)
public void run3(){
String dqsj = "";
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
dqsj = sdf.format(dt);
System.out.println("开始时间"+dqsj);
try {
ProvidentFundServicesController.gjjxtfwjk();
} catch (Exception e) {
e.printStackTrace();
}
}
//进度数据定时器
/**第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次*/
@Scheduled(initialDelay = 10*1000, fixedDelay = 60*1000)
public void run4(){
String dqsj = "";
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
dqsj = sdf.format(dt);
System.out.println("开始时间"+dqsj);
ProvidentFundServicesController.BusinessProcessing();
}
}
...@@ -48,7 +48,7 @@ public class ProvidentFundServicesController { ...@@ -48,7 +48,7 @@ public class ProvidentFundServicesController {
OutputStream out = null; OutputStream out = null;
try { try {
// 创建url 资源 // 创建url 资源
URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices");//调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 URL url = new URL("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices");//调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接 // 创建http 连接
conn = (HttpURLConnection) url.openConnection(); conn = (HttpURLConnection) url.openConnection();
// 设置允许输出 // 设置允许输出
...@@ -84,7 +84,7 @@ public class ProvidentFundServicesController { ...@@ -84,7 +84,7 @@ public class ProvidentFundServicesController {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println(sb.toString()); System.out.println("前置机返回第三方解压之后的公积金服务数据:"+sb.toString());
return sb.toString(); return sb.toString();
} else { } else {
System.out.println("请求失败!!!"); System.out.println("请求失败!!!");
...@@ -341,7 +341,7 @@ public class ProvidentFundServicesController { ...@@ -341,7 +341,7 @@ public class ProvidentFundServicesController {
OutputStream out = null; OutputStream out = null;
try { try {
// 创建url 资源 // 创建url 资源
URL url = new URL("http://192.168.101.34:8080/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 URL url = new URL("http://192.168.1.252:8888/FrontEndProcessor/FrontEndProcessor/BusinessProcessing");//调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
// 创建http 连接 // 创建http 连接
conn = (HttpURLConnection) url.openConnection(); conn = (HttpURLConnection) url.openConnection();
// 设置允许输出 // 设置允许输出
...@@ -377,12 +377,17 @@ public class ProvidentFundServicesController { ...@@ -377,12 +377,17 @@ public class ProvidentFundServicesController {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println(sb.toString()); System.out.println("前置机返回第三方解压之后的进度推送结果"+sb.toString());
String uscc=list.get(0).getUscc(); String uscc=list.get(0).getUscc();
System.out.println(uscc); System.out.println(uscc);
JSONObject jsonObj= JSONObject.parseObject(sb.toString()); JSONObject jsonObj= JSONObject.parseObject(sb.toString());
String success= jsonObj.getString("success"); String success= jsonObj.getString("success");
Boolean value=Boolean.getBoolean(success); Integer value=0;
if("true".equals(success)){
value=1;
}else if("false".equals(success)){
value=0;
}
try { try {
zjbmfhywtosjHX(uscc,value); zjbmfhywtosjHX(uscc,value);
} catch (Exception e) { } catch (Exception e) {
...@@ -483,7 +488,7 @@ public class ProvidentFundServicesController { ...@@ -483,7 +488,7 @@ public class ProvidentFundServicesController {
} }
public static void zjbmfhywtosjHX(String uscc,Boolean value) throws Exception{ public static void zjbmfhywtosjHX(String uscc,Integer value) throws Exception{
//1.调用oracle存储过程,拿到业务办理进度数据 //1.调用oracle存储过程,拿到业务办理进度数据
//加载数据库驱动 //加载数据库驱动
Class.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver");
...@@ -493,7 +498,7 @@ public class ProvidentFundServicesController { ...@@ -493,7 +498,7 @@ public class ProvidentFundServicesController {
CallableStatement pstm=connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}"); CallableStatement pstm=connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}");
//给参数赋值 //给参数赋值
pstm.setString(1,uscc); pstm.setString(1,uscc);
pstm.setBoolean(2,value); pstm.setInt(2,value);
// pstm.registerOutParameter(1, OracleTypes.CURSOR); // pstm.registerOutParameter(1, OracleTypes.CURSOR);
//执行数据库查询操作 //执行数据库查询操作
pstm.execute(); pstm.execute();
......
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