GetCaculator

import java.util.Map;

public class GetCaculator {
    // 将参数封装用于请求API接口
    public static Caculator getBean(Prefer prefer, Map<String, String> parameMap) {
        Caculator caculator = new Caculator();
        String name = prefer.getName();
        if (name != null && "percentageParam".equals(name)) {
            PercentageParam percentageParam = new PercentageParam();
            percentageParam.setNUM1(prefer.getBaseVal() + "");
            percentageParam.setNUM2(prefer.getTargetVal() + "");
            percentageParam.setPERIOD_ID(parameMap.get("time"));
            percentageParam.setREGION_CN_NAME(parameMap.get("organization"));
            percentageParam.setCOUNTRY_CN_NAME(parameMap.get("country"));
            percentageParam.setREPOFFCE_CN_NAME(parameMap.get("repoffce"));
            // 从配置表读取
            caculator.setRequestUrl(prefer.getUrl());
            caculator.setDataType(percentageParam);
            caculator.setApiName(name);
            caculator.setRequesType(prefer.getRequesType());
        }
        return caculator;
    }
}

 

posted @ 2022-10-28 20:58  MING5135  阅读(17)  评论(0编辑  收藏  举报