luobang hace 1 año
padre
commit
f2f9d3f474

+ 7 - 5
src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java

@@ -276,22 +276,18 @@ public class RouteServiceImpl implements RouteService {
      */
     @Override
     public CompletableFuture<String> saveRoute(Map mapValue) throws Exception {
-
         //获得起点的经纬度和code
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date gateTime = dateFormat.parse(mapValue.get("resultOutGateTime").toString());
         String searchPointJson = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("shipperName").toString() == null ? "四川省达州钢铁集团有限责任公司" : mapValue.get("shipperName").toString(), "utf-8") + "&key=" + gaodeTonken);
         SearchPoint2 searchPoint = JSON.parseObject(searchPointJson, SearchPoint2.class);
-
         //创建收货地址    addressProvince 省份、addressDistrict 市区、addressTown 县镇 、addressDeliveryAddress 收货地址、 addressLongitude 收货地址经度、addressLatitude 收货地址纬度
         String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("receiveAddress").toString() == null ? "长沙市" : mapValue.get("receiveAddress").toString(), "utf-8") + "&key=" + gaodeTonken);
         SearchPoint2 searchPoint2 = JSON.parseObject(searchPointJson2, SearchPoint2.class);
-
         //入网验证
         String netValidationResult = zhongJiaoXingLu.netValidation(mapValue.get("capacityNumber").toString());
         Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
         if (Integer.parseInt(netValidationMap.get("status").toString()) == 1001 && netValidationMap.get("result").toString().equals("yes")) {
-
             //运单生成之后保存
             HashMap<String, String> redisMap = new HashMap<>();
             String location = searchPoint.getGeocodes().get(0).getLocation();
@@ -907,7 +903,13 @@ public class RouteServiceImpl implements RouteService {
     @Override
     public CurrentLocationResult getCurrentLocation(String capcityNumber) throws Exception {
         String json = zhongJiaoXingLu.vLastLocationV3(capcityNumber);
-        CurrentLocationResult currentLocationResult = JSONObject.parseObject(json,CurrentLocationResult.class);
+        CurrentLocationResult currentLocationResult = new CurrentLocationResult();
+        try {
+            currentLocationResult = JSONObject.parseObject(json, CurrentLocationResult.class);
+        } catch (Exception e) {
+            Map<String, Object> map = new HashMap<>(JSONObject.parseObject(json));
+            currentLocationResult.setStatus(Integer.parseInt(map.get("status").toString()));
+        }
         try{
             if(currentLocationResult.getResult().getLat()!=null&&currentLocationResult.getResult().getLon()!=null){
                 Double[] lngLon = LngLonUtil.gps84_To_Gcj02((Double.valueOf(currentLocationResult.getResult().getLat()) / 600000), (Double.valueOf(currentLocationResult.getResult().getLon()) / 600000));

+ 4 - 4
src/main/resources/bootstrap.yml

@@ -54,10 +54,10 @@ str:
   tengxun:
     key: WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y
   ZhongJiaoXingLu:
-    cid: 84254ac6-9f05-47c7-ba3c-1d3398590d70
-    srt: b7c4b6ee-09c8-4865-a0b7-934d42205012
-    user: 108e0bda-1795-4e43-9df9-426a446eb77f
-    pwd: cKyp9G98yFy3gHBHG21us7z85377S1
+    user: 0c3380c1-582c-459b-89ec-892a61dbf9d1
+    pwd: 11L2f7OQeA30yR74Iv64T705NW0j0P
+    srt: 84e7259e-4a4d-476a-bd66-d74bb3992b9b
+    cid: b524705f-cf4c-483f-986a-3c96c5961398
     #停车
     parkMins: 60
     #离线时长