Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
a730ef3d
Commit
a730ef3d
authored
Oct 16, 2023
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新消防系统运行状态
parent
37db670d
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
291 additions
and
8 deletions
+291
-8
EquipIndexDto.java
...ava/com/yeejoin/equipmanage/common/dto/EquipIndexDto.java
+28
-0
FireFightingSystemEntity.java
...n/equipmanage/common/entity/FireFightingSystemEntity.java
+10
-0
ConfigPageTopicEnum.java
...yeejoin/equipmanage/common/enums/ConfigPageTopicEnum.java
+2
-1
TopicEnum.java
.../java/com/yeejoin/equipmanage/common/enums/TopicEnum.java
+2
-1
TrueOrFalseEnum.java
...com/yeejoin/equipmanage/common/enums/TrueOrFalseEnum.java
+15
-2
FireFightingSystemController.java
.../equipmanage/controller/FireFightingSystemController.java
+7
-0
FireSystemAction.java
.../com/yeejoin/equipmanage/controller/FireSystemAction.java
+119
-0
IntegratePageDataListener.java
...ejoin/equipmanage/listener/IntegratePageDataListener.java
+10
-2
ApplicationRunnerImpl.java
...ejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
+1
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+48
-0
wl-3.6.0.xml
...ot-system-equip/src/main/resources/changelog/wl-3.6.0.xml
+12
-0
systemStateIndex.json
...ystem-equip/src/main/resources/json/systemStateIndex.json
+29
-0
EmergencyMapper.xml
...ystem-equip/src/main/resources/mapper/EmergencyMapper.xml
+6
-0
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+2
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/dto/EquipIndexDto.java
0 → 100644
View file @
a730ef3d
package
com
.
yeejoin
.
equipmanage
.
common
.
dto
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author keyong
* @title: EquipIndexDto
* <pre>
* @description: TODO
* </pre>
* @date 2023/10/11 18:11
*/
@RuleFact
(
value
=
"测点指标数据"
,
project
=
"换流站消防专项预案"
)
@Data
public
class
EquipIndexDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7404825884689318992L
;
@Label
(
"指标key"
)
private
String
indexKey
;
@Label
(
"值"
)
private
String
indexValue
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/FireFightingSystemEntity.java
View file @
a730ef3d
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
com.yeejoin.equipmanage.common.vo.FileUploadVo
;
import
com.yeejoin.equipmanage.common.vo.FileUploadVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.models.auth.In
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -141,4 +142,13 @@ public class FireFightingSystemEntity {
...
@@ -141,4 +142,13 @@ public class FireFightingSystemEntity {
@ApiModelProperty
(
value
=
"主要设计人员"
)
@ApiModelProperty
(
value
=
"主要设计人员"
)
private
String
leadDesigner
;
private
String
leadDesigner
;
@ApiModelProperty
(
"系统运行状态"
)
private
String
systemRunState
;
@TableField
(
exist
=
false
)
private
Integer
isAlarm
;
@TableField
(
exist
=
false
)
private
String
uUID
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/ConfigPageTopicEnum.java
View file @
a730ef3d
...
@@ -14,7 +14,8 @@ import java.util.List;
...
@@ -14,7 +14,8 @@ import java.util.List;
@AllArgsConstructor
@AllArgsConstructor
public
enum
ConfigPageTopicEnum
{
public
enum
ConfigPageTopicEnum
{
INTEGRATE
(
"INTEGRATE_TOPIC/#"
,
"集成页面统配主题"
);
INTEGRATE
(
"INTEGRATE_TOPIC/#"
,
"集成页面统配主题"
),
SYSTEMDETAIL
(
"EQUIP_INDEX_ON_SYSTEM_DETAIL"
,
"系统详情页面大屏初始化主题"
);
private
String
topic
;
private
String
topic
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/TopicEnum.java
View file @
a730ef3d
...
@@ -21,7 +21,8 @@ public enum TopicEnum {
...
@@ -21,7 +21,8 @@ public enum TopicEnum {
EQXXTJ
(
"fasReportInsertOrUpdate"
,
"设备信号消息统计列表"
),
EQXXTJ
(
"fasReportInsertOrUpdate"
,
"设备信号消息统计列表"
),
ALARM_LOG_INSERT
(
"alarm/log/insert"
,
"告警日志插入"
),
ALARM_LOG_INSERT
(
"alarm/log/insert"
,
"告警日志插入"
),
IOT_SYSTEM__AlARM
(
"iot-system-alarm"
,
"确警消息"
),
IOT_SYSTEM__AlARM
(
"iot-system-alarm"
,
"确警消息"
),
SHBZYCXH
(
"fasNormalIndexInsertOrUpdate"
,
"四横八纵遥测信号"
);
SHBZYCXH
(
"fasNormalIndexInsertOrUpdate"
,
"四横八纵遥测信号"
),
XFXTYXZT
(
"fasFireSystemRunStateUpdate"
,
"站端消防系统运行状态更新主题"
);
private
String
topic
;
private
String
topic
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/TrueOrFalseEnum.java
View file @
a730ef3d
...
@@ -9,7 +9,7 @@ package com.yeejoin.equipmanage.common.enums;
...
@@ -9,7 +9,7 @@ package com.yeejoin.equipmanage.common.enums;
* @date 2020/11/4 19:34
* @date 2020/11/4 19:34
*/
*/
public
enum
TrueOrFalseEnum
{
public
enum
TrueOrFalseEnum
{
real
(
0
,
"true"
,
"是"
,
"进口"
),
fake
(
1
,
"false"
,
"否"
,
"国产
"
);
real
(
0
,
"true"
,
"是"
,
"进口"
,
"0"
),
fake
(
1
,
"false"
,
"否"
,
"国产"
,
"1
"
);
public
final
int
name
;
public
final
int
name
;
...
@@ -19,10 +19,23 @@ public enum TrueOrFalseEnum {
...
@@ -19,10 +19,23 @@ public enum TrueOrFalseEnum {
public
final
String
desc
;
public
final
String
desc
;
TrueOrFalseEnum
(
int
name
,
String
value
,
String
flag
,
String
desc
)
{
public
final
String
stringValue
;
TrueOrFalseEnum
(
int
name
,
String
value
,
String
flag
,
String
desc
,
String
stringValue
)
{
this
.
name
=
name
;
this
.
name
=
name
;
this
.
value
=
value
;
this
.
value
=
value
;
this
.
flag
=
flag
;
this
.
flag
=
flag
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
this
.
stringValue
=
stringValue
;
}
public
static
String
reverseObj
(
String
str
)
{
if
(
str
.
equalsIgnoreCase
(
TrueOrFalseEnum
.
real
.
stringValue
))
{
return
TrueOrFalseEnum
.
fake
.
stringValue
;
}
else
if
(
str
.
equalsIgnoreCase
(
TrueOrFalseEnum
.
fake
.
stringValue
))
{
return
TrueOrFalseEnum
.
real
.
stringValue
;
}
else
{
return
null
;
}
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemController.java
View file @
a730ef3d
...
@@ -15,6 +15,7 @@ import com.yeejoin.equipmanage.common.entity.*;
...
@@ -15,6 +15,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import
com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO
;
import
com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO
;
import
com.yeejoin.equipmanage.common.entity.dto.RequestBaseDto
;
import
com.yeejoin.equipmanage.common.entity.dto.RequestBaseDto
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
...
@@ -788,8 +789,14 @@ public class FireFightingSystemController extends AbstractBaseController {
...
@@ -788,8 +789,14 @@ public class FireFightingSystemController extends AbstractBaseController {
map1
.
put
(
"highLight"
,
"true"
);
map1
.
put
(
"highLight"
,
"true"
);
ite
.
addAll
(
list1
);
ite
.
addAll
(
list1
);
ite
.
add
(
map1
);
ite
.
add
(
map1
);
Map
<
String
,
String
>
map2
=
new
HashMap
<>();
map2
.
put
(
"key"
,
"系统运行状态"
);
map2
.
put
(
"value"
,
"1"
.
equals
(
fireFightingSystem
.
getSystemRunState
())
?
"运行"
:
"停止"
);
map2
.
put
(
"highLight"
,
"true"
);
res
.
put
(
"items"
,
ite
);
res
.
put
(
"items"
,
ite
);
res
.
put
(
"title"
,
"基本信息"
);
res
.
put
(
"title"
,
"基本信息"
);
ite
.
add
(
map2
);
fireFightingSystem
.
setSystemRunState
(
"1"
.
equals
(
fireFightingSystem
.
getSystemRunState
())
?
"运行"
:
"停止"
);
Map
<
String
,
Object
>
fireSystem
=
Bean
.
BeantoMap
(
fireFightingSystem
);
Map
<
String
,
Object
>
fireSystem
=
Bean
.
BeantoMap
(
fireFightingSystem
);
fireSystem
.
put
(
"detailId"
,
fireFightingSystem
.
getId
());
fireSystem
.
put
(
"detailId"
,
fireFightingSystem
.
getId
());
Map
<
String
,
Object
>
state
=
new
HashMap
<>();
Map
<
String
,
Object
>
state
=
new
HashMap
<>();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireSystemAction.java
0 → 100644
View file @
a730ef3d
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.component.rule.MethodParam
;
import
com.yeejoin.amos.component.rule.RuleActionBean
;
import
com.yeejoin.amos.component.rule.RuleMethod
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.equipmanage.common.dto.EquipIndexDto
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity
;
import
com.yeejoin.equipmanage.common.enums.TopicEnum
;
import
com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
org.apache.commons.io.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
/**
* @author keyong
* @title: FireSystemAction
* <pre>
* @description: 消防系统运行状态
* </pre>
* @date 2023/10/11 16:50
*/
@Component
@RuleActionBean
(
beanLabel
=
"消防系统运行状态"
)
public
class
FireSystemAction
{
public
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
FireSystemAction
.
class
);
@Autowired
protected
EmqKeeper
emqKeeper
;
@Autowired
private
IFireFightingSystemService
systemService
;
@Autowired
private
IEquipmentSpecificIndexSerivce
specificIndexSerivce
;
@Value
(
"classpath:/json/systemStateIndex.json"
)
private
Resource
systemStateIndex
;
/**
*
* @param code
* @param systemTypeCode
* @param runStateCode
* @description methodLabel是配置的方法名label,project是规则调用的文件夹名称,方法配置在预案文件夹中
*/
@RuleMethod
(
methodLabel
=
"更新消防系统运行状态"
,
project
=
"换流站消防专项预案"
)
public
void
changeFireSystemRunState
(
@MethodParam
(
paramLabel
=
"系统编码"
)
String
code
,
@MethodParam
(
paramLabel
=
"系统类型编码"
)
String
systemTypeCode
,
@MethodParam
(
paramLabel
=
"系统运行状态"
)
String
runStateCode
,
@MethodParam
(
paramLabel
=
"多指标复合判断"
)
String
boolValue
,
@MethodParam
(
paramLabel
=
"测点指标数据"
)
Object
paramObj
)
throws
Exception
{
boolean
bool
=
Boolean
.
FALSE
;
LambdaQueryWrapper
<
FireFightingSystemEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
FireFightingSystemEntity:
:
getCode
,
code
).
eq
(
FireFightingSystemEntity:
:
getSystemTypeCode
,
systemTypeCode
);
FireFightingSystemEntity
entity
=
systemService
.
getOne
(
queryWrapper
);
if
(
TrueOrFalseEnum
.
real
.
value
.
equalsIgnoreCase
(
boolValue
))
{
// 此方法只针对多条件 与 的逻辑
EquipIndexDto
dto
=
JSONObject
.
parseObject
(
paramObj
.
toString
(),
EquipIndexDto
.
class
);
String
json
=
null
;
try
{
json
=
IOUtils
.
toString
(
systemStateIndex
.
getInputStream
(),
java
.
lang
.
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
<
Map
>
mapList
=
JSONObject
.
parseArray
(
json
,
Map
.
class
);
List
<
Map
>
resultList
=
mapList
.
stream
().
filter
(
x
->
systemTypeCode
.
equalsIgnoreCase
(
String
.
valueOf
(
x
.
get
(
"typeCode"
)))).
collect
(
Collectors
.
toList
());
List
<
EquipIndexDto
>
indexDtos
=
new
ArrayList
<>();
resultList
.
forEach
(
x
->
{
List
<
EquipIndexDto
>
list
=
JSONArray
.
parseArray
(
String
.
valueOf
(
x
.
get
(
"indexVo"
)),
EquipIndexDto
.
class
);
indexDtos
.
addAll
(
list
);
});
List
<
EquipIndexDto
>
list
=
indexDtos
.
stream
().
filter
(
x
->
!
dto
.
getIndexKey
().
equalsIgnoreCase
(
String
.
valueOf
(
x
.
getIndexKey
()))).
collect
(
Collectors
.
toList
());
boolean
flag
=
Boolean
.
TRUE
;
for
(
EquipIndexDto
o
:
list
)
{
// 此处由于测点装备可能不跟系统绑定,所以此处默认取第一个
EquipmentSpecificIndex
index
=
specificIndexSerivce
.
getOne
(
new
QueryWrapper
<
EquipmentSpecificIndex
>().
eq
(
"equipment_index_key"
,
o
.
getIndexKey
()).
last
(
"limit 1"
));
if
(!(
o
.
getIndexKey
().
equalsIgnoreCase
(
index
.
getEquipmentIndexKey
())
&&
o
.
getIndexValue
().
equalsIgnoreCase
(
index
.
getValue
())))
{
flag
=
Boolean
.
FALSE
;
break
;
}
}
if
(
flag
)
{
entity
.
setSystemRunState
(
runStateCode
);
bool
=
systemService
.
saveOrUpdate
(
entity
);
}
}
else
{
entity
.
setSystemRunState
(
runStateCode
);
bool
=
systemService
.
saveOrUpdate
(
entity
);
}
if
(
bool
)
{
entity
.
setIsAlarm
(
1
);
entity
.
setUUID
(
UUID
.
randomUUID
().
toString
());
emqKeeper
.
getMqttClient
().
publish
(
TopicEnum
.
XFXTYXZT
.
getTopic
(),
JSON
.
toJSONString
(
entity
).
getBytes
(),
1
,
false
);
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/IntegratePageDataListener.java
View file @
a730ef3d
package
com
.
yeejoin
.
equipmanage
.
listener
;
package
com
.
yeejoin
.
equipmanage
.
listener
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
...
@@ -8,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -8,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -18,7 +21,10 @@ import java.util.Map;
...
@@ -18,7 +21,10 @@ import java.util.Map;
public
class
IntegratePageDataListener
extends
EmqxListener
{
public
class
IntegratePageDataListener
extends
EmqxListener
{
@Autowired
@Autowired
IFireFightingSystemService
fireFightingSystemService
;
IFireFightingSystemService
fireFightingSystemService
;
@Autowired
IEquipmentSpecificIndexSerivce
equipmentSpecificIndexSerivce
;
@Override
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
...
@@ -32,7 +38,9 @@ public class IntegratePageDataListener extends EmqxListener {
...
@@ -32,7 +38,9 @@ public class IntegratePageDataListener extends EmqxListener {
String
code
=
topic
.
substring
(
topic
.
indexOf
(
split
)
+
1
);
String
code
=
topic
.
substring
(
topic
.
indexOf
(
split
)
+
1
);
fireFightingSystemService
.
integrationPageSysData
(
code
,
false
);
fireFightingSystemService
.
integrationPageSysData
(
code
,
false
);
}
}
}
else
if
(
"EQUIP_INDEX_ON_SYSTEM_DETAIL"
.
equalsIgnoreCase
(
topic
))
{
log
.
warn
(
msg
.
toString
());
// List<EquipmentSpecificIndex> list = equipmentSpecificIndexSerivce.listByIds();
}
}
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
View file @
a730ef3d
...
@@ -63,5 +63,6 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
...
@@ -63,5 +63,6 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
maintenanceResourceDataService
.
subscribeTopic
();
maintenanceResourceDataService
.
subscribeTopic
();
emqKeeper
.
subscript
(
ConfigPageTopicEnum
.
INTEGRATE
.
getTopic
(),
2
,
integratePageDataListener
);
emqKeeper
.
subscript
(
ConfigPageTopicEnum
.
INTEGRATE
.
getTopic
(),
2
,
integratePageDataListener
);
emqKeeper
.
subscript
(
ConfigPageTopicEnum
.
SYSTEMDETAIL
.
getTopic
(),
2
,
integratePageDataListener
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
a730ef3d
...
@@ -8,10 +8,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -8,10 +8,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm
;
import
com.yeejoin.equipmanage.common.dto.EquipIndexDto
;
import
com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto
;
import
com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
...
@@ -30,11 +33,13 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
...
@@ -30,11 +33,13 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.IOUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronization
;
...
@@ -43,13 +48,16 @@ import org.springframework.util.CollectionUtils;
...
@@ -43,13 +48,16 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -154,6 +162,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -154,6 +162,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private
IEquipmentService
equipmentService
;
private
IEquipmentService
equipmentService
;
@Autowired
@Autowired
private
IPressurePumpService
pressurePumpService
;
private
IPressurePumpService
pressurePumpService
;
@Autowired
private
RuleTrigger
ruleTrigger
;
// @Autowired
// private AmosRequestContext amosAuth;
@Value
(
"${equipManage.name}"
)
@Value
(
"${equipManage.name}"
)
private
String
serverName
;
private
String
serverName
;
@Value
(
"${state.code:code}"
)
@Value
(
"${state.code:code}"
)
...
@@ -182,6 +194,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -182,6 +194,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private
String
pressurePumpStart
;
private
String
pressurePumpStart
;
@Value
(
"${emergency.disposal.indicators}"
)
@Value
(
"${emergency.disposal.indicators}"
)
private
String
emergencyDisposalIndicators
;
private
String
emergencyDisposalIndicators
;
@Value
(
"classpath:/json/systemStateIndex.json"
)
private
Resource
systemStateIndex
;
public
static
List
<
EquipmentSpecificAlarmLog
>
upAlarmLogStatus
(
String
iotCode
,
String
equipmentSpecificIndexKey
,
public
static
List
<
EquipmentSpecificAlarmLog
>
upAlarmLogStatus
(
String
iotCode
,
String
equipmentSpecificIndexKey
,
String
traceId
,
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
,
String
traceId
,
IEquipmentSpecificAlarmLogService
equipmentSpecificAlarmLogService
,
...
@@ -1057,6 +1071,27 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -1057,6 +1071,27 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
//根据指标数据处理预案按钮
String
json
=
null
;
try
{
json
=
IOUtils
.
toString
(
systemStateIndex
.
getInputStream
(),
java
.
lang
.
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
<
Map
>
mapList
=
JSONObject
.
parseArray
(
json
,
Map
.
class
);
List
<
EquipIndexDto
>
indexDtos
=
new
ArrayList
<>();
mapList
.
forEach
(
x
->
{
List
<
EquipIndexDto
>
list
=
JSONArray
.
parseArray
(
String
.
valueOf
(
x
.
get
(
"indexVo"
)),
EquipIndexDto
.
class
);
indexDtos
.
addAll
(
list
);
});
List
<
EquipIndexDto
>
list
=
indexDtos
.
stream
().
filter
(
x
->
iotDataVO
.
getKey
().
equalsIgnoreCase
(
String
.
valueOf
(
x
.
getIndexKey
()))).
collect
(
Collectors
.
toList
());
if
(
0
<
list
.
size
()){
EquipIndexDto
indexDto
=
new
EquipIndexDto
();
indexDto
.
setIndexKey
(
iotDataVO
.
getKey
());
indexDto
.
setIndexValue
(
value
);
systemStateExec
(
indexDto
);
}
}
}
}
}
});
});
...
@@ -1167,6 +1202,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -1167,6 +1202,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
// 触发规则调用,修改消防系统运行状态
private
void
systemStateExec
(
EquipIndexDto
indexDto
)
{
String
autoExecPath
=
"换流站消防专项预案/autoExecuteSystemState"
;
try
{
// RequestContext.setAppKey(amosAuth.getAppKey());
// RequestContext.setProduct(amosAuth.getProduct());
// RequestContext.setToken(amosAuth.getToken());
ruleTrigger
.
publish
(
indexDto
,
autoExecPath
,
new
String
[]
{});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
handlingAlarms
(
EquipmentSpecificIndex
equipmentSpecificIndex
,
boolean
alarmFlag
)
{
private
void
handlingAlarms
(
EquipmentSpecificIndex
equipmentSpecificIndex
,
boolean
alarmFlag
)
{
equipmentSpecificIndex
.
setIsAlarm
(
1
);
equipmentSpecificIndex
.
setIsAlarm
(
1
);
equipmentSpecificIndex
.
setValue
(
String
.
valueOf
(
alarmFlag
));
equipmentSpecificIndex
.
setValue
(
String
.
valueOf
(
alarmFlag
));
...
...
amos-boot-system-equip/src/main/resources/changelog/wl-3.6.0.xml
View file @
a730ef3d
...
@@ -928,4 +928,15 @@
...
@@ -928,4 +928,15 @@
UPDATE wl_equipment_specific_index esi SET esi.type_code = ( SELECT type_code FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );
UPDATE wl_equipment_specific_index esi SET esi.type_code = ( SELECT type_code FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );
</sql>
</sql>
</changeSet>
</changeSet>
<changeSet
author=
"keyong"
id=
"1697017798"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_fire_fighting_system"
columnName=
"system_run_state"
/>
</not>
</preConditions>
<comment>
f_fire_fighting_system表新增属性字段system_run_state
</comment>
<sql>
ALTER TABLE `f_fire_fighting_system` ADD COLUMN `system_run_state` VARCHAR (10) DEFAULT '1' COMMENT '站端消防系统运行状态 0-停止 1-运行';
</sql>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
\ No newline at end of file
amos-boot-system-equip/src/main/resources/json/systemStateIndex.json
0 → 100644
View file @
a730ef3d
[
{
"name"
:
"火灾自动报警系统"
,
"typeCode"
:
"fireAlarmSys"
,
"code"
:
"011023306003010000000013"
,
"indexVo"
:
[
{
"indexKey"
:
"FAS_SmokeAlarm_FireAlarm"
,
"indexValue"
:
"true"
}
]
},
{
"name"
:
"消防给水系统"
,
"typeCode"
:
"fireWaterSys"
,
"code"
:
"011023306003010000000068"
,
"indexVo"
:
[
{
"indexKey"
:
"FAS_SmokeAlarm_Fault"
,
"indexValue"
:
"true"
},
{
"indexKey"
:
"FAS_SmokeAlarm_Shield"
,
"indexValue"
:
"true"
}
]
}
]
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/EmergencyMapper.xml
View file @
a730ef3d
...
@@ -8,6 +8,12 @@
...
@@ -8,6 +8,12 @@
`fs`.`name` AS `name`,
`fs`.`name` AS `name`,
`fs`.system_type_code AS systemTypeCode,
`fs`.system_type_code AS systemTypeCode,
`fs`.`code` AS code,
`fs`.`code` AS code,
CASE
WHEN `fs`.system_run_state = '0' THEN
'停止'
WHEN `fs`.system_run_state = '1' THEN
'运行'
END AS systemRunState,
IF
IF
(((
(((
SELECT
SELECT
...
...
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
a730ef3d
...
@@ -5896,7 +5896,7 @@
...
@@ -5896,7 +5896,7 @@
SELECT
SELECT
COUNT(wlesal.id) AS totalNum,
COUNT(wlesal.id) AS totalNum,
IFNULL((select COUNT(DISTINCT wl.equipment_specific_id) from wl_equipment_specific_alarm_log wl where
IFNULL((select COUNT(DISTINCT wl.equipment_specific_id) from wl_equipment_specific_alarm_log wl where
wl.`status` = 1), 0) AS alarmEquipNum,
wl.`status` = 1
AND system_codes LIKE CONCAT('%', #{systemCode}, '%')
), 0) AS alarmEquipNum,
IFNULL(SUM(IF(wlesal.clean_time IS NULL,1,0)), 0) AS unClearNum,
IFNULL(SUM(IF(wlesal.clean_time IS NULL,1,0)), 0) AS unClearNum,
IFNULL(SUM(IF(wlesal.confirm_type IS NOT NULL,1,0)), 0) AS handledNum
IFNULL(SUM(IF(wlesal.confirm_type IS NOT NULL,1,0)), 0) AS handledNum
FROM
FROM
...
@@ -5904,7 +5904,7 @@
...
@@ -5904,7 +5904,7 @@
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids )
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids )
<where>
<where>
<if
test=
"systemCode != null and systemCode != ''"
>
<if
test=
"systemCode != null and systemCode != ''"
>
fs.
system_type_
code = #{systemCode}
fs.code = #{systemCode}
</if>
</if>
</where>
</where>
</select>
</select>
...
...
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