Browse Source

状态值重新处理

zhaohui 3 năm trước cách đây
mục cha
commit
05fe21f05e

+ 13 - 18
src/main/java/info/aspirecn/iov/sjjh/service/impl/VehicleServiceImpl.java

@@ -81,7 +81,7 @@ public class VehicleServiceImpl implements VehicleService {
 
         } else {
             // 车辆线上线下一致性验证
-            upstreamCode = setVehiclePositionConsistencyTwoCheckResponse(ret, outTime, requestParam);
+            upstreamCode = vehiclePositionConsistencyTwoCheck(ret, outTime, requestParam);
         }
 
         request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
@@ -153,22 +153,6 @@ public class VehicleServiceImpl implements VehicleService {
         return upstreamCode;
     }
 
-    private String setVehiclePositionConsistencyTwoCheckResponse(ChannelTypeHandleResponseObject ret, int outTime,
-                                                                 VehicleHistoryPositionRequestParam requestParam){
-        String upstreamCode = "";
-        String result = vehiclePositionConsistencyTwoCheck(ret, outTime, requestParam);
-        if (StringUtils.isBlank(result)) {
-            ret.setResultCode(Constant.MATCH_CODE);
-            ret.setResultBody(Constant.MATCH);
-            ret.setResultDesc(Constant.QUERY_SUCCESS);
-        } else {
-            ret.setResultCode(Constant.UN_MATCH_CODE);
-            ret.setResultBody(result);
-            ret.setResultDesc(Constant.QUERY_SUCCESS);
-        }
-        return upstreamCode;
-    }
-
     private String vehiclePositionConsistencyTwoCheck(ChannelTypeHandleResponseObject ret, int outTime,
                                                       VehicleHistoryPositionRequestParam requestParam){
         ChannelTypeHandleResponseObject retA = new ChannelTypeHandleResponseObject();
@@ -318,6 +302,9 @@ public class VehicleServiceImpl implements VehicleService {
 
         // A、B两点都比对通过
         if(retA.getResultCode()==Constant.MATCH_CODE&&retB.getResultCode()==Constant.MATCH_CODE){
+            ret.setResultCode(Constant.MATCH_CODE);
+            ret.setResultBody(Constant.MATCH);
+            ret.setResultDesc(Constant.QUERY_SUCCESS);
             return upstreamCodeA;
         }
 
@@ -337,7 +324,15 @@ public class VehicleServiceImpl implements VehicleService {
             return upstreamCodeB;
         }
 
-        // errList有数据时,状态值2
+        // A、B点为无返回结果,状态码4
+        if(retA.getResultCode()==Constant.UN_FIND_NUM_CODE && retB.getResultCode()==Constant.UN_FIND_NUM_CODE){
+            ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+            ret.setResultBody(errList);
+            ret.setResultDesc(Constant.QUERY_SUCCESS);
+            return upstreamCodeA;
+        }
+
+        // errList有数据时,状态码2
         if(errList.size()>0){
             ret.setResultCode(Constant.UN_MATCH_CODE);
             ret.setResultBody(errList);