Selaa lähdekoodia

增加接口:车辆历史轨迹核验(运单详版)

15810770710@163.com 4 vuotta sitten
vanhempi
commit
df1f87f442

+ 1 - 1
src/main/java/info/aspirecn/iov/yysj/check/info/CheckInfo.java

@@ -43,7 +43,7 @@ public class CheckInfo {
 		Property property = context.getBean(Property.class);
 		log.info("{}",property.getRequestParamTransfer());
 		watch.stop();
-
+		log.info("版本号:{}", "1.20.0");
 		log.info("{} Ver.{} ({}) 启动完毕,serverPort={}, managementServerPort={}, times={}s", infoName, infoVersion,
 				applicationName, serverPort, managementServerPort, watch.getTotalTimeSeconds());
 	}

+ 121 - 24
src/main/java/info/aspirecn/iov/yysj/check/info/common/TransferParam.java

@@ -1,5 +1,7 @@
 package info.aspirecn.iov.yysj.check.info.common;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import info.aspirecn.cloud.yysj.commons.lang.Constants;
 import info.aspirecn.iov.yysj.paramtransfer.inter.common.Constant;
 import lombok.extern.slf4j.Slf4j;
@@ -84,9 +86,12 @@ public class TransferParam {
 		if ("13".equals(productId)) {// 司机上下线
 
 			customBody = sjsxx(paramMap, emptyList, errorList);
-		}if ("15".equals(productId)) {//装卸货点车辆定位验证
-
+		}
+		if ("15".equals(productId) || "14".equals(productId)) {// 15 装卸货点车辆定位验证; 14车辆历史轨迹核验(车辆线上线下一致性验证)
 			customBody=zxhdwyz(paramMap, emptyList, errorList);
+		}
+		if ("16".equals(productId)) {
+			customBody = waybillHistoryPosition(paramMap, emptyList, errorList);
 		} else if (Constants.OtherRquestUrl.IDLENTITYVERIFICATION.getValue().equals(productId)) {// 身份核验
 			String req_id = paramMap.get(Constants.req_id);
 			if (StringUtils.isEmpty(req_id)) {
@@ -840,62 +845,64 @@ public class TransferParam {
 
 		if (vehicleNumber == null || StringUtils.isEmpty(vehicleNumber)) {
 			emptyList.add(Constants.bill_vehicleNumber);
-		}
-		if (!checkPlateNumber(vehicleNumber)) {
-			errorList.add(Constants.bill_vehicleNumber);
+		} else {
+			if (!checkPlateNumber(vehicleNumber)) {
+				errorList.add(Constants.bill_vehicleNumber);
+			}
 		}
 
 		if (vehiclePlateColorCode == null || StringUtils.isEmpty(vehiclePlateColorCode)) {
 			emptyList.add(Constants.bill_vehiclePlateColorCode);
-		}
-		if (!checkPlateColor(vehiclePlateColorCode)) {
-			errorList.add(Constants.bill_vehiclePlateColorCode);
+		} else {
+			if (!checkPlateColor(vehiclePlateColorCode)) {
+				errorList.add(Constants.bill_vehiclePlateColorCode);
+			}
 		}
 
 		if (receiptCountrySubdivisionCode == null || StringUtils.isEmpty(receiptCountrySubdivisionCode)) {
 			emptyList.add(Constants.bill_receipt_country_subdivision_code);
-		}
-		if (!checkNumber(receiptCountrySubdivisionCode)) {
-			errorList.add(Constants.bill_receipt_country_subdivision_code);
+		} else {
+			if (!checkNumber(receiptCountrySubdivisionCode)) {
+				errorList.add(Constants.bill_receipt_country_subdivision_code);
+			}
 		}
 
 		if (goodsReceiptDateTime == null || StringUtils.isEmpty(goodsReceiptDateTime)) {
 			emptyList.add(Constants.bill_goodsReceiptDateTime);
-		}
-		if(!checkDateTime(goodsReceiptDateTime,"yyyyMMddHHmmss")){
-			errorList.add(Constants.bill_goodsReceiptDateTime);
+		} else {
+			if(!checkDateTime(goodsReceiptDateTime,"yyyyMMddHHmmss")){
+				errorList.add(Constants.bill_goodsReceiptDateTime);
+			}
 		}
 
 		if (loadingCountrySubdivisionCode == null || StringUtils.isEmpty(loadingCountrySubdivisionCode)) {
 			emptyList.add(Constants.bill_loading_country_subdivision_code);
-		}
-		if (!checkNumber(loadingCountrySubdivisionCode)) {
-			errorList.add(Constants.bill_loading_country_subdivision_code);
+		} else {
+			if (!checkNumber(loadingCountrySubdivisionCode)) {
+				errorList.add(Constants.bill_loading_country_subdivision_code);
+			}
 		}
 
 		if (despatchActualDateTime == null || StringUtils.isEmpty(despatchActualDateTime)) {
 			emptyList.add(Constants.bill_despatchActualDateTime);
-		}
-		if(!checkDateTime(despatchActualDateTime,"yyyyMMddHHmmss")){
-			errorList.add(Constants.bill_despatchActualDateTime);
+		} else {
+			if(!checkDateTime(despatchActualDateTime,"yyyyMMddHHmmss")){
+				errorList.add(Constants.bill_despatchActualDateTime);
+			}
 		}
 
 		if (shippingNoteNumber == null || StringUtils.isEmpty(shippingNoteNumber)) {
 			emptyList.add(Constants.bill_shipping_note_number);
 		}
-
 		if (placeOfLoading == null || StringUtils.isEmpty(placeOfLoading)) {
 			emptyList.add(Constants.bill_place_of_loading);
 		}
-
 		if (goodsReceiptPlace == null || StringUtils.isEmpty(goodsReceiptPlace)) {
 			emptyList.add(Constants.bill_goods_receipt_place);
 		}
-
 		if (verificationTimeRadius == null || StringUtils.isEmpty(verificationTimeRadius)) {
 			emptyList.add(Constants.bill_verification_time_radius);
 		}
-
 		Map<String, Object> resultMap = new HashMap<>();
 		if(emptyList.size() == 0 && errorList.size() == 0) {
 			resultMap.put(Constants.zxh_vehicleNumber,vehicleNumber);
@@ -907,7 +914,97 @@ public class TransferParam {
 			return resultMap;
 		}
 		return null;
+	}
+
+	// 校验项 车辆历史轨迹核验(运单详版)
+	public Map<String, Object> waybillHistoryPosition(Map<String, String> requestMap, Set<String> emptyList, Set<String> errorList){
+		log.info("requestMap:{}", requestMap);
+		// 车牌号校验
+		Object vehicleInfo = requestMap.get(Constants.bill_vehicleInfo);
+		log.info("vehicleInfo:{}", vehicleInfo);
+		JSONObject vehicleInfoObject = new JSONObject();
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		if (vehicleInfo == null) {
+			emptyList.add(Constants.bill_vehicleInfo);
+		} else {
+			vehicleInfoObject = JSON.parseObject(JSON.toJSONString(vehicleInfo));
+		}
+		log.info("vehicleInfoObject:{}", vehicleInfoObject);
+		// 车牌号
+		String vehicleNumber = vehicleInfoObject.getString(Constants.bill_vehicleNumber);
+		// 车牌颜色
+		String vehiclePlateColorCode = vehicleInfoObject.getString(Constants.bill_vehiclePlateColorCode);
+		// 收货地址的国家行政区划代码
+		String receiptCountrySubdivisionCode = vehicleInfoObject.getString(Constants.bill_receipt_country_subdivision_code);
+		// 收货日期时间
+		String goodsReceiptDateTime = requestMap.get(Constants.bill_goodsReceiptDateTime);
+		// 装货地址的国家行政区划代码
+		String loadingCountrySubdivisionCode = vehicleInfoObject.getString(Constants.bill_loading_country_subdivision_code);
+		// 发货日期时间
+		String despatchActualDateTime = requestMap.get(Constants.bill_despatchActualDateTime);
 
+		log.info("获取参数");
+		if (vehicleNumber == null || StringUtils.isEmpty(vehicleNumber)) {
+			emptyList.add(Constants.bill_vehicleInfo + "." + Constants.bill_vehicleNumber);
+		} else {
+			if (!checkPlateNumber(vehicleNumber)) {
+				errorList.add(Constants.bill_vehicleInfo + "." + Constants.bill_vehicleNumber);
+			}
+		}
+
+		if (vehiclePlateColorCode == null || StringUtils.isEmpty(vehiclePlateColorCode)) {
+			emptyList.add(Constants.bill_vehicleInfo + "." + Constants.bill_vehiclePlateColorCode);
+		} else {
+			if (!checkPlateColor(vehiclePlateColorCode)) {
+				errorList.add(Constants.bill_vehicleInfo + "." + Constants.bill_vehiclePlateColorCode);
+			}
+		}
+
+		if (receiptCountrySubdivisionCode == null || StringUtils.isEmpty(receiptCountrySubdivisionCode)) {
+			emptyList.add(Constants.bill_vehicleInfo + "." + Constants.bill_receipt_country_subdivision_code);
+		} else {
+			if (!checkNumber(receiptCountrySubdivisionCode)) {
+				errorList.add(Constants.bill_vehicleInfo + "." + Constants.bill_receipt_country_subdivision_code);
+			}
+		}
+
+		if (goodsReceiptDateTime == null || StringUtils.isEmpty(goodsReceiptDateTime)) {
+			emptyList.add(Constants.bill_goodsReceiptDateTime);
+		} else {
+			if(!checkDateTime(goodsReceiptDateTime,"yyyyMMddHHmmss")){
+				errorList.add(Constants.bill_goodsReceiptDateTime);
+			}
+		}
+
+		if (loadingCountrySubdivisionCode == null || StringUtils.isEmpty(loadingCountrySubdivisionCode)) {
+			emptyList.add(Constants.bill_vehicleInfo + "." + Constants.bill_loading_country_subdivision_code);
+		} else {
+			if (!checkNumber(loadingCountrySubdivisionCode)) {
+				errorList.add(Constants.bill_vehicleInfo + "." + Constants.bill_loading_country_subdivision_code);
+			}
+		}
+
+		if (despatchActualDateTime == null || StringUtils.isEmpty(despatchActualDateTime)) {
+			emptyList.add(Constants.bill_despatchActualDateTime);
+		} else {
+			if(!checkDateTime(despatchActualDateTime,"yyyyMMddHHmmss")){
+				errorList.add(Constants.bill_despatchActualDateTime);
+			}
+		}
+		log.info("参数校验");
+
+		if (emptyList.size() == 0 && errorList.size() == 0) {
+			resultMap.put(Constants.zxh_vehicleNumber,vehicleNumber);
+			resultMap.put(Constants.zxh_vehiclePlateColorCode,vehiclePlateColorCode);
+			resultMap.put(Constants.zxh_receiptCountrySubdivisionCode, receiptCountrySubdivisionCode);
+			resultMap.put(Constants.zxh_goodsReceiptDateTime, goodsReceiptDateTime);
+			resultMap.put(Constants.zxh_loadingCountrySubdivisionCode, loadingCountrySubdivisionCode);
+			resultMap.put(Constants.zxh_despatchActualDateTime, despatchActualDateTime);
+			log.info("参数拼接");
+			return resultMap;
+		}
+		log.info("参数校验失败");
+		return null;
 	}
 
 	public static boolean checkPlateColor(String plateColor) {

+ 2 - 0
src/main/java/info/aspirecn/iov/yysj/check/info/common/ZuulHelper.java

@@ -384,6 +384,8 @@ public class ZuulHelper {
 				return 12;
 			}else if (Constants.VehicleTrajectoryUrl.HISTORY_POSITION.getValue().equals(url)) {
 				return 13;
+			}else if (Constants.RequestUrl.VEHICLE_POSITION_CONSISTENCY_CHECK.getValue().equals(url)) {
+				return 14;
 			}
 
 		return 0;

+ 1 - 0
src/main/java/info/aspirecn/iov/yysj/check/info/pre/InterfaceFilter.java

@@ -29,6 +29,7 @@ public class InterfaceFilter extends ZuulFilter {
 		requestContext.getRequest().setAttribute("paramBody",new HashMap());
 		requestContext.getRequest().setAttribute("queryParam",new HashMap());
 		requestContext.getRequest().setAttribute("CheckDetails",new ArrayList<>());
+		log.info("InterfaceFilter-url:{},CommonUtil.checkAllUrl:{}", url, CommonUtil.checkAllUrl(url));
 		return  !CommonUtil.checkAllUrl(url)&&!CommonUtil.checkRoadTransUrl(url);
 	}
 

+ 5 - 5
src/main/java/info/aspirecn/iov/yysj/check/info/pre/WayBillFilter.java

@@ -149,9 +149,9 @@ public class WayBillFilter extends ZuulFilter {
 					productCheckRequest.setSjjhProductId(list);
 					productCheckRequest.setCustomBody(yysjProduct.getCostomObject());
 					String requestBody = mapper.writeValueAsString(productCheckRequest);
-
+					log.info("requestBody:{},userId:{},traceId:{},yysjProduct.getYysjProductId:{}", requestBody, userId, traceId, yysjProduct.getYysjProductId());
 					BillItemResult billItemResult = channelRibbonHandle.channelRibbonHandle(token, requestBody, userId, traceId, yysjProduct.getYysjProductId());
-
+					log.info("billItemResult:{}", billItemResult.toString());
 
 					concreteCheckResult.setResult("1".equals(billItemResult.getResult())?"0":"1");
 					if (!"1".equals(billItemResult.getResult())) {
@@ -217,19 +217,19 @@ public class WayBillFilter extends ZuulFilter {
 			String   checkDetailsStr = mapper.writeValueAsString(checkDetails);
 			request.setAttribute("CheckDetails",checkDetailsStr);
 		} catch (ResultCodeException ex){
-			log.error("resultCodeException:{}",ex);
+			log.error("resultCodeException:{}",ex.getMessage());
 			billResultObject.setResultCode(ex.getCode());
 			billResultObject.setResultMsg(ex.getMessage());
 			billResultObject.setTraceId((String)requestContext.get(Constants.HEADER_TRACEID_KEY));
 		}catch (Exception ex) {
-			log.error("Exception:{}",ex);
+			log.error("Exception:{}",ex.getMessage());
 			billResultObject.setResultCode(Constants.ResultDesc.SERVERERROR.getCode());
 			billResultObject.setResultMsg(Constants.ResultDesc.SERVERERROR.getValue());
 			billResultObject.setTraceId((String) requestContext.get(Constants.HEADER_TRACEID_KEY));
 		}
 		helper.responseHandle(billResultObject, requestContext,false);
 	}catch (JsonProcessingException e) {
-			log.error("解析对象出错,message:{}", e);
+			log.error("解析对象出错,message:{}", e.getMessage());
 		}
 		return null;