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
ee0017fa
authored
Feb 18, 2024
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
modify:bug 修改
parent
7bf13aaf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
16 deletions
server-common/src/main/java/com/makeit/utils/msg/sender/WxSpSender.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
server-common/src/main/java/com/makeit/utils/msg/sender/WxSpSender.java
View file @
ee0017fa
...
@@ -15,6 +15,7 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
...
@@ -15,6 +15,7 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
...
@@ -70,10 +71,11 @@ public class WxSpSender implements IMsgSender {
...
@@ -70,10 +71,11 @@ public class WxSpSender implements IMsgSender {
}
}
log
.
info
(
"微信公众通知:content:{}"
,
JsonUtil
.
toJson
(
info
));
log
.
info
(
"微信公众通知:content:{}"
,
JsonUtil
.
toJson
(
info
));
List
<
WxMpTemplateData
>
mpData
=
Arrays
.
asList
(
List
<
WxMpTemplateData
>
mpData
=
Arrays
.
asList
(
new
WxMpTemplateData
(
"thing25"
,
info
.
getAlarmType
()),
new
WxMpTemplateData
(
"thing25"
,
StrUtil
.
isNotBlank
(
info
.
getAlarmType
())
?
info
.
getAlarmType
()
:
"告警类型未知"
),
new
WxMpTemplateData
(
"thing22"
,
info
.
getRegionName
()),
new
WxMpTemplateData
(
"thing22"
,
StrUtil
.
isNotBlank
(
info
.
getRegionName
())
?
info
.
getRegionName
()
:
"设备位置未知"
),
new
WxMpTemplateData
(
"thing2"
,
info
.
getName
()),
new
WxMpTemplateData
(
"thing2"
,
StrUtil
.
isNotBlank
(
info
.
getName
())
?
info
.
getName
()
:
"长者姓名未知"
),
new
WxMpTemplateData
(
"time3"
,
DateUtil
.
format
(
info
.
getAlarmDate
(),
"yyyy-MM-dd HH:mm:ss"
))
new
WxMpTemplateData
(
"time3"
,
DateUtil
.
format
(
info
.
getAlarmDate
()
!=
null
?
info
.
getAlarmDate
()
:
LocalDateTime
.
now
(),
"yyyy-MM-dd HH:mm:ss"
))
);
);
try
{
try
{
WxMpTemplateMessage
wxMpTemplateMessage
=
WxMpTemplateMessage
.
builder
().
toUser
(
info
.
getWeChatOpenid
())
WxMpTemplateMessage
wxMpTemplateMessage
=
WxMpTemplateMessage
.
builder
().
toUser
(
info
.
getWeChatOpenid
())
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
View file @
ee0017fa
...
@@ -305,7 +305,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -305,7 +305,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
log
.
error
(
"通知家属异常"
,
e
);
log
.
error
(
"通知家属异常"
,
e
);
}
}
//通知内部人员
//通知内部人员
//
noticeUser(alarmConfig, alarmRecord);
noticeUser
(
alarmConfig
,
alarmRecord
);
}
}
...
@@ -363,10 +363,13 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -363,10 +363,13 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
queryDTO
.
setId
(
alarmRecord
.
getDeviceId
());
queryDTO
.
setId
(
alarmRecord
.
getDeviceId
());
pageReqDTO
.
setData
(
queryDTO
);
pageReqDTO
.
setData
(
queryDTO
);
PageVO
<
PlatDeviceListVO
>
platPage
=
platDeviceService
.
platPage
(
pageReqDTO
);
PageVO
<
PlatDeviceListVO
>
platPage
=
platDeviceService
.
platPage
(
pageReqDTO
);
String
regionName
=
alarmRecord
.
getRegionName
()
;
String
regionName
=
""
;
if
(
platPage
!=
null
&&
CollUtil
.
isNotEmpty
(
platPage
.
getList
()))
{
if
(
platPage
!=
null
&&
CollUtil
.
isNotEmpty
(
platPage
.
getList
()))
{
regionName
=
platPage
.
getList
().
get
(
0
).
getSpaceName
();
regionName
=
platPage
.
getList
().
get
(
0
).
getSpaceName
();
}
}
if
(
StrUtil
.
isBlank
(
regionName
))
{
regionName
=
StrUtil
.
isNotBlank
(
alarmRecord
.
getRegionName
())
?
alarmRecord
.
getRegionName
()
:
" "
;
}
List
<
SysDictionary
>
dictList
=
sysDictionaryService
.
list
(
Wrappers
.<
SysDictionary
>
lambdaQuery
().
like
(
SysDictionary:
:
getCode
,
"alarm.alarmType"
));
List
<
SysDictionary
>
dictList
=
sysDictionaryService
.
list
(
Wrappers
.<
SysDictionary
>
lambdaQuery
().
like
(
SysDictionary:
:
getCode
,
"alarm.alarmType"
));
Map
<
String
,
SysDictionary
>
dictMap
=
StreamUtil
.
toMapDep
(
dictList
,
SysDictionary:
:
getValue
);
Map
<
String
,
SysDictionary
>
dictMap
=
StreamUtil
.
toMapDep
(
dictList
,
SysDictionary:
:
getValue
);
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
View file @
ee0017fa
...
@@ -47,10 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -47,10 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.*
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -1036,14 +1033,14 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -1036,14 +1033,14 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
* 持续3小时加60分
* 持续3小时加60分
* 持续4小时加80分
* 持续4小时加80分
* 浅度睡眠:每持续1小时加5分
* 浅度睡眠:每持续1小时加5分
* 清醒:每1次扣5分,超过10
次
扣10分
* 清醒:每1次扣5分,超过10
分钟
扣10分
*
*
* 睡眠时长(扣除清醒):持续6小时加60分
* 睡眠时长(扣除清醒):持续6小时加60分
*/
*/
public
String
calculateScores2
(
SleepTimeDTO
sleepTimeDTO
,
SleepTimeMinuteDTO
sleepTimeMinute
,
public
String
calculateScores2
(
SleepTimeDTO
sleepTimeDTO
,
SleepTimeMinuteDTO
sleepTimeMinute
,
SaasSleepEvaluateStandardReport
evaluateStandardReport
)
{
SaasSleepEvaluateStandardReport
evaluateStandardReport
)
{
AtomicInteger
score
=
new
AtomicInteger
();
AtomicInteger
score
=
new
AtomicInteger
(
0
);
List
<
SleepTimeAnalysisVO
>
deepList
=
sleepTimeDTO
.
getDeepList
();
List
<
SleepTimeAnalysisVO
>
deepList
=
sleepTimeDTO
.
getDeepList
();
List
<
SleepTimeAnalysisVO
>
lightList
=
sleepTimeDTO
.
getLightList
();
List
<
SleepTimeAnalysisVO
>
lightList
=
sleepTimeDTO
.
getLightList
();
List
<
SleepTimeAnalysisVO
>
soberList
=
sleepTimeDTO
.
getSoberList
();
List
<
SleepTimeAnalysisVO
>
soberList
=
sleepTimeDTO
.
getSoberList
();
...
@@ -1054,11 +1051,28 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -1054,11 +1051,28 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
if
(
CollUtil
.
isNotEmpty
(
deepList
)
&&
CollUtil
.
isNotEmpty
(
sleepDeepConfigList
))
{
if
(
CollUtil
.
isNotEmpty
(
deepList
)
&&
CollUtil
.
isNotEmpty
(
sleepDeepConfigList
))
{
deepList
.
forEach
(
d
->
{
deepList
.
forEach
(
d
->
{
long
interval
=
d
.
getInterval
()
==
null
?
0
:
d
.
getInterval
()
/
60
;
long
interval
=
d
.
getInterval
()
==
null
?
0
:
d
.
getInterval
()
/
60
;
SleepConfigVO
configVO
=
sleepDeepConfigList
.
stream
().
filter
(
f
->
f
.
getHour
().
equals
(
Long
.
toString
(
interval
))).
findFirst
().
orElse
(
null
);
List
<
SleepConfigVO
>
list
=
sleepDeepConfigList
.
stream
().
filter
(
f
->
Long
.
parseLong
(
f
.
getHour
())
<=
interval
)
if
(
configVO
==
null
)
{
.
sorted
(
Comparator
.
comparing
(
SleepConfigVO:
:
getHour
).
reversed
()).
collect
(
Collectors
.
toList
());
return
;
if
(
CollUtil
.
isNotEmpty
(
list
))
{
score
.
addAndGet
(
Integer
.
parseInt
(
list
.
get
(
0
).
getScore
()));
}
});
}
if
(
CollUtil
.
isNotEmpty
(
lightList
)
&&
lightnessConfig
!=
null
)
{
deepList
.
forEach
(
d
->
{
long
interval
=
d
.
getInterval
()
==
null
?
0
:
d
.
getInterval
()
/
60
;
int
per
=
(
int
)
(
interval
/
Integer
.
parseInt
(
lightnessConfig
.
getHour
()));
score
.
addAndGet
(
Integer
.
parseInt
(
lightnessConfig
.
getScore
())
*
per
);
});
}
if
(
CollUtil
.
isNotEmpty
(
soberList
)
&&
CollUtil
.
isNotEmpty
(
sleepTimeConfigList
))
{
soberList
.
forEach
(
d
->
{
long
interval
=
d
.
getInterval
()
==
null
?
0
:
d
.
getInterval
()
/
60
;
List
<
SleepConfigVO
>
list
=
sleepDeepConfigList
.
stream
().
filter
(
f
->
Long
.
parseLong
(
f
.
getHour
())
<=
interval
)
.
sorted
(
Comparator
.
comparing
(
SleepConfigVO:
:
getHour
).
reversed
()).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isNotEmpty
(
list
))
{
score
.
addAndGet
(
Integer
.
parseInt
(
list
.
get
(
0
).
getScore
()));
}
}
score
.
addAndGet
(
Integer
.
parseInt
(
configVO
.
getScore
()));
});
});
}
}
return
Integer
.
toString
(
score
.
get
());
return
Integer
.
toString
(
score
.
get
());
...
...
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