Compare commits

..

No commits in common. "c9d6a1986e106f3ff2cc9b2521f5ffed7ccf8ada" and "0d0a7680d960a6d1eff407da885ef58380c70b0c" have entirely different histories.

4 changed files with 109 additions and 111 deletions

64
pom.xml
View File

@ -92,7 +92,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -212,11 +212,11 @@
<artifactId>qcloud-sdk-2.2.7-jar-with-dependencies</artifactId>
<version>2.2.7-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>agw</groupId>-->
<!-- <artifactId>service-client</artifactId>-->
<!-- <version>2.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>agw</groupId>
<artifactId>service-client</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
@ -335,11 +335,11 @@
<version>9.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<!-- <dependency>-->
<!-- <groupId>org.quartz-scheduler</groupId>-->
<!-- <artifactId>quartz</artifactId>-->
<!-- <version>2.3.0</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.quartz-scheduler</groupId>-->
<!-- <artifactId>quartz</artifactId>-->
<!-- <version>2.3.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.bouncycastle</groupId>
@ -406,27 +406,27 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <version>3.1.1</version>-->
<!-- <configuration>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- <consoleOutput>true</consoleOutput>-->
<!-- <failsOnError>true</failsOnError>-->
<!-- <includeTestSourceDirectory>false</includeTestSourceDirectory>-->
<!-- <configLocation>checkstyle-v1.0.xml</configLocation>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>validate</id>-->
<!-- <phase>validate</phase>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <version>3.1.1</version>-->
<!-- <configuration>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- <consoleOutput>true</consoleOutput>-->
<!-- <failsOnError>true</failsOnError>-->
<!-- <includeTestSourceDirectory>false</includeTestSourceDirectory>-->
<!-- <configLocation>checkstyle-v1.0.xml</configLocation>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>validate</id>-->
<!-- <phase>validate</phase>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>

View File

