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
506b08ce
Commit
506b08ce
authored
Dec 10, 2021
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:消防水池液位推送(/AMOS-AUTOSYS/yinan/analogue)
parent
49bd8187
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
121 additions
and
23 deletions
+121
-23
FormInstanceController.java
.../amos/fas/business/controller/FormInstanceController.java
+27
-0
FormInstanceMapper.java
...join/amos/fas/business/dao/mapper/FormInstanceMapper.java
+3
-3
FormInstanceServiceImpl.java
...os/fas/business/service/impl/FormInstanceServiceImpl.java
+3
-2
HandlerMqttMessageImpl.java
...mos/fas/business/service/impl/HandlerMqttMessageImpl.java
+22
-1
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+1
-4
IFormInstanceService.java
...amos/fas/business/service/intfc/IFormInstanceService.java
+6
-3
ScheduledUtil.java
...ava/com/yeejoin/amos/fas/business/util/ScheduledUtil.java
+25
-7
FormInstanceVo.java
...java/com/yeejoin/amos/fas/business/vo/FormInstanceVo.java
+26
-0
dbTemplate_form_instance.xml
...src/main/resources/db/mapper/dbTemplate_form_instance.xml
+8
-3
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/FormInstanceController.java
0 → 100644
View file @
506b08ce
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
com.yeejoin.amos.fas.business.util.ScheduledUtil
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/api/formInstance"
)
@Api
(
tags
=
"建筑API"
)
public
class
FormInstanceController
extends
BaseController
{
@Autowired
private
ScheduledUtil
scheduledUtil
;
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"消防水池与设备编码关系存入Redis"
,
notes
=
"消防水池与设备编码关系存入Redis"
)
@RequestMapping
(
value
=
"/saveWaterLevelToRedis"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
saveWaterLevelToRedis
()
{
return
CommonResponseUtil
.
success
(
scheduledUtil
.
saveWaterLevelToRedis
());
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/FormInstanceMapper.java
View file @
506b08ce
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
import
com.yeejoin.amos.fas.business.vo.FormInstanceVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @ProjectName: YeeAmosFireAutoSysRoot
...
@@ -14,6 +14,6 @@ import java.util.Map;
...
@@ -14,6 +14,6 @@ import java.util.Map;
* @Date: 2021/12/10 17:53
* @Date: 2021/12/10 17:53
* @Version: 1.0
* @Version: 1.0
*/
*/
public
interface
FormInstanceMapper
extends
BaseMapper
{
public
interface
FormInstanceMapper
extends
BaseMapper
{
List
<
Map
<
String
,
String
>
>
queryFirePool
(
@Param
(
"firePoolIndexKey"
)
String
firePoolIndexKey
);
List
<
FormInstanceVo
>
queryFirePool
(
@Param
(
"firePoolIndexKey"
)
String
firePoolIndexKey
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FormInstanceServiceImpl.java
View file @
506b08ce
...
@@ -2,11 +2,11 @@ package com.yeejoin.amos.fas.business.service.impl;
...
@@ -2,11 +2,11 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.yeejoin.amos.fas.business.dao.mapper.FormInstanceMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FormInstanceMapper
;
import
com.yeejoin.amos.fas.business.service.intfc.IFormInstanceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IFormInstanceService
;
import
com.yeejoin.amos.fas.business.vo.FormInstanceVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @ProjectName: YeeAmosFireAutoSysRoot
...
@@ -24,7 +24,7 @@ public class FormInstanceServiceImpl implements IFormInstanceService {
...
@@ -24,7 +24,7 @@ public class FormInstanceServiceImpl implements IFormInstanceService {
private
FormInstanceMapper
formInstanceMapper
;
private
FormInstanceMapper
formInstanceMapper
;
@Override
@Override
public
List
<
Map
<
String
,
String
>
>
queryFirePool
(
String
firePoolIndexKey
)
{
public
List
<
FormInstanceVo
>
queryFirePool
(
String
firePoolIndexKey
)
{
return
formInstanceMapper
.
queryFirePool
(
firePoolIndexKey
);
return
formInstanceMapper
.
queryFirePool
(
firePoolIndexKey
);
}
}
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java
View file @
506b08ce
...
@@ -153,8 +153,18 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -153,8 +153,18 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
String
nameKey
=
equipmentSpecificIndex
.
getNameKey
();
String
nameKey
=
equipmentSpecificIndex
.
getNameKey
();
String
iotCode
=
equipmentSpecificIndex
.
getIotCode
();
String
iotCode
=
equipmentSpecificIndex
.
getIotCode
();
String
value
=
equipmentSpecificIndex
.
getValue
();
String
value
=
equipmentSpecificIndex
.
getValue
();
if
(
nameKey
!=
null
&&
nameKey
.
equalsIgnoreCase
(
firePoolIndexKey
))
{
if
(
nameKey
!=
null
&&
StringUtil
.
isNotEmpty
(
value
)
&&
nameKey
.
equalsIgnoreCase
(
firePoolIndexKey
))
{
redisTemplate
.
opsForValue
().
set
(
"WaterLevel:Value:"
+
iotCode
,
value
);
redisTemplate
.
opsForValue
().
set
(
"WaterLevel:Value:"
+
iotCode
,
value
);
Object
obj
=
redisTemplate
.
opsForValue
().
get
(
"WaterLevel:Code:"
+
iotCode
);
if
(!
ObjectUtils
.
isEmpty
(
obj
))
{
FormInstanceVo
formInstanceVo
=
JSONObject
.
parseObject
(
obj
.
toString
(),
FormInstanceVo
.
class
);
String
area
=
formInstanceVo
.
getArea
();
formInstanceVo
.
setLevel
(
value
);
if
(
StringUtil
.
isNotEmpty
(
area
))
{
formInstanceVo
.
setVolume
(
String
.
format
(
"%.2f"
,
(
Double
.
valueOf
(
Double
.
parseDouble
(
value
)
*
Double
.
parseDouble
(
area
)))));
}
sendWaterLevel
(
formInstanceVo
);
}
}
}
if
(
topicEntity
.
getSimulationDate
().
equals
(
"false"
)
&&
nameKeys
.
contains
(
typeCode
)
&&
indexStateIsChange
(
equipmentSpecificIndex
)){
if
(
topicEntity
.
getSimulationDate
().
equals
(
"false"
)
&&
nameKeys
.
contains
(
typeCode
)
&&
indexStateIsChange
(
equipmentSpecificIndex
)){
log
.
info
(
"指标值没有发生变化: "
+
equipmentSpecificIndex
.
getIotCode
()+
"-"
+
equipmentSpecificIndex
.
getNameKey
()+
":"
+
equipmentSpecificIndex
.
getValue
());
log
.
info
(
"指标值没有发生变化: "
+
equipmentSpecificIndex
.
getIotCode
()+
"-"
+
equipmentSpecificIndex
.
getNameKey
()+
":"
+
equipmentSpecificIndex
.
getValue
());
...
@@ -239,6 +249,17 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
...
@@ -239,6 +249,17 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
}
}
}
}
@Async
public
void
sendWaterLevel
(
FormInstanceVo
formInstanceVo
)
{
try
{
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"analogue"
);
webMqttComponent
.
publish
(
topic
,
JSON
.
toJSONString
(
formInstanceVo
));
log
.
info
(
"消防水池液位数据发送成功!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"消防水池液位数据发送失败!"
);
}
}
/**
/**
* 三维故障火警模块推送最新5条数据
* 三维故障火警模块推送最新5条数据
* @param orgCode
* @param orgCode
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
506b08ce
...
@@ -27,10 +27,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
...
@@ -27,10 +27,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import
com.yeejoin.amos.fas.business.util.DateUtils
;
import
com.yeejoin.amos.fas.business.util.DateUtils
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.*
;
import
com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.TopicEntityVo
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum
;
import
com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum
;
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IFormInstanceService.java
View file @
506b08ce
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.yeejoin.amos.fas.business.vo.FormInstanceVo
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @ProjectName: YeeAmosFireAutoSysRoot
...
@@ -16,8 +17,9 @@ public interface IFormInstanceService {
...
@@ -16,8 +17,9 @@ public interface IFormInstanceService {
/**
/**
* 获取消防水池
* 获取消防水池
*
@return
*
* @param firePoolIndexKey
* @param firePoolIndexKey
* @return
*/
*/
List
<
Map
<
String
,
String
>
>
queryFirePool
(
String
firePoolIndexKey
);
List
<
FormInstanceVo
>
queryFirePool
(
String
firePoolIndexKey
);
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/ScheduledUtil.java
View file @
506b08ce
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.fas.business.service.intfc.IFormInstanceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IFormInstanceService
;
import
com.yeejoin.amos.fas.business.vo.FormInstanceVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -10,7 +12,6 @@ import org.springframework.scheduling.annotation.Scheduled;
...
@@ -10,7 +12,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @ProjectName: YeeAmosFireAutoSysRoot
...
@@ -34,14 +35,30 @@ public class ScheduledUtil {
...
@@ -34,14 +35,30 @@ public class ScheduledUtil {
@Value
(
"${autoSys.fire.pool.index_key}"
)
@Value
(
"${autoSys.fire.pool.index_key}"
)
private
String
firePoolIndexKey
;
private
String
firePoolIndexKey
;
@Scheduled
(
cron
=
"0 * * * * ? "
)
/**
synchronized
private
void
syncByRedis
()
{
* 每日凌晨六点执行
List
<
Map
<
String
,
String
>>
list
=
formInstanceService
.
queryFirePool
(
firePoolIndexKey
);
*/
@Scheduled
(
cron
=
"0 0 0 6 * ? "
)
synchronized
private
void
saveWaterLevelByRedis
()
{
List
<
FormInstanceVo
>
list
=
formInstanceService
.
queryFirePool
(
firePoolIndexKey
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
Map
<
String
,
String
>
map
:
list
)
{
for
(
FormInstanceVo
formInstanceVo
:
list
)
{
Object
[]
toArray
=
map
.
values
().
toArray
();
redisTemplate
.
opsForValue
().
set
(
"WaterLevel:Code:"
+
formInstanceVo
.
getIotCode
(),
JSON
.
toJSONString
(
formInstanceVo
));
redisTemplate
.
opsForValue
().
set
(
"WaterLevel:Code:"
+
toArray
[
0
],
toArray
[
1
]);
}
}
}
}
}
}
/**
* 手动调用接口执行
*/
public
Boolean
saveWaterLevelToRedis
()
{
List
<
FormInstanceVo
>
list
=
formInstanceService
.
queryFirePool
(
firePoolIndexKey
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
FormInstanceVo
formInstanceVo
:
list
)
{
redisTemplate
.
opsForValue
().
set
(
"WaterLevel:Code:"
+
formInstanceVo
.
getIotCode
(),
JSON
.
toJSONString
(
formInstanceVo
));
}
return
Boolean
.
TRUE
;
}
return
Boolean
.
FALSE
;
}
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/FormInstanceVo.java
0 → 100644
View file @
506b08ce
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
lombok.Data
;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.vo
* @ClassName: FormInstanceVo
* @Author: Jianqiang Gao
* @Description: FormInstanceVo
* @Date: 2021/12/10 21:07
* @Version: 1.0
*/
@Data
public
class
FormInstanceVo
{
private
String
name
;
private
String
code
;
private
String
level
;
private
String
maxLevel
;
private
String
alarmLevel
;
private
String
area
;
private
String
volume
;
private
String
iotCode
;
}
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_form_instance.xml
View file @
506b08ce
...
@@ -2,10 +2,15 @@
...
@@ -2,10 +2,15 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.FormInstanceMapper"
>
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.FormInstanceMapper"
>
<select
id=
"queryFirePool"
resultType=
"
java.util.HashMap
"
>
<select
id=
"queryFirePool"
resultType=
"
com.yeejoin.amos.fas.business.vo.FormInstanceVo
"
>
SELECT
SELECT
es.iot_code AS iotCode,
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS `name`,
MAX( CASE WHEN a.field_name = 'code' THEN a.field_value END ) AS `code`
MAX( CASE WHEN a.field_name = 'code' THEN a.field_value END ) AS `code`,
MAX( CASE WHEN a.field_name = 'height' THEN a.field_value END ) AS max_level,
MAX( CASE WHEN a.field_name = 'lowWaterHeight' THEN a.field_value END ) AS alarm_level,
MAX( CASE WHEN a.field_name = 'bottomArea' THEN a.field_value END ) AS area,
MAX( CASE WHEN a.field_name = 'volume' THEN a.field_value END ) AS volume,
es.iot_code
FROM
FROM
`wl_form_instance` a
`wl_form_instance` a
LEFT JOIN wl_equipment_specific es ON a.instance_id = es.warehouse_structure_id
LEFT JOIN wl_equipment_specific es ON a.instance_id = es.warehouse_structure_id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment