15810770710@163.com преди 3 години
родител
ревизия
869d4838f0

+ 1 - 1
pom.xml

@@ -96,7 +96,7 @@
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
-            <version>1.2.15</version>
+            <version>1.2.76</version>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>

+ 99 - 0
src/main/java/info/aspirecn/iov/sjjh/action/VehicleAction.java

@@ -97,4 +97,103 @@ public class VehicleAction {
         request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
         return ret;
     }
+
+    @ApiOperation(value = "运政-车辆运输许可证", notes = "")
+    @PostMapping(value = "/checkVehicleRoadTransport.do")
+    public ChannelTypeHandleResponseObject checkVehicleRoadTransport(
+            @ApiParam(value="通道ID")@RequestHeader(name="channelId")  String channelId,
+            @ApiParam(value="超时时间,单位:毫秒",example = "10000")@RequestParam(name = "outTime", required = true) int outTime,
+            @ApiParam(value="请求参数JSON串")@RequestParam(name = "customBody", required = true) String customBody) {
+        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+                .getRequest();
+
+        //调用service
+        ChannelTypeHandleResponseObject ret = vehicleService.checkVehicleRoadTransport(request, customBody, outTime);
+
+        //把接口参数、调用结果和是否收费放入访问日志中
+        if(ret.getCode() != Constant.SUCCESS) {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_ERROR_CODE);
+        } else {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_SUCCESS_CODE);
+        }
+        request.setAttribute(Constants.Charge_Log_Key, ret.getIsCharge());
+
+        try {
+            request.setAttribute(Constant.CHANNEL_LOG_QUERY,
+                    Base64.encodeBase64String(customBody.getBytes(Constants.ENCODING)));
+
+        } catch (Exception ex) {
+            ErrorUtils.captureException(ex);
+            log.error("checkVehicleRoadTransport.encodeBase64String.Exception=", ex);
+        }
+
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        return ret;
+    }
+
+    @ApiOperation(value = "运政-人员从业资格证核验", notes = "")
+    @PostMapping(value = "/checkPersonQualificationCertificate.do")
+    public ChannelTypeHandleResponseObject checkPersonQualificationCertificate(
+            @ApiParam(value="通道ID")@RequestHeader(name="channelId")  String channelId,
+            @ApiParam(value="超时时间,单位:毫秒",example = "10000")@RequestParam(name = "outTime", required = true) int outTime,
+            @ApiParam(value="请求参数JSON串")@RequestParam(name = "customBody", required = true) String customBody) {
+        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+                .getRequest();
+
+        //调用service
+        ChannelTypeHandleResponseObject ret = vehicleService.checkPersonQualificationCertificate(request, customBody, outTime);
+
+        //把接口参数、调用结果和是否收费放入访问日志中
+        if(ret.getCode() != Constant.SUCCESS) {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_ERROR_CODE);
+        } else {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_SUCCESS_CODE);
+        }
+        request.setAttribute(Constants.Charge_Log_Key, ret.getIsCharge());
+
+        try {
+            request.setAttribute(Constant.CHANNEL_LOG_QUERY,
+                    Base64.encodeBase64String(customBody.getBytes(Constants.ENCODING)));
+
+        } catch (Exception ex) {
+            ErrorUtils.captureException(ex);
+            log.error("checkPersonQualificationCertificate.encodeBase64String.Exception=", ex);
+        }
+
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        return ret;
+    }
+
+    @ApiOperation(value = "运政-企业道路运输经营许可证核验", notes = "")
+    @PostMapping(value = "/checkEnterpriseRoadTransport.do")
+    public ChannelTypeHandleResponseObject checkEnterpriseRoadTransport(
+            @ApiParam(value="通道ID")@RequestHeader(name="channelId")  String channelId,
+            @ApiParam(value="超时时间,单位:毫秒",example = "10000")@RequestParam(name = "outTime", required = true) int outTime,
+            @ApiParam(value="请求参数JSON串")@RequestParam(name = "customBody", required = true) String customBody) {
+        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+                .getRequest();
+
+        //调用service
+        ChannelTypeHandleResponseObject ret = vehicleService.checkEnterpriseRoadTransport(request, customBody, outTime);
+
+        //把接口参数、调用结果和是否收费放入访问日志中
+        if(ret.getCode() != Constant.SUCCESS) {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_ERROR_CODE);
+        } else {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_SUCCESS_CODE);
+        }
+        request.setAttribute(Constants.Charge_Log_Key, ret.getIsCharge());
+
+        try {
+            request.setAttribute(Constant.CHANNEL_LOG_QUERY,
+                    Base64.encodeBase64String(customBody.getBytes(Constants.ENCODING)));
+
+        } catch (Exception ex) {
+            ErrorUtils.captureException(ex);
+            log.error("checkEnterpriseRoadTransport.encodeBase64String.Exception=", ex);
+        }
+
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        return ret;
+    }
 }

