Commit 50e12b0b by huangjy

fix:修复bug

parent dd30e768
......@@ -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);
}
......
......@@ -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);
......
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