From 91a8b4ea5f48f722568b0dcf5af3d5be27fc0687 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Mon, 30 Mar 2026 22:14:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E9=A3=9E=E9=B9=85=20?= =?UTF-8?q?=E6=96=B0=20url=20=E5=9C=B0=E5=9D=80=E5=92=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/shop/store/utis/FeieUtil.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/utis/FeieUtil.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/utis/FeieUtil.java index 060f9a01..41dbe788 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/utis/FeieUtil.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/utis/FeieUtil.java @@ -40,7 +40,7 @@ import java.util.List; public class FeieUtil { private static final Logger logger = LoggerFactory.getLogger(FeieUtil.class); @Value("${feieyun.url}") - public String URL = "";//不需要修改 + public String FeieyunURL = "";//不需要修改 @Value("${feieyun.user}") public String USER = "";//*必填*:账号名 @Value("${feieyun.ukey}") @@ -96,7 +96,7 @@ public class FeieUtil { public Pair addPrinter(String printerInfo) { List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("printerContent", printerInfo)); - JSONObject reps = sendHttpPost2("printerAddlist", nvps); + JSONObject reps = sendHttpPost2(FeieyunURL + "printerAddlist", "Open_printerAddlist", nvps); if (reps == null) { return Pair.of(false, "打印机未返回数据,操作失败"); } @@ -124,7 +124,7 @@ public class FeieUtil { List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("snlist", snList)); - FeiePrinterApiRes reps = sendHttpPost("printerDelList", nvps); + FeiePrinterApiRes reps = sendHttpPost(FeieyunURL + "printerDelList", "Open_printerDelList", nvps); logger.info("飞鹅删除打印机返回数据:{}", reps); if (reps != null && reps.getRet().equals(0)) { return Pair.of(true, "打印机删除成功!"); @@ -150,7 +150,7 @@ public class FeieUtil { nvps.add(new BasicNameValuePair("sn", sn)); nvps.add(new BasicNameValuePair("content", printContent)); - FeiePrinterApiRes reps = sendHttpPost("printMsg", nvps); + FeiePrinterApiRes reps = sendHttpPost(FeieyunURL + "printMsg", "Open_printMsg", nvps); if (reps != null && reps.getRet().equals(0)) { // 返回打印编号,如:816501678_20160919184316_1419533539 return reps.getData(); @@ -201,7 +201,7 @@ public class FeieUtil { List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("sn", sn)); - FeiePrinterApiRes reps = sendHttpPost("delPrinterSqs", nvps); + FeiePrinterApiRes reps = sendHttpPost(FeieyunURL + "delPrinterSqs", "Open_delPrinterSqs", nvps); if (reps != null && reps.getRet().equals(0)) { return true; } @@ -226,11 +226,12 @@ public class FeieUtil { /** * 发送 http post 请求 * - * @param apiName + * @param apiUrl 如:https://api.feieyun.cn/Api/Open/printMsg + * @param apiName 接口名称,如:Open_printMsg * @param paramPair * @return */ - private FeiePrinterApiRes sendHttpPost(String apiName, List paramPair) { + private FeiePrinterApiRes sendHttpPost(String apiUrl, String apiName, List paramPair) { if (StrUtil.isBlank(apiName) || CollectionUtil.isEmpty(paramPair)) { return new FeiePrinterApiRes().fail("缺少必要参数!"); } @@ -245,7 +246,7 @@ public class FeieUtil { .setDefaultRequestConfig(requestConfig) .build(); - HttpPost post = new HttpPost(URL); + HttpPost post = new HttpPost(apiUrl); paramPair.add(new BasicNameValuePair("user", USER)); String STIME = String.valueOf(System.currentTimeMillis() / 1000); @@ -262,7 +263,7 @@ public class FeieUtil { HttpEntity httpentity = response.getEntity(); if (httpentity != null) { String result = EntityUtils.toString(httpentity); - logger.debug("飞鹅云返回到信息:{}", result); + logger.info("飞鹅云返回到信息:{}", result); return JsonUtil.json2object(result, FeiePrinterApiRes.class); } } @@ -275,7 +276,7 @@ public class FeieUtil { return null; } - private JSONObject sendHttpPost2(String apiName, List paramPair) { + private JSONObject sendHttpPost2(String apiUrl, String apiName, List paramPair) { if (StrUtil.isBlank(apiName) || CollectionUtil.isEmpty(paramPair)) { logger.info("缺少必要参数!"); return null; @@ -291,7 +292,7 @@ public class FeieUtil { .setDefaultRequestConfig(requestConfig) .build(); - HttpPost post = new HttpPost(URL); + HttpPost post = new HttpPost(apiUrl); paramPair.add(new BasicNameValuePair("user", USER)); String STIME = String.valueOf(System.currentTimeMillis() / 1000); @@ -308,7 +309,7 @@ public class FeieUtil { HttpEntity httpentity = response.getEntity(); if (httpentity != null) { String result = EntityUtils.toString(httpentity); - logger.debug("飞鹅云返回到信息:{}", result); + logger.info("飞鹅云返回到信息:{}", result); return JSONUtil.parseObj(result); } }