Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
isc-common
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
isc-common
Commits
82b6d938
Commit
82b6d938
authored
Oct 09, 2024
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交lck表相关操作
parent
30c9c300
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
56 deletions
+117
-56
AbstractBizLocker.java
...om/brilliance/isc/common/lock/impl/AbstractBizLocker.java
+5
-2
DBLckBizLocker.java
...a/com/brilliance/isc/common/lock/impl/DBLckBizLocker.java
+99
-42
LckComponent.java
...ava/com/brilliance/isc/common/lock/impl/LckComponent.java
+13
-12
No files found.
isc-common-service-public/src/main/java/com/brilliance/isc/common/lock/impl/AbstractBizLocker.java
View file @
82b6d938
package
com
.
brilliance
.
isc
.
common
.
lock
.
impl
;
import
com.brilliance.isc.common.context.SpringEnvContext
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.Logger
;
import
com.brilliance.isc.common.lock.BizLocker
;
...
...
@@ -49,13 +50,15 @@ public abstract class AbstractBizLocker implements BizLocker {
@Override
public
boolean
lock
(
LockInfo
lockInfo
,
long
seconds
)
{
return
this
.
lock
(
lockInfo
.
genLockKey
(),
lockInfo
.
genLockValue
(),
seconds
);
// return this.lock(lockInfo.genLockKey(),lockInfo.genLockValue(),seconds);
return
SpringEnvContext
.
getBean
(
AbstractBizLocker
.
class
).
lock
(
lockInfo
.
genLockKey
(),
lockInfo
.
genLockValue
(),
seconds
);
}
@Override
public
boolean
lock
(
LockInfo
lockInfo
)
{
return
this
.
lock
(
lockInfo
.
genLockKey
(),
lockInfo
.
genLockValue
(),
DEFAULT_LEASE_TIME
);
// return this.lock(lockInfo.genLockKey(),lockInfo.genLockValue(),DEFAULT_LEASE_TIME);
return
SpringEnvContext
.
getBean
(
AbstractBizLocker
.
class
).
lock
(
lockInfo
.
genLockKey
(),
lockInfo
.
genLockValue
(),
DEFAULT_LEASE_TIME
);
}
/**
...
...
isc-common-service-public/src/main/java/com/brilliance/isc/common/lock/impl/DBLckBizLocker.java
View file @
82b6d938
This diff is collapsed.
Click to expand it.
isc-common-service-public/src/main/java/com/brilliance/isc/common/lock/impl/LckComponent.java
View file @
82b6d938
package
com
.
brilliance
.
isc
.
common
.
lock
.
impl
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.Logger
;
import
com.brilliance.isc.bo.Lck
;
import
com.brilliance.isc.common.lock.LockInfo
;
import
com.brilliance.isc.mda.dao.LckMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -24,39 +24,40 @@ public class LckComponent {
int
cnt
=
lckMapper
.
insert
(
lck
);
logger
.
info
(
"锁定信息插入成功,影响行数:{}"
,
cnt
);
return
true
;
}
catch
(
Exception
e
)
{
logger
.
info
(
"已存在锁{}"
,
lockInfo
.
genLockKey
());
}
finally
{
}
catch
(
Exception
e
){
logger
.
info
(
"已存在锁{}"
,
lockInfo
.
genLockKey
());
}
finally
{
}
return
false
;
}
public
Lck
lockInfo2Lck
(
LockInfo
lockInfo
)
{
public
Lck
lockInfo2Lck
(
LockInfo
lockInfo
){
Lck
dataLck
=
new
Lck
();
dataLck
.
setLckdattim
(
new
Date
());
dataLck
.
setLcktrn
(
lockInfo
.
getTrnName
());
dataLck
.
setLckusr
(
lockInfo
.
getUsrId
());
dataLck
.
setLckstr
(
lockInfo
.
genLockKey
());
if
(
lockInfo
.
isReentrant
())
{
if
(
lockInfo
.
isReentrant
())
{
dataLck
.
setLckhld
(
""
);
}
else
{
}
else
{
dataLck
.
setLckhld
(
"X"
);
}
return
dataLck
;
}
public
LockInfo
lck2Info
(
Lck
dataLck
)
{
if
(
dataLck
==
null
)
{
public
LockInfo
lck2Info
(
Lck
dataLck
){
if
(
dataLck
==
null
)
{
return
null
;
}
LockInfo
lockInfo
=
new
LockInfo
(
dataLck
.
getLckstr
());
lockInfo
.
setTrnName
(
dataLck
.
getLcktrn
());
lockInfo
.
setUsrId
(
dataLck
.
getLckusr
());
if
(
dataLck
.
getLckhld
()
==
null
||
dataLck
.
getLckhld
().
trim
().
isEmpty
())
{
if
(
dataLck
.
getLckhld
()
==
null
||
dataLck
.
getLckhld
().
trim
().
isEmpty
())
{
lockInfo
.
setReentrant
(
true
);
}
else
{
}
else
{
lockInfo
.
setReentrant
(
false
);
}
return
lockInfo
;
...
...
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