# 车场出场信息上报

最新更新时间:2023.06.13

车辆驶离停车场时向开放平台传递车辆驶出记录。

# 接口说明

请求URL: https://{domain}/os-park/ospark/open/api/v2/uploadDriveOut

请求方式: POST

公共请求参数

参数名 必填 类型 说明
access_id string 开发者唯一标识
sign_type string 固定传RSA2
time_stamp long 请求时间,Linux时间戳,单位毫秒
sign string 签名结果
data string 将业务参数转为JSON字符串,然后使用BASE64编码的数据
详细签名方法请阅读接口加密方案

请求参数

名称 必填 类型 说明
osStoreCode string 备案系统中停车场编码(开放平台门店Code)
carPlate string 车牌号,无牌车统一设置为 "无牌车"
carPlateColor int 车牌颜色 1-蓝色 2-黄色 3-白色 4-黑色 5-绿色 6-黄绿双拼色 常量定义在SDK的TyhConstants.CarPlateColor中
orderId string 订单记录号(车辆在停车场唯一停车订单编号,支持数字 字母 _ -,最大长度32),车场方生成
inTime long 进场时间,unix时间戳格式,精确到毫秒,如1631602583000
outTime long 出场时间(车辆离开停车场时间),unix时间戳格式,精确到毫秒,如1631602583000
duration int 车辆停车时长,单位秒
parkType int 停车类型 1-临时车 2-包月车 3-特殊车(例如内部车辆,白名单) 常量定义在SDK的TyhConstants.ParkType中
billingAmount int 计费金额,单位为人民币分
payAmount int 实际支付金额,单位为人民币分
payType int 支付方式 0-现金 1-免费 2-支付宝 3-微信 -1:其他 常量定义在SDK的TyhConstants.PayType中
inChannel string 进场通道,如A1、A2、东入口、西入口
outChannel string 出场通道,如A1、A2、东出口、西出口

SDK方法

// 创建上传数据client
TyhUploadClient client = TyhUploadClient.create(TyhOptions.builder()
    .accessId(ACCESS_ID)
    .secretKey(SECRET_KEY)
    .build());
  
// 车辆出场
OpenParkingDriveOutCmd cmd = OpenParkingDriveOutCmd.builder()
    .osStoreCode(OS_STORE_CODE)
    .carPlate("皖Axxxxx")
    .carPlateColor(TyhConstants.CarPlateColor.BLUE)
    .orderId("order123456662")
    .inTime(inTime)
    .outTime(outTime)
    .duration(1800)
    .parkType(TyhConstants.ParkType.TEMPORARY)
    .billingAmount(500)
    .payAmount(500)
    .payType(TyhConstants.PayType.ALIPAY)
    .inChannel("东入口")
    .outChannel("西出口")
    .build();
  
// 发送请求 result.ifSuccess()表示请求成功
Results result = client.uploadDriveOut(cmd);

入参格式

{
  "osStoreCode" : "30000000000001",
  "carPlate": "皖Axxxxx",
  "carPlateColor": 1,
  "orderId": "order123456662",
  "inTime": 1631602583000,
  "outTime": 1631602583000,
  "duration": 1800,
  "parkType": "01",
  "billingAmount": 500,
  "payAmount": 500,
  "payType": 2,
  "inChannel": "东入口",
  "outChannel": "西出口"
}

出参格式

 { "code":8888, "msg":"success", "data": "json数据"}

code 为 8888 表示操作成功,其它值则为失败,具体内容参见错误码说明。