Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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-progress
Commits
e1477e75
Commit
e1477e75
authored
Feb 28, 2022
by
王晓倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏用户列表接口调整
parent
7af23906
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
50 deletions
+125
-50
TDetectorUserVO.java
...ain/java/com/zehong/system/domain/vo/TDetectorUserVO.java
+0
-9
TDetectorUserMapper.java
...in/java/com/zehong/system/mapper/TDetectorUserMapper.java
+8
-0
ITDetectorUserService.java
...java/com/zehong/system/service/ITDetectorUserService.java
+8
-0
TDetectorInfoServiceImpl.java
.../zehong/system/service/impl/TDetectorInfoServiceImpl.java
+6
-2
TDetectorUserServiceImpl.java
.../zehong/system/service/impl/TDetectorUserServiceImpl.java
+47
-39
TDetectorInfoMapper.xml
.../src/main/resources/mapper/system/TDetectorInfoMapper.xml
+1
-0
TDetectorUserMapper.xml
.../src/main/resources/mapper/system/TDetectorUserMapper.xml
+55
-0
No files found.
gassafetyprogress-system/src/main/java/com/zehong/system/domain/vo/TDetectorUserVO.java
View file @
e1477e75
...
...
@@ -22,9 +22,6 @@ public class TDetectorUserVO
/** 图标类型 */
private
String
iconType
;
/** 用户账号 */
private
String
username
;
/** 用户名称 */
private
String
nickName
;
...
...
@@ -71,10 +68,4 @@ public class TDetectorUserVO
/** 邮箱 */
private
String
email
;
/** 是否删除(0正常,1删除) */
private
String
isDel
;
/** 备注 */
private
String
remarks
;
}
gassafetyprogress-system/src/main/java/com/zehong/system/mapper/TDetectorUserMapper.java
View file @
e1477e75
...
...
@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorUser
;
import
com.zehong.system.domain.vo.TDetectorUserVO
;
/**
* 燃气用户Mapper接口
...
...
@@ -19,6 +20,13 @@ public interface TDetectorUserMapper
*/
public
TDetectorUser
selectTDetectorUserById
(
Long
userId
);
/**
* 查询燃气用户统计信息
*
* @return 燃气用户
*/
public
List
<
TDetectorUserVO
>
countTDetectorUser
();
/**
* 查询燃气用户列表
*
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/service/ITDetectorUserService.java
View file @
e1477e75
...
...
@@ -21,6 +21,14 @@ public interface ITDetectorUserService
*/
public
List
<
TDetectorUserVO
>
detectorUserList
(
TDetectorUser
tDetectorUser
);
/**
* 查询探测器用户报警列表
*
* @param tDetectorUser 探测器用户
* @return 探测器用户集合
*/
public
List
<
TDetectorUserVO
>
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
);
/**
* 查询燃气用户
*
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/TDetectorInfoServiceImpl.java
View file @
e1477e75
...
...
@@ -56,8 +56,10 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
for
(
TDetectorInfo
detector
:
list
){
if
(
"0"
.
equals
(
detector
.
getDetectorStatus
())){
detector
.
setDetectorStatus
(
"正常"
);
}
else
{
}
else
if
(
"1"
.
equals
(
detector
.
getDetectorStatus
()))
{
detector
.
setDetectorStatus
(
"离线"
);
}
else
{
detector
.
setDetectorStatus
(
"报警"
);
}
}
...
...
@@ -77,8 +79,10 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
for
(
TDetectorInfo
detector
:
list
){
if
(
"0"
.
equals
(
detector
.
getDetectorStatus
())){
detector
.
setDetectorStatus
(
"正常"
);
}
else
{
}
else
if
(
"1"
.
equals
(
detector
.
getDetectorStatus
()))
{
detector
.
setDetectorStatus
(
"离线"
);
}
else
{
detector
.
setDetectorStatus
(
"报警"
);
}
}
return
new
PageInfo
(
list
);
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/TDetectorUserServiceImpl.java
View file @
e1477e75
...
...
@@ -43,52 +43,60 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
public
List
<
TDetectorUserVO
>
detectorUserList
(
TDetectorUser
tDetectorUser
)
{
List
<
TDetectorUserVO
>
list
=
new
ArrayList
<>();
List
<
TDetectorUser
>
tDetectorUserList
=
tDetectorUserMapper
.
selectTDetectorUserList
(
tDetectorUser
);
List
<
TDetectorUser
VO
>
tDetectorUserList
=
tDetectorUserMapper
.
countTDetectorUser
(
);
TDetectorInfo
detector
=
new
TDetectorInfo
();
for
(
TDetectorUser
user
:
tDetectorUserList
){
List
<
Object
>
initList
=
new
ArrayList
<>
();
for
(
TDetectorUser
VO
user
:
tDetectorUserList
){
TDetectorUserVO
userVO
=
new
TDetectorUserVO
();
BeanUtils
.
copyProperties
(
user
,
userVO
);
detector
.
setUserId
(
user
.
getUserId
());
detector
.
setIsDel
(
"0"
);
List
<
TDetectorInfo
>
tDetectorInfoList
=
tDetectorInfoMapper
.
selectTDetectorInfoList
(
detector
);
int
onLineNum
=
0
;
int
offLineNum
=
0
;
int
cancelAlarmNum
=
0
;
int
historyAlarmNum
=
0
;
if
(
tDetectorInfoList
.
size
()
>
0
){
for
(
TDetectorInfo
info
:
tDetectorInfoList
){
if
(!
StringUtils
.
isEmpty
(
info
.
getDetectorStatus
())
&&
info
.
getDetectorStatus
().
equals
(
"0"
)){
++
onLineNum
;
}
else
{
++
offLineNum
;
TDetectorUserVO
temp
=
new
TDetectorUserVO
();
if
(
user
.
getUserId
().
equals
(
temp
.
getUserId
())){
initList
.
add
(
user
);
userVO
.
setDetectorCountList
(
initList
);
userVO
.
setIconType
(
"6"
);
}
else
{
BeanUtils
.
copyProperties
(
user
,
temp
);
List
<
Object
>
newList
=
new
ArrayList
<>();
newList
.
add
(
temp
);
userVO
.
setDetectorCountList
(
newList
);
list
.
add
(
userVO
);
}
}
List
<
TDetectorReportData
>
dataList
=
tDetectorReportDataMapper
.
countDetectorByUserId
(
detector
);
historyAlarmNum
=
dataList
.
size
();
for
(
TDetectorReportData
data
:
dataList
){
if
(!
StringUtils
.
isEmpty
(
data
.
getIsCancelAlarm
())
&&
data
.
getIsCancelAlarm
().
equals
(
"1"
)){
++
cancelAlarmNum
;
}
}
return
list
;
}
userVO
.
setDetectorCount
(
tDetectorInfoList
.
size
());
userVO
.
setOnLineNum
(
onLineNum
);
userVO
.
setOffLineNum
(
offLineNum
);
userVO
.
setHistoryAlarmNum
(
historyAlarmNum
);
userVO
.
setCancelAlarmNum
(
cancelAlarmNum
);
userVO
.
setProcessingAlarmNum
(
Math
.
abs
(
historyAlarmNum
-
cancelAlarmNum
));
userVO
.
setIconType
(
"6"
);
userVO
.
setDetectorType
(
"气体探测器"
);
list
.
add
(
userVO
);
}
/**
* 查询探测器用户列表
*
* @param tDetectorUser 探测器用户
* @return 探测器用户
*/
@Override
public
List
<
TDetectorUserVO
>
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
)
{
List
<
TDetectorUserVO
>
list
=
new
ArrayList
<>();
// List<TDetectorUserVO> tDetectorUserList = tDetectorUserMapper.countTDetectorUser();
//
// List<Object> initList = new ArrayList<>();
// for(TDetectorUserVO user : tDetectorUserList){
// TDetectorUserVO userVO = new TDetectorUserVO();
// BeanUtils.copyProperties(user, userVO);
//
// TDetectorUserVO temp = new TDetectorUserVO();
// if(user.getUserId().equals(temp.getUserId())){
// initList.add(user);
// userVO.setDetectorCountList(initList);
// userVO.setIconType("6");
// } else {
// BeanUtils.copyProperties(user, temp);
// List<Object> newList = new ArrayList<>();
// newList.add(temp);
// userVO.setDetectorCountList(newList);
// list.add(userVO);
// }
// }
return
list
;
}
...
...
gassafetyprogress-system/src/main/resources/mapper/system/TDetectorInfoMapper.xml
View file @
e1477e75
...
...
@@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"isDel != null and isDel != ''"
>
and is_del = #{isDel}
</if>
<if
test=
"remarks != null and remarks != ''"
>
and remarks = #{remarks}
</if>
</where>
order by detector_status desc, alarm_time desc
</select>
<select
id=
"selectTDetectorInfoById"
parameterType=
"Long"
resultMap=
"TDetectorInfoResult"
>
...
...
gassafetyprogress-system/src/main/resources/mapper/system/TDetectorUserMapper.xml
View file @
e1477e75
...
...
@@ -37,6 +37,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where user_id = #{userId}
</select>
<select
id=
"countTDetectorUser"
resultType=
"TDetectorUserVO"
>
select t1.*,
IFNULL(t2.historyAlarmNum,0) AS historyAlarmNum,
IFNULL(t2.processingAlarmNum,0) AS processingAlarmNum,
IFNULL(t2.cancelAlarmNum,0) AS cancelAlarmNum
from(
select a.user_id AS userId,
a.detector_id AS detectorId,
a.detector_status AS detectorStatus,
a.nick_name AS nickName,
a.user_type AS userType,
a.address AS address,
a.longitude AS longitude,
a.latitude AS latitude,
a.linkman AS linkman,
a.phone AS phone,
a.email AS email,
CASE a.detector_type
WHEN '1' THEN '家用报警器'
WHEN '2' THEN '工业报警器' END AS detectorType,
COUNT(a.detector_id) AS detectorCount,
SUM(CASE a.detector_status WHEN '0' THEN 1 ELSE 0 END) AS onLineNum,
SUM(CASE a.detector_status WHEN '1' THEN 1 ELSE 0 END) AS offLineNum
from(select a1.detector_id,
a1.detector_type,
a1.detector_status,
a2.* from t_detector_info a1
right join t_detector_user a2 on a1.user_id = a2.user_id
where a1.is_del = '0' and a2.is_del = '0') a
group by a.user_id,a.detector_type
) t1 left join (
select b.user_id AS userId,
COUNT(b.id) AS historyAlarmNum,
SUM(CASE b.is_cancel_alarm WHEN '0' THEN 1 ELSE 0 END) AS processingAlarmNum,
COUNT(b.id) - SUM(CASE b.is_cancel_alarm WHEN '0' THEN 1 ELSE 0 END) AS cancelAlarmNum
from(select b1.id,b1.is_cancel_alarm,b2.*
from t_detector_report_data b1
left join t_detector_info b2 on b1.detector_code = b2.detector_code
right join t_detector_user b3 on b2.user_id = b3.user_id
where b2.is_del = '0' and b3.is_del = '0') b
group by b.user_id,b.detector_type
) t2 on t2.userId = t1.userId
</select>
<!--<select id="selectTDetectorUserAlarmList" parameterType="TDetectorUser" resultMap="">
select * from t_detector_report_data a1
right join t_detector_info a2 on a1.detector_code = a2.detector_code
right join t_detector_user a3 on a2.user_id = a2.user_id
where a2.is_del = '0' and a3.is_del = '0'
</select>-->
<insert
id=
"insertTDetectorUser"
parameterType=
"TDetectorUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
insert into t_detector_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
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