| 
					
				 | 
			
			
				@@ -1,19 +1,20 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.keao.edu.util.collection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.poi.ss.formula.functions.T; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.beans.BeanInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.beans.IntrospectionException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.beans.Introspector; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.beans.PropertyDescriptor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.lang.reflect.InvocationTargetException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.lang.reflect.Method; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Map.Entry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class MapUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private static final Object[] EMPTY_ARRAY = {}; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -128,24 +129,48 @@ public class MapUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * @param <K> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @Author: Joburgess 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @Date: 2019/10/12 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @params [maps] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @return java.util.Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @describe mybatis返回结果转换为Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public static Map convertIntegerMap(List<Map> maps){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public static <K, V> Map<K, V> convertIntegerMap(List<Map<K, V>> maps,Class keyType,Class valueType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		int size = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(maps != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			size = maps.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Map result=new HashMap(size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		maps.forEach(stringIntegerMap -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if(Objects.isNull(stringIntegerMap)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			result.put(stringIntegerMap.get("key"),stringIntegerMap.get("value")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (Map<K, V> stringIntegerMap : maps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(Objects.isNull(stringIntegerMap)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(stringIntegerMap.get("value") == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				K key; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				V value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(keyType.isAssignableFrom(BigDecimal.class)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					key = (K) BigDecimal.class.getDeclaredConstructor(String.class).newInstance(stringIntegerMap.get("key").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}else if(keyType.isAssignableFrom(String.class)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					key = (K) stringIntegerMap.get("key").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					key = (K) keyType.getMethod("valueOf", String.class).invoke(null,stringIntegerMap.get("key").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(valueType.isAssignableFrom(BigDecimal.class)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					value = (V) BigDecimal.class.getDeclaredConstructor(String.class).newInstance(stringIntegerMap.get("value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}else if(valueType.isAssignableFrom(String.class)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					value = (V) stringIntegerMap.get("value").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					value = (V) valueType.getMethod("valueOf", String.class).invoke(null,stringIntegerMap.get("value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				result.put(key, value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |