Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
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
pseer
gxpt_ht
Commits
07e16f2d
Commit
07e16f2d
authored
Jan 16, 2024
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备日志完善
parent
ee2249b1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
3 deletions
+95
-3
DeviceLog.java
...e-system/src/main/java/share/system/domain/DeviceLog.java
+12
-0
DeviceStatusLog.java
...em/src/main/java/share/system/domain/DeviceStatusLog.java
+12
-0
DeviceLogServiceImpl.java
.../java/share/system/service/impl/DeviceLogServiceImpl.java
+44
-2
DeviceStatusLogServiceImpl.java
...share/system/service/impl/DeviceStatusLogServiceImpl.java
+27
-1
No files found.
share-system/src/main/java/share/system/domain/DeviceLog.java
View file @
07e16f2d
...
@@ -50,6 +50,18 @@ public class DeviceLog extends BaseEntity
...
@@ -50,6 +50,18 @@ public class DeviceLog extends BaseEntity
@Excel
(
name
=
"消息主题"
)
@Excel
(
name
=
"消息主题"
)
private
String
topic
;
private
String
topic
;
/**
* 房间名称
*/
@TableField
(
exist
=
false
)
private
String
roomName
;
/**
* 门店名称
*/
@TableField
(
exist
=
false
)
private
String
storeName
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
...
share-system/src/main/java/share/system/domain/DeviceStatusLog.java
View file @
07e16f2d
...
@@ -79,6 +79,18 @@ public class DeviceStatusLog implements Serializable
...
@@ -79,6 +79,18 @@ public class DeviceStatusLog implements Serializable
/** 备注 */
/** 备注 */
private
String
remark
;
private
String
remark
;
/**
* 房间名称
*/
@TableField
(
exist
=
false
)
private
String
roomName
;
/**
* 门店名称
*/
@TableField
(
exist
=
false
)
private
String
storeName
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
...
share-system/src/main/java/share/system/service/impl/DeviceLogServiceImpl.java
View file @
07e16f2d
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
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
share.common.utils.SecurityUtils
;
import
share.common.utils.SecurityUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.mapper.DeviceLogMapper
;
import
share.system.mapper.DeviceLogMapper
;
import
share.system.domain.DeviceLog
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.DeviceLogService
;
import
share.system.service.DeviceLogService
;
/**
/**
...
@@ -22,6 +29,12 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
...
@@ -22,6 +29,12 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
{
{
@Autowired
@Autowired
private
DeviceLogMapper
deviceLogMapper
;
private
DeviceLogMapper
deviceLogMapper
;
@Autowired
private
SRoomMapper
roomMapper
;
@Autowired
private
SStoreMapper
storeMapper
;
@Autowired
private
DeviceMapper
deviceMapper
;
/**
/**
* 查询设备操作日志
* 查询设备操作日志
...
@@ -44,7 +57,36 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
...
@@ -44,7 +57,36 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
@Override
@Override
public
List
<
DeviceLog
>
selectDeviceLogList
(
DeviceLog
deviceLog
)
public
List
<
DeviceLog
>
selectDeviceLogList
(
DeviceLog
deviceLog
)
{
{
return
deviceLogMapper
.
selectDeviceLogList
(
deviceLog
);
List
<
DeviceLog
>
list
=
deviceLogMapper
.
selectDeviceLogList
(
deviceLog
);
if
(
list
.
size
()
>
0
)
{
List
<
String
>
devIds
=
list
.
stream
().
map
(
DeviceLog:
:
getDevId
).
collect
(
Collectors
.
toList
());
// 设备信息查询
LambdaQueryWrapper
<
Device
>
queryDeviceWrapper
=
new
LambdaQueryWrapper
();
queryDeviceWrapper
.
in
(
Device:
:
getDevId
,
devIds
);
List
<
Device
>
deviceList
=
deviceMapper
.
selectList
(
queryDeviceWrapper
);
// 提取roomId,方便批量查询
List
<
Long
>
roomIds
=
deviceList
.
stream
().
map
(
Device:
:
getRoomId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Long
>
deviceRoomMap
=
deviceList
.
stream
().
collect
(
Collectors
.
toMap
(
Device:
:
getDevId
,
Device:
:
getRoomId
));
if
(
roomIds
!=
null
&&
roomIds
.
size
()
>
0
)
{
// 房间信息查询
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SRoom:
:
getId
,
roomIds
);
List
<
SRoom
>
roomList
=
roomMapper
.
selectList
(
queryWrapper
);
Map
<
Long
,
String
>
roomMap
=
roomList
.
stream
().
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
SRoom:
:
getName
));
Map
<
Long
,
Long
>
roomStoreMap
=
roomList
.
stream
().
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
SRoom:
:
getStoreId
));
// 门店信息查询
List
<
Long
>
storeIds
=
roomList
.
stream
().
map
(
SRoom:
:
getStoreId
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
SStore
>
queryStoreWrapper
=
new
LambdaQueryWrapper
();
queryStoreWrapper
.
in
(
SStore:
:
getId
,
storeIds
);
List
<
SStore
>
storeList
=
storeMapper
.
selectList
(
queryStoreWrapper
);
Map
<
Long
,
String
>
storeMap
=
storeList
.
stream
().
collect
(
Collectors
.
toMap
(
SStore:
:
getId
,
SStore:
:
getName
));
list
.
stream
().
forEach
(
log
->
{
log
.
setRoomName
(
roomMap
.
get
(
deviceRoomMap
.
get
(
log
.
getDevId
())));
log
.
setStoreName
(
storeMap
.
get
(
roomStoreMap
.
get
(
deviceRoomMap
.
get
(
log
.
getDevId
()))));
});
}
}
return
list
;
}
}
/**
/**
...
...
share-system/src/main/java/share/system/service/impl/DeviceStatusLogServiceImpl.java
View file @
07e16f2d
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
@@ -58,7 +61,30 @@ public class DeviceStatusLogServiceImpl extends ServiceImpl<DeviceStatusLogMappe
...
@@ -58,7 +61,30 @@ public class DeviceStatusLogServiceImpl extends ServiceImpl<DeviceStatusLogMappe
@Override
@Override
public
List
<
DeviceStatusLog
>
selectDeviceStatusLogList
(
DeviceStatusLog
deviceStatusLog
)
public
List
<
DeviceStatusLog
>
selectDeviceStatusLogList
(
DeviceStatusLog
deviceStatusLog
)
{
{
return
deviceStatusLogMapper
.
selectDeviceStatusLogList
(
deviceStatusLog
);
List
<
DeviceStatusLog
>
list
=
deviceStatusLogMapper
.
selectDeviceStatusLogList
(
deviceStatusLog
);
if
(
list
.
size
()
>
0
)
{
// 提取roomId,方便批量查询
List
<
Long
>
roomIds
=
list
.
stream
().
map
(
DeviceStatusLog:
:
getRoomId
).
collect
(
Collectors
.
toList
());
if
(
roomIds
!=
null
&&
roomIds
.
size
()
>
0
)
{
// 房间信息查询
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SRoom:
:
getId
,
roomIds
);
List
<
SRoom
>
roomList
=
roomMapper
.
selectList
(
queryWrapper
);
Map
<
Long
,
String
>
roomMap
=
roomList
.
stream
().
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
SRoom:
:
getName
));
Map
<
Long
,
Long
>
roomStoreMap
=
roomList
.
stream
().
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
SRoom:
:
getStoreId
));
// 门店信息查询
List
<
Long
>
storeIds
=
roomList
.
stream
().
map
(
SRoom:
:
getStoreId
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
SStore
>
queryStoreWrapper
=
new
LambdaQueryWrapper
();
queryStoreWrapper
.
in
(
SStore:
:
getId
,
storeIds
);
List
<
SStore
>
storeList
=
storeMapper
.
selectList
(
queryStoreWrapper
);
Map
<
Long
,
String
>
storeMap
=
storeList
.
stream
().
collect
(
Collectors
.
toMap
(
SStore:
:
getId
,
SStore:
:
getName
));
list
.
stream
().
forEach
(
log
->
{
log
.
setRoomName
(
roomMap
.
get
(
log
.
getRoomId
()));
log
.
setStoreName
(
storeMap
.
get
(
roomStoreMap
.
get
(
log
.
getRoomId
())));
});
}
}
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