Commit b2f3388f by 朱淼

修改bug

parent c6815154
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
* @Describe: * @Describe:
*/ */
public interface PlatRoomMapper extends BaseMapper<PlatRoom> { public interface PlatRoomMapper extends BaseMapper<PlatRoom> {
List<PlatSpaceAndRoomVO> spaceAndRoomList(); List<PlatSpaceAndRoomVO> spaceAndRoomList(@Param("orgIds")List<String> orgIds);
List<WorkStationInstitutionRoomVO> workStationList(@Param("dto") WorkStationQueryDTO dto); List<WorkStationInstitutionRoomVO> workStationList(@Param("dto") WorkStationQueryDTO dto);
} }
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
*/ */
public interface PlatSpaceMapper extends BaseMapper<PlatSpace> { public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
List<PlatSpaceAndRoomVO> spaceListExcludeLast(); List<PlatSpaceAndRoomVO> spaceListExcludeLast(@Param("orgIds") List<String> orgIds);
List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds); List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds);
} }
...@@ -60,7 +60,7 @@ public interface PlatRoomService extends IService<PlatRoom> { ...@@ -60,7 +60,7 @@ public interface PlatRoomService extends IService<PlatRoom> {
*/ */
PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page); PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page);
List<PlatSpaceAndRoomVO> spaceAndRoomList(); List<PlatSpaceAndRoomVO> spaceAndRoomList(List<String> orgIds);
List<WorkStationInstitutionRoomVO> workStationList(WorkStationQueryDTO dto); List<WorkStationInstitutionRoomVO> workStationList(WorkStationQueryDTO dto);
} }
...@@ -52,7 +52,7 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -52,7 +52,7 @@ public interface PlatSpaceService extends IService<PlatSpace> {
*/ */
PlatSpaceAddDTO view(String id); PlatSpaceAddDTO view(String id);
List<PlatSpaceAndRoomVO> spaceListExcludeLast(); List<PlatSpaceAndRoomVO> spaceListExcludeLast(List<String> orgIds);
/** /**
* 空间树 到 床位 * 空间树 到 床位
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.dto.platform.elder.PlatElderQueryDTO; import com.makeit.dto.platform.elder.PlatElderQueryDTO;
import com.makeit.dto.platform.space.PlatBedPanoramaDTO; import com.makeit.dto.platform.space.PlatBedPanoramaDTO;
import com.makeit.dto.platform.space.PlatRoomPanoramaDTO; import com.makeit.dto.platform.space.PlatRoomPanoramaDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.elder.PlatElder; 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;
...@@ -12,6 +13,7 @@ import com.makeit.entity.platform.space.PlatSpace; ...@@ -12,6 +13,7 @@ import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.platform.space.PlatBedPanoramaSpaceType; import com.makeit.enums.platform.space.PlatBedPanoramaSpaceType;
import com.makeit.enums.platform.space.PlatBedStatusEnum; import com.makeit.enums.platform.space.PlatBedStatusEnum;
import com.makeit.enums.platform.space.PlatRoomStatusEnum; import com.makeit.enums.platform.space.PlatRoomStatusEnum;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.PlatElderService; import com.makeit.service.platform.elder.PlatElderService;
import com.makeit.service.platform.space.*; import com.makeit.service.platform.space.*;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
...@@ -44,6 +46,8 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -44,6 +46,8 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
private PlatElderService platElderService; private PlatElderService platElderService;
@Autowired @Autowired
private PlatRoomBedDeviceService platRoomBedDeviceService; private PlatRoomBedDeviceService platRoomBedDeviceService;
@Autowired
private PlatOrgService platOrgService;
@Override @Override
...@@ -130,8 +134,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -130,8 +134,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
@Override @Override
public List<PlatSpaceAndRoomVO> roomPanoramaTree() { public List<PlatSpaceAndRoomVO> roomPanoramaTree() {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
//获取房间前两级空间 //获取房间前两级空间
List<PlatSpaceAndRoomVO> list = platSpaceService.spaceListExcludeLast(); List<PlatSpaceAndRoomVO> list = platSpaceService.spaceListExcludeLast(orgIds);
//父级 //父级
List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList()); List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
...@@ -149,8 +159,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -149,8 +159,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
@Override @Override
public List<PlatSpaceAndRoomVO> bedPanoramaTree() { public List<PlatSpaceAndRoomVO> bedPanoramaTree() {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
//获取空间及房间 //获取空间及房间
List<PlatSpaceAndRoomVO> list = platRoomService.spaceAndRoomList(); List<PlatSpaceAndRoomVO> list = platRoomService.spaceAndRoomList(orgIds);
//父级 //父级
List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList()); List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
......
...@@ -145,8 +145,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i ...@@ -145,8 +145,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
} }
@Override @Override
public List<PlatSpaceAndRoomVO> spaceAndRoomList() { public List<PlatSpaceAndRoomVO> spaceAndRoomList(List<String> orgIds) {
return baseMapper.spaceAndRoomList(); return baseMapper.spaceAndRoomList(orgIds);
} }
@Override @Override
......
...@@ -163,8 +163,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -163,8 +163,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
@Override @Override
public List<PlatSpaceAndRoomVO> spaceListExcludeLast() { public List<PlatSpaceAndRoomVO> spaceListExcludeLast(List<String> orgIds) {
return baseMapper.spaceListExcludeLast(); return baseMapper.spaceListExcludeLast(orgIds);
} }
@Override @Override
......
...@@ -70,6 +70,16 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -70,6 +70,16 @@ public class WorkStationServiceImpl implements WorkStationService {
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIds); dto.setOrgIds(orgIds);
}else {
//根据类型过滤数据
List<PlatOrg> platOrgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds())
.eq(PlatOrg::getType, PlatOrgEnum.OrgTypeEnum.INSTITUTION.getValue()));
if(platOrgs.isEmpty()){
return vo;
}
List<String> orgIdList = platOrgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIdList);
} }
//待处理告警 //待处理告警
long unHandledNumber = platAlarmRecordService.count(new QueryWrapper<PlatAlarmRecord>().lambda() long unHandledNumber = platAlarmRecordService.count(new QueryWrapper<PlatAlarmRecord>().lambda()
...@@ -259,6 +269,16 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -259,6 +269,16 @@ public class WorkStationServiceImpl implements WorkStationService {
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIds); dto.setOrgIds(orgIds);
}else {
//根据类型过滤数据
List<PlatOrg> platOrgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds())
.eq(PlatOrg::getType, PlatOrgEnum.OrgTypeEnum.HOME.getValue()));
if(platOrgs.isEmpty()){
return vo;
}
List<String> orgIdList = platOrgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIdList);
} }
//长者数 //长者数
long elderNumber = platElderService.count(new QueryWrapper<PlatElder>().lambda() long elderNumber = platElderService.count(new QueryWrapper<PlatElder>().lambda()
......
...@@ -5,10 +5,28 @@ ...@@ -5,10 +5,28 @@
<mapper namespace="com.makeit.mapper.platform.space.PlatRoomMapper"> <mapper namespace="com.makeit.mapper.platform.space.PlatRoomMapper">
<select id="spaceAndRoomList" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO"> <select id="spaceAndRoomList" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO">
SELECT ps.id,ps.`name`,ps.parent_id as parentId,'1' as type FROM plat_space ps SELECT ps.id,ps.`name`,ps.parent_id as parentId,'1' as type FROM plat_space ps
WHERE ps.del_flag = 0 <where>
ps.del_flag = 0
<if test="orgIds != null and orgIds.size()>0 ">
AND ps.org_id IN
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
UNION UNION
SELECT pr.id,pr.`name`,pr.space_id as parentId,'2' as type FROM plat_room pr SELECT pr.id,pr.`name`,pr.space_id as parentId,'2' as type FROM plat_room pr
WHERE pr.del_flag = 0 LEFT JOIN plat_space p ON p.id = pr.space_id
<where>
pr.del_flag = 0
<if test="orgIds != null and orgIds.size()>0 ">
AND p.org_id IN
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select> </select>
<select id="workStationList" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO"> <select id="workStationList" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO">
......
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
<mapper namespace="com.makeit.mapper.platform.space.PlatSpaceMapper"> <mapper namespace="com.makeit.mapper.platform.space.PlatSpaceMapper">
<select id="spaceListExcludeLast" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO"> <select id="spaceListExcludeLast" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO">
SELECT ps.id,ps.`name`,ps.parent_id as parentId FROM plat_space ps SELECT ps.id,ps.`name`,ps.parent_id as parentId FROM plat_space ps
WHERE ps.id in (SELECT parent_id FROM `plat_space` WHERE del_flag =0) and ps.del_flag = 0 <where>
ps.id in (SELECT parent_id FROM `plat_space` WHERE del_flag =0) and ps.del_flag = 0
<if test="orgIds != null and orgIds.size() > 0 ">
AND ps.org_id in
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select> </select>
<select id="listChild" resultType="com.makeit.entity.platform.space.PlatSpace"> <select id="listChild" resultType="com.makeit.entity.platform.space.PlatSpace">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment