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
494b5d5a
Commit
494b5d5a
authored
Jan 19, 2021
by
吴俊凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预案启动代码提交
parent
1efd642c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
369 additions
and
162 deletions
+369
-162
PlanRecordStatusEnum.java
...m/yeejoin/amos/fas/common/enums/PlanRecordStatusEnum.java
+77
-0
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+115
-104
ContingencyPlanController.java
...os/fas/business/controller/ContingencyPlanController.java
+21
-5
RiskSourceController.java
...in/amos/fas/business/controller/RiskSourceController.java
+4
-27
PlanOperationRecordMapper.java
...os/fas/business/dao/mapper/PlanOperationRecordMapper.java
+6
-0
IPlanEquipmentDao.java
...n/amos/fas/business/dao/repository/IPlanEquipmentDao.java
+3
-0
IPlanOperationRecordDao.java
.../fas/business/dao/repository/IPlanOperationRecordDao.java
+3
-0
ContingencyPlanServiceImpl.java
...fas/business/service/impl/ContingencyPlanServiceImpl.java
+66
-9
HandlerMqttMessageImpl.java
...mos/fas/business/service/impl/HandlerMqttMessageImpl.java
+16
-6
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+4
-1
ContingencyPlanService.java
...os/fas/business/service/intfc/ContingencyPlanService.java
+5
-0
IRiskSourceService.java
...n/amos/fas/business/service/intfc/IRiskSourceService.java
+9
-9
TopicEntityVo.java
.../java/com/yeejoin/amos/fas/business/vo/TopicEntityVo.java
+2
-0
PlanOperationRecordMapper.xml
...rc/main/resources/db/mapper/PlanOperationRecordMapper.xml
+38
-1
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/common/enums/PlanRecordStatusEnum.java
0 → 100644
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
common
.
enums
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
*0、运行中,1、完毕,3、中断
* @author suhg
*/
public
enum
PlanRecordStatusEnum
{
OPERATION
(
"运行中"
,
0
),
COMPLETE
(
"完毕"
,
1
),
INTERRUPT
(
"中断"
,
2
);
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
Integer
code
;
/**
* 颜色
*/
private
String
color
;
private
PlanRecordStatusEnum
(
String
name
,
Integer
code
){
this
.
name
=
name
;
this
.
code
=
code
;
}
public
static
PlanRecordStatusEnum
getEnum
(
Integer
code
)
{
PlanRecordStatusEnum
checkStatusEnum
=
null
;
for
(
PlanRecordStatusEnum
type:
PlanRecordStatusEnum
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
checkStatusEnum
=
type
;
break
;
}
}
return
checkStatusEnum
;
}
public
static
List
<
Map
<
String
,
Object
>>
getEnumList
()
{
List
<
Map
<
String
,
Object
>>
nameList
=
new
ArrayList
<>();
for
(
PlanRecordStatusEnum
c:
PlanRecordStatusEnum
.
values
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"name"
,
c
.
getName
());
map
.
put
(
"code"
,
c
.
getCode
());
nameList
.
add
(
map
);
}
return
nameList
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
import
java.io.IOException
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -49,19 +19,49 @@ import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
...
@@ -49,19 +19,49 @@ 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.action.result.message.AbstractActionResultMessage
;
import
com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher
;
import
com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher
;
import
com.yeejoin.amos.fas.business.action.util.StepComparator
;
import
com.yeejoin.amos.fas.business.action.util.StepComparator
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl
;
import
com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl
;
//import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
import
com.yeejoin.amos.fas.dao.entity.PlanOperationRecord
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.io.IOException
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
//import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
@Component
@Component
@RuleActionBean
(
beanLabel
=
"动态预案"
)
@RuleActionBean
(
beanLabel
=
"动态预案"
)
...
@@ -74,15 +74,15 @@ public class ContingencyAction implements CustomerAction {
...
@@ -74,15 +74,15 @@ public class ContingencyAction implements CustomerAction {
@Autowired
@Autowired
private
WebMqttComponent
webMqttComponent
;
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${auto-sys.push.type}"
)
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
private
String
serviceName
;
@Value
(
"${station.name}"
)
@Value
(
"${station.name}"
)
private
String
stationName
;
private
String
stationName
;
@Autowired
@Autowired
private
IContingencyInstance
iContingencyInstance
;
private
IContingencyInstance
iContingencyInstance
;
...
@@ -102,20 +102,24 @@ public class ContingencyAction implements CustomerAction {
...
@@ -102,20 +102,24 @@ public class ContingencyAction implements CustomerAction {
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
private
RedisTemplate
redisTemplate
;
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
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"
);
public
static
ConcurrentHashMap
<
String
,
Map
<
String
,
Object
>>
pointCache
=
new
ConcurrentHashMap
<>();
public
static
ConcurrentHashMap
<
String
,
Map
<
String
,
Object
>>
pointCache
=
new
ConcurrentHashMap
<>();
private
static
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
private
static
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
private
static
final
String
TOKE
=
"TOKE"
;
private
static
final
String
TOKE
=
"TOKE"
;
@Autowired
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
IPlanDetailDao
planDetailDao
;
@Autowired
private
IPlanOperationRecordDao
planOperationRecordDao
;
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
put("S1", "S1");
put("S1", "S1");
...
@@ -153,12 +157,12 @@ public class ContingencyAction implements CustomerAction {
...
@@ -153,12 +157,12 @@ public class ContingencyAction implements CustomerAction {
param
.
put
(
"dutyDate"
,
curDate
);
param
.
put
(
"dutyDate"
,
curDate
);
Toke
toke
=
remoteSecurityService
.
getServerToken
();
Toke
toke
=
remoteSecurityService
.
getServerToken
();
CommonResponse
commonResponse
=
dutyModeServer
.
dutyListByDate
(
toke
.
getAppKey
(),
toke
.
getProduct
(),
toke
.
getToke
(),
orgCode
,
param
.
toJSONString
());
CommonResponse
commonResponse
=
dutyModeServer
.
dutyListByDate
(
toke
.
getAppKey
(),
toke
.
getProduct
(),
toke
.
getToke
(),
orgCode
,
param
.
toJSONString
());
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
// JSONObject jsonObject = JSONObject.parseObject(result);
// JSONObject jsonObject = JSONObject.parseObject(result);
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString());
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString());
String
JSONStr
=
JSON
.
toJSONString
(
commonResponse
.
getDataList
());
String
JSONStr
=
JSON
.
toJSONString
(
commonResponse
.
getDataList
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
log
.
info
(
String
.
format
(
"请求值班系统返回dataList:%s"
,
dataList
));
log
.
info
(
String
.
format
(
"请求值班系统返回dataList:%s"
,
dataList
));
...
@@ -195,7 +199,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -195,7 +199,7 @@ public class ContingencyAction implements CustomerAction {
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setTopic
(
topic
);
event
.
setTopic
(
topic
);
...
@@ -205,7 +209,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -205,7 +209,7 @@ public class ContingencyAction implements CustomerAction {
}
else
if
(
"websocket"
.
equals
(
pushType
.
toLowerCase
())){
}
else
if
(
"websocket"
.
equals
(
pushType
.
toLowerCase
())){
action
.
execute
(
msgType
,
contingency
);
action
.
execute
(
msgType
,
contingency
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -213,16 +217,11 @@ public class ContingencyAction implements CustomerAction {
...
@@ -213,16 +217,11 @@ public class ContingencyAction implements CustomerAction {
/**
/**
* @param stepCode 当前步骤编号
* @param stepCode 当前步骤编号
* @param stepName 当前步骤名称
* @param state 当前步骤状态
* @param nextStepCode 下一步编号
* @param nextStepName 下一步名称
* @param stepType 步骤类型,总览步骤、详细步骤
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
*/
@RuleMethod
(
methodLabel
=
"步骤更新"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"步骤更新"
,
project
=
"换流站消防专项预案"
)
public
void
stepInfo
(
@MethodParam
(
paramLabel
=
"当前编号"
)
String
stepCode
,
public
void
stepInfo
(
@MethodParam
(
paramLabel
=
"当前编号"
)
String
stepCode
,
// @MethodParam(paramLabel = "步骤类型") String stepType,
// @MethodParam(paramLabel = "步骤类型") String stepType,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
...
@@ -234,7 +233,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -234,7 +233,7 @@ public class ContingencyAction implements CustomerAction {
HashMap
preStep
=
new
HashMap
();
HashMap
preStep
=
new
HashMap
();
StepComparator
comparator
=
new
StepComparator
();
StepComparator
comparator
=
new
StepComparator
();
Arrays
.
sort
(
stepArr
,
comparator
);
Arrays
.
sort
(
stepArr
,
comparator
);
boolean
flage
=
false
;
boolean
flage
=
false
;
SetpEnum
pstep
=
null
;
SetpEnum
pstep
=
null
;
for
(
SetpEnum
step
:
stepArr
)
{
for
(
SetpEnum
step
:
stepArr
)
{
...
@@ -253,14 +252,14 @@ public class ContingencyAction implements CustomerAction {
...
@@ -253,14 +252,14 @@ public class ContingencyAction implements CustomerAction {
}
}
pstep
=
step
;
pstep
=
step
;
}
}
tempmap1
.
put
(
"step"
,
list
);
tempmap1
.
put
(
"step"
,
list
);
tempmap1
.
put
(
"preStep"
,
preStep
);
tempmap1
.
put
(
"preStep"
,
preStep
);
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
result
));
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
result
));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
}
/**
/**
* @param stepCode 当前步骤编号
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
* @param paramObj 预案对象
...
@@ -283,7 +282,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -283,7 +282,7 @@ public class ContingencyAction implements CustomerAction {
//转换content中的变量
//转换content中的变量
content
=
instedParams
(
content
,
contingencyRo
);
content
=
instedParams
(
content
,
contingencyRo
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
content
,
"MESSAGE"
,
""
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
content
,
"MESSAGE"
,
""
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
try
{
try
{
...
@@ -304,7 +303,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -304,7 +303,7 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
}
}
...
@@ -322,12 +321,12 @@ public class ContingencyAction implements CustomerAction {
...
@@ -322,12 +321,12 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
*/
@RuleMethod
(
methodLabel
=
"智能辅助"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"智能辅助"
,
project
=
"换流站消防专项预案"
)
public
void
help
(
@MethodParam
(
paramLabel
=
"当前步骤"
)
String
step
,
public
void
help
(
@MethodParam
(
paramLabel
=
"当前步骤"
)
String
step
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"图片集"
)
String
image
,
@MethodParam
(
paramLabel
=
"图片集"
)
String
image
,
@MethodParam
(
paramLabel
=
"表格数据"
)
String
table
,
@MethodParam
(
paramLabel
=
"表格数据"
)
String
table
,
@MethodParam
(
paramLabel
=
"文本内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"文本内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
...
@@ -369,7 +368,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -369,7 +368,7 @@ public class ContingencyAction implements CustomerAction {
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
content
=
content
.
replaceAll
(
"\\$\\{"
+
field
.
getName
()
+
"}"
,
value
);
content
=
content
.
replaceAll
(
"\\$\\{"
+
field
.
getName
()
+
"}"
,
value
);
}
}
content
=
getNative
(
content
);
content
=
getNative
(
content
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -404,10 +403,10 @@ public class ContingencyAction implements CustomerAction {
...
@@ -404,10 +403,10 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
*/
@RuleMethod
(
methodLabel
=
"交互动作"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"交互动作"
,
project
=
"换流站消防专项预案"
)
public
void
operation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
public
void
operation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
...
@@ -479,10 +478,10 @@ public class ContingencyAction implements CustomerAction {
...
@@ -479,10 +478,10 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
*/
@RuleMethod
(
methodLabel
=
"保存交互动作"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"保存交互动作"
,
project
=
"换流站消防专项预案"
)
public
void
saveOperation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
public
void
saveOperation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
...
@@ -509,7 +508,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -509,7 +508,7 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
}
}
...
@@ -539,7 +538,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -539,7 +538,7 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"地图动作"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"地图动作"
,
project
=
"换流站消防专项预案"
)
public
void
mapAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
mapAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
log
.
error
(
"======================================================================================="
);
log
.
error
(
"======================================================================================="
);
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
...
@@ -554,12 +553,12 @@ public class ContingencyAction implements CustomerAction {
...
@@ -554,12 +553,12 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"地图动画"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"地图动画"
,
project
=
"换流站消防专项预案"
)
public
void
mapCartoonAction
(
public
void
mapCartoonAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"动作类型"
)
String
actionType
,
@MethodParam
(
paramLabel
=
"动作类型"
)
String
actionType
,
@MethodParam
(
paramLabel
=
"动作类型参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"动作类型参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
log
.
error
(
"======================================================================================="
);
log
.
error
(
"======================================================================================="
);
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
String
parameter
=
instedParams
(
paramJSON
,
contingencyRo
);
String
parameter
=
instedParams
(
paramJSON
,
contingencyRo
);
...
@@ -583,10 +582,10 @@ public class ContingencyAction implements CustomerAction {
...
@@ -583,10 +582,10 @@ public class ContingencyAction implements CustomerAction {
*/
*/
@RuleMethod
(
methodLabel
=
"消息提示"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"消息提示"
,
project
=
"换流站消防专项预案"
)
public
void
topMessage
(
public
void
topMessage
(
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"类型"
)
String
messageType
,
@MethodParam
(
paramLabel
=
"类型"
)
String
messageType
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
stopSnapshop
(
contingencyRo
);
...
@@ -623,11 +622,11 @@ public class ContingencyAction implements CustomerAction {
...
@@ -623,11 +622,11 @@ public class ContingencyAction implements CustomerAction {
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
opsForValue
().
set
(
"contingencyRo"
,
contingencyRo
);
redisTemplate
.
opsForValue
().
set
(
"contingencyRo"
,
contingencyRo
);
}
}
/**
/**
* 启动预案
* 启动预案
*
*
...
@@ -646,7 +645,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -646,7 +645,7 @@ public class ContingencyAction implements CustomerAction {
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
delete
(
"contingencyRo"
);
redisTemplate
.
delete
(
"contingencyRo"
);
// 结束预案,更新设备重点设备参数
// 结束预案,更新设备重点设备参数
...
@@ -659,19 +658,31 @@ public class ContingencyAction implements CustomerAction {
...
@@ -659,19 +658,31 @@ public class ContingencyAction implements CustomerAction {
equipmentService
.
save
(
equipment
);
equipmentService
.
save
(
equipment
);
}
}
}
}
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord
planOperationRecord
=
planOperationRecordDao
.
findByBatchNo
(
contingencyRo
.
getBatchNo
());
if
(
planOperationRecord
!=
null
){
planOperationRecord
.
setStatus
(
PlanRecordStatusEnum
.
COMPLETE
.
getCode
());
planOperationRecord
.
setEndTime
(
new
Date
());
Optional
<
PlanDetail
>
optionalPlanDetail
=
planDetailDao
.
findById
(
planOperationRecord
.
getPlanId
());
if
(
optionalPlanDetail
.
get
()!=
null
){
PlanDetail
planDetail
=
optionalPlanDetail
.
get
();
planDetail
.
setStatus
(
Integer
.
parseInt
(
ContingencyPlanStatusEnum
.
AVAILABLE
.
getCode
()));
planDetailDao
.
save
(
planDetail
);
}
}
}
}
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"换流站消防专项预案"
)
public
void
autoExecute
(
public
void
autoExecute
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
Toke
toke
=
remoteSecurityService
.
getServerToken
();
Toke
toke
=
remoteSecurityService
.
getServerToken
();
// Toke toke = cacheMap.getValue(TOKE);
// Toke toke = cacheMap.getValue(TOKE);
// if (toke == null) {
// if (toke == null) {
...
@@ -688,16 +699,16 @@ public class ContingencyAction implements CustomerAction {
...
@@ -688,16 +699,16 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@RuleMethod
(
methodLabel
=
"添加步骤执行"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"添加步骤执行"
,
project
=
"换流站消防专项预案"
)
public
void
addExecute
(
public
void
addExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
...
@@ -712,25 +723,25 @@ public class ContingencyAction implements CustomerAction {
...
@@ -712,25 +723,25 @@ public class ContingencyAction implements CustomerAction {
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
}
}
@RuleMethod
(
methodLabel
=
"清除步骤执行"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"清除步骤执行"
,
project
=
"换流站消防专项预案"
)
public
void
clearExecute
(
public
void
clearExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
equipemtnPoints
.
remove
(
stepCode
+
"-"
+
buttonCode
);
equipemtnPoints
.
remove
(
stepCode
+
"-"
+
buttonCode
);
}
}
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"type"
,
"buttonCache"
);
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
...
@@ -738,25 +749,25 @@ public class ContingencyAction implements CustomerAction {
...
@@ -738,25 +749,25 @@ public class ContingencyAction implements CustomerAction {
tempmap1
.
put
(
"content"
,
new
ArrayList
());
tempmap1
.
put
(
"content"
,
new
ArrayList
());
}
}
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
}
}
@RuleMethod
(
methodLabel
=
"同步自动执行步骤"
,
project
=
"换流站消防专项预案"
)
@RuleMethod
(
methodLabel
=
"同步自动执行步骤"
,
project
=
"换流站消防专项预案"
)
public
void
sendExecute
(
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
public
void
sendExecute
(
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
contingencyRo
.
getEquipmentId
());
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
contingencyRo
.
getEquipmentId
());
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
}
public
void
sendcmd
(
String
msgType
,
DeviceRo
deviceRo
,
SafteyPlanResult
result
)
{
public
void
sendcmd
(
String
msgType
,
DeviceRo
deviceRo
,
SafteyPlanResult
result
)
{
Constructor
<?>
constructor
;
Constructor
<?>
constructor
;
try
{
try
{
...
@@ -769,7 +780,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -769,7 +780,7 @@ public class ContingencyAction implements CustomerAction {
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setTopic
(
topic
);
event
.
setTopic
(
topic
);
...
@@ -783,7 +794,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -783,7 +794,7 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
private
void
stopSnapshop
(
ContingencyRo
contingencyRo
)
{
private
void
stopSnapshop
(
ContingencyRo
contingencyRo
)
{
if
(
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
()
!=
null
&&
!
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
().
equals
(
contingencyRo
.
getBatchNo
()))
if
(
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
()
!=
null
&&
!
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
().
equals
(
contingencyRo
.
getBatchNo
()))
RuleRunigSnapshotServiceImpl
.
setReplayBatchNoToNull
();
RuleRunigSnapshotServiceImpl
.
setReplayBatchNoToNull
();
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/ContingencyPlanController.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil2
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil2
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"/api/contingencyPlan"
)
@RequestMapping
(
"/api/contingencyPlan"
)
...
@@ -21,8 +20,25 @@ public class ContingencyPlanController extends BaseController {
...
@@ -21,8 +20,25 @@ public class ContingencyPlanController extends BaseController {
private
ContingencyPlanService
contingencyPlanService
;
private
ContingencyPlanService
contingencyPlanService
;
@ApiOperation
(
value
=
"启动"
)
@ApiOperation
(
value
=
"启动"
)
@RequestMapping
(
value
=
"/start"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/start"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
create
(
@RequestBody
ContingencyPlanParamVo
vo
)
{
public
ResponseModel
start
(
@RequestBody
ContingencyPlanParamVo
vo
)
{
contingencyPlanService
.
planStart
(
vo
);
contingencyPlanService
.
planStart
(
vo
);
return
CommonResponseUtil2
.
success
();
return
CommonResponseUtil2
.
success
();
}
}
@ApiOperation
(
value
=
"装备确景"
)
@RequestMapping
(
value
=
"/scene"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
scene
(
@ApiParam
(
value
=
"装备Id"
,
required
=
true
)
String
equipmentId
)
{
ContingencyPlanParamVo
vo
=
contingencyPlanService
.
equipmentScene
(
Long
.
parseLong
(
equipmentId
));
return
CommonResponseUtil2
.
success
(
vo
);
}
@ApiOperation
(
value
=
"预案启动记录分页列表"
)
@RequestMapping
(
value
=
"/recordList"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
recordList
(
@ApiParam
(
value
=
"预案名称"
)
@RequestParam
(
required
=
false
)
String
planName
,
@RequestParam
int
pageNumber
,
@RequestParam
int
pageSize
)
{
Page
page
=
contingencyPlanService
.
recordListByPage
(
planName
,
pageNumber
,
pageSize
);
return
CommonResponseUtil2
.
success
(
page
);
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskSourceController.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil2
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
...
@@ -38,9 +13,11 @@ import com.yeejoin.amos.fas.business.vo.ReginParams;
...
@@ -38,9 +13,11 @@ import com.yeejoin.amos.fas.business.vo.ReginParams;
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.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil2
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
...
@@ -648,7 +625,7 @@ public class RiskSourceController extends BaseController {
...
@@ -648,7 +625,7 @@ public class RiskSourceController extends BaseController {
@RequestMapping
(
value
=
"/startEquipReserve"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/startEquipReserve"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
ResponseModel
startEquipReserve
(
@RequestParam
Long
id
,
@RequestParam
String
typeCode
)
{
public
ResponseModel
startEquipReserve
(
@RequestParam
Long
id
,
@RequestParam
String
typeCode
)
{
ReserveEnum
reserveEnum
=
riskSourceService
.
startEquipReserve
(
id
,
typeCode
);
ReserveEnum
reserveEnum
=
riskSourceService
.
startEquipReserve
(
id
,
typeCode
,
null
);
Integer
status
=
reserveEnum
.
getStatus
();
Integer
status
=
reserveEnum
.
getStatus
();
String
text
=
reserveEnum
.
getText
();
String
text
=
reserveEnum
.
getText
();
if
(
status
==
1
)
{
if
(
status
==
1
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/PlanOperationRecordMapper.java
View file @
494b5d5a
...
@@ -2,6 +2,10 @@ package com.yeejoin.amos.fas.business.dao.mapper;
...
@@ -2,6 +2,10 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* <h1><h1>
* <h1><h1>
*
*
...
@@ -10,4 +14,6 @@ import org.springframework.stereotype.Repository;
...
@@ -10,4 +14,6 @@ import org.springframework.stereotype.Repository;
*/
*/
@Repository
@Repository
public
interface
PlanOperationRecordMapper
{
public
interface
PlanOperationRecordMapper
{
Integer
PlanOperationRecordListByCount
(
Map
<
String
,
Object
>
params
);
List
<
HashMap
<
String
,
Object
>>
PlanOperationRecordListByPage
(
Map
<
String
,
Object
>
params
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanEquipmentDao.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.dao.entity.PlanEquipment
;
import
com.yeejoin.amos.fas.dao.entity.PlanEquipment
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
@@ -11,4 +12,6 @@ import org.springframework.stereotype.Repository;
...
@@ -11,4 +12,6 @@ import org.springframework.stereotype.Repository;
*/
*/
@Repository
@Repository
public
interface
IPlanEquipmentDao
extends
BaseDao
<
PlanEquipment
,
Long
>
{
public
interface
IPlanEquipmentDao
extends
BaseDao
<
PlanEquipment
,
Long
>
{
@Query
(
value
=
"SELECT * from c_plan_equipment where fire_equipment_id = ?1 AND is_delete = 0 "
,
nativeQuery
=
true
)
PlanEquipment
findByFireEquipmentId
(
Long
fireEquipmentId
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanOperationRecordDao.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.dao.entity.PlanOperationRecord
;
import
com.yeejoin.amos.fas.dao.entity.PlanOperationRecord
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
@@ -11,4 +12,6 @@ import org.springframework.stereotype.Repository;
...
@@ -11,4 +12,6 @@ import org.springframework.stereotype.Repository;
*/
*/
@Repository
@Repository
public
interface
IPlanOperationRecordDao
extends
BaseDao
<
PlanOperationRecord
,
Long
>
{
public
interface
IPlanOperationRecordDao
extends
BaseDao
<
PlanOperationRecord
,
Long
>
{
@Query
(
value
=
"SELECT * from c_plan_operation_record where batch_no = ?1 AND is_delete = 0 "
,
nativeQuery
=
true
)
PlanOperationRecord
findByBatchNo
(
String
batchNo
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
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.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.Optional
;
/**
/**
*@program: YeeAmosFireAutoSysRoot
*@program: YeeAmosFireAutoSysRoot
...
@@ -30,8 +32,18 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
...
@@ -30,8 +32,18 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
private
IEquipmentService
equipmentService
;
private
IEquipmentService
equipmentService
;
@Autowired
@Autowired
private
IRiskSourceService
riskSourceService
;
private
IRiskSourceService
riskSourceService
;
@Autowired
private
IPlanOperationRecordDao
planOperationRecordDao
;
@Qualifier
(
"IEquipmentFireEquipmentDao"
)
@Autowired
private
IEquipmentFireEquipmentDao
equipmentFireEquipmentDao
;
@Qualifier
(
"iEquipmentDao"
)
@Autowired
private
IEquipmentDao
equipmentDao
;
@Autowired
private
IPlanEquipmentDao
planEquipmentDao
;
@Autowired
private
PlanOperationRecordMapper
planOperationRecordMapper
;
@Override
@Override
public
String
planStart
(
ContingencyPlanParamVo
vo
){
public
String
planStart
(
ContingencyPlanParamVo
vo
){
ReserveEnum
reserveEnum
=
null
;
ReserveEnum
reserveEnum
=
null
;
...
@@ -53,12 +65,20 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
...
@@ -53,12 +65,20 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
}
else
{
}
else
{
return
"预控启动状态不正确"
;
return
"预控启动状态不正确"
;
}
}
//预案启动
Optional
<
PlanDetail
>
PlanDetailOp
=
planDetailDao
.
findById
(
Long
.
valueOf
(
vo
.
getPlanId
()));
Optional
<
PlanDetail
>
PlanDetailOp
=
planDetailDao
.
findById
(
Long
.
valueOf
(
vo
.
getPlanId
()));
//插入运行记录表
PlanOperationRecord
planOperationRecord
=
new
PlanOperationRecord
();
planOperationRecord
.
setStatus
(
PlanRecordStatusEnum
.
OPERATION
.
getCode
());
planOperationRecord
.
setPlanId
(
PlanDetailOp
.
get
().
getId
());
planOperationRecord
.
setIsDelete
(
true
);
planOperationRecord
.
setStartTime
(
new
Date
());
planOperationRecord
.
setPlanPattern
(
Integer
.
parseInt
(
vo
.
getStatus
()));
PlanOperationRecord
result
=
planOperationRecordDao
.
save
(
planOperationRecord
);
//预案启动
if
(
PlanDetailOp
.
get
()!=
null
){
if
(
PlanDetailOp
.
get
()!=
null
){
Equipment
equipment
=
equipmentService
.
queryOne
(
PlanDetailOp
.
get
().
getId
());
Equipment
equipment
=
equipmentService
.
queryOne
(
PlanDetailOp
.
get
().
getId
());
//预案启动
//预案启动
reserveEnum
=
riskSourceService
.
startEquipReserve
(
equipment
.
getId
(),
equipment
.
getCode
());
reserveEnum
=
riskSourceService
.
startEquipReserve
(
equipment
.
getId
(),
equipment
.
getCode
()
,
result
.
getId
()
);
if
(
ReserveEnum
.
RUN
.
getStatus
()
==
reserveEnum
.
getStatus
()){
if
(
ReserveEnum
.
RUN
.
getStatus
()
==
reserveEnum
.
getStatus
()){
PlanDetail
planDetail
=
PlanDetailOp
.
get
();
PlanDetail
planDetail
=
PlanDetailOp
.
get
();
planDetail
.
setStatus
(
Integer
.
parseInt
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
()));
planDetail
.
setStatus
(
Integer
.
parseInt
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
()));
...
@@ -67,4 +87,40 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
...
@@ -67,4 +87,40 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
}
}
return
reserveEnum
.
getText
();
return
reserveEnum
.
getText
();
}
}
@Override
public
ContingencyPlanParamVo
equipmentScene
(
Long
equipmentId
)
{
ContingencyPlanParamVo
vo
=
null
;
List
<
EquipmentFireEquipment
>
equipmentFireEquipmentList
=
equipmentFireEquipmentDao
.
findAllByEquipmentId
(
equipmentId
);
if
(
equipmentFireEquipmentList
.
size
()>
0
){
Optional
<
Equipment
>
equipmentOptional
=
equipmentDao
.
findById
(
equipmentFireEquipmentList
.
get
(
0
).
getEquipmentId
());
if
(
equipmentOptional
.
get
()!=
null
){
PlanEquipment
planEquipment
=
planEquipmentDao
.
findByFireEquipmentId
(
equipmentOptional
.
get
().
getId
());
if
(
planEquipment
!=
null
){
vo
=
new
ContingencyPlanParamVo
();
vo
.
setPlanId
(
planEquipment
.
getPlanId
().
toString
());
vo
.
setStatus
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
());
return
vo
;
}
}
}
return
vo
;
}
@Override
public
Page
recordListByPage
(
String
planName
,
int
pageNumber
,
int
pageSize
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"planName"
,
planName
);
params
.
put
(
"pageNumber"
,
pageNumber
);
params
.
put
(
"pageSize"
,
pageSize
);
List
<
HashMap
<
String
,
Object
>>
result
=
planOperationRecordMapper
.
PlanOperationRecordListByPage
(
params
);
Integer
count
=
planOperationRecordMapper
.
PlanOperationRecordListByCount
(
params
);
Page
page
=
new
Page
();
page
.
setRecords
(
result
);
page
.
setTotal
(
count
);
page
.
setSize
(
pageSize
);
page
.
setPages
(
pageNumber
);
return
page
;
}
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java
View file @
494b5d5a
...
@@ -12,6 +12,7 @@ import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
...
@@ -12,6 +12,7 @@ import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
...
@@ -41,7 +42,6 @@ import org.springframework.util.CollectionUtils;
...
@@ -41,7 +42,6 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -118,7 +118,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -118,7 +118,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
private
String
serviceName
;
@Autowired
private
IPlanOperationRecordDao
planOperationRecordDao
;
@Override
@Override
public
void
handlerMqttMessage
(
String
topic
,
String
data
)
{
public
void
handlerMqttMessage
(
String
topic
,
String
data
)
{
...
@@ -137,7 +138,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -137,7 +138,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
if
(
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
if
(
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
log
.
info
(
"(报警)Message type is: "
+
equipmentSpecificIndex
.
getType
());
log
.
info
(
"(报警)Message type is: "
+
equipmentSpecificIndex
.
getType
());
// 报警触发调用规则服务
// 报警触发调用规则服务
executeDynamicPlan
(
deviceData
,
equipment
,
equipmentSpecific
,
toke
);
executeDynamicPlan
(
deviceData
,
equipment
,
equipmentSpecific
,
toke
,
topicEntity
.
getRecordId
()
);
}
else
if
(
EquipmentRiskTypeEnum
.
GZ
.
getCode
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
}
else
if
(
EquipmentRiskTypeEnum
.
GZ
.
getCode
().
equals
(
equipmentSpecificIndex
.
getType
()))
{
// 设备故障处理逻辑
// 设备故障处理逻辑
log
.
info
(
"(故障)Message type is: "
+
equipmentSpecificIndex
.
getType
());
log
.
info
(
"(故障)Message type is: "
+
equipmentSpecificIndex
.
getType
());
...
@@ -268,18 +269,18 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -268,18 +269,18 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
* @Date 2020/11/11 20:46
* @Date 2020/11/11 20:46
*/
*/
@Async
@Async
void
executeDynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Toke
toke
)
{
void
executeDynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Toke
toke
,
String
recordId
)
{
String
batchNo
=
UUID
.
randomUUID
().
toString
();
String
batchNo
=
UUID
.
randomUUID
().
toString
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
try
{
alarmContingency
(
batchNo
,
equipmentSpecific
,
equipment
);
alarmContingency
(
batchNo
,
equipmentSpecific
,
equipment
,
recordId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
public
void
alarmContingency
(
String
batchNo
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Equipment
equipment
)
throws
Exception
{
public
void
alarmContingency
(
String
batchNo
,
EquipmentSpecificForRiskVo
equipmentSpecific
,
Equipment
equipment
,
String
recordId
)
throws
Exception
{
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
ContingencyRo
contingencyRo
=
new
ContingencyRo
();
ContingencyRo
contingencyRo
=
new
ContingencyRo
();
contingencyRo
.
setBatchNo
(
batchNo
);
contingencyRo
.
setBatchNo
(
batchNo
);
...
@@ -349,5 +350,14 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -349,5 +350,14 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
iContingencyOriginalDataDao
.
save
(
contingencyOriginalData
);
iContingencyOriginalDataDao
.
save
(
contingencyOriginalData
);
//更新预案执行记录表的批次号
Optional
<
PlanOperationRecord
>
opt
=
planOperationRecordDao
.
findById
(
Long
.
valueOf
(
recordId
));
PlanOperationRecord
planOperationRecord
=
null
;
if
(
opt
.
get
()!=
null
){
planOperationRecord
=
opt
.
get
();
planOperationRecord
.
setBatchNo
(
contingencyOriginalData
.
getBatchNo
());
planOperationRecordDao
.
save
(
opt
.
get
());
}
}
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
494b5d5a
...
@@ -950,7 +950,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -950,7 +950,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
@Override
@Transactional
@Transactional
public
ReserveEnum
startEquipReserve
(
Long
id
,
String
typeCode
)
{
public
ReserveEnum
startEquipReserve
(
Long
id
,
String
typeCode
,
Long
recordId
)
{
int
count
=
equipmentService
.
countByStatus
(
NumberEnum
.
ONE
.
getValue
());
int
count
=
equipmentService
.
countByStatus
(
NumberEnum
.
ONE
.
getValue
());
...
@@ -965,6 +965,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -965,6 +965,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
topicEntity
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpecificIndexVo
));
topicEntity
.
setMessage
(
JSON
.
toJSONString
(
equipmentSpecificIndexVo
));
if
(
recordId
!=
null
){
topicEntity
.
setRecordId
(
Long
.
valueOf
(
recordId
).
toString
());
}
String
data
=
JSON
.
toJSONString
(
topicEntity
);
String
data
=
JSON
.
toJSONString
(
topicEntity
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/ContingencyPlanService.java
View file @
494b5d5a
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
/**
/**
...
@@ -10,4 +11,8 @@ import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
...
@@ -10,4 +11,8 @@ import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
public
interface
ContingencyPlanService
{
public
interface
ContingencyPlanService
{
String
planStart
(
ContingencyPlanParamVo
vo
);
String
planStart
(
ContingencyPlanParamVo
vo
);
ContingencyPlanParamVo
equipmentScene
(
Long
equipmentId
);
Page
recordListByPage
(
String
planName
,
int
pageNumber
,
int
pageSize
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IRiskSourceService.java
View file @
494b5d5a
...
@@ -29,7 +29,7 @@ public interface IRiskSourceService {
...
@@ -29,7 +29,7 @@ public interface IRiskSourceService {
* 新增及维护风险点
* 新增及维护风险点
*/
*/
RiskSource
editRiskSource
(
HashMap
<
String
,
Object
>
map
)
throws
Exception
;
RiskSource
editRiskSource
(
HashMap
<
String
,
Object
>
map
)
throws
Exception
;
/**
/**
* 风险模型新增及维护时远程同步
* 风险模型新增及维护时远程同步
*
*
...
@@ -48,7 +48,7 @@ public interface IRiskSourceService {
...
@@ -48,7 +48,7 @@ public interface IRiskSourceService {
*/
*/
// String saveToEquipManage(String appKey, String product, String token, String success, long id,
// String saveToEquipManage(String appKey, String product, String token, String success, long id,
// String code, String name, Long parentId);
// String code, String name, Long parentId);
/**
/**
* 将本地 风险模型推送到远程同步
* 将本地 风险模型推送到远程同步
*
*
...
@@ -65,8 +65,8 @@ public interface IRiskSourceService {
...
@@ -65,8 +65,8 @@ public interface IRiskSourceService {
// String synToEquipManage(String appKey, String product, String token, String success, List<RiskSourceTreeResponse> riskSourcesTree);
// String synToEquipManage(String appKey, String product, String token, String success, List<RiskSourceTreeResponse> riskSourcesTree);
/**
/**
*
*
* 是否同步到对站系统
* 是否同步到对站系统
*
*
* @return boolean
* @return boolean
* @throws <br>
* @throws <br>
...
@@ -185,10 +185,10 @@ public interface IRiskSourceService {
...
@@ -185,10 +185,10 @@ public interface IRiskSourceService {
void
notifyFmeaFromDelete
(
Long
handId
,
String
from
);
void
notifyFmeaFromDelete
(
Long
handId
,
String
from
);
void
notifyRiskSourceDelete
(
Long
handId
);
void
notifyRiskSourceDelete
(
Long
handId
);
/**
/**
*
*
* 不做任何不能删校验,直接删除,慎用
* 不做任何不能删校验,直接删除,慎用
*
*
* @param id void
* @param id void
* @throws <br>
* @throws <br>
...
@@ -212,6 +212,6 @@ public interface IRiskSourceService {
...
@@ -212,6 +212,6 @@ public interface IRiskSourceService {
* @return Boolean
* @return Boolean
*/
*/
Boolean
removeBind
(
Long
instanceId
);
Boolean
removeBind
(
Long
instanceId
);
ReserveEnum
startEquipReserve
(
Long
id
,
String
typeCode
);
ReserveEnum
startEquipReserve
(
Long
id
,
String
typeCode
,
Long
recordId
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/TopicEntityVo.java
View file @
494b5d5a
...
@@ -22,4 +22,6 @@ public class TopicEntityVo {
...
@@ -22,4 +22,6 @@ public class TopicEntityVo {
private
String
message
;
private
String
message
;
private
String
type
;
private
String
type
;
private
String
recordId
;
}
}
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/PlanOperationRecordMapper.xml
View file @
494b5d5a
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper"
>
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper"
>
<select
id=
"PlanOperationRecordListByPage"
parameterType=
"hashmap"
resultType=
"java.util.HashMap"
>
SELECT
record.batch_No AS batchNo,
detail.plan_name AS planName,
original.fire_Equipment_Name AS fireEquipmentName,
record.start_time AS startTime,
TIMESTAMPDIFF(second,record.start_time,record.end_time) as executionTime,
record.plan_pattern as planPattern,
'' AS executionType
FROM
`c_plan_operation_record` record
LEFT JOIN c_plan_detail detail ON detail.id = record.plan_id
LEFT JOIN contingency_original_data original ON original.batch_no = record.batch_no
<where>
<if
test=
"planName !=null and planName != ''"
>
( detail.plan_name like concat(concat("%",#{planName}),"%"))
</if>
</where>
limit #{pageNumber} * #{pageSize},
</select>
<select
id=
"PlanOperationRecordListByCount"
parameterType=
"hashmap"
resultType=
"java.lang.Integer"
>
SELECT
record.batch_No AS batchNo,
detail.plan_name AS planName,
original.fire_Equipment_Name AS fireEquipmentName,
record.start_time AS startTime,
TIMESTAMPDIFF(second,record.start_time,record.end_time) as executionTime,
record.plan_pattern as planPattern,
'' AS executionType
FROM
`c_plan_operation_record` record
LEFT JOIN c_plan_detail detail ON detail.id = record.plan_id
LEFT JOIN contingency_original_data original ON original.batch_no = record.batch_no
<where>
<if
test=
"planName !=null and planName != ''"
>
( detail.plan_name like concat(concat("%",#{planName}),"%"))
</if>
</where>
limit #{pageNumber} * #{pageSize},
</select>
</mapper>
</mapper>
\ 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