...
|
...
|
@@ -45,21 +45,24 @@ public class RabbitController { |
|
|
private AsyncTaskService asyncTaskService;
|
|
|
|
|
|
/**
|
|
|
* 测试时的消费消息
|
|
|
* 消费消息,one
|
|
|
*
|
|
|
* @throws IOException
|
|
|
* @throws TimeoutException
|
|
|
* @param RUSR 接收者
|
|
|
* @param SERV 服务器
|
|
|
* @param VSHT 虚拟主机
|
|
|
* @param RCVR 队列
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/consumer_one")
|
|
|
public ResultJson consumerOne(
|
|
|
@RequestParam(value = "receiver") String receiver,
|
|
|
@RequestParam(value = "RUSR") String RUSR,
|
|
|
@RequestParam(value = "SERV") String SERV,
|
|
|
@RequestParam(value = "VSHT") String VSHT,
|
|
|
@RequestParam(value = "RCVR") String RCVR)
|
|
|
{
|
|
|
try {
|
|
|
XmlData xmlData = XmlData.builder()
|
|
|
.receiver(receiver)
|
|
|
.receiver(RUSR)
|
|
|
.serverName(SERV)
|
|
|
.virtualHostName(VSHT)
|
|
|
.queueName(RCVR)
|
...
|
...
|
@@ -75,17 +78,27 @@ public class RabbitController { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 消费消息,more
|
|
|
*
|
|
|
* @param RUSR 接收者
|
|
|
* @param SERV 服务器
|
|
|
* @param VSHT 虚拟主机
|
|
|
* @param RCVR 队列
|
|
|
* @param CUNT 消息数量
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/consumer_more")
|
|
|
public ResultJson consumerMore(
|
|
|
@RequestParam(value = "receiver") String receiver,
|
|
|
@RequestParam(value = "RUSR") String RUSR,
|
|
|
@RequestParam(value = "SERV") String SERV,
|
|
|
@RequestParam(value = "VSHT") String VSHT,
|
|
|
@RequestParam(value = "RCVR") String RCVR,
|
|
|
@RequestParam(value = "count", required = false) Integer count)
|
|
|
@RequestParam(value = "CUNT", required = false) Integer CUNT)
|
|
|
{
|
|
|
try {
|
|
|
XmlData xmlData = XmlData.builder()
|
|
|
.receiver(receiver)
|
|
|
.receiver(RUSR)
|
|
|
.serverName(SERV)
|
|
|
.virtualHostName(VSHT)
|
|
|
.queueName(RCVR)
|
...
|
...
|
@@ -94,22 +107,22 @@ public class RabbitController { |
|
|
if (!RESULT_SUCCESS.equals(validate.getCode())) {
|
|
|
return validate;
|
|
|
}
|
|
|
if (count == null || count < 1) {
|
|
|
count = 1;
|
|
|
if (CUNT == null || CUNT < 1) {
|
|
|
CUNT = 1;
|
|
|
}
|
|
|
ResultJson result = directUtils.directConsumerByPullMore(xmlData, count);
|
|
|
ResultJson result = directUtils.directConsumerByPullMore(xmlData, CUNT);
|
|
|
return result;
|
|
|
} catch (IOException | TimeoutException e) {
|
|
|
return ResultJson.error(CustomExceptionType.RECEIVE_SERVER_EXCEPTION);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping("/product/old")
|
|
|
public ResultJson productOld(String xmlStr)
|
|
|
@PostMapping("/product_old")
|
|
|
public ResultJson productOld(String xmlMessage)
|
|
|
{
|
|
|
try {
|
|
|
// 1、解析 xml 文件,获取数据
|
|
|
XmlData xmlData = xmlUtils.parsingMessage(xmlStr);
|
|
|
XmlData xmlData = xmlUtils.parsingMessage(xmlMessage);
|
|
|
String SNDR = xmlData.getSender();
|
|
|
String RCVR = xmlData.getQueueName();
|
|
|
Date DDTM = xmlData.getSendDateTime() == null ? new Date() : xmlData.getSendDateTime();
|
...
|
...
|
@@ -127,7 +140,7 @@ public class RabbitController { |
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping("/product/new")
|
|
|
@PostMapping("/product_new")
|
|
|
public ResultJson productNew(@RequestParam(value = "SNDR") String SNDR,
|
|
|
@RequestParam(value = "RCVR", required = false) String RCVR,
|
|
|
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
...
|
...
|
@@ -138,7 +151,7 @@ public class RabbitController { |
|
|
@RequestParam(value = "SEQN", required = false) String SEQN,
|
|
|
@RequestParam(value = "VSHT") String VSHT,
|
|
|
@RequestParam(value = "SERV") String SERV,
|
|
|
@RequestParam(value = "content") String content)
|
|
|
@RequestParam(value = "MSG") String MSG)
|
|
|
{
|
|
|
try {
|
|
|
// 1、获取数据
|
...
|
...
|
@@ -152,7 +165,7 @@ public class RabbitController { |
|
|
.sequence(SEQN)
|
|
|
.virtualHostName(VSHT)
|
|
|
.serverName(SERV)
|
|
|
.sendContent(content)
|
|
|
.sendContent(MSG)
|
|
|
.build();
|
|
|
// 2、校验格式、数据
|
|
|
ResultJson resultJson = xmlUtils.checkFormatAndData(xmlData);
|
...
|
...
|
|