Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ai-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
ai-api
Commits
2dda2170
Commit
2dda2170
authored
Oct 25, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改配置文件
parent
e69f2546
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
src/main/java/com/lilosoft/api/controller/MqConsumer.java
src/main/java/com/lilosoft/api/controller/MqConsumer.java
+8
-6
No files found.
src/main/java/com/lilosoft/api/controller/MqConsumer.java
View file @
2dda2170
package
com.lilosoft.api.controller
;
package
com.lilosoft.api.controller
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.json.JSON
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.lilosoft.api.api.RobotApi
;
import
com.lilosoft.api.api.RobotApi
;
import
com.lilosoft.api.bean.RobotCaseRecord
;
import
com.lilosoft.api.bean.RobotCaseRecord
;
import
com.lilosoft.api.service.ApplyService
;
import
com.lilosoft.api.service.ApplyService
;
import
com.lilosoft.core.utils.ObjectUtils
;
import
com.lilosoft.core.utils.ObjectUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -17,12 +19,9 @@ import java.util.Date;
...
@@ -17,12 +19,9 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.HashMap
;
@Service
@Service
@Slf4j
public
class
MqConsumer
{
public
class
MqConsumer
{
/**
* 日志对象
*/
public
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
@Autowired
private
ApplyService
applyService
;
private
ApplyService
applyService
;
...
@@ -35,6 +34,9 @@ public class MqConsumer {
...
@@ -35,6 +34,9 @@ public class MqConsumer {
@JmsListener
(
destination
=
"${api.mq}"
,
containerFactory
=
"jmsListenerContainerQueue"
)
@JmsListener
(
destination
=
"${api.mq}"
,
containerFactory
=
"jmsListenerContainerQueue"
)
public
void
receiveMsg
(
HashMap
<
String
,
String
>
text
)
{
public
void
receiveMsg
(
HashMap
<
String
,
String
>
text
)
{
log
.
info
(
"receive msg==>{}"
,
JSONUtil
.
toJsonStr
(
text
));
RobotCaseRecord
caseRecord
=
new
RobotCaseRecord
();
RobotCaseRecord
caseRecord
=
new
RobotCaseRecord
();
caseRecord
.
setId
(
IdUtil
.
simpleUUID
());
caseRecord
.
setId
(
IdUtil
.
simpleUUID
());
caseRecord
.
setContent
(
text
.
get
(
"content"
));
caseRecord
.
setContent
(
text
.
get
(
"content"
));
...
@@ -45,7 +47,7 @@ public class MqConsumer {
...
@@ -45,7 +47,7 @@ public class MqConsumer {
robotApi
.
saveRecord
(
caseRecord
);
robotApi
.
saveRecord
(
caseRecord
);
HashMap
<
String
,
Object
>
entries
=
JSONUtil
.
toBean
(
text
.
get
(
"content"
),
HashMap
.
class
);
HashMap
<
String
,
Object
>
entries
=
JSONUtil
.
toBean
(
text
.
get
(
"content"
),
HashMap
.
class
);
String
apply
=
applyService
.
webApply
(
entries
);
String
apply
=
applyService
.
webApply
(
entries
);
if
(
ObjectUtils
.
isEmpty
(
apply
))
{
if
(
ObjectUtils
.
isEmpty
(
apply
))
{
caseRecord
.
setSendFlag
(
"2"
);
caseRecord
.
setSendFlag
(
"2"
);
caseRecord
.
setMsg
(
"success"
);
caseRecord
.
setMsg
(
"success"
);
}
else
{
}
else
{
...
@@ -57,7 +59,7 @@ public class MqConsumer {
...
@@ -57,7 +59,7 @@ public class MqConsumer {
caseRecord
.
setSendFlag
(
"1"
);
caseRecord
.
setSendFlag
(
"1"
);
caseRecord
.
setMsg
(
e
.
getMessage
());
caseRecord
.
setMsg
(
e
.
getMessage
());
robotApi
.
saveRecord
(
caseRecord
);
robotApi
.
saveRecord
(
caseRecord
);
log
ger
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment