|
@@ -13,6 +13,7 @@ import org.apache.http.util.EntityUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
@@ -23,7 +24,7 @@ import java.util.*;
|
|
|
* <Date> 2021年5月6日16:49:40 </Date>
|
|
|
* <Author> JK </Author>
|
|
|
*/
|
|
|
-
|
|
|
+@Component
|
|
|
public class PosPrinterUtil {
|
|
|
|
|
|
private static Logger logger =(Logger) LoggerFactory.getLogger(PosPrinterUtil.class);
|
|
@@ -32,7 +33,13 @@ public class PosPrinterUtil {
|
|
|
//public static final String SEND_POS_PRINT_MESSAGE_URL = "http://www.huijy.net/mqapi/sendPosPrintFanoutMessage";
|
|
|
|
|
|
//测试环境:http://mp.huijy.net/mqapi/sendPosPrintFanoutMessage
|
|
|
- public static final String SEND_POS_PRINT_MESSAGE_URL = "http://mp.huijy.net/mqapi/sendPosPrintFanoutMessage";
|
|
|
+ //public static final String SEND_POS_PRINT_MESSAGE_URL = "http://mp.huijy.net/mqapi/sendPosPrintFanoutMessage";
|
|
|
+ public static String domainName;
|
|
|
+
|
|
|
+ @Value("${yijia.domainName}")
|
|
|
+ public void setDomainName(String doMain){
|
|
|
+ this.domainName = doMain;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//推送要打印小票的信息
|
|
@@ -43,6 +50,7 @@ public class PosPrinterUtil {
|
|
|
String resultString ="";
|
|
|
try {
|
|
|
// 创建Http Post请求
|
|
|
+ String SEND_POS_PRINT_MESSAGE_URL = "http://"+domainName+"/mqapi/sendPosPrintFanoutMessage";
|
|
|
HttpPost httpPost = new HttpPost(SEND_POS_PRINT_MESSAGE_URL);
|
|
|
logger.info("POS推送订单消息地址:" +SEND_POS_PRINT_MESSAGE_URL);
|
|
|
// 创建请求内容
|
|
@@ -54,6 +62,7 @@ public class PosPrinterUtil {
|
|
|
logger.info("POS推送订单消息结果:" +resultString);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ logger.info("POS推送订单消息异常信息:"+e.getMessage());
|
|
|
}finally {
|
|
|
try {
|
|
|
response.close();
|