---
url: "https://pay.weixin.qq.com/doc/v3/partner/4019557811-java.md"
title: "查询停车场进件申请单列表-请求示例-java"
doc_id: 4019557811
example_lang: "java"
---

## Java


需配合微信支付工具库 WXPayUtility 使用，请参考 [Java](https://pay.weixin.qq.com/doc/v3/partner/4014985777.md)

```
package com.java.demo;

import com.java.utils.WXPayUtility; // 引用微信支付工具库，参考：https://pay.weixin.qq.com/doc/v3/partner/4014985777

import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 查询停车场进件申请单列表
 */
public class FindApplicationList {
  private static String HOST = "https://api.mch.weixin.qq.com";
  private static String METHOD = "GET";
  private static String PATH = "/v3/parking/reminders/applications";

  public static void main(String[] args) {
    // TODO: 请准备商户开发必要参数，参考：https://pay.weixin.qq.com/doc/v3/partner/4013080340
    FindApplicationList client = new FindApplicationList(
      "19xxxxxxxx",                    // 商户号，是由微信支付系统生成并分配给每个商户的唯一标识符，商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340
      "1DDE55AD98Exxxxxxxxxx",         // 商户API证书序列号，如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924
      "/path/to/apiclient_key.pem",     // 商户API证书私钥文件路径，本地文件路径
      "PUB_KEY_ID_xxxxxxxxxxxxx",      // 微信支付公钥ID，如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589
      "/path/to/wxp_pub.pem"           // 微信支付公钥文件路径，本地文件路径
    );

    FindApplicationListRequest request = new FindApplicationListRequest();
    request.outParkingLotId = "lot_sz_tencent_001";
    request.offset = 1L;
    request.limit = 1L;
    try {
      FindApplicationListResponse response = client.run(request);
        // TODO: 请求成功，继续业务逻辑
        System.out.println(response);
    } catch (WXPayUtility.ApiException e) {
        // TODO: 请求失败，根据状态码执行不同的逻辑
        e.printStackTrace();
    }
  }

  public FindApplicationListResponse run(FindApplicationListRequest request) {
    String uri = PATH;
    Map<String, Object> args = new HashMap<>();
    args.put("out_parking_lot_id", request.outParkingLotId);
    args.put("offset", request.offset);
    args.put("limit", request.limit);
    String queryString = WXPayUtility.urlEncode(args);
    if (!queryString.isEmpty()) {
        uri = uri + "?" + queryString;
    }

    Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
    reqBuilder.addHeader("Accept", "application/json");
    reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
    reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null));
    reqBuilder.method(METHOD, null);
    Request httpRequest = reqBuilder.build();

    // 发送HTTP请求
    OkHttpClient client = new OkHttpClient.Builder().build();
    try (Response httpResponse = client.newCall(httpRequest).execute()) {
      String respBody = WXPayUtility.extractBody(httpResponse);
      if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
        // 2XX 成功，验证应答签名
        WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey,
            httpResponse.headers(), respBody);

        // 从HTTP应答报文构建返回数据
        return WXPayUtility.fromJson(respBody, FindApplicationListResponse.class);
      } else {
        throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
      }
    } catch (IOException e) {
      throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
    }
  }

  private final String mchid;
  private final String certificateSerialNo;
  private final PrivateKey privateKey;
  private final String wechatPayPublicKeyId;
  private final PublicKey wechatPayPublicKey;

  public FindApplicationList(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) {
    this.mchid = mchid;
    this.certificateSerialNo = certificateSerialNo;
    this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath);
    this.wechatPayPublicKeyId = wechatPayPublicKeyId;
    this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
  }

  public static class FindApplicationListRequest {
    @SerializedName("out_parking_lot_id")
    @Expose(serialize = false)
    public String outParkingLotId;

    @SerializedName("offset")
    @Expose(serialize = false)
    public Long offset;

    @SerializedName("limit")
    @Expose(serialize = false)
    public Long limit;
  }

  public static class FindApplicationListResponse {
    @SerializedName("code")
    public String code;

    @SerializedName("message")
    public String message;

    @SerializedName("application_list")
    public List<ParkingLotApplication> applicationList;

    @SerializedName("wx_parking_lot_id")
    public String wxParkingLotId;
  }

  public static class ParkingLotApplication {
    @SerializedName("parking_lot_audit_no")
    public String parkingLotAuditNo;

    @SerializedName("audit_status")
    public AuditStatus auditStatus;

    @SerializedName("submit_time")
    public Long submitTime;

    @SerializedName("parking_lot")
    public ParkingLot parkingLot;

    @SerializedName("audit_comment")
    public ParkingLotAuditComment auditComment;
  }

  public enum AuditStatus {
    @SerializedName("AUDIT_STATUS_UNKNOWN")
    AUDIT_STATUS_UNKNOWN,
    @SerializedName("AUDIT_STATUS_PENDING")
    AUDIT_STATUS_PENDING,
    @SerializedName("AUDIT_STATUS_WITHDRAWN")
    AUDIT_STATUS_WITHDRAWN,
    @SerializedName("AUDIT_STATUS_APPROVED")
    AUDIT_STATUS_APPROVED,
    @SerializedName("AUDIT_STATUS_REJECTED")
    AUDIT_STATUS_REJECTED
  }

  public static class ParkingLot {
    @SerializedName("parking_lot_name")
    public String parkingLotName;

    @SerializedName("out_parking_lot_id")
    public String outParkingLotId;

    @SerializedName("parking_lot_address")
    public String parkingLotAddress;

    @SerializedName("longitude")
    public String longitude;

    @SerializedName("latitude")
    public String latitude;

    @SerializedName("parking_lot_type")
    public ParkingLotType parkingLotType;

    @SerializedName("phone_number")
    public String phoneNumber;

    @SerializedName("parking_sign_url")
    public String parkingSignUrl;

    @SerializedName("notification_text_list")
    public List<String> notificationTextList;

    @SerializedName("payment_mini_prog_appid")
    public String paymentMiniProgAppid;

    @SerializedName("payment_path")
    public String paymentPath;

    @SerializedName("parking_order_mini_prog_appid")
    public String parkingOrderMiniProgAppid;

    @SerializedName("parking_order_path")
    public String parkingOrderPath;

    @SerializedName("charging_rule")
    public ChargingRule chargingRule;
  }

  public static class ParkingLotAuditComment {
    @SerializedName("fields")
    public List<FieldAudit> fields;

    @SerializedName("recommendation")
    public String recommendation;
  }

  public enum ParkingLotType {
    @SerializedName("PARKING_LOT_TYPE_UNKNOWN")
    PARKING_LOT_TYPE_UNKNOWN,
    @SerializedName("PARKING_LOT_TYPE_BUSINESS_DISTRICT")
    PARKING_LOT_TYPE_BUSINESS_DISTRICT,
    @SerializedName("PARKING_LOT_TYPE_OFFICE_BUILDING")
    PARKING_LOT_TYPE_OFFICE_BUILDING,
    @SerializedName("PARKING_LOT_TYPE_TRANSPORTATION_HUB")
    PARKING_LOT_TYPE_TRANSPORTATION_HUB,
    @SerializedName("PARKING_LOT_TYPE_RESIDENTIAL_AREA")
    PARKING_LOT_TYPE_RESIDENTIAL_AREA,
    @SerializedName("PARKING_LOT_TYPE_PARK_AREA")
    PARKING_LOT_TYPE_PARK_AREA,
    @SerializedName("PARKING_LOT_TYPE_OTHER_PUBLIC_FACILITY")
    PARKING_LOT_TYPE_OTHER_PUBLIC_FACILITY
  }

  public static class ChargingRule {
    @SerializedName("rule_type")
    public ChargingRuleType ruleType;

    @SerializedName("fee_limit_type")
    public FeeLimitType feeLimitType;

    @SerializedName("daily_limit_type")
    public DailyLimitType dailyLimitType;

    @SerializedName("time_rounding_type")
    public TimeRoundingType timeRoundingType;

    @SerializedName("free_entry_duration")
    public Long freeEntryDuration;

    @SerializedName("free_exit_duration")
    public Long freeExitDuration;

    @SerializedName("fixed_interval_rule")
    public List<FixedIntervalRule> fixedIntervalRule;

    @SerializedName("duration_segment_rule")
    public List<DurationSegmentRule> durationSegmentRule;

    @SerializedName("pre_entry_rule")
    public List<PreEntryRule> preEntryRule;

    @SerializedName("holiday_mode")
    public HolidayMode holidayMode;

    @SerializedName("aggregate_limit_mode")
    public AggregateLimitMode aggregateLimitMode;

    @SerializedName("first_charge_time_mode")
    public FirstChargeTimeMode firstChargeTimeMode;
  }

  public static class FieldAudit {
    @SerializedName("field")
    public String field;

    @SerializedName("comment")
    public String comment;
  }

  public enum ChargingRuleType {
    @SerializedName("CHARGING_RULE_UNKNOWN")
    CHARGING_RULE_UNKNOWN,
    @SerializedName("CHARGING_RULE_FIXED_INTERVAL")
    CHARGING_RULE_FIXED_INTERVAL,
    @SerializedName("CHARGING_RULE_SEGMENT")
    CHARGING_RULE_SEGMENT,
    @SerializedName("CHARGING_RULE_PER_ENTRY")
    CHARGING_RULE_PER_ENTRY
  }

  public enum FeeLimitType {
    @SerializedName("FEE_LIMIT_UNKNOWN")
    FEE_LIMIT_UNKNOWN,
    @SerializedName("FEE_LIMIT_AGGREGATE")
    FEE_LIMIT_AGGREGATE,
    @SerializedName("FEE_LIMIT_SINGLE")
    FEE_LIMIT_SINGLE
  }

  public enum DailyLimitType {
    @SerializedName("DAILY_LIMIT_UNKNOWN")
    DAILY_LIMIT_UNKNOWN,
    @SerializedName("DAILY_LIMIT_ROLLING_24H")
    DAILY_LIMIT_ROLLING_24H,
    @SerializedName("DAILY_LIMIT_CALENDAR_DAY")
    DAILY_LIMIT_CALENDAR_DAY
  }

  public enum TimeRoundingType {
    @SerializedName("TIME_ROUND_UNKNOWN")
    TIME_ROUND_UNKNOWN,
    @SerializedName("TIME_ROUND_DOWN")
    TIME_ROUND_DOWN,
    @SerializedName("TIME_ROUND_UP")
    TIME_ROUND_UP
  }

  public static class FixedIntervalRule {
    @SerializedName("day_type")
    public DayType dayType;

    @SerializedName("start_time")
    public String startTime;

    @SerializedName("end_time")
    public String endTime;

    @SerializedName("vehicle_type")
    public VehicleType vehicleType;

    @SerializedName("plate_type")
    public PlateType plateType;

    @SerializedName("first_duration")
    public Long firstDuration;

    @SerializedName("first_amount")
    public Long firstAmount;

    @SerializedName("interval_duration")
    public Long intervalDuration;

    @SerializedName("interval_amount")
    public Long intervalAmount;

    @SerializedName("interval_max_amount")
    public Long intervalMaxAmount;

    @SerializedName("max_fee_per_day")
    public Long maxFeePerDay;

    @SerializedName("free_period_charging_mode")
    public FreePeriodChargingMode freePeriodChargingMode;

    @SerializedName("free_period_calculation_mode")
    public FreePeriodCalculationMode freePeriodCalculationMode;

    @SerializedName("is_green_vehicle_free_parking")
    public Boolean isGreenVehicleFreeParking;

    @SerializedName("first_duration_mode")
    public FirstDurationMode firstDurationMode;
  }

  public static class DurationSegmentRule {
    @SerializedName("day_type")
    public DayType dayType;

    @SerializedName("start_time")
    public String startTime;

    @SerializedName("end_time")
    public String endTime;

    @SerializedName("vehicle_type")
    public VehicleType vehicleType;

    @SerializedName("plate_type")
    public PlateType plateType;

    @SerializedName("charge_mode")
    public ChargeMode chargeMode;

    @SerializedName("duration_from")
    public Long durationFrom;

    @SerializedName("duration_to")
    public Long durationTo;

    @SerializedName("fixed_amount")
    public Long fixedAmount;

    @SerializedName("interval_min")
    public Long intervalMin;

    @SerializedName("interval_amount")
    public Long intervalAmount;

    @SerializedName("interval_max_amount")
    public Long intervalMaxAmount;

    @SerializedName("max_fee_per_day")
    public Long maxFeePerDay;
  }

  public static class PreEntryRule {
    @SerializedName("day_type")
    public DayType dayType;

    @SerializedName("start_time")
    public String startTime;

    @SerializedName("end_time")
    public String endTime;

    @SerializedName("vehicle_type")
    public VehicleType vehicleType;

    @SerializedName("plate_type")
    public PlateType plateType;

    @SerializedName("amount")
    public Long amount;

    @SerializedName("max_fee_per_day")
    public Long maxFeePerDay;
  }

  public enum HolidayMode {
    @SerializedName("HOLIDAY_MODE_UNKNOWN")
    HOLIDAY_MODE_UNKNOWN,
    @SerializedName("HOLIDAY_MODE_LEGAL_MODY")
    HOLIDAY_MODE_LEGAL_MODY,
    @SerializedName("HOLIDAY_MODE_CALENDAR_MODY")
    HOLIDAY_MODE_CALENDAR_MODY,
    @SerializedName("HOLIDAY_MODE_FINANCIAL_MODY")
    HOLIDAY_MODE_FINANCIAL_MODY
  }

  public enum AggregateLimitMode {
    @SerializedName("AGGREGATE_LIMIT_MODE_UNKNOWN")
    AGGREGATE_LIMIT_MODE_UNKNOWN,
    @SerializedName("AGGREGATE_LIMIT_MODE_NORMAL")
    AGGREGATE_LIMIT_MODE_NORMAL,
    @SerializedName("AGGREGATE_LIMIT_MODE_MIN")
    AGGREGATE_LIMIT_MODE_MIN
  }

  public enum FirstChargeTimeMode {
    @SerializedName("FIRST_CHARGE_TIME_MODE_UNKNOWN")
    FIRST_CHARGE_TIME_MODE_UNKNOWN,
    @SerializedName("FIRST_CHARGE_TIME_MODE_ENTER")
    FIRST_CHARGE_TIME_MODE_ENTER,
    @SerializedName("FIRST_CHARGE_TIME_MODE_AFTER_FREE")
    FIRST_CHARGE_TIME_MODE_AFTER_FREE
  }

  public enum DayType {
    @SerializedName("DAY_TYPE_UNKNOWN")
    DAY_TYPE_UNKNOWN,
    @SerializedName("DAY_TYPE_WEEKDAY")
    DAY_TYPE_WEEKDAY,
    @SerializedName("DAY_TYPE_HOLIDAY")
    DAY_TYPE_HOLIDAY,
    @SerializedName("DAY_TYPE_ALL_DAY")
    DAY_TYPE_ALL_DAY
  }

  public enum VehicleType {
    @SerializedName("VEHICLE_TYPE_UNKNOWN")
    VEHICLE_TYPE_UNKNOWN,
    @SerializedName("VEHICLE_TYPE_SMALL")
    VEHICLE_TYPE_SMALL,
    @SerializedName("VEHICLE_TYPE_LARGE")
    VEHICLE_TYPE_LARGE,
    @SerializedName("VEHICLE_TYPE_EXTRA_LARGE")
    VEHICLE_TYPE_EXTRA_LARGE,
    @SerializedName("VEHICLE_TYPE_ALL_TYPE")
    VEHICLE_TYPE_ALL_TYPE
  }

  public enum PlateType {
    @SerializedName("PLATE_TYPE_UNKNOWN")
    PLATE_TYPE_UNKNOWN,
    @SerializedName("PLATE_TYPE_TEMPORARY")
    PLATE_TYPE_TEMPORARY,
    @SerializedName("PLATE_TYPE_MONTHLY")
    PLATE_TYPE_MONTHLY,
    @SerializedName("PLATE_TYPE_FREE")
    PLATE_TYPE_FREE,
    @SerializedName("PLATE_TYPE_PREPAID")
    PLATE_TYPE_PREPAID,
    @SerializedName("PLATE_TYPE_OTHERS")
    PLATE_TYPE_OTHERS
  }

  public enum FreePeriodChargingMode {
    @SerializedName("FREE_PERIOD_CHARGING_UNKNOWN")
    FREE_PERIOD_CHARGING_UNKNOWN,
    @SerializedName("FREE_PERIOD_CHARGING_ONCE_PER_ENTRY")
    FREE_PERIOD_CHARGING_ONCE_PER_ENTRY,
    @SerializedName("FREE_PERIOD_CHARGING_ONCE_PER_24_HOURS")
    FREE_PERIOD_CHARGING_ONCE_PER_24_HOURS,
    @SerializedName("FREE_PERIOD_CHARGING_ONCE_PER_CALENDAR_DAY")
    FREE_PERIOD_CHARGING_ONCE_PER_CALENDAR_DAY,
    @SerializedName("FREE_PERIOD_CHARGING_CUMULATIVE_QUOTA_CALCULATION")
    FREE_PERIOD_CHARGING_CUMULATIVE_QUOTA_CALCULATION
  }

  public enum FreePeriodCalculationMode {
    @SerializedName("FREE_PERIOD_CAL_UNKNOWN")
    FREE_PERIOD_CAL_UNKNOWN,
    @SerializedName("FREE_PERIOD_CAL_CONCURRENT_START")
    FREE_PERIOD_CAL_CONCURRENT_START,
    @SerializedName("FREE_PERIOD_CAL_SEQUENTIAL_START")
    FREE_PERIOD_CAL_SEQUENTIAL_START
  }

  public enum FirstDurationMode {
    @SerializedName("FIRST_DURATION_MODE_UNKNOWN")
    FIRST_DURATION_MODE_UNKNOWN,
    @SerializedName("FIRST_DURATION_MODE_ONLY_FIRST_DURATION")
    FIRST_DURATION_MODE_ONLY_FIRST_DURATION,
    @SerializedName("FIRST_DURATION_MODE_EVERY_FIRST_DURATION")
    FIRST_DURATION_MODE_EVERY_FIRST_DURATION
  }

  public enum ChargeMode {
    @SerializedName("UNKNOWN")
    UNKNOWN,
    @SerializedName("INTERVAL")
    INTERVAL,
    @SerializedName("ONE_TIME")
    ONE_TIME
  }

}

```
