haungfuli 2 jaren geleden
bovenliggende
commit
85821a77ec

+ 57 - 9
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/EntityAnalyse.java

@@ -22,6 +22,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.*;
 import java.net.HttpURLConnection;
@@ -35,6 +36,8 @@ import java.util.*;
 
 public class EntityAnalyse {
 
+    @Value("${com.changyuntong.env}")
+    private static String ENV;
 
     /**
      * 获取交投系统token
@@ -44,7 +47,12 @@ public class EntityAnalyse {
      */
     public static String GetJTToken() throws IOException {
         String pwd = DigestUtils.sha1Hex("Ccj841968545");
-        String url = "http://116.182.4.67:50065/platform/login/login";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/login/login";
+        }else {
+            url = "http://116.182.4.67:50065/platform/login/login";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);
@@ -83,7 +91,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String uploadImage(File image, String token) throws IOException {
-        String url = "http://116.182.4.67:50065/platform/file/uploadImage";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/file/uploadImage";
+        }else {
+            url = "http://116.182.4.67:50065/platform/file/uploadImage";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);
@@ -133,7 +146,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String uploadDriverInfo(HyDriverInfo hyDriverInfo) throws IOException, ParseException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/driver";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/driver";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/driver";
+        }
         SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
@@ -205,7 +223,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String uploadDriverCarInfo(HyDriverCarInfo hyDriverCarInfo) throws IOException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/vehicle";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/vehicle";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/vehicle";
+        }
         SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
@@ -309,7 +332,12 @@ public class EntityAnalyse {
         DecimalFormat df = new DecimalFormat("0");
         DecimalFormat df1 = new DecimalFormat("0");
 
-        String url = "http://116.182.4.67:50065/platform/api/v1/transport";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/transport";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/transport";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);
@@ -441,7 +469,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String uploadFlowSheet(HyFreightSettlementInfo hyFreightSettlementInfo) throws IOException, ParseException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/money";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/money";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/money";
+        }
         SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
         DecimalFormat df1 = new DecimalFormat("0");
@@ -536,7 +569,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String driverInfoCheck(HyDriverInfo hyDriverInfo) throws IOException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/driver/validate";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/driver/validate";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/driver/validate";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);
@@ -588,7 +626,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String driverCarInfoCheck(HyDriverCarInfo hyDriverCarInfo) throws IOException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/vehicle/validate";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/vehicle/validate";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/vehicle/validate";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);
@@ -645,7 +688,12 @@ public class EntityAnalyse {
      * @throws IOException
      */
     public static String waybillCheck(OrderInfo orderInfo) throws IOException {
-        String url = "http://116.182.4.67:50065/platform/api/v1/driver/validate";
+        String url = "";
+        if("3".equals(ENV)){
+            url = "http://116.182.4.67:50033/platform/api/v1/transport/validate";
+        }else {
+            url = "http://116.182.4.67:50065/platform/api/v1/transport/validate";
+        }
         CloseableHttpClient httpClient = HttpClients.createDefault();
         // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
         HttpPost httpPost = new HttpPost(url);

+ 30 - 5
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/MonitoringSystemReporting.java

@@ -7,6 +7,7 @@ import com.yh.saas.plugin.yiliangyiyun.entity.HyFreightSettlementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.OrderInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.*;
 import com.yh.saas.plugin.yiliangyiyun.service.Waybill;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.IOException;
 import java.text.DecimalFormat;
@@ -15,6 +16,8 @@ import java.util.*;
 
 public class MonitoringSystemReporting {
 
+    @Value("${com.changyuntong.env}")
+    private static String ENV;
 
     /**
      * 用户列表
@@ -25,12 +28,9 @@ public class MonitoringSystemReporting {
     };
 
     /**
-     * 测试
+     * 发送地址
      */
-    public static final String debugStr = Constants.DEBUG_SYSTEM_CODE;
-    public static final String sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
-    //todo 正式发送报文接口
-//    public static final String sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+    public static String sendUrl = "";
 
 
     /**
@@ -153,6 +153,11 @@ public class MonitoringSystemReporting {
         Root root = getRoot(driver, name, loginRoot("23106960", "qweasd!@#123", "91230229MABPEWQX94", "debugSystem"));
         String messageJson = JSON.toJSONString(root);
         System.out.println("发送报文的内容:" + messageJson);
+        if ("3".equals(ENV)) {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+        }else {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
+        }
         String result = PostUtils.post(sendUrl, messageJson);
         System.out.println("服务器返回消息:" + result);
         return result;
@@ -237,6 +242,11 @@ public class MonitoringSystemReporting {
         Root root = getRoot(vehicle, name, loginRoot("23106960", "qweasd!@#123", "91230229MABPEWQX94", "debugSystem"));
         String messageJson = JSON.toJSONString(root);
         System.out.println("发送报文的内容:" + messageJson);
+        if ("3".equals(ENV)) {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+        }else {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
+        }
         String result = PostUtils.post(sendUrl, messageJson);
         System.out.println("服务器返回消息:" + result);
         return result;
@@ -290,6 +300,11 @@ public class MonitoringSystemReporting {
         Root root = getRoot(vehicle, name, loginRoot("23106960", "qweasd!@#123", "91230229MABPEWQX94", "debugSystem"));
         String messageJson = JSON.toJSONString(root);
         System.out.println("发送报文的内容:" + messageJson);
+        if ("3".equals(ENV)) {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+        }else {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
+        }
         String result = PostUtils.post(sendUrl, messageJson);
         System.out.println("服务器返回消息:" + result);
         return result;
@@ -340,6 +355,11 @@ public class MonitoringSystemReporting {
         Root root = getRoot(financialRoot, name, loginRoot("23106960", "qweasd!@#123", "91230229MABPEWQX94", "debugSystem"));
         String messageJson = JSON.toJSONString(root);
         System.out.println("发送报文的内容:" + messageJson);
+        if ("3".equals(ENV)) {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+        }else {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
+        }
         String result = PostUtils.post(sendUrl, messageJson);
         System.out.println("服务器返回消息:" + result);
         return result;
@@ -357,6 +377,11 @@ public class MonitoringSystemReporting {
         Root root = getRoot(dispatch, name, edmRoot);
         String messageJson = JSON.toJSONString(root);
         System.out.println("发送报文的内容:" + messageJson);
+        if ("3".equals(ENV)) {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-kafka/message/sendMsg";
+        }else {
+            sendUrl = "https://heilongjiang.wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
+        }
         String result = PostUtils.post(sendUrl, messageJson);
         System.out.println("服务器返回消息:" + result);
         return result;