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
7c669f77
Commit
7c669f77
authored
Jun 22, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
a4cb4ded
6cfe5a6d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
19 deletions
+58
-19
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+1
-3
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+1
-1
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+27
-15
infra/src/main/resources/sql/短信验证通过记录.sql
+12
-0
infra/src/main/resources/sql/绑定信息建表语句.sql
+17
-0
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
7c669f77
...
...
@@ -5,12 +5,10 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -72,7 +70,7 @@ public class BindInfoControlller extends BaseController {
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public
Response
unbindInfo
(
@RequestBody
@Validated
UnBindReq
req
)
{
return
service
.
unbindInfo
(
req
)
?
ResponseGenerator
.
success
()
:
ResponseGenerator
.
fail
(
"解绑失败"
);
return
service
.
unbindInfo
(
req
)
?
ResponseGenerator
.
success
()
:
ResponseGenerator
.
fail
(
"解绑失败"
);
}
/**
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
7c669f77
...
...
@@ -165,7 +165,7 @@ public class H5Controller {
* @date: 2020/6/21 13:58
*/
@PostMapping
(
"checkVerifyCode"
)
public
Response
<
Void
>
send
VerifyCode
(
@RequestBody
@Validated
CheckVerifyCodeReq
req
)
{
public
Response
<
Void
>
check
VerifyCode
(
@RequestBody
@Validated
CheckVerifyCodeReq
req
)
{
CheckVerifyCodeMicReq
micReq
=
new
CheckVerifyCodeMicReq
();
micReq
.
setPhone
(
req
.
getPhone
());
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
7c669f77
...
...
@@ -37,7 +37,6 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfo
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -86,6 +85,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper
boundQuery
=
new
QueryWrapper
();
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
boundQuery
.
eq
(
"status"
,
"1"
);
Integer
bound
=
mapper
.
selectCount
(
boundQuery
);
if
(
bound
>=
3
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
BUSINESS_ERROR
);
...
...
@@ -104,16 +104,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
}
//规则3:判断当前车牌号是否已绑定
QueryWrapper
<
BindInfo
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"user_id"
,
info
.
getUserId
());
queryWrapper
.
eq
(
"plate_num"
,
info
.
getPlateNum
());
queryWrapper
.
eq
(
"plate_type"
,
info
.
getPlateType
());
queryWrapper
.
eq
(
"status"
,
"1"
);
BindInfo
bindExist
=
mapper
.
selectOne
(
queryWrapper
);
if
(
bindExist
!=
null
)
{
info
.
setUnqId
(
bindExist
.
getUnqId
());
info
.
setStatus
(
"1"
);
mapper
.
updateById
(
info
);
return
ResponseGenerator
.
fail
(
StatusCode
.
ALERT_ERROR
);
}
else
{
info
.
setUnqId
(
UUID
.
randomUUID
().
toString
());
mapper
.
insert
(
info
);
...
...
@@ -129,7 +128,20 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
*/
@Override
public
boolean
unbindInfo
(
UnBindReq
req
)
{
return
bindCache
.
unBind
(
req
.
getUnqId
(),
req
.
getUserId
());
/**
* 解绑规则:30天内,同一客户解绑次数总计不能超过10次
*/
QueryWrapper
<
BindInfo
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"user_id"
,
req
.
getUnqId
());
queryWrapper
.
eq
(
"unbind_time"
,
DateUtil
.
offsetDay
(
new
Date
(),
-
30
));
queryWrapper
.
eq
(
"status"
,
"0"
);
Integer
integer
=
mapper
.
selectCount
(
queryWrapper
);
if
(
integer
>=
10
)
{
return
false
;
}
else
{
return
bindCache
.
unBind
(
req
.
getUnqId
(),
req
.
getUserId
());
}
}
/**
...
...
@@ -297,15 +309,15 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
}
@Scheduled
(
cron
=
"0 0/30 * * * ?"
)
public
void
clearPast
()
{
DateTime
now
=
DateTime
.
now
();
log
.
info
(
"开始清除,已过期且无效的绑定信息.当前时间:"
+
now
);
Date
lastMonth
=
DateUtil
.
offsetDay
(
now
,
-
30
);
Integer
count
=
mapper
.
clearPast
(
lastMonth
);
log
.
info
(
"清除完毕,共清除过期且无效的绑定信息:"
+
count
);
// @Scheduled(cron = "0 0/30 * * * ?")
// public void clearPast() {
// DateTime now = DateTime.now();
// log.info("开始清除,已过期且无效的绑定信息.当前时间:" + now);
// Date lastMonth = DateUtil.offsetDay(now, -30);
// Integer count = mapper.clearPast(lastMonth);
// log.info("清除完毕,共清除过期且无效的绑定信息:" + count);
}
}
}
infra/src/main/resources/sql/短信验证通过记录.sql
0 → 100644
View file @
7c669f77
-- auto-generated definition
-- auto-generated definition
create
table
verify_info
(
id
bigint
auto_increment
primary
key
,
user_id
varchar
(
36
)
null
comment
'用户id'
,
verify_code
varchar
(
50
)
null
comment
'短信验证码'
,
phone
varchar
(
11
)
null
comment
'电话号码'
,
pass_time
datetime
null
comment
'验证通过时间'
)
comment
'短信验证通过记录'
;
infra/src/main/resources/sql/绑定信息建表语句.sql
0 → 100644
View file @
7c669f77
-- auto-generated definition
-- auto-generated definition
create
table
bind_info
(
unq_id
varchar
(
36
)
not
null
comment
'用户车辆绑定记录唯一编号'
primary
key
,
user_id
varchar
(
128
)
not
null
comment
'客户唯一编号'
,
phone
varchar
(
11
)
not
null
comment
'客户手机号'
,
plate_color
varchar
(
2
)
null
comment
'车牌颜色:A:白,B:灰,C:黄,D:粉,E:红,F:紫,G:绿,H:蓝,I:棕,J:黑'
,
plate_num
varchar
(
20
)
not
null
comment
'车主车牌号'
,
plate_type
varchar
(
20
)
not
null
comment
'车牌类型'
,
status
varchar
(
10
)
default
'1'
null
comment
'绑定状态:0,未绑定,1,已绑定'
,
gmt_bind_time
datetime
null
comment
'绑定时间'
,
unbind_time
datetime
null
comment
'解绑时间'
)
comment
'用户车辆绑定信息'
;
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