+ 3 - 0
src/main/java/info/aspirecn/iov/sjjh/config/SupplierConfig.java

@@ -18,4 +18,7 @@ public class SupplierConfig {
     private int reduceHours;
     private String baiduUrl;
     private String baiduAk;
+    private String vehicleRoadTransportUrl;
+    private String personQualificationUrl;
+    private String enterpriseRoadTransportUrl;
 }

+ 43 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/Constants.java

@@ -52,7 +52,50 @@ public class Constants {
     public static final String RESULT_CODE_110000 = "110000";
     // 查询成功,查无结果
     public static final String NO_RESULT = "查询成功,查无结果";
+    // isCharge
     public static String Charge_Log_Key="isCharge";
+    // respnoseCode
     public static String Charge_Log_ResponseCode="respnoseCode";
+    // application/json;charset=UTF-8
+    public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";
+    // 车辆运输许可证、人员从业资格证、企业道路运输许可证返回码  resultCode-0
+    public static final String CERTIFICATE_CHECK_RESULT_CODE_0 = "0";
+    // 车辆运输许可证、人员从业资格证、企业道路运输许可证返回码  resultCode-110000
+    public static final String CERTIFICATE_CHECK_RESULT_CODE_110000 = "110000";
+    // 车辆运输许可证、人员从业资格证、企业道路运输许可证返回码  resultCode-140001
+    public static final String CERTIFICATE_CHECK_RESULT_CODE_140001 = "140001";
+    // 车辆运输许可证、人员从业资格证、企业道路运输许可证返回码  resultCode-140002
+    public static final String CERTIFICATE_CHECK_RESULT_CODE_140002 = "140002";
+
+    // 不一致字段-vehicleNumber
+    public static final String UN_MATCH_VEHICLE_NUMBER = "车辆牌照号";
+    // 不一致字段-roadTransportCertificateNumber
+    public static final String UN_MATCH_ROAD_TRANSPORT_CERTIFICATE_NUMBER = "道路运输证号";
+    // 不一致字段-roadTransportCertificateValidPeriodFrom
+    public static final String UN_MATCH_CERTIFICATE_VALID_PERIOD_FROM = "道路运输证有效期自";
+    // 不一致字段-roadTransportCertificateValidPeriodTo
+    public static final String UN_MATCH_CERTIFICATE_VALID_PERIOD_TO = "道路运输证有效期至";
+
+    // 不一致字段-driverName
+    public static final String UN_MATCH_DRIVER_NAME = "姓名";
+    // 不一致字段-drivingLicense
+    public static final String UN_MATCH_DRIVING_LICENSE = "身份证号";
+    // 不一致字段-provinceCode
+    public static final String UN_MATCH_PROVINCE_CODE = "从业资格证省份区划代码";
+    // 不一致字段-qualificationCertificate
+    public static final String UN_MATCH_QUALIFICATION_CERTIFICATE = "从业资格证号";
+    // 不一致字段-qualificationCertificateValidPeriodFrom
+    public static final String UN_MATCH_QUALIFICATION_CERTIFICATE_FROM = "从业资格证有效期自";
+    // 不一致字段-qualificationCertificateValidPeriodTo
+    public static final String UN_MATCH_QUALIFICATION_CERTIFICATE_TO = "从业资格证有效期至";
+
+    // 不一致字段-carrier
+    public static final String UN_MATCH_CARRIER = "网络货运经营者名称";
+    // 不一致字段-permitNumber
+    public static final String UN_MATCH_PERMIT_NUMBER = "道路运输经营许可证编号";
+    // 不一致字段-permitValidPeriodFrom
+    public static final String UN_MATCH_PERMIT_VALID_PERIOD_FROM = "道路运输经营许可证有效期自";
+    // 不一致字段-permitValidPeriodTo
+    public static final String UN_MATCH_PERMIT_VALID_PERIOD_TO = "道路运输经营许可证有效期至";
 
 }

