| 
				
				
				
				 | 
			
			 | 
			@@ -1,18 +1,5 @@ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			package com.github.binarywang.wxpay.util; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.lang.reflect.Field; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.lang.reflect.Modifier; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.ArrayList; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.Arrays; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.List; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.Map; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.SortedMap; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.TreeMap; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.codec.digest.DigestUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.lang3.ArrayUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.lang3.StringUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.github.binarywang.wxpay.bean.result.BaseWxPayResult; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.github.binarywang.wxpay.constant.WxPayConstants.SignType; | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -20,6 +7,13 @@ import com.google.common.collect.Lists; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.google.common.collect.Maps; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.thoughtworks.xstream.annotations.XStreamAlias; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import lombok.extern.slf4j.Slf4j; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.codec.digest.DigestUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.lang3.ArrayUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.lang3.StringUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.lang.reflect.Field; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.lang.reflect.Modifier; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import java.util.*; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			/** | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			 * <pre> | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -31,6 +25,12 @@ import lombok.extern.slf4j.Slf4j; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			 */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			@Slf4j | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			public class SignUtils { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  /** | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			   * 签名的时候不携带的参数 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			   */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  private static List<String> NO_SIGN_PARAMS = Lists.newArrayList("sign", "key", "xmlString", "xmlDoc", "couponList"); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  /** | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			   * 请参考并使用 {@link #createSign(Object, String, String, String[])}. | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			   * | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -85,7 +85,7 @@ public class SignUtils { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      String value = params.get(key); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      boolean shouldSign = false; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      if (StringUtils.isNotEmpty(value) && !ArrayUtils.contains(ignoredParams, key) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        && !Lists.newArrayList("sign", "key", "xmlString", "xmlDoc", "couponList").contains(key)) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        && !NO_SIGN_PARAMS.contains(key)) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        shouldSign = true; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |