package com.changhong.epc.rely.api.tool;
|
|
import java.util.Map;
|
import java.util.Random;
|
import java.util.TreeMap;
|
|
import com.iemsoft.framework.cloud.core.password.MD5;
|
import com.iemsoft.framework.cloud.core.tools.DateTool;
|
|
import lombok.extern.slf4j.Slf4j;
|
@Slf4j
|
public class TheThirdParty {
|
public static Map<String, Object> getParam(Map<String, Object> p,com.changhong.epc.constter.system.Service se){
|
Map<String, Object> param = new TreeMap<>(p);
|
param.put("id", se.getAccessId() /*"1000000"*/+ DateTool.currentFormatDate(DateTool.DATE_TO_STRING_SHORT_PATTERN) + String.format("%09d", new Random().nextInt(999999999)));
|
param.put("sign", countSign(param,se));
|
return param;
|
}
|
|
|
protected static String countSign(Map<String, Object> param,com.changhong.epc.constter.system.Service se) {
|
StringBuilder sb = new StringBuilder();
|
for (Map.Entry<String, Object> map : param.entrySet()) {
|
/* 拼接条件 */
|
sb.append(map.getKey())
|
.append('=')
|
.append(map.getValue())
|
.append('&');
|
}
|
sb.append("key=").append(se.getSecurityKey());
|
log.debug("加密参数为:\n{}",sb);
|
log.debug("加密后的参数:\n{}",MD5.toMD5(sb.toString()));
|
return MD5.toMD5(sb.toString());
|
}
|
|
// public static ChangHongProperties getProp(){
|
// return SpringUtil.getBean(ChangHongProperties.class);
|
// }
|
}
|