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
6ef40254
authored
Oct 08, 2023
by
lzy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
老人组织
parent
97eed631
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
server-service/src/main/java/com/makeit/dto/platform/space/PlatSpaceQueryDTO.java
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
View file @
6ef40254
...
@@ -87,6 +87,13 @@ public class PlatSpaceController {
...
@@ -87,6 +87,13 @@ public class PlatSpaceController {
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
@ApiOperation
(
"树-到床位(未住人床位)-根据老人组织"
)
@PostMapping
(
"listTreeAuthIgnoreByElder"
)
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listTreeAuthIgnoreByElder
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
List
<
PlatSpaceVO
>
data
=
spaceService
.
listBedTreeByElderGroup
(
dto
,
true
);
return
ApiResponseUtils
.
success
(
data
);
}
@ApiOperation
(
"树-到床位"
)
@ApiOperation
(
"树-到床位"
)
@PostMapping
(
"listBedTree"
)
@PostMapping
(
"listBedTree"
)
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listBedTreeAuthIgnore
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listBedTreeAuthIgnore
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
...
...
server-service/src/main/java/com/makeit/dto/platform/space/PlatSpaceQueryDTO.java
View file @
6ef40254
...
@@ -15,4 +15,7 @@ public class PlatSpaceQueryDTO {
...
@@ -15,4 +15,7 @@ public class PlatSpaceQueryDTO {
@ApiModelProperty
(
"空间名称"
)
@ApiModelProperty
(
"空间名称"
)
private
String
name
;
private
String
name
;
@ApiModelProperty
(
"长者ID"
)
private
String
elderId
;
}
}
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
View file @
6ef40254
...
@@ -82,4 +82,15 @@ public interface PlatSpaceService extends IService<PlatSpace> {
...
@@ -82,4 +82,15 @@ public interface PlatSpaceService extends IService<PlatSpace> {
List
<
PlatSpaceVO
>
parentListTree
(
PlatSpaceQueryDTO
dto
);
List
<
PlatSpaceVO
>
parentListTree
(
PlatSpaceQueryDTO
dto
);
List
<
PlatSpaceVO
>
listBedTree
(
PlatSpaceQueryDTO
dto
,
boolean
flag
);
List
<
PlatSpaceVO
>
listBedTree
(
PlatSpaceQueryDTO
dto
,
boolean
flag
);
/**
* 根据老人组织过滤空间
* @param dto
* @param flag
* @return
*/
List
<
PlatSpaceVO
>
listBedTreeByElderGroup
(
PlatSpaceQueryDTO
dto
,
boolean
flag
);
}
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
6ef40254
...
@@ -9,6 +9,7 @@ import com.makeit.common.vo.ExcelErrorVo;
...
@@ -9,6 +9,7 @@ import com.makeit.common.vo.ExcelErrorVo;
import
com.makeit.common.vo.ExcelImportVo
;
import
com.makeit.common.vo.ExcelImportVo
;
import
com.makeit.dto.platform.space.*
;
import
com.makeit.dto.platform.space.*
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.elder.PlatElder
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.entity.platform.space.PlatSpace
;
...
@@ -18,6 +19,7 @@ import com.makeit.enums.platform.space.PlatSpaceEnum;
...
@@ -18,6 +19,7 @@ import com.makeit.enums.platform.space.PlatSpaceEnum;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.mapper.platform.space.PlatSpaceMapper
;
import
com.makeit.mapper.platform.space.PlatSpaceMapper
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.elder.PlatElderService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
...
@@ -53,6 +55,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -53,6 +55,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
private
PlatBedService
platBedService
;
private
PlatBedService
platBedService
;
@Autowired
@Autowired
private
PlatOrgService
platOrgService
;
private
PlatOrgService
platOrgService
;
@Autowired
private
PlatElderService
platElderService
;
private
void
check
(
PlatSpaceAddDTO
dto
)
{
private
void
check
(
PlatSpaceAddDTO
dto
)
{
LambdaQueryWrapper
<
PlatSpace
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PlatSpace
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -707,6 +711,78 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -707,6 +711,78 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
}
}
@Override
public
List
<
PlatSpaceVO
>
listBedTreeByElderGroup
(
PlatSpaceQueryDTO
dto
,
boolean
flag
)
{
PlatElder
platElder
=
platElderService
.
getById
(
dto
.
getElderId
());
List
<
String
>
orgIds
=
new
ArrayList
<>();
orgIds
.
add
(
"-1"
);
if
(
platElder
!=
null
){
orgIds
.
add
(
platElder
.
getOrgId
());
}
//床位
LambdaQueryWrapper
<
PlatBed
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
if
(
flag
){
queryWrapper1
.
eq
(
PlatBed:
:
getStatus
,
CommonEnum
.
YES
.
getValue
());
}
List
<
PlatBed
>
listBeds
=
platBedService
.
list
(
queryWrapper1
);
if
(
listBeds
.
isEmpty
()){
return
new
ArrayList
<>();
}
List
<
String
>
roomIds
=
listBeds
.
stream
().
map
(
PlatBed:
:
getRoomId
).
collect
(
Collectors
.
toList
());
List
<
PlatRoom
>
listRoom
=
platRoomService
.
list
(
new
QueryWrapper
<
PlatRoom
>().
lambda
()
.
in
(
PlatRoom:
:
getId
,
roomIds
));
List
<
String
>
spaceIds
=
listRoom
.
stream
().
map
(
PlatRoom:
:
getSpacePath
).
collect
(
Collectors
.
toList
());
Set
<
String
>
spaceIdList
=
new
HashSet
<>();
for
(
String
spaceId
:
spaceIds
){
spaceIdList
.
addAll
(
Arrays
.
asList
(
spaceId
.
split
(
","
)));
}
spaceIdList
.
add
(
"-1"
);
List
<
PlatSpaceVO
>
listRoomVo
=
new
ArrayList
<>();
listRoom
.
forEach
(
item
->
{
PlatSpaceVO
vo
=
new
PlatSpaceVO
();
vo
.
setId
(
item
.
getId
());
vo
.
setName
(
item
.
getName
());
vo
.
setParentId
(
item
.
getSpaceId
());
listRoomVo
.
add
(
vo
);
});
listBeds
.
forEach
(
item
->
{
PlatSpaceVO
vo
=
new
PlatSpaceVO
();
vo
.
setId
(
item
.
getId
());
vo
.
setName
(
item
.
getName
());
vo
.
setParentId
(
item
.
getRoomId
());
listRoomVo
.
add
(
vo
);
});
LambdaQueryWrapper
<
PlatSpace
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
like
(
StringUtil
.
isNotEmpty
(
dto
.
getName
()),
PlatSpace:
:
getName
,
dto
.
getName
());
queryWrapper
.
in
(
PlatSpace:
:
getId
,
spaceIdList
);
queryWrapper
.
in
(
PlatSpace:
:
getOrgId
,
orgIds
);
List
<
PlatSpace
>
list
=
this
.
list
(
queryWrapper
);
List
<
PlatSpaceVO
>
listSpaceVo
=
BeanDtoVoUtils
.
listVo
(
list
,
PlatSpaceVO
.
class
);
listSpaceVo
.
addAll
(
listRoomVo
);
//父级
List
<
PlatSpaceVO
>
listParent
=
listSpaceVo
.
stream
().
filter
(
item
->
StringUtil
.
isEmpty
(
item
.
getParentId
())).
collect
(
Collectors
.
toList
());
//子集
List
<
PlatSpaceVO
>
listChild
=
listSpaceVo
.
stream
().
filter
(
item
->
item
.
getParentId
()
!=
null
).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
PlatSpaceVO
>>
map
=
listChild
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatSpaceVO:
:
getParentId
));
List
<
PlatSpaceVO
>
data
=
new
ArrayList
<>();
for
(
PlatSpaceVO
space
:
listParent
)
{
space
=
childVo
(
space
,
map
);
data
.
add
(
space
);
}
return
data
;
}
}
}
...
...
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