Commit 68354596 by 朱淼

修改bug

parent 74831b4d
...@@ -83,8 +83,8 @@ CREATE TABLE `plat_bed` ...@@ -83,8 +83,8 @@ CREATE TABLE `plat_bed`
CREATE TABLE `plat_region_setting` CREATE TABLE `plat_region_setting`
( (
`id` varchar(64) NOT NULL COMMENT 'id', `id` varchar(64) NOT NULL COMMENT 'id',
`install_type` char(1) NOT NULL COMMENT '安装方式 0-顶装 1-侧装', `install_type` char(1) DEFAULT NULL COMMENT '安装方式 0-顶装 1-侧装',
`toward` char(1) NOT NULL COMMENT '设备朝向 0-上 1-下 2-左 3-右', `toward` char(1) DEFAULT NULL COMMENT '设备朝向 0-上 1-下 2-左 3-右',
`region_name` varchar(64) DEFAULT NULL COMMENT '区域名称', `region_name` varchar(64) DEFAULT NULL COMMENT '区域名称',
`region_range` varchar(128) DEFAULT NULL COMMENT '区域定位', `region_range` varchar(128) DEFAULT NULL COMMENT '区域定位',
`room_range` varchar(128) DEFAULT NULL COMMENT '房间门定位', `room_range` varchar(128) DEFAULT NULL COMMENT '房间门定位',
......
...@@ -397,15 +397,16 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -397,15 +397,16 @@ public class DataScreenServiceImpl implements DataScreenService {
private List<PlatAlarmRecordStatisticsVo> coverToVoList(List<PlatAlarmRecord> alarmRecords, Map<String,PlatElder> platElderMap) { private List<PlatAlarmRecordStatisticsVo> coverToVoList(List<PlatAlarmRecord> alarmRecords, Map<String,PlatElder> platElderMap) {
List<PlatAlarmRecordStatisticsVo> statisticsVos = new ArrayList<>(); List<PlatAlarmRecordStatisticsVo> statisticsVos = new ArrayList<>();
alarmRecords.forEach(record->{ alarmRecords.forEach(record->{
if(StringUtil.isNotEmpty(record.getElderIds())) {
List<String> elderIds = Arrays.asList(record.getElderIds().split(",")); List<String> elderIds = Arrays.asList(record.getElderIds().split(","));
if(StringUtil.isNotEmpty(record.getElderIds()) if (elderIds.size() > 0) {
&& elderIds.size()>0){ if (platElderMap.get(elderIds.get(0)) != null) {
if(platElderMap.get(elderIds.get(0))!=null){
PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class); PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class);
statisticsVo.setSpaceId(platElderMap.get(elderIds.get(0)).getSpaceId()); statisticsVo.setSpaceId(platElderMap.get(elderIds.get(0)).getSpaceId());
statisticsVos.add(statisticsVo); statisticsVos.add(statisticsVo);
} }
} }
}
}); });
return statisticsVos; return statisticsVos;
} }
......
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.space.PlatRegionSettingDTO; import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO; import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceOther;
import com.makeit.entity.platform.space.PlatRegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.enums.platform.device.PlatDeviceEnum; import com.makeit.enums.platform.device.PlatDeviceEnum;
import com.makeit.mapper.platform.space.PlatRegionSettingMapper; import com.makeit.mapper.platform.space.PlatRegionSettingMapper;
import com.makeit.service.platform.device.PlatDeviceOtherService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.space.PlatRegionSettingService; import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
...@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service; ...@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -30,6 +34,8 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM ...@@ -30,6 +34,8 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
@Autowired @Autowired
private PlatDeviceService platDeviceService; private PlatDeviceService platDeviceService;
@Autowired
private PlatDeviceOtherService platDeviceOtherService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -43,13 +49,23 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM ...@@ -43,13 +49,23 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
queryWrapper1.ne(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART); queryWrapper1.ne(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART);
List<PlatDevice> devices = platDeviceService.list(queryWrapper1); List<PlatDevice> devices = platDeviceService.list(queryWrapper1);
listDeviceId = devices.stream().map(item->item.getId()).collect(Collectors.toList()); listDeviceId = devices.stream().map(item->item.getId()).collect(Collectors.toList());
List<PlatDeviceOther> platDeviceOthers = new ArrayList<>();
if(!listDeviceId.isEmpty()){
//获取设备安装方式
platDeviceOthers = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
.in(PlatDeviceOther::getDeviceId,listDeviceId));
}
Map<String,String> map = platDeviceOthers.stream().collect(Collectors.toMap(PlatDeviceOther::getDeviceId,PlatDeviceOther::getInstallation));
List<PlatRegionSetting> list = new ArrayList<>(); List<PlatRegionSetting> list = new ArrayList<>();
listDeviceId.forEach(item->{ listDeviceId.forEach(item->{
PlatRegionSetting platRegionSetting = new PlatRegionSetting(); PlatRegionSetting platRegionSetting = new PlatRegionSetting();
platRegionSetting.setDeviceId(item); platRegionSetting.setDeviceId(item);
platRegionSetting.setRoomId(roomId); platRegionSetting.setRoomId(roomId);
if(map.get(item)!=null){
platRegionSetting.setInstallType(map.get(item));
}
list.add(platRegionSetting); list.add(platRegionSetting);
}); });
......
...@@ -69,12 +69,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -69,12 +69,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public void add(PlatSpaceAddDTO dto) { public void add(PlatSpaceAddDTO dto) {
check(dto); check(dto);
PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class); PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class);
if(StringUtil.isEmpty(dto.getParentId())){
PlatUserVO userVO = PlatUserUtil.getUserVO(); PlatUserVO userVO = PlatUserUtil.getUserVO();
space.setOrgId(userVO.getOrgId()); space.setOrgId(userVO.getOrgId());
PlatOrg org = platOrgService.getById(userVO.getOrgId()); PlatOrg org = platOrgService.getById(space.getOrgId());
if(org!=null){ if(org!=null){
space.setAttribute(org.getType()); space.setAttribute(org.getType());
} }
}else {
//上级空间
PlatSpace parentSpace = getById(dto.getParentId());
space.setOrgId(parentSpace.getOrgId());
space.setAttribute(parentSpace.getAttribute());
}
save(space); save(space);
} }
......
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