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 c4efb0db
authored
Apr 27, 2021
by
fz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.setnx添加业务前缀
2.分享钥匙列表返回page对象
1 parent
2623c831
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
17 deletions
src/main/java/com/glsx/smart/dao/mapper/SmartVehicleBlueShareKeyMapper.java
src/main/java/com/glsx/smart/service/SmartVehicleBlueShareKeyService.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartVehicleBlueShareKeyServiceImpl.java
src/main/resources/mapper/SmartVehicleBlueShareKeyMapper.xml
src/main/java/com/glsx/smart/dao/mapper/SmartVehicleBlueShareKeyMapper.java
View file @
c4efb0d
...
...
@@ -64,5 +64,5 @@ public interface SmartVehicleBlueShareKeyMapper {
*/
int
updateByPrimaryKey
(
SmartVehicleBlueShareKey
record
);
int
updateByIds
(
List
<
Long
>
ids
);
int
update
ShareStatus
ByIds
(
List
<
Long
>
ids
);
}
\ No newline at end of file
src/main/java/com/glsx/smart/service/SmartVehicleBlueShareKeyService.java
View file @
c4efb0d
...
...
@@ -36,6 +36,6 @@ public interface SmartVehicleBlueShareKeyService {
SmartVehicleBlueShareKeyExample
getBlueKeyShareExampleByIDDelete
(
Long
id
);
int
updateByIds
(
List
<
Long
>
ids
);
int
update
ShareStatus
ByIds
(
List
<
Long
>
ids
);
}
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
View file @
c4efb0d
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.alibaba.nacos.common.utils.StringUtils
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.dao.entity.*
;
import
com.glsx.smart.exception.BusinessException
;
...
...
@@ -670,27 +671,23 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
}
List
<
Long
>
expireList
=
new
ArrayList
<>();
List
<
SmartVehicleBlueShareKey
>
resList
=
new
ArrayList
<>();
//过期数据分类
Date
finalNowDate
=
nowDate
;
shareKeyList
.
stream
().
forEach
(
key
->{
Date
expireDate
=
key
.
getExpireTime
();
if
(
finalNowDate
.
after
(
expireDate
))
if
(
finalNowDate
.
after
(
expireDate
))
{
expireList
.
add
(
key
.
getId
());
else
resList
.
add
(
key
);
});
if
(
CollectionUtils
.
isEmpty
(
resList
))
return
R
.
ok
().
data
(
null
);
//过期关闭
key
.
setShareStatus
(
1
);
}
});
//如果当前时间已经超过过期时间,更新数据
if
(
CollectionUtils
.
isNotEmpty
(
expireList
)){
smartVehicleBlueShareKeyService
.
updateByIds
(
expireList
);
smartVehicleBlueShareKeyService
.
update
ShareStatus
ByIds
(
expireList
);
}
return
R
.
ok
().
data
(
resList
);
return
R
.
ok
().
data
(
PageInfo
.
of
(
shareKeyList
)
);
}
}
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
View file @
c4efb0d
...
...
@@ -116,7 +116,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
if
(
nowDate
.
after
(
expireDate
))
return
R
.
error
(
"当前时间已超过分享过期时间"
);
boolean
res
=
redisService
.
setnx
(
shareKeyId
,
userId
);
boolean
res
=
redisService
.
setnx
(
"receive_share_key:"
+
shareKeyId
,
userId
);
if
(!
res
)
return
R
.
error
(
"钥匙已经被领用"
);
...
...
src/main/java/com/glsx/smart/service/impl/SmartVehicleBlueShareKeyServiceImpl.java
View file @
c4efb0d
...
...
@@ -113,8 +113,8 @@ public class SmartVehicleBlueShareKeyServiceImpl implements SmartVehicleBlueShar
}
@Override
public
int
updateByIds
(
List
<
Long
>
ids
)
{
return
smartVehicleBlueShareKeyMapper
.
updateByIds
(
ids
);
public
int
update
ShareStatus
ByIds
(
List
<
Long
>
ids
)
{
return
smartVehicleBlueShareKeyMapper
.
update
ShareStatus
ByIds
(
ids
);
}
private
Date
getFormatNowDate
()
{
...
...
src/main/resources/mapper/SmartVehicleBlueShareKeyMapper.xml
View file @
c4efb0d
...
...
@@ -342,7 +342,7 @@
</update>
<update
id=
"updateByIds"
>
<update
id=
"update
ShareStatus
ByIds"
>
update smart_vehicle_blue_share_key set share_status = 1 where id in
<foreach
collection=
"list"
item=
"keyId"
open=
"("
separator=
","
close=
")"
index=
"index"
>
#{keyId}
...
...
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