Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ce5007a4
authored
Oct 11, 2023
by
杨伟程
Browse files
Options
_('Browse Files')
Download
Plain Diff
配网更新
parents
e775e87f
aeb05456
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
6 deletions
server-service/src/main/java/com/makeit/entity/platform/space/PlatRoomBedDevice.java
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
server-service/src/main/java/com/makeit/service/platform/dataScreen/impl/DataScreenServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
server-service/src/main/java/com/makeit/entity/platform/space/PlatRoomBedDevice.java
View file @
ce5007a4
...
...
@@ -27,4 +27,7 @@ public class PlatRoomBedDevice extends BaseBusEntity {
@TableField
(
updateStrategy
=
FieldStrategy
.
IGNORED
)
@ApiModelProperty
(
value
=
"床位Id"
)
private
String
bedId
;
@TableField
(
exist
=
false
)
private
String
path
;
}
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
View file @
ce5007a4
...
...
@@ -2,6 +2,7 @@ package com.makeit.mapper.platform.device;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
...
...
@@ -20,4 +21,5 @@ public interface PlatDeviceMapper extends BaseMapper<PlatDevice> {
Page
<
PlatDeviceListVO
>
getDeviceIdsBySpaceId
(
@Param
(
"param"
)
PlatDeviceQueryDTO
param
,
Page
page
);
Page
<
PlatDeviceListVO
>
getDevices
(
@Param
(
"param"
)
PlatDataScreenQueryDTO
param
,
Page
<
PlatDevice
>
page
);
}
server-service/src/main/java/com/makeit/service/platform/dataScreen/impl/DataScreenServiceImpl.java
View file @
ce5007a4
...
...
@@ -15,6 +15,7 @@ import com.makeit.entity.platform.device.PlatDevice;
import
com.makeit.entity.platform.elder.PlatElder
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatRoomBedDevice
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.platform.alarm.PlatAlarmConfigEnum
;
...
...
@@ -29,6 +30,7 @@ import com.makeit.service.platform.dataScreen.DataScreenService;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.elder.PlatElderService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatRoomBedDeviceService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.utils.area.AreaUtil
;
import
com.makeit.utils.area.ChinaAreaVO
;
...
...
@@ -41,6 +43,7 @@ import com.makeit.vo.platform.dataScreen.*;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.elder.PlatElderListVO
;
import
jodd.util.StringUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -53,6 +56,7 @@ import java.time.format.DateTimeFormatter;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* Controller
...
...
@@ -76,6 +80,8 @@ public class DataScreenServiceImpl implements DataScreenService {
private
PlatSpaceService
platSpaceService
;
@Autowired
private
PlatOrgService
platOrgService
;
@Autowired
private
PlatRoomBedDeviceService
platRoomBedDeviceService
;
@Override
public
PlatAgeStatisticsVO
ageStatistics
(
PlatDataScreenQueryDTO
dto
)
{
...
...
@@ -508,14 +514,42 @@ public class DataScreenServiceImpl implements DataScreenService {
}
Page
<
PlatDevice
>
p
=
PageUtil
.
toMpPage
(
pageReqDTO
);
LambdaQueryWrapper
queryWrapper
=
new
LambdaQueryWrapper
<
PlatDevice
>()
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getDeviceStatus
()),
PlatDevice:
:
getStatus
,
dto
.
getDeviceStatus
())
.
in
(
PlatDevice:
:
getOrgId
,
dto
.
getOrgIds
())
.
orderByDesc
(
BaseEntity:
:
getUpdateDate
);
// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<PlatDevice>()
// .eq(StringUtils.isNotBlank(dto.getDeviceStatus()), PlatDevice::getStatus, dto.getDeviceStatus())
// .in(PlatDevice::getOrgId, dto.getOrgIds())
// .orderByDesc(BaseEntity::getUpdateDate);
//
// Page<PlatDevice> page = platDeviceService.page(p, queryWrapper);
Page
<
PlatDeviceListVO
>
page
=
platDeviceService
.
getDevices
(
dto
,
p
);
List
<
PlatDeviceListVO
>
voList
=
page
.
getRecords
();
if
(
CollectionUtils
.
isEmpty
(
voList
)){
return
new
PageVO
<>();
}
List
<
String
>
spaceIdList
=
voList
.
stream
().
flatMap
(
vo
->
{
String
spaceParentPath
=
vo
.
getSpaceParentPath
();
String
spp
=
Optional
.
ofNullable
(
spaceParentPath
).
orElse
(
""
);
return
Stream
.
of
(
spp
.
split
(
","
));
}).
collect
(
Collectors
.
toList
());
spaceIdList
.
add
(
"-1"
);
List
<
PlatSpace
>
platSpaces
=
platSpaceService
.
listByIds
(
spaceIdList
);
Page
<
PlatDevice
>
page
=
platDeviceService
.
page
(
p
,
queryWrapper
);
Map
<
String
,
String
>
spaceIdNameMap
=
platSpaces
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
vo
->
vo
.
getName
(),
(
v1
,
v2
)
->
v1
)
);
List
<
PlatDeviceListVO
>
voList
=
BeanDtoVoUtils
.
listVo
(
page
.
getRecords
(),
PlatDeviceListVO
.
class
);
for
(
PlatDeviceListVO
record
:
voList
)
{
String
spaceParentPath
=
record
.
getSpaceParentPath
();
if
(
StringUtils
.
isNotBlank
(
spaceParentPath
)){
String
spaceNameJoin
=
Stream
.
of
(
spaceParentPath
.
split
(
","
)).
map
(
vo
->
spaceIdNameMap
.
get
(
vo
)).
collect
(
Collectors
.
joining
(
"-"
));
String
spaceName
=
spaceNameJoin
+
"-"
+
record
.
getSpaceName
()
+
"-"
+
record
.
getRoomName
();
if
(
StringUtils
.
isNotBlank
(
record
.
getBedName
())){
spaceName
=
spaceName
+
"-"
+
record
.
getBedName
();
}
record
.
setSpaceName
(
spaceName
);
}
}
JoinUtil
.
join
(
voList
,
platOrgService
,
PlatDeviceListVO:
:
getOrgId
,
PlatOrg:
:
getId
,
(
d
,
o
)
->
{
d
.
setOrgName
(
o
.
getName
());
...
...
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
ce5007a4
package
com
.
makeit
.
service
.
platform
.
device
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.dto.platform.device.PlatDeviceEditDTO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
...
...
@@ -62,4 +64,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
List
<
DeviceProperties
>
readDeviceProperties
(
PlatDeviceAttrWechatDTO
dto
);
List
<
PlatDevice
>
productList
(
PlatDeviceQueryDTO
dto
);
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
p
);
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
ce5007a4
...
...
@@ -11,6 +11,7 @@ import com.makeit.common.entity.BaseBusEntity;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.dto.platform.device.PlatDeviceEditDTO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
...
...
@@ -197,6 +198,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
PlatDevice
db
=
getOne
(
new
QueryWrapper
<
PlatDevice
>().
lambda
()
.
eq
(
PlatDevice:
:
getOriDeviceId
,
dto
.
getOriDeviceId
()));
if
(
db
==
null
)
{
throw
new
RuntimeException
(
"设备不存在:"
+
db
.
getOriDeviceId
());
}
String
id
=
null
;
if
(
db
!=
null
)
{
...
...
@@ -374,4 +379,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
.
groupBy
(
PlatDevice:
:
getProductId
));
return
platDevices
;
}
@Override
public
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
page
)
{
return
baseMapper
.
getDevices
(
dto
,
page
);
}
}
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
View file @
ce5007a4
...
...
@@ -43,4 +43,33 @@
</where>
order by pd.update_date desc,prbd.update_date desc
</select>
<select
id=
"getDevices"
resultType=
"com.makeit.vo.platform.device.PlatDeviceListVO"
>
select
distinct
pd.*,
ps.parent_path as spaceParentPath,
ps.name as spaceName,
pr.name as roomName,
pb.name as bedName
from plat_device pd
left join plat_room_bed_device prbd on (pd.id = prbd.device_id and prbd.del_flag = 0)
left join plat_room pr on (pr.id = prbd.room_id and pr.del_flag = 0 )
left join plat_bed pb on ( pb.id = prbd.bed_id and pb.del_flag = 0)
left join plat_space ps on (ps.id = pr.space_id and ps.del_flag = 0)
<where>
pd.del_flag = 0
<if
test=
"param.deviceStatus != null and param.deviceStatus != '' "
>
and pd.status = #{param.deviceStatus}
</if>
<if
test=
"param.orgIds != null and param.orgIds.size() > 0 "
>
AND ps.org_id in
<foreach
collection=
"param.orgIds"
item=
"item"
separator=
","
open=
"("
close=
")"
index=
""
>
#{item}
</foreach>
</if>
</where>
order by pd.update_date desc,prbd.update_date desc
</select>
</mapper>
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