Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
b531a441
Commit
b531a441
authored
Mar 24, 2021
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:区域新增数据同步
parent
130d116c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
2 deletions
+94
-2
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+15
-2
View3dServiceImpl.java
...oin/amos/fas/business/service/impl/View3dServiceImpl.java
+5
-0
DataSyncUtil.java
...java/com/yeejoin/amos/fas/business/util/DataSyncUtil.java
+36
-0
TopicName.java
.../main/java/com/yeejoin/amos/fas/core/enums/TopicName.java
+38
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
b531a441
...
@@ -22,6 +22,8 @@ import java.util.stream.Collectors;
...
@@ -22,6 +22,8 @@ import java.util.stream.Collectors;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.amos.fas.business.util.DataSyncUtil
;
import
com.yeejoin.dataprocess.common.enums.TopicName
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -226,6 +228,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -226,6 +228,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
@Autowired
private
PlanDetailMapper
planDetailMapper
;
private
PlanDetailMapper
planDetailMapper
;
@Autowired
private
DataSyncUtil
dataSyncUtil
;
public
static
String
cacheKeyForCanBeRunning
()
{
public
static
String
cacheKeyForCanBeRunning
()
{
return
Redis
.
genKey
(
CacheType
.
ERASABLE
.
name
(),
"CONTINGENCYRUNING"
);
return
Redis
.
genKey
(
CacheType
.
ERASABLE
.
name
(),
"CONTINGENCYRUNING"
);
}
}
...
@@ -233,6 +238,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -233,6 +238,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
@Autowired
private
IDataRefreshService
iDataRefreshService
;
private
IDataRefreshService
iDataRefreshService
;
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Override
@Override
public
RiskSource
editRiskSource
(
HashMap
<
String
,
Object
>
map
)
throws
Exception
{
public
RiskSource
editRiskSource
(
HashMap
<
String
,
Object
>
map
)
throws
Exception
{
RiskSource
riskSource
=
(
RiskSource
)
map
.
get
(
"param"
);
RiskSource
riskSource
=
(
RiskSource
)
map
.
get
(
"param"
);
...
@@ -259,6 +267,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -259,6 +267,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource
.
setStatus
(
oldRiskSource
.
getStatus
());
riskSource
.
setStatus
(
oldRiskSource
.
getStatus
());
}
}
iRiskSourceDao
.
saveAndFlush
(
riskSource
);
iRiskSourceDao
.
saveAndFlush
(
riskSource
);
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
TopicName
.
AST_SAVE
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
return
riskSource
;
return
riskSource
;
}
}
...
@@ -322,6 +331,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -322,6 +331,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fillBasicParams
(
userId
,
orgCode
,
synBo
.
getId
(),
riskSource
);
fillBasicParams
(
userId
,
orgCode
,
synBo
.
getId
(),
riskSource
);
riskSource
=
iRiskSourceDao
.
save
(
riskSource
);
riskSource
=
iRiskSourceDao
.
save
(
riskSource
);
}
}
// redisTemplate.opsForValue().set(String.join("-", "ast_save", riskSource.getCode()), riskSource);
// webMqttComponent.publish("/ast/save", JSON.toJSONString(riskSource));
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
TopicName
.
AST_SAVE
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
//2.同步下级(只有一级)
//2.同步下级(只有一级)
if
(!
CollectionUtils
.
isEmpty
(
synBo
.
getChildren
())){
if
(!
CollectionUtils
.
isEmpty
(
synBo
.
getChildren
())){
RiskSource
finalRiskSource
=
riskSource
;
RiskSource
finalRiskSource
=
riskSource
;
...
@@ -333,6 +345,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -333,6 +345,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return
t
;
return
t
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
iRiskSourceDao
.
saveAll
(
children
);
iRiskSourceDao
.
saveAll
(
children
);
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
TopicName
.
AST_SAVE_ALL
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
}
}
return
riskSource
;
return
riskSource
;
}
}
...
@@ -354,6 +367,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -354,6 +367,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
RiskSource
riskSource
=
exist
.
get
();
RiskSource
riskSource
=
exist
.
get
();
riskSource
.
setSourceId
(
null
);
riskSource
.
setSourceId
(
null
);
iRiskSourceDao
.
save
(
riskSource
);
iRiskSourceDao
.
save
(
riskSource
);
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
TopicName
.
AST_SAVE
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
}
}
return
exist
.
isPresent
();
return
exist
.
isPresent
();
}
}
...
@@ -1293,8 +1307,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1293,8 +1307,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// }
// }
// }
// }
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${autoSys.push.type}"
)
@Value
(
"${autoSys.push.type}"
)
private
String
pushType
;
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
...
@@ -1831,6 +1843,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1831,6 +1843,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
}
}
iRiskSourceDao
.
save
(
riskSource
);
iRiskSourceDao
.
save
(
riskSource
);
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
TopicName
.
AST_SAVE
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
this
.
updateParentRpn
(
riskSource
.
getParentId
());
this
.
updateParentRpn
(
riskSource
.
getParentId
());
}
}
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/View3dServiceImpl.java
View file @
b531a441
...
@@ -16,6 +16,7 @@ import java.util.Set;
...
@@ -16,6 +16,7 @@ import java.util.Set;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.fas.business.util.DataSyncUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -118,6 +119,9 @@ public class View3dServiceImpl implements IView3dService {
...
@@ -118,6 +119,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
DataSyncUtil
dataSyncUtil
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
CommonResponse
setPoint3dPosition
(
List
<
BindPointBo
>
pointBoList
)
{
public
CommonResponse
setPoint3dPosition
(
List
<
BindPointBo
>
pointBoList
)
{
...
@@ -248,6 +252,7 @@ public class View3dServiceImpl implements IView3dService {
...
@@ -248,6 +252,7 @@ public class View3dServiceImpl implements IView3dService {
if
(
ue4Rotation
!=
null
)
riskSource
.
setUe4Rotation
(
pointBo
.
getUe4Rotation
());
if
(
ue4Rotation
!=
null
)
riskSource
.
setUe4Rotation
(
pointBo
.
getUe4Rotation
());
if
(
position3d
!=
null
)
riskSource
.
setPosition3d
(
position3d
);
if
(
position3d
!=
null
)
riskSource
.
setPosition3d
(
position3d
);
iRiskSourceDao
.
save
(
riskSource
);
iRiskSourceDao
.
save
(
riskSource
);
dataSyncUtil
.
astGeographicalRegionDataSync
(
String
.
join
(
"_"
,
com
.
yeejoin
.
dataprocess
.
common
.
enums
.
TopicName
.
AST_SAVE
.
getValue
(),
riskSource
.
getCode
()),
JSON
.
toJSONString
(
riskSource
));
}
}
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/DataSyncUtil.java
0 → 100644
View file @
b531a441
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.util
* @ClassName: DataSyncUtil
* @Author: Jianqiang Gao
* @Description: 数据同步工具类
* @Date: 2021/3/24 15:31
* @Version: 1.0
*/
@Component
public
class
DataSyncUtil
{
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
WebMqttComponent
webMqttComponent
;
// RedisTemplate redisTemplate = SpringContextHolder.getApplicationContext().getBean(RedisTemplate.class);
//
// WebMqttComponent webMqttComponent = SpringContextHolder.getApplicationContext().getBean(WebMqttComponent.class);
public
void
astGeographicalRegionDataSync
(
String
topic
,
String
message
)
{
redisTemplate
.
opsForValue
().
set
(
topic
,
message
);
webMqttComponent
.
publish
(
topic
.
substring
(
0
,
topic
.
lastIndexOf
(
"_"
)),
message
);
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/enums/TopicName.java
0 → 100644
View file @
b531a441
package
com
.
yeejoin
.
dataprocess
.
common
.
enums
;
/**
* @ProjectName: YeeFireDataProcessRoot
* @Package: com.yeejoin.dataprocess.common.enums
* @ClassName: TopicName
* @Author: Jianqiang Gao
* @Description: TopicName
* @Date: 2021/3/23 15:55
* @Version: 1.0
*/
public
enum
TopicName
{
ROLL_CALL_DEFAULT
(
1
,
"listenDefault"
),
AST_SAVE
(
2
,
"ast_save"
),
AST_SAVE_ALL
(
3
,
"ast_save_all"
);
private
final
Integer
key
;
private
final
String
value
;
private
TopicName
(
Integer
key
,
String
value
)
{
this
.
key
=
key
;
this
.
value
=
value
;
}
public
Integer
getKey
()
{
return
key
;
}
public
String
getValue
()
{
return
value
;
}
@Override
public
String
toString
()
{
return
this
.
value
;
}
}
\ 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