Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
Project
Project
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
曲欣亮
sap-service
Commits
1ac7ad26
Commit
1ac7ad26
authored
Jul 17, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
9d88281a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
ExceptionAspect.java
src/main/java/com/egolm/sso/config/ExceptionAspect.java
+17
-5
CommonService.java
src/main/java/com/egolm/sso/services/CommonService.java
+3
-3
No files found.
src/main/java/com/egolm/sso/config/ExceptionAspect.java
View file @
1ac7ad26
package
com
.
egolm
.
sso
.
config
;
package
com
.
egolm
.
sso
.
config
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.aspectj.lang.annotation.AfterThrowing
;
import
org.aspectj.lang.annotation.AfterThrowing
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
@Aspect
@Aspect
@Component
@Component
public
class
ExceptionAspect
{
public
class
ExceptionAspect
{
@AfterThrowing
(
throwing
=
"ex"
,
pointcut
=
"execution(public * com.egolm.sso.services.*.*.execute(..))"
)
private
static
final
String
execution
=
"execution(public * com.egolm.sso.services.*.*.execute(..))"
;
Log
logger
=
LogFactory
.
getLog
(
ExceptionAspect
.
class
);
@Before
(
value
=
execution
)
public
void
before
(
Throwable
ex
)
{
}
@AfterThrowing
(
throwing
=
"ex"
,
pointcut
=
execution
)
public
void
afterThrowing
(
Throwable
ex
)
{
public
void
afterThrowing
(
Throwable
ex
)
{
}
}
...
...
src/main/java/com/egolm/sso/services/CommonService.java
View file @
1ac7ad26
...
@@ -18,7 +18,7 @@ public class CommonService {
...
@@ -18,7 +18,7 @@ public class CommonService {
public
Long
getNextval
(
String
sName
)
{
public
Long
getNextval
(
String
sName
)
{
try
{
try
{
Map
<
String
,
Object
>
seqMap
=
jdbcTemplate
.
queryForMap
(
"select * from sequence where name = ?"
,
sName
);
Map
<
String
,
Object
>
seqMap
=
jdbcTemplate
.
queryForMap
(
"select * from
x_
sequence where name = ?"
,
sName
);
Integer
id
=
(
Integer
)
seqMap
.
get
(
"id"
);
Integer
id
=
(
Integer
)
seqMap
.
get
(
"id"
);
Long
step
=
(
Long
)
seqMap
.
get
(
"step"
);
Long
step
=
(
Long
)
seqMap
.
get
(
"step"
);
Long
max
=
(
Long
)
seqMap
.
get
(
"max"
);
Long
max
=
(
Long
)
seqMap
.
get
(
"max"
);
...
@@ -29,7 +29,7 @@ public class CommonService {
...
@@ -29,7 +29,7 @@ public class CommonService {
if
(
value
>
max
||
value
<
min
)
{
if
(
value
>
max
||
value
<
min
)
{
throw
new
XRException
(
MessageFormat
.
format
(
"序列已超出许可范围[{0}]"
,
sName
));
throw
new
XRException
(
MessageFormat
.
format
(
"序列已超出许可范围[{0}]"
,
sName
));
}
else
{
}
else
{
String
sql
=
"update sequence set value = ? where id = ? and value < ?"
;
String
sql
=
"update
x_
sequence set value = ? where id = ? and value < ?"
;
int
count
=
jdbcTemplate
.
update
(
sql
,
nextValue
,
id
,
nextValue
);
int
count
=
jdbcTemplate
.
update
(
sql
,
nextValue
,
id
,
nextValue
);
if
(
count
==
1
)
{
if
(
count
==
1
)
{
return
value
;
return
value
;
...
@@ -40,7 +40,7 @@ public class CommonService {
...
@@ -40,7 +40,7 @@ public class CommonService {
}
}
}
}
}
catch
(
EmptyResultDataAccessException
e
)
{
}
catch
(
EmptyResultDataAccessException
e
)
{
String
sql
=
"insert into sequence (name, max, min, step, value) values (?, ?, ?, ?, ?)"
;
String
sql
=
"insert into
x_
sequence (name, max, min, step, value) values (?, ?, ?, ?, ?)"
;
jdbcTemplate
.
update
(
sql
,
sName
,
Long
.
MAX_VALUE
,
1L
,
1L
,
1L
);
jdbcTemplate
.
update
(
sql
,
sName
,
Long
.
MAX_VALUE
,
1L
,
1L
,
1L
);
return
this
.
getNextval
(
sName
);
return
this
.
getNextval
(
sName
);
}
}
...
...
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