Commit 9191b2e8 authored by 张俊's avatar 张俊

单位销户开发

parent 5b767a4c
package net.cdkj.gjj.adapter;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(InternalLogicApplication.class);
}
}
......@@ -29,6 +29,8 @@ public class AlarmTask {
@Resource
private DeptInfoUpdateController deptInfoUpdateController;
@Resource
private DeptLogoutController deptLogoutController;
@Resource
private ProvidentFundServicesController providentFundServicesController;
/**
......@@ -68,5 +70,18 @@ public class AlarmTask {
log.debug("dwxxbgPullTask 开始时间:{}", InternalUtils.getCurrentTime());
deptInfoUpdateController.dwxxbgPull();
}
@Scheduled(initialDelay = 80 * 1000, fixedDelayString = "${dwxhPushTaskDelay}")
public void dwxhPushTask() {
log.debug("dwxhPushTask 开始时间:{}", InternalUtils.getCurrentTime());
deptLogoutController.dwxhPush();
}
@Scheduled(initialDelay = 100 * 1000, fixedDelayString = "${dwxhPullTaskDelay}")
public void dwxhPullTask() {
log.debug("dwxhPullTask 开始时间:{}", InternalUtils.getCurrentTime());
deptLogoutController.dwxhPull();
}
}
......@@ -320,7 +320,10 @@ public class DeptInfoUpdateController {
bp.setEntName(rs.getString(9));
}
if (StringUtils.hasText(rs.getString(10))) {
bp.setBusId(rs.getString(10));
bp.setRn(rs.getString(10));
}
if (StringUtils.hasText(rs.getString(11))) {
bp.setBusId(rs.getString(11));
}
list.add(bp);
}
......
......@@ -195,21 +195,6 @@ public class ProvidentFundServicesController {
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
// 调完第一个存储过程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
if (!bills.isEmpty()) {
for (UnitAccountOpeningInformation uniInfom : bills) {
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) {
......@@ -402,7 +387,6 @@ public class ProvidentFundServicesController {
} catch (Exception e) {
e.printStackTrace();
}
// if(!list.isEmpty()){//查到数据才请求第三方接口推送
System.out.println("调第二个接口了存储过程返回的list" + list);
JSONObject jsonObject = new JSONObject();
jsonObject.put("state", "1");
......
......@@ -30,6 +30,8 @@ public class BusinessProcessing {
private String busId;
private String rn;
public String getBusiLink() {
return busiLink;
}
......@@ -110,19 +112,11 @@ public class BusinessProcessing {
this.busId = busId;
}
@Override
public String toString() {
return "BusinessProcessing{" +
"busiLink='" + busiLink + '\'' +
", busiType='" + busiType + '\'' +
", opeartor='" + opeartor + '\'' +
", tel='" + tel + '\'' +
", opinion='" + opinion + '\'' +
", result='" + result + '\'' +
", time=" + time +
", uscc='" + uscc + '\'' +
", entName='" + entName + '\'' +
", busId='" + busId + '\'' +
'}';
public String getRn() {
return rn;
}
public void setRn(String rn) {
this.rn = rn;
}
}
package net.cdkj.gjj.adapter.utils;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.zip.GZIPInputStream;
public class HttpUtil {
/**
* 获取请求入参数据
*/
public static String getReqData(HttpServletRequest request) {
StringBuffer json = new StringBuffer();
String line = null;
try {
BufferedReader reader = request.getReader();
while ((line = reader.readLine()) != null) {
json.append(line);
}
} catch (Exception e) {
System.out.println(e);
}
String str = json.toString();
System.out.println("要发送给第三方的公积金系统服务报文:" + str);
return str;
}
/**
* 发起 post 请求,并对出参进行解压缩
*/
public static String sendPost(String httpUrl, String content) {
StringBuffer sb = new StringBuffer();
HttpURLConnection conn = null;
OutputStream out = null;
try {
// 创建url 资源
URL url = new URL(httpUrl);
// 创建http 连接
conn = (HttpURLConnection) url.openConnection();
// 设置允许输出
conn.setDoOutput(true);
// 设置允许输入
conn.setDoInput(true);
// 设置不使用缓存
conn.setUseCaches(false);
// 设置传递方式
conn.setRequestMethod("POST");
// 设置维持长连接
conn.setRequestProperty("Connection", "Keep-Alive");
// 设置文件类型:
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
// 设置文件字符集:
conn.setRequestProperty("Charset", "UTF-8");
// 转换为字节数组
byte[] data = content.getBytes("UTF-8");
// 设置文件长度
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 开始连接请求
conn.connect();
// 创建写入流,写入请求的字符串
out = new DataOutputStream(conn.getOutputStream());
out.write(data);
// 请求返回的状态
if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) {
// 请求返回的数据,解压缩
InputStream is = conn.getInputStream();
GZIPInputStream gzis = new GZIPInputStream(is);
InputStreamReader reader = new InputStreamReader(gzis, "UTF-8");
BufferedReader br = new BufferedReader(reader);
String temp;
while ((temp = br.readLine()) != null) {
sb.append(temp);
}
System.out.println("第三方返回的zip解压缩之后的报文:" + sb);
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;
}
}
......@@ -32,6 +32,8 @@ dwkhPullTaskDelay:60000
dwkhPushTaskDelay:60000
dwxxbgPushTaskDelay:60000
dwxxbgPullTaskDelay:60000
dwxhPushTaskDelay:60000
dwxhPullTaskDelay:60000
# 日志配置
logging.config:classpath:logback-spring.xml
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
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