+ 31 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/EnterpriseRoadTransportPermitRequestParam.java

@@ -0,0 +1,31 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import lombok.Data;
+import lombok.ToString;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+@ToString
+public class EnterpriseRoadTransportPermitRequestParam implements Serializable {
+    // 网络货运经营者名称
+    @NotNull(message = "参数名错误")
+    private String carrier;
+
+    // 道路运输经营许可证编号
+    @NotNull(message = "参数名错误")
+    private String permitNumber;
+
+    // 道路运输经营许可证有效期自
+    @NotNull(message = "参数名错误")
+    private String permitValidPeriodFrom;
+
+    // 道路运输经营许可证有效期至
+    @NotNull(message = "参数名错误")
+    private String permitValidPeriodTo;
+}

+ 47 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/PersonQualificationCertificateRequestParam.java

@@ -0,0 +1,47 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.ToString;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+@ToString
+public class PersonQualificationCertificateRequestParam implements Serializable {
+    // 姓名
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "nameOfPerson")
+    private String driverName;
+
+    // 身份证号
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "drivingLicense")
+    private String drivingLicense;
+
+    // 从业资格证省份区划代码
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "provinceCode")
+    private String provinceCode;
+
+    // 从业资格证号
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "qualificationCertificateNumber")
+    private String qualificationCertificate;
+
+    // 从业资格证有效期自
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "periodStartDate")
+    private String qualificationCertificateValidPeriodFrom;
+
+    // 从业资格证有效期至
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "periodEndDate")
+    private String qualificationCertificateValidPeriodTo;
+}

+ 43 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/RoadTransportPermitResponse.java

@@ -0,0 +1,43 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+@ToString
+public class RoadTransportPermitResponse {
+    private String resultCode;
+    private String resultMsg;
+    private Data data;
+
+    @lombok.Data
+    @ToString
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class Data {
+        private String inconsistentMSG;
+        private String consistentMSG;
+        private List<verifyResult> verifyResultSet;
+        private String remark;
+    }
+
+    @lombok.Data
+    @ToString
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class verifyResult {
+        private String verifyCode;
+        private String verifyMSG;
+        private String result;
+        private String errorInfo;
+        private String remark;
+    }
+}

+ 36 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/VehicleRoadTransportPermitRequestParam.java

@@ -0,0 +1,36 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.ToString;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+@ToString
+public class VehicleRoadTransportPermitRequestParam {
+    // 车牌号
+    @NotNull(message = "参数名错误")
+    private String vehicleNumber;
+
+    // 道路运输证号
+    @NotNull(message = "参数名错误")
+    private String roadTransportCertificateNumber;
+
+    // 道路运输证有效期自
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "periodStartDate")
+    private String roadTransportCertificateValidPeriodFrom;
+
+    // 道路运输证有效期至
+    @NotNull(message = "参数名错误")
+    @JsonProperty(value = "periodEndDate")
+    private String roadTransportCertificateValidPeriodTo;
+
+
+    private String licensePlateTypeCode;
+}

+ 30 - 0
src/main/java/info/aspirecn/iov/sjjh/service/VehicleService.java

@@ -16,4 +16,34 @@ public interface VehicleService {
      */
     ChannelTypeHandleResponseObject vehicleHistoryPositionQuery(HttpServletRequest request, String customBody,
                                                                         int outTime, Integer type);
+
+    /**
+     * 车辆运输许可证核验接口
+     * @param request
+     * @param customBody
+     * @param outTime
+     * @return
+     */
+    ChannelTypeHandleResponseObject checkVehicleRoadTransport(HttpServletRequest request, String customBody,
+                                                                int outTime);
+
+    /**
+     * 人员从业资格证核验接口
+     * @param request
+     * @param customBody
+     * @param outTime
+     * @return
+     */
+    ChannelTypeHandleResponseObject checkPersonQualificationCertificate(HttpServletRequest request, String customBody,
+                                                              int outTime);
+
+    /**
+     * 企业道路运输经营许可证核验接口
+     * @param request
+     * @param customBody
+     * @param outTime
+     * @return
+     */
+    ChannelTypeHandleResponseObject checkEnterpriseRoadTransport(HttpServletRequest request, String customBody,
+                                                              int outTime);
 }

