Commit 2efe92cece61c0f56d61a5e45f1b6e8ebb85127e
1 parent
895d126122
Exists in
master
and in
6 other branches
调用德州代金券工具类
Showing 2 changed files with 62 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/HospitalCouponPrintUtils.java
View file @
2efe92c
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import com.lyms.platform.common.utils.PropertiesUtils; | |
4 | +import org.apache.http.HttpEntity; | |
5 | +import org.apache.http.NameValuePair; | |
6 | +import org.apache.http.client.HttpClient; | |
7 | +import org.apache.http.client.entity.UrlEncodedFormEntity; | |
8 | +import org.apache.http.client.methods.CloseableHttpResponse; | |
9 | +import org.apache.http.client.methods.HttpPost; | |
10 | +import org.apache.http.entity.StringEntity; | |
11 | +import org.apache.http.impl.client.DefaultHttpClient; | |
12 | +import org.apache.http.impl.conn.PoolingClientConnectionManager; | |
13 | +import org.apache.http.message.BasicNameValuePair; | |
14 | +import org.apache.http.util.EntityUtils; | |
15 | + | |
16 | +import java.util.ArrayList; | |
17 | +import java.util.Date; | |
18 | +import java.util.List; | |
19 | + | |
20 | +/** | |
21 | + * Created by Administrator on 2017/5/16. | |
22 | + */ | |
23 | +public class HospitalCouponPrintUtils { | |
24 | + | |
25 | + public static final String DJQ_URL = PropertiesUtils.getPropertyValue("djq_url"); | |
26 | + | |
27 | + public static String getDZdjq(String KLX,String KH,String FKYY,String FKR,String LKR,String FKSJ,String BZ,String JSFS,Integer KMJE,Integer XSJE,Integer CZZKL,Integer YE){ | |
28 | + String s2=null; | |
29 | + try { | |
30 | + final String CONTENT_TYPE_TEXT_JSON = "text/json"; | |
31 | + DefaultHttpClient client = new DefaultHttpClient( | |
32 | + new PoolingClientConnectionManager()); | |
33 | + String url = DJQ_URL; | |
34 | + String js = "KLX=" + KLX + "&KH=" + KH + "&FKYY=" + FKYY + "&FKR=" + FKR + "&LKR=" + LKR + "&FKSJ=" + FKSJ+"&BZ="+BZ+"&JSFS="+JSFS+"&KMJE="+KMJE+"&XSJE="+XSJE+"&XSJE="+XSJE+"&CZZKL="+CZZKL+"&YE="+YE; | |
35 | + HttpPost httpPost = new HttpPost(url); | |
36 | + httpPost.setHeader("Content-Type", "application/text;charset=UTF-8"); | |
37 | + StringEntity se = new StringEntity(js); | |
38 | + se.setContentType(CONTENT_TYPE_TEXT_JSON); | |
39 | + httpPost.setEntity(se); | |
40 | + CloseableHttpResponse response2 = null; | |
41 | + response2 = client.execute(httpPost); | |
42 | + HttpEntity entity2 = null; | |
43 | + entity2 = response2.getEntity(); | |
44 | + s2= EntityUtils.toString(entity2, "UTF-8"); | |
45 | + | |
46 | + | |
47 | + | |
48 | + }catch (Exception e){ | |
49 | + e.printStackTrace(); | |
50 | + } | |
51 | + if(s2!=null){ | |
52 | + return s2; | |
53 | + }else | |
54 | + return "调用程序出错"; | |
55 | + | |
56 | + } | |
57 | + | |
58 | +} |
platform-operate-api/src/main/resources/config.properties
View file @
2efe92c