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 6daadf20
authored
Apr 24, 2021
by
fz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.保存注册信息,如果蓝牙地址有则更新,没有新增
1 parent
8b954eba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
View file @
6daadf2
...
...
@@ -300,47 +300,41 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
return
R
.
ok
().
data
(
responseList
);
}
smartKeyBlueSenseList
.
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser1====="
+
s
.
getMobileBlueMac
()));
smartKeyBlueSenseList
.
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser1====="
+
s
.
getMobileBlueMac
()));
//转化为sn,蓝牙感应数据
Map
<
String
,
SmartKeyBlueSense
>
blueSenseListMap
=
new
HashMap
<>();
smartKeyBlueSenseList
.
stream
().
forEach
(
blueSense
->
{
//设备号
String
sn
=
blueSense
.
getSn
();
Date
time1
=
blueSense
.
getCreateTime
();
SmartKeyBlueSense
data
=
null
;
if
(
blueSenseListMap
.
containsKey
(
sn
))
{
data
=
blueSenseListMap
.
get
(
sn
);
if
(
time1
.
after
(
data
.
getCreateTime
()))
data
.
setCreateTime
(
time1
);
}
else
{
//第一次
data
=
new
SmartKeyBlueSense
();
}
Date
time1
=
blueSense
.
getCreateTime
();
Date
time2
=
data
.
getCreateTime
();
if
(
null
==
time2
)
{
data
.
setCreateTime
(
time1
);
}
else
{
//time1小于time2返回-1,time1大于time2返回1,相等返回0
int
res
=
time1
.
compareTo
(
time2
);
if
(
res
==
1
)
data
.
setCreateTime
(
time1
);
}
blueSenseListMap
.
put
(
sn
,
data
);
});
blueSenseListMap
.
entrySet
().
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser2=====key:"
+
s
.
getKey
()+
"===mac:"
+
s
.
getValue
().
getMobileBlueMac
()));
blueSenseListMap
.
entrySet
().
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser2=====key:"
+
s
.
getKey
()
+
"===mac:"
+
s
.
getValue
().
getMobileBlueMac
()));
//将蓝牙感应数据添加
responseList
.
stream
().
forEach
(
response
->
{
responseList
.
stream
().
forEach
(
response
->
{
String
sn
=
response
.
getSn
();
if
(
blueSenseListMap
.
containsKey
(
sn
))
{
if
(
blueSenseListMap
.
containsKey
(
sn
))
{
SmartKeyBlueSense
blueSense
=
blueSenseListMap
.
get
(
sn
);
response
.
setMobileBlueMac
(
blueSense
.
getMobileBlueMac
());
response
.
setAutoSenseStatus
(
blueSense
.
getAutoSenseStatus
());
}
});
smartKeyBlueSenseList
.
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser3====="
+
s
.
getMobileBlueMac
()));
smartKeyBlueSenseList
.
stream
().
forEach
(
s
->
log
.
info
(
"getAllKeyByUser3====="
+
s
.
getMobileBlueMac
()));
return
R
.
ok
().
data
(
responseList
);
...
...
@@ -404,7 +398,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
.
andIsDeleteEqualTo
(
0
);
List
<
SmartKeyBlueSense
>
list
=
smartKeyBlueSenseService
.
selectByExample
(
blueSenseExample
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
//如果手机mac不存在,新增
SmartKeyBlueSense
blueSense
=
SmartKeyBlueSense
.
builder
()
.
userId
(
smartVehicleBlueKey
.
getUserId
())
...
...
@@ -416,7 +410,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
.
build
();
//新增车钥匙手机蓝牙mac,自动感应状态
smartKeyBlueSenseService
.
insert
(
blueSense
);
}
else
{
}
else
{
SmartKeyBlueSense
blueSense
=
list
.
get
(
0
);
blueSense
.
setMobileBlueMac
(
mobileMac
);
//新增车钥匙手机蓝牙mac,自动感应状态
...
...
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