...
|
...
|
@@ -62,8 +62,8 @@ public class GetResponse extends DefaultConsumer { |
|
|
this.mqResponse = new MqResponse(consumerTag,envelope,properties,new String(body, StandardCharsets.UTF_8));
|
|
|
log.info("-----------获取到报文----------\n{}",mqResponse.getContent());
|
|
|
|
|
|
handleMessage(mqResponse.getContent());
|
|
|
// writeToReadDir(mqResponse.getContent());
|
|
|
// handleMessage(mqResponse.getContent());
|
|
|
writeToReadDir(mqResponse.getContent());
|
|
|
|
|
|
//写入回执目录
|
|
|
}
|
...
|
...
|
@@ -71,19 +71,20 @@ public class GetResponse extends DefaultConsumer { |
|
|
public void writeToReadDir(String content)throws IOException{
|
|
|
if(content !=null && !content.isEmpty()){
|
|
|
//todo:下边过去xml文件报头代码在TCS服务器上部署的时候最好去掉.这段过滤代码是为了能转发到IMF
|
|
|
content = content.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>","");
|
|
|
// content = content.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>","");
|
|
|
//查找报文中的messageid作为文件名
|
|
|
String pattern = "<MessageID>(\\w+)</MessageID>";
|
|
|
Pattern r = Pattern.compile(pattern);
|
|
|
Matcher matcher = r.matcher(content);
|
|
|
String fileName = this.receptDir + UUID.randomUUID().toString()+".xml";
|
|
|
// 新舱单部署要去掉下面更改名称代码
|
|
|
// if (matcher.find()){
|
|
|
// fileName = this.receptDir+ matcher.group(1)+".xml";
|
|
|
// }
|
|
|
log.info("-----------{}报文保存成功----------",fileName);
|
|
|
if (matcher.find()){
|
|
|
fileName = this.receptDir+ matcher.group(1)+".xml";
|
|
|
}
|
|
|
|
|
|
File fileToDirectory = new File(fileName);
|
|
|
FileUtils.writeStringToFile(fileToDirectory,content,"UTF-8");
|
|
|
log.info("-----------{}报文保存成功----------",fileName);
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|