Showing
1 changed file
with
14 additions
and
5 deletions
@@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Value; | @@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Value; | ||
24 | import java.io.UnsupportedEncodingException; | 24 | import java.io.UnsupportedEncodingException; |
25 | import java.math.BigDecimal; | 25 | import java.math.BigDecimal; |
26 | import java.net.URLEncoder; | 26 | import java.net.URLEncoder; |
27 | +import java.nio.charset.Charset; | ||
28 | +import java.nio.charset.StandardCharsets; | ||
27 | import java.text.SimpleDateFormat; | 29 | import java.text.SimpleDateFormat; |
28 | import java.util.*; | 30 | import java.util.*; |
29 | 31 | ||
@@ -672,6 +674,17 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -672,6 +674,17 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
672 | * @return | 674 | * @return |
673 | */ | 675 | */ |
674 | private String getSignString(Map<String, String> paramsMap) { | 676 | private String getSignString(Map<String, String> paramsMap) { |
677 | + return getSignString(paramsMap, StandardCharsets.UTF_8); | ||
678 | + } | ||
679 | + | ||
680 | + | ||
681 | + | ||
682 | + /** | ||
683 | + * 获取支付宝回调待签名字符串 | ||
684 | + * @param paramsMap | ||
685 | + * @return | ||
686 | + */ | ||
687 | + private String getSignString(Map<String, String> paramsMap, Charset charset) { | ||
675 | if(null == paramsMap) { | 688 | if(null == paramsMap) { |
676 | return ""; | 689 | return ""; |
677 | } | 690 | } |
@@ -685,11 +698,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | @@ -685,11 +698,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { | ||
685 | if(StringUtils.isEmpty(entry.getValue())) { | 698 | if(StringUtils.isEmpty(entry.getValue())) { |
686 | continue; | 699 | continue; |
687 | } | 700 | } |
688 | - try { | ||
689 | - sortMap.put(entry.getKey(), new String(entry.getValue().getBytes("ISO-8859-1"))); | ||
690 | - } catch (UnsupportedEncodingException e) { | ||
691 | - logger.error("解析支付宝回调参数出错:key={}, msg= {}",entry.getKey(), e.getMessage()); | ||
692 | - } | 701 | + sortMap.put(entry.getKey(), new String(entry.getValue().getBytes(charset))); |
693 | } | 702 | } |
694 | 703 | ||
695 | return getUrlString(sortMap); | 704 | return getUrlString(sortMap); |
-
Please register or login to post a comment