package com.malk.server.common;

import com.malk.base.BaseDto;
import com.malk.utils.UtilHttp;
import lombok.Data;
import lombok.SneakyThrows;

import java.util.Map;

/**
 * 定义第三方返回值结构信息
 */
@Data
public class VenR extends BaseDto {

    /**
     * 断言错误信息: 子类实现 [静态代理]
     */
    public void assertSuccess() {

    }

    ///-- 反射 [通过Class.forName(全类名)方式获取Class]

    public static final String RC_MC = "com.malk.server.common.MCR";
    public static final String RC_YD = "com.malk.server.aliwork.YDR";
    public static final String RC_ALY = "com.malk.server.aliyun.ALYR";
    public static final String RC_DD = "com.malk.server.dingtalk.DDR";
    public static final String RC_DD_New = "com.malk.server.dingtalk.DDR_New";
    public static final String RC_EKB = "com.malk.server.ekuaibao.EKBRR";
    public static final String RC_FXK = "com.malk.server.fxiaoke.FXKR ";
    public static final String RC_XBB = "com.malk.server.xbongbong.XBBR";
    public static final String RC_VK = "com.malk.server.vika.VKR";
    public static final String RC_TB = "com.malk.server.teambition.TBR";
    public static final String RC_INTP = "com.malk.server.integration.INTPR";

    /**
     * 通用post请求
     */
    @SneakyThrows
    public static VenR doPost(String url, Map header, Map param, Map body, String path) {
        Class rClass = Class.forName(path);
        VenR rsp = UtilHttp.doPost(url, header, param, body, rClass);
        return rsp;
    }

    /**
     * 通用get请求
     */
    @SneakyThrows
    public static VenR doGet(String url, Map header, Map param, String path) {
        Class rClass = Class.forName(path);
        VenR rsp = UtilHttp.doGet(url, header, param, rClass);
        return rsp;
    }
}

