WxOperationRealtimeLogSearchDataRequest.java 1.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
package com.yanzuoguang.wxxcx.operation.select;

import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;

/***
 * 本接口提供基于小程序的银行卡 OCR 识别
 *
 * @author:heyanou
 */
public class WxOperationRealtimeLogSearchDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara {


    private final WxXcxConfig wxXcxConfig;
    private final WxXcxRequest wxXcxRequest;
    private final WxXcxAccessToken accessToken;
    private final WxOperationRealtimelogSearchDataReq req;

    public WxOperationRealtimeLogSearchDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxOperationRealtimelogSearchDataReq req) {
        this.wxXcxConfig = wxXcxConfig;
        this.wxXcxRequest = wxXcxRequest;
        this.accessToken = accessToken;
        this.req = req;
    }

    @Override
    public String getUrlPara() {
        return HttpHelper.getUrlParameter(accessToken);
    }

    @Override
    public String getUrl() {
        return wxXcxConfig.getBaseUrl() + wxXcxConfig.getOperationRealtimelogSearchDataUrl() + "?" + this.getUrlPara();
    }

    /***
     * <b>response返回结果集检测</b>
     * @return 返回类对象
     */
    public WxOperationRealtimelogSearchDataRes getResponse() {
        // todo: 检测参数是否合法
        return this.wxXcxRequest.request(this, response -> {
            WxOperationRealtimelogSearchDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxOperationRealtimelogSearchDataRes>() {
            });
            WxXcxAssert.assertBaseError(ret);
            return ret;
        });
    }
}