liyg 2 år sedan
förälder
incheckning
5edd33f1f7

+ 1 - 0
src/main/java/com/steerinfo/dil/controller/OffSiteTransportationController.java

@@ -529,6 +529,7 @@ public class OffSiteTransportationController extends BaseRESTfulController {
     @GetMapping("/getCurrentLocation")
     public RESTfulResult getCurrentLocation(@RequestParam("capcityNumber") String capcityNumber) throws Exception {
            CurrentLocationResult currentLocationResult = routeService.getCurrentLocation(capcityNumber);
+           currentLocationResult.setStatusStr();
            return success(currentLocationResult);
     }
     //在途订单列表

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

@@ -943,13 +943,14 @@ public class RouteServiceImpl implements RouteService {
     public CurrentLocationResult getCurrentLocation(String capcityNumber) throws Exception {
         String json = zhongJiaoXingLu.vLastLocationV3(capcityNumber);
         CurrentLocationResult currentLocationResult = (CurrentLocationResult) DataConversionTool.jsonToBean(json, CurrentLocationResult.class);
-        if (currentLocationResult.equals(1006)) {
-            return null;
-        }
-        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));
-            currentLocationResult.getResult().setLat(lngLon[0].toString());
-            currentLocationResult.getResult().setLon(lngLon[1].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));
+                currentLocationResult.getResult().setLat(lngLon[0].toString());
+                currentLocationResult.getResult().setLon(lngLon[1].toString());
+            }
+        }catch (Exception e){
+
         }
         return currentLocationResult;
     }

+ 72 - 0
src/main/java/com/steerinfo/route/vo/currentLocation/CurrentLocationResult.java

@@ -3,6 +3,7 @@ package com.steerinfo.route.vo.currentLocation;
 public class CurrentLocationResult {
     private CurrentLocation result;
     private Integer status;
+    private String statusStr;
     public void setResult(CurrentLocation result) {
         this.result = result;
     }
@@ -16,4 +17,75 @@ public class CurrentLocationResult {
     public Integer getStatus() {
         return status;
     }
+
+    public String getStatusStr() {
+        return statusStr;
+    }
+
+    public void setStatusStr() {
+        switch (status){
+            case 1001:
+                this.statusStr = "接口执行成功";
+                break;
+            case 1002:
+                this.statusStr = "参数不正确";
+                break;
+            case 1003:
+                this.statusStr = "车辆调用数量已达上限";
+                break;
+            case 1004:
+                this.statusStr = "接口调用次数已达上限";
+                break;
+            case 1005:
+                this.statusStr = "该 API 账号未授权指定所属行政区划数据范围";
+                break;
+            case 1006:
+                this.statusStr = "车辆暂无GPS";
+                break;
+            case 1010:
+                this.statusStr = "用户名或密码不正确";
+                break;
+            case 1011:
+                this.statusStr = "IP 不在白名单列表";
+                break;
+            case 1012:
+                this.statusStr = "账号已禁用";
+                break;
+            case 1013:
+                this.statusStr = "账号已过有效期";
+                break;
+            case 1014:
+                this.statusStr = "无接口权限";
+                break;
+            case 1015:
+                this.statusStr = "用户认证系统已升级,请使用令牌访问";
+                break;
+            case 1016:
+                this.statusStr = "令牌失效";
+                break;
+            case 1017:
+                this.statusStr = "账号欠费";
+                break;
+            case 1018:
+                this.statusStr = "授权的接口已禁用";
+                break;
+            case 1019:
+                this.statusStr = "授权的接口已过期";
+                break;
+            case 1020:
+                this.statusStr = "该车调用次数已达上限";
+                break;
+            case 1021:
+                this.statusStr = "client_id 不正确";
+                break;
+            case 1031:
+                this.statusStr = "签名验证失败";
+                break;
+            case 9001:
+                this.statusStr = "中交兴路系统异常";
+                break;
+            default:
+                this.statusStr = "未知状态";
+        }
+    }
 }