Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 359013ec
authored
May 03, 2021
by
fengzhi
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.主钥匙不存在,不可领取分享钥匙
1 parent
8bcef227
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
View file @
359013e
...
@@ -82,8 +82,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
...
@@ -82,8 +82,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
SmartVehicleBlueKey
key
=
keyList
.
get
(
0
);
SmartVehicleBlueKey
key
=
keyList
.
get
(
0
);
//将数据库密钥解密成明文
//将数据库密钥解密成明文
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()!=
2
)
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()
!=
2
)
return
R
.
error
(
"钥匙信息不完整"
);
return
R
.
error
(
"钥匙信息不完整"
);
key
.
setCrepCode
(
arr
.
get
(
0
));
key
.
setCrepCode
(
arr
.
get
(
0
));
...
@@ -189,8 +189,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
...
@@ -189,8 +189,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
return
R
.
ok
().
data
(
null
);
return
R
.
ok
().
data
(
null
);
SmartShareKeyBlueKey
key
=
keyList
.
get
(
0
);
SmartShareKeyBlueKey
key
=
keyList
.
get
(
0
);
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()!=
2
)
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()
!=
2
)
return
R
.
error
(
"钥匙信息不完整"
);
return
R
.
error
(
"钥匙信息不完整"
);
key
.
setCrepCode
(
arr
.
get
(
0
));
key
.
setCrepCode
(
arr
.
get
(
0
));
...
@@ -214,8 +214,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
...
@@ -214,8 +214,8 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
List
<
SmartShareKeyBlueKey
>
keys
=
shareKeyService
.
getShareKeyListByUserId
(
userId
);
List
<
SmartShareKeyBlueKey
>
keys
=
shareKeyService
.
getShareKeyListByUserId
(
userId
);
keys
.
stream
().
forEach
(
key
->
{
keys
.
stream
().
forEach
(
key
->
{
//将数据库密钥解密成明文
//将数据库密钥解密成明文
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
List
<
String
>
arr
=
encryptKey
(
key
.
getCrepCode
(),
key
.
getSecretKey
());
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()!=
2
)
if
(
CollectionUtils
.
isEmpty
(
arr
)
||
arr
.
size
()
!=
2
)
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_21
);
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_21
);
key
.
setCrepCode
(
arr
.
get
(
0
));
key
.
setCrepCode
(
arr
.
get
(
0
));
...
@@ -231,23 +231,25 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
...
@@ -231,23 +231,25 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
long
keyShareID
=
Long
.
valueOf
((
String
)
claims
.
get
(
"keyShareID"
));
long
keyShareID
=
Long
.
valueOf
((
String
)
claims
.
get
(
"keyShareID"
));
List
<
SmartVehicleBlueKey
>
keyList
=
blueKeyService
.
selectById
(
keyid
);
List
<
SmartVehicleBlueKey
>
keyList
=
blueKeyService
.
selectById
(
keyid
);
if
(
CollectionUtils
.
is
Not
Empty
(
keyList
))
{
if
(
CollectionUtils
.
isEmpty
(
keyList
))
{
SmartVehicleBlueKey
blueKey
=
keyList
.
get
(
0
);
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_19
);
String
crepCode
=
blueKey
.
getCrepCode
();
}
String
secretKey
=
blueKey
.
getSecretKey
(
);
SmartVehicleBlueKey
blueKey
=
keyList
.
get
(
0
);
String
smartLockMac
=
blueKey
.
getSmartLockMac
();
String
crepCode
=
blueKey
.
getCrepCode
();
//主钥匙是否信息完整
String
secretKey
=
blueKey
.
getSecretKey
();
if
(
StringUtils
.
isBlank
(
crepCode
)
||
StringUtils
.
isBlank
(
secretKey
)
||
StringUtils
.
isBlank
(
smartLockMac
))
{
String
smartLockMac
=
blueKey
.
getSmartLockMac
();
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_21
);
}
//主钥匙是否关闭分享
//主钥匙是否信息完整
int
status
=
blueKey
.
getShareStatus
();
if
(
StringUtils
.
isBlank
(
crepCode
)
||
StringUtils
.
isBlank
(
secretKey
)
||
StringUtils
.
isBlank
(
smartLockMac
))
{
if
(
status
==
0
)
{
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_21
);
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_20
);
}
}
//主钥匙是否关闭分享
int
status
=
blueKey
.
getShareStatus
();
if
(
status
==
0
)
{
throw
new
BusinessException
(
ResultEnum
.
CAR_KEY_EXCEP_20
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment