Commit 943ed719 by 朱淼

fixbug

parent 115de5dd
...@@ -27,4 +27,7 @@ public class PlatRoomBedDevice extends BaseBusEntity { ...@@ -27,4 +27,7 @@ public class PlatRoomBedDevice extends BaseBusEntity {
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
@ApiModelProperty(value = "床位Id") @ApiModelProperty(value = "床位Id")
private String bedId; private String bedId;
@TableField(exist = false)
private String path;
} }
...@@ -2,6 +2,7 @@ package com.makeit.mapper.platform.device; ...@@ -2,6 +2,7 @@ package com.makeit.mapper.platform.device;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.vo.platform.device.PlatDeviceListVO; import com.makeit.vo.platform.device.PlatDeviceListVO;
...@@ -20,4 +21,5 @@ public interface PlatDeviceMapper extends BaseMapper<PlatDevice> { ...@@ -20,4 +21,5 @@ public interface PlatDeviceMapper extends BaseMapper<PlatDevice> {
Page<PlatDeviceListVO> getDeviceIdsBySpaceId(@Param("param")PlatDeviceQueryDTO param, Page page); Page<PlatDeviceListVO> getDeviceIdsBySpaceId(@Param("param")PlatDeviceQueryDTO param, Page page);
Page<PlatDeviceListVO> getDevices(@Param("param")PlatDataScreenQueryDTO param, Page<PlatDevice> page);
} }
...@@ -15,6 +15,7 @@ import com.makeit.entity.platform.device.PlatDevice; ...@@ -15,6 +15,7 @@ import com.makeit.entity.platform.device.PlatDevice;
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;
import com.makeit.entity.platform.space.PlatRoomBedDevice;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum; import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
...@@ -29,6 +30,7 @@ import com.makeit.service.platform.dataScreen.DataScreenService; ...@@ -29,6 +30,7 @@ import com.makeit.service.platform.dataScreen.DataScreenService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderService; 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.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.area.AreaUtil; import com.makeit.utils.area.AreaUtil;
import com.makeit.utils.area.ChinaAreaVO; import com.makeit.utils.area.ChinaAreaVO;
...@@ -41,6 +43,7 @@ import com.makeit.vo.platform.dataScreen.*; ...@@ -41,6 +43,7 @@ import com.makeit.vo.platform.dataScreen.*;
import com.makeit.vo.platform.device.PlatDeviceListVO; import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.elder.PlatElderListVO; import com.makeit.vo.platform.elder.PlatElderListVO;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -53,6 +56,7 @@ import java.time.format.DateTimeFormatter; ...@@ -53,6 +56,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* Controller * Controller
...@@ -76,6 +80,8 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -76,6 +80,8 @@ public class DataScreenServiceImpl implements DataScreenService {
private PlatSpaceService platSpaceService; private PlatSpaceService platSpaceService;
@Autowired @Autowired
private PlatOrgService platOrgService; private PlatOrgService platOrgService;
@Autowired
private PlatRoomBedDeviceService platRoomBedDeviceService;
@Override @Override
public PlatAgeStatisticsVO ageStatistics(PlatDataScreenQueryDTO dto) { public PlatAgeStatisticsVO ageStatistics(PlatDataScreenQueryDTO dto) {
...@@ -508,14 +514,42 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -508,14 +514,42 @@ public class DataScreenServiceImpl implements DataScreenService {
} }
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO); Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<PlatDevice>() // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<PlatDevice>()
.eq(StringUtils.isNotBlank(dto.getDeviceStatus()), PlatDevice::getStatus, dto.getDeviceStatus()) // .eq(StringUtils.isNotBlank(dto.getDeviceStatus()), PlatDevice::getStatus, dto.getDeviceStatus())
.in(PlatDevice::getOrgId, dto.getOrgIds()) // .in(PlatDevice::getOrgId, dto.getOrgIds())
.orderByDesc(BaseEntity::getUpdateDate); // .orderByDesc(BaseEntity::getUpdateDate);
//
// Page<PlatDevice> page = platDeviceService.page(p, queryWrapper);
Page<PlatDeviceListVO> page = platDeviceService.getDevices(dto, p);
List<PlatDeviceListVO> voList = page.getRecords();
if(CollectionUtils.isEmpty(voList)){
return new PageVO<>();
}
List<String> spaceIdList = voList.stream().flatMap(vo -> {
String spaceParentPath = vo.getSpaceParentPath();
String spp = Optional.ofNullable(spaceParentPath).orElse("");
return Stream.of(spp.split(","));
}).collect(Collectors.toList());
spaceIdList.add("-1");
Page<PlatDevice> page = platDeviceService.page(p, queryWrapper); List<PlatSpace> platSpaces = platSpaceService.listByIds(spaceIdList);
List<PlatDeviceListVO> voList = BeanDtoVoUtils.listVo(page.getRecords(), PlatDeviceListVO.class); Map<String, String> spaceIdNameMap = platSpaces.stream().collect(Collectors.toMap(BaseEntity::getId, vo -> vo.getName(), (v1, v2) -> v1));
for (PlatDeviceListVO record : voList) {
String spaceParentPath = record.getSpaceParentPath();
if(StringUtils.isNotBlank(spaceParentPath)){
String spaceNameJoin = Stream.of(spaceParentPath.split(",")).map(vo -> spaceIdNameMap.get(vo)).collect(Collectors.joining("-"));
String spaceName = spaceNameJoin + "-" + record.getSpaceName() + "-" + record.getRoomName();
if(StringUtils.isNotBlank(record.getBedName())){
spaceName = spaceName +"-"+record.getBedName();
}
record.setSpaceName(spaceName);
}
}
JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> { JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName()); d.setOrgName(o.getName());
......
package com.makeit.service.platform.device; package com.makeit.service.platform.device;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
...@@ -62,4 +64,6 @@ public interface PlatDeviceService extends IService<PlatDevice> { ...@@ -62,4 +64,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
List<DeviceProperties> readDeviceProperties(PlatDeviceAttrWechatDTO dto); List<DeviceProperties> readDeviceProperties(PlatDeviceAttrWechatDTO dto);
List<PlatDevice> productList(PlatDeviceQueryDTO dto); List<PlatDevice> productList(PlatDeviceQueryDTO dto);
Page<PlatDeviceListVO> getDevices(PlatDataScreenQueryDTO dto, Page<PlatDevice> p);
} }
...@@ -11,6 +11,7 @@ import com.makeit.common.entity.BaseBusEntity; ...@@ -11,6 +11,7 @@ import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity; import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
...@@ -369,4 +370,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -369,4 +370,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
.groupBy(PlatDevice::getProductId)); .groupBy(PlatDevice::getProductId));
return platDevices; return platDevices;
} }
@Override
public Page<PlatDeviceListVO> getDevices(PlatDataScreenQueryDTO dto, Page<PlatDevice> page) {
return baseMapper.getDevices(dto,page);
}
} }
...@@ -43,4 +43,33 @@ ...@@ -43,4 +43,33 @@
</where> </where>
order by pd.update_date desc,prbd.update_date desc order by pd.update_date desc,prbd.update_date desc
</select> </select>
<select id="getDevices" resultType="com.makeit.vo.platform.device.PlatDeviceListVO">
select
distinct
pd.*,
ps.parent_path as spaceParentPath,
ps.name as spaceName,
pr.name as roomName,
pb.name as bedName
from plat_device pd
left join plat_room_bed_device prbd on (pd.id = prbd.device_id and prbd.del_flag = 0)
left join plat_room pr on (pr.id = prbd.room_id and pr.del_flag = 0 )
left join plat_bed pb on ( pb.id = prbd.bed_id and pb.del_flag = 0)
left join plat_space ps on (ps.id = pr.space_id and ps.del_flag = 0)
<where>
pd.del_flag = 0
<if test="param.deviceStatus != null and param.deviceStatus != '' ">
and pd.status = #{param.deviceStatus}
</if>
<if test="param.orgIds != null and param.orgIds.size() > 0 ">
AND ps.org_id in
<foreach collection="param.orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
order by pd.update_date desc,prbd.update_date desc
</select>
</mapper> </mapper>
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