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; } }