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
62769d43
Commit
62769d43
authored
Feb 01, 2021
by
田涛
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_upgrade-1225' into dev_upgrade-1225
parents
01d46bd7
53741e0c
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
372 additions
and
181 deletions
+372
-181
BubbleTipAction.java
...com/yeejoin/amos/fas/business/action/BubbleTipAction.java
+14
-12
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+107
-36
CustomerAction.java
.../com/yeejoin/amos/fas/business/action/CustomerAction.java
+5
-0
RiskSituationAction.java
...yeejoin/amos/fas/business/action/RiskSituationAction.java
+23
-21
SimpleTipAction.java
...com/yeejoin/amos/fas/business/action/SimpleTipAction.java
+20
-16
ContingencyRo.java
...yeejoin/amos/fas/business/action/model/ContingencyRo.java
+14
-14
SetpEnum.java
.../com/yeejoin/amos/fas/business/action/model/SetpEnum.java
+8
-13
ContingencyPlanController.java
...os/fas/business/controller/ContingencyPlanController.java
+8
-1
RiskModelController.java
...oin/amos/fas/business/controller/RiskModelController.java
+11
-0
TimeLineController.java
...join/amos/fas/business/controller/TimeLineController.java
+11
-6
PlanDetailMapper.java
...eejoin/amos/fas/business/dao/mapper/PlanDetailMapper.java
+1
-0
IContingencyPlanInstanceRepository.java
...ss/dao/repository/IContingencyPlanInstanceRepository.java
+2
-2
IFmeaDao.java
...om/yeejoin/amos/fas/business/dao/repository/IFmeaDao.java
+3
-0
IPlanDetailDao.java
...join/amos/fas/business/dao/repository/IPlanDetailDao.java
+3
-2
IPreplanPictureDao.java
.../amos/fas/business/dao/repository/IPreplanPictureDao.java
+6
-0
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+14
-2
ContingencyPlanServiceImpl.java
...fas/business/service/impl/ContingencyPlanServiceImpl.java
+35
-13
EquipmentServiceImpl.java
.../amos/fas/business/service/impl/EquipmentServiceImpl.java
+18
-4
HandlerMqttMessageImpl.java
...mos/fas/business/service/impl/HandlerMqttMessageImpl.java
+14
-13
RiskFactorServiceImpl.java
...amos/fas/business/service/impl/RiskFactorServiceImpl.java
+6
-0
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+8
-1
IContingencyInstance.java
...amos/fas/business/service/intfc/IContingencyInstance.java
+3
-4
IContingencyPlanService.java
...s/fas/business/service/intfc/IContingencyPlanService.java
+1
-1
PlanDetailMapper.xml
...ysStart/src/main/resources/db/mapper/PlanDetailMapper.xml
+18
-4
dbTemplate_equipment_specific.xml
...ain/resources/db/mapper/dbTemplate_equipment_specific.xml
+5
-3
dbTemplate_fire_equip.xml
...rt/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
+3
-2
pom.xml
pom.xml
+11
-11
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/BubbleTipAction.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.stereotype.Component
;
import
com.yeejoin.amos.component.rule.RuleActionBean
;
import
com.yeejoin.amos.component.rule.RuleMethod
;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
import
com.yeejoin.amos.fas.business.action.result.BubbleTipResult
;
import
com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
*
* <pre>
* 气泡提示动作
* </pre>
...
...
@@ -27,8 +25,8 @@ import com.yeejoin.amos.fas.business.service.model.ToipResponse;
public
class
BubbleTipAction
implements
CustomerAction
{
private
static
String
PACKAGEURL
=
"com.yeejoin.amos.fas.business.action.result.message."
;
//@ExposeAction("气泡提示")
@RuleMethod
(
methodLabel
=
"气泡提示"
,
project
=
"风险管控"
)
public
void
sendBubbleTip
(
Object
bizobj
,
Boolean
showInfo
,
Object
title
,
String
type
)
...
...
@@ -49,7 +47,7 @@ public class BubbleTipAction implements CustomerAction
Map
<
String
,
Object
>
tempmap4
=
new
HashMap
<>();
tempmap4
.
put
(
"type"
,
type
);
result
.
add
(
tempmap4
);
Constructor
<?>
constructor
;
try
{
...
...
@@ -66,5 +64,9 @@ public class BubbleTipAction implements CustomerAction
e
.
printStackTrace
();
}
}
@Override
public
void
intreeuptPlan
(
String
batchNo
)
{
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
62769d43
...
...
@@ -184,37 +184,6 @@ 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
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
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/%s"
,
serviceName
,
stationName
,
"plan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setTopic
(
topic
);
event
.
setMsgType
(
msgType
);
event
.
setContingency
(
contingency
);
contingencyLogPublisher
.
publish
(
event
);
}
else
if
(
"websocket"
.
equals
(
pushType
.
toLowerCase
())){
action
.
execute
(
msgType
,
contingency
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
...
...
@@ -260,6 +229,62 @@ public class ContingencyAction implements CustomerAction {
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
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
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
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/%s"
,
serviceName
,
stationName
,
"plan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setTopic
(
topic
);
event
.
setMsgType
(
msgType
);
event
.
setContingency
(
contingency
);
contingencyLogPublisher
.
publish
(
event
);
}
else
if
(
"websocket"
.
equals
(
pushType
.
toLowerCase
())){
action
.
execute
(
msgType
,
contingency
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
sendweb
(
String
msgType
,
Object
contingency
,
SafteyPlanResult
result
)
{
ContingencyRo
ro
=
(
ContingencyRo
)
contingency
;
ro
.
setTelemetryMap
(
null
);
ro
.
setTelesignallingMap
(
null
);
Constructor
<?>
constructor
;
try
{
constructor
=
Class
.
forName
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
AbstractActionResultMessage
<?>
action
=
(
AbstractActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
ToipResponse
toipResponse
=
action
.
buildResponse
(
msgType
,
contingency
,
result
.
toJson
());
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"numberPlan"
);
log
.
info
(
String
.
format
(
"mqtt[%s]:【 %s 】"
,
topic
,
toipResponse
.
toJsonStr
()));
webMqttComponent
.
publish
(
topic
,
toipResponse
.
toJsonStr
());
ContingencyEvent
event
=
new
ContingencyEvent
(
this
);
event
.
setMsgBody
(
toipResponse
.
toJsonStr
());
event
.
setTopic
(
topic
);
event
.
setMsgType
(
msgType
);
event
.
setContingency
(
contingency
);
contingencyLogPublisher
.
publish
(
event
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
...
...
@@ -298,13 +323,15 @@ public class ContingencyAction implements CustomerAction {
});
}
tempmap1
.
put
(
"content"
,
records
);
tempmap1
.
put
(
"status"
,
PlanRecordStatusEnum
.
OPERATION
.
getCode
());
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
result
.
add
(
tempmap1
);
System
.
out
.
println
(
"--------------------messageRecord----------------------"
+
result
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
this
.
sendweb
(
"recordarea"
,
paramObj
,
result
);
}
/**
...
...
@@ -508,9 +535,8 @@ public class ContingencyAction implements CustomerAction {
e
.
printStackTrace
();
}
result
.
add
(
tempmap1
);
System
.
out
.
println
(
"--------------------saveOperation----------------------"
+
result
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
}
private
String
getContingencyPlanId
(
String
batchNo
,
String
actionName
,
String
icon
,
String
tips
,
String
buttonJson
)
{
...
...
@@ -642,10 +668,11 @@ public class ContingencyAction implements CustomerAction {
tempmap1
.
put
(
"type"
,
"event"
);
tempmap1
.
put
(
"content"
,
"stopPlan"
);
//数字预案结束状态
tempmap1
.
put
(
"status"
,
PlanRecordStatusEnum
.
COMPLETE
.
getCode
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
delete
(
"contingencyRo"
);
// 结束预案,更新设备重点设备参数
...
...
@@ -658,9 +685,10 @@ public class ContingencyAction implements CustomerAction {
equipmentService
.
save
(
equipment
);
}
}
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord
planOperationRecord
=
planOperationRecordDao
.
findByBatchNo
(
contingencyRo
.
getBatchNo
());
if
(
planOperationRecord
!=
null
){
if
(
planOperationRecord
!=
null
&&
planOperationRecord
.
getStatus
()==
PlanRecordStatusEnum
.
OPERATION
.
getCode
()
){
planOperationRecord
.
setStatus
(
PlanRecordStatusEnum
.
COMPLETE
.
getCode
());
planOperationRecord
.
setEndTime
(
new
Date
());
planOperationRecordDao
.
save
(
planOperationRecord
);
...
...
@@ -670,7 +698,10 @@ public class ContingencyAction implements CustomerAction {
planDetail
.
setStatus
(
ContingencyPlanStatusEnum
.
AVAILABLE
.
getCode
());
planDetailDao
.
save
(
planDetail
);
}
//数字预案业务屏web端发送消息
this
.
sendweb
(
"recordarea"
,
paramObj
,
result
);
}
}
...
...
@@ -801,4 +832,44 @@ public class ContingencyAction implements CustomerAction {
RuleRunigSnapshotServiceImpl
.
setReplayBatchNoToNull
();
}
@Override
public
void
intreeuptPlan
(
String
batchNo
)
{
ContingencyRo
contingencyRo
=
new
ContingencyRo
();
contingencyRo
.
setBatchNo
(
batchNo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"type"
,
"event"
);
ArrayList
records
=
new
ArrayList
<>();
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf
.
format
(
new
Date
()));
map
.
put
(
"stepName"
,
"应急处置中断"
);
records
.
add
(
map
);
tempmap1
.
put
(
"content"
,
records
);
//数字预案结束状态
tempmap1
.
put
(
"status"
,
PlanRecordStatusEnum
.
INTERRUPT
.
getCode
());
result
.
add
(
tempmap1
);
//数字预案业务屏web端发送消息
this
.
sendweb
(
"recordarea"
,
contingencyRo
,
result
);
updateNumberPlan
(
contingencyRo
.
getBatchNo
());
}
/**
* 修改数字预案状态
* */
public
void
updateNumberPlan
(
String
batchNo
){
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord
planOperationRecord
=
planOperationRecordDao
.
findByBatchNo
(
batchNo
);
if
(
planOperationRecord
!=
null
){
planOperationRecord
.
setStatus
(
PlanRecordStatusEnum
.
INTERRUPT
.
getCode
());
planOperationRecord
.
setEndTime
(
new
Date
());
planOperationRecordDao
.
save
(
planOperationRecord
);
Optional
<
PlanDetail
>
optionalPlanDetail
=
planDetailDao
.
findById
(
planOperationRecord
.
getPlanId
());
if
(
optionalPlanDetail
.
get
()!=
null
){
PlanDetail
planDetail
=
optionalPlanDetail
.
get
();
planDetail
.
setStatus
(
ContingencyPlanStatusEnum
.
AVAILABLE
.
getCode
());
planDetailDao
.
save
(
planDetail
);
}
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/CustomerAction.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
public
interface
CustomerAction
{
/**
*数字预案中断
*/
void
intreeuptPlan
(
String
batchNo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/RiskSituationAction.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
com.yeejoin.amos.component.rule.MethodParam
;
import
com.yeejoin.amos.component.rule.RuleActionBean
;
import
com.yeejoin.amos.component.rule.RuleMethod
;
...
...
@@ -15,10 +7,16 @@ 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.BubbleTipResult
;
import
com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage
;
import
com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
*
* <pre>
* 风险态势图动作
* </pre>
...
...
@@ -31,22 +29,22 @@ import com.yeejoin.amos.fas.business.service.model.ToipResponse;
public
class
RiskSituationAction
implements
CustomerAction
{
private
static
String
PACKAGEURL
=
"com.yeejoin.amos.fas.business.action.result.message."
;
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@Value
(
"${station.name}"
)
private
String
stationName
;
@RuleMethod
(
methodLabel
=
"气泡提示"
,
project
=
"换流站消防专项预案"
)
public
void
sendBubbleTip
(
@MethodParam
(
paramLabel
=
"bizobj对象"
)
Object
bizobj
,
@MethodParam
(
paramLabel
=
"是否显示名称"
)
Boolean
showInfo
,
public
void
sendBubbleTip
(
@MethodParam
(
paramLabel
=
"bizobj对象"
)
Object
bizobj
,
@MethodParam
(
paramLabel
=
"是否显示名称"
)
Boolean
showInfo
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
)
{
BubbleTipResult
result
=
new
BubbleTipResult
();
...
...
@@ -61,7 +59,7 @@ public class RiskSituationAction implements CustomerAction
Map
<
String
,
Object
>
tempmap3
=
new
HashMap
<>();
tempmap3
.
put
(
"title"
,
title
);
result
.
add
(
tempmap3
);
Constructor
<?>
constructor
;
try
{
...
...
@@ -83,7 +81,7 @@ public class RiskSituationAction implements CustomerAction
e
.
printStackTrace
();
}
}
@RuleMethod
(
methodLabel
=
"区域颜色改变"
,
project
=
"换流站消防专项预案"
)
public
void
regionChange
(
@MethodParam
(
paramLabel
=
"bizobj对象"
)
Object
bizobj
,
@MethodParam
(
paramLabel
=
"颜色"
)
String
colour
)
{
...
...
@@ -95,7 +93,7 @@ public class RiskSituationAction implements CustomerAction
Map
<
String
,
Object
>
tempmap2
=
new
HashMap
<>();
tempmap2
.
put
(
"colour"
,
colour
);
result
.
add
(
tempmap2
);
Constructor
<?>
constructor
;
try
{
...
...
@@ -150,5 +148,9 @@ public class RiskSituationAction implements CustomerAction
e
.
printStackTrace
();
}
}
@Override
public
void
intreeuptPlan
(
String
batchNo
)
{
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/SimpleTipAction.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
com.yeejoin.amos.fas.business.action.el.ELEvaluationContext
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
...
...
@@ -16,9 +8,16 @@ import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultM
import
com.yeejoin.amos.fas.business.action.util.DataItemUtil
;
import
com.yeejoin.amos.fas.business.service.intfc.IMessageService
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
*
* <pre>
* 消息提示动作
* </pre>
...
...
@@ -30,22 +29,22 @@ import com.yeejoin.amos.fas.business.service.model.ToipResponse;
public
class
SimpleTipAction
implements
CustomerAction
{
private
static
String
PACKAGEURL
=
"com.yeejoin.amos.fas.business.action.result.message."
;
@Autowired
private
IMessageService
messageService
;
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@Value
(
"${station.name}"
)
private
String
stationName
;
//@ExposeAction("消息提示")
public
void
sendMessageTip
(
Object
bizobj
,
String
title
,
String
content
,
String
type
)
{
...
...
@@ -83,7 +82,12 @@ public class SimpleTipAction implements CustomerAction
e
.
printStackTrace
();
}
}
@Override
public
void
intreeuptPlan
(
String
batchNo
)
{
}
// @SuppressWarnings("unchecked")
// private void saveMessageAction(AbstractActionResult abstractActionResult,String type)
// {
...
...
@@ -93,7 +97,7 @@ public class SimpleTipAction implements CustomerAction
// for(String str: map.keySet()) {
// if(str.equals("content")) {
// message.setContent(map.get("content").toString());
// }else
// }else
// if (str.equals("title"))
// {
// message.setTitle(map.get("title").toString());
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/ContingencyRo.java
View file @
62769d43
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
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Map
;
@RuleFact
(
value
=
"动态预案"
,
project
=
"换流站消防专项预案"
)
@Data
public
class
ContingencyRo
implements
Serializable
{
@Label
(
"批次号"
)
private
String
batchNo
;
/**
*
*
*/
private
static
final
long
serialVersionUID
=
1863437780244849215L
;
@Label
(
"消防设备名称"
)
...
...
@@ -35,10 +34,10 @@ public class ContingencyRo implements Serializable {
//负责人名称,手机号
@Label
(
"重点设备id"
)
private
String
equipmentId
;
//重点设备id
@Label
(
"重点设备组织编码"
)
private
String
equipmentOrgCode
=
"10"
;
//重点设备组织编码
@Label
(
"重点设备名称"
)
private
String
equipmentName
;
@Label
(
"重点设备坐标"
)
...
...
@@ -77,14 +76,15 @@ public class ContingencyRo implements Serializable {
private
String
stepState
;
//步骤操作状态
@Label
(
"重点设备编码"
)
private
String
equipmentCode
;
private
Date
createDate
=
new
Date
();
private
Date
createDate
=
new
Date
();
@Label
(
"遥测数据"
)
private
HashMap
<
String
,
Double
>
telemetryMap
;
private
Map
<
String
,
Double
>
telemetryMap
;
@Label
(
"遥信数据"
)
private
Hash
Map
<
String
,
Integer
>
telesignallingMap
;
private
Map
<
String
,
Integer
>
telesignallingMap
;
//消防炮
@Label
(
"消防炮编号"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/SetpEnum.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
.
model
;
import
com.yeejoin.amos.component.rule.model.RuleConstants
;
//@Constants(value = SetpEnum.class)
public
enum
SetpEnum
implements
RuleConstants
{
STEP0
(
"0"
,
"确认火灾"
,
0
),
STEP1
(
"1"
,
"停运换流阀、拨打报警电话"
,
1
),
STEP2
(
"2"
,
"开启水喷雾系统"
,
2
),
public
enum
SetpEnum
{
STEP0
(
"0"
,
"确认火灾"
,
0
),
STEP1
(
"1"
,
"停运换流阀、拨打报警电话"
,
1
),
STEP2
(
"2"
,
"开启水喷雾系统"
,
2
),
STEP3
(
"3"
,
"断开上级电源"
,
3
),
STEP4
(
"4"
,
"开启油枕排油系统"
,
4
),
STEP5
(
"5"
,
"消防炮“一键启动”"
,
5
),
...
...
@@ -20,27 +17,25 @@ public enum SetpEnum implements RuleConstants{
STEP13
(
"13"
,
"灭火指挥权交接"
,
13
),
STEP14
(
"14"
,
"应急处置结束"
,
14
);
private
String
stepCode
;
private
String
stepName
;
private
int
order
;
SetpEnum
(
String
stepCode
,
String
stepName
,
int
order
)
{
this
.
stepCode
=
stepCode
;
this
.
stepName
=
stepName
;
this
.
order
=
order
;
}
@Override
public
String
getValue
()
{
return
stepCode
;
}
@Override
public
String
getTitle
()
{
return
stepName
;
}
public
int
getOrder
()
{
return
order
;
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/ContingencyPlanController.java
View file @
62769d43
...
...
@@ -166,7 +166,14 @@ public class ContingencyPlanController extends BaseController {
AgencyUserModel
user
=
getUserInfo
();
vo
.
setUserId
(
user
.
getUserId
());
vo
.
setUserName
(
user
.
getRealName
());
ContingencyPlanResponseVo
result
=
contingencyPlanService
.
planStart
(
vo
,
toke
);
ContingencyPlanResponseVo
result
=
null
;
try
{
result
=
contingencyPlanService
.
planStart
(
vo
,
toke
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
CommonResponseUtil2
.
failure
();
}
return
CommonResponseUtil2
.
success
(
result
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskModelController.java
View file @
62769d43
...
...
@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.controller;
import
java.util.HashMap
;
import
java.util.List
;
import
com.yeejoin.amos.fas.business.dao.repository.IFmeaDao
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -49,6 +51,9 @@ public class RiskModelController extends BaseController {
@Autowired
private
IFmeaService
fmeaService
;
@Autowired
private
IFmeaDao
iFmeaDao
;
@Permission
@ApiOperation
(
value
=
"根据父类编号获取子类风险点类型"
,
notes
=
"根据父类编号获取子类风险点类型"
)
@GetMapping
(
value
=
"/riskSource/getChildTypeByPid"
)
...
...
@@ -159,6 +164,12 @@ public class RiskModelController extends BaseController {
@RequestMapping
(
value
=
"/fmea/editFmea"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
editFmea
(
@ApiParam
(
value
=
"Fmea模型对象"
,
required
=
true
)
@RequestBody
List
<
Fmea
>
params
)
{
try
{
params
.
forEach
(
param
->
{
int
i
=
iFmeaDao
.
checkIdAndName
(
param
.
getRiskSourceId
(),
param
.
getRiskFactorsId
());
if
(
i
>
0
){
throw
new
YeeException
(
"危险因素重复"
);
}
});
AgencyUserModel
user
=
getUserInfo
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"user_id"
,
user
.
getUserId
());
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/TimeLineController.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
com.yeejoin.amos.fas.business.action.CustomerAction
;
import
com.yeejoin.amos.fas.business.service.impl.RiskSourceServiceImpl
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyOriginalDataService
;
...
...
@@ -20,6 +21,7 @@ import io.swagger.annotations.ApiParam;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -36,10 +38,12 @@ public class TimeLineController extends BaseController{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
TimeLineController
.
class
);
@Autowired
IContingencyInstance
iContingencyInstance
;
@Qualifier
(
"contingencyAction"
)
@Autowired
private
CustomerAction
customerAction
;
@Autowired
IContingencyOriginalDataService
iContingencyOriginalDataService
;
@Autowired
IRuleRunningSnapshotService
iRuleRunningSnapshotService
;
...
...
@@ -52,7 +56,7 @@ public class TimeLineController extends BaseController{
private
RedisTemplate
redisTemplate
;
@Autowired
private
IRuleRunningSnapshotService
ruleRunningSnapshotService
;
@Permission
//@Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据批次号查询时间轴"
,
notes
=
"根据批次号查询时间轴"
)
...
...
@@ -85,7 +89,7 @@ public class TimeLineController extends BaseController{
fireQueue
.
addLast
(
map
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
@Permission
//@Authorization(ingore = true)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"点击按钮"
,
notes
=
"点击按钮"
)
...
...
@@ -107,6 +111,7 @@ public class TimeLineController extends BaseController{
equip
.
setStatus
(
NumberEnum
.
ONE
.
getValue
());
equipmentService
.
save
(
equip
);
});
customerAction
.
intreeuptPlan
(
batchNo
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
...
...
@@ -118,7 +123,7 @@ public class TimeLineController extends BaseController{
ruleRunningSnapshotService
.
replayPlan
(
batchNo
,
randomNumber
);
return
CommonResponseUtil
.
success
(
"SUCCESS"
);
}
@Permission
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"预案回放退出"
,
notes
=
"预案回放退出"
)
@RequestMapping
(
value
=
"/fire/replay/exit"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
...
...
@@ -223,7 +228,7 @@ public class TimeLineController extends BaseController{
" }"
+
" ]"
+
"}"
;
@Permission
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据批次号查询时间轴"
,
notes
=
"根据批次号查询时间轴"
)
@RequestMapping
(
value
=
"/replay"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/PlanDetailMapper.java
View file @
62769d43
...
...
@@ -44,4 +44,5 @@ public interface PlanDetailMapper {
*/
List
<
PlanDetailVo
>
filterList
(
@Param
(
"planName"
)
String
planName
,
@Param
(
"classifyId"
)
List
<
Long
>
classifyId
,
@Param
(
"planRange"
)
List
<
String
>
planRange
,
@Param
(
"editOrgName"
)
String
editOrgName
,
@Param
(
"implementationTimeLeft"
)
Date
implementationTimeLeft
,
@Param
(
"implementationTimeRight"
)
Date
implementationTimeRight
,
@Param
(
"start"
)
int
start
,
@Param
(
"size"
)
int
size
);
String
getRuleIdByEquipment
(
@Param
(
"id"
)
Long
id
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IContingencyPlanInstanceRepository.java
View file @
62769d43
...
...
@@ -28,7 +28,7 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" t.batch_no = ?"
+
" AND t.record_type = ?"
+
" ORDER BY"
+
" t.sort
DE
SC"
,
nativeQuery
=
true
)
" t.sort
A
SC"
,
nativeQuery
=
true
)
List
<
ContingencyPlanInstance
>
queryForCategory
(
String
batch_no
,
String
recordType
);
@Query
(
value
=
...
...
@@ -45,6 +45,6 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" where t.batch_no = ?1 and t.category=?2 and t.sub_category=?3"
+
" order by t.sort desc "
,
nativeQuery
=
true
)
List
<
ContingencyPlanInstance
>
queryForContent
(
String
batch_no
,
String
category
,
String
subCategory
);
Optional
<
ContingencyPlanInstance
>
findById
(
String
id
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IFmeaDao.java
View file @
62769d43
...
...
@@ -48,4 +48,7 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
@Query
(
value
=
"select * from `f_fmea` where id in ?1"
,
nativeQuery
=
true
)
List
<
Fmea
>
findAllByRiskSourceIds
(
List
<
Long
>
ids
);
@Query
(
value
=
"select count(1) from `f_fmea` where risk_source_id = ?1 and risk_factors_id = ?2"
,
nativeQuery
=
true
)
int
checkIdAndName
(
Long
sId
,
Long
nId
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanDetailDao.java
View file @
62769d43
...
...
@@ -15,8 +15,9 @@ import java.util.List;
@Repository
public
interface
IPlanDetailDao
extends
BaseDao
<
PlanDetail
,
Long
>
{
@Query
(
value
=
"SELECT
count(*)
from c_plan_detail where status in (?1) AND is_delete = 0 "
,
nativeQuery
=
true
)
int
findByStatus
(
Integer
[]
status
);
@Query
(
value
=
"SELECT
*
from c_plan_detail where status in (?1) AND is_delete = 0 "
,
nativeQuery
=
true
)
List
<
PlanDetail
>
findByStatus
(
Integer
[]
status
);
List
<
PlanDetail
>
getPlanDetailsByIdInAndIsDelete
(
List
<
Long
>
idList
,
Boolean
isDelete
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPreplanPictureDao.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
...
...
@@ -11,6 +13,10 @@ public interface IPreplanPictureDao extends BaseDao<PreplanPicture, Long> {
@Query
(
value
=
"select * from f_preplan_picture where equipment_id=?1 and type = ?2"
,
nativeQuery
=
true
)
PreplanPicture
selectOne
(
Long
id
,
int
type
);
@Transactional
@Modifying
@Query
(
value
=
"delete from f_preplan_picture where equipment_id=?1"
,
nativeQuery
=
true
)
int
deletebyEqId
(
Long
id
);
List
<
PreplanPicture
>
findByEquipmentId
(
Long
equipmentId
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
62769d43
...
...
@@ -9,6 +9,7 @@ import com.yeejoin.amos.fas.business.action.model.SetpEnum;
import
com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher
;
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.mapper.PlanDetailMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
...
...
@@ -52,6 +53,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
FireEquipPointMapper
fireEquipPointMapper
;
...
...
@@ -82,6 +84,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired
private
ContingencyLogPublisher
contingencyLogPublisher
;
@Autowired
private
PlanDetailMapper
planDetailMapper
;
/**
* 创建预案执行记录
...
...
@@ -181,16 +185,19 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
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
);
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
String
plan
=
this
.
getNumberPlan
(
Long
.
parseLong
(
contingencyRo
.
getEquipmentId
()));
ruleTrigger
.
publish
(
contingencyRo
,
"换流站消防专项预案/"
+
plan
,
ArrayUtils
.
toArray
(
equipment
.
getName
()));
publisherPlanLog
(
stepCode
,
buttonCode
,
batchNo
);
}
...
...
@@ -301,4 +308,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
public
void
updateStep
(
String
step
,
String
batchNo
)
{
iContingencyOriginalDataDao
.
updateByButtonStep
(
step
,
batchNo
);
}
public
String
getNumberPlan
(
Long
id
)
{
String
ruleId
=
planDetailMapper
.
getRuleIdByEquipment
(
id
);
return
ruleId
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java
View file @
62769d43
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.component.rule.config.ClazzUtils
;
import
com.yeejoin.amos.fas.business.action.CustomerAction
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.param.AlarmParam
;
...
...
@@ -14,6 +15,7 @@ import com.yeejoin.amos.fas.common.enums.ExecutionTypeEnum;
import
com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum
;
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.*
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -23,7 +25,6 @@ import org.eclipse.paho.client.mqttv3.MqttException;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
...
...
@@ -60,8 +61,11 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
private
IEquipmentHandlerService
equipmentHandlerService
;
@Autowired
private
IContingencyPlanInstanceRepository
repository
;
@Value
(
"${number.plan.projectName}"
)
private
String
projectName
;
@Qualifier
(
"contingencyAction"
)
@Autowired
private
CustomerAction
customerAction
;
// @Value("${number.plan.projectName}")
// private String projectName;
private
final
PlanOperationRecordMapper
planOperationRecordMapper
;
private
final
IPlanDetailDao
planDetailDao
;
private
final
IPlanDocDao
planDocDao
;
...
...
@@ -74,7 +78,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
private
final
PlanDocMapper
planDocMapper
;
private
final
EmqKeeper
emqKeeper
;
private
final
IPlanClassifyTreeService
planClassifyTreeService
;
@Autowired
IContingencyInstance
iContingencyInstance
;
@Autowired
public
ContingencyPlanServiceImpl
(
IPlanDetailDao
planDetailDao
,
IPlanDocDao
planDocDao
,
IPlanEquipmentDao
planEquipmentDao
,
IPlanRuleDao
planRuleDao
,
IPlanClassifyTreeDao
classifyTreeDao
,
PlanDetailMapper
planDetailMapper
,
...
...
@@ -97,10 +102,11 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ContingencyPlanResponseVo
planStart
(
ContingencyPlanParamVo
vo
,
Toke
toke
)
{
public
ContingencyPlanResponseVo
planStart
(
ContingencyPlanParamVo
vo
,
Toke
toke
)
throws
Exception
{
ContingencyPlanResponseVo
result
=
new
ContingencyPlanResponseVo
();
//状态校验
ReserveEnum
reserveEnum
=
this
.
runCheck
(
vo
);
result
.
setMessage
(
reserveEnum
.
getText
());
if
(
ReserveEnum
.
THISRUNNING
.
getStatus
()
==
reserveEnum
.
getStatus
())
{
List
<
PlanOperationRecord
>
recordList
=
planOperationRecordDao
.
findByPlanId1
(
Long
.
valueOf
(
vo
.
getPlanId
()));
result
.
setMessage
(
ReserveEnum
.
THISRUNNING
.
getText
());
...
...
@@ -158,7 +164,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
String
batchNo
=
equipmentHandlerService
.
executeDynamicPlan
(
deviceData
,
equipment
,
equipmentSpecific
,
toke
,
operationRecord
.
getId
());
//更新模型状态
PlanDetail
planDetail
=
PlanDetailOp
.
get
();
planDetail
.
setStatus
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
());
planDetail
.
setStatus
(
vo
.
getStatus
());
planDetailDao
.
save
(
planDetail
);
//更新预案执行记录表的批次号
operationRecord
.
setBatchNo
(
batchNo
);
...
...
@@ -217,27 +223,43 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
//启动状态校验
public
ReserveEnum
runCheck
(
ContingencyPlanParamVo
vo
)
{
public
ReserveEnum
runCheck
(
ContingencyPlanParamVo
vo
)
throws
Exception
{
if
(
EquipmentRiskTypeEnum
.
HZGJ
.
getCode
().
equals
(
vo
.
getRiskType
())
||
StringUtils
.
isBlank
(
vo
.
getRiskType
()))
{
List
<
PlanOperationRecord
>
recordList
=
planOperationRecordDao
.
findByPlanId1
(
Long
.
valueOf
(
vo
.
getPlanId
()));
if
(
recordList
.
size
()
>
0
)
{
if
(
recordList
.
size
()
>
0
&&
vo
.
getStatus
()!=
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()
)
{
return
ReserveEnum
.
THISRUNNING
;
}
if
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
().
equals
(
vo
.
getStatus
()))
{
Integer
[]
statusArray
=
(
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
(),
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()).
toArray
();
int
count
=
planDetailDao
.
findByStatus
(
statusArray
);
if
(
count
>
NumberEnum
.
ZERO
.
getValue
())
{
List
<
PlanDetail
>
count
=
planDetailDao
.
findByStatus
(
statusArray
);
if
(
count
.
size
()
>
NumberEnum
.
ZERO
.
getValue
())
{
return
ReserveEnum
.
RUNNING
;
}
}
else
if
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
().
equals
(
vo
.
getStatus
()))
{
//自动启动
Integer
[]
statusArray
=
(
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()).
toArray
();
int
count
=
planDetailDao
.
findByStatus
(
statusArray
);
if
(
count
>
NumberEnum
.
ZERO
.
getValue
())
{
List
<
PlanDetail
>
countZd
=
planDetailDao
.
findByStatus
((
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()).
toArray
());
if
(
countZd
.
size
()
>
NumberEnum
.
ZERO
.
getValue
())
{
return
ReserveEnum
.
RUNNING
;
}
List
<
PlanDetail
>
countMn
=
planDetailDao
.
findByStatus
((
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
()).
toArray
());
if
(
countMn
.
size
()
>
NumberEnum
.
ZERO
.
getValue
())
{
List
<
PlanOperationRecord
>
planOperationRecordList
=
planOperationRecordDao
.
findByPlanId1
(
countMn
.
get
(
0
).
getId
());
if
(
planOperationRecordList
.
size
()>
0
){
Optional
<
Equipment
>
equipment
=
iContingencyInstance
.
fire
(
planOperationRecordList
.
get
(
0
).
getBatchNo
(),
"0"
,
""
,
"FIRE_CANCEL"
,
"CONFIRM"
,
"B"
);
// 结束预案,更新设备重点设备参数
equipment
.
ifPresent
(
equip
->
{
equip
.
setStartTime
(
DateUtil
.
getDateNow
());
equip
.
setEndTime
(
null
);
equip
.
setReserveSource
(
NumberEnum
.
ONE
.
getValue
());
equip
.
setStatus
(
NumberEnum
.
ONE
.
getValue
());
equipmentService
.
save
(
equip
);
});
customerAction
.
intreeuptPlan
(
planOperationRecordList
.
get
(
0
).
getBatchNo
());
}
}
}
else
{
return
ReserveEnum
.
PLANSTATUSERROR
;
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EquipmentServiceImpl.java
View file @
62769d43
...
...
@@ -85,6 +85,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Value
(
"${linux.img.path}"
)
private
String
linuxImgPath
;
@Value
(
"${server.servlet.context-path}"
)
private
String
fireAutoSys
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
...
...
@@ -331,6 +334,19 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Override
public
Equipment
saveEquipmentAndImg
(
ImgParam
[]
imgs
,
Equipment
equipment
)
{
String
path
=
FasConstant
.
UPLOAD_ROOT_PATH
+
File
.
separator
+
FasConstant
.
UPLOAD_EQUIPMENT_PATH
+
File
.
separator
+
equipment
.
getId
();
String
filePath
=
getRootPath
()
+
path
;
preplanPictureDao
.
deletebyEqId
(
equipment
.
getId
());
File
file1
=
new
File
(
filePath
);
if
(
file1
.
exists
()){
File
[]
files
=
file1
.
listFiles
();
if
(
files
.
length
>
0
){
for
(
File
f:
files
)
{
f
.
delete
();
}
}
}
// TODO Auto-generated method stub
if
(
imgs
==
null
||
imgs
.
length
<
1
)
{
equipment
=
save
(
equipment
);
...
...
@@ -369,9 +385,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
pp
.
setCreateDate
(
new
Date
());
}
String
path
=
FasConstant
.
UPLOAD_ROOT_PATH
+
File
.
separator
+
FasConstant
.
UPLOAD_EQUIPMENT_PATH
+
File
.
separator
+
equipment
.
getId
();
String
filePath
=
getRootPath
()
+
path
;
String
fileType
=
file
.
getOriginalFilename
().
substring
(
file
.
getOriginalFilename
().
lastIndexOf
(
"."
),
file
.
getOriginalFilename
().
length
());
...
...
@@ -390,7 +403,8 @@ public class EquipmentServiceImpl implements IEquipmentService {
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
String
[]
split
=
fireAutoSys
.
split
(
"/"
);
String
picture
=
split
[
1
]+
"/"
+
path
+
fileName
;
pp
.
setPicture
(
picture
);
preplanPictureDao
.
saveAndFlush
(
pp
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java
View file @
62769d43
...
...
@@ -39,6 +39,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.*
;
...
...
@@ -330,19 +331,19 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
}
// 获取遥信指标,暂不处理 code = 设备编码iot_code-指标项name_key
//
List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false
// Hash
Map<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"); //物联指标 非 true false
// Hash
Map<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);
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
//物联属性指标 and 为true或false
Map
<
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"
);
//物联指标 非 true false
Map
<
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
()));
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskFactorServiceImpl.java
View file @
62769d43
...
...
@@ -14,6 +14,8 @@ import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
...
...
@@ -44,14 +46,18 @@ public class RiskFactorServiceImpl implements IRiskFactorService {
long
total
=
riskFactorMapper
.
countPageData
(
param
);
List
<
HashMap
<
String
,
Object
>>
content
=
riskFactorMapper
.
queryRiskFactorPage
(
param
);
if
(!
CollectionUtils
.
isEmpty
(
content
)){
List
<
DictionarieValueModel
>
typeNameList
=
Systemctl
.
dictionarieClient
.
dictValues
(
"INDUSTRY_TYPE"
).
getResult
();
Map
<
String
,
String
>
typeName
=
typeNameList
.
stream
().
collect
(
Collectors
.
toMap
(
DictionarieValueModel:
:
getDictDataKey
,
DictionarieValueModel:
:
getDictDataValue
));
Set
<
String
>
userIds
=
new
HashSet
<>();
Set
<
String
>
deptIds
=
new
HashSet
<>();
for
(
HashMap
<
String
,
Object
>
map
:
content
)
{
map
.
put
(
"typeName"
,
typeName
.
get
(
map
.
get
(
"type"
)));
String
userId
=
String
.
valueOf
(
map
.
get
(
"createBy"
));
String
deptId
=
String
.
valueOf
(
map
.
get
(
"deptId"
));
userIds
.
add
(
userId
);
deptIds
.
add
(
deptId
);
}
userIds
.
remove
(
null
);
userIds
.
remove
(
""
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
62769d43
...
...
@@ -184,6 +184,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
IEquipManageFeign
iEquipManageFeign
;
@Autowired
private
PlanDetailMapper
planDetailMapper
;
public
static
String
cacheKeyForCanBeRunning
()
{
return
Redis
.
genKey
(
CacheType
.
ERASABLE
.
name
(),
"CONTINGENCYRUNING"
);
...
...
@@ -581,7 +583,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
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"
);
//物联指标 非 true false
HashMap
<
String
,
Double
>
telemetryMap
=
new
HashMap
<>();
for
(
Map
map
:
points
)
{
...
...
@@ -589,6 +591,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
contingencyRo
.
setTelemetryMap
(
telemetryMap
);
String
plan
=
this
.
getNumberPlan
(
Long
.
parseLong
(
contingencyRo
.
getEquipmentId
()));
log
.
debug
(
"开始调用规则"
);
Object
result
=
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
...
...
@@ -1915,5 +1918,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return
null
;
}
public
String
getNumberPlan
(
Long
id
){
String
ruleId
=
planDetailMapper
.
getRuleIdByEquipment
(
id
);
return
ruleId
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IContingencyInstance.java
View file @
62769d43
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
java.util.List
;
import
java.util.Optional
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
java.util.List
;
import
java.util.Optional
;
public
interface
IContingencyInstance
{
ContingencyPlanInstance
createInstanceRecord
(
String
instanceNo
,
String
category
,
String
subCategory
,
String
content
,
String
recordType
,
String
icon
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IContingencyPlanService.java
View file @
62769d43
...
...
@@ -25,7 +25,7 @@ public interface IContingencyPlanService {
String
DELETE_SYNC_PLAN_RULE
=
"urule/package/remove"
;
String
DELETE_SYNC_PLAN_EQUIP
=
"DELETE_SYNC_PLAN_EQUIP"
;
ContingencyPlanResponseVo
planStart
(
ContingencyPlanParamVo
vo
,
Toke
toke
);
ContingencyPlanResponseVo
planStart
(
ContingencyPlanParamVo
vo
,
Toke
toke
)
throws
Exception
;
ContingencyPlanParamVo
equipmentScene
(
Long
equipmentId
,
String
riskType
);
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/PlanDetailMapper.xml
View file @
62769d43
<?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">
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper"
>
<update
id=
"updatePlanStatusByIdList"
parameterType=
"list"
>
UPDATE c_plan_detail SET status = #{status} WHERE id IN
<foreach
collection=
"idList"
separator=
","
item=
"id"
open=
"("
close=
")"
>
#{id}
</foreach>
</update>
<update
id=
"updateIsDeleteByIdList"
parameterType=
"list"
>
UPDATE c_plan_detail SET is_delete = #{isDelete} WHERE id IN
<foreach
collection=
"idList"
separator=
","
item=
"id"
open=
"("
close=
")"
>
#{id}
</foreach>
</update>
<select
id=
"filterCount"
parameterType=
"string"
resultType=
"int"
>
SELECT
count(1)
...
...
@@ -49,7 +49,7 @@
AND is_delete = 0
</where>
</select>
<select
id=
"filterList"
parameterType=
"string"
resultType=
"com.yeejoin.amos.fas.business.vo.PlanDetailVo"
>
SELECT
id
...
...
@@ -103,4 +103,17 @@
ORDER BY create_date ASC
LIMIT #{start}, #{size}
</select>
<select
id=
"getRuleIdByEquipment"
parameterType=
"java.lang.Long"
resultType=
"java.lang.String"
>
SELECT
rule_id
FROM
c_plan_detail cpd
LEFT JOIN c_plan_rule rule ON rule.plan_id = cpd.id
LEFT JOIN c_plan_equipment equip ON equip.plan_id = cpd.id
LEFT JOIN f_equipment equipment ON equipment.id = equip.fire_equipment_id
where
equipment.id = #{id}
</select>
</mapper>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_equipment_specific.xml
View file @
62769d43
...
...
@@ -63,17 +63,19 @@
limit #{pageNumber},#{pageSize}
</select>
<select
id=
"getEquipmentBySpeCount"
resultType=
"int"
>
select
<select
id=
"getEquipmentBySpeCount"
resultType=
"int"
>
select
count(1)
from
wl_stock_detail as sto
left join wl_equipment_specific as spe on sto.qr_code = spe.qr_code
<if
test=
"equipmentId != null and equipmentId!='null' "
>
left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id
</if>
left join wl_warehouse_structure as ware on sto.warehouse_structure_id = ware.source_id
left join wl_equipment_detail as det on sto.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cate on equ.category_id = cate.id
left join f_
equipment_fire_equipment as fire on sto.id = fire.fire_equipment_
id
left join f_
fire_fighting_system as manage on spe.system_id = manage.
id
where sto.amount
<![CDATA[>]]>
0
<if
test=
"name != null and name!='null' "
>
and det.name like CONCAT('%',#{name},'%' )
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
View file @
62769d43
...
...
@@ -165,7 +165,8 @@
WHEN 'false' THEN '否'
ELSE ind.value END 'e_value',
ein.unit as eq_point_unit,
sce.name as source_name,
str.full_name as source_name,
-- sce.name as source_name,
(
SELECT
group_concat(DISTINCT f.`name`)
...
...
@@ -183,7 +184,7 @@
left join wl_equipment_index as ein on ind.equipment_index_id = ein.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as sce on str.source_id = sce.source_id
--
left join f_risk_source as sce on str.source_id = sce.source_id
) d
WHERE
1 = 1
...
...
pom.xml
View file @
62769d43
...
...
@@ -34,8 +34,8 @@
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-rule
</artifactId>
<version>
1.
2.0
-SNAPSHOT
</version>
</dependency>
<version>
1.
4.4
-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
...
...
@@ -123,13 +123,13 @@
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<artifactId>
jackson-databind
</artifactId>
</dependency>
<dependency>
<groupId>
org.codehaus.jackson
</groupId>
<artifactId>
jackson-jaxrs
</artifactId>
<version>
1.9.11
</version>
</dependency>
</dependency>
<!-- 通用Mapper -->
<dependency>
...
...
@@ -143,8 +143,8 @@
</dependency>
<dependency>
<groupId>
org.liquibase
</groupId>
<artifactId>
liquibase-core
</artifactId>
</dependency>
<artifactId>
liquibase-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
...
...
@@ -171,10 +171,10 @@
</dependency>
<!-- 预案突发事件websocket -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
...
...
@@ -213,7 +213,7 @@
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>
Releases
</id>
...
...
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