对json进行排序处理
private String getSortJson(JSONObject json) {
Set<String> set = json.keySet();
List<String> list = new ArrayList<>();
list.addAll(set);
Collections.sort(list);
StringBuffer sb = new StringBuffer();
for (String key : list) {
sb.append(key).append("=").append(json.getString(key)).append("&");
}
sb.replace(sb.length() - 1, sb.length(), "");
return sb.toString();
}