|
@@ -45,21 +45,24 @@ public class RabbitController { |
|
@@ -45,21 +45,24 @@ public class RabbitController { |
45
|
private AsyncTaskService asyncTaskService;
|
45
|
private AsyncTaskService asyncTaskService;
|
46
|
|
46
|
|
47
|
/**
|
47
|
/**
|
48
|
- * 测试时的消费消息
|
48
|
+ * 消费消息,one
|
49
|
*
|
49
|
*
|
50
|
- * @throws IOException
|
|
|
51
|
- * @throws TimeoutException
|
50
|
+ * @param RUSR 接收者
|
|
|
51
|
+ * @param SERV 服务器
|
|
|
52
|
+ * @param VSHT 虚拟主机
|
|
|
53
|
+ * @param RCVR 队列
|
|
|
54
|
+ * @return
|
52
|
*/
|
55
|
*/
|
53
|
@GetMapping("/consumer_one")
|
56
|
@GetMapping("/consumer_one")
|
54
|
public ResultJson consumerOne(
|
57
|
public ResultJson consumerOne(
|
55
|
- @RequestParam(value = "receiver") String receiver,
|
58
|
+ @RequestParam(value = "RUSR") String RUSR,
|
56
|
@RequestParam(value = "SERV") String SERV,
|
59
|
@RequestParam(value = "SERV") String SERV,
|
57
|
@RequestParam(value = "VSHT") String VSHT,
|
60
|
@RequestParam(value = "VSHT") String VSHT,
|
58
|
@RequestParam(value = "RCVR") String RCVR)
|
61
|
@RequestParam(value = "RCVR") String RCVR)
|
59
|
{
|
62
|
{
|
60
|
try {
|
63
|
try {
|
61
|
XmlData xmlData = XmlData.builder()
|
64
|
XmlData xmlData = XmlData.builder()
|
62
|
- .receiver(receiver)
|
65
|
+ .receiver(RUSR)
|
63
|
.serverName(SERV)
|
66
|
.serverName(SERV)
|
64
|
.virtualHostName(VSHT)
|
67
|
.virtualHostName(VSHT)
|
65
|
.queueName(RCVR)
|
68
|
.queueName(RCVR)
|
|
@@ -75,17 +78,27 @@ public class RabbitController { |
|
@@ -75,17 +78,27 @@ public class RabbitController { |
75
|
}
|
78
|
}
|
76
|
}
|
79
|
}
|
77
|
|
80
|
|
|
|
81
|
+ /**
|
|
|
82
|
+ * 消费消息,more
|
|
|
83
|
+ *
|
|
|
84
|
+ * @param RUSR 接收者
|
|
|
85
|
+ * @param SERV 服务器
|
|
|
86
|
+ * @param VSHT 虚拟主机
|
|
|
87
|
+ * @param RCVR 队列
|
|
|
88
|
+ * @param CUNT 消息数量
|
|
|
89
|
+ * @return
|
|
|
90
|
+ */
|
78
|
@GetMapping("/consumer_more")
|
91
|
@GetMapping("/consumer_more")
|
79
|
public ResultJson consumerMore(
|
92
|
public ResultJson consumerMore(
|
80
|
- @RequestParam(value = "receiver") String receiver,
|
93
|
+ @RequestParam(value = "RUSR") String RUSR,
|
81
|
@RequestParam(value = "SERV") String SERV,
|
94
|
@RequestParam(value = "SERV") String SERV,
|
82
|
@RequestParam(value = "VSHT") String VSHT,
|
95
|
@RequestParam(value = "VSHT") String VSHT,
|
83
|
@RequestParam(value = "RCVR") String RCVR,
|
96
|
@RequestParam(value = "RCVR") String RCVR,
|
84
|
- @RequestParam(value = "count", required = false) Integer count)
|
97
|
+ @RequestParam(value = "CUNT", required = false) Integer CUNT)
|
85
|
{
|
98
|
{
|
86
|
try {
|
99
|
try {
|
87
|
XmlData xmlData = XmlData.builder()
|
100
|
XmlData xmlData = XmlData.builder()
|
88
|
- .receiver(receiver)
|
101
|
+ .receiver(RUSR)
|
89
|
.serverName(SERV)
|
102
|
.serverName(SERV)
|
90
|
.virtualHostName(VSHT)
|
103
|
.virtualHostName(VSHT)
|
91
|
.queueName(RCVR)
|
104
|
.queueName(RCVR)
|
|
@@ -94,22 +107,22 @@ public class RabbitController { |
|
@@ -94,22 +107,22 @@ public class RabbitController { |
94
|
if (!RESULT_SUCCESS.equals(validate.getCode())) {
|
107
|
if (!RESULT_SUCCESS.equals(validate.getCode())) {
|
95
|
return validate;
|
108
|
return validate;
|
96
|
}
|
109
|
}
|
97
|
- if (count == null || count < 1) {
|
|
|
98
|
- count = 1;
|
110
|
+ if (CUNT == null || CUNT < 1) {
|
|
|
111
|
+ CUNT = 1;
|
99
|
}
|
112
|
}
|
100
|
- ResultJson result = directUtils.directConsumerByPullMore(xmlData, count);
|
113
|
+ ResultJson result = directUtils.directConsumerByPullMore(xmlData, CUNT);
|
101
|
return result;
|
114
|
return result;
|
102
|
} catch (IOException | TimeoutException e) {
|
115
|
} catch (IOException | TimeoutException e) {
|
103
|
return ResultJson.error(CustomExceptionType.RECEIVE_SERVER_EXCEPTION);
|
116
|
return ResultJson.error(CustomExceptionType.RECEIVE_SERVER_EXCEPTION);
|
104
|
}
|
117
|
}
|
105
|
}
|
118
|
}
|
106
|
|
119
|
|
107
|
- @PostMapping("/product/old")
|
|
|
108
|
- public ResultJson productOld(String xmlStr)
|
120
|
+ @PostMapping("/product_old")
|
|
|
121
|
+ public ResultJson productOld(String xmlMessage)
|
109
|
{
|
122
|
{
|
110
|
try {
|
123
|
try {
|
111
|
// 1、解析 xml 文件,获取数据
|
124
|
// 1、解析 xml 文件,获取数据
|
112
|
- XmlData xmlData = xmlUtils.parsingMessage(xmlStr);
|
125
|
+ XmlData xmlData = xmlUtils.parsingMessage(xmlMessage);
|
113
|
String SNDR = xmlData.getSender();
|
126
|
String SNDR = xmlData.getSender();
|
114
|
String RCVR = xmlData.getQueueName();
|
127
|
String RCVR = xmlData.getQueueName();
|
115
|
Date DDTM = xmlData.getSendDateTime() == null ? new Date() : xmlData.getSendDateTime();
|
128
|
Date DDTM = xmlData.getSendDateTime() == null ? new Date() : xmlData.getSendDateTime();
|
|
@@ -127,7 +140,7 @@ public class RabbitController { |
|
@@ -127,7 +140,7 @@ public class RabbitController { |
127
|
}
|
140
|
}
|
128
|
}
|
141
|
}
|
129
|
|
142
|
|
130
|
- @PostMapping("/product/new")
|
143
|
+ @PostMapping("/product_new")
|
131
|
public ResultJson productNew(@RequestParam(value = "SNDR") String SNDR,
|
144
|
public ResultJson productNew(@RequestParam(value = "SNDR") String SNDR,
|
132
|
@RequestParam(value = "RCVR", required = false) String RCVR,
|
145
|
@RequestParam(value = "RCVR", required = false) String RCVR,
|
133
|
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
146
|
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
|
@@ -138,7 +151,7 @@ public class RabbitController { |
|
@@ -138,7 +151,7 @@ public class RabbitController { |
138
|
@RequestParam(value = "SEQN", required = false) String SEQN,
|
151
|
@RequestParam(value = "SEQN", required = false) String SEQN,
|
139
|
@RequestParam(value = "VSHT") String VSHT,
|
152
|
@RequestParam(value = "VSHT") String VSHT,
|
140
|
@RequestParam(value = "SERV") String SERV,
|
153
|
@RequestParam(value = "SERV") String SERV,
|
141
|
- @RequestParam(value = "content") String content)
|
154
|
+ @RequestParam(value = "MSG") String MSG)
|
142
|
{
|
155
|
{
|
143
|
try {
|
156
|
try {
|
144
|
// 1、获取数据
|
157
|
// 1、获取数据
|
|
@@ -152,7 +165,7 @@ public class RabbitController { |
|
@@ -152,7 +165,7 @@ public class RabbitController { |
152
|
.sequence(SEQN)
|
165
|
.sequence(SEQN)
|
153
|
.virtualHostName(VSHT)
|
166
|
.virtualHostName(VSHT)
|
154
|
.serverName(SERV)
|
167
|
.serverName(SERV)
|
155
|
- .sendContent(content)
|
168
|
+ .sendContent(MSG)
|
156
|
.build();
|
169
|
.build();
|
157
|
// 2、校验格式、数据
|
170
|
// 2、校验格式、数据
|
158
|
ResultJson resultJson = xmlUtils.checkFormatAndData(xmlData);
|
171
|
ResultJson resultJson = xmlUtils.checkFormatAndData(xmlData);
|