Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b1c74864
authored
Sep 30, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
http://git.xmmakeit.com/huangjiay/iot-platform-server
into dev
parents
f25daeef
7ff30f3f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
461 additions
and
32 deletions
saas-module/src/main/java/com/makeit/controller/sys/SaasFileController.java
saas-module/src/main/java/com/makeit/controller/sys/SaasUploadController.java
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatRoleDTOVO.java
server-service/src/main/java/com/makeit/dto/platform/alarm/PlatAlarmRecordQueryDTO.java
server-service/src/main/java/com/makeit/entity/platform/auth/PlatRoleOrg.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatRoleServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportDayServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportWeekServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomBedDeviceServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/elder/report/day/PlatElderSleepEvaluationVO.java
server-service/src/main/java/com/makeit/vo/platform/elder/report/week/PlatElderSleepDiagramWeekContentVO.java
saas-module/src/main/java/com/makeit/controller/sys/SaasFileController.java
0 → 100644
View file @
b1c74864
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
));
}
}
saas-module/src/main/java/com/makeit/controller/sys/SaasUploadController.java
0 → 100644
View file @
b1c74864
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;
}
server-common/src/main/java/com/makeit/module/admin/dto/plat/PlatRoleDTOVO.java
View file @
b1c74864
...
@@ -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
;
...
...
server-service/src/main/java/com/makeit/dto/platform/alarm/PlatAlarmRecordQueryDTO.java
View file @
b1c74864
...
@@ -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
;
}
}
server-service/src/main/java/com/makeit/entity/platform/auth/PlatRoleOrg.java
View file @
b1c74864
...
@@ -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
{
/**
/**
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
View file @
b1c74864
...
@@ -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
);
...
...
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatRoleServiceImpl.java
View file @
b1c74864
...
@@ -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
);
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportDayServiceImpl.java
View file @
b1c74864
...
@@ -101,6 +101,9 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
...
@@ -101,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
;
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportWeekServiceImpl.java
View file @
b1c74864
...
@@ -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,20 +275,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
...
@@ -287,20 +275,7 @@ 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
());
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
;
});
});
...
@@ -311,6 +286,28 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
...
@@ -311,6 +286,28 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
return
vo
;
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
.
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
());
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
));
if
(
platElderSleepAnalysis
!=
null
)
{
vo
.
setTurnedCount
(
platElderSleepAnalysis
.
getTurnedCount
());
vo
.
setBodyMoveCount
(
platElderSleepAnalysis
.
getActionCount
());
vo
.
setScore
(
Integer
.
valueOf
(
platElderSleepAnalysis
.
getSleepScore
()
+
""
));
}
return
vo
;
}
@Override
@Override
public
PlatElderHeartRespiratoryEvaluationVO
heartRespiratoryEvaluationInternal
(
PlatElderReportDTO
platElderIdDTO
,
LocalDate
weekStartDate
,
LocalDate
weekEndDate
)
{
public
PlatElderHeartRespiratoryEvaluationVO
heartRespiratoryEvaluationInternal
(
PlatElderReportDTO
platElderIdDTO
,
LocalDate
weekStartDate
,
LocalDate
weekEndDate
)
{
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomBedDeviceServiceImpl.java
View file @
b1c74864
...
@@ -98,11 +98,20 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
...
@@ -98,11 +98,20 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
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
=
""
;
...
...
server-service/src/main/java/com/makeit/vo/platform/elder/report/day/PlatElderSleepEvaluationVO.java
View file @
b1c74864
...
@@ -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
;
}
}
server-service/src/main/java/com/makeit/vo/platform/elder/report/week/PlatElderSleepDiagramWeekContentVO.java
View file @
b1c74864
...
@@ -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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment