1
Showing
1 changed file
with
74 additions
and
0 deletions
| ... | @@ -11,11 +11,14 @@ import com.phxl.modules.goods.entity.billback.BillBackWithDetail; | ... | @@ -11,11 +11,14 @@ import com.phxl.modules.goods.entity.billback.BillBackWithDetail; |
| 11 | import org.apache.commons.fileupload.disk.DiskFileItem; | 11 | import org.apache.commons.fileupload.disk.DiskFileItem; |
| 12 | import org.apache.http.HttpEntity; | 12 | import org.apache.http.HttpEntity; |
| 13 | import org.apache.http.HttpResponse; | 13 | import org.apache.http.HttpResponse; |
| 14 | import org.apache.http.NameValuePair; | ||
| 14 | import org.apache.http.client.HttpClient; | 15 | import org.apache.http.client.HttpClient; |
| 16 | import org.apache.http.client.entity.UrlEncodedFormEntity; | ||
| 15 | import org.apache.http.client.methods.HttpPost; | 17 | import org.apache.http.client.methods.HttpPost; |
| 16 | import org.apache.http.entity.mime.MultipartEntityBuilder; | 18 | import org.apache.http.entity.mime.MultipartEntityBuilder; |
| 17 | import org.apache.http.entity.mime.content.FileBody; | 19 | import org.apache.http.entity.mime.content.FileBody; |
| 18 | import org.apache.http.impl.client.HttpClients; | 20 | import org.apache.http.impl.client.HttpClients; |
| 21 | import org.apache.http.message.BasicNameValuePair; | ||
| 19 | import org.apache.http.util.EntityUtils; | 22 | import org.apache.http.util.EntityUtils; |
| 20 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; | 24 | import org.slf4j.LoggerFactory; |
| ... | @@ -125,6 +128,7 @@ public class SpdControlller { | ... | @@ -125,6 +128,7 @@ public class SpdControlller { |
| 125 | @Autowired | 128 | @Autowired |
| 126 | private SuInvoiceBackService suInvoiceBackService; | 129 | private SuInvoiceBackService suInvoiceBackService; |
| 127 | 130 | ||
| 131 | private static HttpClient client; | ||
| 128 | 132 | ||
| 129 | @RequestMapping(value="/setMFMedGoods") | 133 | @RequestMapping(value="/setMFMedGoods") |
| 130 | @ResponseBody | 134 | @ResponseBody |
| ... | @@ -940,4 +944,74 @@ public class SpdControlller { | ... | @@ -940,4 +944,74 @@ public class SpdControlller { |
| 940 | interfaceLogService.setResultLog(response, logId, exception); | 944 | interfaceLogService.setResultLog(response, logId, exception); |
| 941 | return result; | 945 | return result; |
| 942 | } | 946 | } |
| 947 | |||
| 948 | |||
| 949 | /** | ||
| 950 | * 库存查询接口 | ||
| 951 | * @param params | ||
| 952 | * @return | ||
| 953 | */ | ||
| 954 | @RequestMapping("/querystock") | ||
| 955 | @ResponseBody | ||
| 956 | public String querystock(@RequestBody String params){ | ||
| 957 | logger.debug("查询库存:{}", params); | ||
| 958 | String result = ""; | ||
| 959 | try { | ||
| 960 | result = HTTPClient.sendJsonDataByPost("http://10.146.8.221:9002/medicinal-web/a/StoreDetail/queryDrugByDeptAll", params); | ||
| 961 | } catch (Exception e) { | ||
| 962 | result = e.getMessage(); | ||
| 963 | } | ||
| 964 | return result; | ||
| 965 | } | ||
| 966 | |||
| 967 | /** | ||
| 968 | * 近效期查询接口 | ||
| 969 | * @param params | ||
| 970 | * @return | ||
| 971 | */ | ||
| 972 | @RequestMapping("/queryexpir") | ||
| 973 | @ResponseBody | ||
| 974 | public String queryexpir(@RequestBody String params){ | ||
| 975 | logger.debug("查询近效期:{}", params); | ||
| 976 | String result = ""; | ||
| 977 | try { | ||
| 978 | result = HTTPClient.sendJsonDataByPost("http://10.146.8.221:9002/medicinal-web/a/ypjxq/statics/list", params); | ||
| 979 | } catch (Exception e) { | ||
| 980 | result = e.getMessage(); | ||
| 981 | } | ||
| 982 | return result; | ||
| 983 | } | ||
| 984 | |||
| 985 | /** | ||
| 986 | * 呆滞品查询接口 | ||
| 987 | * @param params | ||
| 988 | * @return | ||
| 989 | */ | ||
| 990 | @RequestMapping("/querydetained") | ||
| 991 | @ResponseBody | ||
| 992 | public String querydetained(@RequestBody String params){ | ||
| 993 | logger.debug("查询近效期:{}", params); | ||
| 994 | String result = ""; | ||
| 995 | if (client == null){ | ||
| 996 | client = HttpClients.createDefault(); | ||
| 997 | } | ||
| 998 | try { | ||
| 999 | JSONObject objec = JSON.parseObject(params); | ||
| 1000 | List<NameValuePair> param = new ArrayList<NameValuePair>(); | ||
| 1001 | param.add(new BasicNameValuePair("depetCode",objec.getString("depetCode"))); | ||
| 1002 | param.add(new BasicNameValuePair("pageNo",objec.getString("pageNo"))); | ||
| 1003 | param.add(new BasicNameValuePair("pageSize",objec.getString("pageSize"))); | ||
| 1004 | param.add(new BasicNameValuePair("startTime",objec.getString("startTime"))); | ||
| 1005 | param.add(new BasicNameValuePair("endTime",objec.getString("endTime"))); | ||
| 1006 | HttpPost post = new HttpPost("http://10.146.8.221:9002/medicinal-web/a/statics/delayStore/list"); | ||
| 1007 | post.setHeader("Content-Type", "application/x-www-form-urlencoded"); | ||
| 1008 | post.setEntity(new UrlEncodedFormEntity(param)); | ||
| 1009 | HttpResponse reponse = client.execute(post); | ||
| 1010 | HttpEntity entity = reponse.getEntity(); | ||
| 1011 | result = EntityUtils.toString(entity, "UTF-8"); | ||
| 1012 | } catch (Exception e) { | ||
| 1013 | result = e.getMessage(); | ||
| 1014 | } | ||
| 1015 | return result; | ||
| 1016 | } | ||
| 943 | } | 1017 | } | ... | ... |
-
Please register or sign in to post a comment