//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.jeequan.jeepay.pay.ctrl.yly.sdk;

import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class RequestMethod {
    private static String example = "{\"error\":\"20\",\"error_description\":\"success\",\"body\":\"未完成初始化\"}";
    public String clientId;
    public String clientSecret;

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getClientSecret() {
        return clientSecret;
    }

    public void setClientSecret(String clientSecret) {
        this.clientSecret = clientSecret;
    }

    private static final RequestMethod singleton = new RequestMethod();

    private RequestMethod() {
    }

    public static RequestMethod getInstance() {
        return singleton;
    }

    public void init(String client_id, String client_secret) {
        clientId = client_id;
        clientSecret = client_secret;
    }

    private boolean CCIsNull(String client_id, String client_secret) {
        return clientId != null && clientSecret != null && !clientId.equals("") && !clientSecret.equals("");
    }

    public String getCodeOpen(String redirect_uri) {
        return clientId != null && !clientId.equals("") ? UtilUrl.openType + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + redirect_uri + "&state=1" : example;
    }

    public String getOpenAccessToken(String code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("client_id", clientId);
            paramMap.put("grant_type", "authorization_code");
            paramMap.put("sign", sign);
            paramMap.put("code", code);
            paramMap.put("scope", "all");
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            return HttpRequest.sendPost(UtilUrl.freeType, paramMap);
        } else {
            return example;
        }
    }

    public String getAccessToken() throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("client_id", clientId);
            paramMap.put("grant_type", "client_credentials");
            paramMap.put("sign", sign);
            paramMap.put("scope", "all");
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            return HttpRequest.sendPost(UtilUrl.freeType, paramMap);
        } else {
            return example;
        }
    }

    public String getRefreshAccessToken(String refresh_token) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("refresh_token", refresh_token);
            paramMap.put("grant_type", "refresh_token");
            paramMap.put("scope", "all");
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.freeType, paramMap);
        } else {
            return example;
        }
    }

    public String addPrinter(String machine_code, String msign, String access_token) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("machine_code", machine_code);
            paramMap.put("msign", msign);
            paramMap.put("access_token", access_token);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.addPrinter, paramMap);
        } else {
            return example;
        }
    }

    public String addPrinter(String machine_code, String msign, String access_token, String phone, String print_name) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("machine_code", machine_code);
            paramMap.put("msign", msign);
            paramMap.put("access_token", access_token);
            paramMap.put("phone", phone);
            paramMap.put("print_name", print_name);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.addPrinter, paramMap);
        } else {
            return example;
        }
    }

    public String scanCodeModel(String machine_code, String msign) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("machine_code", machine_code);
            paramMap.put("msign", msign);
            paramMap.put("scope", "all");
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.scanCodeModel, paramMap);
        } else {
            return example;
        }
    }

    public String scanCodeModel_msign(String machine_code, String msign) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("machine_code", machine_code);
            paramMap.put("msign", msign);
            paramMap.put("scope", "all");
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.scanCodeModel, paramMap);
        } else {
            return example;
        }
    }

    public String printIndex(String access_token, String machine_code, String content, String origin_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("content", content);
            paramMap.put("origin_id", origin_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("idempotence", "0");
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printIndex, paramMap);
        } else {
            return example;
        }
    }

    public String picturePrintIndex(String access_token, String machine_code, String picture_url, String origin_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("picture_url", URLEncoder.encode(picture_url, "UTF-8"));
            paramMap.put("origin_id", origin_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.picturePrintIndex, paramMap);
        } else {
            return example;
        }
    }

    public String expressPrintIndex(String access_token, String machine_code, String content, String origin_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("content", content);
            paramMap.put("origin_id", origin_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.expressPrintIndex, paramMap);
        } else {
            return example;
        }
    }

    public String printerSetVoice(String access_token, String machine_code, String content, String is_file, String aid, String origin_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("content", content);
            paramMap.put("is_file", is_file);
            paramMap.put("aid", aid);
            paramMap.put("origin_id", origin_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerSetVoice, paramMap);
        } else {
            return example;
        }
    }

    public String printerDeleteVoice(String access_token, String machine_code, String aid, String origin_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("aid", aid);
            paramMap.put("origin_id", origin_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerDeleteVoice, paramMap);
        } else {
            return example;
        }
    }

    public String printerDeletePrinter(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerDeletePrinter, paramMap);
        } else {
            return example;
        }
    }

    public String printMenuAddPrintMenu(String access_token, String machine_code, String content) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("content", content);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printMenuAddPrintMenu, paramMap);
        } else {
            return example;
        }
    }

    public String printShutdownRestart(String access_token, String machine_code, String response_type) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("response_type", response_type);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printShutdownRestart, paramMap);
        } else {
            return example;
        }
    }

    public String printSetSound(String access_token, String machine_code, String response_type, String voice) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("response_type", response_type);
            paramMap.put("voice", voice);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printSetSound, paramMap);
        } else {
            return example;
        }
    }

    public String printPrintInfo(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printPrintInfo, paramMap);
        } else {
            return example;
        }
    }

    public String printGetVersion(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printGetVersion, paramMap);
        } else {
            return example;
        }
    }

    public String printCancelAll(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printCancelAll, paramMap);
        } else {
            return example;
        }
    }

    public String printCancelOne(String access_token, String machine_code, String order_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("order_id", order_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printCancelOne, paramMap);
        } else {
            return example;
        }
    }

    public String printSetIcon(String access_token, String machine_code, String img_url) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("img_url", img_url);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printSetIcon, paramMap);
        } else {
            return example;
        }
    }

    public String printDeleteIcon(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printDeleteIcon, paramMap);
        } else {
            return example;
        }
    }

    public String printBtnPrint(String access_token, String machine_code, String response_type) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("response_type", response_type);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printBtnPrint, paramMap);
        } else {
            return example;
        }
    }

    public String printGetOrder(String access_token, String machine_code, String response_type) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("response_type", response_type);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printGetOrder, paramMap);
        } else {
            return example;
        }
    }

    public String oauthSetPushUrl(String access_token, String machine_code, String cmd, String url, String status) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("cmd", cmd);
            paramMap.put("url", url);
            paramMap.put("status", status);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.oauthSetPushUrl, paramMap);
        } else {
            return example;
        }
    }

    public String printerGetOrderStatus(String access_token, String machine_code, String order_id) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("order_id", order_id);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerGetOrderStatus, paramMap);
        } else {
            return example;
        }
    }

    public String printerGetOrderPagingList(String access_token, String machine_code, String page_index, String page_size) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("page_index", page_index);
            paramMap.put("page_size", page_size);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerGetOrderPagingList, paramMap);
        } else {
            return example;
        }
    }

    public String printerGetPrintStatus(String access_token, String machine_code) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerGetPrintStatus, paramMap);
        } else {
            return example;
        }
    }

    public String printerSetKeywords(String access_token, String machine_code, String keys, String type, String content) throws Exception {
        if (CCIsNull(clientId, clientSecret)) {
            String timestamp = Utils.getTimestamp();
            String signMD5 = clientId + timestamp + clientSecret;
            String sign = Utils.getMD5Str(signMD5);
            Map<String, String> paramMap = new HashMap();
            paramMap.put("access_token", access_token);
            paramMap.put("machine_code", machine_code);
            paramMap.put("client_id", clientId);
            paramMap.put("timestamp", timestamp);
            paramMap.put("id", UUID.randomUUID().toString());
            paramMap.put("keys", keys);
            paramMap.put("type", type);
            paramMap.put("content", content);
            paramMap.put("sign", sign);
            return HttpRequest.sendPost(UtilUrl.printerSetKeywords, paramMap);
        } else {
            return example;
        }
    }
}
