开始
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
@@ -103,5 +105,9 @@
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.11.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.56" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -13,4 +13,5 @@
|
||||
<artifactId>cwhelp</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.cwhelp.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cwhelp.common.enums.ResultEnum;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author: yan.y
|
||||
* @Description:
|
||||
* @Date: Created in 23:59 2019-08-26
|
||||
* @Modified by:
|
||||
*/
|
||||
public class HttpYoushangFapiaoUtil {
|
||||
private static final String url = "https://fapiao.youshang.com/GuoShuiAction.do";
|
||||
|
||||
public static final JSONObject getVatInfoiceInfo(JSONObject params){
|
||||
final String action = "findInvoiceResult";
|
||||
JSONObject result = new JSONObject();
|
||||
try {
|
||||
HttpClient httpClient = HttpClients.createDefault();
|
||||
URIBuilder uriBuilder = new URIBuilder(url);
|
||||
URI uri = uriBuilder.addParameter("action", action)
|
||||
.addParameter("fpdm", params.getString("fpdm"))
|
||||
.addParameter("fphm", params.getString("fphm"))
|
||||
.addParameter("kprq", params.getString("kprq"))
|
||||
.addParameter("kjje", params.getString("kjje"))
|
||||
.addParameter("jym", params.getString("jym")).build();
|
||||
HttpGet httpGet = new HttpGet(uri);
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
result.put("code", ResultEnum.SUCCESS.getCode());
|
||||
result.put("meg", ResultEnum.SUCCESS.getMessage());
|
||||
result.put("data", content);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("code", ResultEnum.ERROR.getCode());
|
||||
result.put("msg", ResultEnum.ERROR.getMessage() + "-" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user