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
68354596
authored
Sep 18, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改bug
parent
74831b4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
14 deletions
db/space.sql
server-service/src/main/java/com/makeit/service/platform/dataScreen/impl/DataScreenServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
db/space.sql
View file @
68354596
...
...
@@ -83,8 +83,8 @@ CREATE TABLE `plat_bed`
CREATE
TABLE
`plat_region_setting`
(
`id`
varchar
(
64
)
NOT
NULL
COMMENT
'id'
,
`install_type`
char
(
1
)
NO
T
NULL
COMMENT
'安装方式 0-顶装 1-侧装'
,
`toward`
char
(
1
)
NO
T
NULL
COMMENT
'设备朝向 0-上 1-下 2-左 3-右'
,
`install_type`
char
(
1
)
DEFAUL
T
NULL
COMMENT
'安装方式 0-顶装 1-侧装'
,
`toward`
char
(
1
)
DEFAUL
T
NULL
COMMENT
'设备朝向 0-上 1-下 2-左 3-右'
,
`region_name`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'区域名称'
,
`region_range`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'区域定位'
,
`room_range`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'房间门定位'
,
...
...
server-service/src/main/java/com/makeit/service/platform/dataScreen/impl/DataScreenServiceImpl.java
View file @
68354596
...
...
@@ -397,13 +397,14 @@ public class DataScreenServiceImpl implements DataScreenService {
private
List
<
PlatAlarmRecordStatisticsVo
>
coverToVoList
(
List
<
PlatAlarmRecord
>
alarmRecords
,
Map
<
String
,
PlatElder
>
platElderMap
)
{
List
<
PlatAlarmRecordStatisticsVo
>
statisticsVos
=
new
ArrayList
<>();
alarmRecords
.
forEach
(
record
->{
List
<
String
>
elderIds
=
Arrays
.
asList
(
record
.
getElderIds
().
split
(
","
));
if
(
StringUtil
.
isNotEmpty
(
record
.
getElderIds
())
&&
elderIds
.
size
()>
0
){
if
(
platElderMap
.
get
(
elderIds
.
get
(
0
))!=
null
){
PlatAlarmRecordStatisticsVo
statisticsVo
=
BeanDtoVoUtils
.
convert
(
record
,
PlatAlarmRecordStatisticsVo
.
class
);
statisticsVo
.
setSpaceId
(
platElderMap
.
get
(
elderIds
.
get
(
0
)).
getSpaceId
());
statisticsVos
.
add
(
statisticsVo
);
if
(
StringUtil
.
isNotEmpty
(
record
.
getElderIds
()))
{
List
<
String
>
elderIds
=
Arrays
.
asList
(
record
.
getElderIds
().
split
(
","
));
if
(
elderIds
.
size
()
>
0
)
{
if
(
platElderMap
.
get
(
elderIds
.
get
(
0
))
!=
null
)
{
PlatAlarmRecordStatisticsVo
statisticsVo
=
BeanDtoVoUtils
.
convert
(
record
,
PlatAlarmRecordStatisticsVo
.
class
);
statisticsVo
.
setSpaceId
(
platElderMap
.
get
(
elderIds
.
get
(
0
)).
getSpaceId
());
statisticsVos
.
add
(
statisticsVo
);
}
}
}
});
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
View file @
68354596
package
com
.
makeit
.
service
.
platform
.
space
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.makeit.dto.platform.space.PlatRegionSettingDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
import
com.makeit.enums.platform.device.PlatDeviceEnum
;
import
com.makeit.mapper.platform.space.PlatRegionSettingMapper
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
...
...
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -30,6 +34,8 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
@Autowired
private
PlatDeviceService
platDeviceService
;
@Autowired
private
PlatDeviceOtherService
platDeviceOtherService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -43,13 +49,23 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
queryWrapper1
.
ne
(
PlatDevice:
:
getCategory
,
PlatDeviceEnum
.
CategoryEnum
.
HEART
);
List
<
PlatDevice
>
devices
=
platDeviceService
.
list
(
queryWrapper1
);
listDeviceId
=
devices
.
stream
().
map
(
item
->
item
.
getId
()).
collect
(
Collectors
.
toList
());
List
<
PlatDeviceOther
>
platDeviceOthers
=
new
ArrayList
<>();
if
(!
listDeviceId
.
isEmpty
()){
//获取设备安装方式
platDeviceOthers
=
platDeviceOtherService
.
list
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
.
in
(
PlatDeviceOther:
:
getDeviceId
,
listDeviceId
));
}
Map
<
String
,
String
>
map
=
platDeviceOthers
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDeviceOther:
:
getDeviceId
,
PlatDeviceOther:
:
getInstallation
));
List
<
PlatRegionSetting
>
list
=
new
ArrayList
<>();
listDeviceId
.
forEach
(
item
->{
PlatRegionSetting
platRegionSetting
=
new
PlatRegionSetting
();
platRegionSetting
.
setDeviceId
(
item
);
platRegionSetting
.
setRoomId
(
roomId
);
if
(
map
.
get
(
item
)!=
null
){
platRegionSetting
.
setInstallType
(
map
.
get
(
item
));
}
list
.
add
(
platRegionSetting
);
});
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
68354596
...
...
@@ -69,12 +69,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public
void
add
(
PlatSpaceAddDTO
dto
)
{
check
(
dto
);
PlatSpace
space
=
BeanDtoVoUtils
.
convert
(
dto
,
PlatSpace
.
class
);
PlatUserVO
userVO
=
PlatUserUtil
.
getUserVO
();
space
.
setOrgId
(
userVO
.
getOrgId
());
PlatOrg
org
=
platOrgService
.
getById
(
userVO
.
getOrgId
());
if
(
org
!=
null
){
space
.
setAttribute
(
org
.
getType
());
if
(
StringUtil
.
isEmpty
(
dto
.
getParentId
())){
PlatUserVO
userVO
=
PlatUserUtil
.
getUserVO
();
space
.
setOrgId
(
userVO
.
getOrgId
());
PlatOrg
org
=
platOrgService
.
getById
(
space
.
getOrgId
());
if
(
org
!=
null
){
space
.
setAttribute
(
org
.
getType
());
}
}
else
{
//上级空间
PlatSpace
parentSpace
=
getById
(
dto
.
getParentId
());
space
.
setOrgId
(
parentSpace
.
getOrgId
());
space
.
setAttribute
(
parentSpace
.
getAttribute
());
}
save
(
space
);
}
...
...
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