//测试环境发送用例
@Test
public void testSendForTest() {
String url = "http://172.16.30.108:8138/api/doDeliver" ;
String appkey = "00d40313b7f340ec8df6a3dff293d45c" ;
String token = "871c69137b654c07b18191859d8bd257b9e092ac1f704336999a2a184a7d9910" ;
Map<String, String> params = new LinkedHashMap<>();
params.put( "appkey" , appkey);
params.put( "p0" , "PDS" ); //业务系统
params.put( "p1" , "PDS-test" ); //业务类型
params.put( "p2" , UUID.randomUUID().toString()); //业务id
params.put( "p3" , "STATION_EUAE,STATION_SZAE" ); //目的站
params.put( "p4" , "我是测试" ); //消息内容
params.put( "p5" , "test" ); //跟踪ID
params.put( "p9" , "123" ); //消息内容加密密钥
String timestamp = System.currentTimeMillis()+ "" ;
params.put( "timestamp" , timestamp); //时间戳
StringBuilder s = new StringBuilder();
for (Iterator<Entry<String, String>> iterator = params.entrySet().iterator(); iterator.hasNext();) {
Entry<String, String> entry = iterator.next();
if (StringUtils.isNotBlank(entry.getValue())) {
s.append(entry.getKey()).append( "=" ).append(entry.getValue()).append( "&" );
}
}
String paramsStr = s.toString();
String signStr = CodecUtil.md5AndBase64(paramsStr.substring( 0 , paramsStr.length() - 1 ) + token);
params.put( "signStr" , signStr);
String response = HttpUtils.postJson(url, params);
System.out.println(response);
ResponseMessage responseMessage = JSON.parseObject(response, ResponseMessage. class );
System.out.println(responseMessage);
}
|