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
c451df44
Commit
c451df44
authored
Nov 09, 2022
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:数据同步添加emq推送开关
parent
88a83e94
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
25 deletions
+63
-25
DataSyncServiceImpl.java
...t/module/common/biz/service/impl/DataSyncServiceImpl.java
+10
-2
PatrolDataSyncServiceImpl.java
...trol/business/service/impl/PatrolDataSyncServiceImpl.java
+34
-10
application-dev.properties
...-system-jcs/src/main/resources/application-dev.properties
+4
-1
application-dev.properties
...stem-patrol/src/main/resources/application-dev.properties
+15
-12
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DataSyncServiceImpl.java
View file @
c451df44
...
...
@@ -9,6 +9,7 @@ import com.yeejoin.amos.component.rule.config.RuleConfig;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
...
...
@@ -28,6 +29,9 @@ public class DataSyncServiceImpl implements IDataSyncService {
@Autowired
private
OrgUsrMapper
orgUsrMapper
;
@Value
(
"${emq.orgUsr.sync.switch}"
)
private
Boolean
orgUsrSyncSwitch
;
@Override
public
void
OrgUsrSyncDtoDataSync
(
Long
id
)
{
try
{
...
...
@@ -39,7 +43,9 @@ public class DataSyncServiceImpl implements IDataSyncService {
for
(
OrgUsrSyncDto
x
:
list
)
{
String
message
=
buildSyncMessage
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
x
);
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
JSONObject
.
toJSONString
(
x
).
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
if
(
orgUsrSyncSwitch
)
{
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
JSONObject
.
toJSONString
(
x
).
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
}
}
}
else
{
// 同步删除人员信息
...
...
@@ -47,7 +53,9 @@ public class DataSyncServiceImpl implements IDataSyncService {
orgUsrSyncDto
.
setSequenceNbr
(
id
);
String
message
=
buildSyncMessage
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
orgUsrSyncDto
);
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
JSONObject
.
toJSONString
(
orgUsrSyncDto
).
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
if
(
orgUsrSyncSwitch
)
{
emqKeeper
.
getMqttClient
().
publish
(
DataSyncTopicEnum
.
ORG_USR
.
getTopic
(),
JSONObject
.
toJSONString
(
orgUsrSyncDto
).
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
}
}
}
}
catch
(
Exception
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PatrolDataSyncServiceImpl.java
View file @
c451df44
...
...
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
...
...
@@ -36,13 +37,18 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
@Autowired
private
IPlanTaskDetailDao
planTaskDetailDao
;
@Value
(
"${emq.patrol.sync.switch}"
)
private
Boolean
patrolSyncSwitch
;
@Override
public
void
checkDataSync
(
Check
check
)
{
if
(
check
!=
null
)
{
try
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
check
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
JSON
.
toJSONString
(
check
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
JSON
.
toJSONString
(
check
,
SerializerFeature
.
WriteMapNullValue
));
}
String
isOk
=
check
.
getIsOk
();
long
taskId
=
check
.
getPlanTaskId
();
long
taskDetailId
=
check
.
getPlanTaskDetailId
();
...
...
@@ -53,7 +59,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
planTaskDetailList
.
forEach
(
x
->
{
String
detailMessage
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
x
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
detailMessage
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -69,7 +77,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
checkList
.
forEach
(
check
->
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
check
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
JSON
.
toJSONString
(
check
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK
.
getTopic
(),
JSON
.
toJSONString
(
check
,
SerializerFeature
.
WriteMapNullValue
));
}
String
isOk
=
check
.
getIsOk
();
long
taskId
=
check
.
getPlanTaskId
();
long
taskDetailId
=
check
.
getPlanTaskDetailId
();
...
...
@@ -80,7 +90,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
planTaskDetailList
.
forEach
(
x
->
{
String
detailMessage
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
x
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
detailMessage
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK_DETAIL
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
});
...
...
@@ -97,7 +109,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
checkInputList
.
forEach
(
x
->
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT
.
getTopic
(),
x
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -112,7 +126,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
checkShotList
.
forEach
(
x
->
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK_SHOT
.
getTopic
(),
x
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_SHOT
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_SHOT
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -126,7 +142,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
if
(
checkInputSyncBo
!=
null
)
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
checkInputSyncBo
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
JSON
.
toJSONString
(
checkInputSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
JSON
.
toJSONString
(
checkInputSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"站端与中心级巡检数据【CheckInputSyncBo】同步推送失败-----------"
+
e
.
getMessage
());
...
...
@@ -140,7 +158,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
checkInputSyncBoList
.
forEach
(
x
->
{
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
x
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
CHECK_INPUT_BO
.
getTopic
(),
JSON
.
toJSONString
(
x
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -155,7 +175,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
PlanTaskSyncBo
planTaskSyncBo
=
buildPlanTaskBo
(
planTask
);
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
planTaskSyncBo
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
JSON
.
toJSONString
(
planTaskSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
JSON
.
toJSONString
(
planTaskSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"站端与中心级巡检数据【planTask】同步推送失败-----------"
+
e
.
getMessage
());
...
...
@@ -170,7 +192,9 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
PlanTaskSyncBo
planTaskSyncBo
=
buildPlanTaskBo
(
x
);
String
message
=
buildSyncMessage
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
planTaskSyncBo
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
EQM_PATROL_CREATED
.
getTopic
(),
message
);
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
JSON
.
toJSONString
(
planTaskSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
if
(
patrolSyncSwitch
)
{
webMqttComponent
.
publish
(
PatrolDataSyncTopicEnum
.
PLAN_TASK
.
getTopic
(),
JSON
.
toJSONString
(
planTaskSyncBo
,
SerializerFeature
.
WriteMapNullValue
));
}
});
}
}
catch
(
Exception
e
)
{
...
...
amos-boot-system-jcs/src/main/resources/application-dev.properties
View file @
c451df44
...
...
@@ -40,9 +40,12 @@ rule.definition.default-agency=jcs
#spring.data.mongodb.uri=mongodb://172.16.6.60:27017/command_db
## file properties:
file.url
=
http://
39.98.45.134
:9000/
file.url
=
http://
172.16.11.201
:9000/
video.url
=
https://11.11.16.4:443/
ifc.url
=
http://11.11.16.17/IFCInterface
ifc.call-back.localIp
=
11.11.16.1
#人员消息同步开关
emq.orgUsr.sync.switch
=
true
amos-boot-system-patrol/src/main/resources/application-dev.properties
View file @
c451df44
eureka.client.serviceUrl.defaultZone
=
http://172.16.1
0.21
1:10001/eureka/
eureka.client.serviceUrl.defaultZone
=
http://172.16.1
1.20
1:10001/eureka/
eureka.client.registry-fetch-interval-seconds
=
5
eureka.instance.prefer-ip-address
=
true
management.endpoint.health.show-details
=
always
...
...
@@ -18,7 +18,7 @@ ribbon.MaxAutoRetries = 1
xiy_amos_satety_business
spring.reactor.debug-agent.enabled
=
true
#DB properties:
spring.datasource.url
=
jdbc:mysql://172.16.1
0.211:3306/xiy_safety_business_v3.0.1_20100712
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://172.16.1
1.201:3306/dl_business_v3.0.1.3
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username
=
root
spring.datasource.password
=
Yeejoin@2020
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
...
...
@@ -35,9 +35,9 @@ security.appKey=studio_normalapp_3168830
#redis 配置
spring.redis.database
=
1
spring.redis.host
=
172.16.1
0.21
1
spring.redis.host
=
172.16.1
1.20
1
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@202
0
spring.redis.password
=
123456
0
spring.redis.jedis.pool.max-active
=
200
spring.redis.jedis.pool.max-wait
=
-1
spring.redis.jedis.pool.max-idle
=
10
...
...
@@ -63,15 +63,18 @@ jobs.cron = 0 0/1 22-23 * * ?
#jpush 推送配置项
params.isPush
=
false
#巡检消息同步开关
emq.patrol.sync.switch
=
true
params.work.flow.normalProcessDefinitionKey
=
normalHazardManagement
params.work.flow.processDefinitionKey
=
hazardManagement
params.work.flow.address
=
http://172.16.1
0.21
1:30040
params.work.flow.address
=
http://172.16.1
1.20
1:30040
params.spc.address
=
http://172.16.3.89:9001
#websocket
params.remoteWebsocketUrl
=
http://172.16.1
0.21
1:8080/
params.remoteWebsocketUrl
=
http://172.16.1
1.20
1:8080/
#websocket send message url
params.remoteWebSocketSendMsgUrl
=
http://172.16.1
0.21
1:10601/
params.remoteWebSocketSendMsgUrl
=
http://172.16.1
1.20
1:10601/
#上传文件配置
spring.http.multipart.maxFileSize
=
80480000
...
...
@@ -82,9 +85,9 @@ linux.img.path = /
## emqx
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${random.int[1024,65536]}-3578
emqx.broker
=
tcp://172.16.1
0.211:2
883
emqx.user-name
=
super
emqx.password
=
a123456
emqx.broker
=
tcp://172.16.1
1.201:1
883
emqx.user-name
=
admin
emqx.password
=
public
emqx.max-inflight
=
1000
file.url
=
http://39.98.45.134:9000/
\ No newline at end of file
file.url
=
http://172.16.11.201:9000/
\ No newline at end of file
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