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
be866e04
Commit
be866e04
authored
Jun 23, 2020
by
xieshixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整代码
parent
dddfe986
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+1
-1
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/IBindService.java
+1
-1
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+25
-8
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
be866e04
...
...
@@ -68,7 +68,7 @@ public class BindInfoControlller extends BaseController {
@PostMapping
(
"unbind"
)
@BodyDecryptAnnotation
public
Response
unbindInfo
(
@RequestBody
@Validated
UnBindReq
req
)
{
return
service
.
unbindInfo
(
req
)
?
ResponseGenerator
.
success
()
:
ResponseGenerator
.
fail
(
"解绑失败"
)
;
return
service
.
unbindInfo
(
req
)
;
}
/**
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
be866e04
...
...
@@ -135,7 +135,7 @@ public class H5Controller {
public
Response
<
CheckValidityRes
>
checkValidity
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
ParkVerifyInfo
verifyInfo
=
verifyInfoMapper
.
checkValidity
(
query
.
getPhone
(),
query
.
getUserId
(),
DateUtil
.
offset
Day
(
DateTime
.
now
(),
-
1
));
DateUtil
.
offset
Hour
(
DateTime
.
now
(),
-
checkValidityLimitTime
));
CheckValidityRes
checkValidityRes
=
new
CheckValidityRes
();
defaultConverter
.
getMapperFacade
().
map
(
query
,
checkValidityRes
);
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
View file @
be866e04
...
...
@@ -35,7 +35,7 @@ public interface IBindService extends IService<ParkBindInfo> {
* @param req
* @return
*/
boolean
unbindInfo
(
UnBindReq
req
);
Response
unbindInfo
(
UnBindReq
req
);
/**
* 查询用户绑定信息
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
be866e04
...
...
@@ -37,7 +37,10 @@ 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.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
...
...
@@ -70,6 +73,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
@Autowired
UnqIdUtil
unqIdUtil
;
/**
* 解除绑定时间限制
* 单位:小时
*/
@Value
(
"${biz.unbind.time:720}"
)
Integer
unBindTime
;
@Override
public
Response
bind
(
ParkBindInfo
info
)
{
...
...
@@ -144,22 +154,29 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
* @return
*/
@Override
public
boolean
unbindInfo
(
UnBindReq
req
)
{
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Response
unbindInfo
(
UnBindReq
req
)
{
ParkBindInfo
bindInfo
=
bindCache
.
getById
(
req
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
,
"绑定信息不存在"
);
}
/**
* 解绑规则:30天内,同一客户解绑次数总计不能超过10次
*/
QueryWrapper
<
ParkBindInfo
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"user_id"
,
req
.
getU
nq
Id
());
queryWrapper
.
lt
(
"unbind_time"
,
DateUtil
.
offsetDay
(
new
Date
(),
-
30
));
queryWrapper
.
eq
(
"user_id"
,
req
.
getU
ser
Id
());
queryWrapper
.
ge
(
"unbind_time"
,
DateUtil
.
offsetHour
(
new
Date
(),
-
unBindTime
));
queryWrapper
.
eq
(
"status"
,
"0"
);
Integer
integer
=
mapper
.
selectCount
(
queryWrapper
);
if
(
integer
>=
10
)
{
return
false
;
return
ResponseGenerator
.
fail
(
StatusCode
.
BUSINESS_ERROR
,
"同一用户30天内只能解绑10次"
)
;
}
return
bindCache
.
unBind
(
req
.
getUnqId
(),
req
.
getUserId
());
if
(!
bindCache
.
unBind
(
req
.
getUnqId
(),
req
.
getUserId
()))
{
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResponseGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
,
"解绑失败"
);
}
return
ResponseGenerator
.
success
();
}
/**
...
...
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