Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
56df504e
Commit
56df504e
authored
May 31, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.由于平台规则不支持共享主题,分步式环境消息重复,故调整为api接口
parent
e2e4bc65
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
InspectionOrgRefreshListener.java
...odule/jyjc/biz/listener/InspectionOrgRefreshListener.java
+34
-2
No files found.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/listener/InspectionOrgRefreshListener.java
View file @
56df504e
...
...
@@ -11,6 +11,8 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.rule.Rule
;
import
com.yeejoin.amos.feign.rule.model.FactBaseModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -22,6 +24,9 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
javax.annotation.PostConstruct
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
...
...
@@ -109,7 +114,7 @@ public class InspectionOrgRefreshListener extends EmqxListener {
inspectionEquipInfo
.
setInspectionType
(
equipInfoModel
.
getInspectionType
());
inspectionEquipInfo
.
setRecord
(
equipInfoModel
.
getRecord
());
inspectionEquipInfo
.
setBizType
(
getCategoryByType
(
JYJCTypeEnum
.
of
(
inspectionEquipInfo
.
getInspectionType
())));
touchRule
(
inspectionEquipInfo
);
touchRule
WithApi
(
inspectionEquipInfo
);
}
private
RegistrationInfo
fetchRegistrationInfo
(
String
record
)
{
...
...
@@ -119,7 +124,7 @@ public class InspectionOrgRefreshListener extends EmqxListener {
.
eq
(
RegistrationInfo:
:
getRecord
,
record
));
}
private
void
touchRule
(
InspectionEquipInfo
inspectionEquipInfo
)
{
private
void
touchRule
WithMsg
(
InspectionEquipInfo
inspectionEquipInfo
)
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"发送规则的消息对象:{}"
,
toJSONString
(
inspectionEquipInfo
));
}
...
...
@@ -134,4 +139,31 @@ public class InspectionOrgRefreshListener extends EmqxListener {
log
.
error
(
"调用规则触发风险模型失败"
,
e
);
}
}
private
void
touchRuleWithApi
(
InspectionEquipInfo
inspectionEquipInfo
)
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"发送规则的消息对象:{}"
,
toJSONString
(
inspectionEquipInfo
));
}
try
{
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
HashMap
<
String
,
byte
[]>
factMap
=
new
HashMap
<>();
List
<
Object
>
factList
=
new
ArrayList
<>();
factList
.
add
(
inspectionEquipInfo
);
for
(
Object
fact
:
factList
)
{
factMap
.
put
(
fact
.
getClass
().
getName
(),
toJSONString
(
fact
).
getBytes
());
}
FactBaseModel
factBaseModel
=
new
FactBaseModel
();
factBaseModel
.
setFactMap
(
factMap
);
factBaseModel
.
setPackageId
(
ruleName
+
"/"
+
inspectionEquipInfo
.
getBizType
());
factBaseModel
.
setProcessIds
(
null
);
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"发送规则的消息对象:{},\n变量对象:{}"
,
toJSONString
(
factBaseModel
),
toJSONString
(
factBaseModel
));
}
Rule
.
ruleClient
.
fireRule
(
factBaseModel
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则触发风险模型失败"
,
e
);
}
}
}
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