+ 379 - 15
src/main/java/info/aspirecn/iov/sjjh/service/impl/VehicleServiceImpl.java

@@ -7,11 +7,7 @@ import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
 import info.aspirecn.iov.sjjh.commons.lang.Constant;
 import info.aspirecn.iov.sjjh.config.SupplierConfig;
 import info.aspirecn.iov.sjjh.constant.Constants;
-import info.aspirecn.iov.sjjh.entity.RequestObject;
-import info.aspirecn.iov.sjjh.entity.Response;
-import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionRequestParam;
-import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionResponse;
-import info.aspirecn.iov.sjjh.entity.geocoding.GeocodingResponseObject;
+import info.aspirecn.iov.sjjh.entity.*;
 import info.aspirecn.iov.sjjh.enums.VehicleHistoryPositionQueryType;
 import info.aspirecn.iov.sjjh.service.VehicleService;
 import info.aspirecn.iov.sjjh.util.DateUtil;
@@ -20,7 +16,6 @@ import info.aspirecn.iov.sjjh.util.ValidateParamUtil;
 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;
@@ -28,10 +23,7 @@ import org.springframework.stereotype.Service;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
 
 /**
  * @author xusonglin
@@ -75,7 +67,6 @@ public class VehicleServiceImpl implements VehicleService {
 
         // 参数校验
         if (!ValidateParamUtil.validateRequestParams(requestParam)) {
-            ret.setCode(Constant.FAIL);
             ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
             ret.setResultBody(Constant.INVALID_PARAMETER);
             ret.setResultDesc(Constant.INVALID_PARAMETER);
@@ -200,7 +191,7 @@ public class VehicleServiceImpl implements VehicleService {
         }
 
         boolean checkResultA = false;
-        // todo 这个集合为了查看位置是否正确
+        // 这个集合为了查看位置是否正确
         List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
         for (int i = 0; i < checkTimeListA.size()-1; i++) {
             for (VehicleHistoryPositionResponse.Data position : positionList) {
@@ -222,7 +213,7 @@ public class VehicleServiceImpl implements VehicleService {
         }
 
         boolean checkResultB = false;
-        // todo 这个集合为了查看位置是否正确
+        // 这个集合为了查看位置是否正确
         List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
         for (int i = 0; i < checkTimeListB.size()-1; i++) {
             for (VehicleHistoryPositionResponse.Data position : positionList) {
@@ -258,7 +249,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 = vehiclePositionConsistencyCheck(positionResponse.getData(), requestParam);
+                    String result = vehicleHistoryPositionQuery(positionResponse.getData(), requestParam);
                     if (StringUtils.isBlank(result)) {
                         ret.setResultCode(Constant.MATCH_CODE);
                         ret.setResultBody(Constant.MATCH);
@@ -323,7 +314,7 @@ public class VehicleServiceImpl implements VehicleService {
             tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
         }
 
-        // todo 这个集合为了查看位置是否正确
+        // 这个集合为了查看位置是否正确
         List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
         for (int i = 0; i < checkTimeListA.size()-1; i++) {
             for (VehicleHistoryPositionResponse.Data position : positionList) {
@@ -338,7 +329,7 @@ public class VehicleServiceImpl implements VehicleService {
             }
         }
 
-        // todo 这个集合为了查看位置是否正确
+        // 这个集合为了查看位置是否正确
         List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
         for (int i = 0; i < checkTimeListB.size()-1; i++) {
             for (VehicleHistoryPositionResponse.Data position : positionList) {
@@ -354,4 +345,377 @@ public class VehicleServiceImpl implements VehicleService {
         }
         return "";
     }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkVehicleRoadTransport(HttpServletRequest request, String customBody, int outTime) {
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+        ret.setCode(Constant.SUCCESS);
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        if (outTime <= Constants.PARA_ZERO) {
+            outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
+        }
+
+        log.info("supplier-vehicle.checkVehicleRoadTransport---customBody={},outTime={}", customBody, outTime);
+        // 解析参数
+        ObjectMapper objectMapper = new ObjectMapper();
+        VehicleRoadTransportPermitRequestParam requestParam;
+        try {
+            requestParam = objectMapper.readValue(customBody, VehicleRoadTransportPermitRequestParam.class);
+        } catch (IOException ioe) {
+            log.info("supplier-vehicle.checkVehicleRoadTransport-解析参数Exception:{}", ioe);
+            ErrorUtils.captureException(ioe);
+            ret.setCode(Constant.FAIL);
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 参数校验
+        if (!ValidateParamUtil.validateRequestParams(requestParam)) {
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 接口调用
+        String responseContext = "";
+        try {
+            okhttp3.Response response = PostUtil.postString(supplierConfig.getVehicleRoadTransportUrl(), JSON.toJSONString(requestParam), outTime);
+            if (response.body() != null) {
+                responseContext = response.body().string();
+                upstreamCode = setVehicleRoadTransportResponse(ret, responseContext);
+            } else {
+                ret.setCode(Constant.FAIL);
+            }
+            log.info("responseContext:{}", responseContext);
+        } catch (IOException e) {
+            log.info("supplier-vehicle.vehicleHistoryPositionQuery-IOException:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.REQUEST_TIMEOUT);
+        } catch (Exception e) {
+            log.info("supplier-vehicle.vehicleHistoryPositionQuery-Exception:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.FAIL);
+        }
+
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        return ret;
+    }
+
+    private String setVehicleRoadTransportResponse(ChannelTypeHandleResponseObject ret, String responseContext) {
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        RoadTransportPermitResponse responseObject = JSON.toJavaObject(JSON.parseObject(responseContext),
+                RoadTransportPermitResponse.class);
+        if (responseObject == null) {
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+            return upstreamCode;
+        }
+
+        String resultCode = responseObject.getResultCode();
+        upstreamCode = resultCode;
+        List<String> errorList = new ArrayList<>();
+        if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_0)) {
+            if (responseObject.getData().getVerifyResultSet().get(0).getResult().equals("0")) {
+                // 一致
+                ret.setResultCode(Constant.MATCH_CODE);
+                ret.setResultBody(Constant.MATCH);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            } else {
+                // 不一致,返回具体不一致项
+                String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
+                if (errorInfo.contains(Constants.UN_MATCH_VEHICLE_NUMBER)) {
+                    errorList.add("vehicleNumber");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_ROAD_TRANSPORT_CERTIFICATE_NUMBER)) {
+                    errorList.add("roadTransportCertificateNumber");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_FROM)) {
+                    errorList.add("roadTransportCertificateValidPeriodFrom");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_CERTIFICATE_VALID_PERIOD_TO)){
+                    errorList.add("roadTransportCertificateValidPeriodTo");
+                }
+                ret.setResultCode(Constant.UN_MATCH_CODE);
+                ret.setResultBody(errorList);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            }
+            // 查询成功
+            ret.setIsCharge(Constant.IS_CHARGE);
+            upstreamCode = resultCode + "-" + responseObject.getData().getVerifyResultSet().get(0).getResult();
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_110000)) {
+            // 库无
+            ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+            ret.setResultBody(Constants.NO_RESULT);
+            ret.setResultDesc(Constants.NO_RESULT);
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140001)
+                || resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140002)) {
+            // 参数错误
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+        } else {
+            // 其他错误
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+        }
+        return upstreamCode;
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkPersonQualificationCertificate(HttpServletRequest request, String customBody, int outTime) {
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+        ret.setCode(Constant.SUCCESS);
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        if (outTime <= Constants.PARA_ZERO) {
+            outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
+        }
+
+        log.info("supplier-vehicle.checkPersonQualificationCertificate---customBody={},outTime={}", customBody, outTime);
+        // 解析参数
+        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);
+            ErrorUtils.captureException(ioe);
+            ret.setCode(Constant.FAIL);
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 参数校验
+        if (!ValidateParamUtil.validateRequestParams(requestParam)) {
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 接口调用
+        String responseContext = "";
+        try {
+            okhttp3.Response response = PostUtil.postString(supplierConfig.getPersonQualificationUrl(), JSON.toJSONString(requestParam), outTime);
+            if (response.body() != null) {
+                responseContext = response.body().string();
+                upstreamCode = setPersonQualificationCertificateResponse(ret, responseContext);
+            } else {
+                ret.setCode(Constant.FAIL);
+            }
+            log.info("responseContext:{}", responseContext);
+        } catch (IOException e) {
+            log.info("supplier-vehicle.checkPersonQualificationCertificate-IOException:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.REQUEST_TIMEOUT);
+        } catch (Exception e) {
+            log.info("supplier-vehicle.checkPersonQualificationCertificate-Exception:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.FAIL);
+        }
+
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        return ret;
+    }
+
+    private String setPersonQualificationCertificateResponse(ChannelTypeHandleResponseObject ret, String responseContext) {
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        RoadTransportPermitResponse responseObject = JSON.toJavaObject(JSON.parseObject(responseContext),
+                RoadTransportPermitResponse.class);
+        if (responseObject == null) {
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+            return upstreamCode;
+        }
+
+        String resultCode = responseObject.getResultCode();
+        upstreamCode = resultCode;
+        List<String> errorList = new ArrayList<>();
+        if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_0)) {
+            if (responseObject.getData().getVerifyResultSet().get(0).getResult().equals("0")) {
+                // 一致
+                ret.setResultCode(Constant.MATCH_CODE);
+                ret.setResultBody(Constant.MATCH);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            } else {
+                // 不一致,返回具体不一致项
+                String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
+                if (errorInfo.contains(Constants.UN_MATCH_DRIVER_NAME)) {
+                    errorList.add("driverName");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_DRIVING_LICENSE)) {
+                    errorList.add("drivingLicense");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_PROVINCE_CODE)) {
+                    errorList.add("provinceCode");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE)){
+                    errorList.add("qualificationCertificate");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_FROM)){
+                    errorList.add("qualificationCertificateValidPeriodFrom");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_QUALIFICATION_CERTIFICATE_TO)){
+                    errorList.add("qualificationCertificateValidPeriodTo");
+                }
+                ret.setResultCode(Constant.UN_MATCH_CODE);
+                ret.setResultBody(errorList);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            }
+            // 查询成功
+            ret.setIsCharge(Constant.IS_CHARGE);
+            upstreamCode = resultCode + "-" + responseObject.getData().getVerifyResultSet().get(0).getResult();
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_110000)) {
+            // 库无
+            ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+            ret.setResultBody(Constants.NO_RESULT);
+            ret.setResultDesc(Constants.NO_RESULT);
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140001)
+                || resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140002)) {
+            // 参数错误
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+        } else {
+            // 其他错误
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+        }
+        return upstreamCode;
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkEnterpriseRoadTransport(HttpServletRequest request, String customBody, int outTime) {
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+        ret.setCode(Constant.SUCCESS);
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        if (outTime <= Constants.PARA_ZERO) {
+            outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
+        }
+
+        log.info("supplier-vehicle.checkEnterpriseRoadTransport---customBody={},outTime={}", customBody, outTime);
+        // 解析参数
+        ObjectMapper objectMapper = new ObjectMapper();
+        EnterpriseRoadTransportPermitRequestParam requestParam;
+        try {
+            requestParam = objectMapper.readValue(customBody, EnterpriseRoadTransportPermitRequestParam.class);
+        } catch (IOException ioe) {
+            log.info("supplier-vehicle.checkEnterpriseRoadTransport-解析参数Exception:{}", ioe);
+            ErrorUtils.captureException(ioe);
+            ret.setCode(Constant.FAIL);
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 参数校验
+        if (!ValidateParamUtil.validateRequestParams(requestParam)) {
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 接口调用
+        String responseContext = "";
+        try {
+            okhttp3.Response response = PostUtil.postString(supplierConfig.getEnterpriseRoadTransportUrl(), JSON.toJSONString(requestParam), outTime);
+            if (response.body() != null) {
+                responseContext = response.body().string();
+                upstreamCode = setEnterpriseRoadTransportResponse(ret, responseContext);
+            } else {
+                ret.setCode(Constant.FAIL);
+            }
+            log.info("responseContext:{}", responseContext);
+        } catch (IOException e) {
+            log.info("supplier-vehicle.checkEnterpriseRoadTransport-IOException:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.REQUEST_TIMEOUT);
+        } catch (Exception e) {
+            log.info("supplier-vehicle.checkEnterpriseRoadTransport-Exception:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.FAIL);
+        }
+
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        return ret;
+    }
+
+    private String setEnterpriseRoadTransportResponse(ChannelTypeHandleResponseObject ret, String responseContext) {
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        RoadTransportPermitResponse responseObject = JSON.toJavaObject(JSON.parseObject(responseContext),
+                RoadTransportPermitResponse.class);
+        if (responseObject == null) {
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+            return upstreamCode;
+        }
+
+        String resultCode = responseObject.getResultCode();
+        upstreamCode = resultCode;
+        List<String> errorList = new ArrayList<>();
+        if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_0)) {
+            if (responseObject.getData().getVerifyResultSet().get(0).getResult().equals("0")) {
+                // 一致
+                ret.setResultCode(Constant.MATCH_CODE);
+                ret.setResultBody(Constant.MATCH);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            } else {
+                // 不一致,返回具体不一致项
+                String errorInfo = responseObject.getData().getVerifyResultSet().get(0).getErrorInfo();
+                if (errorInfo.contains(Constants.UN_MATCH_CARRIER)) {
+                    errorList.add("carrier");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_PERMIT_NUMBER)) {
+                    errorList.add("permitNumber");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_PERMIT_VALID_PERIOD_FROM)) {
+                    errorList.add("permitValidPeriodFrom");
+                }
+                if (errorInfo.contains(Constants.UN_MATCH_PERMIT_VALID_PERIOD_TO)){
+                    errorList.add("permitValidPeriodTo");
+                }
+                ret.setResultCode(Constant.UN_MATCH_CODE);
+                ret.setResultBody(errorList);
+                ret.setResultDesc(Constant.QUERY_SUCCESS);
+            }
+            // 查询成功
+            ret.setIsCharge(Constant.IS_CHARGE);
+            upstreamCode = resultCode + "-" + responseObject.getData().getVerifyResultSet().get(0).getResult();
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_110000)) {
+            // 库无
+            ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+            ret.setResultBody(Constants.NO_RESULT);
+            ret.setResultDesc(Constants.NO_RESULT);
+        } else if (resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140001)
+                || resultCode.equals(Constants.CERTIFICATE_CHECK_RESULT_CODE_140002)) {
+            // 参数错误
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+        } else {
+            // 其他错误
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+        }
+        return upstreamCode;
+    }
 }

+ 22 - 0
src/main/java/info/aspirecn/iov/sjjh/util/PostUtil.java

@@ -18,16 +18,22 @@
  */
 package info.aspirecn.iov.sjjh.util;
 
