|
@@ -20,6 +20,7 @@ import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -90,7 +91,6 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
requestObject.setPartyFunctionCode(supplierConfig.getPartyFunctionCode());
|
|
|
response = PostUtil.postString(supplierConfig.getHistoryPositionUrl(), JSON.toJSONString(requestObject),
|
|
|
supplierConfig.getAppKey(), supplierConfig.getAppSecret(), outTime);
|
|
|
- System.out.println(JSON.toJSONString(response));
|
|
|
} catch (IOException e) {
|
|
|
log.info("supplier-vehicle.vehicleHistoryPositionQuery-IOException:{}", e);
|
|
|
ErrorUtils.captureException(e);
|
|
@@ -108,14 +108,16 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
private String setVehicleHistoryPositionQueryResponse(ChannelTypeHandleResponseObject ret, Response response,
|
|
|
VehicleHistoryPositionRequestParam requestParam) {
|
|
|
String upstreamCode = "";
|
|
|
+ log.info("supplier-vehicle.vehicleHistoryPositionQuery-responseStatus:{}", response.getStatusCode());
|
|
|
+ log.info("supplier-vehicle.vehicleHistoryPositionQuery-responseBody:{}", response.getBody());
|
|
|
if (response.getStatusCode() == Constants.STATUS_CODE_200) {
|
|
|
VehicleHistoryPositionResponse positionResponse = JSON.toJavaObject(JSON.parseObject(response.getBody()),
|
|
|
VehicleHistoryPositionResponse.class);
|
|
|
upstreamCode = positionResponse.getResultCode();
|
|
|
if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_0)) {
|
|
|
if (positionResponse.getData() != null && positionResponse.getData().size() > 0) {
|
|
|
- boolean result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
|
|
|
- if (result) {
|
|
|
+ String result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
|
|
|
+ if (StringUtils.isBlank(result)) {
|
|
|
JSONObject vehicleLocationInfo = new JSONObject();
|
|
|
vehicleLocationInfo.put("vehicleLocationInfo", positionResponse.getData());
|
|
|
ret.setResultCode(Constant.MATCH_CODE);
|
|
@@ -123,7 +125,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
} else {
|
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
|
- ret.setResultBody("核验不一致");
|
|
|
+ ret.setResultBody(result);
|
|
|
ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
}
|
|
|
} else {
|
|
@@ -150,7 +152,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
return upstreamCode;
|
|
|
}
|
|
|
|
|
|
- private boolean vehicleHistoryPositionQueryByBaidu(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
+ private String vehicleHistoryPositionQueryByBaidu(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
VehicleHistoryPositionRequestParam requestParam) {
|
|
|
/**
|
|
|
* 1、云雁调取A-到B+之间所有的车辆轨迹(每30秒有一个经纬度数据)。
|
|
@@ -195,9 +197,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListA.get(i))
|
|
|
&& Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i+1))) {
|
|
|
verificationPositionListA.add(position);
|
|
|
- if (getGeocodingCheck(3000,
|
|
|
- (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
- requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
+ if (requestParam.getLoadingCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
checkResultA = true;
|
|
|
}
|
|
|
break;
|
|
@@ -208,7 +208,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
}
|
|
|
}
|
|
|
if (!checkResultA) {
|
|
|
- return false;
|
|
|
+ return "loadingCountrySubdivisionCode与数据源不一致";
|
|
|
}
|
|
|
|
|
|
boolean checkResultB = false;
|
|
@@ -219,9 +219,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListB.get(i))
|
|
|
&& Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i+1))) {
|
|
|
verificationPositionListB.add(position);
|
|
|
- if (getGeocodingCheck(3000,
|
|
|
- (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
- requestParam.getReceiptCountrySubdivisionCode())) {
|
|
|
+ if (requestParam.getReceiptCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
checkResultB = true;
|
|
|
}
|
|
|
break;
|
|
@@ -233,9 +231,9 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
}
|
|
|
|
|
|
if (checkResultA && checkResultB) {
|
|
|
- return true;
|
|
|
+ return "";
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return "receiptCountrySubdivisionCode与数据源不一致";
|
|
|
}
|
|
|
}
|
|
|
|