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
636f3615
Commit
636f3615
authored
Aug 26, 2020
by
高东东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)预案修改
parent
3d1733d8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
328 additions
and
38 deletions
+328
-38
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+207
-6
DeviceRo.java
.../com/yeejoin/amos/fas/business/action/model/DeviceRo.java
+24
-0
SetpEnum.java
.../com/yeejoin/amos/fas/business/action/model/SetpEnum.java
+11
-11
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+3
-2
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+69
-7
PermissionAspect.java
...in/java/com/yeejoin/amos/fas/config/PermissionAspect.java
+12
-10
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+1
-1
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+1
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
636f3615
...
...
@@ -12,14 +12,18 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
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.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -28,6 +32,7 @@ import com.yeejoin.amos.component.rule.MethodParam;
import
com.yeejoin.amos.component.rule.RuleActionBean
;
import
com.yeejoin.amos.component.rule.RuleMethod
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.model.DeviceRo
;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
...
...
@@ -35,13 +40,17 @@ 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.util.StepComparator
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
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.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.HttpUtil
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
@Component
...
...
@@ -78,10 +87,15 @@ public class ContingencyAction implements CustomerAction {
@Autowired
private
IDutyModeServer
dutyModeServer
;
@Autowired
private
RedisTemplate
redisTemplate
;
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
private
static
Map
<
String
,
Map
<
String
,
String
>>
stringStringMap
=
new
HashMap
<>();
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
public
static
ConcurrentHashMap
<
String
,
Map
<
String
,
Object
>>
pointCache
=
new
ConcurrentHashMap
<>();
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
...
...
@@ -186,26 +200,65 @@ public class ContingencyAction implements CustomerAction {
ArrayList
list
=
new
ArrayList
();
HashMap
preStep
=
new
HashMap
();
StepComparator
comparator
=
new
StepComparator
();
Arrays
.
sort
(
stepArr
,
comparator
);
boolean
flage
=
false
;
SetpEnum
pstep
=
null
;
for
(
SetpEnum
step
:
stepArr
)
{
if
(
Long
.
valueOf
(
step
.
getValue
())
>=
Long
.
valueOf
(
stepCode
))
{
if
(
Long
.
valueOf
(
step
.
getValue
())
==
Long
.
valueOf
(
stepCode
))
{
if
(!
ObjectUtils
.
isEmpty
(
pstep
))
{
preStep
.
put
(
"stepCode"
,
pstep
.
getValue
());
preStep
.
put
(
"stepName"
,
pstep
.
getTitle
());
}
flage
=
true
;
}
if
(
flage
)
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"stepCode"
,
step
.
getValue
());
map
.
put
(
"stepName"
,
step
.
getTitle
());
list
.
add
(
map
);
}
else
if
(
Long
.
valueOf
(
step
.
getValue
())
==
Long
.
valueOf
(
stepCode
)
-
1
)
{
preStep
.
put
(
"stepCode"
,
step
.
getValue
());
preStep
.
put
(
"stepName"
,
step
.
getTitle
());
}
pstep
=
step
;
}
tempmap1
.
put
(
"step"
,
list
);
tempmap1
.
put
(
"preStep"
,
preStep
);
result
.
add
(
tempmap1
);
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
result
));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
// public static void main(String[] args) {
// SetpEnum[] stepArr = SetpEnum.values();
// Map<String, Object> tempmap1 = new HashMap<>();
// ArrayList list = new ArrayList();
// HashMap preStep = new HashMap();
// StepComparator comparator = new StepComparator();
// Arrays.sort(stepArr, comparator);
// boolean flage = false;
// SetpEnum pstep = null;
// for (SetpEnum step : stepArr) {
// if (Long.valueOf(step.getValue()) == Long.valueOf("3")) {
// if (!ObjectUtils.isEmpty(pstep)) {
// preStep.put("stepCode", pstep.getValue());
// preStep.put("stepName", pstep.getTitle());
// }
// flage = true;
// }
// if (flage) {
// HashMap map = new HashMap();
// map.put("stepCode", step.getValue());
// map.put("stepName", step.getTitle());
// list.add(map);
// }
// pstep = step;
// }
//
// tempmap1.put("step", list);
// tempmap1.put("preStep", preStep);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(tempmap1));
// }
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
...
...
@@ -533,7 +586,155 @@ public class ContingencyAction implements CustomerAction {
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
/**
* 启动预案
*
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"启动预案"
,
project
=
"青海换流站消防预案"
)
public
void
startPlan
(
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"type"
,
"event"
);
tempmap1
.
put
(
"content"
,
"startPlan"
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
opsForValue
().
set
(
"contingencyRo"
,
contingencyRo
);
}
/**
* 启动预案
*
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"结束预案"
,
project
=
"青海换流站消防预案"
)
public
void
stopPlan
(
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"type"
,
"event"
);
tempmap1
.
put
(
"content"
,
"stopPlan"
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
delete
(
"contingencyRo"
);
}
private
static
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
private
static
final
String
TOKE
=
"TOKE"
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"青海换流站消防预案"
)
public
void
autoExecute
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
if
(
toke
==
null
)
{
toke
=
remoteSecurityService
.
come
();
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
}
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
iContingencyInstance
.
setButtonExecuted
(
contingencyRo
.
getBatchNo
(),
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
);
iContingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
,
stepState
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@RuleMethod
(
methodLabel
=
"添加步骤执行"
,
project
=
"青海换流站消防预案"
)
public
void
addExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
result
.
add
(
tempmap1
);
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
if
(
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
equipemtnPoints
=
new
HashMap
<>();
}
equipemtnPoints
.
put
(
stepCode
+
"-"
+
buttonCode
,
content
);
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
this
.
sendcmd
(
"message"
,
null
,
result
);
}
@RuleMethod
(
methodLabel
=
"清除步骤执行"
,
project
=
"青海换流站消防预案"
)
public
void
clearExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
equipemtnPoints
.
remove
(
stepCode
+
"-"
+
buttonCode
);
}
tempmap1
.
put
(
"type"
,
"buttonCache"
);
if
(!
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
}
else
{
tempmap1
.
put
(
"content"
,
new
ArrayList
());
}
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
@RuleMethod
(
methodLabel
=
"同步自动执行步骤"
,
project
=
"青海换流站消防预案"
)
public
void
sendExecute
(
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
contingencyRo
.
getEquipmentId
());
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
private
void
stopSnapshop
(
ContingencyRo
contingencyRo
)
{
if
(
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
()
!=
null
&&
!
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
().
equals
(
contingencyRo
.
getBatchNo
()))
RuleRunigSnapshotServiceImpl
.
setReplayBatchNoToNull
();
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/DeviceRo.java
0 → 100644
View file @
636f3615
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
.
model
;
import
java.io.Serializable
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
import
lombok.Data
;
@RuleFact
(
value
=
"设备数据"
,
project
=
"青海换流站消防预案"
)
@Data
public
class
DeviceRo
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
299646964348882067L
;
@Label
(
"点编码"
)
private
String
pointCode
;
@Label
(
"值"
)
private
String
value
;
@Label
(
"重点装备ID"
)
private
Long
equipmentId
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/SetpEnum.java
View file @
636f3615
...
...
@@ -8,17 +8,17 @@ public enum SetpEnum implements RuleConstants{
STEP1
(
"1"
,
"停运换流阀、拨打报警电话"
,
1
),
STEP2
(
"2"
,
"开启水喷雾系统"
,
2
),
STEP3
(
"3"
,
"断开上级电源"
,
3
),
STEP4
(
"
10
"
,
"开启油枕排油系统"
,
4
),
STEP5
(
"
11
"
,
"消防炮“一键启动”"
,
5
),
STEP6
(
"12
"
,
"消防供水"
,
6
),
STEP7
(
"
13
"
,
"阀厅防护"
,
7
),
STEP8
(
"
14
"
,
"本体排油"
,
8
),
STEP9
(
"
4
"
,
"停运空调和水冷系统"
,
9
),
STEP10
(
"
5
"
,
"驻站消防指挥权准备交接"
,
10
),
STEP11
(
"
6
"
,
"驻站消防指挥权交接"
,
11
),
STEP12
(
"
7
"
,
"电缆沟封堵"
,
12
),
STEP13
(
"
8
"
,
"灭火指挥权交接"
,
13
),
STEP14
(
"
9
"
,
"应急处置结束"
,
14
);
STEP4
(
"
4
"
,
"开启油枕排油系统"
,
4
),
STEP5
(
"
5
"
,
"消防炮“一键启动”"
,
5
),
// STEP6("6
", "消防供水", 6),
STEP7
(
"
7
"
,
"阀厅防护"
,
7
),
STEP8
(
"
8
"
,
"本体排油"
,
8
),
STEP9
(
"
9
"
,
"停运空调和水冷系统"
,
9
),
STEP10
(
"
10
"
,
"驻站消防指挥权准备交接"
,
10
),
STEP11
(
"
11
"
,
"驻站消防指挥权交接"
,
11
),
STEP12
(
"
12
"
,
"电缆沟封堵"
,
12
),
STEP13
(
"
13
"
,
"灭火指挥权交接"
,
13
),
STEP14
(
"
14
"
,
"应急处置结束"
,
14
);
private
String
stepCode
;
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
636f3615
...
...
@@ -170,8 +170,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
SetpEnum
step
=
SetpEnum
.
getStepByCode
(
stepCode
);
contingencyRo
.
setStep
(
step
.
getValue
());
contingencyRo
.
setStepState
(
stepMap
.
get
(
stepKey
));
// contingencyRo.setStep(stepCode);
log
.
info
(
"stepstate:"
+
contingencyRo
.
getStepState
());
log
.
info
(
"stepCode:"
+
stepCode
);
Equipment
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
Long
.
parseLong
(
contingencyRo
.
getFireEquipmentId
()));
// 获取重点设备胚胎指标
// 获取遥信指标
...
...
@@ -189,7 +190,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
}
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
ruleTrigger
.
publish
(
contingencyRo
,
"青海换流站消防预案/test"
,
ArrayUtils
.
toArray
(
"极Ⅰ高端YY换流变B相"
));
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()
));
// 刷新记录区
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
636f3615
...
...
@@ -26,6 +26,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
...
...
@@ -49,10 +50,12 @@ import com.google.common.collect.Sets;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.fas.business.action.model.CheckInputItemRo
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.model.DeviceRo
;
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.RiskSourceRuleRo
;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgContentBo
;
...
...
@@ -516,6 +519,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public
void
alermContingency
(
String
batchNo
,
FireEquipment
fireEquipment
,
Equipment
equipment
)
throws
Exception
{
Object
oldContingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
ContingencyRo
contingencyRo
=
new
ContingencyRo
();
contingencyRo
.
setBatchNo
(
batchNo
);
contingencyRo
.
setEquipmentId
(
String
.
valueOf
(
equipment
.
getId
()));
...
...
@@ -523,8 +527,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo
.
setFireEquipmentId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
contingencyRo
.
setFireEquipmentName
(
fireEquipment
.
getName
());
// if (ObjectUtils.isEmpty(oldContingencyRo)) {
// contingencyRo.setStep(SetpEnum.STEP0.getValue());
// } else {
// contingencyRo.setStep(((ContingencyRo)oldContingencyRo).getStep());
// }
contingencyRo
.
setStep
(
SetpEnum
.
STEP0
.
getValue
());
//contingencyRo.setNodeState(deviceData.getNodeState());
contingencyRo
.
setConfirm
(
"NONE"
);
contingencyRo
.
setFireTruckRoute
(
equipment
.
getFireTruckRoute
());
contingencyRo
.
setRunstep
(
false
);
...
...
@@ -557,12 +566,27 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
}
log
.
debug
(
"开始调用规则"
);
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(), equipment.getName());
// 获取遥信指标
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
HashMap
<
String
,
Integer
>
telesignallingMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
telesignallingMap
.
put
(
map
.
get
(
"code"
)
+
""
,
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
||
"false"
.
equals
(
map
.
get
(
"value"
).
toString
()))
?
0
:
1
);
}
contingencyRo
.
setTelesignallingMap
(
telesignallingMap
);
// 获取遥测指标
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"ANALOGUE"
);
HashMap
<
String
,
Double
>
telemetryMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
telemetryMap
.
put
(
map
.
get
(
"code"
)
+
""
,
Double
.
valueOf
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"value"
))
?
"0"
:
map
.
get
(
"value"
).
toString
()));
}
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
log
.
debug
(
"开始调用规则"
);
Object
result
=
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
// Object result = ruleTrigger.publish(contingencyRo, "青海换流站消防预案/预案执行", ArrayUtils.toArray("极Ⅰ高端YY换流变B相"));
log
.
debug
(
"规则调用返回=="
,
result
);
ContingencyOriginalData
contingencyOriginalData
=
new
ContingencyOriginalData
();
BeanUtils
.
copyProperties
(
contingencyRo
,
contingencyOriginalData
);
iContingencyOriginalDataDao
.
save
(
contingencyOriginalData
);
...
...
@@ -821,12 +845,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
);
// 根据监测点设备信息获取保护的重点装备
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
DeviceRo
deviceRo
=
new
DeviceRo
();
deviceRo
.
setEquipmentId
(
equipment
.
getId
());
deviceRo
.
setPointCode
(
deviceData
.
getPointCode
());
deviceRo
.
setValue
(
deviceData
.
getState
());
triggerPlanDevice
(
deviceRo
,
equipment
,
toke
);
// Boolean have = equipmentGroupedPointDao.existsByEqpPointIdAndEquipId(fireEquipmentPoint.getId(), equipment.getId());
Boolean
have
=
impAndFireEquipMapper
.
existsAlarmPointByEqpPointIdAndEquipId
(
fireEquipmentPoint
.
getId
(),
equipment
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
have
)
&&
have
)
{
//动态预案执行
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
}
}
}
...
...
@@ -840,7 +872,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
*/
@Async
void
dynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
FireEquipment
fireEquipment
,
Toke
toke
)
{
String
batchNo
=
UUID
.
randomUUID
().
toString
();
Object
contingencyRo
=
redisTemplate
.
opsForValue
().
get
(
"contingencyRo"
);
String
batchNo
=
null
;
// if (!ObjectUtils.isEmpty(contingencyRo)) {
// batchNo = ((ContingencyRo)contingencyRo).getBatchNo();
// } else {
// batchNo = UUID.randomUUID().toString();
// }
batchNo
=
UUID
.
randomUUID
().
toString
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
...
...
@@ -849,6 +888,17 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
e
.
printStackTrace
();
}
}
@Async
public
void
triggerPlanDevice
(
DeviceRo
deviceRo
,
Equipment
equipment
,
Toke
toke
)
{
try
{
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
Object
result1
=
ruleTrigger
.
publish
(
deviceRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
@javax
.
transaction
.
Transactional
...
...
@@ -919,6 +969,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
iDataRefreshService
.
sendRefreshDataWithArea
(
View3dRefreshAreaEum
.
monitor_data
.
getCode
(),
content
);
}
}
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"telesignaling"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
deviceData
));
List
<
AlarmParam
>
list
=
new
ArrayList
<>();
list
.
add
(
deviceData
);
//保存所有数据(遥测,遥信)到mongo
...
...
@@ -1008,12 +1061,21 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fmeaIds
.
forEach
(
fmeaId
->
rsDataQueue
.
addEquipmentMessage
(
fmeaId
,
monitor
,
st
));
}
}
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@Async
public
void
sendAnalogue
(
EquipCommunicationData
data
)
{
try
{
redisTemplate
.
opsForHash
().
put
(
"Analogue"
,
data
.
getPointCode
(),
data
);
remoteWebSocketServer
.
sendMessage
(
"plan"
,
JSON
.
toJSONString
(
data
));
// remoteWebSocketServer.sendMessage("plan", JSON.toJSONString(data));
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"analogue"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
data
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/PermissionAspect.java
View file @
636f3615
...
...
@@ -9,6 +9,7 @@ import org.aspectj.lang.annotation.Before;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -31,15 +32,16 @@ public class PermissionAspect {
logger
.
info
(
"======开始权限校验======"
);
// 用户token
String
token
=
(
String
)
request
.
getHeader
(
"token"
);
String
product
=
(
String
)
request
.
getHeader
(
"product"
);
String
appKey
=
(
String
)
request
.
getHeader
(
"appKey"
);
logger
.
info
(
"用户token:"
+
token
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
if
(!
TokenOperation
.
refresh
(
token
))
{
throw
new
PermissionException
(
"登录信息失效,请重新登录"
);
}
String
token
=
(
String
)
request
.
getHeader
(
"token"
);
token
=
ObjectUtils
.
isEmpty
(
token
)
?
(
String
)
request
.
getHeader
(
"X-Access-Token"
)
:
token
;
String
product
=
(
String
)
request
.
getHeader
(
"product"
);
String
appKey
=
(
String
)
request
.
getHeader
(
"appKey"
);
logger
.
info
(
"用户token:"
+
token
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
if
(!
TokenOperation
.
refresh
(
token
))
{
throw
new
PermissionException
(
"登录信息失效,请重新登录"
);
}
}
}
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
636f3615
...
...
@@ -15,7 +15,7 @@ eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry
=
true
eureka.instance.prefer-ip-address
=
true
#DB properties:
spring.datasource.url
=
jdbc:mysql://172.16.11.33:3306/
safety-business-2.0.37
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://172.16.11.33:3306/
v2.0_zmd_yeejoin_safety_business
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username
=
root
spring.datasource.password
=
admin_1234
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
...
...
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
636f3615
spring.application.name
=
Amos-autosys
-gdd
spring.application.name
=
Amos-autosys
server.port
=
8083
...
...
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