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
ea37bf56
authored
Oct 08, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixbug
parent
76f759b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
21 deletions
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
server-service/src/main/java/com/makeit/dto/platform/auth/PlatOrgDTO.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
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
View file @
ea37bf56
...
...
@@ -97,7 +97,7 @@ public class PlatSpaceController {
@ApiOperation
(
value
=
"导出模板"
)
@PostMapping
(
"/exportTemplate"
)
public
void
exportTemplate
(
HttpServletResponse
response
)
{
ExcelUtil
.
exportTemplate
(
response
,
"空间导入模板"
+
FileSuffixEnum
.
EXCEL
.
getSuffix
(),
PlatSpaceImportDTO
.
class
);
ExcelUtil
.
exportTemplate
(
response
,
"空间导入模板"
+
FileSuffixEnum
.
EXCEL
.
getSuffix
(),
"空间导入模板"
,
PlatSpaceImportDTO
.
class
);
}
...
...
server-service/src/main/java/com/makeit/dto/platform/auth/PlatOrgDTO.java
View file @
ea37bf56
...
...
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* Controller
*
...
...
@@ -15,4 +17,7 @@ import lombok.Data;
public
class
PlatOrgDTO
{
@ApiModelProperty
(
value
=
"类型 1-居家 2-机构"
)
private
String
type
;
@ApiModelProperty
(
value
=
"组织ids"
)
private
List
<
String
>
orgIds
;
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
View file @
ea37bf56
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.makeit.dto.platform.space.PlatRegionSettingDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
...
...
@@ -66,7 +67,7 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
.
in
(
PlatDeviceOther:
:
getDeviceId
,
listDeviceId
));
}
Map
<
String
,
String
>
map
=
platDeviceOthers
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDeviceOther:
:
getDeviceId
,
PlatDeviceOther:
:
get
Installation
));
Map
<
String
,
String
>
map
=
platDeviceOthers
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDeviceOther:
:
getDeviceId
,
PlatDeviceOther:
:
get
Attribute
));
List
<
PlatRegionSetting
>
list
=
new
ArrayList
<>();
listDeviceId
.
forEach
(
item
->{
...
...
@@ -74,7 +75,9 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
platRegionSetting
.
setDeviceId
(
item
);
platRegionSetting
.
setRoomId
(
roomId
);
if
(
map
.
get
(
item
)!=
null
){
platRegionSetting
.
setInstallType
(
map
.
get
(
item
));
String
attribute
=
map
.
get
(
item
);
PlatDeviceAttrWechatDTO
deviceAttrWechatDTO
=
JsonUtil
.
toObj
(
attribute
,
PlatDeviceAttrWechatDTO
.
class
);
platRegionSetting
.
setInstallType
(
deviceAttrWechatDTO
.
getRadarMount
()+
""
);
}
list
.
add
(
platRegionSetting
);
});
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
ea37bf56
...
...
@@ -387,6 +387,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
List
<
PlatRoom
>
rooms
=
platRoomService
.
list
();
Map
<
String
,
List
<
PlatRoom
>>
roomMap
=
rooms
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatRoom:
:
getSpaceId
));
List
<
String
>
lastSpaceIds
=
rooms
.
stream
().
filter
(
t
->
StringUtil
.
isNotEmpty
(
t
.
getSpaceId
())).
map
(
PlatRoom:
:
getSpaceId
).
collect
(
Collectors
.
toList
());
List
<
PlatSpaceImportDTO
>
list
=
ExcelUtil
.
importExcel
(
null
,
3
,
excelFile
,
PlatSpaceImportDTO
.
class
);
...
...
@@ -454,6 +455,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
if
(
errorVoList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
boolean
flag
=
false
;
PlatSpaceImportDTO
item
=
list
.
get
(
i
);
...
...
@@ -474,10 +476,19 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
spacePath
=
firstId
;
}
if
(
lastSpaceIds
.
contains
(
firstId
)){
flag
=
true
;
}
//第二层级
String
secondId
=
null
;
if
(
StringUtil
.
isNotEmpty
(
item
.
getBuilding
()))
{
if
(
flag
){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
0
),
"该空间下存在房间,不允许添加下级空间"
));
successCount
--;
errorCount
++;
continue
;
}
String
secondKey
=
firstId
+
"-"
+
item
.
getBuilding
();
if
(!
childrenIdMap
.
containsKey
(
secondKey
))
{
PlatSpace
platSpace
=
new
PlatSpace
();
...
...
@@ -493,12 +504,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
secondId
=
childrenIdMap
.
get
(
secondKey
);
}
spacePath
=
spacePath
+
","
+
secondId
;
if
(
lastSpaceIds
.
contains
(
secondId
)){
flag
=
true
;
}
}
//第三级
String
threeId
=
null
;
if
(
StringUtil
.
isNotEmpty
(
item
.
getUnit
()))
{
if
(
flag
){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
1
),
"该空间下存在房间,不允许添加下级空间"
));
successCount
--;
errorCount
++;
continue
;
}
String
threeKey
=
secondId
+
"-"
+
item
.
getUnit
();
if
(!
childrenIdMap
.
containsKey
(
threeKey
))
{
PlatSpace
platSpace
=
new
PlatSpace
();
...
...
@@ -514,12 +533,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
threeId
=
childrenIdMap
.
get
(
threeKey
);
}
spacePath
=
spacePath
+
","
+
threeId
;
if
(
lastSpaceIds
.
contains
(
secondId
)){
flag
=
true
;
}
}
//第四级
String
fourId
=
null
;
if
(
StringUtil
.
isNotEmpty
(
item
.
getFloor
()))
{
if
(
flag
){
errorVoList
.
add
(
new
ExcelErrorVo
(
i
+
3
,
excelField
.
get
(
2
),
"该空间下存在房间,不允许添加下级空间"
));
successCount
--;
errorCount
++;
continue
;
}
String
fourKey
=
threeId
+
"-"
+
item
.
getFloor
();
if
(!
childrenIdMap
.
containsKey
(
fourKey
))
{
PlatSpace
platSpace
=
new
PlatSpace
();
...
...
@@ -540,7 +567,12 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//房间
PlatRoomDTO
platRoomDTO
=
new
PlatRoomDTO
();
platRoomDTO
.
setName
(
item
.
getRoomName
());
platRoomDTO
.
setBedNumber
(
item
.
getBedNumber
());
if
(
item
.
getBedNumber
()!=
null
){
platRoomDTO
.
setBedNumber
(
item
.
getBedNumber
());
}
else
{
platRoomDTO
.
setBedNumber
(
0
);
}
String
spaceId
=
null
;
int
j
=
0
;
if
(
fourId
!=
null
){
...
...
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
View file @
ea37bf56
...
...
@@ -169,17 +169,20 @@ public class WorkStationServiceImpl implements WorkStationService {
public
PageVO
<
WorkStationInstitutionRoomVO
>
institutionPage
(
PageReqDTO
<
WorkStationQueryDTO
>
page
)
{
WorkStationQueryDTO
dto
=
page
.
getData
();
List
<
PlatSpace
>
spaces
=
new
ArrayList
<>();
//获取该账号的权限组织
List
<
PlatOrg
>
orgs
=
belongToScopeList
(
PlatOrgEnum
.
OrgTypeEnum
.
INSTITUTION
.
getValue
());
if
(
orgs
.
isEmpty
())
{
return
new
PageVO
<>();
if
(
dto
.
getOrgIds
().
isEmpty
()){
//获取该账号的权限组织
List
<
PlatOrg
>
orgs
=
belongToScopeList
(
PlatOrgEnum
.
OrgTypeEnum
.
INSTITUTION
.
getValue
());
if
(
orgs
.
isEmpty
())
{
return
new
PageVO
<>();
}
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setOrgIds
(
orgIds
);
}
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setOrgIds
(
orgIds
);
if
(
dto
.
getSpaceIds
().
isEmpty
())
{
spaces
=
platSpaceService
.
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
.
in
(
PlatSpace:
:
getOrgId
,
orgIds
));
.
in
(
PlatSpace:
:
getOrgId
,
dto
.
getOrgIds
()
));
if
(
spaces
.
isEmpty
())
{
return
new
PageVO
<>();
}
...
...
@@ -463,17 +466,20 @@ public class WorkStationServiceImpl implements WorkStationService {
public
PageVO
<
WorkStationHomeBedVO
>
homePage
(
PageReqDTO
<
WorkStationQueryDTO
>
page
)
{
WorkStationQueryDTO
dto
=
page
.
getData
();
List
<
PlatSpace
>
spaces
=
new
ArrayList
<>();
//获取该账号的权限组织
List
<
PlatOrg
>
orgs
=
belongToScopeList
(
PlatOrgEnum
.
OrgTypeEnum
.
HOME
.
getValue
());
if
(
orgs
.
isEmpty
())
{
return
new
PageVO
<>();
if
(
dto
.
getOrgIds
().
isEmpty
()){
//获取该账号的权限组织
List
<
PlatOrg
>
orgs
=
belongToScopeList
(
PlatOrgEnum
.
OrgTypeEnum
.
HOME
.
getValue
());
if
(
orgs
.
isEmpty
())
{
return
new
PageVO
<>();
}
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setOrgIds
(
orgIds
);
}
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setOrgIds
(
orgIds
);
if
(
dto
.
getSpaceIds
().
isEmpty
())
{
spaces
=
platSpaceService
.
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
.
in
(
PlatSpace:
:
getOrgId
,
orgIds
));
.
in
(
PlatSpace:
:
getOrgId
,
dto
.
getOrgIds
()
));
if
(
spaces
.
isEmpty
())
{
return
new
PageVO
<>();
}
...
...
@@ -550,6 +556,10 @@ public class WorkStationServiceImpl implements WorkStationService {
}
List
<
String
>
orgIds
=
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
if
(!
dto
.
getOrgIds
().
isEmpty
()){
orgIds
=
dto
.
getOrgIds
();
}
List
<
PlatSpace
>
list
=
platSpaceService
.
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
.
in
(
PlatSpace:
:
getOrgId
,
orgIds
));
...
...
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