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
dcb843e1
Commit
dcb843e1
authored
Dec 29, 2022
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:预案执行流程走redis优化
parent
f0e943bb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
74 deletions
+138
-74
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+37
-21
TimeLineController.java
...join/amos/fas/business/controller/TimeLineController.java
+5
-9
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+7
-29
ContingencyPlanServiceImpl.java
...fas/business/service/impl/ContingencyPlanServiceImpl.java
+1
-0
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+67
-13
IContingencyInstance.java
...amos/fas/business/service/intfc/IContingencyInstance.java
+1
-1
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+5
-1
PlanExecuteVo.java
.../java/com/yeejoin/amos/fas/business/vo/PlanExecuteVo.java
+15
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
dcb843e1
...
@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
...
@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import
com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao
;
import
com.yeejoin.amos.fas.business.feign.JcsFeign
;
import
com.yeejoin.amos.fas.business.feign.JcsFeign
;
...
@@ -126,7 +127,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -126,7 +127,7 @@ public class ContingencyAction implements CustomerAction {
private
IPlanRuleService
planRuleService
;
private
IPlanRuleService
planRuleService
;
@Autowired
@Autowired
private
IPlanVisual3dService
iP
lanVisual3dService
;
private
IPlanVisual3dService
p
lanVisual3dService
;
@Autowired
@Autowired
private
ContingencyInstanceInfoService
contingencyInstanceInfoService
;
private
ContingencyInstanceInfoService
contingencyInstanceInfoService
;
...
@@ -134,6 +135,9 @@ public class ContingencyAction implements CustomerAction {
...
@@ -134,6 +135,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired
@Autowired
private
ContingencyPlanInstanceMapper
contingencyPlanInstanceMapper
;
private
ContingencyPlanInstanceMapper
contingencyPlanInstanceMapper
;
@Autowired
private
IContingencyPlanInstanceRepository
contingencyPlanInstanceRepository
;
@Value
(
"${rocket-plan-topic}"
)
@Value
(
"${rocket-plan-topic}"
)
private
String
rocketTopic
;
private
String
rocketTopic
;
...
@@ -148,6 +152,8 @@ public class ContingencyAction implements CustomerAction {
...
@@ -148,6 +152,8 @@ public class ContingencyAction implements CustomerAction {
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
private
static
Map
<
String
,
ContingencyPlanInstance
>
OPERATE_CONTINGENCYPLAN_INSTANCE
=
new
HashMap
<>();
private
static
Map
<
String
,
Map
<
String
,
String
>>
stringStringMap
=
new
HashMap
<>();
private
static
Map
<
String
,
Map
<
String
,
String
>>
stringStringMap
=
new
HashMap
<>();
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
...
@@ -339,7 +345,6 @@ public class ContingencyAction implements CustomerAction {
...
@@ -339,7 +345,6 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
System
.
out
.
printf
(
"=========recordarea=====396====%s=========%s=========%n"
,
JSONObject
.
toJSONString
(
paramObj
),
JSONObject
.
toJSONString
(
result
));
sendcmd
(
"recordarea"
,
paramObj
,
result
);
sendcmd
(
"recordarea"
,
paramObj
,
result
);
sendweb
(
"recordarea"
,
paramObj
,
result
);
sendweb
(
"recordarea"
,
paramObj
,
result
);
}
}
...
@@ -451,8 +456,9 @@ public class ContingencyAction implements CustomerAction {
...
@@ -451,8 +456,9 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult
result
=
new
SafteyPlanResult
();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
// String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
ContingencyPlanInstance
contingencyPlanInstance
=
getContingencyPlan
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
String
contingencyPlanId
=
contingencyPlanInstance
.
getId
();
tempmap1
.
put
(
"actionName"
,
actionName
);
tempmap1
.
put
(
"actionName"
,
actionName
);
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"tips"
,
tips
);
tempmap1
.
put
(
"tips"
,
tips
);
...
@@ -463,16 +469,9 @@ public class ContingencyAction implements CustomerAction {
...
@@ -463,16 +469,9 @@ public class ContingencyAction implements CustomerAction {
if
(!
isUpdatePlanStep
)
{
if
(!
isUpdatePlanStep
)
{
try
{
try
{
System
.
out
.
println
(
"======optionarea 加入队列参数信息======action====="
);
ButtonJsonVO
buttonJsonVO
=
JSONObject
.
parseObject
(
buttonJson
,
ButtonJsonVO
.
class
);
ButtonJsonVO
buttonJsonVO
=
JSONObject
.
parseObject
(
buttonJson
,
ButtonJsonVO
.
class
);
Map
<
String
,
Object
>
map
=
buttonJsonVO
.
getOperate
().
get
(
buttonJsonVO
.
getOperate
().
size
()
-
1
);
Map
<
String
,
Object
>
map
=
buttonJsonVO
.
getOperate
().
get
(
buttonJsonVO
.
getOperate
().
size
()
-
1
);
System
.
out
.
println
(
"batchNo-->"
+
batchNo
);
iContingencyInstance
.
fire
(
batchNo
,
buttonJsonVO
.
getStepCode
(),
buttonJson
,
contingencyPlanId
,
map
.
get
(
"code"
).
toString
(),
"CANCEL_0"
,
"A"
,
"false"
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
(),
RequestContext
.
getAppKey
());
System
.
out
.
println
(
"stepCode-->"
+
stepCode
);
System
.
out
.
println
(
"stepCodeNew-->"
+
buttonJsonVO
.
getStepCode
());
System
.
out
.
println
(
"contingencyPlanId-->"
+
contingencyPlanId
);
System
.
out
.
println
(
"buttonCode-->"
+
map
.
get
(
"code"
).
toString
());
iContingencyInstance
.
fire
(
batchNo
,
buttonJsonVO
.
getStepCode
(),
contingencyPlanId
,
map
.
get
(
"code"
).
toString
(),
"CANCEL_0"
,
"A"
,
"false"
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
(),
RequestContext
.
getAppKey
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"optionarea 加入队列失败-->"
+
e
.
getMessage
());
log
.
error
(
"optionarea 加入队列失败-->"
+
e
.
getMessage
());
}
}
...
@@ -486,7 +485,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -486,7 +485,7 @@ public class ContingencyAction implements CustomerAction {
messageVO
.
setIsSendApp
(
true
);
messageVO
.
setIsSendApp
(
true
);
messageVO
.
setIsSendWeb
(
true
);
messageVO
.
setIsSendWeb
(
true
);
messageVO
.
setRelationId
(
batchNo
);
messageVO
.
setRelationId
(
batchNo
);
iP
lanVisual3dService
.
sendMessage
(
buttonCode
,
messageVO
);
p
lanVisual3dService
.
sendMessage
(
buttonCode
,
messageVO
);
}
}
}
}
...
@@ -567,6 +566,19 @@ public class ContingencyAction implements CustomerAction {
...
@@ -567,6 +566,19 @@ public class ContingencyAction implements CustomerAction {
return
contingencyPlanId
;
return
contingencyPlanId
;
}
}
private
ContingencyPlanInstance
getContingencyPlan
(
String
batchNo
,
String
actionName
,
String
icon
,
String
tips
,
String
buttonJson
)
{
String
cacheKey
=
batchNo
+
actionName
;
ContingencyPlanInstance
contingencyPlanInstance
=
null
;
if
(
OPERATE_CONTINGENCYPLAN_INSTANCE
.
get
(
cacheKey
)
==
null
)
{
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
batchNo
,
actionName
,
"DEFAULT"
,
buttonJson
,
"OPERATE"
,
icon
);
OPERATE_CONTINGENCYPLAN_INSTANCE
.
put
(
cacheKey
,
contingencyPlanInstance
);
}
else
{
contingencyPlanInstance
=
OPERATE_CONTINGENCYPLAN_INSTANCE
.
get
(
cacheKey
);
OPERATE_CONTINGENCYPLAN_INSTANCE
.
remove
(
cacheKey
);
}
return
contingencyPlanInstance
;
}
/**
/**
* 地图动作推送
* 地图动作推送
...
@@ -845,14 +857,17 @@ public class ContingencyAction implements CustomerAction {
...
@@ -845,14 +857,17 @@ public class ContingencyAction implements CustomerAction {
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
String
batchNo
=
contingencyRo
.
getBatchNo
();
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
// String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
ContingencyPlanInstance
contingencyPlanInstance
=
getContingencyPlan
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
String
contingencyPlanId
=
contingencyPlanInstance
.
getId
();
try
{
try
{
ContingencyPlanInstance
instance
=
contingencyInstance
.
getMessageById
(
contingencyPlanId
);
// ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId);
if
(
instance
!=
null
)
{
// if (contingencyPlanInstance != null) {
instance
.
setRoleCode
(
contingencyInstance
.
getPlanStepRoleCodeByButtonCode
(
buttonCode
));
contingencyPlanInstance
.
setRoleCode
(
contingencyInstance
.
getPlanStepRoleCodeByButtonCode
(
buttonCode
));
contingencyPlanInstanceMapper
.
updateMessageById
(
instance
);
// contingencyPlanInstanceMapper.updateMessageById(contingencyPlanInstance);
}
contingencyPlanInstanceRepository
.
save
(
contingencyPlanInstance
);
contingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
,
"true"
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
(),
RequestContext
.
getAppKey
());
// }
contingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
buttonJson
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
,
"true"
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
(),
RequestContext
.
getAppKey
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -907,7 +922,8 @@ public class ContingencyAction implements CustomerAction {
...
@@ -907,7 +922,8 @@ public class ContingencyAction implements CustomerAction {
this
.
sendweb
(
"recordarea"
,
contingencyRo
,
result
);
this
.
sendweb
(
"recordarea"
,
contingencyRo
,
result
);
updateNumberPlan
(
batchNo
);
updateNumberPlan
(
batchNo
);
// 应急处置中断,初始化planStep,json数据;更新预案结束时间
// 应急处置中断,初始化planStep,json数据;更新预案结束时间
planRuleService
.
updatePlanRuleByBatchNo
(
batchNo
);
// planRuleService.updatePlanRuleByBatchNo(batchNo);
planVisual3dService
.
initPlanStep
();
contingencyInstanceInfoService
.
updateEndTimeById
(
batchNo
);
contingencyInstanceInfoService
.
updateEndTimeById
(
batchNo
);
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/TimeLineController.java
View file @
dcb843e1
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyOriginalDataService
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyOriginalDataService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRuleRunningSnapshotService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRuleRunningSnapshotService
;
import
com.yeejoin.amos.fas.business.vo.PlanExecuteVo
;
import
com.yeejoin.amos.fas.config.Permission
;
import
com.yeejoin.amos.fas.config.Permission
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.request.CommonRequest
;
import
com.yeejoin.amos.fas.core.common.request.CommonRequest
;
...
@@ -67,15 +68,10 @@ public class TimeLineController extends BaseController {
...
@@ -67,15 +68,10 @@ public class TimeLineController extends BaseController {
@Permission
@Permission
//@Authorization(ingore = true)
//@Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"点击按钮"
,
notes
=
"点击按钮"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"点击按钮"
,
notes
=
"点击按钮"
)
@RequestMapping
(
value
=
"/fire"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/fire"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
fire
(
@RequestParam
(
"batchNo"
)
String
batchNo
,
public
CommonResponse
fire
(
@RequestBody
PlanExecuteVo
vo
)
throws
Exception
{
@RequestParam
(
"stepCode"
)
String
stepCode
,
iContingencyInstance
.
fire
(
vo
.
getBatchNo
(),
vo
.
getStepCode
(),
vo
.
getButtonJson
(),
vo
.
getContingencyPlanId
(),
vo
.
getButtonCode
(),
vo
.
getConfirm
(),
vo
.
getStepState
(),
"true"
,
getToken
(),
getProduct
(),
getAppKey
());
@RequestParam
(
"buttonCode"
)
String
buttonCode
,
@RequestParam
(
"confirm"
)
String
confirm
,
@RequestParam
(
"contingencyPlanId"
)
String
contingencyPlanId
,
@RequestParam
(
"stepState"
)
String
stepState
)
throws
Exception
{
iContingencyInstance
.
fire
(
batchNo
,
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
,
"true"
,
getToken
(),
getProduct
(),
getAppKey
());
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
dcb843e1
...
@@ -393,7 +393,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
...
@@ -393,7 +393,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
if
(
"CONFIRM"
.
equals
(
buttonState
)
&&
(
"FIRE_CANCEL"
.
equals
(
code
)
||
"END_EMERGENCY"
.
equals
(
code
)))
{
if
(
"CONFIRM"
.
equals
(
buttonState
)
&&
(
"FIRE_CANCEL"
.
equals
(
code
)
||
"END_EMERGENCY"
.
equals
(
code
)))
{
redisTemplate
.
delete
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
());
redisTemplate
.
delete
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
());
// 应急处置中断,初始化planStep,json数据
// 应急处置中断,初始化planStep,json数据
planRuleService
.
updatePlanRuleByBatchNo
(
batchNo
);
// planRuleService.updatePlanRuleByBatchNo(batchNo);
planVisual3dService
.
initPlanStep
();
// 应急处置中断,更新预案信息表结束时间
// 应急处置中断,更新预案信息表结束时间
contingencyInstanceInfoService
.
updateEndTimeById
(
batchNo
);
contingencyInstanceInfoService
.
updateEndTimeById
(
batchNo
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
...
@@ -447,7 +448,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
...
@@ -447,7 +448,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
}
}
@Override
@Override
public
Optional
<
Equipment
>
fire
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
,
String
isExecute
,
String
token
,
String
product
,
String
appKey
)
throws
Exception
{
public
Optional
<
Equipment
>
fire
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
,
String
isExecute
,
String
token
,
String
product
,
String
appKey
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"batchNo"
,
batchNo
);
map
.
put
(
"batchNo"
,
batchNo
);
map
.
put
(
"stepCode"
,
stepCode
);
map
.
put
(
"stepCode"
,
stepCode
);
...
@@ -456,20 +457,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
...
@@ -456,20 +457,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
map
.
put
(
"contingencyPlanId"
,
contingencyPlanId
);
map
.
put
(
"contingencyPlanId"
,
contingencyPlanId
);
map
.
put
(
"stepState"
,
stepStateOnbutton
);
map
.
put
(
"stepState"
,
stepStateOnbutton
);
map
.
put
(
"isExecute"
,
isExecute
);
map
.
put
(
"isExecute"
,
isExecute
);
map
.
put
(
"buttonJson"
,
buttonJson
);
System
.
out
.
println
(
"======加入队列参数=====fire===1==="
);
System
.
out
.
println
(
"fireQueue-size:-->"
+
fireQueue
.
size
());
System
.
out
.
println
(
"batchNo-->"
+
batchNo
);
System
.
out
.
println
(
"stepCode-->"
+
stepCode
);
System
.
out
.
println
(
"buttonCode-->"
+
buttonCode
);
System
.
out
.
println
(
"confirm-->"
+
buttonState
);
System
.
out
.
println
(
"contingencyPlanId-->"
+
contingencyPlanId
);
System
.
out
.
println
(
"stepState-->"
+
stepStateOnbutton
);
System
.
out
.
println
(
"isExecute-->"
+
isExecute
);
System
.
out
.
println
(
"appKey-->"
+
appKey
);
System
.
out
.
println
(
"product-->"
+
product
);
System
.
out
.
println
(
"token-->"
+
token
);
System
.
out
.
println
(
"======加入队列参数=====fire===2==="
);
if
(
StringUtils
.
isBlank
(
token
)
||
StringUtils
.
isBlank
(
product
))
{
if
(
StringUtils
.
isBlank
(
token
)
||
StringUtils
.
isBlank
(
product
))
{
Toke
serverToken
=
remoteSecurityService
.
getServerToken
();
Toke
serverToken
=
remoteSecurityService
.
getServerToken
();
map
.
put
(
"token"
,
serverToken
.
getToke
());
map
.
put
(
"token"
,
serverToken
.
getToke
());
...
@@ -591,27 +580,16 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
...
@@ -591,27 +580,16 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
String
contingencyPlanId
=
map
.
get
(
"contingencyPlanId"
);
String
contingencyPlanId
=
map
.
get
(
"contingencyPlanId"
);
String
stepState
=
map
.
get
(
"stepState"
);
String
stepState
=
map
.
get
(
"stepState"
);
String
isExecute
=
map
.
get
(
"isExecute"
);
String
isExecute
=
map
.
get
(
"isExecute"
);
String
buttonJson
=
map
.
get
(
"buttonJson"
);
String
appKey
=
map
.
get
(
"appKey"
);
String
appKey
=
map
.
get
(
"appKey"
);
String
product
=
map
.
get
(
"product"
);
String
product
=
map
.
get
(
"product"
);
String
token
=
map
.
get
(
"token"
);
String
token
=
map
.
get
(
"token"
);
try
{
try
{
System
.
out
.
println
(
"======加入队列参数=====fireQueue===1==="
);
System
.
out
.
println
(
"fireQueue-size:-->"
+
fireQueue
.
size
());
System
.
out
.
println
(
"batchNo-->"
+
batchNo
);
System
.
out
.
println
(
"stepCode-->"
+
stepCode
);
System
.
out
.
println
(
"buttonCode-->"
+
buttonCode
);
System
.
out
.
println
(
"confirm-->"
+
confirm
);
System
.
out
.
println
(
"contingencyPlanId-->"
+
contingencyPlanId
);
System
.
out
.
println
(
"stepState-->"
+
stepState
);
System
.
out
.
println
(
"isExecute-->"
+
isExecute
);
System
.
out
.
println
(
"appKey-->"
+
appKey
);
System
.
out
.
println
(
"product-->"
+
product
);
System
.
out
.
println
(
"token-->"
+
token
);
System
.
out
.
println
(
"======加入队列参数=====fireQueue===2==="
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setToken
(
token
);
planVisual3dService
.
updatePlanStep
(
batchNo
,
stepCode
,
contingencyPlanId
,
buttonCode
,
isExecute
);
// planVisual3dService.updatePlanStep(batchNo, stepCode, buttonJson, contingencyPlanId, buttonCode, isExecute);
planVisual3dService
.
updatePlanStepToRedis
(
batchNo
,
stepCode
,
buttonJson
,
contingencyPlanId
,
buttonCode
,
isExecute
);
setButtonExecuted
(
batchNo
,
contingencyPlanId
,
buttonCode
,
confirm
);
setButtonExecuted
(
batchNo
,
contingencyPlanId
,
buttonCode
,
confirm
);
fire
(
batchNo
,
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
);
fire
(
batchNo
,
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java
View file @
dcb843e1
...
@@ -127,6 +127,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
...
@@ -127,6 +127,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
logger
.
info
(
"========状态校验==========="
);
logger
.
info
(
"========状态校验==========="
);
ReserveEnum
reserveEnum
=
this
.
runCheck
(
vo
);
ReserveEnum
reserveEnum
=
this
.
runCheck
(
vo
);
result
.
setMessage
(
reserveEnum
.
getText
());
result
.
setMessage
(
reserveEnum
.
getText
());
planVisual3dService
.
initPlanStep
();
if
(
ReserveEnum
.
THISRUNNING
.
getStatus
().
equals
(
reserveEnum
.
getStatus
()))
{
if
(
ReserveEnum
.
THISRUNNING
.
getStatus
().
equals
(
reserveEnum
.
getStatus
()))
{
List
<
PlanOperationRecord
>
recordList
=
planOperationRecordDao
.
findByPlanId1
(
Long
.
valueOf
(
vo
.
getPlanId
()));
List
<
PlanOperationRecord
>
recordList
=
planOperationRecordDao
.
findByPlanId1
(
Long
.
valueOf
(
vo
.
getPlanId
()));
result
.
setMessage
(
ReserveEnum
.
THISRUNNING
.
getText
());
result
.
setMessage
(
ReserveEnum
.
THISRUNNING
.
getText
());
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
dcb843e1
...
@@ -40,6 +40,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -40,6 +40,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -102,6 +103,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -102,6 +103,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
@Autowired
private
IContingencyPlanInstanceRepository
repository
;
private
IContingencyPlanInstanceRepository
repository
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
private
String
serviceName
;
...
@@ -322,15 +326,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -322,15 +326,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
public
ToipResponse
getPlanStepByBatchNo
(
String
batchNo
)
{
public
ToipResponse
getPlanStepByBatchNo
(
String
batchNo
)
{
ToipResponse
toipResponse
=
new
ToipResponse
();
ToipResponse
toipResponse
=
new
ToipResponse
();
// 根据批次号查询预案步骤
// 根据批次号查询预案步骤
String
planStep
=
planOperationRecordMapper
.
getPlanStepByBatchNo
(
batchNo
);
// String planStep = planOperationRecordMapper.getPlanStepByBatchNo(batchNo);
if
(
StringUtil
.
isNotEmpty
(
planStep
))
{
String
planStep
=
Objects
.
requireNonNull
(
redisTemplate
.
opsForValue
().
get
(
"planStep"
)).
toString
();
JSONArray
objects
=
JSON
.
parseArray
(
planStep
);
JSONArray
objects
=
JSON
.
parseArray
(
planStep
);
Map
<
String
,
Object
>
msgContext
=
new
HashMap
<>(
2
);
if
(
StringUtil
.
isNotEmpty
(
planStep
)
&&
StringUtils
.
isNotBlank
(
batchNo
))
{
// 查询当前步骤
// 查询当前步骤
ContingencyOriginalData
contingencyOriginalData
=
contingencyOriginalDataDao
.
findByBatchNo
(
batchNo
);
ContingencyOriginalData
contingencyOriginalData
=
contingencyOriginalDataDao
.
findByBatchNo
(
batchNo
);
String
step
=
contingencyOriginalData
.
getStep
();
String
confirm
=
contingencyOriginalData
.
getConfirm
();
Map
<
String
,
Object
>
msgContext
=
new
HashMap
<>(
2
);
msgContext
.
put
(
"step"
,
objects
);
msgContext
.
put
(
"currentStep"
,
contingencyOriginalData
.
getStep
());
msgContext
.
put
(
"currentStep"
,
contingencyOriginalData
.
getStep
());
msgContext
.
put
(
"confirm"
,
contingencyOriginalData
.
getConfirm
());
msgContext
.
put
(
"confirm"
,
contingencyOriginalData
.
getConfirm
());
msgContext
.
put
(
"createDate"
,
contingencyOriginalData
.
getCreateDate
());
msgContext
.
put
(
"createDate"
,
contingencyOriginalData
.
getCreateDate
());
...
@@ -342,9 +344,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -342,9 +344,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
}
}
}
toipResponse
.
setMsgType
(
"steparea"
);
toipResponse
.
setMsgType
(
"steparea"
);
toipResponse
.
setMsgContext
(
msgContext
);
toipResponse
.
setContingency
(
contingencyOriginalData
);
toipResponse
.
setContingency
(
contingencyOriginalData
);
}
}
msgContext
.
put
(
"step"
,
objects
);
toipResponse
.
setMsgContext
(
msgContext
);
return
toipResponse
;
return
toipResponse
;
}
}
...
@@ -394,12 +397,21 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -394,12 +397,21 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
}
@Override
@Override
public
void
initPlanStep
()
{
try
{
redisTemplate
.
opsForValue
().
set
(
"planStep"
,
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
)));
redisTemplate
.
delete
(
"isMock"
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"预案redis初始化planStep信息失败!"
);
}
}
@Override
@Transactional
@Transactional
public
void
updatePlanStep
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
)
{
public
void
updatePlanStep
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
)
{
if
(
StringUtils
.
isNotBlank
(
batchNo
)
&&
StringUtils
.
isNotBlank
(
contingencyPlanId
)
&&
StringUtils
.
isNotBlank
(
buttonCode
))
{
if
(
StringUtils
.
isNotBlank
(
batchNo
)
&&
StringUtils
.
isNotBlank
(
contingencyPlanId
)
&&
StringUtils
.
isNotBlank
(
buttonCode
))
{
// 根据批次号查询预案步骤
// 根据批次号查询预案步骤
PlanRule
planRule
=
planOperationRecordMapper
.
getPlanRuleByBatchNo
(
batchNo
);
PlanRule
planRule
=
planOperationRecordMapper
.
getPlanRuleByBatchNo
(
batchNo
);
System
.
out
.
println
(
"======updatePlanStep==前==="
+
JSON
.
toJSONString
(
planRule
));
if
(
planRule
!=
null
)
{
if
(
planRule
!=
null
)
{
List
<
PlanStepJsonVO
>
list
=
JSONObject
.
parseArray
(
planRule
.
getPlanStep
(),
PlanStepJsonVO
.
class
);
List
<
PlanStepJsonVO
>
list
=
JSONObject
.
parseArray
(
planRule
.
getPlanStep
(),
PlanStepJsonVO
.
class
);
List
<
PlanStepJsonVO
>
collect
=
list
.
stream
().
peek
(
x
->
{
List
<
PlanStepJsonVO
>
collect
=
list
.
stream
().
peek
(
x
->
{
...
@@ -427,13 +439,55 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -427,13 +439,55 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
// 通过contingencyPlanId获取buttonJson数据
// 通过contingencyPlanId获取buttonJson数据
x
.
setBatchNo
(
batchNo
);
x
.
setBatchNo
(
batchNo
);
x
.
setCaseId
(
contingencyPlanId
);
x
.
setCaseId
(
contingencyPlanId
);
ContingencyPlanInstance
planInstance
=
iContingencyPlanInstanceRepository
.
getOne
(
contingencyPlanId
);
// ContingencyPlanInstance planInstance = iContingencyPlanInstanceRepository.getOne(contingencyPlanId);
x
.
setButtonJson
(
planInstance
.
getContent
());
// x.setButtonJson(planInstance.getContent());
x
.
setButtonJson
(
buttonJson
);
}
}
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
planRule
.
setPlanStep
(
JSON
.
toJSONString
(
collect1
));
planRule
.
setPlanStep
(
JSON
.
toJSONString
(
collect1
));
planRuleDao
.
save
(
planRule
);
planRuleDao
.
save
(
planRule
);
System
.
out
.
println
(
"======updatePlanStep==后==="
+
JSON
.
toJSONString
(
planRule
));
}
}
}
@Override
public
void
updatePlanStepToRedis
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
)
{
if
(
StringUtils
.
isNotBlank
(
batchNo
)
&&
StringUtils
.
isNotBlank
(
contingencyPlanId
)
&&
StringUtils
.
isNotBlank
(
buttonCode
))
{
// 根据批次号查询预案步骤
String
planStep
=
Objects
.
requireNonNull
(
redisTemplate
.
opsForValue
().
get
(
"planStep"
)).
toString
();
if
(
StringUtils
.
isNotBlank
(
planStep
))
{
List
<
PlanStepJsonVO
>
list
=
JSONObject
.
parseArray
(
planStep
,
PlanStepJsonVO
.
class
);
List
<
PlanStepJsonVO
>
collect
=
list
.
stream
().
peek
(
x
->
{
if
(
"true"
.
equals
(
isExecute
))
{
// 更新进度条标志位
if
(
StringUtils
.
isBlank
(
x
.
getTime
())
&&
Integer
.
parseInt
(
x
.
getStepCode
())
<=
Integer
.
parseInt
(
stepCode
))
{
x
.
setShowLine
(
true
);
}
}
}).
collect
(
Collectors
.
toList
());
List
<
PlanStepJsonVO
>
collect1
=
collect
.
stream
().
peek
(
x
->
{
String
code
=
x
.
getStepCode
();
if
(
code
.
equals
(
stepCode
))
{
if
(
"true"
.
equals
(
isExecute
))
{
if
(
buttonCode
.
endsWith
(
"_NOT"
))
{
x
.
setCheckYesOrNo
(
"0"
);
}
else
{
x
.
setCheckYesOrNo
(
"1"
);
if
(
StringUtils
.
isNotBlank
(
x
.
getTime
()))
{
x
.
setShowLine
(
true
);
}
}
x
.
setTime
(
DateFormatUtils
.
format
(
new
Date
(),
"HH:mm:ss"
));
}
// 通过contingencyPlanId获取buttonJson数据
x
.
setBatchNo
(
batchNo
);
x
.
setCaseId
(
contingencyPlanId
);
// ContingencyPlanInstance planInstance = iContingencyPlanInstanceRepository.getOne(contingencyPlanId);
// x.setButtonJson(planInstance.getContent());
x
.
setButtonJson
(
buttonJson
);
}
}).
collect
(
Collectors
.
toList
());
redisTemplate
.
opsForValue
().
set
(
"planStep"
,
JSON
.
toJSONString
(
collect1
));
}
}
}
}
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IContingencyInstance.java
View file @
dcb843e1
...
@@ -24,7 +24,7 @@ public interface IContingencyInstance {
...
@@ -24,7 +24,7 @@ public interface IContingencyInstance {
void
updateStep
(
String
step
,
String
batchNo
);
void
updateStep
(
String
step
,
String
batchNo
);
Optional
<
Equipment
>
fire
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
,
String
isExecute
,
String
token
,
String
product
,
String
appKey
)
throws
Exception
;
Optional
<
Equipment
>
fire
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
,
String
isExecute
,
String
token
,
String
product
,
String
appKey
)
throws
Exception
;
/**
/**
* 扩展属性赋值
* 扩展属性赋值
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
dcb843e1
...
@@ -90,7 +90,11 @@ public interface IPlanVisual3dService {
...
@@ -90,7 +90,11 @@ public interface IPlanVisual3dService {
PlanStepVo
updatePlanStep
(
PlanStepVo
planStepVo
);
PlanStepVo
updatePlanStep
(
PlanStepVo
planStepVo
);
void
updatePlanStep
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
);
void
initPlanStep
();
void
updatePlanStep
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
);
void
updatePlanStepToRedis
(
String
batchNo
,
String
stepCode
,
String
buttonJson
,
String
contingencyPlanId
,
String
buttonCode
,
String
isExecute
);
Page
<
ContingencyPlanInstanceVO
>
selectDisposalActionPage
(
int
current
,
int
size
,
String
batchNo
,
List
<
RoleModel
>
roleModelList
,
int
dataType
);
Page
<
ContingencyPlanInstanceVO
>
selectDisposalActionPage
(
int
current
,
int
size
,
String
batchNo
,
List
<
RoleModel
>
roleModelList
,
int
dataType
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/PlanExecuteVo.java
0 → 100644
View file @
dcb843e1
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
lombok.Data
;
@Data
public
class
PlanExecuteVo
{
private
String
batchNo
;
private
String
stepCode
;
private
String
buttonJson
;
private
String
buttonCode
;
private
String
confirm
;
private
String
contingencyPlanId
;
private
String
stepState
;
}
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