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
ca37a2ae
Commit
ca37a2ae
authored
Sep 10, 2020
by
高东东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)添加预案回放退出工程
parent
b90e5484
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
5 deletions
+51
-5
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+2
-2
TimeLineController.java
...join/amos/fas/business/controller/TimeLineController.java
+9
-1
RuleRunigSnapshotServiceImpl.java
...s/business/service/impl/RuleRunigSnapshotServiceImpl.java
+38
-2
IRuleRunningSnapshotService.java
...s/business/service/intfc/IRuleRunningSnapshotService.java
+2
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
ca37a2ae
...
...
@@ -575,14 +575,14 @@ public class ContingencyAction implements CustomerAction {
log
.
error
(
"======================================================================================="
);
stopSnapshop
(
contingencyRo
);
instedParams
(
paramJSON
,
contingencyRo
);
String
parameter
=
instedParams
(
paramJSON
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"key"
,
actionName
);
tempmap1
.
put
(
"content"
,
actionType
);
tempmap1
.
put
(
"parameter"
,
param
JSON
);
tempmap1
.
put
(
"parameter"
,
param
eter
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"maparea"
,
paramObj
,
result
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/TimeLineController.java
View file @
ca37a2ae
...
...
@@ -96,7 +96,6 @@ public class TimeLineController extends BaseController{
}
@Permission
//@Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"预案回放"
,
notes
=
"预案回放"
)
@RequestMapping
(
value
=
"/fire/replay"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
replay
(
@RequestParam
(
"batchNo"
)
String
batchNo
,
...
...
@@ -104,6 +103,15 @@ public class TimeLineController extends BaseController{
ruleRunningSnapshotService
.
replayPlan
(
batchNo
,
randomNumber
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
@Permission
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"预案回放退出"
,
notes
=
"预案回放退出"
)
@RequestMapping
(
value
=
"/fire/replay/exit"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
replayExit
(
@RequestParam
(
"batchNo"
)
String
batchNo
,
@RequestParam
(
"randomNumber"
)
String
randomNumber
)
throws
Exception
{
ruleRunningSnapshotService
.
exitReplayPlan
(
batchNo
,
randomNumber
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
@Scheduled
(
cron
=
"*/2 * * * * ?"
)
public
void
runFireQueue
()
throws
Exception
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RuleRunigSnapshotServiceImpl.java
View file @
ca37a2ae
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Method
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
...
...
@@ -16,6 +18,7 @@ import org.springframework.scheduling.annotation.Async;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.SpringContextHelper
;
...
...
@@ -23,10 +26,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.yeejoin.amos.fas.business.action.CustomerAction
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
import
com.yeejoin.amos.fas.business.action.result.SafteyPlanResult
;
import
com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage
;
import
com.yeejoin.amos.fas.business.dao.mapper.RuleRuningSnapshotMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IRuleRuningSnapshotDao
;
import
com.yeejoin.amos.fas.business.service.intfc.IRuleRunningSnapshotService
;
import
com.yeejoin.amos.fas.business.service.model.RuleRuningSnapshot
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
/**
*
...
...
@@ -63,6 +70,8 @@ public class RuleRunigSnapshotServiceImpl
@Autowired
private
WebMqttComponent
webMqttComponent
;
private
static
String
PACKAGEURL
=
"com.yeejoin.amos.fas.business.action.result.message."
;
static
{
objectMapper
=
new
ObjectMapper
();
}
...
...
@@ -151,13 +160,30 @@ public class RuleRunigSnapshotServiceImpl
{
logger
.
info
(
"开始回放:batchNo="
+
batchNo
);
logger
.
info
(
"获取到动作记录个数:"
+
oldEntityList
.
size
());
redisTemplate
.
opsForValue
().
set
(
"replay:"
+
batchNo
+
":"
+
randomNumber
,
true
);
int
count
=
0
;
for
(
RuleRuningSnapshot
snapshot
:
oldEntityList
)
{
if
(
batchNo
==
null
)
return
;
Object
play
=
redisTemplate
.
opsForValue
().
get
(
"replay:"
+
batchNo
+
":"
+
randomNumber
);
if
(
ObjectUtils
.
isEmpty
(
play
))
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"type"
,
"event"
);
tempmap1
.
put
(
"content"
,
"stopPlan"
);
result
.
add
(
tempmap1
);
Constructor
<?>
constructor
=
Class
.
forName
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
AbstractActionResultMessage
<?>
action
=
(
AbstractActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
ToipResponse
toipResponse
=
action
.
buildResponse
(
"message"
,
batchNo
,
result
.
toJson
());
webMqttComponent
.
publish
(
String
.
format
(
"%s/%s/%s"
,
snapshot
.
getPackageId
(),
"replay"
,
randomNumber
),
toipResponse
.
toJsonStr
());
return
;
}
//延迟
logger
.
info
(
"开始执行第"
+(++
count
)+
"个动作."
);
logger
.
info
(
"方法名:"
+
snapshot
.
getMethodClass
()+
"."
+
snapshot
.
getMethodName
());
...
...
@@ -181,9 +207,16 @@ public class RuleRunigSnapshotServiceImpl
{
logger
.
info
(
"回放失败."
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
redisTemplate
.
delete
(
"replay:"
+
batchNo
+
":"
+
randomNumber
);
}
}
@Override
public
void
exitReplayPlan
(
String
batchNo
,
String
randomNumber
)
{
redisTemplate
.
delete
(
"replay:"
+
batchNo
+
":"
+
randomNumber
);
}
@Async
public
void
replay
(
String
batchNo
)
throws
Exception
{
...
...
@@ -281,4 +314,6 @@ public class RuleRunigSnapshotServiceImpl
public
static
void
setReplayBatchNoToNull
()
{
RuleRunigSnapshotServiceImpl
.
replayBatchNo
=
null
;
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IRuleRunningSnapshotService.java
View file @
ca37a2ae
...
...
@@ -17,4 +17,6 @@ public interface IRuleRunningSnapshotService
public
void
reacordPlan
(
String
topic
,
String
msgType
,
String
msgBody
,
Object
contingency
);
public
void
replayPlan
(
String
batchNo
,
String
randomNumber
)
throws
Exception
;
void
exitReplayPlan
(
String
batchNo
,
String
randomNumber
);
}
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