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
9d9d66a5
Commit
9d9d66a5
authored
Jun 24, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分布式锁调整
parent
af5cd4be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
8 deletions
+18
-8
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+13
-1
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+2
-3
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result/Result.java
+2
-2
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/ViolationCache.java
+1
-2
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
9d9d66a5
...
...
@@ -61,6 +61,9 @@ public class BindInfoControlller extends BaseController {
}
catch
(
DistributedLockException
e
)
{
log
.
error
(
"分布式锁超时"
);
return
ResultGenerator
.
fail
(
ResultCode
.
REPEAT_SUBMIT
);
}
catch
(
Exception
e
)
{
log
.
error
(
"系统异常:{}"
,
e
);
return
ResultGenerator
.
fail
(
ResultCode
.
SYSTEM_ERROR
);
}
return
response
;
}
...
...
@@ -77,7 +80,16 @@ public class BindInfoControlller extends BaseController {
@PostMapping
(
"unbind"
)
@BodyDecryptAnnotation
public
Result
unbindInfo
(
@RequestBody
@Validated
UnBindReq
req
)
{
return
service
.
unbindInfo
(
req
);
Result
result
=
null
;
try
{
result
=
service
.
unbindInfo
(
req
);
}
catch
(
DistributedLockException
e
)
{
return
ResultGenerator
.
fail
(
ResultCode
.
REPEAT_SUBMIT
);
}
catch
(
Exception
e
)
{
log
.
error
(
"系统异常:{}"
,
e
);
return
ResultGenerator
.
fail
(
ResultCode
.
SYSTEM_ERROR
);
}
return
result
;
}
/**
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
9d9d66a5
...
...
@@ -176,13 +176,12 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@DistributedLock
(
key
=
"'park:extend:lock:unbind:unqId:'+#req.unqId+':userId:'+#req.userId+':timestamp:'+#req"
+
".timestamp"
,
expireTime
=
3000
,
waitTime
=
2000
,
retryTimes
=
50
)
public
Result
unbindInfo
(
UnBindReq
req
)
{
".timestamp"
,
isSpin
=
false
)
public
Result
unbindInfo
(
UnBindReq
req
)
{
ParkBindInfo
bindInfo
=
bindCache
.
getById
(
req
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResultGenerator
.
fail
(
ResultCode
.
BIND_INFO_UNKNOWN
);
}
if
(!
bindCache
.
unBind
(
req
.
getUnqId
(),
req
.
getUserId
()))
{
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result/Result.java
View file @
9d9d66a5
...
...
@@ -23,12 +23,12 @@ public class Result<T> {
/**
* 状态码
*/
private
long
code
;
private
long
code
=
ResultCode
.
SUCCESS
.
getCode
()
;
/**
* 描述
*/
private
String
msg
;
private
String
msg
=
ResultCode
.
SUCCESS
.
getMsg
()
;
/**
* 挂载数据
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/ViolationCache.java
View file @
9d9d66a5
...
...
@@ -25,8 +25,7 @@ public class ViolationCache {
* @param req 号牌+号牌类型,时间开始-结束
* @return
*/
@Cacheable
(
value
=
"violations"
,
key
=
"'plateNum:'+#req.plateNum+':plateType:'+#req.plateType+':timeStart:'+#req"
+
".timeStart.toString()+':timeEnd:'+#req.timeEnd.toString()"
,
unless
=
"#result==null or #result.size()==0"
)
@Cacheable
(
value
=
"violations"
,
key
=
"'plateNum:'+#req.plateNum+':plateType:'+#req.plateType"
,
unless
=
"#result==null or #result.size()==0"
)
public
List
<
ViolationMicRes
>
getByPlateNumAndType
(
ViolationListByTimeReq
req
)
{
return
violatio
.
listByTime
(
req
).
getData
();
}
...
...
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