Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
park
extend
Commits
ede31bd8
Commit
ede31bd8
authored
Jun 23, 2020
by
xieshixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验电话号码唯一
parent
c2d69122
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+12
-4
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
+10
-0
No files found.
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
ede31bd8
...
...
@@ -74,14 +74,22 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
@Override
public
Response
bind
(
ParkBindInfo
info
)
{
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper
boundQuery
=
new
QueryWrapper
();
QueryWrapper
<
ParkBindInfo
>
boundQuery
=
new
QueryWrapper
();
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
boundQuery
.
eq
(
"status"
,
"1"
);
Integer
bound
=
mapper
.
selectCoun
t
(
boundQuery
);
if
(
bound
>=
3
)
{
List
<
ParkBindInfo
>
list
=
mapper
.
selectLis
t
(
boundQuery
);
if
(
list
!=
null
&&
list
.
size
()
>=
3
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
BUSINESS_ERROR
);
}
//规则:一个电话号码只能对应一个客户
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
boolean
equals
=
list
.
get
(
0
).
getPhone
().
equals
(
info
.
getPhone
());
if
(!
equals
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
BUSINESS_ERROR
,
"当前客户手机号与历史绑定手机号不一致"
);
}
}
//规则2:客户手机号与车辆对应的车主手机号一致
PlateNumQueryReq
req
=
new
PlateNumQueryReq
();
req
.
setPlateNum
(
info
.
getPlateNum
());
...
...
@@ -113,7 +121,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
info
.
setUnqId
(
unqIdUtil
.
getUnqId
());
info
.
setGmtBindTime
(
new
Date
());
mapper
.
insert
(
info
);
bindCache
.
insert
(
info
);
return
ResponseGenerator
.
success
(
new
BindInfoRes
(
info
.
getUnqId
()));
}
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
View file @
ede31bd8
...
...
@@ -23,6 +23,14 @@ public class BindCache {
private
BindInfoMapper
mapper
;
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"bindinfo"
,
key
=
"'userId:'+#info.userId"
,
condition
=
"#info!=null"
)
})
public
boolean
insert
(
ParkBindInfo
info
)
{
return
mapper
.
insert
(
info
)
>
0
;
}
/**
* 获取绑定信息
*
...
...
@@ -67,4 +75,6 @@ public class BindCache {
bindInfo
.
setUnbindTime
(
new
Date
());
return
mapper
.
unbind
(
bindInfo
)
>
0
;
}
}
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