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
7e899482
authored
Dec 07, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 修复bug
parent
1284b262
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
16 deletions
server-service/src/main/java/com/makeit/entity/platform/device/PlatDeviceLog.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceLogServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderBreatheAnalysisServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
server-service/src/main/java/com/makeit/service/wechat/impl/PlatLoginWechatServiceImpl.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/entity/platform/device/PlatDeviceLog.java
View file @
7e899482
...
...
@@ -38,6 +38,9 @@ public class PlatDeviceLog extends BaseBusEntity {
private
String
url
;
@ApiModelProperty
(
value
=
"文件名称"
)
private
String
fileName
;
@ApiModelProperty
(
value
=
"租户名称"
)
@TableField
(
exist
=
false
)
private
String
tenantName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
...
...
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceLogServiceImpl.java
View file @
7e899482
...
...
@@ -4,19 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.makeit.common.entity.BaseBusEntity
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
import
com.makeit.entity.platform.alarm.PlatAlarmRecord
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceLog
;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.mapper.platform.device.PlatDeviceLogMapper
;
import
com.makeit.service.platform.device.PlatDeviceLogService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* <p>
* 设备日志 服务实现类
...
...
@@ -30,6 +39,8 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P
@Autowired
private
PlatDeviceLogMapper
platDeviceLogMapper
;
@Autowired
private
PlatTenantService
platTenantService
;
@Override
public
PageVO
<
PlatDeviceLog
>
pageList
(
PageReqDTO
<
PlatDeviceLog
>
pageReqDTO
)
{
...
...
@@ -38,12 +49,19 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P
LambdaQueryWrapper
<
PlatDeviceLog
>
lambdaQueryWrapper
=
new
QueryWrapper
<
PlatDeviceLog
>().
lambda
()
.
eq
(
StringUtils
.
isNotEmpty
(
dto
.
getDeviceId
()),
PlatDeviceLog:
:
getDeviceId
,
dto
.
getDeviceId
())
.
eq
(
StringUtils
.
isNotEmpty
(
dto
.
getProductName
()),
PlatDeviceLog:
:
getProductName
,
dto
.
getProductName
())
.
like
(
StringUtils
.
isNotEmpty
(
dto
.
getProductName
()),
PlatDeviceLog:
:
getProductName
,
dto
.
getProductName
())
.
eq
(
StringUtils
.
isNotEmpty
(
dto
.
getTenantId
()),
PlatDeviceLog:
:
getTenantId
,
dto
.
getTenantId
())
.
ge
(
dto
.
getStartTime
()
!=
null
,
PlatDeviceLog:
:
getCreateDate
,
dto
.
getStartTime
())
.
ge
(
dto
.
getEndTime
()
!=
null
,
PlatDeviceLog:
:
getCreateDate
,
dto
.
getEndTime
());
Page
<
PlatDeviceLog
>
deviceLogPage
=
platDeviceLogMapper
.
selectPage
(
p
,
lambdaQueryWrapper
);
List
<
PlatDeviceLog
>
records
=
deviceLogPage
.
getRecords
();
List
<
String
>
tenantIdList
=
StreamUtil
.
map
(
records
,
BaseBusEntity:
:
getTenantId
);
List
<
PlatTenant
>
platTenantList
=
platTenantService
.
listByIds
(
tenantIdList
);
Map
<
String
,
String
>
tenantMap
=
platTenantList
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
PlatTenant:
:
getName
,
((
v1
,
v2
)
->
v2
)));
for
(
PlatDeviceLog
record
:
records
)
{
record
.
setTenantName
(
tenantMap
.
getOrDefault
(
record
.
getTenantId
(),
""
));
}
return
PageUtil
.
toPageVO
(
deviceLogPage
.
getRecords
()
,
deviceLogPage
);
return
PageUtil
.
toPageVO
(
records
,
deviceLogPage
);
}
}
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderBreatheAnalysisServiceImpl.java
View file @
7e899482
...
...
@@ -102,7 +102,7 @@ public class PlatElderBreatheAnalysisServiceImpl extends ServiceImpl<PlatElderBr
.
in
(
PlatElderBreatheDayStat:
:
getElderId
,
elderIdList
)
.
eq
(
PlatElderBreatheDayStat:
:
getDay
,
yesDate
));
Map
<
String
,
PlatElderBreatheDayStat
>
breatheDayStatMap
=
StreamUtil
.
toMap
(
elderBreatheDayStatList
,
PlatElderBreatheDayStat:
:
getElderId
);
Map
<
String
,
PlatElderBreatheDayStat
>
breatheDayStatMap
=
StreamUtil
.
toMap
Dep
(
elderBreatheDayStatList
,
PlatElderBreatheDayStat:
:
getElderId
);
SaasSleepAnalysisModel
analysisModel
=
saasSleepAnalysisModelService
.
getOne
(
new
QueryWrapper
<
SaasSleepAnalysisModel
>().
lambda
()
.
orderByDesc
(
BaseEntity:
:
getCreateBy
)
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
7e899482
...
...
@@ -422,13 +422,8 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
Object
track
=
result
.
get
(
"track"
);
List
<
Integer
>
list
=
track
==
null
?
Lists
.
newArrayList
()
:
(
List
<
Integer
>)
track
;
String
distance
=
result
.
getString
(
"track"
);
BigDecimal
x
=
new
BigDecimal
(
distance
).
multiply
(
BigDecimal
.
valueOf
(
Math
.
cos
(
Double
.
parseDouble
(
list
.
get
(
1
)
+
""
)))
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
BigDecimal
y
=
new
BigDecimal
(
distance
).
multiply
(
BigDecimal
.
valueOf
(
Math
.
sin
(
Math
.
cos
(
Double
.
parseDouble
(
list
.
get
(
2
)
+
""
))))
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
vo
.
setX
(
x
);
vo
.
setY
(
y
);
vo
.
setX
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
1
))
:
BigDecimal
.
ZERO
);
vo
.
setY
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
2
)):
BigDecimal
.
ZERO
);
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
return
vo
;
}).
collect
(
Collectors
.
toList
());
...
...
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
View file @
7e899482
...
...
@@ -281,12 +281,11 @@ public class WorkStationServiceImpl implements WorkStationService {
for
(
WorkStationInstitutionRoomVO
vo
:
roomVOList
)
{
vo
.
setPathName
(
vo
.
getPathName
()
+
"-"
+
vo
.
getRoomName
());
List
<
PlatDevice
>
deviceList
=
Lists
.
newArrayList
();
if
(
bedMap
.
get
(
vo
.
getRoomId
())
!=
null
)
{
List
<
WorkStationInstitutionBedVO
>
roomBedVos
=
bedMap
.
get
(
vo
.
getRoomId
());
//获取告警类型及老人状态
for
(
WorkStationInstitutionBedVO
r
:
roomBedVos
){
List
<
PlatDevice
>
deviceList
=
Lists
.
newArrayList
();
List
<
PlatRoomBedDevice
>
platRoomBedDevices
=
roomDeviceMap
.
get
(
r
.
getRoomId
());
if
(
CollectionUtils
.
isNotEmpty
(
platRoomBedDevices
))
{
List
<
String
>
tempDeviceIdList
=
StreamUtil
.
map
(
platRoomBedDevices
,
PlatRoomBedDevice:
:
getDeviceId
);
...
...
server-service/src/main/java/com/makeit/service/wechat/impl/PlatLoginWechatServiceImpl.java
View file @
7e899482
...
...
@@ -43,8 +43,6 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
PlatUser
platUser
=
platUserService
.
getOne
(
new
QueryWrapper
<
PlatUser
>().
lambda
()
.
eq
(
PlatUser:
:
getAccount
,
loginDTO
.
getAccount
())
.
or
()
.
eq
(
PlatUser:
:
getMobile
,
loginDTO
.
getAccount
())
);
if
(
platUser
==
null
)
{
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
7e899482
...
...
@@ -114,9 +114,8 @@ public class PushCallback implements MqttCallback {
Long
timestamp
=
device
.
getTimestamp
();
// TODO 先这样判断
if
(
REPORT_PROPERTY
.
equals
(
device
.
getMessageType
())
&&
headers
.
getProductName
().
contains
(
"呼吸"
))
{
// 缓存呼吸设备某段时间的数据,hash 最大长度 duration
L
ong
duration
=
getSleepTimeActionDuration
();
l
ong
duration
=
getSleepTimeActionDuration
();
Long
size
=
redisTemplate
.
opsForHash
().
size
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
());
if
(
size
.
equals
(
duration
*
60
))
{
redisTemplate
.
opsForHash
().
delete
(
DEVICE_BR_ANALYSIS
+
device
.
getDeviceId
(),
timestamp
-
duration
*
60
);
...
...
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