🆕 #1746: 【企业微信】第三方应用增加授权配置接口,同时增加向员工付款的接口

This commit is contained in:
LinXiaoHuChong
2020-11-29 23:00:38 +08:00
committed by GitHub
parent c0af379370
commit 0e2186632a
6 changed files with 324 additions and 2 deletions

View File

@@ -127,6 +127,30 @@ public class SignUtils {
sortedMap.put("total_amount", totalAmount + "");
sortedMap.put("wxappid", wxAppId);
return toSignBuilder(sortedMap, signKey, signType);
}
/**
* 企业微信签名
* @param signType md5 目前接口要求使用的加密类型
*/
public static String createEntSign(Integer totalAmount, String appId, String description, String mchId,
String nonceStr, String openid, String partnerTradeNo, String wwMsgType,
String signKey, String signType) {
Map<String, String> sortedMap = new HashMap<>(8);
sortedMap.put("amount", String.valueOf(totalAmount));
sortedMap.put("appid", appId);
sortedMap.put("desc", description);
sortedMap.put("mch_id", mchId);
sortedMap.put("nonce_str", nonceStr);
sortedMap.put("openid", openid);
sortedMap.put("partner_trade_no", partnerTradeNo);
sortedMap.put("ww_msg_type", wwMsgType);
return toSignBuilder(sortedMap, signKey, signType);
}
private static String toSignBuilder(Map<String, String> sortedMap, String signKey, String signType) {
Iterator<Map.Entry<String, String>> iterator = new TreeMap<>(sortedMap).entrySet().iterator();
StringBuilder toSign = new StringBuilder();
while (iterator.hasNext()) {
@@ -148,7 +172,6 @@ public class SignUtils {
} else {
return DigestUtils.md5Hex(toSign.toString()).toUpperCase();
}
}
/**