|
@@ -2,6 +2,7 @@ package info.aspirecn.iov.sjjh.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
|
|
|
import info.aspirecn.iov.sjjh.commons.lang.Constant;
|
|
@@ -54,6 +55,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
VehicleHistoryPositionRequestParam requestParam;
|
|
|
try {
|
|
|
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
|
requestParam = objectMapper.readValue(customBody, VehicleHistoryPositionRequestParam.class);
|
|
|
} catch (IOException ioe) {
|
|
|
log.info("supplier-vehicle.vehicleHistoryPositionQuery-解析参数Exception:{}", ioe);
|
|
@@ -73,8 +75,29 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ if (type.equals(VehicleHistoryPositionQueryType.VEHICLE_HISTORY_POSITION_QUERY.getValue())) {
|
|
|
+ // 车辆轨迹核验
|
|
|
+ upstreamCode = setVehicleHistoryPositionQueryResponse(ret, outTime, requestParam);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 车辆线上线下一致性验证
|
|
|
+ upstreamCode = vehiclePositionConsistencyCheck(ret, outTime, requestParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*----------------------------------------------------新增开始----------------------------------------------------*/
|
|
|
+
|
|
|
+ private String setVehicleHistoryPositionQueryResponse(ChannelTypeHandleResponseObject ret, int outTime,
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ String upstreamCode = vehiclePositionConsistencyCheck(ret, outTime, requestParam);
|
|
|
+ if (ret.getResultCode() != Constant.MATCH_CODE) {
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
// 接口调用
|
|
|
- Response response = new Response();
|
|
|
+ Response response;
|
|
|
try {
|
|
|
RequestObject requestObject = new RequestObject();
|
|
|
requestObject.setVehicleNumber(requestParam.getPlateNumber());
|
|
@@ -84,6 +107,29 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
requestObject.setPartyFunctionCode(supplierConfig.getPartyFunctionCode());
|
|
|
response = PostUtil.postString(supplierConfig.getHistoryPositionUrl(), JSON.toJSONString(requestObject),
|
|
|
supplierConfig.getAppKey(), supplierConfig.getAppSecret(), outTime);
|
|
|
+ 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) {
|
|
|
+ JSONObject vehicleLocationInfo = new JSONObject();
|
|
|
+ vehicleLocationInfo.put("vehicleLocationInfo", positionResponse.getData());
|
|
|
+ ret.setResultBody(vehicleLocationInfo);
|
|
|
+ }
|
|
|
+ ret.setIsCharge(Constant.IS_CHARGE);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
log.info("supplier-vehicle.vehicleHistoryPositionQuery-IOException:{}", e);
|
|
|
ErrorUtils.captureException(e);
|
|
@@ -93,19 +139,221 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
ErrorUtils.captureException(e);
|
|
|
ret.setCode(Constant.FAIL);
|
|
|
}
|
|
|
- if (type.equals(VehicleHistoryPositionQueryType.VEHICLE_HISTORY_POSITION_QUERY.getValue())) {
|
|
|
- // 车辆轨迹核验
|
|
|
- upstreamCode = setVehicleHistoryPositionQueryResponse(ret, response, requestParam);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer subdivisionCodeCheck(VehicleHistoryPositionRequestParam requestParam, String subdivisionCodeType, Integer outTime
|
|
|
+ , String upstreamCode) {
|
|
|
+ String startTime;
|
|
|
+ String endTime;
|
|
|
+ if (subdivisionCodeType.equals("loadingCountrySubdivisionCode")) {
|
|
|
+ // A-
|
|
|
+ startTime = DateUtil.addHours(requestParam.getStartTime(), supplierConfig.getReduceHours());
|
|
|
+ // A+
|
|
|
+ endTime = DateUtil.addHours(requestParam.getStartTime(), supplierConfig.getAddHours());
|
|
|
} else {
|
|
|
- // 车辆线上线下一致性验证
|
|
|
- upstreamCode = setVehiclePositionConsistencyCheckResponse(ret, response, requestParam);
|
|
|
+ // B-
|
|
|
+ startTime = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getReduceHours());
|
|
|
+ // B+
|
|
|
+ endTime = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getAddHours());
|
|
|
+ }
|
|
|
+ Response response;
|
|
|
+ try {
|
|
|
+ RequestObject requestObject = new RequestObject();
|
|
|
+ requestObject.setVehicleNumber(requestParam.getPlateNumber());
|
|
|
+ requestObject.setLicensePlateTypeCode(requestParam.getPlateColor());
|
|
|
+ requestObject.setStartTime(startTime);
|
|
|
+ requestObject.setEndTime(endTime);
|
|
|
+ requestObject.setPartyFunctionCode(supplierConfig.getPartyFunctionCode());
|
|
|
+ response = PostUtil.postString(supplierConfig.getHistoryPositionUrl(), JSON.toJSONString(requestObject),
|
|
|
+ supplierConfig.getAppKey(), supplierConfig.getAppSecret(), outTime);
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.info("supplier-vehicle.vehicleHistoryAPositionQuery-IOException:{}", e);
|
|
|
+ ErrorUtils.captureException(e);
|
|
|
+ return Constants.REQUEST_TIMEOUT;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("supplier-vehicle.vehicleHistoryAPositionQuery-Exception:{}", e);
|
|
|
+ ErrorUtils.captureException(e);
|
|
|
+ return Constant.FAIL;
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ if (subdivisionCodeType.equals("loadingCountrySubdivisionCode")) {
|
|
|
+ result = vehiclePositionConsistencyCheck(positionResponse.getData(), requestParam.getLoadingCountrySubdivisionCode());
|
|
|
+ } else {
|
|
|
+ result = vehiclePositionConsistencyCheck(positionResponse.getData(), requestParam.getReceiptCountrySubdivisionCode());
|
|
|
+ }
|
|
|
+ if (result) {
|
|
|
+ return Constant.MATCH_CODE;
|
|
|
+ } else {
|
|
|
+ return Constant.UN_MATCH_CODE;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return Constant.UN_FIND_NUM_CODE;
|
|
|
+ }
|
|
|
+// retA.setIsCharge(Constant.IS_CHARGE);
|
|
|
+ } else if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_110000)) {
|
|
|
+ return Constant.UN_FIND_NUM_CODE;
|
|
|
+ } else {
|
|
|
+ return Constant.OTHER_ERROR_CODE;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return Constant.OTHER_ERROR_CODE;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ private String vehiclePositionConsistencyCheck(ChannelTypeHandleResponseObject ret, int outTime,
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ /**
|
|
|
+ * 1、云雁分调取A-到A+和B-到B+的轨迹,并取这两段轨迹中的每个点的行政区划代码合集X和合集Y
|
|
|
+ * 2、将合集X分别与A点行政区划进行比对,只要有一点比对一致则视为此点核验通过
|
|
|
+ * 3、将合集Y分别与B点行政区划进行比对,只要有一点比对一致则视为此点核验通过
|
|
|
+ * 4、A点和B点均核验通过视为此核验项通过
|
|
|
+ */
|
|
|
+ String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
|
|
|
+ Integer loadingCountryResult = subdivisionCodeCheck(requestParam, "loadingCountrySubdivisionCode", outTime, upstreamCode);
|
|
|
|
|
|
- request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
- return ret;
|
|
|
+ if (loadingCountryResult == Constants.REQUEST_TIMEOUT) {
|
|
|
+ // 请求超时
|
|
|
+ ret.setCode(Constant.REQUEST_TIMEOUT);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (loadingCountryResult == Constant.FAIL) {
|
|
|
+ // 请求异常
|
|
|
+ ret.setCode(Constant.FAIL);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (loadingCountryResult == Constant.OTHER_ERROR_CODE) {
|
|
|
+ // 装货点(A点)调用失败
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ Integer receiptCountryResult = subdivisionCodeCheck(requestParam, "receiptCountrySubdivisionCode", outTime, upstreamCode);
|
|
|
+ if (receiptCountryResult == Constants.REQUEST_TIMEOUT) {
|
|
|
+ // 请求超时
|
|
|
+ ret.setCode(Constant.REQUEST_TIMEOUT);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (receiptCountryResult == Constant.FAIL) {
|
|
|
+ // 请求异常
|
|
|
+ ret.setCode(Constant.FAIL);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (receiptCountryResult == Constant.OTHER_ERROR_CODE) {
|
|
|
+ // 卸货点(B点)调用失败
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (loadingCountryResult == Constant.MATCH_CODE && receiptCountryResult == Constant.MATCH_CODE) {
|
|
|
+ // 装货点(A点)一致 且 卸货点(B点)一致;返回一致
|
|
|
+ ret.setResultCode(Constant.MATCH_CODE);
|
|
|
+ ret.setResultBody(Constant.MATCH);
|
|
|
+ ret.setResultDesc(Constant.MATCH);
|
|
|
+ ret.setIsCharge(Constant.IS_CHARGE);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ List<String> errorList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (loadingCountryResult == Constant.UN_MATCH_CODE && receiptCountryResult == Constant.UN_MATCH_CODE) {
|
|
|
+ // 装货点(A点)结果为空 且 卸货点(B点)结果为空;返回查无
|
|
|
+ errorList.add("loadingCountrySubdivisionCode");
|
|
|
+ errorList.add("receiptCountrySubdivisionCode");
|
|
|
+ ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
|
+ ret.setResultBody(errorList);
|
|
|
+ ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ if (loadingCountryResult == Constant.UN_MATCH_CODE) {
|
|
|
+ // 装货点(A点)不一致
|
|
|
+ errorList.add("loadingCountrySubdivisionCode");
|
|
|
+ }
|
|
|
+ if (receiptCountryResult == Constant.UN_MATCH_CODE) {
|
|
|
+ // 卸货点(B点)不一致
|
|
|
+ errorList.add("receiptCountrySubdivisionCode");
|
|
|
+ }
|
|
|
+ if (errorList.size() > 0) {
|
|
|
+ // 装货点(A点)一致 或 卸货点(B点)不一致;返回不一致
|
|
|
+ ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
|
+ ret.setResultBody(errorList);
|
|
|
+ ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
+ ret.setIsCharge(Constant.IS_CHARGE);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (loadingCountryResult == Constant.UN_FIND_NUM_CODE) {
|
|
|
+ // 装货点(A点)为空
|
|
|
+ errorList.add("loadingCountrySubdivisionCode");
|
|
|
+ }
|
|
|
+ if (receiptCountryResult == Constant.UN_FIND_NUM_CODE) {
|
|
|
+ // 卸货点(B点)为空
|
|
|
+ errorList.add("receiptCountrySubdivisionCode");
|
|
|
+ }
|
|
|
+ if (errorList.size() > 0) {
|
|
|
+ // 装货点(A点)为空 或 卸货点(B点)为空;返回不一致
|
|
|
+ ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
|
+ ret.setResultBody(errorList);
|
|
|
+ ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
+ return upstreamCode;
|
|
|
+ }
|
|
|
+ return upstreamCode;
|
|
|
}
|
|
|
|
|
|
+ private boolean vehiclePositionConsistencyCheck(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
+ String subdivisionCode) {
|
|
|
+ for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
+ if (subdivisionCode.equals(position.getPositionDescribe())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String vehiclePositionConsistencyACheck(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ boolean checkResultA = false;
|
|
|
+ for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
+ if (!requestParam.getLoadingCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
+ checkResultA = true;
|
|
|
+ }
|
|
|
+ if (checkResultA) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!checkResultA) {
|
|
|
+ return "loadingCountrySubdivisionCode";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private String vehiclePositionConsistencyBCheck(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ boolean checkResultB = false;
|
|
|
+ for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
+ if (!requestParam.getReceiptCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
+ checkResultB = true;
|
|
|
+ }
|
|
|
+ if (checkResultB) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!checkResultB) {
|
|
|
+ return "receiptCountrySubdivisionCode";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /*----------------------------------------------------新增结束----------------------------------------------------*/
|
|
|
+
|
|
|
private String setVehicleHistoryPositionQueryResponse(ChannelTypeHandleResponseObject ret, Response response,
|
|
|
VehicleHistoryPositionRequestParam requestParam) {
|
|
|
String upstreamCode = "";
|
|
@@ -154,7 +402,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
}
|
|
|
|
|
|
private String vehicleHistoryPositionQuery(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
- VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
/**
|
|
|
* 1、云雁调取A-到B+之间所有的车辆轨迹(每30秒有一个经纬度数据)。
|
|
|
* 2、从A-到A+时间区间中每半个小时抽取一个点位信息的行政区划代码集合,将此集合与A点(起点)行政区划代码进行比对,只要有一点比对一致则视为此点核验通过。
|
|
@@ -174,18 +422,21 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
String endTimeB = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getAddHours());
|
|
|
|
|
|
// 4小时*2=8小时(A-A+间隔),8小时*2=16个点(每半个小时取1个点)
|
|
|
- int pointNumber = supplierConfig.getAddHours()*2*2;
|
|
|
+ int pointNumber = supplierConfig.getAddHours() * 2 * 2;
|
|
|
|
|
|
+ /**
|
|
|
+ * A点,装货点,8小时16个点,进行处理各个点的时间点
|
|
|
+ */
|
|
|
List<String> checkTimeListA = new ArrayList<>();
|
|
|
String tempStartTime = startTimeA;
|
|
|
- for (int i = 0; i < pointNumber+1; i++) {
|
|
|
+ for (int i = 0; i < pointNumber + 1; i++) {
|
|
|
checkTimeListA.add(tempStartTime);
|
|
|
tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
}
|
|
|
|
|
|
List<String> checkTimeListB = new ArrayList<>();
|
|
|
tempStartTime = startTimeB;
|
|
|
- for (int i = 0; i < pointNumber+1; i++) {
|
|
|
+ for (int i = 0; i < pointNumber + 1; i++) {
|
|
|
checkTimeListB.add(tempStartTime);
|
|
|
tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
}
|
|
@@ -193,10 +444,10 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
boolean checkResultA = false;
|
|
|
// 这个集合为了查看位置是否正确
|
|
|
List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
|
|
|
- for (int i = 0; i < checkTimeListA.size()-1; i++) {
|
|
|
+ for (int i = 0; i < checkTimeListA.size() - 1; i++) {
|
|
|
for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListA.get(i))
|
|
|
- && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i+1))) {
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i + 1))) {
|
|
|
verificationPositionListA.add(position);
|
|
|
if (requestParam.getLoadingCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
checkResultA = true;
|
|
@@ -215,10 +466,10 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
boolean checkResultB = false;
|
|
|
// 这个集合为了查看位置是否正确
|
|
|
List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
|
|
|
- for (int i = 0; i < checkTimeListB.size()-1; i++) {
|
|
|
+ for (int i = 0; i < checkTimeListB.size() - 1; i++) {
|
|
|
for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListB.get(i))
|
|
|
- && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i+1))) {
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i + 1))) {
|
|
|
verificationPositionListB.add(position);
|
|
|
if (requestParam.getReceiptCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
checkResultB = true;
|
|
@@ -234,12 +485,12 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
if (checkResultA && checkResultB) {
|
|
|
return "";
|
|
|
} else {
|
|
|
- return "receiptCountrySubdivisionCode与数据源不一致";
|
|
|
+ return "receiptCountrySubdivisionCode与数据源不一致";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String setVehiclePositionConsistencyCheckResponse(ChannelTypeHandleResponseObject ret, Response response,
|
|
|
- VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
String upstreamCode = "";
|
|
|
log.info("supplier-vehicle.vehicleHistoryPositionCheck-responseStatus:{}", response.getStatusCode());
|
|
|
log.info("supplier-vehicle.vehicleHistoryPositionCheck-responseBody:{}", response.getBody());
|
|
@@ -249,7 +500,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
upstreamCode = positionResponse.getResultCode();
|
|
|
if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_0)) {
|
|
|
if (positionResponse.getData() != null && positionResponse.getData().size() > 0) {
|
|
|
- String result = vehicleHistoryPositionQuery(positionResponse.getData(), requestParam);
|
|
|
+ String result = vehiclePositionConsistencyCheck(positionResponse.getData(), requestParam);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
ret.setResultCode(Constant.MATCH_CODE);
|
|
|
ret.setResultBody(Constant.MATCH);
|
|
@@ -284,7 +535,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
}
|
|
|
|
|
|
private String vehiclePositionConsistencyCheck(List<VehicleHistoryPositionResponse.Data> positionList,
|
|
|
- VehicleHistoryPositionRequestParam requestParam) {
|
|
|
+ VehicleHistoryPositionRequestParam requestParam) {
|
|
|
/**
|
|
|
* 1、云雁调取A-到B+之间的车辆轨迹
|
|
|
* 2、将B点与B-到B+时间点内的行政区划代码做对比,得出比对结果一
|
|
@@ -298,28 +549,28 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
String startTimeB = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getReduceHours());
|
|
|
|
|
|
// 4小时*2=8小时(A-A+间隔),8小时*2=16个点(每半个小时取1个点)
|
|
|
- int pointNumber = supplierConfig.getAddHours()*2*2;
|
|
|
+ int pointNumber = supplierConfig.getAddHours() * 2 * 2;
|
|
|
|
|
|
List<String> checkTimeListA = new ArrayList<>();
|
|
|
String tempStartTime = startTimeA;
|
|
|
- for (int i = 0; i < pointNumber+1; i++) {
|
|
|
+ for (int i = 0; i < pointNumber + 1; i++) {
|
|
|
checkTimeListA.add(tempStartTime);
|
|
|
tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
}
|
|
|
|
|
|
List<String> checkTimeListB = new ArrayList<>();
|
|
|
tempStartTime = startTimeB;
|
|
|
- for (int i = 0; i < pointNumber+1; i++) {
|
|
|
+ for (int i = 0; i < pointNumber + 1; i++) {
|
|
|
checkTimeListB.add(tempStartTime);
|
|
|
tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
}
|
|
|
|
|
|
// 这个集合为了查看位置是否正确
|
|
|
List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
|
|
|
- for (int i = 0; i < checkTimeListA.size()-1; i++) {
|
|
|
+ for (int i = 0; i < checkTimeListA.size() - 1; i++) {
|
|
|
for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListA.get(i))
|
|
|
- && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i+1))) {
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i + 1))) {
|
|
|
verificationPositionListA.add(position);
|
|
|
if (!requestParam.getLoadingCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
return "loadingCountrySubdivisionCode";
|
|
@@ -331,10 +582,10 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
|
|
|
// 这个集合为了查看位置是否正确
|
|
|
List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
|
|
|
- for (int i = 0; i < checkTimeListB.size()-1; i++) {
|
|
|
+ for (int i = 0; i < checkTimeListB.size() - 1; i++) {
|
|
|
for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListB.get(i))
|
|
|
- && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i+1))) {
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i + 1))) {
|
|
|
verificationPositionListB.add(position);
|
|
|
if (!requestParam.getReceiptCountrySubdivisionCode().equals(position.getPositionDescribe())) {
|
|
|
return "receiptCountrySubdivisionCode";
|
|
@@ -429,16 +680,16 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
} else {
|
|
|
// 不一致,返回具体不一致项
|
|
|
String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_VEHICLE_NUMBER)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_VEHICLE_NUMBER)) {
|
|
|
errorList.add("vehicleNumber");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_ROAD_TRANSPORT_CERTIFICATE_NUMBER)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_ROAD_TRANSPORT_CERTIFICATE_NUMBER)) {
|
|
|
errorList.add("roadTransportCertificateNumber");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_FROM)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_FROM)) {
|
|
|
errorList.add("roadTransportCertificateValidPeriodFrom");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_TO)){
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_TO)) {
|
|
|
errorList.add("roadTransportCertificateValidPeriodTo");
|
|
|
}
|
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
@@ -484,7 +735,6 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
PersonQualificationCertificateRequestParam requestParam;
|
|
|
try {
|
|
|
- PersonQualificationCertificateRequestParam jsonObject = JSON.toJavaObject(JSON.parseObject(customBody), PersonQualificationCertificateRequestParam.class);
|
|
|
requestParam = objectMapper.readValue(customBody, PersonQualificationCertificateRequestParam.class);
|
|
|
} catch (IOException ioe) {
|
|
|
log.info("supplier-vehicle.checkPersonQualificationCertificate-解析参数Exception:{}", ioe);
|
|
@@ -552,22 +802,22 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
} else {
|
|
|
// 不一致,返回具体不一致项
|
|
|
String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_DRIVER_NAME)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_DRIVER_NAME)) {
|
|
|
errorList.add("driverName");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_DRIVING_LICENSE)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_DRIVING_LICENSE)) {
|
|
|
errorList.add("drivingLicense");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_PROVINCE_CODE)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_PROVINCE_CODE)) {
|
|
|
errorList.add("provinceCode");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE)){
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE)) {
|
|
|
errorList.add("qualificationCertificate");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_FROM)){
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_FROM)) {
|
|
|
errorList.add("qualificationCertificateValidPeriodFrom");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_TO)){
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_TO)) {
|
|
|
errorList.add("qualificationCertificateValidPeriodTo");
|
|
|
}
|
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
@@ -680,16 +930,16 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
} else {
|
|
|
// 不一致,返回具体不一致项
|
|
|
String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_CARRIER)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_CARRIER)) {
|
|
|
errorList.add("carrier");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_PERMIT_NUMBER)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_PERMIT_NUMBER)) {
|
|
|
errorList.add("permitNumber");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_PERMIT_VALID_PERIOD_FROM)) {
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_PERMIT_VALID_PERIOD_FROM)) {
|
|
|
errorList.add("permitValidPeriodFrom");
|
|
|
}
|
|
|
- if (errorInfo.contains(Constants.UN_MATCH_PERMIT_VALID_PERIOD_TO)){
|
|
|
+ if (errorInfo.equals(Constants.UN_MATCH_PERMIT_VALID_PERIOD_TO)) {
|
|
|
errorList.add("permitValidPeriodTo");
|
|
|
}
|
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|