...
|
...
|
@@ -54,25 +54,26 @@ public class RabbitController { |
|
|
}
|
|
|
|
|
|
@PostMapping("/product/old")
|
|
|
public ResultJson productOld(String xmlStr) throws DocumentException
|
|
|
public ResultJson productOld(String xmlStr)
|
|
|
{
|
|
|
// 1、解析 xml 文件,获取数据
|
|
|
XmlData xmlData = xmlUtils.parsingMessage(xmlStr);
|
|
|
|
|
|
// 2、校验格式、数据
|
|
|
ResultJson resultJson = xmlUtils.checkFormatAndData(xmlData);
|
|
|
if (!"200".equals(resultJson.getCode())) {
|
|
|
return resultJson;
|
|
|
}
|
|
|
|
|
|
// 3、通过格式校验之后,进行配置校验
|
|
|
Boolean binding = userMessageBindingService.validateXmlBinding(xmlData);
|
|
|
if (!binding) {
|
|
|
return ResultJson.error(CustomExceptionType.BINDING_ERROR);
|
|
|
try {
|
|
|
// 1、解析 xml 文件,获取数据
|
|
|
XmlData xmlData = xmlUtils.parsingMessage(xmlStr);
|
|
|
String SNDR = xmlData.getSender();
|
|
|
String RCVR = xmlData.getQueueName();
|
|
|
Date DDTM = xmlData.getSendDateTime() == null ? new Date() : xmlData.getSendDateTime();
|
|
|
String TYPE = xmlData.getExchangeName();
|
|
|
String STYP = xmlData.getRoutingKeyName();
|
|
|
String TOKN = xmlData.getToken();
|
|
|
String SEQN = xmlData.getSequence();
|
|
|
String VSHT = xmlData.getVirtualHostName();
|
|
|
String SERV = xmlData.getServerName();
|
|
|
String content = xmlData.getSendContent();
|
|
|
ResultJson result = productNew(SNDR, RCVR, DDTM, TYPE, STYP, TOKN, SEQN, VSHT, SERV, content);
|
|
|
return result;
|
|
|
} catch (DocumentException e) {
|
|
|
return ResultJson.error(CustomExceptionType.CLIENT_EXCEPTION);
|
|
|
}
|
|
|
|
|
|
// 4、发送消息,并讲消息存放到数据库中
|
|
|
return ResultJson.success("发送成功");
|
|
|
}
|
|
|
|
|
|
@PostMapping("/product/new")
|
...
|
...
|
@@ -116,7 +117,7 @@ public class RabbitController { |
|
|
// 4、mq发送消息,数据库中保存消息并保存至ES
|
|
|
return sendAndSave(sentData);
|
|
|
} catch (IOException | TimeoutException | InterruptedException e) {
|
|
|
return ResultJson.error(CustomExceptionType.SERVER_EXCEPTION);
|
|
|
return ResultJson.error(CustomExceptionType.SERVER_EXCEPTION);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|