@ -12,12 +12,10 @@ import com.chinaweal.aiccs.crgs.movein.service.TbZcEntityMoveinService;
import com.chinaweal.aiccs.crgs.moveinDetails.entity.*;
import com.chinaweal.aiccs.crgs.moveinDetails.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
@ -31,7 +29,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@ -653,14 +650,17 @@ public class DownLoadTask {
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost postMethod = new HttpPost(downloadPath);
postMethod.setHeader("Content-Type", "text/xml; charset=utf-8");
postMethod.setEntity(new StringEntity(soapRequestData, StandardCharsets.UTF_8));
try {
PostMethod postMethod = new PostMethod(downloadPath);
byte[] b = soapRequestData.getBytes("utf-8");
InputStream is = new ByteArrayInputStream(b, 0, b.length);
//这里不能用 application/soap+xml 要改为text/xml与soap版本有关
RequestEntity re = new InputStreamRequestEntity(is, b.length, "text/xml; charset=utf-8");
postMethod.setRequestEntity(re);
CloseableHttpResponse response = client.execute(postMethod);
int statusCode = response.getStatusLine().getStatusCode();
String soapResponseData = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
// String soapResponseData = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
// " <soap:Body>" +

View File

@ -9,14 +9,12 @@ import com.chinaweal.aiccs.crgs.transfor.sdk.XzxkWsBO;
import com.chinaweal.aiccs.crgs.transfor.service.OtNcaseDownloadLogService;
import com.chinaweal.aiccs.crgs.transfor.service.OtNpermitDownloadLogService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -27,7 +25,6 @@ import org.springframework.stereotype.Component;
import javax.activation.DataHandler;
import javax.annotation.Resource;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
@ -224,23 +221,24 @@ public class DownloadSchedule {
" </jog:downloadCreditInfoByXzcf>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost postMethod = new HttpPost(String.format(caseDownloadUrl, userName, password));
postMethod.setHeader("Content-Type", "application/xml; charset=utf-8");
postMethod.setEntity(new StringEntity(soapRequestData, StandardCharsets.UTF_8));
PostMethod postMethod = new PostMethod(String.format(caseDownloadUrl, userName, password));
byte[] b = soapRequestData.getBytes("utf-8");
InputStream contentis = new ByteArrayInputStream(b, 0, b.length);
//这里用 text/xml 或者 application/xml与soap版本有关
RequestEntity re = new InputStreamRequestEntity(contentis, b.length, "application/xml; charset=utf-8");
postMethod.setRequestEntity(re);
CloseableHttpResponse response = client.execute(postMethod);
int statusCode = response.getStatusLine().getStatusCode();
String soapResponseData = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政处罚请求下载接口,返回结果:{}", uploadDateto, soapResponseData);
int z = soapResponseData.indexOf("<ns1:return>");
int j = soapResponseData.indexOf("</ns1:return>");
returnStr = soapResponseData.substring(z + "<ns1:return>".length(), j);
} else {
log.info("{}异地流转行政处罚请求下载接口失败,状态值:{}", uploadDateto, statusCode);
}
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政处罚请求下载接口,返回结果:{}", uploadDateto,soapResponseData);
int z = soapResponseData.indexOf("<ns1:return>");
int j = soapResponseData.indexOf("</ns1:return>");
returnStr = soapResponseData.substring(z + "<ns1:return>".length(), j);
} else {
log.info("{}异地流转行政处罚请求下载接口失败,状态值:{}",uploadDateto ,statusCode);
}
} catch (Exception e) {
e.printStackTrace();
@ -439,23 +437,24 @@ public class DownloadSchedule {
" </jog:downloadCreditInfoByXzxk>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost postMethod = new HttpPost(String.format(permitDownloadUrl, userName, password));
postMethod.setHeader("Content-Type", "application/xml; charset=utf-8");
postMethod.setEntity(new StringEntity(soapRequestData, StandardCharsets.UTF_8));
PostMethod postMethod = new PostMethod(String.format(permitDownloadUrl, userName, password));
byte[] b = soapRequestData.getBytes("utf-8");
InputStream contentis = new ByteArrayInputStream(b, 0, b.length);
//这里用 text/xml 或者 application/xml与soap版本有关
RequestEntity re = new InputStreamRequestEntity(contentis, b.length, "application/xml; charset=utf-8");
postMethod.setRequestEntity(re);
CloseableHttpResponse response = client.execute(postMethod);
int statusCode = response.getStatusLine().getStatusCode();
String soapResponseData = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政许可请求下载接口,返回结果:{}", uploadDateto, soapResponseData);
int z = soapResponseData.indexOf("<ns1:return>");
int j = soapResponseData.indexOf("</ns1:return>");
returnStr = soapResponseData.substring(z + "<ns1:return>".length(), j);
} else {
log.info("{}异地流转行政许可请求下载接口失败,状态值:{}", uploadDateto, statusCode);
}
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政许可请求下载接口,返回结果:{}", uploadDateto,soapResponseData);
int z = soapResponseData.indexOf("<ns1:return>");
int j = soapResponseData.indexOf("</ns1:return>");
returnStr = soapResponseData.substring(z + "<ns1:return>".length(), j);
} else {
log.info("{}异地流转行政许可请求下载接口失败,状态值:{}",uploadDateto ,statusCode);
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -2,25 +2,19 @@ package com.chinaweal.aiccs.crgs.transfor.sdk;
import cn.hutool.core.codec.Base64Encoder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.io.IOUtils;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.io.*;
/**
* @author <a href="https://blog.lroyia.top">lroyia</a>
@ -85,14 +79,16 @@ public class UploadSDK {
" </upl:uploadCreditInfoByCase>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (CloseableHttpClient client = HttpClients.createDefault()){
HttpPost postMethod = new HttpPost(String.format(uploadUrl, userName, password));
postMethod.setHeader("Content-Type", "text/xml; charset=utf-8");
try {
PostMethod postMethod = new PostMethod(String.format(uploadUrl, userName, password));
byte[] b = str.getBytes("utf-8");
InputStream is = new ByteArrayInputStream(b, 0, b.length);
postMethod.setEntity(new StringEntity(str));
CloseableHttpResponse execute = client.execute(postMethod);
int statusCode = execute.getStatusLine().getStatusCode();
String soapResponseData = EntityUtils.toString(execute.getEntity(), StandardCharsets.UTF_8);
RequestEntity re = new InputStreamRequestEntity(is, b.length, "text/xml; charset=utf-8");
postMethod.setRequestEntity(re);
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政处罚上传接口,返回结果:{}", filePath, soapResponseData);
@ -103,7 +99,7 @@ public class UploadSDK {
log.info("{}异地流转行政处罚上传接口,状态值:{}", filePath, statusCode);
}
} catch (Exception e) {
log.error("上传报错", e);
e.printStackTrace();
}
return fileStr;
}
@ -152,13 +148,16 @@ public class UploadSDK {
" </upl:uploadCreditInfoByPermit>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (CloseableHttpClient client = HttpClients.createDefault()){
HttpPost postMethod = new HttpPost(String.format(uploadUrl, userName, password));
postMethod.setHeader("Content-Type", "text/xml; charset=utf-8");
postMethod.setEntity(new StringEntity(str));
CloseableHttpResponse response = client.execute(postMethod);
int statusCode = response.getStatusLine().getStatusCode();
String soapResponseData = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
try {
PostMethod postMethod = new PostMethod(String.format(uploadUrl, userName, password));
byte[] b = str.getBytes("utf-8");
InputStream is = new ByteArrayInputStream(b, 0, b.length);
RequestEntity re = new InputStreamRequestEntity(is, b.length, "text/xml; charset=utf-8");
postMethod.setRequestEntity(re);
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
//200说明正常返回数据
if (statusCode == 200) {
log.info("{}异地流转行政处罚上传接口,返回结果:{}", filePath, soapResponseData);