+import com.alibaba.fastjson.JSON;
 import info.aspirecn.iov.sjjh.constant.Constants;
 import info.aspirecn.iov.sjjh.constant.ContentType;
 import info.aspirecn.iov.sjjh.constant.HttpHeader;
 import info.aspirecn.iov.sjjh.entity.Request;
 import info.aspirecn.iov.sjjh.entity.Response;
 import info.aspirecn.iov.sjjh.enums.Method;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 调用示例
@@ -71,4 +77,20 @@ public class PostUtil {
         return response;
     }
 
+    public static okhttp3.Response postString(String url, String body, Integer outTime) throws Exception {
+        MediaType mediaType = MediaType.parse(Constants.APPLICATION_JSON_UTF8_VALUE);
+        RequestBody requestBody = RequestBody.create(mediaType, body);
+        okhttp3.Request okRequest = new okhttp3.Request.Builder()
+                .post(requestBody)
+                .url(url)
+                .build();
+        OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
+        OkHttpClient client = okHttpClient.newBuilder()
+                .connectTimeout(outTime, TimeUnit.MILLISECONDS)
+                .readTimeout(outTime, TimeUnit.MILLISECONDS)
+                .writeTimeout(outTime, TimeUnit.MILLISECONDS)
+                .build();
+        return  client.newCall(okRequest).execute();
+    }
+
 }

