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
a9e71634
Commit
a9e71634
authored
Jan 08, 2021
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:新增预案状态、时间、来源
parent
a47db4b3
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
137 additions
and
9 deletions
+137
-9
Equipment.java
.../main/java/com/yeejoin/amos/fas/dao/entity/Equipment.java
+44
-0
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+19
-0
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+14
-0
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+19
-6
NumberEnum.java
...main/java/com/yeejoin/amos/fas/core/enums/NumberEnum.java
+24
-0
ReserveEnum.java
...ain/java/com/yeejoin/amos/fas/core/enums/ReserveEnum.java
+2
-1
DateUtil.java
...rc/main/java/com/yeejoin/amos/fas/core/util/DateUtil.java
+9
-0
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+6
-2
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/Equipment.java
View file @
a9e71634
package
com
.
yeejoin
.
amos
.
fas
.
dao
.
entity
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
...
...
@@ -122,6 +123,24 @@ public class Equipment extends BasicEntity {
private
Integer
status
;
/**
* 预案开始时间
*/
@Column
(
name
=
"start_time"
)
private
Date
startTime
;
/**
* 预案结束时间
*/
@Column
(
name
=
"end_time"
)
private
Date
endTime
;
/**
* 预案来源:1-手动触发,0-自动触发(默认)
*/
@Column
(
name
=
"reserve_source"
)
private
Integer
reserveSource
;
public
Equipment
()
{
}
...
...
@@ -255,4 +274,28 @@ public class Equipment extends BasicEntity {
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getReserveSource
()
{
return
reserveSource
;
}
public
void
setReserveSource
(
Integer
reserveSource
)
{
this
.
reserveSource
=
reserveSource
;
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
a9e71634
...
...
@@ -16,6 +16,11 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -93,6 +98,9 @@ public class ContingencyAction implements CustomerAction {
private
IDutyModeServer
dutyModeServer
;
@Autowired
private
IEquipmentService
equipmentService
;
@Autowired
private
RedisTemplate
redisTemplate
;
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
...
...
@@ -640,6 +648,17 @@ public class ContingencyAction implements CustomerAction {
this
.
sendcmd
(
"message"
,
paramObj
,
result
);
redisTemplate
.
delete
(
"contingencyRo"
);
// 结束预案,更新设备重点设备参数
if
(
contingencyRo
!=
null
)
{
Equipment
equipment
=
equipmentService
.
queryOne
(
Long
.
parseLong
(
contingencyRo
.
getEquipmentId
()));
if
(
equipment
!=
null
)
{
equipment
.
setEndTime
(
DateUtil
.
getDateNow
());
equipment
.
setReserveSource
(
NumberEnum
.
ZERO
.
getValue
());
equipment
.
setStatus
(
NumberEnum
.
ZERO
.
getValue
());
equipmentService
.
save
(
equipment
);
}
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
a9e71634
...
...
@@ -6,6 +6,9 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Optional
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.slf4j.Logger
;
...
...
@@ -62,6 +65,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired
private
IContingencyInstance
iContingencyInstance
;
@Autowired
private
IEquipmentService
equipmentService
;
@Value
(
"${station.name}"
)
private
String
stationName
;
...
...
@@ -175,6 +181,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
log
.
info
(
"stepstate:"
+
contingencyRo
.
getStepState
());
log
.
info
(
"stepCode:"
+
stepCode
);
Equipment
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
Long
.
parseLong
(
contingencyRo
.
getFireEquipmentId
()));
if
(
equipment
!=
null
)
{
// 获取重点设备胚胎指标
// 获取遥信指标
List
<
Map
>
points
=
fireEquipPointMapper
.
getPointsByEquipmentIdAndType
(
equipment
.
getId
(),
"SWITCH"
);
...
...
@@ -195,6 +202,13 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
ruleTrigger
.
publish
(
contingencyRo
,
equipment
.
getReservePlan
(),
ArrayUtils
.
toArray
(
equipment
.
getName
()));
publisherPlanLog
(
stepCode
,
buttonCode
,
batchNo
);
// 结束预案,更新设备重点设备参数
equipment
.
setEndTime
(
DateUtil
.
getDateNow
());
equipment
.
setReserveSource
(
NumberEnum
.
ZERO
.
getValue
());
equipment
.
setStatus
(
NumberEnum
.
ZERO
.
getValue
());
equipmentService
.
save
(
equipment
);
}
}
else
{
throw
new
Exception
(
"数据异常,请联系管理员."
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
a9e71634
...
...
@@ -22,7 +22,9 @@ import java.util.stream.Collectors;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.core.util.DateUtil
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -1044,15 +1046,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
@Override
@Transactional
public
ReserveEnum
startEquipReserve
(
Long
id
,
String
typeCode
)
{
int
count
=
equipmentService
.
countByStatus
(
1
);
if
(
count
>
0
)
{
return
ReserveEnum
.
RUN
;
int
count
=
equipmentService
.
countByStatus
(
NumberEnum
.
ONE
.
getValue
()
);
if
(
count
>
NumberEnum
.
ZERO
.
getValue
()
)
{
return
ReserveEnum
.
RUN
NING
;
}
else
{
List
<
EquipmentSpecificIndexVo
>
list
=
equipmentService
.
getReserveEquipById
(
id
,
typeCode
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
EquipmentSpecificIndexVo
equipmentSpecificIndexVo
=
new
EquipmentSpecificIndexVo
();
equipmentSpecificIndexVo
.
setEquipmentSpecificId
(
list
.
get
(
0
).
getEquipmentSpecificId
());
equipmentSpecificIndexVo
.
setEquipmentSpecificId
(
list
.
get
(
NumberEnum
.
ZERO
.
getValue
()
).
getEquipmentSpecificId
());
equipmentSpecificIndexVo
.
setType
(
typeCode
);
TopicEntityVo
topicEntity
=
new
TopicEntityVo
();
...
...
@@ -1061,9 +1064,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
String
data
=
JSON
.
toJSONString
(
topicEntity
);
System
.
out
.
println
(
data
);
iEquipmentHandlerService
.
handlerMqttMessage
(
""
,
data
);
return
ReserveEnum
.
RUNNING
;
}
else
{
Equipment
equipment
=
equipmentService
.
queryOne
(
id
);
if
(
equipment
!=
null
)
{
equipment
.
setStartTime
(
DateUtil
.
getDateNow
());
equipment
.
setEndTime
(
null
);
equipment
.
setReserveSource
(
NumberEnum
.
ONE
.
getValue
());
equipment
.
setStatus
(
NumberEnum
.
ONE
.
getValue
());
equipmentService
.
save
(
equipment
);
return
ReserveEnum
.
RUN
;
}
return
ReserveEnum
.
NOEQUIP
;
}
else
{
return
ReserveEnum
.
NOFIRE
;
}
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/enums/NumberEnum.java
0 → 100644
View file @
a9e71634
package
com
.
yeejoin
.
amos
.
fas
.
core
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 整数统一枚举
*/
@Getter
@AllArgsConstructor
public
enum
NumberEnum
{
ZERO
(
"zero"
,
0
),
ONE
(
"one"
,
1
),
TWO
(
"two"
,
2
),
THREE
(
"three"
,
3
),
FOUR
(
"four"
,
4
),
FIVE
(
"five"
,
5
);
private
String
name
;
private
Integer
value
;
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/enums/ReserveEnum.java
View file @
a9e71634
...
...
@@ -12,7 +12,8 @@ package com.yeejoin.amos.fas.core.enums;
public
enum
ReserveEnum
{
RUN
(
1
,
"启动成功"
),
RUNNING
(
2
,
"已有预案正在启动"
),
NOEQUIP
(
3
,
" 该电力设备未安装火灾探测器"
);
NOFIRE
(
3
,
"该电力设备未安装火灾探测器"
),
NOEQUIP
(
4
,
"未找到该电力设备"
);
private
Integer
status
;
private
String
text
;
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/util/DateUtil.java
View file @
a9e71634
...
...
@@ -42,6 +42,15 @@ public class DateUtil
}
/**
* 获取当前时间
*
* @return 当前日期时间
*/
public
static
Date
getDateNow
()
{
return
new
Date
();
}
/**
*
* <pre>
* 获取当前北京时间
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
a9e71634
...
...
@@ -587,7 +587,7 @@
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
</sql>
</changeSet>
<changeSet
author=
"gaojianqiang"
id=
"1609989
450
-1"
>
<changeSet
author=
"gaojianqiang"
id=
"1609989
888
-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_equipment"
columnName=
"status"
/>
...
...
@@ -595,7 +595,10 @@
</preConditions>
<comment>
修改f_equipment表结构
</comment>
<sql>
ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT NULL COMMENT '预案状态:1-启动,0-未启动';
ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT NULL 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>
</databaseChangeLog>
\ 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