Commit d8cb04fe by huangjy

Merge remote-tracking branch 'origin/dev' into dev

parents 85f584d0 50f8f7de
Showing with 538 additions and 51 deletions
package com.makeit.controller.sys;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.module.system.dto.SysFileDTOVO;
import com.makeit.module.system.entity.SysFile;
import com.makeit.module.system.service.SysFileService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.storage.AccessoryRepository;
import com.makeit.utils.storage.DataWithMeta;
import com.makeit.utils.sys.FileUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
@Api(tags = "saas-文件")
@RestController
@RequestMapping("/saas/sys/file")
public class SaasFileController {
@Autowired
public AccessoryRepository accessoryRepository;
@Autowired
private SysFileService sysFileService;
@ApiOperation("获取文件临时路径路径")
@PostMapping("getFileTmp")
public ApiResponseEntity<SysFileDTOVO> getFileTmp(@RequestBody BaseIdDTO baseIdDTO) {
SysFileDTOVO sysFileDTOVO = BeanDtoVoUtils.convert(sysFileService.getById(baseIdDTO.getId()), SysFileDTOVO.class);
sysFileDTOVO.setFullUrl(accessoryRepository.getTmpURL(sysFileDTOVO.getUrl()));
return ApiResponseUtils.success(sysFileDTOVO);
}
@ApiOperation("获取文件路径")
@PostMapping("getFile")
public ApiResponseEntity<List<SysFileDTOVO>> getFile(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(FileUtil.convertMultiply(Arrays.asList(baseIdDTO.getId())).get(0));
}
@ApiOperation("获取文件路径集合")
@PostMapping("getFileList")
public ApiResponseEntity<List<List<SysFileDTOVO>>> getFile(@RequestBody List<String> list) {
return ApiResponseUtils.success(FileUtil.convertMultiply(list));
}
//这种方式可以 只是不能设置下载文件名
// @ApiOperation("下载文件")
// @PostMapping("downloadFile")
// public byte[] downloadFile(@RequestBody BaseIdDTO baseIdDTO) {
// return aliyunOSSRepository.getBytes(UriUtils.decode(StringUtils.substringAfter(sysFileService.getById(baseIdDTO.getId()).getUrl(), "oss/"), "UTF-8"));
// }
void downloadFile(HttpServletResponse response, String id) throws IOException {
SysFile sysFile = sysFileService.getById(id);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/octet-stream");
// 设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(sysFile.getFileName(), "UTF-8"));
OutputStream outputStream = response.getOutputStream();
outputStream.write(accessoryRepository.getBytes(UriUtils.decode(StringUtils.substringAfter(sysFile.getUrl(), "oss/"), "UTF-8")));
}
//这样是可以
// private void previewFile(HttpServletResponse response, String id) throws IOException {
//
// SysFile sysFile = sysFileService.getById(id);
//
// response.setCharacterEncoding("UTF-8");
// response.setContentType("application/octet-stream");
// // 设置文件头:最后一个参数是设置下载文件名
// response.setHeader("Content-disposition", "inline;filename=" + URLEncoder.encode(sysFile.getFileName(), "UTF-8"));
//
// String suffix = sysFile.getUrl().substring(sysFile.getUrl().lastIndexOf("."));
//
// Map<String, String> map = new HashMap<>(16);
// map.put(".pdf", "application/pdf");
// map.put(".png", "image/png");
// map.put(".jpg", "image/jpg");
// map.put(".jpeg", "image/jpeg");
//
// String contentType = map.get(suffix);
// if (StringUtils.isNotBlank(contentType)) {
// response.setContentType(contentType);
// }
//
// OutputStream outputStream = response.getOutputStream();
// outputStream.write(aliyunOSSRepository.getBytes(UriUtils.decode(StringUtils.substringAfter(sysFile.getUrl(), "oss/"), "UTF-8")));
// outputStream.close();
// }
private void previewFile(HttpServletResponse response, String id) throws IOException {
SysFile sysFile = sysFileService.getById(id);
response.setCharacterEncoding("UTF-8");
// 设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-disposition", "inline;filename=" + URLEncoder.encode(sysFile.getFileName(), "UTF-8"));
DataWithMeta dataWithMeta = accessoryRepository.getDataWithMeta(UriUtils.decode(StringUtils.substringAfter(sysFile.getUrl(), "oss/"), "UTF-8"));
response.setContentType(dataWithMeta.getContentType());
OutputStream outputStream = response.getOutputStream();
outputStream.write(dataWithMeta.getBytes());
outputStream.close();
}
@ApiOperation("下载文件(json id)")
@RequestMapping(value = "downloadFile", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadFile(HttpServletResponse response, @RequestBody BaseIdDTO baseIdDTO) throws IOException {
downloadFile(response, baseIdDTO.getId());
}
@ApiOperation("预览文件(json id)")
@RequestMapping(value = "previewFile", method = {RequestMethod.GET, RequestMethod.POST})
public void previewFile(HttpServletResponse response, @RequestBody BaseIdDTO baseIdDTO) throws IOException {
previewFile(response, baseIdDTO.getId());
}
@ApiOperation("下载文件")
@RequestMapping(value = "downloadFileParam", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadFileParam(HttpServletResponse response, String id) throws IOException {
downloadFile(response, id);
}
@ApiOperation("预览文件")
@RequestMapping(value = "previewFileParam", method = {RequestMethod.GET, RequestMethod.POST})
public void previewFileParam(HttpServletResponse response, String id) throws IOException {
previewFile(response, id);
}
@ApiOperation("批量保存")
@PostMapping("addList")
public ApiResponseEntity<?> addList(@RequestBody List<SysFileDTOVO> list) {
List<SysFile> fileList = BeanDtoVoUtils.listVo(list, SysFile.class);
sysFileService.saveBatch(fileList);
return ApiResponseUtils.success(StreamUtil.map(fileList, SysFile::getId));
}
}
package com.makeit.controller.sys;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.module.system.dto.SysFileDTOVO;
import com.makeit.module.system.dto.UploadKeyDTO;
import com.makeit.module.system.entity.SysFile;
import com.makeit.module.system.service.SysFileService;
import com.makeit.utils.contract.word.WordConverterUtil;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.storage.HwObsRepository;
import com.makeit.utils.storage.PostSignature;
import com.makeit.utils.sys.FileUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author liuhb
* @date 2021/12/14
*/
@Api(tags = "saas-文件")
@RestController
@RequestMapping("/saas/storage")
public class SaasUploadController extends BaseController {
@Autowired
private SysFileService sysFileService;
private static final Logger logger = LoggerFactory.getLogger(SaasUploadController.class);
// @ApiOperation(value = "获取key")
// @PostMapping("getKey")
// public String getKey(@ApiParam(value = "originalFilename") String originalFilename) {
// String fullPath = getFullPath(null, originalFilename);
// return getUri(accessoryRepository.getKey(fullPath));
// }
@ApiOperation(value = "获取key")
@PostMapping("getKey")
public SysFileDTOVO getKey(@RequestBody UploadKeyDTO dto) {
SysFileDTOVO sysFile = new SysFileDTOVO();
sysFile.setFileName(dto.getOriginalFilename());
String fullPath = getFullPath(null, dto.getOriginalFilename());
sysFile.setUrl(getUri(HwObsRepository.APIURI + accessoryRepository.getKey(fullPath)));
sysFile.setKey(accessoryRepository.getKey(fullPath));
return sysFile;
}
@ApiOperation(value = "获取签名")
@PostMapping("getSignature")
public PostSignature getPostSignature() {
return accessoryRepository.getPostSignature();
}
private String replaceSuffix(String name) {
int index = name.lastIndexOf(".");
return name.substring(0, index) + ".pdf";
}
private List<SysFile> uploadInternal(List<MultipartFile> files, String convertToPdf) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<SysFile> sysFileList = StreamUtil.map(files, e -> {
try {
SysFile sysFile = new SysFile();
sysFile.setFileName(e.getOriginalFilename());
String fullPath = getFullPath(null, e.getOriginalFilename());
sysFile.setUrl(getUri(storageRepository("1").save(e.getBytes(), fullPath)));
if ("1".equals(convertToPdf)) {
fullPath = getFullPath(null, replaceSuffix(e.getOriginalFilename()));
sysFile.setPdfUrl(getUri(storageRepository("1").save(WordConverterUtil.convert(e.getInputStream()), fullPath)));
}
sysFile.setMime(e.getContentType());
return sysFile;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
});
sysFileService.saveBatch(sysFileList);
stopWatch.stop();
logger.info("文件上传耗时:{} ms", stopWatch.getLastTaskTimeMillis());
return sysFileList;
}
private List<SysFile> convertAndUploadInternal(List<MultipartFile> files) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<SysFile> sysFileList = StreamUtil.map(files, e -> {
try {
SysFile sysFile = new SysFile();
sysFile.setFileName(replaceSuffix(e.getOriginalFilename()));
String fullPath = getFullPath(null, replaceSuffix(e.getOriginalFilename()));
sysFile.setUrl(getUri(storageRepository("1").save(WordConverterUtil.convert(e.getInputStream()), fullPath)));
sysFile.setMime(e.getContentType());
return sysFile;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
});
sysFileService.saveBatch(sysFileList);
stopWatch.stop();
logger.info("文件上传耗时:{} ms", stopWatch.getLastTaskTimeMillis());
return sysFileList;
}
@ApiOperation(value = "统一文件上传")
@PostMapping("uploadFile")
public ApiResponseEntity<List<String>> uploadFile(
@ApiParam(value = "convertToPdf") @RequestParam(defaultValue = "0") String convertToPdf,
@ApiParam(value = "files") List<MultipartFile> files) {
List<SysFile> sysFileList = uploadInternal(files, convertToPdf);
return ApiResponseUtils.success(StreamUtil.map(sysFileList, SysFile::getId));
}
@ApiOperation(value = "统一文件上传返回路径")
@PostMapping("uploadFileUrl")
public ApiResponseEntity<List<SysFileDTOVO>> uploadFileUrl(
@ApiParam(value = "convertToPdf") @RequestParam(defaultValue = "0") String convertToPdf,
@ApiParam(value = "files") List<MultipartFile> files) {
List<SysFile> sysFileList = uploadInternal(files, convertToPdf);
List<SysFileDTOVO> voList = BeanDtoVoUtils.listVo(sysFileList, SysFileDTOVO.class);
FileUtil.fillFullUrl(voList);
FileUtil.fillPdfFullUrl(voList);
return ApiResponseUtils.success(voList);
}
@ApiOperation(value = "统一转换为pdf后上传")
@PostMapping("convertAndUploadFile")
public ApiResponseEntity<List<String>> convertAndUploadFile(
@ApiParam(value = "files") List<MultipartFile> files) {
List<SysFile> sysFileList = convertAndUploadInternal(files);
return ApiResponseUtils.success(StreamUtil.map(sysFileList, SysFile::getId));
}
@ApiOperation(value = "统一转换为pdf后上传返回路径")
@PostMapping("convertAndUploadFileUrl")
public ApiResponseEntity<List<SysFileDTOVO>> convertAndUploadFileUrl(
@ApiParam(value = "files") List<MultipartFile> files) {
List<SysFile> sysFileList = convertAndUploadInternal(files);
List<SysFileDTOVO> voList = BeanDtoVoUtils.listVo(sysFileList, SysFileDTOVO.class);
FileUtil.fillFullUrl(voList);
//FileUtil.fillPdfFullUrl(voList);
return ApiResponseUtils.success(voList);
}
//下面两个的作用
//返回给前端的路径 要基于下面两个转发
@ApiOperation("获取oss文件")
@RequestMapping(value = "oss/**", method = RequestMethod.GET)
public void getOssFile(HttpServletRequest req, HttpServletResponse resp) throws Exception {
// String filepath = req.getRequestURI();
// filepath = UriUtils.decode(StringUtils.substringAfter(filepath, "oss"), "UTF-8");
// //.toString().split("\\?")[0];
// resp.sendRedirect(accessoryRepository.getPermanentURL(filepath));
resp.sendRedirect(accessoryRepository.getPermanentURL(req.getRequestURI()));
}
@ApiOperation("获取oss文件(临时路径)")
@RequestMapping(value = "tmp/oss/**", method = RequestMethod.GET)
public void getOssFileTmpPath(HttpServletRequest req, HttpServletResponse resp) throws Exception {
// String filepath = req.getRequestURI();
// filepath = UriUtils.decode(StringUtils.substringAfter(filepath, "tmp/oss"), "UTF-8");
// //.toString().split("\\?")[0];
// resp.sendRedirect(accessoryRepository.getTmpURL(filepath));
resp.sendRedirect(accessoryRepository.getTmpURL(req.getRequestURI()));
}
//private String name;
// private String nameOrigin;
// private String extName;
// private Long fileSize;
// private String storeType;//video audio img pdf等
// private String relativePath;
}
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" /> <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" />
<orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.5" level="project" /> <orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
......
...@@ -115,6 +115,8 @@ public enum CodeMessageEnum { ...@@ -115,6 +115,8 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_ROOM_OTHER_USED_NOT_DEL(500, "PLATFORM.ERROR.ROOM.OTHER.USED.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"), PLATFORM_ERROR_BED_BIND_DEVICE_NOT_AUTH(500, "PLATFORM.ERROR.BED.BIND_DEVICE_NOT_AUTH"),
PLATFORM_ERROR_ELDER_BED_CANT_DEL(500, "PLATFORM.ERROR.ELDER.BED.CANT.DEL"),
SYSTEM_ERROR_CANT_CHANGE_TENANT_STATUS(500, "SYSTEM.ERROR.CANT.CHANGE.TENANT.STATUS"), 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"), SYSTEM_ERROR_CANT_REMOVE_TENANT_USER_LINK(500, "SYSTEM.ERROR.CANT.REMOVE.TENANT.USER.LINK"),
SYSTEM_ERROR_TENANT_ID_NOT_BLANK(510, "SYSTEM.ERROR.TENANT.ID.NOT.BLANK"), SYSTEM_ERROR_TENANT_ID_NOT_BLANK(510, "SYSTEM.ERROR.TENANT.ID.NOT.BLANK"),
......
...@@ -28,6 +28,8 @@ public class PlatRoleDTOVO extends BaseOrgDTO implements Serializable { ...@@ -28,6 +28,8 @@ public class PlatRoleDTOVO extends BaseOrgDTO implements Serializable {
@ApiModelProperty(value = "部门名称") @ApiModelProperty(value = "部门名称")
private String deptName; private String deptName;
private String orgPath;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "角色名称集合") @ApiModelProperty(value = "角色名称集合")
private List<String> nameList; private List<String> nameList;
......
...@@ -109,6 +109,8 @@ PLATFORM.ERROR.BAD.NOT.DEL=床位已绑定长者或设备,不可删除 ...@@ -109,6 +109,8 @@ PLATFORM.ERROR.BAD.NOT.DEL=床位已绑定长者或设备,不可删除
PLATFORM.ERROR.ROOM.OTHER.USED.NOT.DEL=该房间下有床位有其他长者入住 PLATFORM.ERROR.ROOM.OTHER.USED.NOT.DEL=该房间下有床位有其他长者入住
PLATFORM.ERROR.BED.BIND_DEVICE_NOT_AUTH=该床位已绑定设备,请重新选择床位 PLATFORM.ERROR.BED.BIND_DEVICE_NOT_AUTH=该床位已绑定设备,请重新选择床位
PLATFORM.ERROR.ELDER.BED.CANT.DEL=含入住床位的老人,不可删除
SYSTEM.ERROR.ROLE.ADMIN.CANT.ADD=不能在该节点下新增非管理员角色 SYSTEM.ERROR.ROLE.ADMIN.CANT.ADD=不能在该节点下新增非管理员角色
SYSTEM.ERROR.ROLE.ADMIN.CANT.EDIT=管理员角色不能修改 SYSTEM.ERROR.ROLE.ADMIN.CANT.EDIT=管理员角色不能修改
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" /> <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" />
<orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.5" level="project" /> <orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
......
...@@ -58,6 +58,11 @@ public class PlatAlarmRecordQueryDTO extends BaseTenantDTO { ...@@ -58,6 +58,11 @@ public class PlatAlarmRecordQueryDTO extends BaseTenantDTO {
//子女关联的老人id //子女关联的老人id
private List<String> elderIdList; private List<String> elderIdList;
/**
* 通知家属状态 0 未通知 1 已通知
*/
private String noticeStatus;
} }
...@@ -6,10 +6,12 @@ import lombok.Data; ...@@ -6,10 +6,12 @@ import lombok.Data;
/** /**
* 租户端角色部门关联表 * 租户端角色部门关联表
* 角色和所属部门 一对一
* @TableName plat_role_org * @TableName plat_role_org
*/ */
@TableName(value ="plat_role_org") @TableName(value ="plat_role_org")
@Data @Data
@Deprecated
public class PlatRoleOrg extends BaseBusEntity { public class PlatRoleOrg extends BaseBusEntity {
/** /**
......
...@@ -161,6 +161,9 @@ public class BehaviorAlarm implements IAlarm { ...@@ -161,6 +161,9 @@ public class BehaviorAlarm implements IAlarm {
platElderList = platAlarmCheckDTO.getPlatElderList(); platElderList = platAlarmCheckDTO.getPlatElderList();
} }
for (PlatElder platElder : platElderList) { for (PlatElder platElder : platElderList) {
if(StringUtils.isBlank(platElder.getRegionName())){
continue;
}
PlatDayDurationRecord durationRecord = new PlatDayDurationRecord(); PlatDayDurationRecord durationRecord = new PlatDayDurationRecord();
durationRecord.setElderIds(platElder.getId()); durationRecord.setElderIds(platElder.getId());
durationRecord.setRegionName(platElder.getRegionName()); durationRecord.setRegionName(platElder.getRegionName());
......
...@@ -120,6 +120,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -120,6 +120,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
String[] split = elderId.split(","); String[] split = elderId.split(",");
PlatAlarmRecordQueryDTO data = dto.getData(); PlatAlarmRecordQueryDTO data = dto.getData();
data.setElderIdList(Arrays.asList(split)); data.setElderIdList(Arrays.asList(split));
data.setNoticeStatus(CommonEnum.YES.getValue());
return page(dto); return page(dto);
} }
...@@ -139,6 +140,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -139,6 +140,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
qw.or().apply("find_in_set('" + elderId + "',elder_ids)"); qw.or().apply("find_in_set('" + elderId + "',elder_ids)");
} }
}) })
.eq(StringUtils.isNotBlank(param.getNoticeStatus()),PlatAlarmRecord::getNoticeStatus,param.getNoticeStatus())
.orderByDesc(BaseEntity::getCreateDate) .orderByDesc(BaseEntity::getCreateDate)
; ;
} }
...@@ -304,6 +306,9 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -304,6 +306,9 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
*/ */
private void noticeByChannel(PlatAlarmConfig alarmConfig, PlatAlarmRecord alarmRecord, Set<String> phoneSet,Set<String> emailSet, List<SendTypeEnum> notifyChannelList) { private void noticeByChannel(PlatAlarmConfig alarmConfig, PlatAlarmRecord alarmRecord, Set<String> phoneSet,Set<String> emailSet, List<SendTypeEnum> notifyChannelList) {
String notifyChannel = alarmConfig.getNotifyChannel(); String notifyChannel = alarmConfig.getNotifyChannel();
if(StringUtils.isEmpty(notifyChannel)){
return;
}
String[] split = notifyChannel.split(","); String[] split = notifyChannel.split(",");
for (String sendType : split) { for (String sendType : split) {
SendTypeEnum sendTypeEnum = SendTypeEnum.getByValue(sendType); SendTypeEnum sendTypeEnum = SendTypeEnum.getByValue(sendType);
......
...@@ -186,7 +186,10 @@ implements PlatRoleService { ...@@ -186,7 +186,10 @@ implements PlatRoleService {
PlatRoleDTOVO vo = BeanDtoVoUtils.convert(getById(id), PlatRoleDTOVO.class); PlatRoleDTOVO vo = BeanDtoVoUtils.convert(getById(id), PlatRoleDTOVO.class);
JoinUtil.join(Arrays.asList(vo), platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> r.setDeptName(e.getName())); JoinUtil.join(Arrays.asList(vo), platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) ->{
r.setDeptName(e.getName());
r.setOrgPath(e.getPath()+","+e.getId());
} );
List<PlatMenuDTOVO> assignMenuDTO = getAssignMenuDTO(id); List<PlatMenuDTOVO> assignMenuDTO = getAssignMenuDTO(id);
List<PlatMenuDTOVO> tree = tree(assignMenuDTO); List<PlatMenuDTOVO> tree = tree(assignMenuDTO);
......
...@@ -20,6 +20,7 @@ import com.makeit.service.platform.elder.*; ...@@ -20,6 +20,7 @@ import com.makeit.service.platform.elder.*;
import com.makeit.utils.LongTimestampUtil; import com.makeit.utils.LongTimestampUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.validate.CollectionUtils; import com.makeit.utils.data.validate.CollectionUtils;
import com.makeit.utils.old.StringUtils;
import com.makeit.utils.time.LocalDateTimeUtils; import com.makeit.utils.time.LocalDateTimeUtils;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO; import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO; import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO;
...@@ -100,6 +101,9 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe ...@@ -100,6 +101,9 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
platElderSleepEvaluationVO.setSleepDuration(Integer.valueOf(platElderSleepAnalysis.getSleepTime() + "")); platElderSleepEvaluationVO.setSleepDuration(Integer.valueOf(platElderSleepAnalysis.getSleepTime() + ""));
platElderSleepEvaluationVO.setRestDuration(Integer.valueOf(platElderSleepAnalysis.getRestTime() + "")); platElderSleepEvaluationVO.setRestDuration(Integer.valueOf(platElderSleepAnalysis.getRestTime() + ""));
platElderSleepEvaluationVO.setSleepDurationHour(new BigDecimal(platElderSleepEvaluationVO.getSleepDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
platElderSleepEvaluationVO.setRestDurationHour(new BigDecimal(platElderSleepEvaluationVO.getRestDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
return platElderSleepEvaluationVO; return platElderSleepEvaluationVO;
} }
...@@ -425,6 +429,11 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe ...@@ -425,6 +429,11 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
}); });
voList.forEach(e -> {
if (StringUtils.isBlank(e.getAreaName())) {
e.setAreaName("");
}
});
Map<String, List<PlatElderBehaviorDistributionVO>> map = StreamUtil.groupBy(voList, PlatElderBehaviorDistributionVO::getAreaName); Map<String, List<PlatElderBehaviorDistributionVO>> map = StreamUtil.groupBy(voList, PlatElderBehaviorDistributionVO::getAreaName);
List<PlatElderBehaviorDistributionVO> newVoList = new ArrayList<>(10); List<PlatElderBehaviorDistributionVO> newVoList = new ArrayList<>(10);
......
...@@ -29,6 +29,7 @@ import com.makeit.vo.platform.elder.report.week.PlatElderSleepDiagramWeekVO; ...@@ -29,6 +29,7 @@ import com.makeit.vo.platform.elder.report.week.PlatElderSleepDiagramWeekVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.DayOfWeek; import java.time.DayOfWeek;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -262,20 +263,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -262,20 +263,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
List<PlatSleepRangeVO> sleepRecord = list.stream().flatMap(i -> i.getSleepRecord().stream()).collect(Collectors.toList()); List<PlatSleepRangeVO> sleepRecord = list.stream().flatMap(i -> i.getSleepRecord().stream()).collect(Collectors.toList());
vo.setSleepDeepDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_DEEP.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue()); return getPlatElderSleepDiagramWeekContentVO(dateTimeFormatter, sleepAnalysisMap, timeFormatter, e, vo, sleepRecord);
vo.setSleepModerateDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_MODERATE.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepLightnessDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_LIGHTNESS.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSoberDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SOBER.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
PlatElderSleepAnalysis platElderSleepAnalysis = sleepAnalysisMap.get(dateTimeFormatter.format(e));
if (platElderSleepAnalysis != null) {
vo.setTurnedCount(platElderSleepAnalysis.getTurnedCount());
vo.setBodyMoveCount(platElderSleepAnalysis.getActionCount());
vo.setScore(Integer.valueOf(platElderSleepAnalysis.getSleepScore() + ""));
}
return vo;
}); });
...@@ -287,11 +275,28 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -287,11 +275,28 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
List<PlatSleepRangeVO> sleepRecord = list.stream().flatMap(i -> Optional.ofNullable(i.getSleepRecord()).orElse(new ArrayList<>(10)).stream()).collect(Collectors.toList()); List<PlatSleepRangeVO> sleepRecord = list.stream().flatMap(i -> Optional.ofNullable(i.getSleepRecord()).orElse(new ArrayList<>(10)).stream()).collect(Collectors.toList());
return getPlatElderSleepDiagramWeekContentVO(dateTimeFormatter, sleepAnalysisMap, timeFormatter, e, vo, sleepRecord);
});
PlatElderSleepDiagramWeekVO vo = new PlatElderSleepDiagramWeekVO();
vo.setSleep(sleep);
vo.setRest(rest);
return vo;
}
private PlatElderSleepDiagramWeekContentVO getPlatElderSleepDiagramWeekContentVO(DateTimeFormatter dateTimeFormatter, Map<String, PlatElderSleepAnalysis> sleepAnalysisMap, DateTimeFormatter timeFormatter, LocalDate e, PlatElderSleepDiagramWeekContentVO vo, List<PlatSleepRangeVO> sleepRecord) {
vo.setSleepDeepDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_DEEP.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue()); vo.setSleepDeepDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_DEEP.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepModerateDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_MODERATE.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue()); vo.setSleepModerateDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_MODERATE.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepLightnessDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_LIGHTNESS.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue()); vo.setSleepLightnessDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_LIGHTNESS.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSoberDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SOBER.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue()); vo.setSoberDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SOBER.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepDeepDurationHour(new BigDecimal(vo.getSleepDeepDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
vo.setSleepModerateDurationHour(new BigDecimal(vo.getSleepModerateDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
vo.setSleepLightnessDurationHour(new BigDecimal(vo.getSleepLightnessDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
vo.setSoberDurationHour(new BigDecimal(vo.getSoberDuration()).divide(new BigDecimal(60), 2, BigDecimal.ROUND_HALF_UP));
PlatElderSleepAnalysis platElderSleepAnalysis = sleepAnalysisMap.get(dateTimeFormatter.format(e)); PlatElderSleepAnalysis platElderSleepAnalysis = sleepAnalysisMap.get(dateTimeFormatter.format(e));
if (platElderSleepAnalysis != null) { if (platElderSleepAnalysis != null) {
...@@ -301,14 +306,6 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek ...@@ -301,14 +306,6 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
} }
return vo; return vo;
});
PlatElderSleepDiagramWeekVO vo = new PlatElderSleepDiagramWeekVO();
vo.setSleep(sleep);
vo.setRest(rest);
return vo;
} }
@Override @Override
......
...@@ -829,7 +829,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -829,7 +829,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder db = getById(id); PlatElder db = getById(id);
if (StringUtils.isNotBlank(db.getBedId())) { if (StringUtils.isNotBlank(db.getBedId())) {
throw new RuntimeException(); throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_ELDER_BED_CANT_DEL);
} }
removeById(id); removeById(id);
...@@ -842,7 +842,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -842,7 +842,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
dbList.forEach(e -> { dbList.forEach(e -> {
if (StringUtils.isNotBlank(e.getBedId())) { if (StringUtils.isNotBlank(e.getBedId())) {
throw new RuntimeException();//TODO ywc 报错具体换 throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_ELDER_BED_CANT_DEL);//TODO ywc 报错具体换
} }
}); });
......
...@@ -97,12 +97,21 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -97,12 +97,21 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
PlatSpaceDeviceQueryDTO dto = pageReqDTO.getData(); PlatSpaceDeviceQueryDTO dto = pageReqDTO.getData();
LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.select(PlatRoomBedDevice::getDeviceId); // queryWrapper1.select(PlatRoomBedDevice::getDeviceId);
List<PlatRoomBedDevice> list = list(queryWrapper1);
List<PlatRoomBedDevice> list1 = new ArrayList<>();
if (CommonEnum.NO.getValue().equals(dto.getIsRoom())) { if (CommonEnum.NO.getValue().equals(dto.getIsRoom())) {
queryWrapper1.isNotNull(PlatRoomBedDevice::getBedId);
queryWrapper1.eq(PlatRoomBedDevice::getRoomId, dto.getRoomId()); list.forEach(item->{
if(!item.getRoomId().equals(dto.getRoomId())
|| (item.getRoomId().equals(dto.getRoomId()) && StringUtil.isEmpty(item.getBedId()))){
list1.add(item);
} }
List<PlatRoomBedDevice> list = list(queryWrapper1); });
}
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList()); List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList());
String orgId = ""; String orgId = "";
......
...@@ -107,12 +107,16 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -107,12 +107,16 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
space.setAddress(dto.getAddress()); space.setAddress(dto.getAddress());
space.setLatitude(dto.getLatitude()); space.setLatitude(dto.getLatitude());
space.setLongitude(dto.getLongitude()); space.setLongitude(dto.getLongitude());
space.setParentId(dto.getParentId());
if(StringUtil.isEmpty(dto.getParentPath())){ if(StringUtil.isEmpty(dto.getParentPath())){
space.setParentPath(null); space.setParentPath(null);
}else { }else {
space.setParentPath(dto.getParentPath()); space.setParentPath(dto.getParentPath());
} }
if(StringUtil.isEmpty(dto.getParentId())){
space.setParentId(null);
}else {
space.setParentId(dto.getParentId());
}
//上级空间 //上级空间
PlatSpace parentSpace = this.getById(dto.getParentId()); PlatSpace parentSpace = this.getById(dto.getParentId());
...@@ -177,6 +181,10 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -177,6 +181,10 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
.in(PlatSpace::getId, parentIds)); .in(PlatSpace::getId, parentIds));
if (CollectionUtils.isNotEmpty(arrayList)) { if (CollectionUtils.isNotEmpty(arrayList)) {
spaceList.addAll(arrayList); spaceList.addAll(arrayList);
spaceList = spaceList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(PlatSpace::getId))), ArrayList::new));
} }
}else { }else {
spaceList = list; spaceList = list;
...@@ -370,12 +378,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -370,12 +378,15 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
try { try {
List<PlatSpace> listPlatSpace = list(new LambdaQueryWrapper<>()); List<PlatSpace> listPlatSpace = list(new LambdaQueryWrapper<>());
List<PlatSpace> firstSpace = listPlatSpace.stream().filter(item -> item.getParentId() == null).collect(Collectors.toList()); List<PlatSpace> firstSpace = listPlatSpace.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
Map<String, String> firstSpaceNameMap = firstSpace.stream().collect(Collectors.toMap(PlatSpace::getName, PlatSpace::getId, (k1, k2) -> k1)); Map<String, String> firstSpaceNameMap = firstSpace.stream().collect(Collectors.toMap(PlatSpace::getName, PlatSpace::getId, (k1, k2) -> k1));
List<PlatSpace> listChildren = listPlatSpace.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList()); List<PlatSpace> listChildren = listPlatSpace.stream().filter(item -> StringUtil.isNotEmpty(item.getParentId())).collect(Collectors.toList());
Map<String, List<PlatSpace>> childrenMap = listChildren.stream().collect(Collectors.groupingBy(PlatSpace::getParentId)); Map<String, List<PlatSpace>> childrenMap = listChildren.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
Map<String, String> childrenIdMap = listChildren.stream().collect(Collectors.toMap(item -> item.getParentId() + item.getName(), item -> item.getId(), (k1, k2) -> k1)); Map<String, String> childrenIdMap = listChildren.stream().collect(Collectors.toMap(item -> item.getParentId() + "-"+item.getName(), item -> item.getId(), (k1, k2) -> k1));
List<PlatRoom> rooms = platRoomService.list();
Map<String,List<PlatRoom>> roomMap = rooms.stream().collect(Collectors.groupingBy(PlatRoom::getSpaceId));
List<PlatSpaceImportDTO> list = ExcelUtil.importExcel(null, 3, excelFile, PlatSpaceImportDTO.class); List<PlatSpaceImportDTO> list = ExcelUtil.importExcel(null, 3, excelFile, PlatSpaceImportDTO.class);
...@@ -426,10 +437,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -426,10 +437,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
key = key + "-" + item.getFloor(); key = key + "-" + item.getFloor();
} }
if (listKey.contains(key)) { if (listKey.contains(key+"-"+item.getRoomName())) {
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(0), "该空间下,房间名已存在")); errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(0), "该空间下,房间名已存在"));
errorFlag = true; errorFlag = true;
} }
listKey.add(key+"-"+item.getRoomName());
if (errorFlag) { if (errorFlag) {
errorCount++; errorCount++;
...@@ -459,6 +471,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -459,6 +471,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
spacePath = firstId; spacePath = firstId;
} else { } else {
firstId = firstSpaceNameMap.get(item.getCommunity()); firstId = firstSpaceNameMap.get(item.getCommunity());
spacePath = firstId;
} }
//第二层级 //第二层级
...@@ -529,19 +542,48 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -529,19 +542,48 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
platRoomDTO.setName(item.getRoomName()); platRoomDTO.setName(item.getRoomName());
platRoomDTO.setBedNumber(item.getBedNumber()); platRoomDTO.setBedNumber(item.getBedNumber());
String spaceId = null; String spaceId = null;
if (firstId != null) { int j = 0;
spaceId = firstId; if (fourId != null){
} else if (secondId != null) {
spaceId = secondId;
} else if (threeId != null) {
spaceId = threeId;
} else if (fourId != null) {
spaceId = fourId; spaceId = fourId;
j = 3;
} else if (threeId !=null){
spaceId = threeId;
j = 2;
} else if (secondId !=null){
spaceId = secondId;
j = 1;
} else if (firstId !=null){
spaceId = firstId;
}
//判断该层级是否最后一级
List<PlatSpace> childSpaes = list(new QueryWrapper<PlatSpace>().lambda()
.eq(PlatSpace::getParentId, spaceId));
if(!childSpaes.isEmpty()){
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(j), "该空间存在下级空间,不允许添加房间"));
successCount--;
errorCount++;
continue;
} }
platRoomDTO.setSpaceId(spaceId); platRoomDTO.setSpaceId(spaceId);
platRoomDTO.setSpacePath(spacePath); platRoomDTO.setSpacePath(spacePath);
platRoomService.add(platRoomDTO); PlatRoom platRoom = BeanDtoVoUtils.convert(platRoomDTO, PlatRoom.class);
if(roomMap.get(spaceId)!=null ){
List<PlatRoom> roomList = roomMap.get(spaceId);
List<String> roomNames = roomList.stream().map(PlatRoom::getName).collect(Collectors.toList());
if(roomNames.contains(platRoom.getName())){
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(0), "该空间下,房间名已存在"));
successCount--;
errorCount++;
continue;
} }
}
platRoomService.save(platRoom);
platBedService.add(platRoom);
}
}
if(!errorVoList.isEmpty()){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} }
excelImportVo.setTotalCount(list.size()); excelImportVo.setTotalCount(list.size());
excelImportVo.setErrorCount(errorCount); excelImportVo.setErrorCount(errorCount);
......
...@@ -3,6 +3,8 @@ package com.makeit.vo.platform.elder.report.day; ...@@ -3,6 +3,8 @@ package com.makeit.vo.platform.elder.report.day;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@Data @Data
public class PlatElderSleepEvaluationVO { public class PlatElderSleepEvaluationVO {
...@@ -22,4 +24,12 @@ public class PlatElderSleepEvaluationVO { ...@@ -22,4 +24,12 @@ public class PlatElderSleepEvaluationVO {
private Integer restDuration; private Integer restDuration;
@ApiModelProperty(value = "睡眠时长")
private BigDecimal sleepDurationHour;
@ApiModelProperty(value = "休息时长")
private BigDecimal restDurationHour;
} }
...@@ -3,6 +3,7 @@ package com.makeit.vo.platform.elder.report.week; ...@@ -3,6 +3,7 @@ package com.makeit.vo.platform.elder.report.week;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
@Data @Data
...@@ -23,6 +24,7 @@ public class PlatElderSleepDiagramWeekContentVO { ...@@ -23,6 +24,7 @@ public class PlatElderSleepDiagramWeekContentVO {
@ApiModelProperty(value = "清醒时长") @ApiModelProperty(value = "清醒时长")
private Integer soberDuration; private Integer soberDuration;
@ApiModelProperty(value = "翻身次数") @ApiModelProperty(value = "翻身次数")
private Integer turnedCount; private Integer turnedCount;
...@@ -33,5 +35,17 @@ public class PlatElderSleepDiagramWeekContentVO { ...@@ -33,5 +35,17 @@ public class PlatElderSleepDiagramWeekContentVO {
private Integer score; private Integer score;
@ApiModelProperty(value = "深度睡眠时长")
private BigDecimal sleepDeepDurationHour;
@ApiModelProperty(value = "中度睡眠时长")
private BigDecimal sleepModerateDurationHour;
@ApiModelProperty(value = "浅度睡眠时长")
private BigDecimal sleepLightnessDurationHour;
@ApiModelProperty(value = "清醒时长")
private BigDecimal soberDurationHour;
} }
...@@ -21,6 +21,9 @@ public class PlatBedPanoramaVO extends BaseIdDTO { ...@@ -21,6 +21,9 @@ public class PlatBedPanoramaVO extends BaseIdDTO {
@ApiModelProperty("全路径名称") @ApiModelProperty("全路径名称")
private String spacePathName; private String spacePathName;
@ApiModelProperty("房间id")
private String roomId;
@ApiModelProperty("房间名称") @ApiModelProperty("房间名称")
private String roomName; private String roomName;
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<select id="getHealthConfigList" resultType="com.makeit.dto.platform.alarm.PlatHealthConfigDTO"> <select id="getHealthConfigList" resultType="com.makeit.dto.platform.alarm.PlatHealthConfigDTO">
select pehi.elder_id as platElderId, select pehi.elder_id as platElderId,
pehi.respiratory_rate as heartRateStr, pehi.respiratory_rate as breathRateStr,
pehi.respiratory_exception_time as heartDuration, pehi.respiratory_exception_time as breathDuration,
pehi.heart_rate as breathRateStr, pehi.heart_rate as heartRateStr,
pehi.heart_exception_time as breathDuration pehi.heart_exception_time as heartDuration
from plat_elder_health_info pehi from plat_elder_health_info pehi
left join plat_elder pe on pe.id = pehi.elder_id left join plat_elder pe on pe.id = pehi.elder_id
where pehi.del_flag = 0 where pehi.del_flag = 0
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.makeit.mapper.platform.space.PlatBedMapper"> <mapper namespace="com.makeit.mapper.platform.space.PlatBedMapper">
<select id="selectBySpaceIdAndStatus" resultType="com.makeit.vo.platform.space.PlatBedPanoramaVO"> <select id="selectBySpaceIdAndStatus" resultType="com.makeit.vo.platform.space.PlatBedPanoramaVO">
SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId,pm.id as roomId
FROM `plat_bed` pb FROM `plat_bed` pb
LEFT JOIN plat_room pm on pb.room_id = pm.id LEFT JOIN plat_room pm on pb.room_id = pm.id
LEFT JOIN plat_elder pe on pe.bed_id = pb.id LEFT JOIN plat_elder pe on pe.bed_id = pb.id
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</select> </select>
<select id="selectByRoomIdAndStatus" resultType="com.makeit.vo.platform.space.PlatBedPanoramaVO"> <select id="selectByRoomIdAndStatus" resultType="com.makeit.vo.platform.space.PlatBedPanoramaVO">
SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId,pm.id as roomId
FROM `plat_bed` pb FROM `plat_bed` pb
LEFT JOIN plat_room pm on pb.room_id = pm.id LEFT JOIN plat_room pm on pb.room_id = pm.id
LEFT JOIN plat_elder pe on pe.bed_id = pb.id and pe.del_flag = 0 LEFT JOIN plat_elder pe on pe.bed_id = pb.id and pe.del_flag = 0
......
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" /> <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:alibabacloud-gateway-spi:0.0.1" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.14" level="project" />
<orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.5" level="project" /> <orderEntry type="library" name="Maven: com.huaweicloud:esdk-obs-java-bundle:3.23.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:5.2.2" level="project" /> <orderEntry type="library" name="Maven: org.apache.poi:poi:5.2.2" level="project" />
......
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