Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
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
耿迪迪
gassafety
Commits
7e565c7d
Commit
7e565c7d
authored
Aug 10, 2021
by
王晓倩
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
47d9311a
0d3ca84d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
49 deletions
+25
-49
TDeviceAlarmController.java
...web/controller/dataMonitoring/TDeviceAlarmController.java
+7
-32
WebSocketController.java
.../zehong/web/controller/websocket/WebSocketController.java
+0
-16
TDeviceAlarmServiceImpl.java
...m/zehong/system/service/impl/TDeviceAlarmServiceImpl.java
+18
-1
No files found.
gassafety-admin/src/main/java/com/zehong/web/controller/dataMonitoring/TDeviceAlarmController.java
View file @
7e565c7d
package
com
.
zehong
.
web
.
controller
.
dataMonitoring
;
import
java.util.List
;
import
com.zehong.common.core.domain.entity.SysDictData
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.service.ISysDictTypeService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zehong.common.annotation.Log
;
import
com.zehong.common.core.controller.BaseController
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.common.core.page.TableDataInfo
;
import
com.zehong.common.enums.BusinessType
;
import
com.zehong.system.domain.TDeviceAlarm
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.service.ITDeviceAlarmService
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.common.core.page.TableDataInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 报警信息Controller
...
...
@@ -38,8 +27,6 @@ public class TDeviceAlarmController extends BaseController
@Autowired
private
ITDeviceAlarmService
tDeviceAlarmService
;
@Autowired
private
ISysDictTypeService
iSysDictTypeService
;
/**
* 查询报警信息列表
...
...
@@ -52,18 +39,6 @@ public class TDeviceAlarmController extends BaseController
List
<
DeviceAlarmVo
>
list
=
null
;
try
{
list
=
tDeviceAlarmService
.
selectTDeviceAlarmList
(
tDeviceAlarm
);
List
<
SysDictData
>
sysDictDataList
=
iSysDictTypeService
.
selectDictDataByType
(
"t_alarm_type"
);
for
(
DeviceAlarmVo
deviceAlarmVo
:
list
){
for
(
SysDictData
sysDictData
:
sysDictDataList
){
if
(
StringUtils
.
isNotEmpty
(
deviceAlarmVo
.
getAlarmType
())){
if
(
deviceAlarmVo
.
getAlarmType
().
equals
(
sysDictData
.
getDictValue
())){
deviceAlarmVo
.
setAlarmType
(
sysDictData
.
getDictLabel
());
}
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
Exception
(
"查询报警信息列表出错"
);
...
...
gassafety-admin/src/main/java/com/zehong/web/controller/websocket/WebSocketController.java
View file @
7e565c7d
...
...
@@ -3,8 +3,6 @@ package com.zehong.web.controller.websocket;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.service.ITDeviceAlarmService
;
import
com.zehong.system.service.ITDeviceInfoService
;
import
com.zehong.system.service.ITPipeService
;
import
com.zehong.system.service.WebSocketServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -25,25 +23,11 @@ public class WebSocketController {
@Autowired
private
ITDeviceAlarmService
itDeviceAlarmService
;
@Autowired
private
ITDeviceInfoService
itDeviceInfoService
;
@Autowired
private
ITPipeService
itPipeService
;
private
final
static
String
PIPE_TYPE
=
"0"
;
@GetMapping
(
"/send"
)
public
void
send
(
int
alarmId
){
try
{
DeviceAlarmVo
alarm
=
itDeviceAlarmService
.
selectTDeviceAlarmById
(
alarmId
);
/*JSONObject json = new JSONObject();
json.put("alarmInfo",alarm);*/
/*if(PIPE_TYPE.equals(alarm.getAlarmType())){
json.put("deviceInfo",itPipeService.selectTPipeById(alarm.getDeviceId()));
}else{
json.put("deviceInfo",itDeviceInfoService.selectTDeviceInfoById(alarm.getDeviceId()));
}*/
webSocketServer
.
batchSendMessage
(
JSONObject
.
toJSONString
(
alarm
));
}
catch
(
Exception
e
)
{
log
.
error
(
"wesocket发送失败!"
);
...
...
gassafety-system/src/main/java/com/zehong/system/service/impl/TDeviceAlarmServiceImpl.java
View file @
7e565c7d
...
...
@@ -2,12 +2,16 @@ package com.zehong.system.service.impl;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.zehong.common.core.domain.entity.SysDictData
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.TDeviceInfo
;
import
com.zehong.system.domain.TPipe
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.mapper.TDeviceInfoMapper
;
import
com.zehong.system.mapper.TPipeMapper
;
import
com.zehong.system.service.ISysDictTypeService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -31,6 +35,9 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
@Autowired
private
TPipeMapper
tPipeMapper
;
@Autowired
private
ISysDictTypeService
iSysDictTypeService
;
/**
* 查询报警信息
*
...
...
@@ -75,7 +82,7 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
DeviceAlarmVo
deviceAlarmVo
=
new
DeviceAlarmVo
();
BeanUtils
.
copyProperties
(
alarm
,
deviceAlarmVo
);
if
(
"0"
.
equals
(
tDeviceA
larm
.
getDeviceType
())){
if
(
"0"
.
equals
(
a
larm
.
getDeviceType
())){
TPipe
pipe
=
tPipeMapper
.
selectTPipeById
(
alarm
.
getDeviceId
());
if
(
pipe
!=
null
)
{
deviceAlarmVo
.
setDeviceCode
(
pipe
.
getPipeCode
());
...
...
@@ -89,6 +96,16 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
}
}
List
<
SysDictData
>
sysDictDataList
=
iSysDictTypeService
.
selectDictDataByType
(
"t_alarm_type"
);
for
(
SysDictData
sysDictData
:
sysDictDataList
){
if
(
StringUtils
.
isNotEmpty
(
alarm
.
getAlarmType
())){
if
(
alarm
.
getAlarmType
().
equals
(
sysDictData
.
getDictValue
())){
deviceAlarmVo
.
setAlarmType
(
sysDictData
.
getDictLabel
());
}
}
}
list
.
add
(
deviceAlarmVo
);
}
return
list
;
...
...
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