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
Show 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
...
@@ -17,6 +17,7 @@ import com.zehong.system.domain.TDetectorUser;
...
@@ -17,6 +17,7 @@ import com.zehong.system.domain.TDetectorUser;
import
com.zehong.system.domain.TDetectorInfo
;
import
com.zehong.system.domain.TDetectorInfo
;
import
com.zehong.system.domain.dto.TDetectorInfoDTO
;
import
com.zehong.system.domain.dto.TDetectorInfoDTO
;
import
com.zehong.system.domain.form.TDetectorReportDataForm
;
import
com.zehong.system.domain.form.TDetectorReportDataForm
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
import
com.zehong.system.domain.vo.TDetectorUserVO
;
import
com.zehong.system.domain.vo.TDetectorUserVO
;
import
com.zehong.system.service.ITDetectorReportDataService
;
import
com.zehong.system.service.ITDetectorReportDataService
;
import
com.zehong.system.service.ITDetectorUserService
;
import
com.zehong.system.service.ITDetectorUserService
;
...
@@ -397,21 +398,22 @@ public class TDetectorInfoController extends BaseController
...
@@ -397,21 +398,22 @@ public class TDetectorInfoController extends BaseController
for
(
TDetectorInfoDTO
dto
:
tDetectorInfoDTOList
){
for
(
TDetectorInfoDTO
dto
:
tDetectorInfoDTOList
){
TDetectorInfo
tDetectorInfo
=
new
TDetectorInfo
();
TDetectorInfo
tDetectorInfo
=
new
TDetectorInfo
();
//
家用报警
器
//
1探测
器
if
(!
StringUtils
.
isEmpty
(
dto
.
getDe
tectorType
())
&&
dto
.
getDetectorType
().
equals
(
"1"
))
{
if
(!
StringUtils
.
isEmpty
(
dto
.
getDe
viceType
())
&&
dto
.
getDeviceType
().
equals
(
"1"
))
{
if
(!
StringUtils
.
isEmpty
(
dto
.
getDetectorStatus
())
&&
dto
.
getDetectorStatus
().
equals
(
"1"
))
{
if
(!
StringUtils
.
isEmpty
(
dto
.
getDeviceStatus
())
&&
dto
.
getDeviceStatus
().
equals
(
"1"
))
{
tDetectorInfo
.
setDetectorStatus
(
"0"
);
tDetectorInfo
.
setDetectorStatus
(
"0"
);
tDetectorInfo
.
setAlarmTime
(
null
);
tDetectorInfo
.
setAlarmTime
(
null
);
}
else
if
(
new
ArrayList
<
String
>(
Arrays
.
asList
(
"7"
,
"9"
)).
contains
(
dto
.
getDetectorStatus
()))
{
}
else
if
(
new
ArrayList
<
String
>(
Arrays
.
asList
(
"7"
,
"9"
)).
contains
(
dto
.
getDeviceStatus
()))
{
tDetectorInfo
.
setDetectorStatus
(
"1"
);
tDetectorInfo
.
setDetectorStatus
(
"1"
);
}
else
{
}
else
{
tDetectorInfo
.
setDetectorStatus
(
"2"
);
tDetectorInfo
.
setDetectorStatus
(
"2"
);
}
}
}
else
{
if
(!
StringUtils
.
isEmpty
(
dto
.
getDetectorStatus
())
&&
dto
.
getDetectorStatus
().
equals
(
"0"
)){
tDetectorInfo
.
setAlarmTime
(
null
);
}
}
}
// else{
// if(!StringUtils.isEmpty(dto.getDetectorStatus()) && dto.getDetectorStatus().equals("0")){
// tDetectorInfo.setAlarmTime(null);
// }
// }
list
.
add
(
tDetectorInfo
);
list
.
add
(
tDetectorInfo
);
}
}
...
@@ -423,7 +425,6 @@ public class TDetectorInfoController extends BaseController
...
@@ -423,7 +425,6 @@ public class TDetectorInfoController extends BaseController
throw
new
IOCException
(
ResultEnum
.
OPERATION_FAIL
);
throw
new
IOCException
(
ResultEnum
.
OPERATION_FAIL
);
}
}
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
@@ -454,14 +455,15 @@ public class TDetectorInfoController extends BaseController
...
@@ -454,14 +455,15 @@ public class TDetectorInfoController extends BaseController
if
(
tDetectorInfoList
.
size
()
>
0
){
if
(
tDetectorInfoList
.
size
()
>
0
){
//报警设备类型,1
家用报警器,2工业探测器
//报警设备类型,1
探测器,2智慧用电 E+原始类型
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceType
())
&&
tDetectorReportDataForm
.
getDeviceType
().
equals
(
"1"
)
&&
!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
!
tDetectorReportDataForm
.
getDeviceStatusId
().
equals
(
"1"
)){
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceType
())
&&
tDetectorReportDataForm
.
getDeviceType
().
equals
(
"1"
)
&&
!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
!
tDetectorReportDataForm
.
getDeviceStatusId
().
equals
(
"1"
)){
TDetectorReportData
datas
=
new
TDetectorReportData
();
TDetectorReportData
datas
=
new
TDetectorReportData
();
datas
.
setSourceId
(
tDetectorReportDataForm
.
getSourceId
());
datas
.
setSourceId
(
tDetectorReportDataForm
.
getSourceId
());
datas
.
setDetectorCode
(
tDetectorReportDataForm
.
getDeviceNo
());
datas
.
setDetectorCode
(
tDetectorReportDataForm
.
getDeviceNo
());
datas
.
setDetectorStatus
(
tDetectorReportDataForm
.
getDeviceStatusId
());
datas
.
setDetectorStatusId
(
tDetectorReportDataForm
.
getDeviceStatusId
());
datas
.
setStatusName
(
tDetectorReportDataForm
.
getStatusName
());
datas
.
setReportValue
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getReportValue
())?
null
:
Float
.
parseFloat
(
tDetectorReportDataForm
.
getReportValue
()));
datas
.
setReportValue
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getReportValue
())?
null
:
Float
.
parseFloat
(
tDetectorReportDataForm
.
getReportValue
()));
datas
.
setZhHostStatusId
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getZhHostStatusId
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getZhHostStatusId
()));
datas
.
setZhHostStatusId
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getZhHostStatusId
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getZhHostStatusId
()));
datas
.
setSignalStrength
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getSignalStrength
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getSignalStrength
()));
datas
.
setSignalStrength
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getSignalStrength
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getSignalStrength
()));
...
@@ -471,28 +473,29 @@ public class TDetectorInfoController extends BaseController
...
@@ -471,28 +473,29 @@ public class TDetectorInfoController extends BaseController
tDetectorReportDataService
.
insertTDetectorReportData
(
datas
);
tDetectorReportDataService
.
insertTDetectorReportData
(
datas
);
}
else
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceType
())
&&
tDetectorReportDataForm
.
getDeviceType
().
equals
(
"2"
)
&&
!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
!
tDetectorReportDataForm
.
getDeviceStatusId
().
equals
(
"E"
)){
TDetectorReportData
datas
=
new
TDetectorReportData
();
datas
.
setSourceId
(
tDetectorReportDataForm
.
getSourceId
());
datas
.
setDetectorCode
(
tDetectorReportDataForm
.
getDeviceNo
());
//设备类型,1家用报警器,2工业探测器
datas
.
setDetectorStatus
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())?
null
:
"E"
+
tDetectorReportDataForm
.
getDeviceStatusId
());
datas
.
setReportValue
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getReportValue
())?
null
:
Float
.
parseFloat
(
tDetectorReportDataForm
.
getReportValue
()));
datas
.
setZhHostStatusId
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getZhHostStatusId
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getZhHostStatusId
()));
datas
.
setSignalStrength
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getSignalStrength
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getSignalStrength
()));
datas
.
setNetPoint
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getNetPoint
())?
null
:
Integer
.
parseInt
(
tDetectorReportDataForm
.
getNetPoint
()));
datas
.
setIpAddress
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getIpAddress
())?
null
:
tDetectorReportDataForm
.
getIpAddress
());
datas
.
setCreateTime
(
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getCreateTime
())?
null
:
new
Date
());
tDetectorReportDataService
.
insertTDetectorReportData
(
datas
);
}
}
// else if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("2") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && !tDetectorReportDataForm.getDeviceStatusId().equals("E")){
// TDetectorReportData datas = new TDetectorReportData();
// datas.setSourceId(tDetectorReportDataForm.getSourceId());
// datas.setDetectorCode(tDetectorReportDataForm.getDeviceNo());
//
// //设备类型,1家用报警器,2工业探测器
// datas.setDetectorStatus(StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId())?null:"E"+tDetectorReportDataForm.getDeviceStatusId());
// datas.setReportValue(StringUtils.isEmpty(tDetectorReportDataForm.getReportValue())?null:Float.parseFloat(tDetectorReportDataForm.getReportValue()));
// datas.setZhHostStatusId(StringUtils.isEmpty(tDetectorReportDataForm.getZhHostStatusId())?null:Integer.parseInt(tDetectorReportDataForm.getZhHostStatusId()));
// datas.setSignalStrength(StringUtils.isEmpty(tDetectorReportDataForm.getSignalStrength())?null:Integer.parseInt(tDetectorReportDataForm.getSignalStrength()));
// datas.setNetPoint(StringUtils.isEmpty(tDetectorReportDataForm.getNetPoint())?null:Integer.parseInt(tDetectorReportDataForm.getNetPoint()));
// datas.setIpAddress(StringUtils.isEmpty(tDetectorReportDataForm.getIpAddress())?null:tDetectorReportDataForm.getIpAddress());
// datas.setCreateTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime())?null:new Date());
//
// tDetectorReportDataService.insertTDetectorReportData(datas);
// }
//设备状态更新
//设备状态更新
TDetectorInfo
detectorInfo
=
new
TDetectorInfo
();
TDetectorInfo
detectorInfo
=
new
TDetectorInfo
();
detectorInfo
.
setDetectorId
(
tDetectorInfoList
.
get
(
0
).
getDetectorId
());
detectorInfo
.
setDetectorId
(
tDetectorInfoList
.
get
(
0
).
getDetectorId
());
// 探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,其他都为报警值)用电手动消警 用 E 代表
// 探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,其他都为报警值)用电手动消警 用 E 代表
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
new
ArrayList
<
String
>(
Arrays
.
asList
(
"1"
,
"E"
)).
contain
s
((
tDetectorReportDataForm
.
getDeviceStatusId
()))){
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
"1"
.
equal
s
((
tDetectorReportDataForm
.
getDeviceStatusId
()))){
detectorInfo
.
setDetectorStatus
(
"0"
);
// 设备表状态 0正常,1故障(掉线)
detectorInfo
.
setDetectorStatus
(
"0"
);
// 设备表状态 0正常,1故障(掉线)
detectorInfo
.
setAlarmTime
(
null
);
detectorInfo
.
setAlarmTime
(
null
);
}
else
{
}
else
{
...
@@ -502,9 +505,10 @@ public class TDetectorInfoController extends BaseController
...
@@ -502,9 +505,10 @@ public class TDetectorInfoController extends BaseController
}
else
{
}
else
{
detectorInfo
.
setDetectorStatus
(
"2"
);
detectorInfo
.
setDetectorStatus
(
"2"
);
}
}
}
else
{
detectorInfo
.
setDetectorStatus
(
"2"
);
}
}
// else{
// detectorInfo.setDetectorStatus("2");
// }
detectorInfo
.
setAlarmTime
(
tDetectorReportDataForm
.
getCreateTime
());
detectorInfo
.
setAlarmTime
(
tDetectorReportDataForm
.
getCreateTime
());
}
}
...
@@ -512,13 +516,14 @@ public class TDetectorInfoController extends BaseController
...
@@ -512,13 +516,14 @@ public class TDetectorInfoController extends BaseController
//消警处理
//消警处理
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
new
ArrayList
<
String
>(
Arrays
.
asList
(
"1"
,
"E"
)).
contain
s
((
tDetectorReportDataForm
.
getDeviceStatusId
()))){
if
(!
StringUtils
.
isEmpty
(
tDetectorReportDataForm
.
getDeviceStatusId
())
&&
"1"
.
equal
s
((
tDetectorReportDataForm
.
getDeviceStatusId
()))){
// ZHDeviceReportDatasExample zhDeviceReportDatasExample = new ZHDeviceReportDatasExample();
// ZHDeviceReportDatasExample zhDeviceReportDatasExample = new ZHDeviceReportDatasExample();
// zhDeviceReportDatasExample.createCriteria().andDeviceNoEqualTo(tDetectorReportDataForm.getDeviceNo());
// zhDeviceReportDatasExample.createCriteria().andDeviceNoEqualTo(tDetectorReportDataForm.getDeviceNo());
// zhDeviceReportDatasExample.setOrderByClause(" create_time DESC LIMIT 1");
// zhDeviceReportDatasExample.setOrderByClause(" create_time DESC LIMIT 1");
//
//
// List<ZHDeviceReportDatas> dataList = zHDeviceReportDataService.selectByExample(zhDeviceReportDatasExample);
// List<ZHDeviceReportDatas> dataList = zHDeviceReportDataService.selectByExample(zhDeviceReportDatasExample);
// 查询该设备最新的一条
TDetectorReportData
data
=
tDetectorReportDataService
.
selectTDetectorReportDataByCode
(
tDetectorReportDataForm
.
getDeviceNo
());
TDetectorReportData
data
=
tDetectorReportDataService
.
selectTDetectorReportDataByCode
(
tDetectorReportDataForm
.
getDeviceNo
());
if
(
data
!=
null
){
if
(
data
!=
null
){
data
.
setIsCancelAlarm
(
"1"
);
// 1自动消警
data
.
setIsCancelAlarm
(
"1"
);
// 1自动消警
...
@@ -564,14 +569,7 @@ public class TDetectorInfoController extends BaseController
...
@@ -564,14 +569,7 @@ public class TDetectorInfoController extends BaseController
}
}
}
}
List
<
TDetectorReportData
>
alarmVO
=
tDetectorReportDataService
.
selectRealtimeDataList
();
List
<
TDetectorAlarmInfoVO
>
alarmVO
=
tDetectorReportDataService
.
selectTDetectorAlarm
();
for
(
TDetectorReportData
data
:
alarmVO
){
if
(
"0"
.
equals
(
data
.
getDetectorStatus
())){
data
.
setDetectorStatus
(
"正常"
);
}
else
{
data
.
setDetectorStatus
(
"报警"
);
}
}
map
.
put
(
"totalNum"
,
totalNum
);
map
.
put
(
"totalNum"
,
totalNum
);
map
.
put
(
"handledNum"
,
handledNum
);
map
.
put
(
"handledNum"
,
handledNum
);
...
...
gassafety-system/src/main/java/com/zehong/system/domain/TDetectorReportData.java
View file @
e5917dbb
...
@@ -10,7 +10,9 @@ public class TDetectorReportData implements Serializable {
...
@@ -10,7 +10,9 @@ public class TDetectorReportData implements Serializable {
private
String
detectorCode
;
private
String
detectorCode
;
private
String
detectorStatus
;
private
String
detectorStatusId
;
private
String
statusName
;
private
Float
reportValue
;
private
Float
reportValue
;
...
@@ -54,12 +56,20 @@ public class TDetectorReportData implements Serializable {
...
@@ -54,12 +56,20 @@ public class TDetectorReportData implements Serializable {
this
.
detectorCode
=
detectorCode
;
this
.
detectorCode
=
detectorCode
;
}
}
public
String
getDetectorStatus
()
{
public
String
getDetectorStatusId
()
{
return
detectorStatus
;
return
detectorStatusId
;
}
public
void
setDetectorStatusId
(
String
detectorStatusId
)
{
this
.
detectorStatusId
=
detectorStatusId
;
}
public
String
getStatusName
()
{
return
statusName
;
}
}
public
void
set
DetectorStatus
(
String
detectorStatus
)
{
public
void
set
StatusName
(
String
statusName
)
{
this
.
detectorStatus
=
detectorStatus
;
this
.
statusName
=
statusName
;
}
}
public
Float
getReportValue
()
{
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;
...
@@ -5,11 +5,11 @@ import lombok.Data;
@Data
@Data
public
class
TDetectorInfoDTO
{
public
class
TDetectorInfoDTO
{
private
String
de
tector
Type
;
// 1探测器、2安全用电设备
private
String
de
vice
Type
;
// 1探测器、2安全用电设备
private
String
de
tector
Code
;
private
String
de
vice
Code
;
//探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,0正常,1故障,2预警)
//探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,0正常,1故障,2预警)
private
String
de
tector
Status
;
private
String
de
vice
Status
;
private
String
alarmTime
;
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;
...
@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import
java.util.List
;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
/**
/**
* 设备上报的数据Mapper接口
* 设备上报的数据Mapper接口
...
@@ -25,6 +26,8 @@ public interface TDetectorReportDataMapper
...
@@ -25,6 +26,8 @@ public interface TDetectorReportDataMapper
public
List
<
TDetectorReportData
>
countDetector
(
List
<
String
>
list
);
public
List
<
TDetectorReportData
>
countDetector
(
List
<
String
>
list
);
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
();
public
List
<
TDetectorReportData
>
selectRealtimeDataList
();
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;
...
@@ -3,6 +3,7 @@ package com.zehong.system.service;
import
java.util.List
;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.zehong.system.domain.TDetectorReportData
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
/**
/**
* 设备上报的数据Service接口
* 设备上报的数据Service接口
...
@@ -25,6 +26,8 @@ public interface ITDetectorReportDataService
...
@@ -25,6 +26,8 @@ public interface ITDetectorReportDataService
public
List
<
TDetectorReportData
>
selectRealtimeDataList
();
public
List
<
TDetectorReportData
>
selectRealtimeDataList
();
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
();
public
List
<
TDetectorReportData
>
countDetector
(
List
<
String
>
list
);
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
...
@@ -45,7 +45,7 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
for
(
TDetectorInfo
detector
:
list
){
for
(
TDetectorInfo
detector
:
list
){
if
(
"0"
.
equals
(
detector
.
getDetectorStatus
())){
if
(
"0"
.
equals
(
detector
.
getDetectorStatus
())){
detector
.
setDetectorStatus
(
"正常"
);
detector
.
setDetectorStatus
(
"正常"
);
}
else
if
(
"1"
.
equals
(
detector
.
getDetectorStatus
()))
{
}
else
{
detector
.
setDetectorStatus
(
"离线"
);
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;
...
@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import
java.util.List
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.domain.vo.TDetectorAlarmInfoVO
;
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
com.zehong.system.mapper.TDetectorReportDataMapper
;
import
com.zehong.system.mapper.TDetectorReportDataMapper
;
...
@@ -39,6 +40,12 @@ public class TDetectorReportDataServiceImpl implements ITDetectorReportDataServi
...
@@ -39,6 +40,12 @@ public class TDetectorReportDataServiceImpl implements ITDetectorReportDataServi
return
tDetectorReportDataMapper
.
selectTDetectorReportDataByCode
(
detectorCode
);
return
tDetectorReportDataMapper
.
selectTDetectorReportDataByCode
(
detectorCode
);
}
}
@Override
public
List
<
TDetectorAlarmInfoVO
>
selectTDetectorAlarm
()
{
return
tDetectorReportDataMapper
.
selectTDetectorAlarm
();
}
@Override
@Override
public
List
<
TDetectorReportData
>
selectRealtimeDataList
()
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"
...
@@ -8,7 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"sourceId"
column=
"source_id"
/>
<result
property=
"sourceId"
column=
"source_id"
/>
<result
property=
"detectorCode"
column=
"detector_code"
/>
<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=
"reportValue"
column=
"report_value"
/>
<result
property=
"zhHostStatusId"
column=
"zh_host_status_id"
/>
<result
property=
"zhHostStatusId"
column=
"zh_host_status_id"
/>
<result
property=
"netPoint"
column=
"net_point"
/>
<result
property=
"netPoint"
column=
"net_point"
/>
...
@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
</resultMap>
<sql
id=
"selectTDetectorReportDataVo"
>
<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>
</sql>
<select
id=
"selectTDetectorReportDataList"
parameterType=
"TDetectorReportData"
resultMap=
"TDetectorReportDataResult"
>
<select
id=
"selectTDetectorReportDataList"
parameterType=
"TDetectorReportData"
resultMap=
"TDetectorReportDataResult"
>
...
@@ -28,7 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -28,7 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<where>
<if
test=
"sourceId != null and sourceId != ''"
>
and source_id = #{sourceId}
</if>
<if
test=
"sourceId != null and sourceId != ''"
>
and source_id = #{sourceId}
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
and detector_code = #{detectorCode}
</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=
"reportValue != null "
>
and report_value = #{reportValue}
</if>
<if
test=
"zhHostStatusId != null "
>
and zh_host_status_id = #{zhHostStatusId}
</if>
<if
test=
"zhHostStatusId != null "
>
and zh_host_status_id = #{zhHostStatusId}
</if>
<if
test=
"netPoint != null "
>
and net_point = #{netPoint}
</if>
<if
test=
"netPoint != null "
>
and net_point = #{netPoint}
</if>
...
@@ -50,13 +52,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -50,13 +52,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time DESC LIMIT 1
order by create_time DESC LIMIT 1
</select>
</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
id=
"selectRealtimeDataList"
resultMap=
"TDetectorReportDataResult"
>
SELECT * FROM
SELECT * FROM
(
(
SELECT
SELECT
t.source_id,
t.source_id,
t.detector_code,
t.detector_code,
t.detector_status,
t.detector_status_id,
t.status_name,
t.report_value,
t.report_value,
t.zh_host_status_id,
t.zh_host_status_id,
t.net_point,
t.net_point,
...
@@ -72,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -72,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t_detector_report_data t
t_detector_report_data t
LEFT JOIN t_detector_info d ON t.detector_code = d.detector_code
LEFT JOIN t_detector_info d ON t.detector_code = d.detector_code
WHERE
WHERE
t.detector_status != '1'
t.detector_status
_id
!= '1'
ORDER BY t.create_time DESC
ORDER BY t.create_time DESC
)data
)data
GROUP BY data.detector_id LIMIT 50
GROUP BY data.detector_id LIMIT 50
...
@@ -80,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -80,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"countDetector"
parameterType=
"List"
resultMap=
"TDetectorReportDataResult"
>
<select
id=
"countDetector"
parameterType=
"List"
resultMap=
"TDetectorReportDataResult"
>
<include
refid=
"selectTDetectorReportDataVo"
/>
<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=
","
>
<foreach
collection=
"list"
item=
"detectorCode"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{detectorCode}
#{detectorCode}
</foreach>
</foreach>
...
@@ -91,7 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -91,7 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
source_id,
</if>
<if
test=
"sourceId != null"
>
source_id,
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
detector_code,
</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=
"reportValue != null"
>
report_value,
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id,
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id,
</if>
<if
test=
"netPoint != null"
>
net_point,
</if>
<if
test=
"netPoint != null"
>
net_point,
</if>
...
@@ -104,7 +129,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -104,7 +129,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
#{sourceId},
</if>
<if
test=
"sourceId != null"
>
#{sourceId},
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
#{detectorCode},
</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=
"reportValue != null"
>
#{reportValue},
</if>
<if
test=
"zhHostStatusId != null"
>
#{zhHostStatusId},
</if>
<if
test=
"zhHostStatusId != null"
>
#{zhHostStatusId},
</if>
<if
test=
"netPoint != null"
>
#{netPoint},
</if>
<if
test=
"netPoint != null"
>
#{netPoint},
</if>
...
@@ -121,7 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -121,7 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"sourceId != null"
>
source_id = #{sourceId},
</if>
<if
test=
"sourceId != null"
>
source_id = #{sourceId},
</if>
<if
test=
"detectorCode != null and detectorCode != ''"
>
detector_code = #{detectorCode},
</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=
"reportValue != null"
>
report_value = #{reportValue},
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id = #{zhHostStatusId},
</if>
<if
test=
"zhHostStatusId != null"
>
zh_host_status_id = #{zhHostStatusId},
</if>
<if
test=
"netPoint != null"
>
net_point = #{netPoint},
</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