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
97182136
Commit
97182136
authored
Aug 21, 2020
by
高东东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全预控调整
parent
0028af03
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
411 additions
and
260 deletions
+411
-260
Node3DVoResponse.java
...ejoin/amos/fas/core/common/response/Node3DVoResponse.java
+15
-0
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+12
-5
RiskSituationAction.java
...yeejoin/amos/fas/business/action/RiskSituationAction.java
+10
-12
SimpleTipAction.java
...com/yeejoin/amos/fas/business/action/SimpleTipAction.java
+6
-5
ContingencyRo.java
...yeejoin/amos/fas/business/action/model/ContingencyRo.java
+8
-1
SetpEnum.java
.../com/yeejoin/amos/fas/business/action/model/SetpEnum.java
+29
-15
SimpleResult.java
...yeejoin/amos/fas/business/action/result/SimpleResult.java
+4
-2
StepComparator.java
...yeejoin/amos/fas/business/action/util/StepComparator.java
+14
-0
RiskSourceController.java
...in/amos/fas/business/controller/RiskSourceController.java
+0
-1
TimeLineController.java
...join/amos/fas/business/controller/TimeLineController.java
+0
-6
FireEquipPointMapper.java
...in/amos/fas/business/dao/mapper/FireEquipPointMapper.java
+3
-0
ImpAndFireEquipMapper.java
...n/amos/fas/business/dao/mapper/ImpAndFireEquipMapper.java
+3
-0
AlarmParam.java
.../java/com/yeejoin/amos/fas/business/param/AlarmParam.java
+6
-0
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+47
-21
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+177
-157
CacheMap.java
...ain/java/com/yeejoin/amos/fas/business/util/CacheMap.java
+29
-27
Toke.java
.../src/main/java/com/yeejoin/amos/fas/business/vo/Toke.java
+5
-0
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+10
-7
dbTemplate_fire_equippoint.xml
...c/main/resources/db/mapper/dbTemplate_fire_equippoint.xml
+10
-0
dbTemplate_impAndfire_equip.xml
.../main/resources/db/mapper/dbTemplate_impAndfire_equip.xml
+15
-0
dbTemplate_view3d.xml
...sStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
+7
-0
pom.xml
pom.xml
+1
-1
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/core/common/response/Node3DVoResponse.java
View file @
97182136
...
...
@@ -116,6 +116,8 @@ public class Node3DVoResponse{
private
String
orgCode
;
private
String
code
;
public
String
getId
()
{
return
id
;
...
...
@@ -382,6 +384,18 @@ public class Node3DVoResponse{
public
void
setScale
(
CoordDTO
scale
)
{
this
.
scale
=
scale
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
97182136
...
...
@@ -7,6 +7,7 @@ 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
;
...
...
@@ -32,6 +33,7 @@ import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
import
com.yeejoin.amos.fas.business.action.result.SafteyPlanResult
;
import
com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage
;
import
com.yeejoin.amos.fas.business.action.util.StepComparator
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl
;
import
com.yeejoin.amos.fas.business.service.intfc.FireStengthService
;
...
...
@@ -140,7 +142,9 @@ public class ContingencyAction implements CustomerAction {
public
void
sendcmd
(
String
msgType
,
Object
contingency
,
SafteyPlanResult
result
)
{
ContingencyRo
ro
=
(
ContingencyRo
)
contingency
;
ro
.
setTelemetryMap
(
null
);
ro
.
setTelesignallingMap
(
null
);
Constructor
<?>
constructor
;
try
{
constructor
=
Class
.
forName
(
...
...
@@ -149,7 +153,8 @@ public class ContingencyAction implements CustomerAction {
AbstractActionResultMessage
<?>
action
=
(
AbstractActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
if
(
"mqtt"
.
equals
(
pushType
.
toLowerCase
()))
{
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
contingency
,
result
.
toJson
());
String
topic
=
String
.
format
(
"/%s/%s"
,
serviceName
,
"rule"
);
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"plan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
}
else
if
(
"websocket"
.
equals
(
pushType
.
toLowerCase
())){
action
.
execute
(
msgType
,
contingency
);
...
...
@@ -180,7 +185,7 @@ public class ContingencyAction implements CustomerAction {
SetpEnum
[]
stepArr
=
SetpEnum
.
values
();
ArrayList
list
=
new
ArrayList
();
HashMap
preStep
=
new
HashMap
();
StepComparator
comparator
=
new
StepComparator
();
for
(
SetpEnum
step
:
stepArr
)
{
if
(
Long
.
valueOf
(
step
.
getValue
())
>=
Long
.
valueOf
(
stepCode
))
{
HashMap
map
=
new
HashMap
();
...
...
@@ -230,11 +235,12 @@ public class ContingencyAction implements CustomerAction {
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"YYYY/MM/DD HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isEmpty
(
list
))
{
if
(
!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf
.
format
(
action
.
getCreateDate
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
}
tempmap1
.
put
(
"content"
,
records
);
...
...
@@ -437,11 +443,12 @@ public class ContingencyAction implements CustomerAction {
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"YYYY/MM/DD HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isEmpty
(
list
))
{
if
(
!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf
.
format
(
action
.
getCreateDate
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
}
tempmap1
.
put
(
"content"
,
records
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/RiskSituationAction.java
View file @
97182136
...
...
@@ -38,7 +38,9 @@ public class RiskSituationAction implements CustomerAction
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@RuleMethod
(
methodLabel
=
"气泡提示"
,
project
=
"青海换流站消防预案"
)
public
void
sendBubbleTip
(
@MethodParam
(
paramLabel
=
"bizobj对象"
)
Object
bizobj
,
@MethodParam
(
paramLabel
=
"是否显示名称"
)
Boolean
showInfo
,
...
...
@@ -64,13 +66,13 @@ public class RiskSituationAction implements CustomerAction
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
AbstractActionResultMessage
<?>
action
=
(
AbstractActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
String
msgType
=
"
message
"
;
String
msgType
=
"
bubbleTip
"
;
if
(
"mqtt"
.
equals
(
pushType
.
toLowerCase
()))
{
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
bizobj
,
result
);
webMqttComponent
.
publish
(
""
,
toipResponse
.
toJsonStr
());
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"rule"
);
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
}
else
{
Object
obj
=
action
.
execute
(
msgType
,
null
);
Object
obj
=
action
.
execute
(
msgType
,
bizobj
);
}
}
catch
(
Exception
e
)
...
...
@@ -98,13 +100,12 @@ public class RiskSituationAction implements CustomerAction
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
AbstractActionResultMessage
<?>
action
=
(
AbstractActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
String
msgType
=
"
message
"
;
String
msgType
=
"
changeColor
"
;
if
(
"mqtt"
.
equals
(
pushType
.
toLowerCase
()))
{
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
bizobj
,
result
);
webMqttComponent
.
publish
(
""
,
toipResponse
.
toJsonStr
());
}
else
{
Object
obj
=
action
.
execute
(
msgType
,
null
);
action
.
execute
(
msgType
,
bizobj
);
}
}
catch
(
Exception
e
)
...
...
@@ -139,11 +140,8 @@ public class RiskSituationAction implements CustomerAction
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
bizobj
,
result
);
webMqttComponent
.
publish
(
""
,
toipResponse
.
toJsonStr
());
}
else
{
Object
obj
=
action
.
execute
(
msgType
,
null
);
action
.
execute
(
msgType
,
null
);
}
}
catch
(
Exception
e
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/SimpleTipAction.java
View file @
97182136
...
...
@@ -49,7 +49,9 @@ public class SimpleTipAction implements CustomerAction
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
//@ExposeAction("消息提示")
public
void
sendMessageTip
(
Object
bizobj
,
String
title
,
String
content
,
String
type
)
{
...
...
@@ -75,12 +77,11 @@ public class SimpleTipAction implements CustomerAction
String
msgType
=
"message"
;
if
(
"mqtt"
.
equals
(
pushType
.
toLowerCase
()))
{
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
bizobj
,
result
);
webMqttComponent
.
publish
(
""
,
toipResponse
.
toJsonStr
());
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
"yinan"
,
"rule"
);
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
}
else
{
Object
obj
=
action
.
execute
(
msgType
,
null
);
action
.
execute
(
msgType
,
bizobj
);
}
// saveMessageAction(result,type);
}
catch
(
Exception
e
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/ContingencyRo.java
View file @
97182136
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.action.model;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashMap
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
...
...
@@ -16,7 +17,7 @@ public class ContingencyRo implements Serializable {
/**
*
*/
private
static
final
long
serialVersionUID
=
49797517302816004
L
;
private
static
final
long
serialVersionUID
=
1863437780244849215
L
;
@Label
(
"消防设备名称"
)
private
String
fireEquipmentName
;
//消防设备名称
@Label
(
"消防设备id"
)
...
...
@@ -72,4 +73,10 @@ public class ContingencyRo implements Serializable {
private
String
stepState
;
//步骤操作状态
private
Date
createDate
=
new
Date
();
@Label
(
"遥测数据"
)
private
HashMap
<
String
,
Double
>
telemetryMap
;
@Label
(
"遥信数据"
)
private
HashMap
<
String
,
Integer
>
telesignallingMap
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/SetpEnum.java
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
.
model
;
import
com.yeejoin.amos.component.rule.Constants
;
import
com.yeejoin.amos.component.rule.model.RuleConstants
;
//@Constants(value = SetpEnum.class)
public
enum
SetpEnum
implements
RuleConstants
{
STEP0
(
"0"
,
""
),
STEP1
(
"1"
,
"停运换流阀、拨打报警电话"
),
STEP2
(
"2"
,
"开启水喷雾系统"
),
STEP3
(
"3"
,
"断开上级电源"
),
STEP4
(
"4"
,
"停运空调和水冷系统"
),
STEP5
(
"5"
,
"驻站消防指挥权准备交接"
),
STEP6
(
"6"
,
"驻站消防指挥权交接"
),
STEP7
(
"7"
,
"电缆沟封堵"
),
STEP8
(
"8"
,
"灭火指挥权交接"
),
STEP9
(
"9"
,
"应急处置结束"
);
STEP0
(
"0"
,
"确认火灾"
,
0
),
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
);
private
String
stepCode
;
private
String
stepName
;
private
int
order
;
SetpEnum
(
String
stepCode
,
String
stepName
)
{
SetpEnum
(
String
stepCode
,
String
stepName
,
int
order
)
{
this
.
stepCode
=
stepCode
;
this
.
stepName
=
stepName
;
this
.
order
=
order
;
}
@Override
public
String
getValue
()
{
return
stepCode
;
}
...
...
@@ -34,9 +40,17 @@ public enum SetpEnum implements RuleConstants{
public
String
getTitle
()
{
return
stepName
;
}
public
int
getOrder
()
{
return
order
;
}
public
static
SetpEnum
getStepByCode
(
String
stepCode
)
{
return
SetpEnum
.
valueOf
(
stepCode
);
// return null;
for
(
SetpEnum
setp
:
SetpEnum
.
values
())
{
if
(
setp
.
stepCode
.
equals
(
stepCode
))
{
return
setp
;
}
}
return
null
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/result/SimpleResult.java
View file @
97182136
...
...
@@ -31,9 +31,11 @@ public class SimpleResult extends AbstractActionResult implements ActionResult
}
@Override
public
void
addAll
(
List
<
Object
>
data
)
public
void
addAll
(
List
<
Object
>
data
s
)
{
this
.
data
.
addAll
((
Collection
<?
extends
Map
<
String
,
Object
>>)
data
);
for
(
Object
o
:
datas
)
{
this
.
data
.
add
(
JSONUtil
.
toMap
(
JSONUtil
.
toJson
(
o
)));
}
}
@Override
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/util/StepComparator.java
0 → 100644
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
.
util
;
import
java.util.Comparator
;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
public
class
StepComparator
implements
Comparator
<
SetpEnum
>{
@Override
public
int
compare
(
SetpEnum
o1
,
SetpEnum
o2
)
{
//对日期字段进行升序,如果欲降序可采用before方法
if
(
o1
.
getOrder
()
>
o2
.
getOrder
())
return
1
;
return
-
1
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskSourceController.java
View file @
97182136
...
...
@@ -673,7 +673,6 @@ public class RiskSourceController extends BaseController {
* @return
*/
@Permission
//@Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"设置预案节点自动执行"
,
notes
=
"设置预案节点自动执行"
)
@RequestMapping
(
value
=
"/contingency/setup"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
queryRiskSourceSecondLevel
(
@RequestBody
ContingencyDeviceStatus
contingencyDeviceStatus
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/TimeLineController.java
View file @
97182136
...
...
@@ -109,12 +109,6 @@ public class TimeLineController extends BaseController{
}
@Permission
// @Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"查询预案记录"
,
notes
=
"查询预案记录"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/FireEquipPointMapper.java
View file @
97182136
...
...
@@ -53,4 +53,7 @@ public interface FireEquipPointMapper extends BaseMapper {
List
<
FireEquipmentPointEntity
>
listByCodes
(
@Param
(
"codes"
)
Set
<
String
>
codes
);
List
<
Map
>
getPointsByEquipmentIdAndType
(
@Param
(
"id"
)
long
id
,
@Param
(
"type"
)
String
type
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/ImpAndFireEquipMapper.java
View file @
97182136
...
...
@@ -33,4 +33,7 @@ public interface ImpAndFireEquipMapper extends BaseMapper {
List
<
Map
<
String
,
Object
>>
findEquipVideo
();
public
Boolean
existsAlarmPointByEqpPointIdAndEquipId
(
@Param
(
"pointId"
)
long
pointId
,
@Param
(
"equipmentId"
)
long
equipmentId
);
// Boolean containGroupedPoint(long id);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/param/AlarmParam.java
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
param
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.yeejoin.amos.fas.business.action.model.BasicsRo
;
public
class
AlarmParam
extends
BasicsRo
{
...
...
@@ -98,4 +100,8 @@ public class AlarmParam extends BasicsRo{
public
void
setOldState
(
String
oldState
)
{
this
.
oldState
=
oldState
;
}
public
String
toJsonStr
()
{
return
JSON
.
toJSONString
(
this
,
SerializerFeature
.
WriteMapNullValue
,
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
SkipTransientField
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -15,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.client.RestTemplate
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
...
...
@@ -23,6 +27,7 @@ import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
import
com.yeejoin.amos.fas.business.action.result.BubbleTipResult
;
import
com.yeejoin.amos.fas.business.action.result.SafteyPlanResult
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
...
...
@@ -56,10 +61,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
FireEquipPointMapper
fireEquipPointMapper
;
@Value
(
"${params.remoteRuleUrl}"
)
private
String
remoteRuleUrl
;
@Autowired
private
IContingencyInstance
iContingencyInstance
;
private
static
Map
<
String
,
String
>
stepMap
=
new
HashMap
<>();
...
...
@@ -90,7 +100,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
planInstance
.
setRecordType
(
recordType
);
planInstance
.
setCategory
(
category
);
planInstance
.
setBatchNo
(
instanceNo
);
planInstance
.
setCreateDate
(
new
Date
());
//计算序号
int
count
=
repository
.
countByBatchNo
(
instanceNo
);
planInstance
.
setSort
(++
count
);
...
...
@@ -113,13 +123,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
public
void
fire
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
)
throws
Exception
{
//火灾误报
ContingencyOriginalData
contingencyOriginalData
=
iContingencyOriginalDataDao
.
findByBatchNo
(
batchNo
);
if
(
"FIRE_CANCEL"
.
equals
(
buttonCode
)
||
"END_EMERGENCY"
.
equals
(
buttonCode
)){
redisTemplate
.
delete
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
());
}
else
{
redisTemplate
.
opsForValue
().
setIfAbsent
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
(),
"CONTINGENCYRUNING"
);
}
String
stepKey
=
batchNo
+
"_"
+
stepCode
;
if
(
stepMap
.
get
(
stepKey
)
==
null
)
stepMap
.
put
(
stepKey
,
""
);
...
...
@@ -143,7 +148,6 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
if
(
Integer
.
parseInt
(
stepCode
)
>
Integer
.
parseInt
(
contingencyOriginalData
.
getStep
()))
{
//contingencyOriginalData.setStep(stepCode);
contingencyOriginalData
.
setStepState
(
stepStateOnbutton
);
}
...
...
@@ -153,11 +157,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
contingencyOriginalData
.
getRunstep
(),
contingencyOriginalData
.
getStepState
(),
contingencyOriginalData
.
getBatchNo
());
// setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
//使用原始数据触发规则
if
(
"CONFIRM"
.
equals
(
buttonState
)
&&
!
stepMap
.
get
(
stepKey
).
contains
(
stepStateOnbutton
))
stepMap
.
put
(
stepKey
,
stepMap
.
get
(
stepKey
)
+
stepStateOnbutton
);
...
...
@@ -171,16 +172,42 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
contingencyRo
.
setStepState
(
stepMap
.
get
(
stepKey
));
log
.
info
(
"stepstate:"
+
contingencyRo
.
getStepState
());
Equipment
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
Long
.
parseLong
(
contingencyRo
.
getFireEquipmentId
()));
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
Equipment
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
Long
.
parseLong
(
contingencyRo
.
getFireEquipmentId
()));
// 获取重点设备胚胎指标
// 获取遥信指标
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
);
SafteyPlanResult
result1
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap2
=
new
HashMap
<>();
tempmap2
.
put
(
"refresh"
,
"refresh"
);
tempmap2
.
put
(
"batchNo"
,
batchNo
);
contingencyAction
.
sendcmd
(
"recordarea"
,
contingencyRo
,
result1
);
ruleTrigger
.
publish
(
contingencyRo
,
"青海换流站消防预案/test"
,
ArrayUtils
.
toArray
(
"极Ⅰ高端YY换流变B相"
));
// 刷新记录区
// SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/DD HH:mm:ss");
// List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
// SafteyPlanResult result1 = new SafteyPlanResult();
// Map<String, Object> tempmap2 = new HashMap<>();
// ArrayList records = new ArrayList<>();
// if (ObjectUtils.isEmpty(list)) {
// list.forEach(action -> {
// HashMap map = new HashMap();
// map.put("time", sdf.format(action.getCreateDate()));
// map.put("stepName", action.getContent());
// });
// }
// tempmap2.put("content", records);
// result1.add(tempmap2);
// contingencyAction.sendcmd("recordarea", contingencyRo, result1);
}
else
{
throw
new
Exception
(
"数据异常,请联系管理员."
);
}
...
...
@@ -255,7 +282,6 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
}
}
if
(
buttonState
.
equals
(
"CONFIRM"
))
contingencyPlanInstance
.
setRunstate
(
true
);
operateJson
=
objectMapper
.
writeValueAsString
(
operateGroup
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
import
javax.annotation.PostConstruct
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -14,11 +53,32 @@ 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.bo.*
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgContentBo
;
import
com.yeejoin.amos.fas.business.bo.MsgParamBo
;
import
com.yeejoin.amos.fas.business.bo.RpnCalculationBo
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaPointInputitemMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper
;
import
com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.dao.repository.IAlarmDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IDictDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao
;
import
com.yeejoin.amos.fas.business.feign.RemoteRuleServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
...
...
@@ -31,8 +91,12 @@ import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import
com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService
;
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.model.*
;
import
com.yeejoin.amos.fas.business.util.*
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.DateUtils
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
...
...
@@ -43,34 +107,24 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.fas.dao.entity.Alarm
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.Dict
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EvaluationModel
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentData
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.Fmea
;
import
com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
com.yeejoin.amos.fas.dao.entity.RiskFactor
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.dao.entity.RpnChangeLog
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.stream.Collectors
;
@Service
(
"riskSourceService"
)
public
class
RiskSourceServiceImpl
implements
IRiskSourceService
{
...
...
@@ -176,6 +230,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
private
IRiskFactorDao
iRiskFactorDao
;
public
static
String
cacheKeyForCanBeRunning
()
{
return
Redis
.
genKey
(
CacheType
.
ERASABLE
.
name
(),
"CONTINGENCYRUNING"
);
}
...
...
@@ -504,7 +559,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
log
.
debug
(
"开始调用规则"
);
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(), equipment.getName());
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
);
...
...
@@ -707,24 +764,25 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public
void
run
()
{
boolean
isRunning
=
true
;
while
(
isRunning
)
{
AlarmParam
alarmParam
=
null
;
AlarmParam
deviceData
=
null
;
try
{
alarmParam
=
blockingQueue
.
take
();
}
catch
(
Interrupted
Exception
e
)
{
deviceData
=
blockingQueue
.
take
();
}
catch
(
Exception
e
)
{
log
.
error
(
"take alarmParam happened error"
,
e
);
}
// 2.调用业务接口;
if
(
alarmParam
==
null
)
{
if
(
deviceData
==
null
)
{
log
.
warn
(
"alarmParam is empty!"
);
}
else
{
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
if
(
toke
==
null
)
{
toke
=
remoteSecurityService
.
come
();
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
}
try
{
processFireData
(
alarmParam
,
toke
);
try
{
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
if
(
toke
==
null
)
{
toke
=
remoteSecurityService
.
come
();
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
}
log
.
error
(
"rule token "
,
toke
.
toString
());
processDeivceData
(
deviceData
,
toke
);
}
catch
(
Exception
e
)
{
log
.
error
(
"parse alarmParam happened error"
,
e
);
// 失败处理
...
...
@@ -735,36 +793,43 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
private
void
process
FireData
(
AlarmParam
deviceData
,
Toke
toke
)
throws
Exception
{
//处理设备和巡检数据
private
void
process
DeivceData
(
AlarmParam
deviceData
,
Toke
toke
)
{
//处理设备和巡检数据
deviceData
.
setNodeState
(
deviceData
.
getState
());
FireEquipmentPoint
fireEquipmentPoint
=
iFireEquipmentPointDao
.
findOneByCode
(
deviceData
.
getPointCode
());
fireEquipmentPoint
.
setValue
(
deviceData
.
getState
());
updateFirePointValue
(
fireEquipmentPoint
.
getId
(),
deviceData
.
getState
());
String
fireEquipmentPointType
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
.
getAlarmType
()))
{
Dict
dict
=
dictDao
.
getOne
(
fireEquipmentPoint
.
getAlarmType
());
fireEquipmentPointType
=
dict
.
getDictValue
();
}
// 根据监测点获取监测点设备信息
Optional
<
FireEquipment
>
fireEquipment1
=
this
.
iFireEquipmentDao
.
findById
(
fireEquipmentPoint
.
getFireEquipmentId
());
FireEquipment
fireEquipment
=
null
;
if
(
fireEquipment1
.
isPresent
())
{
fireEquipment
=
fireEquipment1
.
get
();
}
Equipment
equipment
=
null
;
if
(
fireEquipment
!=
null
)
{
deviceData
.
setCode
(
fireEquipment
.
getCode
());
//保存实时数据
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
);
// 根据监测点设备信息获取保护的重点装备
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
if
(
equipment
!=
null
&&
"alarm_type_fire"
.
equals
(
fireEquipmentPointType
))
{
// 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
,
fireEquipmentPointType
,
toke
);
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
}
}
}
}
/**
* 预案执行
*
...
...
@@ -774,59 +839,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* @param fireEquipmentPointType
*/
@Async
void
dynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
FireEquipment
fireEquipment
,
String
fireEquipmentPointType
,
Toke
toke
)
{
String
batchNo
=
null
;
Object
batch
=
null
;
Dict
dict
=
null
;
if
(
fireEquipmentPointType
!=
null
)
{
if
(
"alarm_type_fire"
.
equals
(
fireEquipmentPointType
))
{
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"batchNo"
,
null
);
}
else
{
batch
=
redisTemplate
.
opsForHash
().
get
(
"currentContingency"
,
"batchNo"
);
}
if
(
batch
!=
null
)
{
batchNo
=
batch
.
toString
();
}
else
{
batchNo
=
UUID
.
randomUUID
().
toString
();
}
}
else
{
batchNo
=
UUID
.
randomUUID
().
toString
();
}
if
(
ObjectUtils
.
isEmpty
(
batchNo
))
{
return
;
}
deviceData
.
setBatchNo
(
batchNo
);
deviceData
.
setMonitor
(
equipment
.
getName
());
deviceData
.
setEquimentId
(
String
.
valueOf
(
equipment
.
getId
()));
if
(
"alarm_type_fire"
.
equals
(
fireEquipmentPointType
))
{
if
(
deviceData
.
getIsMock
())
{
redisTemplate
.
delete
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
());
}
Object
canBeRunning
=
redisTemplate
.
opsForValue
().
get
(
cacheKeyForCanBeRunning
());
log
.
debug
(
"canBeRunning===="
,
canBeRunning
);
if
(
canBeRunning
==
null
)
{
try
{
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
alermContingency
(
batchNo
,
fireEquipment
,
equipment
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则失败"
,
e
);
}
}
else
{
redisTemplate
.
expire
(
cacheKeyForCanBeRunning
(),
24
*
60
*
60
,
TimeUnit
.
SECONDS
);
}
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"batchNo"
,
batchNo
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"contingencyPlan"
,
null
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"alarmType"
,
null
);
}
else
{
String
alarmType
=
(
String
)
redisTemplate
.
opsForHash
().
get
(
"currentContingency"
,
"alarmType"
);
if
(!
ObjectUtils
.
isEmpty
(
alarmType
)
&&
dict
.
getDictValue
().
equals
(
alarmType
))
{
ContingencyDeviceStatus
contingencyDeviceStatus
=
(
ContingencyDeviceStatus
)
redisTemplate
.
opsForHash
().
get
(
"currentContingency"
,
"contingencyPlan"
);
contingencyDeviceStatus
.
setNeedStatus
(
"true"
);
autoProcessContingency
(
contingencyDeviceStatus
,
alarmType
);
}
}
void
dynamicPlan
(
AlarmParam
deviceData
,
Equipment
equipment
,
FireEquipment
fireEquipment
,
Toke
toke
)
{
String
batchNo
=
UUID
.
randomUUID
().
toString
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
alermContingency
(
batchNo
,
fireEquipment
,
equipment
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
...
...
@@ -836,7 +857,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return
"SUCCESS"
;
}
private
void
saveFireEquipmentData
(
FireEquipmentPoint
fireEquipmentPoint
,
FireEquipment
fireEquipment
,
AlarmParam
deviceData
,
String
fireEquipmentPointType
)
{
if
(
"alarm_type_fire"
.
equals
(
fireEquipmentPointType
)
||
"alarm_type_trouble"
.
equals
(
fireEquipmentPointType
))
{
Alarm
alarm
=
iAlarmDao
.
findByStatusTrueAndFireEquipmentPointCode
(
deviceData
.
getPointCode
());
...
...
@@ -1021,59 +1042,58 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
public
void
queryContingencyDeviceStatus
(
ContingencyDeviceStatus
contingencyDeviceStatus
)
{
String
alarmType
=
null
;
switch
(
contingencyDeviceStatus
.
getActionName
())
{
case
"确认灾情"
:
// redisTemplate.opsForHash().put("currentContingency", "equipmentId", contingencyDeviceStatus.getEquipmentId());
redisTemplate
.
opsForValue
().
set
(
"equipmentId"
,
contingencyDeviceStatus
.
getEquipmentId
());
break
;
case
"断开上级电源"
:
alarmType
=
"alarm_type_power"
;
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"alarmType"
,
alarmType
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"contingencyPlan"
,
contingencyDeviceStatus
);
redisTemplate
.
opsForValue
().
set
(
"equipmentId"
,
contingencyDeviceStatus
.
getEquipmentId
());
break
;
case
"关停设备"
:
// 换流变
alarmType
=
"alarm_type_rheology"
;
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"alarmType"
,
alarmType
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"contingencyPlan"
,
contingencyDeviceStatus
);
redisTemplate
.
opsForValue
().
set
(
"equipmentId"
,
contingencyDeviceStatus
.
getEquipmentId
());
break
;
case
"应急处置结束"
:
// 换流变
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"batchNo"
,
null
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"contingencyPlan"
,
null
);
redisTemplate
.
opsForHash
().
put
(
"currentContingency"
,
"alarmType"
,
null
);
redisTemplate
.
opsForValue
().
set
(
"equipmentId"
,
null
);
break
;
default
:
redisTemplate
.
opsForValue
().
set
(
"equipmentId"
,
contingencyDeviceStatus
.
getEquipmentId
());
break
;
}
if
(
alarmType
==
null
)
{
return
;
}
contingencyDeviceStatus
.
setNeedStatus
(
"true"
);
autoProcessContingency
(
contingencyDeviceStatus
,
alarmType
);
}
private
void
autoProcessContingency
(
ContingencyDeviceStatus
contingencyDeviceStatus
,
String
alarmType
)
{
if
(
ObjectUtils
.
isEmpty
(
contingencyDeviceStatus
))
{
return
;
}
int
pointCount
=
fireEquipPointMapper
.
queryCountByEuipmentIdAndAlarmType
(
contingencyDeviceStatus
.
getEquipmentId
(),
alarmType
);
int
count
=
fireEquipPointMapper
.
queryStopCountByEuipmentIdAndAlarmType
(
contingencyDeviceStatus
.
getEquipmentId
(),
alarmType
,
contingencyDeviceStatus
.
getNeedStatus
());
if
(
pointCount
>
0
&&
pointCount
==
count
)
{
try
{
String
batchNo
=
(
String
)
redisTemplate
.
opsForHash
().
get
(
"currentContingency"
,
"batchNo"
);
// iContingencyInstance.setButtonExecuted(batchNo, contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm());
// iContingencyInstance.fire(batchNo, contingencyDeviceStatus.getStepCode(), contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm(), contingencyDeviceStatus.getStepState());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
;
}
}
// String alarmType = null;
//
// switch (contingencyDeviceStatus.getActionName()) {
// case "确认灾情":
// redisTemplate.opsForValue().set("equipmentId", contingencyDeviceStatus.getEquipmentId());
// break;
// case "断开上级电源":
// alarmType = "alarm_type_power";
// redisTemplate.opsForHash().put("currentContingency", "alarmType", alarmType);
// redisTemplate.opsForHash().put("currentContingency", "contingencyPlan", contingencyDeviceStatus);
// redisTemplate.opsForValue().set("equipmentId", contingencyDeviceStatus.getEquipmentId());
// break;
// case "关停设备": // 换流变
// alarmType = "alarm_type_rheology";
// redisTemplate.opsForHash().put("currentContingency", "alarmType", alarmType);
// redisTemplate.opsForHash().put("currentContingency", "contingencyPlan", contingencyDeviceStatus);
// redisTemplate.opsForValue().set("equipmentId", contingencyDeviceStatus.getEquipmentId());
// break;
// case "应急处置结束": // 换流变
// redisTemplate.opsForHash().put("currentContingency", "batchNo", null);
// redisTemplate.opsForHash().put("currentContingency", "contingencyPlan", null);
// redisTemplate.opsForHash().put("currentContingency", "alarmType", null);
// redisTemplate.opsForValue().set("equipmentId", null);
// break;
// default:
// redisTemplate.opsForValue().set("equipmentId", contingencyDeviceStatus.getEquipmentId());
// break;
// }
// if (alarmType == null) {
// return;
// }
// contingencyDeviceStatus.setNeedStatus("true");
// autoProcessContingency(contingencyDeviceStatus, alarmType);
}
// private void autoProcessContingency(ContingencyDeviceStatus contingencyDeviceStatus, String alarmType) {
// if (ObjectUtils.isEmpty(contingencyDeviceStatus)) {
// return;
// }
// int pointCount = fireEquipPointMapper.queryCountByEuipmentIdAndAlarmType(contingencyDeviceStatus.getEquipmentId(), alarmType);
// int count = fireEquipPointMapper.queryStopCountByEuipmentIdAndAlarmType(contingencyDeviceStatus.getEquipmentId(), alarmType, contingencyDeviceStatus.getNeedStatus());
// if (pointCount > 0 && pointCount == count) {
// try {
// String batchNo = (String) redisTemplate.opsForHash().get("currentContingency", "batchNo");
//// iContingencyInstance.setButtonExecuted(batchNo, contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm());
//// iContingencyInstance.fire(batchNo, contingencyDeviceStatus.getStepCode(), contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm(), contingencyDeviceStatus.getStepState());
// } catch (Exception e) {
// e.printStackTrace();
// }
// return;
// }
// }
@Override
public
List
<
Map
>
queryContingencyWater
()
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/CacheMap.java
View file @
97182136
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
public
class
CacheMap
{
// 缓存Map
ConcurrentHashMap
<
String
,
CacheValue
>
cacheMap
=
new
ConcurrentHashMap
<
String
,
CacheValue
>();
public
class
CacheMap
{
//缓存Map
ConcurrentHashMap
<
String
,
CacheValue
>
cacheMap
=
new
ConcurrentHashMap
<
String
,
CacheValue
>
();
//保证不能被外界 构造
CacheMap
(){
// 保证不能被外界 构造
CacheMap
()
{
}
public
void
setex
(
String
key
,
Toke
value
,
long
times
){
CacheValue
cValue
=
new
CacheValue
();
cValue
.
setTimes
(
System
.
currentTimeMillis
()+
times
*
1000
);
cValue
.
setValue
(
value
);
cacheMap
.
put
(
key
,
cValue
);
}
public
Toke
getValue
(
String
key
){
CacheValue
cValue
=
cacheMap
.
get
(
key
);
if
(
cValue
!=
null
&&
cValue
.
getTimes
()>
System
.
currentTimeMillis
()){
return
cValue
.
getValue
();
}
else
if
(
cValue
!=
null
&&
cacheMap
.
containsKey
(
key
)){
//清理一次
cacheMap
.
remove
(
key
);
public
void
setex
(
String
key
,
Toke
value
,
long
times
)
{
CacheValue
cValue
=
new
CacheValue
();
cValue
.
setTimes
(
System
.
currentTimeMillis
()
+
times
*
1000
);
cValue
.
setValue
(
value
);
cacheMap
.
put
(
key
,
cValue
);
}
return
null
;
public
Toke
getValue
(
String
key
)
{
CacheValue
cValue
=
cacheMap
.
get
(
key
);
if
(
cValue
!=
null
&&
cValue
.
getTimes
()
>
System
.
currentTimeMillis
())
{
return
cValue
.
getValue
();
}
else
if
(
cValue
!=
null
&&
cacheMap
.
containsKey
(
key
))
{
// 清理一次
cacheMap
.
remove
(
key
);
}
return
null
;
}
/**
获取key集合
@return
*/
public
Set
getKeys
(){
return
cacheMap
.
keySet
();
}
*
获取key集合
*
* @return
*/
public
Set
getKeys
()
{
return
cacheMap
.
keySet
();
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/Toke.java
View file @
97182136
...
...
@@ -25,6 +25,11 @@ public class Toke {
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
;
}
@Override
public
String
toString
()
{
return
"Toke [toke="
+
toke
+
", product="
+
product
+
", appKey="
+
appKey
+
"]"
;
}
}
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
97182136
security.password
=
tw123456
security.loginId
=
tw3
#security.password=a1234560
#security.loginId=station_safety
security.password
=
a1234560
security.loginId
=
shg
security.productWeb
=
CONVERTER_STATION_WEB
security.appKeyWeb
=
CONVERTER_STATION
#environment
#spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone
=
http://172.16.
10.72
:10001/eureka/
eureka.client.serviceUrl.defaultZone
=
http://172.16.
3.75
:10001/eureka/
eureka.client.register-with-eureka
=
true
eureka.client.fetch-registry
=
true
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
-36
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://172.16.11.33:3306/safety-business-2.0
.37
?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
...
...
@@ -28,7 +31,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
#rule
#params.remoteRuleUrl=http://172.16.3.3:8080/
params.remoteRuleUrl
=
http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl
=
http://172.16.10.
91
:10600/
params.remoteWebsocketUrl
=
http://172.16.10.
72
:10600/
spring.redis.database
=
0
spring.redis.host
=
172.16.10.85
...
...
@@ -56,7 +59,7 @@ emqx.password=a123456
Push.fegin.name
=
APPMESSAGEPUSHSERVICE-36
dutyMode.fegin.name
=
AMOSDUTYMODE
DutyMode.dutyUrl
=
http://172.16.1
1.36
:10005/
DutyMode.dutyUrl
=
http://172.16.1
0.72
:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_equippoint.xml
View file @
97182136
...
...
@@ -437,4 +437,13 @@
</foreach>
</delete>
<select
id=
"getPointsByEquipmentIdAndType"
resultType=
"Map"
>
SELECT p.* from
f_fire_equipment_point p
LEFT JOIN f_fire_equipment fe on p.fire_equipment_id = fe.id
LEFT JOIN f_equipment_fire_equipment e on fe.id = e.fire_equipment_id
where e.equipment_id = #{id}
and p.type = #{type}
</select>
</mapper>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_impAndfire_equip.xml
View file @
97182136
...
...
@@ -145,4 +145,18 @@
</select>
<select
id=
"existsAlarmPointByEqpPointIdAndEquipId"
resultType=
"Boolean"
>
SELECT
1
FROM
f_fire_equipment_point ep
LEFT JOIN f_fire_equipment e ON e.id = ep.fire_equipment_id
LEFT JOIN f_equipment_fire_equipment fe ON fe.fire_equipment_id = e.id
LEFT JOIN f_dict d on ep.alarm_type = d.id
where d.dict_code = 'fire_equipment_switch'
and d.dict_value = 'alarm_type_fire'
and fe.equipment_id = #{equipmentId}
and ep.id = #{pointId}
</select>
</mapper>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
View file @
97182136
...
...
@@ -808,6 +808,7 @@
FROM
(
SELECT
rs.code,
rs.id,
rs.is_indoor inDoor,
CONCAT('riskSource-', rs.id) 'key',
...
...
@@ -857,6 +858,7 @@
AND rs.is_region
<![CDATA[<>]]>
'TRUE'
UNION ALL
SELECT
eq.code,
id,
is_indoor inDoor,
CONCAT('impEquipment-', id) 'key',
...
...
@@ -907,6 +909,7 @@
</if>
UNION ALL
select
p.point_no code,
p.id,
p.is_indoor as inDoor,
CONCAT('patrol',p.id) as `key`,
...
...
@@ -958,6 +961,7 @@
AND p.coordinates != '' AND p.coordinates is not null
UNION ALL
select
fe.code,
fe.id,
fe.is_indoor as inDoor,
case
...
...
@@ -1013,6 +1017,7 @@
AND fe.position3d != '' AND fe.position3d is not null
UNION ALL
select
c.car_num code,
c.id,
c.is_indoor as inDoor,
CONCAT('fireCar',c.id) as `key`,
...
...
@@ -1055,6 +1060,7 @@
AND c.position3d != '' AND c.position3d is not null
UNION ALL
select
s.code,
s.id,
s.is_indoor as inDoor,
case
...
...
@@ -1104,6 +1110,7 @@
AND s.position3d != '' AND s.position3d is not null
UNION ALL
select
w.code,
w.id,
w.is_indoor as inDoor,
case
...
...
pom.xml
View file @
97182136
...
...
@@ -34,7 +34,7 @@
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-rule
</artifactId>
<version>
1.
1
.0-SNAPSHOT
</version>
<version>
1.
2
.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
...
...
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