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
50e12b0b
authored
Oct 09, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:修复bug
parent
dd30e768
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
server-api/src/main/java/com/makeit/api/external/util/RSAUtils.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportWeekServiceImpl.java
server-api/src/main/java/com/makeit/api/external/util/RSAUtils.java
View file @
50e12b0b
...
...
@@ -38,11 +38,12 @@ public class RSAUtils {
System
.
out
.
println
(
keys
);
RSAPublicKey
publicKey
=
getPublicKey
(
keys
.
get
(
"publicKey"
));
RSAPrivateKey
privateKey
=
getPrivateKey
(
keys
.
get
(
"privateKey"
));
String
encrypt
=
publicEncrypt
(
"{\"page\":1,\"limit\":10,\"data\":{}}"
,
publicKey
,
"UTF-8"
);
System
.
out
.
println
(
encrypt
);
RSAPrivateKey
privateKey
=
getPrivateKey
(
keys
.
get
(
"privateKey"
));
String
decrypt
=
privateDecrypt
(
encrypt
,
privateKey
,
"UTF-8"
);
System
.
out
.
println
(
decrypt
);
...
...
@@ -120,7 +121,8 @@ public class RSAUtils {
try
{
Cipher
cipher
=
Cipher
.
getInstance
(
RSA_ALGORITHM
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
publicKey
);
return
Base64
.
encodeBase64URLSafeString
(
rsaSplitCodec
(
cipher
,
Cipher
.
ENCRYPT_MODE
,
data
.
getBytes
(
encoding
),
publicKey
.
getModulus
().
bitLength
()));
return
Base64
.
encodeBase64URLSafeString
(
rsaSplitCodec
(
cipher
,
Cipher
.
ENCRYPT_MODE
,
data
.
getBytes
(
encoding
),
publicKey
.
getModulus
().
bitLength
()));
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"加密字符串["
+
data
+
"]时遇到异常"
,
e
);
}
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderDayReportWeekServiceImpl.java
View file @
50e12b0b
...
...
@@ -182,17 +182,20 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
.
le
(
PlatElderSleepAnalysis:
:
getHappenDate
,
dateTimeFormatter
.
format
(
weekEndDate
))
);
if
(
CollectionUtils
.
isEmpty
(
sleepAnalysisList
))
{
return
new
PlatElderSleepEvaluationVO
();
}
int
score
=
0
;
int
sleepDuration
=
0
;
int
restDuration
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
sleepAnalysisList
))
{
score
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getSleepScore
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
score
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getSleepScore
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
sleepDuration
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getSleepTime
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
sleepDuration
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getSleepTime
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
restDuration
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getRestTime
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
restDuration
=
StreamUtil
.
reduce
(
sleepAnalysisList
,
e
->
Integer
.
valueOf
(
e
.
getRestTime
()
+
""
),
0
,
Integer:
:
sum
)
/
sleepAnalysisList
.
size
();
}
PlatElderSleepEvaluationVO
platElderSleepEvaluationVO
=
new
PlatElderSleepEvaluationVO
();
platElderSleepEvaluationVO
.
setScore
(
score
);
...
...
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