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
76f759b4
authored
Oct 06, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix bug
parent
b1c74864
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
14 deletions
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomBedDeviceServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomBedDeviceServiceImpl.java
View file @
76f759b4
...
@@ -97,7 +97,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
...
@@ -97,7 +97,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
PlatSpaceDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
PlatSpaceDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
LambdaQueryWrapper
<
PlatRoomBedDevice
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PlatRoomBedDevice
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
select
(
PlatRoomBedDevice:
:
getDeviceId
);
//
queryWrapper1.select(PlatRoomBedDevice::getDeviceId);
List
<
PlatRoomBedDevice
>
list
=
list
(
queryWrapper1
);
List
<
PlatRoomBedDevice
>
list
=
list
(
queryWrapper1
);
List
<
PlatRoomBedDevice
>
list1
=
new
ArrayList
<>();
List
<
PlatRoomBedDevice
>
list1
=
new
ArrayList
<>();
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
76f759b4
...
@@ -107,12 +107,16 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -107,12 +107,16 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
space
.
setAddress
(
dto
.
getAddress
());
space
.
setAddress
(
dto
.
getAddress
());
space
.
setLatitude
(
dto
.
getLatitude
());
space
.
setLatitude
(
dto
.
getLatitude
());
space
.
setLongitude
(
dto
.
getLongitude
());
space
.
setLongitude
(
dto
.
getLongitude
());
space
.
setParentId
(
dto
.
getParentId
());
if
(
StringUtil
.
isEmpty
(
dto
.
getParentPath
())){
if
(
StringUtil
.
isEmpty
(
dto
.
getParentPath
())){
space
.
setParentPath
(
null
);
space
.
setParentPath
(
null
);
}
else
{
}
else
{
space
.
setParentPath
(
dto
.
getParentPath
());
space
.
setParentPath
(
dto
.
getParentPath
());
}
}
if
(
StringUtil
.
isEmpty
(
dto
.
getParentId
())){
space
.
setParentId
(
null
);
}
else
{
space
.
setParentId
(
dto
.
getParentId
());
}
//上级空间
//上级空间
PlatSpace
parentSpace
=
this
.
getById
(
dto
.
getParentId
());
PlatSpace
parentSpace
=
this
.
getById
(
dto
.
getParentId
());
...
@@ -374,12 +378,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -374,12 +378,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
try
{
try
{
List
<
PlatSpace
>
listPlatSpace
=
list
(
new
LambdaQueryWrapper
<>());
List
<
PlatSpace
>
listPlatSpace
=
list
(
new
LambdaQueryWrapper
<>());
List
<
PlatSpace
>
firstSpace
=
listPlatSpace
.
stream
().
filter
(
item
->
item
.
getParentId
()
==
null
).
collect
(
Collectors
.
toList
());
List
<
PlatSpace
>
firstSpace
=
listPlatSpace
.
stream
().
filter
(
item
->
StringUtil
.
isEmpty
(
item
.
getParentId
())
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
firstSpaceNameMap
=
firstSpace
.
stream
().
collect
(
Collectors
.
toMap
(
PlatSpace:
:
getName
,
PlatSpace:
:
getId
,
(
k1
,
k2
)
->
k1
));
Map
<
String
,
String
>
firstSpaceNameMap
=
firstSpace
.
stream
().
collect
(
Collectors
.
toMap
(
PlatSpace:
:
getName
,
PlatSpace:
:
getId
,
(
k1
,
k2
)
->
k1
));
List
<
PlatSpace
>
listChildren
=
listPlatSpace
.
stream
().
filter
(
item
->
item
.
getParentId
()
!=
null
).
collect
(
Collectors
.
toList
());
List
<
PlatSpace
>
listChildren
=
listPlatSpace
.
stream
().
filter
(
item
->
StringUtil
.
isNotEmpty
(
item
.
getParentId
())
).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
PlatSpace
>>
childrenMap
=
listChildren
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatSpace:
:
getParentId
));
Map
<
String
,
List
<
PlatSpace
>>
childrenMap
=
listChildren
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatSpace:
:
getParentId
));
Map
<
String
,
String
>
childrenIdMap
=
listChildren
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getParentId
()
+
item
.
getName
(),
item
->
item
.
getId
(),
(
k1
,
k2
)
->
k1
));
Map
<
String
,
String
>
childrenIdMap
=
listChildren
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getParentId
()
+
"-"
+
item
.
getName
(),
item
->
item
.
getId
(),
(
k1
,
k2
)
->
k1
));
List
<
PlatRoom
>
rooms
=
platRoomService
.
list
();
Map
<
String
,
List
<
PlatRoom
>>
roomMap
=
rooms
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatRoom:
:
getSpaceId
));
List
<
PlatSpaceImportDTO
>
list
=
ExcelUtil
.
importExcel
(
null
,
3
,
excelFile
,
PlatSpaceImportDTO
.
class
);
List
<
PlatSpaceImportDTO
>
list
=
ExcelUtil
.
importExcel
(
null
,
3
,
excelFile
,
PlatSpaceImportDTO
.
class
);
...
@@ -430,10 +437,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -430,10 +437,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
key
=
key
+
"-"
+
item
.
getFloor
();
key
=
key
+
"-"
+
item
.
getFloor
();
}
}
if
(
listKey
.
contains
(
key
))
{
if
(
listKey
.
contains
(
key
+
"-"
+
item
.
getRoomName
()
))
{
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
0
),
"该空间下,房间名已存在"
));
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
0
),
"该空间下,房间名已存在"
));
errorFlag
=
true
;
errorFlag
=
true
;
}
}
listKey
.
add
(
key
+
"-"
+
item
.
getRoomName
());
if
(
errorFlag
)
{
if
(
errorFlag
)
{
errorCount
++;
errorCount
++;
...
@@ -534,19 +542,48 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -534,19 +542,48 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
platRoomDTO
.
setName
(
item
.
getRoomName
());
platRoomDTO
.
setName
(
item
.
getRoomName
());
platRoomDTO
.
setBedNumber
(
item
.
getBedNumber
());
platRoomDTO
.
setBedNumber
(
item
.
getBedNumber
());
String
spaceId
=
null
;
String
spaceId
=
null
;
if
(
firstId
!=
null
)
{
int
j
=
0
;
spaceId
=
firstId
;
if
(
fourId
!=
null
){
}
else
if
(
secondId
!=
null
)
{
spaceId
=
secondId
;
}
else
if
(
threeId
!=
null
)
{
spaceId
=
threeId
;
}
else
if
(
fourId
!=
null
)
{
spaceId
=
fourId
;
spaceId
=
fourId
;
j
=
3
;
}
else
if
(
threeId
!=
null
){
spaceId
=
threeId
;
j
=
2
;
}
else
if
(
secondId
!=
null
){
spaceId
=
secondId
;
j
=
1
;
}
else
if
(
firstId
!=
null
){
spaceId
=
firstId
;
}
//判断该层级是否最后一级
List
<
PlatSpace
>
childSpaes
=
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
.
eq
(
PlatSpace:
:
getParentId
,
spaceId
));
if
(!
childSpaes
.
isEmpty
()){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
j
),
"该空间存在下级空间,不允许添加房间"
));
successCount
--;
errorCount
++;
continue
;
}
}
platRoomDTO
.
setSpaceId
(
spaceId
);
platRoomDTO
.
setSpaceId
(
spaceId
);
platRoomDTO
.
setSpacePath
(
spacePath
);
platRoomDTO
.
setSpacePath
(
spacePath
);
platRoomService
.
add
(
platRoomDTO
);
PlatRoom
platRoom
=
BeanDtoVoUtils
.
convert
(
platRoomDTO
,
PlatRoom
.
class
);
if
(
roomMap
.
get
(
spaceId
)!=
null
){
List
<
PlatRoom
>
roomList
=
roomMap
.
get
(
spaceId
);
List
<
String
>
roomNames
=
roomList
.
stream
().
map
(
PlatRoom:
:
getName
).
collect
(
Collectors
.
toList
());
if
(
roomNames
.
contains
(
platRoom
.
getName
())){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
0
),
"该空间下,房间名已存在"
));
successCount
--;
errorCount
++;
continue
;
}
}
}
platRoomService
.
save
(
platRoom
);
platBedService
.
add
(
platRoom
);
}
}
if
(!
errorVoList
.
isEmpty
()){
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
}
excelImportVo
.
setTotalCount
(
list
.
size
());
excelImportVo
.
setTotalCount
(
list
.
size
());
excelImportVo
.
setErrorCount
(
errorCount
);
excelImportVo
.
setErrorCount
(
errorCount
);
...
...
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