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
bd3ebb9f
Commit
bd3ebb9f
authored
Mar 01, 2022
by
王晓倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏用户列表接口、用户报警接口、泽宏云推送调用查询用户接口
parent
35db2bd1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
196 additions
and
50 deletions
+196
-50
TDetectorReportController.java
...g/web/controller/supervise/TDetectorReportController.java
+5
-5
TDetectorUserController.java
...ong/web/controller/supervise/TDetectorUserController.java
+11
-3
TDetectorUserVO.java
...ain/java/com/zehong/system/domain/vo/TDetectorUserVO.java
+3
-0
TDetectorUserMapper.java
...in/java/com/zehong/system/mapper/TDetectorUserMapper.java
+19
-1
ITDetectorUserService.java
...java/com/zehong/system/service/ITDetectorUserService.java
+19
-5
TDetectorUserServiceImpl.java
.../zehong/system/service/impl/TDetectorUserServiceImpl.java
+65
-26
TDetectorReportDataMapper.xml
...ain/resources/mapper/system/TDetectorReportDataMapper.xml
+1
-1
TDetectorUserMapper.xml
.../src/main/resources/mapper/system/TDetectorUserMapper.xml
+64
-9
detectorUser.js
gassafetyprogress-web/src/api/detector/detectorUser.js
+9
-0
No files found.
gassafetyprogress-admin/src/main/java/com/zehong/web/controller/supervise/TDetectorReportController.java
View file @
bd3ebb9f
...
...
@@ -91,7 +91,7 @@ public class TDetectorReportController extends BaseController
TDetectorUser
tDetectorUser
=
new
TDetectorUser
();
tDetectorUser
.
setNickName
(
username
);
tDetectorUser
.
setIsDel
(
"0"
);
List
<
TDetectorUser
VO
>
tDetectorUserList
=
tDetectorUserService
.
detectorUserList
(
tDetectorUser
);
List
<
TDetectorUser
>
tDetectorUserList
=
tDetectorUserService
.
selectTDetectorUser
(
tDetectorUser
);
if
(
tDetectorUserList
.
size
()
==
0
){
return
AjaxResult
.
error
(
1
,
"查询不到用户名username="
+
username
);
}
...
...
@@ -167,7 +167,7 @@ public class TDetectorReportController extends BaseController
TDetectorUser
tDetectorUser
=
new
TDetectorUser
();
tDetectorUser
.
setNickName
(
username
);
tDetectorUser
.
setIsDel
(
"0"
);
List
<
TDetectorUser
VO
>
tDetectorUserList
=
tDetectorUserService
.
detectorUserList
(
tDetectorUser
);
List
<
TDetectorUser
>
tDetectorUserList
=
tDetectorUserService
.
selectTDetectorUser
(
tDetectorUser
);
if
(
tDetectorUserList
.
size
()
==
0
){
return
AjaxResult
.
error
(
1
,
"查询不到用户名username="
+
username
);
}
...
...
@@ -224,7 +224,7 @@ public class TDetectorReportController extends BaseController
TDetectorUser
tDetectorUser
=
new
TDetectorUser
();
tDetectorUser
.
setNickName
(
username
);
tDetectorUser
.
setIsDel
(
"0"
);
List
<
TDetectorUser
VO
>
tDetectorUserList
=
tDetectorUserService
.
detectorUserList
(
tDetectorUser
);
List
<
TDetectorUser
>
tDetectorUserList
=
tDetectorUserService
.
selectTDetectorUser
(
tDetectorUser
);
if
(
tDetectorUserList
.
size
()
==
0
){
continue
;
}
...
...
@@ -265,7 +265,7 @@ public class TDetectorReportController extends BaseController
TDetectorUser
tDetectorUser1
=
new
TDetectorUser
();
tDetectorUser1
.
setNickName
(
sourceUsername
);
tDetectorUser1
.
setIsDel
(
"0"
);
List
<
TDetectorUser
VO
>
tDetectorUserList1
=
tDetectorUserService
.
detectorUserList
(
tDetectorUser1
);
List
<
TDetectorUser
>
tDetectorUserList1
=
tDetectorUserService
.
selectTDetectorUser
(
tDetectorUser1
);
if
(
tDetectorUserList1
.
size
()
==
0
){
return
AjaxResult
.
error
(
4
,
"查询不到原用户名sourceUsername="
+
sourceUsername
);
}
...
...
@@ -273,7 +273,7 @@ public class TDetectorReportController extends BaseController
TDetectorUser
tDetectorUser2
=
new
TDetectorUser
();
tDetectorUser2
.
setNickName
(
targetUsername
);
tDetectorUser2
.
setIsDel
(
"0"
);
List
<
TDetectorUser
VO
>
tDetectorUserList2
=
tDetectorUserService
.
detectorUserList
(
tDetectorUser2
);
List
<
TDetectorUser
>
tDetectorUserList2
=
tDetectorUserService
.
selectTDetectorUser
(
tDetectorUser2
);
if
(
tDetectorUserList2
.
size
()
==
0
){
return
AjaxResult
.
error
(
5
,
"查询不到目标用户名targetUsername="
+
targetUsername
);
}
...
...
gassafetyprogress-admin/src/main/java/com/zehong/web/controller/supervise/TDetectorUserController.java
View file @
bd3ebb9f
...
...
@@ -47,12 +47,20 @@ public class TDetectorUserController extends BaseController
/**
* 获取探测器用户列表
* @param tDetectorUser
* @return
*/
@GetMapping
(
"/detectorUserList"
)
public
AjaxResult
detectorUserList
(
TDetectorUser
tDetectorUser
){
return
AjaxResult
.
success
(
tDetectorUserService
.
detectorUserList
(
tDetectorUser
));
public
AjaxResult
detectorUserList
(){
return
AjaxResult
.
success
(
tDetectorUserService
.
detectorUserList
());
}
/**
* 获取探测器用户列表
* @return
*/
@GetMapping
(
"/getDetectorUserAlarmList"
)
public
AjaxResult
getDetectorUserAlarmList
(){
return
AjaxResult
.
success
(
tDetectorUserService
.
getDetectorUserAlarmList
());
}
/**
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/domain/vo/TDetectorUserVO.java
View file @
bd3ebb9f
...
...
@@ -22,6 +22,9 @@ public class TDetectorUserVO
/** 图标类型 */
private
String
iconType
;
/** 用户状态(1正常,2报警) */
private
String
userStatus
;
/** 用户名称 */
private
String
nickName
;
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/mapper/TDetectorUserMapper.java
View file @
bd3ebb9f
package
com
.
zehong
.
system
.
mapper
;
import
java.util.List
;
import
com.zehong.system.domain.TDetectorInfo
;
import
com.zehong.system.domain.TDetectorUser
;
import
com.zehong.system.domain.vo.TDetectorUserVO
;
...
...
@@ -25,7 +27,23 @@ public interface TDetectorUserMapper
*
* @return 燃气用户
*/
public
List
<
TDetectorUserVO
>
countTDetectorUser
();
public
List
<
TDetectorUserVO
>
countTDetectorUser
(
TDetectorInfo
tDetectorInfo
);
/**
* 查询探测器报警用户
*
* @param tDetectorUser 探测器用户
* @return 探测器用户
*/
public
TDetectorUserVO
countTDetectorUserAlarm
(
TDetectorUser
tDetectorUser
);
/**
* 泽宏云推送查询燃气用户
*
* @param tDetectorUser 燃气用户
* @return 燃气用户
*/
public
List
<
TDetectorUser
>
selectTDetectorUser
(
TDetectorUser
tDetectorUser
);
/**
* 查询燃气用户列表
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/service/ITDetectorUserService.java
View file @
bd3ebb9f
...
...
@@ -16,18 +16,32 @@ public interface ITDetectorUserService
/**
* 查询探测器用户列表
*
* @param tDetectorUser 探测器用户
* @return 探测器用户集合
*/
public
List
<
TDetectorUserVO
>
detectorUserList
(
TDetectorUser
tDetectorUser
);
public
List
<
TDetectorUserVO
>
detectorUserList
();
/**
* 查询探测器报警用户(前台调用)
*
* @return 探测器用户
*/
public
List
<
TDetectorUserVO
>
getDetectorUserAlarmList
();
/**
* 查询探测器
用户报警列表
* 查询探测器
报警用户(后台推送)
*
* @param tDetectorUser 探测器用户
* @return 探测器用户集合
* @return 探测器用户
*/
public
TDetectorUserVO
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
);
/**
* 泽宏云推送查询燃气用户
*
* @param tDetectorUser 燃气用户
* @return 燃气用户
*/
public
List
<
TDetectorUser
VO
>
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
);
public
List
<
TDetectorUser
>
selectTDetectorUser
(
TDetectorUser
tDetectorUser
);
/**
* 查询燃气用户
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/TDetectorUserServiceImpl.java
View file @
bd3ebb9f
...
...
@@ -36,14 +36,13 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
/**
* 查询探测器用户列表
*
* @param tDetectorUser 探测器用户
* @return 探测器用户
*/
@Override
public
List
<
TDetectorUserVO
>
detectorUserList
(
TDetectorUser
tDetectorUser
)
public
List
<
TDetectorUserVO
>
detectorUserList
()
{
List
<
TDetectorUserVO
>
list
=
new
ArrayList
<>();
List
<
TDetectorUserVO
>
tDetectorUserList
=
tDetectorUserMapper
.
countTDetectorUser
();
List
<
TDetectorUserVO
>
tDetectorUserList
=
tDetectorUserMapper
.
countTDetectorUser
(
new
TDetectorInfo
()
);
List
<
Object
>
initList
=
new
ArrayList
<>();
for
(
TDetectorUserVO
user
:
tDetectorUserList
){
...
...
@@ -55,11 +54,14 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
initList
.
add
(
user
);
userVO
.
setDetectorCountList
(
initList
);
userVO
.
setIconType
(
"6"
);
userVO
.
setUserStatus
(
"1"
);
}
else
{
BeanUtils
.
copyProperties
(
user
,
temp
);
List
<
Object
>
newList
=
new
ArrayList
<>();
newList
.
add
(
temp
);
userVO
.
setDetectorCountList
(
newList
);
userVO
.
setIconType
(
"6"
);
userVO
.
setUserStatus
(
"1"
);
list
.
add
(
userVO
);
}
}
...
...
@@ -68,39 +70,76 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
}
/**
* 查询探测器
用户列表
* 查询探测器
报警用户(前台调用)
*
* @param tDetectorUser 探测器用户
* @return 探测器用户
*/
@Override
public
List
<
TDetectorUserVO
>
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
)
public
List
<
TDetectorUserVO
>
getDetectorUserAlarmList
(
)
{
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);
// }
// }
TDetectorInfo
tDetectorInfo
=
new
TDetectorInfo
();
tDetectorInfo
.
setDetectorStatus
(
"2"
);
// 查询报警的数据
List
<
TDetectorUserVO
>
tDetectorUserList
=
tDetectorUserMapper
.
countTDetectorUser
(
tDetectorInfo
);
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"
);
userVO
.
setUserStatus
(
"2"
);
}
else
{
BeanUtils
.
copyProperties
(
user
,
temp
);
List
<
Object
>
newList
=
new
ArrayList
<>();
newList
.
add
(
temp
);
userVO
.
setDetectorCountList
(
newList
);
userVO
.
setIconType
(
"6"
);
userVO
.
setUserStatus
(
"2"
);
list
.
add
(
userVO
);
}
}
return
list
;
}
/**
* 查询探测器报警用户(后台推送)
*
* @param tDetectorUser 探测器用户
* @return 探测器用户
*/
@Override
public
TDetectorUserVO
detectorUserAlarmList
(
TDetectorUser
tDetectorUser
)
{
List
<
Object
>
list
=
new
ArrayList
<>();
TDetectorUserVO
user
=
tDetectorUserMapper
.
countTDetectorUserAlarm
(
tDetectorUser
);
TDetectorUserVO
userVO
=
new
TDetectorUserVO
();
BeanUtils
.
copyProperties
(
user
,
userVO
);
list
.
add
(
user
);
userVO
.
setDetectorCountList
(
list
);
return
userVO
;
}
/**
* 泽宏云推送查询燃气用户
*
* @param tDetectorUser 燃气用户
* @return 燃气用户
*/
@Override
public
List
<
TDetectorUser
>
selectTDetectorUser
(
TDetectorUser
tDetectorUser
)
{
return
tDetectorUserMapper
.
selectTDetectorUser
(
tDetectorUser
);
}
/**
* 查询燃气用户
*
...
...
gassafetyprogress-system/src/main/resources/mapper/system/TDetectorReportDataMapper.xml
View file @
bd3ebb9f
...
...
@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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.is_del = '0'
WHERE u.is_del = '0'
and di.is_del = '0'
ORDER BY rd.create_time DESC LIMIT 50
</select>
...
...
gassafetyprogress-system/src/main/resources/mapper/system/TDetectorUserMapper.xml
View file @
bd3ebb9f
...
...
@@ -32,12 +32,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by user_id desc
</select>
<select
id=
"selectTDetectorUser"
parameterType=
"TDetectorUser"
resultMap=
"TDetectorUserResult"
>
<include
refid=
"selectTDetectorUserVo"
/>
<where>
<if
test=
"isDel != null and isDel != ''"
>
and is_del = #{isDel}
</if>
<if
test=
"username != null and username != ''"
>
and username = #{username}
</if>
<if
test=
"nickName != null and nickName != ''"
>
and nick_name = #{nickName}
</if>
</where>
group by user_id desc
</select>
<select
id=
"selectTDetectorUserById"
parameterType=
"Long"
resultMap=
"TDetectorUserResult"
>
<include
refid=
"selectTDetectorUserVo"
/>
where user_id = #{userId}
</select>
<select
id=
"countTDetectorUser"
resultType=
"TDetectorUserVO"
>
<select
id=
"countTDetectorUser"
resultType=
"TDetectorUserVO"
parameterType=
"TDetectorInfo"
>
select t1.*,
IFNULL(t2.historyAlarmNum,0) AS historyAlarmNum,
IFNULL(t2.processingAlarmNum,0) AS processingAlarmNum,
...
...
@@ -66,7 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
<where>
a1.is_del = '0' and a2.is_del = '0'
<if
test=
"detectorStatus != null and detectorStatus != ''"
>
and a1.detector_status = #{detectorStatus}
</if>
</where>
) a
group by a.user_id,a.detector_type
) t1 left join (
...
...
@@ -79,18 +91,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
<where>
b2.is_del = '0' and b3.is_del = '0'
<if
test=
"detectorStatus != null and detectorStatus != ''"
>
and b2.detector_status = #{detectorStatus}
</if>
</where>
) 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>-->
<select
id=
"countTDetectorUserAlarm"
resultType=
"TDetectorUserVO"
parameterType=
"TDetectorUser"
>
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' and a2.user_id = #{userId}) a
group by 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' and b3.user_id = #{userId}) b
group by b.detector_type
) t2 on t2.userId = t1.userId
</select>
<insert
id=
"insertTDetectorUser"
parameterType=
"TDetectorUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
insert into t_detector_user
...
...
gassafetyprogress-web/src/api/detector/detectorUser.js
View file @
bd3ebb9f
...
...
@@ -18,6 +18,15 @@ export function detectorUserList(query) {
})
}
// 探测器用户列表
export
function
getDetectorUserAlarmList
(
query
)
{
return
request
({
url
:
'/supervise/user/getDetectorUserAlarmList'
,
method
:
'get'
,
params
:
query
})
}
// 查询探测器用户详细
export
function
getDetectorUser
(
userId
)
{
return
request
({
...
...
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