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
1b5e3f59
Commit
1b5e3f59
authored
Aug 02, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
da9c3392
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
15 deletions
+35
-15
CommonService.java
src/main/java/com/egolm/sso/services/CommonService.java
+29
-15
application-dev.yml
src/main/resources/application-dev.yml
+2
-0
application-pro.yml
src/main/resources/application-pro.yml
+2
-0
application-uat.yml
src/main/resources/application-uat.yml
+2
-0
No files found.
src/main/java/com/egolm/sso/services/CommonService.java
View file @
1b5e3f59
...
...
@@ -48,6 +48,9 @@ public class CommonService {
@Value
(
"${dataTracking.uri.insertOrderTracking}"
)
private
String
insertOrderTrackingUri
;
@Value
(
"${dataTracking.isOpen}"
)
private
boolean
isOpen
;
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
Long
getNextval
(
String
sName
)
{
try
{
...
...
@@ -100,9 +103,16 @@ public class CommonService {
jdbcTemplate
.
update
(
sql
,
objs
);
}
@Value
(
"${dataTracking.tokenExpireMinute}"
)
private
Long
tokenExpireMinute
;
private
static
String
token
;
private
static
Date
tokenCreateTime
;
public
String
getToken
()
{
Date
now
=
new
Date
();
if
(
token
!=
null
&&
tokenCreateTime
!=
null
&&
(
tokenCreateTime
.
getTime
()
+
((
tokenExpireMinute
-
2
)*
60L
*
1000L
))
>
now
.
getTime
())
{
return
token
;
}
String
requestUrl
=
baseUrl
+
tokenUri
;
Map
<
String
,
Object
>
parameters
=
new
HashMap
<
String
,
Object
>();
parameters
.
put
(
"appId"
,
appId
);
...
...
@@ -112,13 +122,16 @@ public class CommonService {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resultText
);
Boolean
isSuccess
=
jsonObject
.
getBoolean
(
"success"
);
if
(
isSuccess
!=
null
&&
isSuccess
)
{
return
jsonObject
.
getString
(
"token"
);
tokenCreateTime
=
now
;
token
=
jsonObject
.
getString
(
"token"
);
return
token
;
}
else
{
throw
new
TrackingTokenException
(
jsonObject
.
getString
(
"message"
));
}
}
public
void
saveOrderTracking
(
String
traceNo
,
String
orderType
,
String
orderNo
,
String
disCode
,
String
action
,
String
result
,
String
errorMessage
)
{
if
(
isOpen
)
{
String
requestUrl
=
baseUrl
+
insertOrderTrackingUri
;
String
token
=
this
.
getToken
();
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
...
...
@@ -133,6 +146,7 @@ public class CommonService {
parameters
.
put
(
"errorMessage"
,
errorMessage
);
HttpUtil
.
post
(
requestUrl
,
parameters
,
headers
);
}
}
public
static
class
TrackingTokenException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/resources/application-dev.yml
View file @
1b5e3f59
...
...
@@ -6,6 +6,8 @@ schneider:
password
:
disbtor@2019
cronSap009
:
0 0 0 * * ?
dataTracking
:
isOpen
:
false
tokenExpireMinute
:
30
appId
:
schneider
appSecret
:
SGVsbG8yQ2xpZW50IQ==
username
:
schneider
...
...
src/main/resources/application-pro.yml
View file @
1b5e3f59
...
...
@@ -6,6 +6,8 @@ schneider:
password
:
disbtor@2019
cronSap009
:
0 0 0 * * ?
dataTracking
:
isOpen
:
false
tokenExpireMinute
:
30
appId
:
schneider
appSecret
:
SGVsbG8yQ2xpZW50IQ==
username
:
schneider
...
...
src/main/resources/application-uat.yml
View file @
1b5e3f59
...
...
@@ -6,6 +6,8 @@ schneider:
password
:
disbtor@2019
cronSap009
:
0 0 0 * * ?
dataTracking
:
isOpen
:
false
tokenExpireMinute
:
30
appId
:
schneider
appSecret
:
SGVsbG8yQ2xpZW50IQ==
username
:
schneider
...
...
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