Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JDCLOUD
Project
Project
Details
Activity
Releases
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
gavelinfo
JDCLOUD
Commits
c27c39c4
Commit
c27c39c4
authored
Jul 27, 2022
by
zhoumaotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码调整
parent
28c37814
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
22 deletions
+54
-22
DatasyncServiceImpl.java
.../com/gavel/datasync/service/impl/DatasyncServiceImpl.java
+6
-22
JDClientUtil.java
...c/src/main/java/com/gavel/datasync/util/JDClientUtil.java
+48
-0
No files found.
gavel-web/datasyncweb/gavel-datasync/src/main/java/com/gavel/datasync/service/impl/DatasyncServiceImpl.java
View file @
c27c39c4
...
@@ -4,7 +4,6 @@ import com.gavel.common.utils.DateUtils;
...
@@ -4,7 +4,6 @@ import com.gavel.common.utils.DateUtils;
import
com.gavel.common.utils.NumberUtils
;
import
com.gavel.common.utils.NumberUtils
;
import
com.gavel.datasync.service.DatasyncService
;
import
com.gavel.datasync.service.DatasyncService
;
import
com.gavel.datasync.util.JDClientUtil
;
import
com.gavel.datasync.util.JDClientUtil
;
import
com.jd.open.api.sdk.DefaultJdClient
;
import
com.jd.open.api.sdk.JdClient
;
import
com.jd.open.api.sdk.JdClient
;
import
com.jd.open.api.sdk.domain.supplier.IDpsSearchAllOrdersInterface.response.searchAllOrders.QueryAllOrdersForJosResult
;
import
com.jd.open.api.sdk.domain.supplier.IDpsSearchAllOrdersInterface.response.searchAllOrders.QueryAllOrdersForJosResult
;
import
com.jd.open.api.sdk.domain.supplier.ProductManagementService.response.find.CategoryDto
;
import
com.jd.open.api.sdk.domain.supplier.ProductManagementService.response.find.CategoryDto
;
...
@@ -18,7 +17,6 @@ import com.jd.open.api.sdk.response.supplier.DropshipDpsSearchAllOrdersResponse;
...
@@ -18,7 +17,6 @@ import com.jd.open.api.sdk.response.supplier.DropshipDpsSearchAllOrdersResponse;
import
com.jd.open.api.sdk.response.supplier.VcItemBrandsFindResponse
;
import
com.jd.open.api.sdk.response.supplier.VcItemBrandsFindResponse
;
import
com.jd.open.api.sdk.response.supplier.VcItemCategoriesFindResponse
;
import
com.jd.open.api.sdk.response.supplier.VcItemCategoriesFindResponse
;
import
com.jd.open.api.sdk.response.supplier.VcItemProductsFindResponse
;
import
com.jd.open.api.sdk.response.supplier.VcItemProductsFindResponse
;
import
com.jd.security.tdeclient.SecretJdClient
;
import
com.jd.security.tdeclient.TDEClient
;
import
com.jd.security.tdeclient.TDEClient
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -35,7 +33,7 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -35,7 +33,7 @@ public class DatasyncServiceImpl implements DatasyncService {
@Override
@Override
public
List
<
CategoryDto
>
getCategories
()
{
public
List
<
CategoryDto
>
getCategories
()
{
JdClient
client
=
createClient
();
JdClient
client
=
JDClientUtil
.
createClient
();
VcItemCategoriesFindRequest
request
=
new
VcItemCategoriesFindRequest
();
VcItemCategoriesFindRequest
request
=
new
VcItemCategoriesFindRequest
();
try
{
try
{
VcItemCategoriesFindResponse
response
=
client
.
execute
(
request
);
VcItemCategoriesFindResponse
response
=
client
.
execute
(
request
);
...
@@ -48,7 +46,7 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -48,7 +46,7 @@ public class DatasyncServiceImpl implements DatasyncService {
@Override
@Override
public
List
<
SimpleBrandDto
>
getBrands
()
{
public
List
<
SimpleBrandDto
>
getBrands
()
{
JdClient
client
=
createClient
();
JdClient
client
=
JDClientUtil
.
createClient
();
VcItemBrandsFindRequest
request
=
new
VcItemBrandsFindRequest
();
VcItemBrandsFindRequest
request
=
new
VcItemBrandsFindRequest
();
try
{
try
{
VcItemBrandsFindResponse
response
=
client
.
execute
(
request
);
VcItemBrandsFindResponse
response
=
client
.
execute
(
request
);
...
@@ -62,7 +60,7 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -62,7 +60,7 @@ public class DatasyncServiceImpl implements DatasyncService {
@Override
@Override
public
List
<
MyProductInfoDto
>
getProducts
(
Date
time
,
String
brandid
,
String
categoryid
)
{
public
List
<
MyProductInfoDto
>
getProducts
(
Date
time
,
String
brandid
,
String
categoryid
)
{
try
{
try
{
JdClient
client
=
createClient
();
JdClient
client
=
JDClientUtil
.
createClient
();
VcItemProductsFindRequest
request
=
new
VcItemProductsFindRequest
();
VcItemProductsFindRequest
request
=
new
VcItemProductsFindRequest
();
final
int
PAGE_SIZE
=
50
;
final
int
PAGE_SIZE
=
50
;
request
.
setOffset
(
0
);
request
.
setOffset
(
0
);
...
@@ -103,7 +101,7 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -103,7 +101,7 @@ public class DatasyncServiceImpl implements DatasyncService {
@Override
@Override
public
List
<
QueryAllOrdersForJosResult
>
searchOrders
(
Date
start
,
Date
end
)
{
public
List
<
QueryAllOrdersForJosResult
>
searchOrders
(
Date
start
,
Date
end
)
{
try
{
try
{
JdClient
client
=
createClient
();
JdClient
client
=
JDClientUtil
.
createClient
();
final
int
PAGE_SIZE
=
50
;
final
int
PAGE_SIZE
=
50
;
DropshipDpsSearchAllOrdersRequest
request
=
new
DropshipDpsSearchAllOrdersRequest
();
DropshipDpsSearchAllOrdersRequest
request
=
new
DropshipDpsSearchAllOrdersRequest
();
request
.
setPage
(
1
);
request
.
setPage
(
1
);
...
@@ -152,7 +150,7 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -152,7 +150,7 @@ public class DatasyncServiceImpl implements DatasyncService {
@Override
@Override
public
List
<
QueryAllOrdersForJosResult
>
searchOrders2
(
Date
start
,
Date
end
)
{
public
List
<
QueryAllOrdersForJosResult
>
searchOrders2
(
Date
start
,
Date
end
)
{
try
{
try
{
JdClient
client
=
createClient
();
JdClient
client
=
JDClientUtil
.
createClient
();
final
int
PAGE_SIZE
=
50
;
final
int
PAGE_SIZE
=
50
;
DropshipDpsSearchAllOrdersRequest
request
=
new
DropshipDpsSearchAllOrdersRequest
();
DropshipDpsSearchAllOrdersRequest
request
=
new
DropshipDpsSearchAllOrdersRequest
();
request
.
setPage
(
1
);
request
.
setPage
(
1
);
...
@@ -198,24 +196,10 @@ public class DatasyncServiceImpl implements DatasyncService {
...
@@ -198,24 +196,10 @@ public class DatasyncServiceImpl implements DatasyncService {
return
null
;
return
null
;
}
}
private
JdClient
createClient
()
{
return
new
DefaultJdClient
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN
,
JDClientUtil
.
APPKEY
,
JDClientUtil
.
APPSECRET
);
}
private
TDEClient
getTdeClient
()
{
TDEClient
tdeClient
=
null
;
try
{
tdeClient
=
SecretJdClient
.
getInstance
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN
,
JDClientUtil
.
APPKEY
,
JDClientUtil
.
APPSECRET
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"错误信息P01"
,
e
.
getMessage
());
}
return
tdeClient
;
}
private
String
getValue
(
String
val
){
private
String
getValue
(
String
val
){
TDEClient
tdeClient
=
getTdeClient
();
TDEClient
tdeClient
=
JDClientUtil
.
getTdeClient
();
String
s
=
""
;
String
s
=
""
;
try
{
try
{
s
=
tdeClient
.
decryptString
(
val
);
s
=
tdeClient
.
decryptString
(
val
);
...
...
gavel-web/datasyncweb/gavel-datasync/src/main/java/com/gavel/datasync/util/JDClientUtil.java
View file @
c27c39c4
package
com
.
gavel
.
datasync
.
util
;
package
com
.
gavel
.
datasync
.
util
;
import
com.gavel.datasync.service.impl.DatasyncServiceImpl
;
import
com.jd.open.api.sdk.DefaultJdClient
;
import
com.jd.open.api.sdk.JdClient
;
import
com.jd.security.tdeclient.SecretJdClient
;
import
com.jd.security.tdeclient.TDEClient
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
public
class
JDClientUtil
{
public
class
JDClientUtil
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DatasyncServiceImpl
.
class
);
// 正式环境
// 正式环境
public
static
final
String
SERVER_URL
=
"https://api.jd.com/routerjson"
;
public
static
final
String
SERVER_URL
=
"https://api.jd.com/routerjson"
;
//帷易胜店铺信息
public
static
final
String
APPKEY
=
"FEAFBABCDEEC48A569A10818138D7841"
;
public
static
final
String
APPKEY
=
"FEAFBABCDEEC48A569A10818138D7841"
;
public
static
final
String
APPSECRET
=
"36c196b5b2ea4c2aaaae6d80010a28a8"
;
public
static
final
String
APPSECRET
=
"36c196b5b2ea4c2aaaae6d80010a28a8"
;
public
static
final
String
ACCESS_TOKEN
=
"1d4a07ea9743455d99c2f7f63e2f7971a3zw"
;
public
static
final
String
ACCESS_TOKEN
=
"1d4a07ea9743455d99c2f7f63e2f7971a3zw"
;
//hailinking1984店铺信息
public
static
final
String
APPKEY_H
=
"819A568C76FEBC54945536AF7B7BBCBE"
;
public
static
final
String
APPSECRET_H
=
"374c67fe9ff2410f876686282de33dac"
;
public
static
final
String
ACCESS_TOKEN_H
=
"ed1bc49527c8449c94bc503dd268cbfem0ot"
;
public
static
JdClient
createClient
()
{
return
new
DefaultJdClient
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN
,
JDClientUtil
.
APPKEY
,
JDClientUtil
.
APPSECRET
);
}
public
static
TDEClient
getTdeClient
()
{
TDEClient
tdeClient
=
null
;
try
{
tdeClient
=
SecretJdClient
.
getInstance
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN
,
JDClientUtil
.
APPKEY
,
JDClientUtil
.
APPSECRET
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"错误信息"
,
e
.
getMessage
());
}
return
tdeClient
;
}
public
static
JdClient
createHClient
()
{
return
new
DefaultJdClient
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN_H
,
JDClientUtil
.
APPKEY_H
,
JDClientUtil
.
APPSECRET_H
);
}
public
static
TDEClient
getHTdeClient
()
{
TDEClient
tdeClient
=
null
;
try
{
tdeClient
=
SecretJdClient
.
getInstance
(
JDClientUtil
.
SERVER_URL
,
JDClientUtil
.
ACCESS_TOKEN_H
,
JDClientUtil
.
APPKEY_H
,
JDClientUtil
.
APPSECRET_H
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"错误信息"
,
e
.
getMessage
());
}
return
tdeClient
;
}
}
}
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