+ 76 - 0
src/main/java/info/aspirecn/iov/sjjh/util/ValidateParamUtil.java

@@ -2,7 +2,10 @@ package info.aspirecn.iov.sjjh.util;
 
 import info.aspirecn.iov.sjjh.commons.lang.Constant;
 import info.aspirecn.iov.sjjh.commons.lang.PatternTools;
+import info.aspirecn.iov.sjjh.entity.EnterpriseRoadTransportPermitRequestParam;
+import info.aspirecn.iov.sjjh.entity.PersonQualificationCertificateRequestParam;
 import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionRequestParam;
+import info.aspirecn.iov.sjjh.entity.VehicleRoadTransportPermitRequestParam;
 import org.apache.commons.lang3.StringUtils;
 
 import javax.validation.ConstraintViolation;
@@ -23,6 +26,11 @@ public class ValidateParamUtil {
             "|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))0229))" +
             "([0-1]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])$";
     private static final String NUMBER_REGEX = "^(0|[1-9]\\d*)$";
+    private static final String YYYYMMDD_REGEX = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|" +
+            "[1-9][0-9]{3})(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|" +
+            "[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))0229))$";
+    private static final String ID_CODE_REGEX = "^([1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$|^[1-9]\\" +
+            "d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X|x))$";
 
     public static boolean validateRequestParams(VehicleHistoryPositionRequestParam requestParam) {
         Pattern datePattern = Pattern.compile(DATE_REGEX);
@@ -46,6 +54,74 @@ public class ValidateParamUtil {
         }
     }
 
+    public static boolean validateRequestParams(VehicleRoadTransportPermitRequestParam requestParam) {
+        Pattern datePattern = Pattern.compile(YYYYMMDD_REGEX);
+        if (!validateParamNullValue(requestParam)) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getVehicleNumber())
+                || !PatternTools.checkResult(Constant.PATTERN_CAR_NUMBER_REGEX, requestParam.getVehicleNumber())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getRoadTransportCertificateNumber())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getRoadTransportCertificateValidPeriodFrom())
+                || !datePattern.matcher(requestParam.getRoadTransportCertificateValidPeriodFrom()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getRoadTransportCertificateValidPeriodTo())
+                || !datePattern.matcher(requestParam.getRoadTransportCertificateValidPeriodTo()).matches()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    public static boolean validateRequestParams(PersonQualificationCertificateRequestParam requestParam) {
+        Pattern datePattern = Pattern.compile(YYYYMMDD_REGEX);
+        Pattern idCodePattern = Pattern.compile(ID_CODE_REGEX);
+        Pattern numberPattern = Pattern.compile(NUMBER_REGEX);
+        if (!validateParamNullValue(requestParam)) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getDriverName())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getDrivingLicense())
+                || !idCodePattern.matcher(requestParam.getDrivingLicense()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getProvinceCode())
+                || !numberPattern.matcher(requestParam.getProvinceCode()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getQualificationCertificate())
+                || requestParam.getQualificationCertificate().length() > 18) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getQualificationCertificateValidPeriodFrom())
+                || !datePattern.matcher(requestParam.getQualificationCertificateValidPeriodFrom()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getQualificationCertificateValidPeriodTo())
+                || !datePattern.matcher(requestParam.getQualificationCertificateValidPeriodTo()).matches()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    public static boolean validateRequestParams(EnterpriseRoadTransportPermitRequestParam requestParam) {
+        Pattern datePattern = Pattern.compile(YYYYMMDD_REGEX);
+        Pattern numberPattern = Pattern.compile(NUMBER_REGEX);
+        if (!validateParamNullValue(requestParam)) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getCarrier())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getPermitNumber())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getPermitValidPeriodFrom())
+                || !datePattern.matcher(requestParam.getPermitValidPeriodFrom()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getPermitValidPeriodTo())
+                || !datePattern.matcher(requestParam.getPermitValidPeriodTo()).matches()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
     private static boolean validateParamNullValue(Object jsonResolveObject) {
         ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
         Validator validator = vf.getValidator();