package com.persagy.business.maintain; import java.lang.reflect.Method; import java.util.List; import java.util.Map; import org.springframework.stereotype.Service; import com.persagy.core.service.BaseBusinessService; import com.persagy.core.service.BusinessService; import com.persagy.weather.util.ConfigUtil; @Service("ConfigShow") @SuppressWarnings({"unchecked","rawtypes" }) public class ConfigShow extends BaseBusinessService implements BusinessService { @Override public void handle(Map dto, List content) throws Exception { String method = (String) dto.get("method"); List paramList = (List)dto.get("paramList"); if(method == null) { throw new Exception("method不能为空!"); } Method m = null; Object result = null; try { if(paramList != null) { int paramNum = paramList.size(); if(paramNum > 0) { Class[] clzAray = new Class[paramNum]; String[] paramValue = new String[paramNum]; for (int i = 0; i < paramNum; i++) { clzAray[i] = String.class; paramValue[i] = paramList.get(i); } m = ConfigUtil.class.getMethod(method, clzAray); result = m.invoke(new ConfigUtil(), paramValue); } }else { m = ConfigUtil.class.getMethod(method); result = m.invoke(new ConfigUtil()); } }catch (Exception e) { result = "Error! " + e.getMessage(); } content.add(result); } }