Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pingshan-ranqi
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
yaqizhang
pingshan-ranqi
Commits
e5917dbb
Commit
e5917dbb
authored
Nov 15, 2021
by
王晓倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备推送数据接口更改设备状态字段
parent
1675c09d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
178 additions
and
57 deletions
+178
-57
TDetectorInfoController.java
...hong/web/controller/detector/TDetectorInfoController.java
+37
-39
TDetectorReportData.java
...in/java/com/zehong/system/domain/TDetectorReportData.java
+15
-5
TDetectorInfoDTO.java
...n/java/com/zehong/system/domain/dto/TDetectorInfoDTO.java
+3
-3
TDetectorAlarmInfoVO.java
...ava/com/zehong/system/domain/vo/TDetectorAlarmInfoVO.java
+73
-0
TDetectorReportDataMapper.java
...a/com/zehong/system/mapper/TDetectorReportDataMapper.java
+3
-0
ITDetectorReportDataService.java
...om/zehong/system/service/ITDetectorReportDataService.java
+3
-0
TDetectorInfoServiceImpl.java
.../zehong/system/service/impl/TDetectorInfoServiceImpl.java
+1
-1
TDetectorReportDataServiceImpl.java
...g/system/service/impl/TDetectorReportDataServiceImpl.java
+7
-0
TDetectorReportDataMapper.xml
...ain/resources/mapper/system/TDetectorReportDataMapper.xml
+36
-9
No files found.
gassafety-admin/src/main/java/com/zehong/web/controller/detector/TDetectorInfoController.java
View file @
e5917dbb
This diff is collapsed.
Click to expand it.
gassafety-system/src/main/java/com/zehong/system/domain/TDetectorReportData.java
View file @
e5917dbb
...
...
@@ -10,7 +10,9 @@ public class TDetectorReportData implements Serializable {
private
String
detectorCode
;
private
String
detectorStatus
;
private
String
detectorStatusId
;
private
String
statusName
;
private
Float
reportValue
;
...
...
@@ -54,12 +56,20 @@ public class TDetectorReportData implements Serializable {
this
.
detectorCode
=
detectorCode
;
}
public
String
getDetectorStatus
()
{
return
detectorStatus
;
public
String
getDetectorStatusId
()
{
return
detectorStatusId
;
}
public
void
setDetectorStatusId
(
String
detectorStatusId
)
{
this
.
detectorStatusId
=
detectorStatusId
;
}
public
String
getStatusName
()
{
return
statusName
;
}
public
void
set
DetectorStatus
(
String
detectorStatus
)
{
this
.
detectorStatus
=
detectorStatus
;
public
void
set
StatusName
(
String
statusName
)
{
this
.
statusName
=
statusName
;
}
public
Float
getReportValue
()
{
...
...
gassafety-system/src/main/java/com/zehong/system/domain/dto/TDetectorInfoDTO.java
View file @
e5917dbb
...
...
@@ -5,11 +5,11 @@ import lombok.Data;
@Data
public
class
TDetectorInfoDTO
{
private
String
de
tector
Type
;
// 1探测器、2安全用电设备
private
String
de
tector
Code
;
private
String
de
vice
Type
;
// 1探测器、2安全用电设备
private
String
de
vice
Code
;
//探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,0正常,1故障,2预警)
private
String
de
tector
Status
;
private
String
de
vice
Status
;
private
String
alarmTime
;
}
gassafety-system/src/main/java/com/zehong/system/domain/vo/TDetectorAlarmInfoVO.java
0 → 100644
View file @
e5917dbb
package
com
.
zehong
.
system
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
/**
* 推送的报警数据信息
* @author zhangzhizhong
*
*/
public
class
TDetectorAlarmInfoVO
{
// 设备编号
private
String
detectorCode
;
// 监测单位
private
String
unitName
;
// 设备类型
private
String
detectorType
;
// 预警类型
private
String
statusName
;
// 预警时间
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
alarmTime
;
// 处理状态
private
String
handledStatus
;
public
String
getDetectorCode
()
{
return
detectorCode
;
}
public
void
setDetectorCode
(
String
detectorCode
)
{
this
.
detectorCode
=
detectorCode
;
}
public
String
getUnitName
()
{
return
unitName
;
}
public
void
setUnitName
(
String
unitName
)
{
this
.
unitName
=
unitName
;
}
public
String
getDetectorType
()
{
return
detectorType
;
}
public
void
setDetectorType
(
String
detectorType
)
{
this
.
detectorType
=
detectorType
;
}
public
String
getStatusName
()
{
return
statusName
;
}
public
void
setStatusName
(
String
statusName
)
{
this
.
statusName
=
statusName
;
}
public
Date
getAlarmTime
()
{
return
alarmTime
;
}
public
void
setAlarmTime
(
Date
alarmTime
)
{
this
.
alarmTime
=
alarmTime
;
}
public
String
getHandledStatus
()
{
return
handledStatus
;
}
public
void
setHandledStatus
(
String
handledStatus
)
{
this
.
handledStatus
=
handledStatus
;
}
}
gassafety-system/src/main/java/com/zehong/system/mapper/TDetectorReportDataMapper.java
View file @
e5917dbb
...
...
@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
/**
* 设备上报的数据Mapper接口
...
...
@@ -25,6 +26,8 @@ public interface TDetectorReportDataMapper
public
List
<
TDetectorReportData
>
countDetector
(
List
<
String
>
list
);
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
();
public
List
<
TDetectorReportData
>
selectRealtimeDataList
();
/**
...
...
gassafety-system/src/main/java/com/zehong/system/service/ITDetectorReportDataService.java
View file @
e5917dbb
...
...
@@ -3,6 +3,7 @@ package com.zehong.system.service;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
/**
* 设备上报的数据Service接口
...
...
@@ -25,6 +26,8 @@ public interface ITDetectorReportDataService
public
List
<
TDetectorReportData
>
selectRealtimeDataList
();
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
();
public
List
<
TDetectorReportData
>
countDetector
(
List
<
String
>
list
);
/**
...
...
gassafety-system/src/main/java/com/zehong/system/service/impl/TDetectorInfoServiceImpl.java
View file @
e5917dbb
...
...
@@ -45,7 +45,7 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
for
(
TDetectorInfo
detector
:
list
){
if
(
"0"
.
equals
(
detector
.
getDetectorStatus
())){
detector
.
setDetectorStatus
(
"正常"
);
}
else
if
(
"1"
.
equals
(
detector
.
getDetectorStatus
()))
{
}
else
{
detector
.
setDetectorStatus
(
"离线"
);
}
}
...
...
gassafety-system/src/main/java/com/zehong/system/service/impl/TDetectorReportDataServiceImpl.java
View file @
e5917dbb
...
...
@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zehong.system.mapper.TDetectorReportDataMapper
;
...
...
@@ -39,6 +40,12 @@ public class TDetectorReportDataServiceImpl implements ITDetectorReportDataServi
return
tDetectorReportDataMapper
.
selectTDetectorReportDataByCode
(
detectorCode
);
}
@Override
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
()
{
return
tDetectorReportDataMapper
.
selectTDetectorAlarm
();
}
@Override
public
List
<
TDetectorReportData
>
selectRealtimeDataList
()
{
...
...
gassafety-system/src/main/resources/mapper/system/TDetectorReportDataMapper.xml
View file @
e5917dbb
...
...
@@ -8,7 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"sourceId"
column=
"source_id"
/>
<result
property=
"detectorCode"
column=
"detector_code"
/>
<result
property=
"deviceStatus"
column=
"device_status"
/>
<result
property=
"detectorStatusId"
column=
"detector_status_id"
/>
<result
property=
"statusName"
column=
"status_name"
/>
<result
property=
"reportValue"
column=
"report_value"
/>
<result
property=
"zhHostStatusId"
column=
"zh_host_status_id"
/>
<result
property=
"netPoint"
column=
"net_point"
/>
...
...
@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql
id=
"selectTDetectorReportDataVo"
>
select id, source_id, detector_code, detector_status, report_value, zh_host_status_id, net_point, signal_strength, ip_address, create_time, is_cancel_alarm, cancel_time from t_detector_report_data
select id, source_id, detector_code, detector_status
_id, status_name
, report_value, zh_host_status_id, net_point, signal_strength, ip_address, create_time, is_cancel_alarm, cancel_time from t_detector_report_data
</sql>
<select
id=
"selectTDetectorReportDataList"
parameterType=
"TDetectorReportData"
resultMap=
"TDetectorReportDataResult"
>
...
...
@@ -28,7 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if
test=
"sourceId != null and sourceId != ''"
>
and source_id = #{sourceId}
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
and detector_code = #{detectorCode}
</if>
<if
test=
"detectorStatus != null and detectorStatus != ''"
>
and detector_status = #{detectorStatus}
</if>
<if
test=
"detectorStatusId != null and detectorStatusId != ''"
>
and detector_status_id = #{detectorStatusId}
</if>
<if
test=
"statusName != null and statusName != ''"
>
and status_name = #{statusName}
</if>
<if
test=
"reportValue != null "
>
and report_value = #{reportValue}
</if>
<if
test=
"zhHostStatusId != null "
>
and zh_host_status_id = #{zhHostStatusId}
</if>
<if
test=
"netPoint != null "
>
and net_point = #{netPoint}
</if>
...
...
@@ -50,13 +52,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time DESC LIMIT 1
</select>
<select
id=
"selectTDetectorAlarm"
resultType=
"TDetectorAlarmInfoVO"
>
SELECT
rd.detector_code detectorCode,
CONCAT_WS("#",IFNULL(u.nick_name,IFNULL(di.linkman,di.detector_addr)),di.linkman) unitName,
di.detector_type detectorType,
rd.status_name statusName,
rd.create_time alarmTime,
IF (
rd.is_cancel_alarm = 0,
'未消除',
'已消除'
) handledStatus
FROM
t_detector_report_data rd
LEFT JOIN t_detector_info di ON rd.detector_code = di.detector_code
LEFT JOIN t_detector_user u ON u.user_id = di.user_id
WHERE u.nick_name is not NULL
ORDER BY rd.create_time DESC LIMIT 50
</select>
<select
id=
"selectRealtimeDataList"
resultMap=
"TDetectorReportDataResult"
>
SELECT * FROM
(
SELECT
t.source_id,
t.detector_code,
t.detector_status,
t.detector_status_id,
t.status_name,
t.report_value,
t.zh_host_status_id,
t.net_point,
...
...
@@ -72,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t_detector_report_data t
LEFT JOIN t_detector_info d ON t.detector_code = d.detector_code
WHERE
t.detector_status != '1'
t.detector_status
_id
!= '1'
ORDER BY t.create_time DESC
)data
GROUP BY data.detector_id LIMIT 50
...
...
@@ -80,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"countDetector"
parameterType=
"List"
resultMap=
"TDetectorReportDataResult"
>
<include
refid=
"selectTDetectorReportDataVo"
/>
where detector_status != '1' and detector_code in
where detector_status
_id
!= '1' and detector_code in
<foreach
collection=
"list"
item=
"detectorCode"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{detectorCode}
</foreach>
...
...
@@ -91,7 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
source_id,
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
detector_code,
</if>
<if
test=
"detectorStatus != null"
>
detector_status,
</if>
<if
test=
"detectorStatusId != null"
>
detector_status_id,
</if>
<if
test=
"statusName != null"
>
status_name,
</if>
<if
test=
"reportValue != null"
>
report_value,
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id,
</if>
<if
test=
"netPoint != null"
>
net_point,
</if>
...
...
@@ -104,7 +129,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
#{sourceId},
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
#{detectorCode},
</if>
<if
test=
"detectorStatus != null"
>
#{detectorStatus},
</if>
<if
test=
"detectorStatusId != null"
>
#{detectorStatusId},
</if>
<if
test=
"statusName != null"
>
#{statusName},
</if>
<if
test=
"reportValue != null"
>
#{reportValue},
</if>
<if
test=
"zhHostStatusId != null"
>
#{zhHostStatusId},
</if>
<if
test=
"netPoint != null"
>
#{netPoint},
</if>
...
...
@@ -121,7 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
source_id = #{sourceId},
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
detector_code = #{detectorCode},
</if>
<if
test=
"detectorStatus != null"
>
detector_status = #{detectorStatus},
</if>
<if
test=
"detectorStatusId != null"
>
detector_status_id = #{detectorStatusId},
</if>
<if
test=
"statusName != null"
>
status_name = #{statusName},
</if>
<if
test=
"reportValue != null"
>
report_value = #{reportValue},
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id = #{zhHostStatusId},
</if>
<if
test=
"netPoint != null"
>
net_point = #{netPoint},
</if>
...
...
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