Commit e47ae6b4 by 杨伟程
parents f3a70dcc 373f9c78
......@@ -111,6 +111,7 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_BAD_NAME_EXIT(500, "PLATFORM.ERROR.BAD.NAME.EXIT"),
PLATFORM_ERROR_BAD_NOT_DEL(500, "PLATFORM.ERROR.BAD.NOT.DEL"),
PLATFORM_ERROR_ROOM_OTHER_USED_NOT_DEL(500, "PLATFORM.ERROR.ROOM.OTHER.USED.NOT.DEL"),
PLATFORM_ERROR_BED_BIND_DEVICE_NOT_AUTH(500, "PLATFORM.ERROR.BED.BIND_DEVICE_NOT_AUTH"),
SYSTEM_ERROR_CANT_CHANGE_TENANT_STATUS(500, "SYSTEM.ERROR.CANT.CHANGE.TENANT.STATUS"),
SYSTEM_ERROR_CANT_REMOVE_TENANT_USER_LINK(500, "SYSTEM.ERROR.CANT.REMOVE.TENANT.USER.LINK"),
......
......@@ -106,6 +106,7 @@ PLATFORM.ERROR.BAD.NAME.EXIT=床位名称已存在
PLATFORM.ERROR.BAD.NOT.DEL=床位已绑定长者或设备,不可删除
PLATFORM.ERROR.ROOM.OTHER.USED.NOT.DEL=该房间下有床位有其他长者入住
PLATFORM.ERROR.BED.BIND_DEVICE_NOT_AUTH=该床位已绑定设备,请重新选择床位
SYSTEM.ERROR.ROLE.ADMIN.CANT.ADD=不能在该节点下新增非管理员角色
......
......@@ -8,26 +8,22 @@ import lombok.Data;
public class PlatUserImportDTO {
private static final String headDesc = "导入说明:\n" +
"\n" +
"1.带*号为必填项\n" +
"\n" +
"2.手机号和邮箱不可重复\n" +
"\n" +
"3.角色必须为【角色管理】处维护的角色名称\n" +
"\n" +
"4.导入人员默认登录密码为:888888";
"4.导入人员默认登录密码为:abc888888";
@ExcelProperty(value = "姓名*")
@ExcelProperty(value = {headDesc,"姓名*"})
private String username;
@ExcelProperty(value = "手机号*")
@ExcelProperty(value = {headDesc,"手机号*"})
private String mobile;
@ExcelProperty(value = "邮箱")
@ExcelProperty(value = {headDesc,"邮箱"})
private String email;
@ExcelProperty(value = "*所属组织")
@ExcelProperty(value = {headDesc,"*所属组织"})
private String orgName;
@ExcelProperty(value = "*角色")
@ExcelProperty(value = {headDesc,"*角色"})
private String roleName;
@ExcelProperty(value = "备注")
@ExcelProperty(value = {headDesc,"备注"})
private String remark;
......
......@@ -210,9 +210,10 @@ public class PlatAlarmConfigServiceImpl extends ServiceImpl<PlatAlarmConfigMappe
});
saveBatch(configList);
alarmConfigUtil.putAll(configList);
});
alarmConfigUtil.putAll(configList);
}
@Override
......
......@@ -652,6 +652,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder db = getById(dto.getId());
String oldBedId = db.getBedId();
PlatElder platElder = BeanDtoVoUtils.convert(dto, PlatElder.class);
fillSpace(platElder);
......@@ -660,9 +662,14 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
addOrEditExt(dto);
if (StringUtils.isNotBlank(dto.getBedId()) && StringUtils.isBlank(db.getBedId())) {
if (StringUtils.isNotBlank(dto.getBedId())) {
checkInInternal(dto.getBedId());
}
if (StringUtils.isNotBlank(oldBedId) && !oldBedId.equals(dto.getBedId())) {
checkOutInternal(oldBedId);
}
}
......@@ -744,6 +751,14 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
platBedService.changeStatus(statusDTO);
}
private void checkOutInternal(String bedId) {
StatusDTO statusDTO = new StatusDTO();
statusDTO.setId(bedId);
statusDTO.setStatus(CommonEnum.YES.getValue());
platBedService.changeStatus(statusDTO);
}
//TODO ywc 可能要改床位表状态
@Transactional
......
......@@ -16,8 +16,10 @@ import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.entity.platform.space.PlatRoomBedDevice;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.device.PlatDeviceEnum;
import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.space.PlatRoomBedDeviceMapper;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.space.*;
......@@ -63,6 +65,16 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
List<String> listEquipmentIds = dto.getListDeviceId();
List<PlatRoomBedDevice> list = new ArrayList<>();
if(dto.getBedId() != null){
LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatRoomBedDevice::getRoomId,dto.getRoomId());
queryWrapper.eq(PlatRoomBedDevice::getBedId,dto.getBedId());
queryWrapper.isNotNull(PlatRoomBedDevice::getDeviceId);
if(count(queryWrapper) > 0){
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_BED_BIND_DEVICE_NOT_AUTH);
}
}
listEquipmentIds.forEach(item -> {
PlatRoomBedDevice data = new PlatRoomBedDevice();
......
......@@ -117,6 +117,10 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_ROOM_EXIT_BAD);
}
removeByIds(ids);
//删除床位
platBedService.remove(new QueryWrapper<PlatBed>().lambda()
.in(PlatBed::getRoomId, ids));
}
@Transactional(rollbackFor = Exception.class)
......
......@@ -3,6 +3,7 @@ package com.makeit.service.platform.space.impl;
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.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.vo.ExcelErrorVo;
import com.makeit.common.vo.ExcelImportVo;
......@@ -107,7 +108,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
space.setLatitude(dto.getLatitude());
space.setLongitude(dto.getLongitude());
space.setParentId(dto.getParentId());
space.setParentPath(dto.getParentPath());
if(StringUtil.isEmpty(dto.getParentPath())){
space.setParentPath(null);
}else {
space.setParentPath(dto.getParentPath());
}
//上级空间
PlatSpace parentSpace = this.getById(dto.getParentId());
......@@ -150,11 +155,38 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
queryWrapper.in(PlatSpace::getOrgId, orgIds);
List<PlatSpace> list = this.list(queryWrapper);
List<PlatSpace> spaceList = new ArrayList<>();
Set<Long> parentIds = new HashSet<>();
if(StringUtil.isNotEmpty(dto.getName())){
List<PlatSpace> arrayList = new ArrayList<>();
for(PlatSpace space : list){
//非一级空间的获取上级空间
if (StringUtil.isNotEmpty(space.getParentId())) {
List<String> parentIdList = new ArrayList<>();
parentIdList.addAll(Arrays.asList(space.getParentPath().split(",")));
parentIdList.add(space.getId());
Set<Long> set = new HashSet(parentIdList);
parentIds.addAll(set);
} else {
arrayList.add(space);
}
}
parentIds.add(-1L);
arrayList = arrayList.stream().filter(e -> !parentIds.contains(Long.valueOf(e.getId()))).collect(Collectors.toList());
spaceList = list(new QueryWrapper<PlatSpace>().lambda()
.in(PlatSpace::getId, parentIds));
if (CollectionUtils.isNotEmpty(arrayList)) {
spaceList.addAll(arrayList);
}
}else {
spaceList = list;
}
//父级
List<PlatSpace> listParent = list.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
List<PlatSpace> listParent = spaceList.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集
List<PlatSpace> listChild = list.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
List<PlatSpace> listChild = spaceList.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
......
......@@ -175,7 +175,8 @@ public class WorkStationServiceImpl implements WorkStationService {
} else {
//获取父级的所有子级空间
spaces = platSpaceService.listChild(dto.getSpaceIds());
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
}
List<String> elderIdList = new ArrayList<>();
......@@ -218,8 +219,7 @@ public class WorkStationServiceImpl implements WorkStationService {
//查询睡眠质量分析模型
// SaasModelManage modelManage = saasModelManageService.getOne(new QueryWrapper<SaasModelManage>().lambda()
// .eq(SaasModelManage::getModelType, ModelManageTypeEnum.SLEEP.getCode())
// .last(" limit 1"));
// .eq(SaasModelManage::getModelType, ModelManageTypeEnum.SLEEP.getCode());
// Integer turnedComparison = 0;
// if(modelManage != null){
// SaasSleepAnalysisModel model = saasSleepAnalysisModelService.view(modelManage.getModelId());
......@@ -396,6 +396,8 @@ public class WorkStationServiceImpl implements WorkStationService {
} else {
//获取父级的所有子级空间
spaces = platSpaceService.listChild(dto.getSpaceIds());
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
}
List<String> elderIdList = new ArrayList<>();
......
......@@ -291,7 +291,7 @@ public class PlatTenantServiceImpl extends ServiceImpl<PlatTenantMapper, PlatTen
PlatTenant tntTenant = BeanDtoVoUtils.convert(dto, PlatTenant.class);
PlatTenant platTenant = getById(tntTenant.getId());
//更新同步到iot
iotOrgService.updateIotOrgInfo(tntTenant.getIotOrgId(), dto.getName());
iotOrgService.updateIotOrgInfo(platTenant.getIotOrgId(), dto.getName());
updateById(tntTenant);
......
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