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
49dec6b2
Commit
49dec6b2
authored
Sep 30, 2022
by
maoying
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_upgrade' of…
Merge branch 'dev_upgrade' of
http://39.98.45.134:8090/station/YeeAmosFireAutoSysRoot
into dev_upgrade
parents
c9e6635d
93984635
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
1708 additions
and
1336 deletions
+1708
-1336
DutyPersonEnum.java
...ava/com/yeejoin/amos/fas/common/enums/DutyPersonEnum.java
+77
-0
pom.xml
YeeAmosFireAutoSysService/pom.xml
+15
-1
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+260
-326
ContingencyPlanController.java
...os/fas/business/controller/ContingencyPlanController.java
+6
-0
LoginController.java
...yeejoin/amos/fas/business/controller/LoginController.java
+2
-2
PlanVisual3dController.java
.../amos/fas/business/controller/PlanVisual3dController.java
+19
-13
View3dController.java
...eejoin/amos/fas/business/controller/View3dController.java
+10
-7
PlanOperationRecordMapper.java
...os/fas/business/dao/mapper/PlanOperationRecordMapper.java
+3
-0
IContingencyPlanInstanceRepository.java
...ss/dao/repository/IContingencyPlanInstanceRepository.java
+3
-0
IPlanOperationRecordDao.java
.../fas/business/dao/repository/IPlanOperationRecordDao.java
+1
-0
JcsFeign.java
...in/java/com/yeejoin/amos/fas/business/feign/JcsFeign.java
+38
-0
RemoteSecurityService.java
...eejoin/amos/fas/business/feign/RemoteSecurityService.java
+13
-24
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+10
-1
ContingencyPlanServiceImpl.java
...fas/business/service/impl/ContingencyPlanServiceImpl.java
+7
-0
HandlerMqttMessageImpl.java
...mos/fas/business/service/impl/HandlerMqttMessageImpl.java
+1
-1
PlanRuleServiceImpl.java
...n/amos/fas/business/service/impl/PlanRuleServiceImpl.java
+40
-0
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+63
-37
View3dServiceImpl.java
...oin/amos/fas/business/service/impl/View3dServiceImpl.java
+64
-5
IContingencyPlanService.java
...s/fas/business/service/intfc/IContingencyPlanService.java
+1
-0
IPlanRuleService.java
...oin/amos/fas/business/service/intfc/IPlanRuleService.java
+8
-0
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+4
-0
IView3dService.java
...ejoin/amos/fas/business/service/intfc/IView3dService.java
+7
-1
PlanStepVo.java
...ain/java/com/yeejoin/amos/fas/business/vo/PlanStepVo.java
+10
-0
PermissionAspect.java
...in/java/com/yeejoin/amos/fas/config/PermissionAspect.java
+167
-167
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+8
-4
application-docker.properties
...SysStart/src/main/resources/application-docker.properties
+8
-4
application-test.properties
...toSysStart/src/main/resources/application-test.properties
+8
-4
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+4
-0
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+749
-739
PlanOperationRecordMapper.xml
...rc/main/resources/db/mapper/PlanOperationRecordMapper.xml
+9
-0
plan-step.json
...osFireAutoSysStart/src/main/resources/json/plan-step.json
+93
-0
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/common/enums/DutyPersonEnum.java
0 → 100644
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
common
.
enums
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
*0、运行中,1、完毕,3、中断
* @author suhg
*/
public
enum
DutyPersonEnum
{
FIRE_PERSON
(
"驻站消防"
,
"fire"
),
OPS_PERSON
(
"运维人员"
,
"ops"
),
REAL_PERSON
(
"物业安保"
,
"realEstate"
);
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 颜色
*/
private
String
color
;
private
DutyPersonEnum
(
String
name
,
String
code
){
this
.
name
=
name
;
this
.
code
=
code
;
}
public
static
DutyPersonEnum
getEnum
(
String
code
)
{
DutyPersonEnum
checkStatusEnum
=
null
;
for
(
DutyPersonEnum
type:
DutyPersonEnum
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
checkStatusEnum
=
type
;
break
;
}
}
return
checkStatusEnum
;
}
public
static
List
<
Map
<
String
,
Object
>>
getEnumList
()
{
List
<
Map
<
String
,
Object
>>
nameList
=
new
ArrayList
<>();
for
(
DutyPersonEnum
c:
DutyPersonEnum
.
values
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"name"
,
c
.
getName
());
map
.
put
(
"code"
,
c
.
getCode
());
nameList
.
add
(
map
);
}
return
nameList
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
YeeAmosFireAutoSysService/pom.xml
View file @
49dec6b2
...
...
@@ -136,7 +136,21 @@
<version>
6.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-authtoken
</artifactId>
<version>
1.7.13-SNAPSHOT
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
io.springfox
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
49dec6b2
...
...
@@ -22,6 +22,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.JcsFeign
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl
;
import
com.yeejoin.amos.fas.business.service.intfc.*
;
...
...
@@ -36,6 +37,7 @@ import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
...
...
@@ -75,6 +77,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired
private
WebMqttComponent
webMqttComponent
;
@Autowired
private
JcsFeign
jcsFeign
;
@Value
(
"${auto-sys.push.type}"
)
private
String
pushType
;
@Value
(
"${spring.application.name}"
)
...
...
@@ -119,6 +124,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired
private
PlanDetailMapper
planDetailMapper
;
@Autowired
private
IPlanRuleService
planRuleService
;
@Value
(
"${rocket-plan-topic}"
)
private
String
rocketTopic
;
...
...
@@ -177,30 +185,19 @@ public class ContingencyAction implements CustomerAction {
stringStringMap
=
new
HashMap
<>();
returnMap
=
new
HashMap
<>();
Date
curDate
=
new
Date
();
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"dutyDate"
,
curDate
);
Toke
toke
=
remoteSecurityService
.
getServerToken
();
CommonResponse
commonResponse
=
dutyModeServer
.
dutyListByDate
(
toke
.
getAppKey
(),
toke
.
getProduct
(),
toke
.
getToke
(),
orgCode
,
param
.
toJSONString
());
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
// JSONObject jsonObject = JSONObject.parseObject(result);
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString());
String
JSONStr
=
JSON
.
toJSONString
(
commonResponse
.
getDataList
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
log
.
info
(
String
.
format
(
"请求值班系统返回dataList:%s"
,
dataList
));
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
Map
<
String
,
String
>
finalReturnMap
=
returnMap
;
dataList
.
forEach
(
x
->
{
JSONObject
obj
=
(
JSONObject
)
x
;
String
name
=
obj
.
getString
(
"position"
);
finalReturnMap
.
put
(
name
,
obj
.
getString
(
"dutyName"
));
}
);
ResponseModel
responseModel
=
jcsFeign
.
dutyPersonList
();
if
(
"SUCCESS"
.
equals
(
responseModel
.
getDevMessage
()))
{
String
JSONStr
=
JSON
.
toJSONString
(
responseModel
.
getResult
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
Map
<
String
,
String
>
finalReturnMap
=
returnMap
;
dataList
.
forEach
(
x
->
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
JSONObject
obj
=
(
JSONObject
)
x
;
finalReturnMap
.
put
(
obj
.
getString
(
"postTypeName"
),
obj
.
getString
(
"userName"
));
});
}
}
stringStringMap
.
put
(
batchNo
,
returnMap
);
}
...
...
@@ -216,33 +213,32 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"步骤更新"
,
project
=
"换流站消防专项预案"
)
public
void
stepInfo
(
@MethodParam
(
paramLabel
=
"当前步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"当前步骤名称"
)
String
stepName
,
@MethodParam
(
paramLabel
=
"下一步编号"
)
String
nextStepCode
,
@MethodParam
(
paramLabel
=
"下一步名称"
)
String
nextStepName
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
stepInfo
(
@MethodParam
(
paramLabel
=
"当前步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"当前步骤名称"
)
String
stepName
,
@MethodParam
(
paramLabel
=
"下一步编号"
)
String
nextStepCode
,
@MethodParam
(
paramLabel
=
"下一步名称"
)
String
nextStepName
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
ArrayList
list
=
new
ArrayList
();
HashMap
step
=
new
HashMap
();
step
.
put
(
"stepCode"
,
stepCode
);
step
.
put
(
"stepName"
,
stepName
);
HashMap
nextmap
=
new
HashMap
();
nextmap
.
put
(
"stepCode"
,
nextStepCode
);
nextmap
.
put
(
"stepName"
,
nextStepName
);
list
.
add
(
step
);
list
.
add
(
nextmap
);
tempmap1
.
put
(
"step"
,
list
);
tempmap1
.
put
(
"preStep"
,
new
HashMap
());
result
.
add
(
tempmap1
);
log
.
info
(
"步骤更新(new)"
+
JSONObject
.
toJSONString
(
result
));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
ArrayList
list
=
new
ArrayList
();
HashMap
step
=
new
HashMap
();
step
.
put
(
"stepCode"
,
stepCode
);
step
.
put
(
"stepName"
,
stepName
);
HashMap
nextmap
=
new
HashMap
();
nextmap
.
put
(
"stepCode"
,
nextStepCode
);
nextmap
.
put
(
"stepName"
,
nextStepName
);
list
.
add
(
step
);
list
.
add
(
nextmap
);
tempmap1
.
put
(
"step"
,
list
);
tempmap1
.
put
(
"preStep"
,
new
HashMap
());
result
.
add
(
tempmap1
);
log
.
info
(
"步骤更新(new)"
+
JSONObject
.
toJSONString
(
result
));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
}
/**
...
...
@@ -250,42 +246,11 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"步骤更新(旧)"
,
project
=
"换流站消防专项预案"
)
public
void
stepInfoOld
(
@MethodParam
(
paramLabel
=
"当前编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
stepInfoOld
(
@MethodParam
(
paramLabel
=
"当前编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
// Map<String, Object> tempmap1 = new HashMap<>();
// SetpEnum[] stepArr = SetpEnum.values();
// ArrayList list = new ArrayList();
// HashMap preStep = new HashMap();
// StepComparator comparator = new StepComparator();
// Arrays.sort(stepArr, comparator);
//
// boolean flage = false;
// SetpEnum pstep = null;
// for (SetpEnum step : stepArr) {
// if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
// if (!ObjectUtils.isEmpty(pstep)) {
// preStep.put("stepCode", pstep.getValue());
// preStep.put("stepName", pstep.getTitle());
// }
// flage = true;
// }
// if (flage) {
// HashMap map = new HashMap();
// map.put("stepCode", step.getValue());
// map.put("stepName", step.getTitle());
// list.add(map);
// }
// pstep = step;
// }
//
// tempmap1.put("step", list);
// tempmap1.put("preStep", preStep);
// result.add(tempmap1);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
...
...
@@ -296,9 +261,7 @@ public class ContingencyAction implements CustomerAction {
ro
.
setTelesignallingMap
(
null
);
Constructor
<?>
constructor
;
try
{
constructor
=
Class
.
forName
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
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
());
...
...
@@ -338,9 +301,7 @@ public class ContingencyAction implements CustomerAction {
ro
.
setTelesignallingMap
(
null
);
Constructor
<?>
constructor
;
try
{
constructor
=
Class
.
forName
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
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"
);
...
...
@@ -365,7 +326,10 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"步骤更新保存"
,
project
=
"换流站消防专项预案"
)
public
void
saveStepInfo
(
@MethodParam
(
paramLabel
=
"当前编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
iContingencyInstance
.
updateStep
(
stepCode
,
contingencyRo
.
getBatchNo
());
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
iContingencyInstance
.
updateStep
(
stepCode
,
contingencyRo
.
getBatchNo
());
}
}
...
...
@@ -376,35 +340,38 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"执行记录"
,
project
=
"换流站消防专项预案"
)
public
void
messageRecord
(
@MethodParam
(
paramLabel
=
"消息内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
//转换content中的变量
content
=
instedParams
(
content
,
contingencyRo
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
content
,
"MESSAGE"
,
""
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
try
{
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf1
.
format
(
action
.
getCreateDate
().
getTime
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
//转换content中的变量
content
=
instedParams
(
content
,
contingencyRo
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
content
,
"MESSAGE"
,
""
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
try
{
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf1
.
format
(
action
.
getCreateDate
().
getTime
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
}
tempmap1
.
put
(
"content"
,
records
);
tempmap1
.
put
(
"status"
,
PlanRecordStatusEnum
.
OPERATION
.
getCode
());
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
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
);
}
result
.
add
(
tempmap1
);
System
.
out
.
println
(
"--------------------messageRecord----------------------"
+
result
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
this
.
sendweb
(
"recordarea"
,
paramObj
,
result
);
}
/**
...
...
@@ -421,34 +388,29 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"智能辅助"
,
project
=
"换流站消防专项预案"
)
public
void
help
(
@MethodParam
(
paramLabel
=
"当前步骤"
)
String
step
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"图片集"
)
String
image
,
@MethodParam
(
paramLabel
=
"表格数据"
)
String
table
,
@MethodParam
(
paramLabel
=
"文本内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
help
(
@MethodParam
(
paramLabel
=
"当前步骤"
)
String
step
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"图片集"
)
String
image
,
@MethodParam
(
paramLabel
=
"表格数据"
)
String
table
,
@MethodParam
(
paramLabel
=
"文本内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
//转换智能辅助中的变量
content
=
instedParams
(
content
,
contingencyRo
);
//转换智能辅助中的变量
content
=
instedParams
(
content
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"step"
,
step
);
tempmap1
.
put
(
"title"
,
title
);
tempmap1
.
put
(
"content"
,
content
);
tempmap1
.
put
(
"image"
,
image
);
tempmap1
.
put
(
"table"
,
table
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
/*JSONObject.toJSONString(tempmap1)*/
JSONUtil
.
toJson
(
tempmap1
),
"HELPAREA"
,
""
);
// tempmap1.put("batchNo", contingencyRo.getBatchNo());
// tempmap1.put("contingencyRo", contingencyRo);
result
.
add
(
tempmap1
);
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"step"
,
step
);
tempmap1
.
put
(
"title"
,
title
);
tempmap1
.
put
(
"content"
,
content
);
tempmap1
.
put
(
"image"
,
image
);
tempmap1
.
put
(
"table"
,
table
);
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
JSONUtil
.
toJson
(
tempmap1
),
"HELPAREA"
,
""
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"helparea"
,
paramObj
,
result
);
this
.
sendcmd
(
"helparea"
,
paramObj
,
result
);
}
}
...
...
@@ -462,8 +424,7 @@ public class ContingencyAction implements CustomerAction {
Method
getMethod
=
null
;
try
{
for
(
Field
field
:
fields
)
{
if
(
field
.
getName
().
equals
(
"serialVersionUID"
))
continue
;
if
(
field
.
getName
().
equals
(
"serialVersionUID"
))
continue
;
String
fileNameInMethod
=
String
.
valueOf
(
field
.
getName
().
charAt
(
0
)).
toUpperCase
()
+
field
.
getName
().
substring
(
1
);
getMethod
=
contingencyRo
.
getClass
().
getMethod
(
"get"
+
fileNameInMethod
);
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
...
...
@@ -483,11 +444,9 @@ public class ContingencyAction implements CustomerAction {
while
(
m
.
find
())
{
String
parameter
=
m
.
group
();
Object
parametervalue
=
ELEvaluationContext
.
getValue
(
parameter
.
substring
(
1
,
parameter
.
length
()
-
1
));
Object
parametervalue
=
ELEvaluationContext
.
getValue
(
parameter
.
substring
(
1
,
parameter
.
length
()
-
1
));
if
(
parametervalue
!=
null
)
str
=
str
.
replace
(
parameter
,
parametervalue
!=
null
?
parametervalue
.
toString
()
:
null
);
str
=
str
.
replace
(
parameter
,
parametervalue
!=
null
?
parametervalue
.
toString
()
:
null
);
}
return
str
;
}
...
...
@@ -502,49 +461,34 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"交互动作"
,
project
=
"换流站消防专项预案"
)
public
void
operation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
public
void
operation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
//转换content中的变量
tips
=
instedParams
(
tips
,
contingencyRo
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>(
);
//转换content中的变量
tips
=
instedParams
(
tips
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
tempmap1
.
put
(
"actionName"
,
actionName
);
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"tips"
,
tips
);
tempmap1
.
put
(
"button"
,
buttonJson
);
tempmap1
.
put
(
"caseId"
,
contingencyPlanId
);
result
.
add
(
tempmap1
);
tempmap1
.
put
(
"actionName"
,
actionName
);
tempmap1
.
put
(
"icon"
,
icon
);
tempmap1
.
put
(
"tips"
,
tips
);
tempmap1
.
put
(
"button"
,
buttonJson
);
tempmap1
.
put
(
"caseId"
,
contingencyPlanId
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"optionarea"
,
paramObj
,
result
);
this
.
sendcmd
(
"optionarea"
,
paramObj
,
result
);
}
}
private
boolean
sendButton
(
String
batchNo
,
String
contingencyPlanId
,
String
equipmentId
,
String
actionName
,
String
buttonJson
)
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
/**
* batchNo
* stepCode
* buttonCode
* confirm
* contingencyPlanId
* stepState
*/
try
{
Map
button
=
objectMapper
.
readValue
(
buttonJson
,
Map
.
class
);
Map
operateInstance
=
(
Map
)
((
List
)
button
.
get
(
"operate"
)).
get
(
0
);
...
...
@@ -557,11 +501,9 @@ public class ContingencyAction implements CustomerAction {
contingencyDeviceStatus
.
setStepCode
(
String
.
valueOf
(
button
.
get
(
"stepCode"
)));
contingencyDeviceStatus
.
setStepState
(
String
.
valueOf
(
operateInstance
.
get
(
"stepState"
)));
riskSourceService
.
queryContingencyDeviceStatus
(
contingencyDeviceStatus
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
false
;
}
...
...
@@ -576,39 +518,35 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"保存交互动作"
,
project
=
"换流站消防专项预案"
)
public
void
saveOperation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
saveOperation
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
//转换content中的变量
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
try
{
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
// map.put("time", sdf.format(action.getCreateDate()));
map
.
put
(
"time"
,
sdf1
.
format
(
action
.
getCreateDate
().
getTime
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
//转换content中的变量
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
try
{
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
ContingencyPlanInstance
>
list
=
iContingencyInstance
.
queryForTimeLine
(
contingencyRo
.
getBatchNo
(),
"MESSAGE"
);
ArrayList
records
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
action
->
{
HashMap
map
=
new
HashMap
();
map
.
put
(
"time"
,
sdf1
.
format
(
action
.
getCreateDate
().
getTime
()));
map
.
put
(
"stepName"
,
action
.
getContent
());
records
.
add
(
map
);
});
}
tempmap1
.
put
(
"content"
,
records
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
tempmap1
.
put
(
"content"
,
records
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"recordarea"
,
paramObj
,
result
);
}
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
)
{
...
...
@@ -636,44 +574,42 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"地图动作"
,
project
=
"换流站消防专项预案"
)
public
void
mapAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
log
.
error
(
"======================================================================================="
);
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"key"
,
actionName
);
tempmap1
.
put
(
"content"
,
paramJSON
);
if
(
isArea
.
contains
(
paramJSON
))
{
tempmap1
.
put
(
"isArea"
,
true
);
}
else
{
tempmap1
.
put
(
"isArea"
,
false
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"key"
,
actionName
);
tempmap1
.
put
(
"content"
,
paramJSON
);
if
(
isArea
.
contains
(
paramJSON
))
{
tempmap1
.
put
(
"isArea"
,
true
);
}
else
{
tempmap1
.
put
(
"isArea"
,
false
);
}
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"maparea"
,
paramObj
,
result
);
}
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"maparea"
,
paramObj
,
result
);
}
@RuleMethod
(
methodLabel
=
"地图动画"
,
project
=
"换流站消防专项预案"
)
public
void
mapCartoonAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"动作类型"
)
String
actionType
,
@MethodParam
(
paramLabel
=
"动作类型参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
mapCartoonAction
(
@MethodParam
(
paramLabel
=
"动作名称标识"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"动作类型"
)
String
actionType
,
@MethodParam
(
paramLabel
=
"动作类型参数"
)
String
paramJSON
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
log
.
error
(
"======================================================================================="
);
stopSnapshop
(
contingencyRo
);
String
parameter
=
instedParams
(
paramJSON
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"key"
,
actionName
);
tempmap1
.
put
(
"content"
,
actionType
);
tempmap1
.
put
(
"parameter"
,
parameter
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"maparea"
,
paramObj
,
result
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
String
parameter
=
instedParams
(
paramJSON
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
tempmap1
.
put
(
"key"
,
actionName
);
tempmap1
.
put
(
"content"
,
actionType
);
tempmap1
.
put
(
"parameter"
,
parameter
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"maparea"
,
paramObj
,
result
);
}
}
/**
...
...
@@ -684,27 +620,25 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod
(
methodLabel
=
"消息提示"
,
project
=
"换流站消防专项预案"
)
public
void
topMessage
(
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"类型"
)
String
messageType
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
public
void
topMessage
(
@MethodParam
(
paramLabel
=
"标题"
)
String
title
,
@MethodParam
(
paramLabel
=
"内容"
)
String
content
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"类型"
)
String
messageType
,
@MethodParam
(
paramLabel
=
"对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
stopSnapshop
(
contingencyRo
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
stopSnapshop
(
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//转换content中的变量
content
=
instedParams
(
content
,
contingencyRo
);
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//转换content中的变量
content
=
instedParams
(
content
,
contingencyRo
);
tempmap1
.
put
(
"content"
,
content
);
tempmap1
.
put
(
"type"
,
messageType
);
//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
tempmap1
.
put
(
"title"
,
title
);
tempmap1
.
put
(
"icon"
,
icon
);
result
.
add
(
tempmap1
);
tempmap1
.
put
(
"content"
,
content
);
tempmap1
.
put
(
"type"
,
messageType
);
//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
tempmap1
.
put
(
"title"
,
title
);
tempmap1
.
put
(
"icon"
,
icon
);
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
}
/**
...
...
@@ -817,55 +751,51 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"换流站消防专项预案"
)
public
void
autoExecute
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
public
void
autoExecute
(
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
Toke
toke
=
remoteSecurityService
.
getServerToken
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
iContingencyInstance
.
setButtonExecuted
(
contingencyRo
.
getBatchNo
(),
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
);
iContingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
,
stepState
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Toke
toke
=
remoteSecurityService
.
getServerToken
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
iContingencyInstance
.
setButtonExecuted
(
contingencyRo
.
getBatchNo
(),
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
);
iContingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanInstance
.
getId
(),
buttonCode
,
"CONFIRM"
,
stepState
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@RuleMethod
(
methodLabel
=
"添加步骤执行"
,
project
=
"换流站消防专项预案"
)
public
void
addExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
if
(
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
equipemtnPoints
=
new
HashMap
<>();
public
void
addExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"设备数据"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
content
.
put
(
"stepCode"
,
stepCode
);
content
.
put
(
"buttonCode"
,
buttonCode
);
DeviceRo
ro
=
(
DeviceRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
ro
.
getEquipmentId
());
if
(
ObjectUtils
.
isEmpty
(
equipemtnPoints
))
{
equipemtnPoints
=
new
HashMap
<>();
}
equipemtnPoints
.
put
(
stepCode
+
"-"
+
buttonCode
,
content
);
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
}
equipemtnPoints
.
put
(
stepCode
+
"-"
+
buttonCode
,
content
);
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
ro
,
result
);
}
@RuleMethod
(
methodLabel
=
"清除步骤执行"
,
project
=
"换流站消防专项预案"
)
public
void
clearExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"重点设备ID"
)
String
fireEquipmentId
)
{
public
void
clearExecute
(
@MethodParam
(
paramLabel
=
"步骤编号"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"重点设备ID"
)
String
fireEquipmentId
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
content
=
new
HashMap
<>();
...
...
@@ -890,45 +820,38 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod
(
methodLabel
=
"同步自动执行步骤"
,
project
=
"换流站消防专项预案"
)
public
void
sendExecute
(
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
contingencyRo
.
getEquipmentId
());
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
ObjectUtils
.
isEmpty
(
equipemtnPoints
)
?
new
ArrayList
<>()
:
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
SafteyPlanResult
result
=
new
SafteyPlanResult
();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
Map
<
String
,
Object
>
equipemtnPoints
=
pointCache
.
get
(
contingencyRo
.
getEquipmentId
());
tempmap1
.
put
(
"type"
,
"buttonCache"
);
tempmap1
.
put
(
"content"
,
ObjectUtils
.
isEmpty
(
equipemtnPoints
)
?
new
ArrayList
<>()
:
equipemtnPoints
.
values
());
result
.
add
(
tempmap1
);
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
}
}
@RuleMethod
(
methodLabel
=
"自动执行动作V2"
,
project
=
"换流站消防专项预案"
)
public
void
autoExecuteActionV2
(
@MethodParam
(
paramLabel
=
"步骤编码"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"按钮状态"
)
String
confirm
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
public
void
autoExecuteActionV2
(
@MethodParam
(
paramLabel
=
"步骤编码"
)
String
stepCode
,
@MethodParam
(
paramLabel
=
"按钮编码"
)
String
buttonCode
,
@MethodParam
(
paramLabel
=
"按钮状态"
)
String
confirm
,
@MethodParam
(
paramLabel
=
"步骤状态"
)
String
stepState
,
@MethodParam
(
paramLabel
=
"动作名称"
)
String
actionName
,
@MethodParam
(
paramLabel
=
"图标"
)
String
icon
,
@MethodParam
(
paramLabel
=
"提示信息"
)
String
tips
,
@MethodParam
(
paramLabel
=
"按钮json字符串"
)
String
buttonJson
,
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
try
{
contingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
String
batchNo
=
contingencyRo
.
getBatchNo
();
if
(!
findByBatchNoAndStatus
(
batchNo
))
{
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
try
{
contingencyInstance
.
fire
(
contingencyRo
.
getBatchNo
(),
stepCode
,
contingencyPlanId
,
buttonCode
,
confirm
,
stepState
,
RequestContext
.
getToken
(),
RequestContext
.
getProduct
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
public
void
sendcmd
(
String
msgType
,
SafteyPlanResult
result
)
{
Constructor
<?>
constructor
;
try
{
constructor
=
Class
.
forName
(
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
.
getConstructor
(
ActionResult
.
class
);
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
,
null
,
result
.
toJson
());
...
...
@@ -971,7 +894,9 @@ public class ContingencyAction implements CustomerAction {
result
.
add
(
tempmap1
);
//数字预案业务屏web端发送消息
this
.
sendweb
(
"recordarea"
,
contingencyRo
,
result
);
updateNumberPlan
(
contingencyRo
.
getBatchNo
());
updateNumberPlan
(
batchNo
);
// 应急处置中断,初始化planStep,json数据
planRuleService
.
updatePlanRuleByBatchNo
(
batchNo
);
}
/**
...
...
@@ -996,4 +921,13 @@ public class ContingencyAction implements CustomerAction {
}
}
}
/**
* 通过batchNo获取预案的状态
* @param batchNo
* @return
*/
private
Boolean
findByBatchNoAndStatus
(
String
batchNo
)
{
return
CollectionUtils
.
isEmpty
(
planOperationRecordDao
.
findByBatchNoAndStatus
(
batchNo
,
0
));
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/ContingencyPlanController.java
View file @
49dec6b2
...
...
@@ -232,4 +232,10 @@ public class ContingencyPlanController extends BaseController {
return
CommonResponseUtil2
.
success
(
bool
);
}
@ApiOperation
(
value
=
"获取预案状态"
)
@RequestMapping
(
value
=
"/getPlanStatus"
,
method
=
RequestMethod
.
GET
)
public
ResponseModel
getPlanStatus
()
{
return
CommonResponseUtil2
.
success
(
contingencyPlanService
.
getPlanStatus
());
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/LoginController.java
View file @
49dec6b2
...
...
@@ -64,10 +64,10 @@ public class LoginController {
@Value
(
"${outSystem.user.password}"
)
private
String
password
;
@Value
(
"${
security.productWeb
}"
)
@Value
(
"${
amos.system.user.product
}"
)
private
String
product
;
@Value
(
"${
security.appK
ey}"
)
@Value
(
"${
amos.system.user.app-k
ey}"
)
private
String
appKey
;
@ApiOperation
(
value
=
"通过userId登录"
,
notes
=
"查询设备指标"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanVisual3dController.java
View file @
49dec6b2
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.config.Permission
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
...
...
@@ -10,6 +11,7 @@ import com.yeejoin.amos.fas.dao.entity.TextPlan;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -128,40 +130,44 @@ public class PlanVisual3dController extends BaseController {
List
<
Map
<
String
,
Object
>>
list
=
planVisual3dService
.
getResourceById
(
type
,
id
);
return
CommonResponseUtil
.
success
(
list
);
}
@Permission
@ApiOperation
(
value
=
"预案应用树"
,
notes
=
"预案应用树"
)
@GetMapping
(
value
=
"/plan/textPlanTree/{appId}"
)
public
CommonResponse
getPlanTree
(
@PathVariable
(
"appId"
)
String
appId
)
{
return
CommonResponseUtil
.
success
(
planVisual3dService
.
getTextPlanBySubjectId
(
appId
));
}
@Permission
@ApiOperation
(
value
=
"删除预案文件"
,
notes
=
"删除预案文件"
)
@DeleteMapping
(
value
=
"/plan/textPlan/{id}"
)
public
CommonResponse
deleteTextPlanFile
(
@PathVariable
(
"id"
)
Long
id
)
{
try
{
planVisual3dService
.
deleteTextPlanFile
(
id
);
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
try
{
planVisual3dService
.
deleteTextPlanFile
(
id
);
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
@Permission
@ApiOperation
(
value
=
"根据批次号获取预案的步骤"
,
notes
=
"根据批次号获取预案的步骤"
)
@GetMapping
(
value
=
"/plan/getPlanStep"
)
public
ResponseModel
getPlanStep
(
@RequestParam
(
"batchNo"
)
String
batchNo
)
{
if
(
!
StringUtil
.
isNot
Empty
(
batchNo
))
{
public
ResponseModel
getPlanStep
(
@RequestParam
(
value
=
"batchNo"
,
required
=
false
)
String
batchNo
)
{
if
(
StringUtils
.
is
Empty
(
batchNo
))
{
batchNo
=
planVisual3dService
.
getNewestBatchNo
();
}
if
(!
StringUtil
.
isNotEmpty
(
batchNo
))
{
return
CommonResponseUtil
.
successNew
(
null
);
}
return
CommonResponseUtil
.
successNew
(
planVisual3dService
.
getPlanStepByBatchNo
(
batchNo
));
}
@Permission
@ApiOperation
(
value
=
"根据批次号更新预案的步骤"
,
notes
=
"根据批次号更新预案的步骤"
)
@PostMapping
(
value
=
"/plan/updatePlanStep"
)
public
ResponseModel
updatePlanStep
(
@RequestBody
PlanStepVo
planStepVo
)
{
return
CommonResponseUtil
.
successNew
(
planVisual3dService
.
updatePlanStep
(
planStepVo
));
}
@Permission
@ApiOperation
(
value
=
"根据批次号获取预案的记录"
,
notes
=
"根据R批次号获取预案的记录"
)
@GetMapping
(
value
=
"/plan/getPlaneRecord"
)
public
ResponseModel
getPlaneRecord
(
@RequestParam
(
"batchNo"
)
String
batchNo
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/View3dController.java
View file @
49dec6b2
...
...
@@ -180,13 +180,7 @@ public class View3dController extends BaseController {
@ApiOperation
(
value
=
"今日值班统计"
,
notes
=
"今日值班统计"
)
@GetMapping
(
value
=
"statistics/duty"
)
public
CommonResponse
getStatisticsDuty
(){
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
orgCode
=
this
.
getOrgCode
(
reginParams
);
appKey
=
getAppKey
();
product
=
getProduct
();
staticOrgCode
=
orgCode
;
token
=
getToken
();
return
view3dService
.
getStatisticsDuty
(
getAppKey
(),
getProduct
(),
token
,
orgCode
);
return
CommonResponseUtil
.
success
(
view3dService
.
getStatisticsDuty
());
}
@Permission
...
...
@@ -332,6 +326,15 @@ public class View3dController extends BaseController {
return
CommonResponseUtil
.
success
(
view3dService
.
listPointsByRegionId
(
regionId
,
type
));
}
@Permission
@ApiOperation
(
value
=
"今日值班列表"
,
notes
=
"今日值班列表"
)
@GetMapping
(
value
=
"dutyList"
)
public
CommonResponse
dutyList
(){
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
orgCode
=
this
.
getOrgCode
(
reginParams
);
return
CommonResponseUtil
.
success
(
view3dService
.
dutyList
(
orgCode
));
}
@Autowired
IRocketMQService
rocketMQService
;
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/PlanOperationRecordMapper.java
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
import
com.google.gson.JsonObject
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
import
com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -34,4 +35,6 @@ public interface PlanOperationRecordMapper {
* @return
*/
String
getNewestBatchNo
();
PlanRule
getPlanRuleByBatchNo
(
String
batchNo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IContingencyPlanInstanceRepository.java
View file @
49dec6b2
...
...
@@ -81,4 +81,7 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" ORDER BY"
+
" t.create_date DESC limit 1"
,
nativeQuery
=
true
)
String
queryRecordOne
(
String
batchNo
,
String
recordType
);
@Query
(
value
=
"SELECT * FROM `contingency_plan_instance` WHERE batch_no = ?1"
,
nativeQuery
=
true
)
List
<
ContingencyPlanInstance
>
findByBatchNo
(
String
batchNo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanOperationRecordDao.java
View file @
49dec6b2
...
...
@@ -30,4 +30,5 @@ public interface IPlanOperationRecordDao extends BaseDao<PlanOperationRecord, Lo
*/
List
<
PlanOperationRecord
>
findByStatus
(
Integer
status
);
List
<
PlanOperationRecord
>
findByBatchNoAndStatus
(
String
batchNo
,
Integer
status
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/JcsFeign.java
0 → 100644
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
;
import
com.yeejoin.amos.fas.business.jpush.PushMsgParam
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
/**
* 消息推送
* @author maoying
*
*/
@FeignClient
(
name
=
"${Jcs.fegin.name}"
,
configuration
={
MultipartSupportConfig
.
class
})
public
interface
JcsFeign
{
/**
* 新值班月视图
* @param dutyDay
* @param shiftId
* @param postType
* @return
*/
@RequestMapping
(
value
=
"/jcs/common/duty-person/new-duty-detail"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
dutyStatisticsByDate
(
@RequestParam
String
beginDate
,
@RequestParam
String
endDate
,
@RequestParam
(
required
=
false
)
String
fieldCode
);
/**
* 查询当前值班人信息列表
* @return
*/
@RequestMapping
(
value
=
"/jcs/common/duty-person/person/on_duty/list"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
dutyPersonList
();
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java
View file @
49dec6b2
...
...
@@ -9,6 +9,7 @@ import java.util.Set;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.component.authtoken.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -38,20 +39,12 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
@Value
(
"${security.password}"
)
@Autowired
AmosRequestContext
amosRequestContext
;
@Value
(
"${amos.system.user.password}"
)
private
String
password
;
@Value
(
"${security.loginId}"
)
private
String
loginId
;
@Value
(
"${security.productWeb}"
)
private
String
productWeb
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
...
...
@@ -157,15 +150,15 @@ public class RemoteSecurityService {
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setLoginId
(
amosRequestContext
.
getUserName
()
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Toke
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
amosRequestContext
.
getUserName
()
)),
Toke
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
)){
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
productWeb
);
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
()
);
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
...
...
@@ -178,15 +171,11 @@ public class RemoteSecurityService {
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
){
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
productWeb
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
){
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
productWeb
);
toke
.
setAppKey
(
appKey
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
toke
.
setToke
(
amosRequestContext
.
getToken
());
toke
.
setProduct
(
amosRequestContext
.
getProduct
());
toke
.
setAppKey
(
amosRequestContext
.
getAppKey
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
49dec6b2
...
...
@@ -8,6 +8,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Optional
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanRuleService
;
import
com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -92,6 +93,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired
private
ContingencyOriginalMapper
contingencyOriginalMapper
;
@Autowired
private
IPlanRuleService
planRuleService
;
private
static
Map
<
String
,
String
>
stepMap
=
new
HashMap
<>();
...
...
@@ -313,8 +317,13 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
if
(
"CONFIRM"
.
equals
(
buttonState
))
{
if
(
code
.
equals
(
operate
.
getCode
()))
{
operate
.
setState
(
"executed"
);
if
(
"FIRE_CANCEL"
.
equals
(
code
)
||
"END_EMERGENCY"
.
equals
(
code
))
if
(
"FIRE_CANCEL"
.
equals
(
code
)
||
"END_EMERGENCY"
.
equals
(
code
))
{
redisTemplate
.
delete
(
RiskSourceServiceImpl
.
cacheKeyForCanBeRunning
());
}
if
(
"END_EMERGENCY"
.
equals
(
code
))
{
// 应急处置中断,初始化planStep,json数据
planRuleService
.
updatePlanRuleByBatchNo
(
batchNo
);
}
}
else
{
operate
.
setState
(
"disable"
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java
View file @
49dec6b2
...
...
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -814,4 +815,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
return
bool
;
}
@Override
public
Boolean
getPlanStatus
()
{
return
CollectionUtils
.
isEmpty
(
planOperationRecordDao
.
findByStatus
(
0
));
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java
View file @
49dec6b2
...
...
@@ -130,7 +130,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value
(
"${autoSys.alarm.nameKeys}"
)
private
String
nameKeys
;
@Value
(
"${
security.loginId
}"
)
@Value
(
"${
amos.system.user.user-name
}"
)
private
String
loginId
;
@Value
(
"${autoSys.fire.pool.index_key}"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanRuleServiceImpl.java
0 → 100644
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanRuleDao
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanRuleService
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
@Service
public
class
PlanRuleServiceImpl
implements
IPlanRuleService
{
@Autowired
private
IPlanRuleDao
planRuleDao
;
@Autowired
private
PlanOperationRecordMapper
planOperationRecordMapper
;
@Value
(
"classpath:/json/plan-step.json"
)
private
Resource
planStepResource
;
@Override
public
void
updatePlanRuleByBatchNo
(
String
batchNo
)
{
try
{
// 根据批次号查询预案步骤
PlanRule
planRule
=
planOperationRecordMapper
.
getPlanRuleByBatchNo
(
batchNo
);
String
json
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
planRule
.
setPlanStep
(
json
);
planRuleDao
.
save
(
planRule
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"初始化预案规则planStep数据失败!"
);
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
49dec6b2
...
...
@@ -2,30 +2,27 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.DictMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.feign.IMaasVisualServer
;
import
com.yeejoin.amos.fas.business.service.intfc.IDictService
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.util.JSONUtil
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.Dict
;
import
com.yeejoin.amos.fas.dao.entity.TextPlan
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -59,6 +56,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
private
IContingencyPlanInstanceRepository
contingencyPlanInstanceRepository
;
@Autowired
private
IPlanRuleDao
planRuleDao
;
@Autowired
private
IPlanOperationRecordDao
planOperationRecordDao
;
@Override
public
List
<
TreeSubjectVo
>
getPlanTree
()
{
...
...
@@ -88,11 +91,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override
public
TextPlan
getTextPlanInfoById
(
Long
id
)
{
Optional
<
TextPlan
>
textPlan
=
iTextPlanDao
.
findById
(
id
);
if
(
textPlan
.
isPresent
())
{
return
textPlan
.
get
();
}
return
null
;
Optional
<
TextPlan
>
textPlan
=
iTextPlanDao
.
findById
(
id
);
if
(
textPlan
.
isPresent
())
{
return
textPlan
.
get
();
}
return
null
;
}
private
List
<
TreeSubjectVo
>
listToTree
(
List
<
Object
>
list
)
{
...
...
@@ -117,11 +120,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List
<
TreeSubjectVo
>
childrenVos
=
Lists
.
newArrayList
();
List
<
Object
>
res
=
(
List
<
Object
>)
response
.
getDataList
();
res
.
forEach
(
r
->
{
LinkedHashMap
<
String
,
Object
>
map1
=
(
LinkedHashMap
<
String
,
Object
>)
r
;
Integer
state
=
(
Integer
)
map1
.
get
(
"publishState"
);
if
(
state
==
0
)
{
//过滤 未发布状态
return
;
}
LinkedHashMap
<
String
,
Object
>
map1
=
(
LinkedHashMap
<
String
,
Object
>)
r
;
Integer
state
=
(
Integer
)
map1
.
get
(
"publishState"
);
if
(
state
==
0
)
{
//过滤 未发布状态
return
;
}
TreeSubjectVo
subjectVo
=
new
TreeSubjectVo
();
subjectVo
.
setType
(
"listNode"
);
subjectVo
.
setParentId
((
String
)
map
.
get
(
"id"
));
...
...
@@ -187,8 +190,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
Dict
dict
=
new
Dict
();
dict
.
setDictCode
(
type
);
List
<
Dict
>
dictList
=
dictService
.
getDictList
(
dict
);
Map
<
String
,
String
>
dicts
=
dictList
.
stream
().
collect
(
Collectors
.
toMap
(
Dict:
:
getDictValue
,
Dict:
:
getDictName
,
(
key1
,
key2
)
->
key2
));
Map
<
String
,
String
>
dicts
=
dictList
.
stream
().
collect
(
Collectors
.
toMap
(
Dict:
:
getDictValue
,
Dict:
:
getDictName
,
(
key1
,
key2
)
->
key2
));
//2.1换key为中文
Map
<
String
,
Object
>
tempMap
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -215,22 +217,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
dict
.
setDictCode
(
FasConstant
.
PLAN_SOURCE_TYPE
);
List
<
Dict
>
dictList
=
dictMapper
.
getDictList
(
dict
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
list
=
dictList
.
stream
().
map
(
e
->
{
list
=
dictList
.
stream
().
map
(
e
->
{
Map
<
String
,
Object
>
newMap
=
new
HashMap
<
String
,
Object
>();
newMap
.
put
(
"key"
,
e
.
getDictValue
());
newMap
.
put
(
"value"
,
e
.
getDictValue
());
//前端级联Cascader使用
newMap
.
put
(
"isLeaf"
,
false
);
////前端级联Cascader使用
newMap
.
put
(
"dataType"
,
"type"
);
newMap
.
put
(
"label"
,
e
.
getDictName
());
newMap
.
put
(
"key"
,
e
.
getDictValue
());
newMap
.
put
(
"value"
,
e
.
getDictValue
());
//前端级联Cascader使用
newMap
.
put
(
"isLeaf"
,
false
);
////前端级联Cascader使用
newMap
.
put
(
"dataType"
,
"type"
);
newMap
.
put
(
"label"
,
e
.
getDictName
());
return
newMap
;
}).
collect
(
Collectors
.
toList
());
return
list
;
}
@Override
public
List
<
TreeSubjectVo
>
getTextPlanBySubjectId
(
String
appId
)
{
//关联文字预案
List
<
TreeSubjectVo
>
subjectVos
=
new
ArrayList
<>();
@Override
public
List
<
TreeSubjectVo
>
getTextPlanBySubjectId
(
String
appId
)
{
//关联文字预案
List
<
TreeSubjectVo
>
subjectVos
=
new
ArrayList
<>();
List
<
TextPlan
>
textPlans
=
iTextPlanDao
.
findByAppId
(
appId
);
textPlans
.
forEach
(
t
->
{
TreeSubjectVo
textTreeSubjectVo
=
new
TreeSubjectVo
();
...
...
@@ -240,13 +242,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
textTreeSubjectVo
.
setType
(
"textNode"
);
subjectVos
.
add
(
textTreeSubjectVo
);
});
return
subjectVos
;
}
return
subjectVos
;
}
@Override
public
void
deleteTextPlanFile
(
Long
id
)
{
iTextPlanDao
.
deleteById
(
id
);
}
@Override
public
void
deleteTextPlanFile
(
Long
id
)
{
iTextPlanDao
.
deleteById
(
id
);
}
@Override
public
String
getNewestBatchNo
()
{
...
...
@@ -263,9 +265,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
// 查询当前步骤
ContingencyOriginalData
contingencyOriginalData
=
contingencyOriginalDataDao
.
findByBatchNo
(
batchNo
);
String
step
=
contingencyOriginalData
.
getStep
();
String
confirm
=
contingencyOriginalData
.
getConfirm
();
Map
<
String
,
Object
>
msgContext
=
new
HashMap
<>(
2
);
msgContext
.
put
(
"step"
,
objects
);
msgContext
.
put
(
"currentStep"
,
step
);
msgContext
.
put
(
"currentStep"
,
contingencyOriginalData
.
getStep
());
msgContext
.
put
(
"confirm"
,
contingencyOriginalData
.
getConfirm
());
msgContext
.
put
(
"createDate"
,
contingencyOriginalData
.
getCreateDate
());
List
<
ContingencyPlanInstance
>
list
=
contingencyPlanInstanceRepository
.
findByBatchNo
(
batchNo
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
List
<
ContingencyPlanInstance
>
collect
=
list
.
stream
().
filter
(
x
->
"OPERATE"
.
equals
(
x
.
getRecordType
())).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
msgContext
.
put
(
"caseId"
,
collect
.
get
(
0
).
getId
());
}
}
toipResponse
.
setMsgType
(
"steparea"
);
toipResponse
.
setMsgContext
(
msgContext
);
toipResponse
.
setContingency
(
contingencyOriginalData
);
...
...
@@ -303,4 +315,18 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
return
toipResponse
;
}
@Override
@Transactional
public
PlanStepVo
updatePlanStep
(
PlanStepVo
planStepVo
)
{
// 运行中的设置为重置
List
<
PlanOperationRecord
>
planList
=
planOperationRecordDao
.
findByStatus
(
0
);
if
(!
CollectionUtils
.
isEmpty
(
planList
))
{
// 根据批次号查询预案步骤
PlanRule
planRule
=
planOperationRecordMapper
.
getPlanRuleByBatchNo
(
planStepVo
.
getBatchNo
());
planRule
.
setPlanStep
(
planStepVo
.
getPlanStep
());
planRuleDao
.
save
(
planRule
);
}
return
planStepVo
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/View3dServiceImpl.java
View file @
49dec6b2
...
...
@@ -18,6 +18,7 @@ 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.ISafetyIndexChangeLogDao
;
import
com.yeejoin.amos.fas.business.feign.IDutyModeServer
;
import
com.yeejoin.amos.fas.business.feign.JcsFeign
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
...
...
@@ -30,6 +31,7 @@ import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
...
...
@@ -87,6 +89,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private
IDutyModeServer
dutyModeServer
;
@Autowired
private
JcsFeign
jcsFeign
;
@Value
(
"${param.system.online.date}"
)
private
String
onLineDate
;
...
...
@@ -495,12 +500,45 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public
CommonResponse
getStatisticsDuty
(
String
appKey
,
String
product
,
String
token
,
String
orgCode
)
{
Date
curDate
=
new
Date
();
public
Map
<
String
,
Object
>
getStatisticsDuty
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Date
date
=
new
Date
();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"dutyDate"
,
curDate
);
return
dutyModeServer
.
dutyListByDay
(
appKey
,
product
,
token
,
orgCode
,
param
.
toJSONString
());
String
dateStr
=
format
.
format
(
date
);
ResponseModel
responseModel
=
jcsFeign
.
dutyStatisticsByDate
(
dateStr
,
dateStr
,
"personType"
);
if
(
"SUCCESS"
.
equals
(
responseModel
.
getDevMessage
()))
{
String
JSONStr
=
JSON
.
toJSONString
(
responseModel
.
getResult
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
for
(
Object
x
:
dataList
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
String
json
=
JSON
.
toJSONString
(((
JSONObject
)
x
).
get
(
"data"
));
JSONArray
array
=
JSONObject
.
parseArray
(
json
);
if
(!
ObjectUtils
.
isEmpty
(
array
))
{
Map
<
String
,
String
>
result
=
(
Map
<
String
,
String
>)
array
.
get
(
0
);
String
total
=
result
.
get
(
"total"
);
String
postTypeName
=
result
.
get
(
"postTypeName"
);
if
(
DutyPersonEnum
.
FIRE_PERSON
.
getName
().
equals
(
postTypeName
))
{
map
.
put
(
"firePersonNumber"
,
total
);
}
else
if
(
DutyPersonEnum
.
OPS_PERSON
.
getName
().
equals
(
postTypeName
))
{
map
.
put
(
"dutyPersonNumber"
,
total
);
}
else
if
(
DutyPersonEnum
.
REAL_PERSON
.
getName
().
equals
(
postTypeName
))
{
map
.
put
(
"securityPersonNumber"
,
total
);
}
}
}
}
}
if
(!
map
.
containsKey
(
"firePersonNumber"
))
{
map
.
put
(
"firePersonNumber"
,
0
);
}
if
(!
map
.
containsKey
(
"dutyPersonNumber"
))
{
map
.
put
(
"dutyPersonNumber"
,
0
);
}
if
(!
map
.
containsKey
(
"securityPersonNumber"
))
{
map
.
put
(
"securityPersonNumber"
,
0
);
}
return
map
;
}
@Override
...
...
@@ -657,6 +695,27 @@ public class View3dServiceImpl implements IView3dService {
return
pointList
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
dutyList
(
String
orgCode
)
{
ArrayList
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
ResponseModel
responseModel
=
jcsFeign
.
dutyPersonList
();
if
(
"SUCCESS"
.
equals
(
responseModel
.
getDevMessage
()))
{
String
JSONStr
=
JSON
.
toJSONString
(
responseModel
.
getResult
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
dataList
.
forEach
(
x
->
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
JSONObject
obj
=
(
JSONObject
)
x
;
resultMap
.
put
(
"postName"
,
obj
.
getString
(
"postTypeName"
));
resultMap
.
put
(
"name"
,
obj
.
getString
(
"userName"
));
resultMap
.
put
(
"phone"
,
obj
.
getString
(
"telephone"
));
list
.
add
(
resultMap
);
});
}
}
return
list
;
}
private
List
<
Map
<
String
,
Object
>>
getPointsByRegionIds
(
List
<
Long
>
ids
)
{
return
view3dMapper
.
getAllPointInRegions
(
ids
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IContingencyPlanService.java
View file @
49dec6b2
...
...
@@ -135,4 +135,5 @@ public interface IContingencyPlanService {
AtomicBoolean
planReset
();
Boolean
getPlanStatus
();
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanRuleService.java
0 → 100644
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
public
interface
IPlanRuleService
{
void
updatePlanRuleByBatchNo
(
String
batchNo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
import
com.yeejoin.amos.fas.dao.entity.TextPlan
;
import
java.util.List
;
...
...
@@ -68,4 +70,6 @@ public interface IPlanVisual3dService {
* @return 预案记录
*/
ToipResponse
getPlaneRecordOneByBatchNo
(
String
batchNo
);
PlanStepVo
updatePlanStep
(
PlanStepVo
planStepVo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IView3dService.java
View file @
49dec6b2
...
...
@@ -104,7 +104,7 @@ public interface IView3dService {
* 今日值班统计
* @return
*/
CommonResponse
getStatisticsDuty
(
String
appKey
,
String
product
,
String
token
,
String
orgCode
);
Map
<
String
,
Object
>
getStatisticsDuty
(
);
/**
* 设备状态消息最新5条
...
...
@@ -189,4 +189,10 @@ public interface IView3dService {
*/
List
<
Map
<
String
,
Object
>>
listPointsByRegionId
(
Long
regionId
,
String
type
);
/**
* 今日值班列表
* @param orgCode
* @return
*/
List
<
Map
<
String
,
Object
>>
dutyList
(
String
orgCode
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/PlanStepVo.java
0 → 100644
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
lombok.Data
;
@Data
public
class
PlanStepVo
{
private
String
batchNo
;
private
String
planStep
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/PermissionAspect.java
View file @
49dec6b2
package
com
.
yeejoin
.
amos
.
fas
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.vo.CompanyBo
;
import
com.yeejoin.amos.fas.business.vo.DepartmentBo
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.business.vo.RoleBo
;
import
com.yeejoin.amos.fas.exception.PermissionException
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Aspect
@Component
@ResponseBody
public
class
PermissionAspect
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PermissionAspect
.
class
);
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
// 前置通知,在方法执行之前
@Before
(
value
=
"@annotation(Permission)"
)
public
void
PermissionCheck
(
JoinPoint
joinPoint
)
throws
PermissionException
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
logger
.
info
(
"======开始权限校验======"
);
// 用户token
String
token
=
(
String
)
request
.
getHeader
(
"token"
);
token
=
ObjectUtils
.
isEmpty
(
token
)
?
(
String
)
request
.
getHeader
(
"X-Access-Token"
)
:
token
;
String
product
=
(
String
)
request
.
getHeader
(
"product"
);
String
appKey
=
(
String
)
request
.
getHeader
(
"appKey"
);
logger
.
info
(
"用户token:"
+
token
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
if
(!
TokenOperation
.
refresh
(
token
))
{
throw
new
PermissionException
(
"登录信息失效,请重新登录"
);
}
if
(
joinPoint
.
getSignature
().
getName
().
equals
(
"saveCurCompany"
))
{
return
;
}
FeignClientResult
feignClientResult
;
AgencyUserModel
userModel
=
null
;
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
getme
();
userModel
=
(
AgencyUserModel
)
feignClientResult
.
getResult
();
String
userId
=
null
;
ReginParams
regionParam
=
new
ReginParams
();
if
(
userModel
!=
null
){
userId
=
userModel
.
getUserId
();
ReginParams
reginParams
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
userModel
.
getUserId
(),
token
)),
ReginParams
.
class
);
if
(
reginParams
==
null
&&
userModel
.
getCompanys
().
size
()
>
0
){
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
List
<
DepartmentModel
>
deptList
=
remoteSecurityService
.
getDepartmentTreeByCompanyId
(
token
,
product
,
appKey
,
companyModel
.
getSequenceNbr
().
toString
());
if
(
deptList
.
size
()
>
0
){
CompanyBo
companyBo
=
convertCompanyModelToBo
(
companyModel
);
DepartmentBo
departmentBo
=
convertDepartmentModelToBo
(
deptList
.
get
(
0
));
regionParam
.
setCompany
(
companyBo
);
regionParam
.
setDepartment
(
departmentBo
);
}
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
userModel
.
getOrgRoles
();
List
<
RoleModel
>
roleModels
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
orgRoles
))
{
for
(
Map
.
Entry
<
Long
,
List
<
RoleModel
>>
entry
:
orgRoles
.
entrySet
())
{
roleModels
=
entry
.
getValue
();
break
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
roleModels
)){
regionParam
.
setRole
(
convertRoleModelToBo
(
roleModels
.
get
(
0
)));
}
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
regionParam
),
28
,
TimeUnit
.
DAYS
);
}
}
}
catch
(
InnerInvokException
e
)
{
logger
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
}
private
DepartmentBo
convertDepartmentModelToBo
(
DepartmentModel
departmentModel
){
DepartmentBo
departmentBo
=
new
DepartmentBo
();
if
(
departmentModel
!=
null
)
{
departmentBo
.
setCompanySeq
(
departmentModel
.
getCompanySeq
().
toString
());
departmentBo
.
setDepartmentDesc
(
departmentModel
.
getDepartmentDesc
());
departmentBo
.
setDepartmentName
(
departmentModel
.
getDepartmentName
());
departmentBo
.
setLevel
(
departmentModel
.
getLevel
());
departmentBo
.
setOrgCode
(
departmentModel
.
getOrgCode
());
departmentBo
.
setParentId
(
departmentModel
.
getParentId
().
toString
());
departmentBo
.
setDeptOrgCode
(
departmentModel
.
getDeptOrgCode
().
toString
());
departmentBo
.
setSequenceNbr
(
departmentModel
.
getSequenceNbr
().
toString
());
}
return
departmentBo
;
}
/**
* Model 转 Bo
*/
private
CompanyBo
convertCompanyModelToBo
(
CompanyModel
companyModel
){
CompanyBo
companyBo
=
new
CompanyBo
();
if
(
companyModel
!=
null
)
{
companyBo
.
setAddress
(
companyModel
.
getAddress
());
companyBo
.
setCompanyName
(
companyModel
.
getCompanyName
());
companyBo
.
setCompanyOrgCode
(
Long
.
parseLong
(
companyModel
.
getCompanyOrgCode
().
toString
()));
companyBo
.
setEmail
(
companyModel
.
getEmail
());
companyBo
.
setLandlinePhone
(
companyModel
.
getLandlinePhone
());
companyBo
.
setLongitude
(
companyModel
.
getLongitude
());
companyBo
.
setLatitude
(
companyModel
.
getLatitude
());
companyBo
.
setLevel
(
companyModel
.
getLevel
());
companyBo
.
setOrgCode
(
companyModel
.
getOrgCode
());
companyBo
.
setSequenceNbr
(
companyModel
.
getSequenceNbr
().
toString
());
companyBo
.
setParentId
(
companyModel
.
getParentId
().
toString
());
}
return
companyBo
;
}
private
RoleBo
convertRoleModelToBo
(
RoleModel
roleModel
)
{
RoleBo
roleBo
=
new
RoleBo
();
if
(
roleModel
!=
null
){
roleBo
.
setRoleName
(
roleModel
.
getRoleName
());
roleBo
.
setRoleType
(
roleModel
.
getRoleType
());
roleBo
.
setSequenceNbr
(
roleModel
.
getSequenceNbr
().
toString
());
}
return
roleBo
;
}
//redi缓存选择的用户信息
private
String
buildKey
(
String
userId
,
String
token
)
{
return
"region_"
+
userId
+
"_"
+
token
;
}
}
package
com
.
yeejoin
.
amos
.
fas
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.vo.CompanyBo
;
import
com.yeejoin.amos.fas.business.vo.DepartmentBo
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.business.vo.RoleBo
;
import
com.yeejoin.amos.fas.exception.PermissionException
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Aspect
@Component
@ResponseBody
public
class
PermissionAspect
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PermissionAspect
.
class
);
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
// 前置通知,在方法执行之前
@Before
(
value
=
"@annotation(Permission)"
)
public
void
PermissionCheck
(
JoinPoint
joinPoint
)
throws
PermissionException
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
logger
.
info
(
"======开始权限校验======"
);
// 用户token
String
token
=
(
String
)
request
.
getHeader
(
"token"
);
token
=
ObjectUtils
.
isEmpty
(
token
)
?
(
String
)
request
.
getHeader
(
"X-Access-Token"
)
:
token
;
String
product
=
(
String
)
request
.
getHeader
(
"product"
);
String
appKey
=
(
String
)
request
.
getHeader
(
"appKey"
);
logger
.
info
(
"用户token:"
+
token
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
if
(!
TokenOperation
.
refresh
(
token
))
{
throw
new
PermissionException
(
"登录信息失效,请重新登录"
);
}
if
(
joinPoint
.
getSignature
().
getName
().
equals
(
"saveCurCompany"
))
{
return
;
}
FeignClientResult
feignClientResult
;
AgencyUserModel
userModel
=
null
;
try
{
feignClientResult
=
Privilege
.
agencyUserClient
.
getme
();
userModel
=
(
AgencyUserModel
)
feignClientResult
.
getResult
();
String
userId
=
null
;
ReginParams
regionParam
=
new
ReginParams
();
if
(
userModel
!=
null
){
userId
=
userModel
.
getUserId
();
ReginParams
reginParams
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
userModel
.
getUserId
(),
token
)),
ReginParams
.
class
);
if
(
reginParams
==
null
&&
userModel
.
getCompanys
().
size
()
>
0
){
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
List
<
DepartmentModel
>
deptList
=
remoteSecurityService
.
getDepartmentTreeByCompanyId
(
token
,
product
,
appKey
,
companyModel
.
getSequenceNbr
().
toString
());
CompanyBo
companyBo
=
convertCompanyModelToBo
(
companyModel
);
regionParam
.
setCompany
(
companyBo
);
if
(
deptList
.
size
()
>
0
){
DepartmentBo
departmentBo
=
convertDepartmentModelToBo
(
deptList
.
get
(
0
));
regionParam
.
setDepartment
(
departmentBo
);
}
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
userModel
.
getOrgRoles
();
List
<
RoleModel
>
roleModels
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
orgRoles
))
{
for
(
Map
.
Entry
<
Long
,
List
<
RoleModel
>>
entry
:
orgRoles
.
entrySet
())
{
roleModels
=
entry
.
getValue
();
break
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
roleModels
)){
regionParam
.
setRole
(
convertRoleModelToBo
(
roleModels
.
get
(
0
)));
}
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
regionParam
),
28
,
TimeUnit
.
DAYS
);
}
}
}
catch
(
InnerInvokException
e
)
{
logger
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
}
private
DepartmentBo
convertDepartmentModelToBo
(
DepartmentModel
departmentModel
){
DepartmentBo
departmentBo
=
new
DepartmentBo
();
if
(
departmentModel
!=
null
)
{
departmentBo
.
setCompanySeq
(
departmentModel
.
getCompanySeq
().
toString
());
departmentBo
.
setDepartmentDesc
(
departmentModel
.
getDepartmentDesc
());
departmentBo
.
setDepartmentName
(
departmentModel
.
getDepartmentName
());
departmentBo
.
setLevel
(
departmentModel
.
getLevel
());
departmentBo
.
setOrgCode
(
departmentModel
.
getOrgCode
());
departmentBo
.
setParentId
(
departmentModel
.
getParentId
().
toString
());
departmentBo
.
setDeptOrgCode
(
departmentModel
.
getDeptOrgCode
().
toString
());
departmentBo
.
setSequenceNbr
(
departmentModel
.
getSequenceNbr
().
toString
());
}
return
departmentBo
;
}
/**
* Model 转 Bo
*/
private
CompanyBo
convertCompanyModelToBo
(
CompanyModel
companyModel
){
CompanyBo
companyBo
=
new
CompanyBo
();
if
(
companyModel
!=
null
)
{
companyBo
.
setAddress
(
companyModel
.
getAddress
());
companyBo
.
setCompanyName
(
companyModel
.
getCompanyName
());
companyBo
.
setCompanyOrgCode
(
Long
.
parseLong
(
companyModel
.
getCompanyOrgCode
().
toString
()));
companyBo
.
setEmail
(
companyModel
.
getEmail
());
companyBo
.
setLandlinePhone
(
companyModel
.
getLandlinePhone
());
companyBo
.
setLongitude
(
companyModel
.
getLongitude
());
companyBo
.
setLatitude
(
companyModel
.
getLatitude
());
companyBo
.
setLevel
(
companyModel
.
getLevel
());
companyBo
.
setOrgCode
(
companyModel
.
getOrgCode
());
companyBo
.
setSequenceNbr
(
companyModel
.
getSequenceNbr
().
toString
());
companyBo
.
setParentId
(
companyModel
.
getParentId
().
toString
());
}
return
companyBo
;
}
private
RoleBo
convertRoleModelToBo
(
RoleModel
roleModel
)
{
RoleBo
roleBo
=
new
RoleBo
();
if
(
roleModel
!=
null
){
roleBo
.
setRoleName
(
roleModel
.
getRoleName
());
roleBo
.
setRoleType
(
roleModel
.
getRoleType
());
roleBo
.
setSequenceNbr
(
roleModel
.
getSequenceNbr
().
toString
());
}
return
roleBo
;
}
//redi缓存选择的用户信息
private
String
buildKey
(
String
userId
,
String
token
)
{
return
"region_"
+
userId
+
"_"
+
token
;
}
}
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
49dec6b2
...
...
@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery
=
SELECT 1
#系统服务账号,用户后端服务调用
security.password
=
a1234560
security.loginId
=
fas_autosys
#security.password=a1234560
#security.loginId=fas_autosys
amos.system.user.user-name
=
fas_autosys
amos.system.user.password
=
a1234560
#应用product appkey
security.productWeb
=
STUDIO_APP_WEB
security.appKey
=
studio_normalapp_3056965
#security.productWeb=STUDIO_APP_WEB
#security.appKey =studio_normalapp_3056965
amos.system.user.app-key
=
studio_normalapp_3056965
amos.system.user.product
=
STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone
=
http://172.16.11.201:10001/eureka/
eureka.client.register-with-eureka
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-docker.properties
View file @
49dec6b2
...
...
@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery
=
SELECT 1
#系统服务账号,用户后端服务调用
security.password
=
a1234560
security.loginId
=
fas_autosys
#security.password=a1234560
#security.loginId=fas_autosys
amos.system.user.user-name
=
fas_autosys
amos.system.user.password
=
a1234560
#应用product appkey
security.productWeb
=
STUDIO_APP_WEB
security.appKey
=
studio_normalapp_2681691
#security.productWeb=STUDIO_APP_WEB
#security.appKey =studio_normalapp_3056965
amos.system.user.app-key
=
studio_normalapp_3056965
amos.system.user.product
=
STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone
=
http://172.16.11.20:10001/eureka/
eureka.client.register-with-eureka
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-test.properties
View file @
49dec6b2
...
...
@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery
=
SELECT 1
#系统服务账号,用户后端服务调用
security.password
=
a1234560
security.loginId
=
fas_autosys
#security.password=a1234560
#security.loginId=fas_autosys
amos.system.user.user-name
=
fas_autosys
amos.system.user.password
=
a1234560
#应用product appkey
security.productWeb
=
STUDIO_APP_WEB
security.appKey
=
studio_normalapp_2681691
#security.productWeb=STUDIO_APP_WEB
#security.appKey =studio_normalapp_3056965
amos.system.user.app-key
=
studio_normalapp_3056965
amos.system.user.product
=
STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone
=
http://172.16.11.20:10001/eureka/
eureka.client.register-with-eureka
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
49dec6b2
...
...
@@ -52,6 +52,10 @@ equipManage.fegin.name=AMOS-EQUIPMANAGE
#jpush 服务名称
Push.fegin.name
=
AMOS-JPUSH
#JCS 服务名称
Jcs.fegin.name
=
JCS
#feginName
number.plan.projectName
=
换流站消防专项预案
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
49dec6b2
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_location
</comment>
<sql>
alter table `f_risk_source` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_rotation
</comment>
<sql>
alter table `f_risk_source` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_extent"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_extent
</comment>
<sql>
alter table `f_risk_source` add column `ue4_extent` text default null comment 'ue4缩放' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587351415717-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_equipment add column ue4_location
</comment>
<sql>
alter table `f_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587351415717-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_equipment add column ue4_rotation
</comment>
<sql>
alter table `f_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350552716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_equipment"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_fire_equipment add column ue4_location
</comment>
<sql>
alter table `f_fire_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350552716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_equipment"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_fire_equipment add column ue4_rotation
</comment>
<sql>
alter table `f_fire_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350593716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_station"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_fire_station add column ue4_location
</comment>
<sql>
alter table `f_fire_station` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350593716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_station"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_fire_station add column ue4_rotation
</comment>
<sql>
alter table `f_fire_station` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350759717-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_water_resource"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_water_resource add column ue4_location
</comment>
<sql>
alter table `f_water_resource` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350759717-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_water_resource"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_water_resource add column ue4_rotation
</comment>
<sql>
alter table `f_water_resource` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350860716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"f_safety_index_change_log"
/>
</not>
</preConditions>
<comment>
create f_safety_index_change_log
</comment>
<sql>
create table f_safety_index_change_log
(
id bigint(20) not null auto_increment comment '物理主键',
safety_index decimal(4,1) comment '安全指数',
collect_date date comment '统计日期',
org_code varchar(100) comment '机构',
remark varchar(255) comment '备注',
primary key (id)
);
alter table f_safety_index_change_log comment '安全指数日流水';
create index Index_org_code on f_safety_index_change_log
(
org_code
);
</sql>
</changeSet>
<changeSet
id=
"1587882668719-1"
author=
"suhuiguang"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<indexExists
indexName=
"idx_type"
/>
</not>
</preConditions>
<createIndex
indexName=
"idx_type"
tableName=
"f_fire_station"
tablespace=
"A String"
unique=
"false"
>
<column
name=
"type"
/>
</createIndex>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1588067351000-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"route_path"
/>
</not>
</preConditions>
<comment>
f_risk_source add column route_path
</comment>
<sql>
alter table f_risk_source add column `route_path` varchar(2000) DEFAULT NULL COMMENT '路径坐标' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588140925893-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_safety_index_change_log"
columnName=
"create_date"
/>
</not>
</preConditions>
<comment>
f_safety_index_change_log add column create_date
</comment>
<sql>
alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588990926789-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
</not>
</preConditions>
<comment>
f_risk_level add column manage_level 管控级别
</comment>
<sql>
ALTER TABLE `f_risk_level`
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589165258908-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_rpn_change_log "
columnName=
"trigger_type"
/>
</not>
</preConditions>
<comment>
f_rpn_change_log add column trigger_type 触发类型
</comment>
<sql>
ALTER TABLE `f_rpn_change_log`
add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589165258908-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source "
columnName=
"flicker_frequency"
/>
</not>
</preConditions>
<comment>
f_risk_source add column flicker_frequency 闪烁频率
</comment>
<sql>
ALTER TABLE `f_risk_source`
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql>
</changeSet>
<changeSet
author=
"zhouyi"
id=
"1589444792916-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<tableExists
tableName=
"f_station_info"
/>
</preConditions>
<comment>
create table f_station_info
</comment>
<sql>
DROP TABLE IF EXISTS f_station_info;
CREATE TABLE `f_station_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(20) DEFAULT NULL COMMENT '名称',
`station_code` varchar(32) NOT NULL COMMENT '环流站编码',
`code` varchar(10) DEFAULT NULL COMMENT '后三位编码',
`elec_type` tinyint(4) DEFAULT NULL COMMENT '换流站类型:1-发电类型;2-收电类型',
`use_type` tinyint(4) NOT NULL COMMENT '用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他',
`province_code` varchar(32) DEFAULT NULL COMMENT '省份编码',
`city_code` varchar(32) DEFAULT NULL COMMENT '市区编码',
`district_code` varchar(32) DEFAULT NULL COMMENT '区县编码',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`status` bit(1) NOT NULL DEFAULT b'0' COMMENT '0-启用;1-停用',
`longitude` double DEFAULT NULL COMMENT '经度',
`latitude` double DEFAULT NULL COMMENT '纬度',
`station_charge_user_id` varchar(50) DEFAULT NULL COMMENT '换流站负责人',
`safety_charge_user_id` varchar(50) DEFAULT NULL COMMENT '安全负责人',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `f_station_info_uniq` (`station_code`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='站端信息表';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589769364577-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
</preConditions>
<comment>
f_risk_level 增加管控级别 初始化数据
</comment>
<sql>
update f_risk_level set manage_level = 1 where level = '1';
update f_risk_level set manage_level = 2 where level = '2';
update f_risk_level set manage_level = 3 where level = '3';
update f_risk_level set manage_level = 4 where level = '4';
</sql>
</changeSet>
<changeSet
author=
"maoying"
id=
"11590390304001-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_fire_equipment_point "
columnName=
"fire_equipment_id"
/>
</preConditions>
<comment>
修改fire_equipment_id可为空
</comment>
<sql>
ALTER TABLE `f_fire_equipment_point`
MODIFY COLUMN `fire_equipment_id` bigint(20) NULL COMMENT '消防装备id' AFTER `code`;
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1591672147780-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<viewExists
viewName=
"toip_biz_message"
/>
</preConditions>
<comment>
create view toip_biz_message
</comment>
<sql>
DROP VIEW IF EXISTS toip_biz_message;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `toip_biz_message` AS SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `f_equipment` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo' ) ) UNION ALL
SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `p_point` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.ProtalDataRo' ) ) UNION ALL
SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `f_risk_source` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo' ) );
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_original_data"
/>
</not>
</preConditions>
<comment>
create table contingency_original_data
</comment>
<sql>
DROP TABLE IF EXISTS contingency_original_data;
CREATE TABLE `contingency_original_data` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`fire_Equipment_Name` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`fire_Equipment_Id` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`layer` int(11) NOT NULL COMMENT '一级分类',
`fire_Equipment_Layer` int(11) NOT NULL COMMENT '二级分类',
`fire_Equipment_Position` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`equipment_Id` int(11) NOT NULL COMMENT '排序',
`equipment_Name` varchar(255) DEFAULT NULL,
`mobile` varchar(255) DEFAULT NULL,
`admin_Name` varchar(255) DEFAULT NULL,
`camera_Codes` varchar(255) DEFAULT NULL,
`camera_Ids` varchar(255) DEFAULT NULL,
`fire_Count` int(11) DEFAULT NULL,
`confirm` varchar(255) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL,
`batch_No` varchar(36) NOT NULL,
`picture1` varchar(255) DEFAULT NULL,
`picture2` varchar(255) DEFAULT NULL,
`picture4` varchar(255) DEFAULT NULL,
`picture3` varchar(255) DEFAULT NULL,
`fire_Truck_Route` varchar(2000) DEFAULT NULL,
`runstep` bit(1) DEFAULT NULL,
`step_state` varchar(255) DEFAULT NULL,
`step` varchar(255) DEFAULT NULL,
`equipment_position3d` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `INDEX_BATCH_NO` (`batch_No`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_plan"
/>
</not>
</preConditions>
<comment>
create table contingency_plan
</comment>
<sql>
DROP TABLE IF EXISTS contingency_plan;
CREATE TABLE `contingency_plan` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`content` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`category` varchar(36) NOT NULL COMMENT '一级分类',
`sub_category` varchar(36) NOT NULL COMMENT '二级分类',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) NOT NULL COMMENT '排序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_plan_instance"
/>
</not>
</preConditions>
<comment>
create table contingency_plan_instance
</comment>
<sql>
DROP TABLE IF EXISTS contingency_plan_instance;
CREATE TABLE `contingency_plan_instance` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`category` varchar(36) DEFAULT NULL COMMENT '一级分类',
`content` varchar(2000) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) DEFAULT NULL COMMENT '所有节点一起的排序号',
`sequence_num` int(11) DEFAULT NULL COMMENT '用于显示的序号',
`batch_no` varchar(36) NOT NULL COMMENT '预案实例编号,暂时无法区分多个火灾,暂时存储报警设备id',
`create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL,
`tips` varchar(255) DEFAULT NULL,
`runstate` bit(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案执行记录实例';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"station_charge_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_charge_user_name` varchar(20) NULL COMMENT '换流站负责人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"safety_charge_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_charge_user_name` varchar(20) NULL COMMENT '安全负责人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"create_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"create_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_phone_num` varchar(20) NULL COMMENT '创建人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"station_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_user_phone_num` varchar(20) NULL COMMENT '换流站负责人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"safety_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_user_phone_num` varchar(20) NULL COMMENT '安全负责人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_name` varchar(20) NULL COMMENT '驻站消防队队长姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_phone_num` varchar(20) NULL COMMENT '驻站消防队队长电话';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_user_id"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1609226808866-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add column source_id
</comment>
<sql>
alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`;
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1609226808867-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<indexExists
indexName=
"unique_idx_source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add UNIQUE source_id
</comment>
<sql>
ALTER TABLE `f_risk_source` ADD UNIQUE unique_idx_source_id(source_id);
</sql>
</changeSet>
<changeSet
author=
"gaojianqiang"
id=
"1609989898-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"status"
/>
</not>
</preConditions>
<comment>
修改f_equipment表结构
</comment>
<sql>
ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT 0 COMMENT '预案状态:1-启动,0-未启动';
ALTER TABLE `f_equipment` ADD COLUMN `start_time` datetime(0) NULL DEFAULT NULL COMMENT '预案开始时间';
ALTER TABLE `f_equipment` ADD COLUMN `end_time` datetime(0) NULL DEFAULT NULL COMMENT '预案结束时间';
ALTER TABLE `f_equipment` ADD COLUMN `reserve_source` tinyint(4) NULL DEFAULT 0 COMMENT '预案来源:1-手动触发,0-自动触发(默认)';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_classify_tree"
/>
</not>
</preConditions>
<comment>
create table c_plan_classify_tree
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_classify_tree;
CREATE TABLE `c_plan_classify_tree` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`classify_name` varchar(255) DEFAULT NULL COMMENT '预案分类名称',
`parent_id` bigint(20) DEFAULT NULL COMMENT '父类id',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`org_code` varchar(255) DEFAULT NULL COMMENT '组织机构',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='预案分类树';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_detail"
/>
</not>
</preConditions>
<comment>
create table c_plan_detail
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_detail;
CREATE TABLE `c_plan_detail` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '数字预案ID',
`plan_name` varchar(255) DEFAULT NULL COMMENT '预案名称',
`code` varchar(255) DEFAULT NULL COMMENT '预案编号',
`classify_id` bigint(20) DEFAULT NULL COMMENT '预案类型',
`plan_range` varchar(255) DEFAULT NULL COMMENT '适用范围',
`edit_org_name` varchar(255) DEFAULT NULL COMMENT '编写部门',
`edition` varchar(255) DEFAULT NULL COMMENT '版次',
`implementation_time` datetime DEFAULT NULL COMMENT '实施时间',
`create_date` datetime NOT NULL COMMENT '录入时间',
`remark` text COMMENT '备注',
`status` int(255) DEFAULT NULL COMMENT '预案状态',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`reviser` varchar(255) DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
`org_code` varchar(255) DEFAULT NULL COMMENT '部门code',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '删除状态(0、正常,1、删除)',
`input_time` datetime DEFAULT NULL COMMENT '录入时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COMMENT='预案详情表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_doc"
/>
</not>
</preConditions>
<comment>
create table c_plan_doc
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_doc;
CREATE TABLE `c_plan_doc` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`doc_id` bigint(20) DEFAULT NULL COMMENT '文档ID',
`create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案文档关系表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-4"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_equipment"
/>
</not>
</preConditions>
<comment>
create table c_plan_equipment
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_equipment;
CREATE TABLE `c_plan_equipment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`fire_equipment_id` bigint(20) DEFAULT NULL COMMENT '电力装备ID',
`create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案电力设备关系表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-5"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_operation_record"
/>
</not>
</preConditions>
<comment>
create table c_plan_operation_record
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_operation_record;
CREATE TABLE `c_plan_operation_record` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`plan_pattern` tinyint(4) DEFAULT NULL COMMENT '运行模式(4、模拟,5、自动)',
`status` tinyint(4) DEFAULT NULL COMMENT '运行状态(0、运行中,1、完毕,3、中断)',
`execution_type` tinyint(4) DEFAULT NULL COMMENT '执行方式(0、预案验证 1、火灾处置)',
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`batch_no` varchar(255) DEFAULT NULL COMMENT '批次号',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`start_user_name` varchar(255) DEFAULT NULL COMMENT '启动人名称',
`start_user_id` varchar(255) DEFAULT NULL COMMENT '启动人id',
`equipment_code` varchar(20) DEFAULT NULL COMMENT '装备code',
`equipment_name` varchar(255) DEFAULT NULL COMMENT '装备名称',
`equipment_id` bigint(11) DEFAULT NULL COMMENT '装备ID',
`fire_equipment_id` bigint(255) DEFAULT NULL COMMENT '电力设备ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COMMENT='预案运行记录表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-6"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_rule"
/>
</not>
</preConditions>
<comment>
create table c_plan_rule
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_rule;
CREATE TABLE `c_plan_rule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`rule_id` varchar(32) DEFAULT NULL COMMENT '规则ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`rule_name` varchar(100) DEFAULT NULL COMMENT '规则名称',
`pic_url` varchar(100) DEFAULT NULL COMMENT '规则树形图路径',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4;
</sql>
</changeSet>
<changeSet
author=
"maoying"
id=
"1612272587000-7"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"c_plan_operation_record"
columnName=
"equipment_code"
/>
</preConditions>
<comment>
c_plan_operation_record table equipment_code MODIFY
</comment>
<sql>
ALTER TABLE `c_plan_operation_record`
MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ;
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"xxz-2022-07-07-01"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"c_plan_rule"
columnName=
"plan_step"
/>
</not>
</preConditions>
<comment>
c_plan_rule add column plan_step
</comment>
<sql>
alter table `c_plan_rule` add column `plan_step` json DEFAULT NULL COMMENT '预案步骤';
</sql>
</changeSet>
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_location
</comment>
<sql>
alter table `f_risk_source` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_rotation
</comment>
<sql>
alter table `f_risk_source` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587349916716-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"ue4_extent"
/>
</not>
</preConditions>
<comment>
f_risk_source add column ue4_extent
</comment>
<sql>
alter table `f_risk_source` add column `ue4_extent` text default null comment 'ue4缩放' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587351415717-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_equipment add column ue4_location
</comment>
<sql>
alter table `f_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587351415717-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_equipment add column ue4_rotation
</comment>
<sql>
alter table `f_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350552716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_equipment"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_fire_equipment add column ue4_location
</comment>
<sql>
alter table `f_fire_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350552716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_equipment"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_fire_equipment add column ue4_rotation
</comment>
<sql>
alter table `f_fire_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350593716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_station"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_fire_station add column ue4_location
</comment>
<sql>
alter table `f_fire_station` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350593716-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_station"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_fire_station add column ue4_rotation
</comment>
<sql>
alter table `f_fire_station` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350759717-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_water_resource"
columnName=
"ue4_location"
/>
</not>
</preConditions>
<comment>
f_water_resource add column ue4_location
</comment>
<sql>
alter table `f_water_resource` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350759717-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_water_resource"
columnName=
"ue4_rotation"
/>
</not>
</preConditions>
<comment>
f_water_resource add column ue4_rotation
</comment>
<sql>
alter table `f_water_resource` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1587350860716-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"f_safety_index_change_log"
/>
</not>
</preConditions>
<comment>
create f_safety_index_change_log
</comment>
<sql>
create table f_safety_index_change_log
(
id bigint(20) not null auto_increment comment '物理主键',
safety_index decimal(4,1) comment '安全指数',
collect_date date comment '统计日期',
org_code varchar(100) comment '机构',
remark varchar(255) comment '备注',
primary key (id)
);
alter table f_safety_index_change_log comment '安全指数日流水';
create index Index_org_code on f_safety_index_change_log
(
org_code
);
</sql>
</changeSet>
<changeSet
id=
"1587882668719-1"
author=
"suhuiguang"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<indexExists
indexName=
"idx_type"
/>
</not>
</preConditions>
<createIndex
indexName=
"idx_type"
tableName=
"f_fire_station"
tablespace=
"A String"
unique=
"false"
>
<column
name=
"type"
/>
</createIndex>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1588067351000-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"route_path"
/>
</not>
</preConditions>
<comment>
f_risk_source add column route_path
</comment>
<sql>
alter table f_risk_source add column `route_path` varchar(2000) DEFAULT NULL COMMENT '路径坐标' after `position3d`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588140925893-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_safety_index_change_log"
columnName=
"create_date"
/>
</not>
</preConditions>
<comment>
f_safety_index_change_log add column create_date
</comment>
<sql>
alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588990926789-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
</not>
</preConditions>
<comment>
f_risk_level add column manage_level 管控级别
</comment>
<sql>
ALTER TABLE `f_risk_level`
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589165258908-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_rpn_change_log "
columnName=
"trigger_type"
/>
</not>
</preConditions>
<comment>
f_rpn_change_log add column trigger_type 触发类型
</comment>
<sql>
ALTER TABLE `f_rpn_change_log`
add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`;
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589165258908-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source "
columnName=
"flicker_frequency"
/>
</not>
</preConditions>
<comment>
f_risk_source add column flicker_frequency 闪烁频率
</comment>
<sql>
ALTER TABLE `f_risk_source`
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql>
</changeSet>
<changeSet
author=
"zhouyi"
id=
"1589444792916-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<tableExists
tableName=
"f_station_info"
/>
</preConditions>
<comment>
create table f_station_info
</comment>
<sql>
DROP TABLE IF EXISTS f_station_info;
CREATE TABLE `f_station_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(20) DEFAULT NULL COMMENT '名称',
`station_code` varchar(32) NOT NULL COMMENT '环流站编码',
`code` varchar(10) DEFAULT NULL COMMENT '后三位编码',
`elec_type` tinyint(4) DEFAULT NULL COMMENT '换流站类型:1-发电类型;2-收电类型',
`use_type` tinyint(4) NOT NULL COMMENT '用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他',
`province_code` varchar(32) DEFAULT NULL COMMENT '省份编码',
`city_code` varchar(32) DEFAULT NULL COMMENT '市区编码',
`district_code` varchar(32) DEFAULT NULL COMMENT '区县编码',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`status` bit(1) NOT NULL DEFAULT b'0' COMMENT '0-启用;1-停用',
`longitude` double DEFAULT NULL COMMENT '经度',
`latitude` double DEFAULT NULL COMMENT '纬度',
`station_charge_user_id` varchar(50) DEFAULT NULL COMMENT '换流站负责人',
`safety_charge_user_id` varchar(50) DEFAULT NULL COMMENT '安全负责人',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `f_station_info_uniq` (`station_code`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='站端信息表';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589769364577-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
</preConditions>
<comment>
f_risk_level 增加管控级别 初始化数据
</comment>
<sql>
update f_risk_level set manage_level = 1 where level = '1';
update f_risk_level set manage_level = 2 where level = '2';
update f_risk_level set manage_level = 3 where level = '3';
update f_risk_level set manage_level = 4 where level = '4';
</sql>
</changeSet>
<changeSet
author=
"maoying"
id=
"11590390304001-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_fire_equipment_point "
columnName=
"fire_equipment_id"
/>
</preConditions>
<comment>
修改fire_equipment_id可为空
</comment>
<sql>
ALTER TABLE `f_fire_equipment_point`
MODIFY COLUMN `fire_equipment_id` bigint(20) NULL COMMENT '消防装备id' AFTER `code`;
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1591672147780-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<viewExists
viewName=
"toip_biz_message"
/>
</preConditions>
<comment>
create view toip_biz_message
</comment>
<sql>
DROP VIEW IF EXISTS toip_biz_message;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `toip_biz_message` AS SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `f_equipment` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo' ) ) UNION ALL
SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `p_point` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.ProtalDataRo' ) ) UNION ALL
SELECT
`m`.`id` AS `id`,
`m`.`time` AS `time`,
`m`.`content` AS `content`,
`m`.`title` AS `title`,
`m`.`type` AS `type`,
`m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code`
FROM
( `toip_sys_message` `m` JOIN `f_risk_source` `n` )
WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo' ) );
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_original_data"
/>
</not>
</preConditions>
<comment>
create table contingency_original_data
</comment>
<sql>
DROP TABLE IF EXISTS contingency_original_data;
CREATE TABLE `contingency_original_data` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`fire_Equipment_Name` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`fire_Equipment_Id` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`layer` int(11) NOT NULL COMMENT '一级分类',
`fire_Equipment_Layer` int(11) NOT NULL COMMENT '二级分类',
`fire_Equipment_Position` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`equipment_Id` int(11) NOT NULL COMMENT '排序',
`equipment_Name` varchar(255) DEFAULT NULL,
`mobile` varchar(255) DEFAULT NULL,
`admin_Name` varchar(255) DEFAULT NULL,
`camera_Codes` varchar(255) DEFAULT NULL,
`camera_Ids` varchar(255) DEFAULT NULL,
`fire_Count` int(11) DEFAULT NULL,
`confirm` varchar(255) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL,
`batch_No` varchar(36) NOT NULL,
`picture1` varchar(255) DEFAULT NULL,
`picture2` varchar(255) DEFAULT NULL,
`picture4` varchar(255) DEFAULT NULL,
`picture3` varchar(255) DEFAULT NULL,
`fire_Truck_Route` varchar(2000) DEFAULT NULL,
`runstep` bit(1) DEFAULT NULL,
`step_state` varchar(255) DEFAULT NULL,
`step` varchar(255) DEFAULT NULL,
`equipment_position3d` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `INDEX_BATCH_NO` (`batch_No`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_plan"
/>
</not>
</preConditions>
<comment>
create table contingency_plan
</comment>
<sql>
DROP TABLE IF EXISTS contingency_plan;
CREATE TABLE `contingency_plan` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`content` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`category` varchar(36) NOT NULL COMMENT '一级分类',
`sub_category` varchar(36) NOT NULL COMMENT '二级分类',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) NOT NULL COMMENT '排序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1593309428780-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"contingency_plan_instance"
/>
</not>
</preConditions>
<comment>
create table contingency_plan_instance
</comment>
<sql>
DROP TABLE IF EXISTS contingency_plan_instance;
CREATE TABLE `contingency_plan_instance` (
`id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`category` varchar(36) DEFAULT NULL COMMENT '一级分类',
`content` varchar(2000) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) DEFAULT NULL COMMENT '所有节点一起的排序号',
`sequence_num` int(11) DEFAULT NULL COMMENT '用于显示的序号',
`batch_no` varchar(36) NOT NULL COMMENT '预案实例编号,暂时无法区分多个火灾,暂时存储报警设备id',
`create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL,
`tips` varchar(255) DEFAULT NULL,
`runstate` bit(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案执行记录实例';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"station_charge_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_charge_user_name` varchar(20) NULL COMMENT '换流站负责人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"safety_charge_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_charge_user_name` varchar(20) NULL COMMENT '安全负责人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1605924681-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"create_user_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"create_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_phone_num` varchar(20) NULL COMMENT '创建人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"station_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_user_phone_num` varchar(20) NULL COMMENT '换流站负责人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1606290088-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"safety_user_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_user_phone_num` varchar(20) NULL COMMENT '安全负责人联系方式';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_name"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_name` varchar(20) NULL COMMENT '驻站消防队队长姓名';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_phone_num"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_phone_num` varchar(20) NULL COMMENT '驻站消防队队长电话';
</sql>
</changeSet>
<changeSet
author=
"keyong"
id=
"1608279637-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_station_info"
columnName=
"fire_captain_user_id"
/>
</not>
</preConditions>
<comment>
修改f_station_info表结构
</comment>
<sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1609226808866-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_risk_source"
columnName=
"source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add column source_id
</comment>
<sql>
alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`;
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"1609226808867-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<indexExists
indexName=
"unique_idx_source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add UNIQUE source_id
</comment>
<sql>
ALTER TABLE `f_risk_source` ADD UNIQUE unique_idx_source_id(source_id);
</sql>
</changeSet>
<changeSet
author=
"gaojianqiang"
id=
"1609989898-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"status"
/>
</not>
</preConditions>
<comment>
修改f_equipment表结构
</comment>
<sql>
ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT 0 COMMENT '预案状态:1-启动,0-未启动';
ALTER TABLE `f_equipment` ADD COLUMN `start_time` datetime(0) NULL DEFAULT NULL COMMENT '预案开始时间';
ALTER TABLE `f_equipment` ADD COLUMN `end_time` datetime(0) NULL DEFAULT NULL COMMENT '预案结束时间';
ALTER TABLE `f_equipment` ADD COLUMN `reserve_source` tinyint(4) NULL DEFAULT 0 COMMENT '预案来源:1-手动触发,0-自动触发(默认)';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_classify_tree"
/>
</not>
</preConditions>
<comment>
create table c_plan_classify_tree
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_classify_tree;
CREATE TABLE `c_plan_classify_tree` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`classify_name` varchar(255) DEFAULT NULL COMMENT '预案分类名称',
`parent_id` bigint(20) DEFAULT NULL COMMENT '父类id',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`org_code` varchar(255) DEFAULT NULL COMMENT '组织机构',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='预案分类树';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_detail"
/>
</not>
</preConditions>
<comment>
create table c_plan_detail
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_detail;
CREATE TABLE `c_plan_detail` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '数字预案ID',
`plan_name` varchar(255) DEFAULT NULL COMMENT '预案名称',
`code` varchar(255) DEFAULT NULL COMMENT '预案编号',
`classify_id` bigint(20) DEFAULT NULL COMMENT '预案类型',
`plan_range` varchar(255) DEFAULT NULL COMMENT '适用范围',
`edit_org_name` varchar(255) DEFAULT NULL COMMENT '编写部门',
`edition` varchar(255) DEFAULT NULL COMMENT '版次',
`implementation_time` datetime DEFAULT NULL COMMENT '实施时间',
`create_date` datetime NOT NULL COMMENT '录入时间',
`remark` text COMMENT '备注',
`status` int(255) DEFAULT NULL COMMENT '预案状态',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`reviser` varchar(255) DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
`org_code` varchar(255) DEFAULT NULL COMMENT '部门code',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '删除状态(0、正常,1、删除)',
`input_time` datetime DEFAULT NULL COMMENT '录入时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COMMENT='预案详情表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_doc"
/>
</not>
</preConditions>
<comment>
create table c_plan_doc
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_doc;
CREATE TABLE `c_plan_doc` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`doc_id` bigint(20) DEFAULT NULL COMMENT '文档ID',
`create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案文档关系表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-4"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_equipment"
/>
</not>
</preConditions>
<comment>
create table c_plan_equipment
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_equipment;
CREATE TABLE `c_plan_equipment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`fire_equipment_id` bigint(20) DEFAULT NULL COMMENT '电力装备ID',
`create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案电力设备关系表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-5"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_operation_record"
/>
</not>
</preConditions>
<comment>
create table c_plan_operation_record
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_operation_record;
CREATE TABLE `c_plan_operation_record` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`plan_pattern` tinyint(4) DEFAULT NULL COMMENT '运行模式(4、模拟,5、自动)',
`status` tinyint(4) DEFAULT NULL COMMENT '运行状态(0、运行中,1、完毕,3、中断)',
`execution_type` tinyint(4) DEFAULT NULL COMMENT '执行方式(0、预案验证 1、火灾处置)',
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`batch_no` varchar(255) DEFAULT NULL COMMENT '批次号',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`start_user_name` varchar(255) DEFAULT NULL COMMENT '启动人名称',
`start_user_id` varchar(255) DEFAULT NULL COMMENT '启动人id',
`equipment_code` varchar(20) DEFAULT NULL COMMENT '装备code',
`equipment_name` varchar(255) DEFAULT NULL COMMENT '装备名称',
`equipment_id` bigint(11) DEFAULT NULL COMMENT '装备ID',
`fire_equipment_id` bigint(255) DEFAULT NULL COMMENT '电力设备ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COMMENT='预案运行记录表';
</sql>
</changeSet>
<changeSet
author=
"wujunkai"
id=
"1612272587000-6"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_rule"
/>
</not>
</preConditions>
<comment>
create table c_plan_rule
</comment>
<sql>
DROP TABLE IF EXISTS c_plan_rule;
CREATE TABLE `c_plan_rule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`rule_id` varchar(32) DEFAULT NULL COMMENT '规则ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`rule_name` varchar(100) DEFAULT NULL COMMENT '规则名称',
`pic_url` varchar(100) DEFAULT NULL COMMENT '规则树形图路径',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4;
</sql>
</changeSet>
<changeSet
author=
"maoying"
id=
"1612272587000-7"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"c_plan_operation_record"
columnName=
"equipment_code"
/>
</preConditions>
<comment>
c_plan_operation_record table equipment_code MODIFY
</comment>
<sql>
ALTER TABLE `c_plan_operation_record`
MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ;
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"xxz-2022-07-07-01"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"c_plan_rule"
columnName=
"plan_step"
/>
</not>
</preConditions>
<comment>
c_plan_rule add column plan_step
</comment>
<sql>
alter table `c_plan_rule` add column `plan_step` json DEFAULT NULL COMMENT '预案步骤';
</sql>
</changeSet>
<changeSet
author=
"gaojianqiang"
id=
"20220901-01"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"toip_rm_snapshot"
columnName=
"method_param"
/>
</preConditions>
<comment>
修改属性字段 method_param
</comment>
<sql>
ALTER TABLE `toip_rm_snapshot` MODIFY COLUMN `method_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数' AFTER `equipment_id`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/PlanOperationRecordMapper.xml
View file @
49dec6b2
...
...
@@ -115,6 +115,15 @@
WHERE
cpor.batch_no = #{batchNo}
</select>
<select
id=
"getPlanRuleByBatchNo"
resultType=
"com.yeejoin.amos.fas.dao.entity.PlanRule"
>
SELECT
cpr.*
FROM
c_plan_rule cpr
LEFT JOIN c_plan_operation_record cpor ON cpor.plan_id = cpr.plan_id
WHERE
cpor.batch_no = #{batchNo}
</select>
<select
id=
"getNewestBatchNo"
resultType=
"java.lang.String"
>
select batch_no as batchNo from c_plan_operation_record where status = 0 and is_delete = 0 order by create_date desc limit 1
...
...
YeeAmosFireAutoSysStart/src/main/resources/json/plan-step.json
0 → 100644
View file @
49dec6b2
[
{
"stepCode"
:
"0"
,
"stepName"
:
"确认灾情"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"FIRE_CONFIRM"
},
{
"stepCode"
:
"1"
,
"stepName"
:
"停运换流阀"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"STOP_COMMUTATION"
},
{
"stepCode"
:
"2"
,
"stepName"
:
"拨打报警电话"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"CALL_PHONE"
},
{
"stepCode"
:
"3"
,
"stepName"
:
"确认油枕排油系统已开启"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"DRAIN_OIL_CONFIRM"
},
{
"stepCode"
:
"4"
,
"stepName"
:
"确认水喷雾系统已开启"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"OPEN_WATERSYSTEM"
},
{
"stepCode"
:
"5"
,
"stepName"
:
"断开上级电源"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"OFF_POWER"
},
{
"stepCode"
:
"6"
,
"stepName"
:
"停运阀厅空调系统"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"STOP_AIRCON"
},
{
"stepCode"
:
"7"
,
"stepName"
:
"一键开启消防炮"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"MONITOR_START"
},
{
"stepCode"
:
"8"
,
"stepName"
:
"驻站消防队指挥权交接"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"HANDOVER_COMMAND"
},
{
"stepCode"
:
"9"
,
"stepName"
:
"确认本体排油已开启"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"OWNER_DRAIN_OIL"
},
{
"stepCode"
:
"10"
,
"stepName"
:
"启动阀厅应急预案"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"START_VALVE_HALL_CONTINGENCY"
},
{
"stepCode"
:
"11"
,
"stepName"
:
"电缆沟封堵"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"PLUG_CABLETRENCH"
},
{
"stepCode"
:
"12"
,
"stepName"
:
"政府消防队指挥权交接"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"HANDOVER_FIGTHHING"
},
{
"stepCode"
:
"13"
,
"stepName"
:
"确认明火扑灭"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"FIRE_EXTINCT"
},
{
"stepCode"
:
"14"
,
"stepName"
:
"应急处置结束"
,
"stepStatus"
:
"0"
,
"buttonCode"
:
"END_EMERGENCY"
}
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment