Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MultipleSourceSecurity
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
周宗顺
MultipleSourceSecurity
Commits
afa547f2
Commit
afa547f2
authored
Nov 08, 2025
by
Allen Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
263e7ab5
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
233 additions
and
300 deletions
+233
-300
PddAPIConfig.java
...r/src/main/java/org/ta/pddserver/config/PddAPIConfig.java
+34
-0
PddFZController.java
...ain/java/org/ta/pddserver/controller/PddFZController.java
+13
-18
PddGDController.java
...ain/java/org/ta/pddserver/controller/PddGDController.java
+5
-78
PddLocalController.java
.../java/org/ta/pddserver/controller/PddLocalController.java
+83
-101
PddOpenController.java
...n/java/org/ta/pddserver/controller/PddOpenController.java
+3
-2
PddHttpTool.java
...ver/src/main/java/org/ta/pddserver/utils/PddHttpTool.java
+5
-7
CommonTest.java
PddServer/src/test/java/org/ta/pddserver/CommonTest.java
+73
-78
LGTest2.java
PddServer/src/test/java/org/ta/pddserver/LGTest2.java
+9
-11
upload.json
PddServer/src/test/java/org/ta/pddserver/upload.json
+8
-5
No files found.
PddServer/src/main/java/org/ta/pddserver/config/PddAPIConfig.java
0 → 100644
View file @
afa547f2
package
org
.
ta
.
pddserver
.
config
;
public
class
PddAPIConfig
{
// 临沂海际韩国集运 生产环境参数
// 应用基础参数
public
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
public
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
// 基础API地址
public
static
final
String
URL
=
"https://ark-api.pinduoduo.com/ark/router"
;
// 工单API地址
public
static
final
String
URL_GD
=
"https://gw-api.pinduoduo.com/api/router"
;
// 临沂海际韩国集运 测试环境参数
// // 应用基础参数
// public static final String CLIENT_ID = "d0217707e1194c46b57e696ac7619a06";
// public static final String CLIENT_SECRET = "a5aba84483d8387030899f01276b06a194942470";
// // 基础API地址
// public static final String URL = "https://opengw-api.hutaojie.com/ark/router";
// // 工单API地址
// public static final String URL_GD = "https://opengw-api.hutaojie.com/api/router";
// 服务商编码 生产环境和测试环境一致
public
static
final
String
PROVIDER_CODE
=
"HAIJI_KR"
;
// 仓库编码 生产环境和测试环境一致
public
static
final
String
WAREHOUSE_CODE
=
"HJJY001"
;
// 分配快递编码 生产环境和测试环境一致
public
static
final
String
SHIP_ID
=
"567"
;
}
PddServer/src/main/java/org/ta/pddserver/controller/PddFZController.java
View file @
afa547f2
...
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServletResponse;
...
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServletResponse;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.mapper.TraceObjectMapper
;
import
org.ta.pddserver.mapper.TraceObjectMapper
;
import
org.ta.pddserver.model.pddjy.request.*
;
import
org.ta.pddserver.model.pddjy.request.*
;
...
@@ -33,12 +34,6 @@ import java.util.List;
...
@@ -33,12 +34,6 @@ import java.util.List;
@RestController
@RestController
public
class
PddFZController
{
public
class
PddFZController
{
private
static
final
String
PROVIDER_CODE
=
"HAIJI_KR"
;
private
static
final
String
WAREHOUSE_CODE
=
"HJJY001"
;
private
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
private
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
@Resource
@Resource
LogOrderMailDetailImpl
logOrderMailDetailImpl
;
LogOrderMailDetailImpl
logOrderMailDetailImpl
;
...
@@ -59,14 +54,14 @@ public class PddFZController {
...
@@ -59,14 +54,14 @@ public class PddFZController {
PddLogisticsCoTrackNotifyRequest
request
=
new
PddLogisticsCoTrackNotifyRequest
();
PddLogisticsCoTrackNotifyRequest
request
=
new
PddLogisticsCoTrackNotifyRequest
();
request
.
setClient_id
(
CLIENT_ID
);
request
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setShip_id
(
"567"
);
request
.
setShip_id
(
PddAPIConfig
.
SHIP_ID
);
request
.
setTarget_client_id
(
CLIENT_ID
);
request
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
PddLogisticsCoTrackNotifyRequest
.
DataObject
dataObject
=
getDataObject
(
code
);
PddLogisticsCoTrackNotifyRequest
.
DataObject
dataObject
=
getDataObject
(
code
);
request
.
setDataObject
(
dataObject
);
request
.
setDataObject
(
dataObject
);
request
.
encodeData
();
request
.
encodeData
();
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
CLIENT_SECRET
));
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
log
.
info
(
"resp = {}"
,
resp
);
log
.
info
(
"resp = {}"
,
resp
);
...
@@ -92,7 +87,7 @@ public class PddFZController {
...
@@ -92,7 +87,7 @@ public class PddFZController {
public
void
bizAction
(
@PathVariable
(
"mailNo"
)
String
mailNo
,
@PathVariable
(
"action"
)
String
action
)
{
public
void
bizAction
(
@PathVariable
(
"mailNo"
)
String
mailNo
,
@PathVariable
(
"action"
)
String
action
)
{
LogOrderMailDetailEntity
logOrderMailDetailEntity
=
logOrderMailDetailImpl
.
getByMailNo
(
mailNo
);
LogOrderMailDetailEntity
logOrderMailDetailEntity
=
logOrderMailDetailImpl
.
getByMailNo
(
mailNo
);
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
logOrderMailDetailEntity
.
getLogisticsOrderCode
());
notifyRequest
.
setLogisticsOrderCode
(
logOrderMailDetailEntity
.
getLogisticsOrderCode
());
...
@@ -122,11 +117,11 @@ public class PddFZController {
...
@@ -122,11 +117,11 @@ public class PddFZController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -141,7 +136,7 @@ public class PddFZController {
...
@@ -141,7 +136,7 @@ public class PddFZController {
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setLogisticsOrderCode
(
logOrderMailDetailEntity
.
getLogisticsOrderCode
());
notifyRequest
.
setLogisticsOrderCode
(
logOrderMailDetailEntity
.
getLogisticsOrderCode
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
...
@@ -167,11 +162,11 @@ public class PddFZController {
...
@@ -167,11 +162,11 @@ public class PddFZController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
...
PddServer/src/main/java/org/ta/pddserver/controller/PddGDController.java
View file @
afa547f2
...
@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.entity.GDAttachmentEntity
;
import
org.ta.pddserver.entity.GDAttachmentEntity
;
import
org.ta.pddserver.entity.GDReplyAttachmentEntity
;
import
org.ta.pddserver.entity.GDReplyAttachmentEntity
;
import
org.ta.pddserver.entity.GDReplyEntity
;
import
org.ta.pddserver.entity.GDReplyEntity
;
...
@@ -37,80 +38,6 @@ import java.util.*;
...
@@ -37,80 +38,6 @@ import java.util.*;
@Slf4j
@Slf4j
@RestController
@RestController
public
class
PddGDController
{
public
class
PddGDController
{
private
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
private
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
public
JSONObject
getTicketList
()
{
JSONObject
jsonObject
=
new
JSONObject
();
long
end
=
new
Date
().
getTime
()
/
1000
;
jsonObject
.
put
(
"end_updated_at"
,
end
);
jsonObject
.
put
(
"start_updated_at"
,
end
-
1800
);
jsonObject
.
put
(
"page"
,
1
);
jsonObject
.
put
(
"page_size"
,
100
);
jsonObject
.
put
(
"client_id"
,
CLIENT_ID
);
JYBaseRequestModel
requestModel
=
new
JYBaseRequestModel
();
requestModel
.
setRequest
(
JSON
.
toJSONString
(
jsonObject
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.logistics.ticket.get"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
requestModel
);
log
.
info
(
"resp = {}"
,
resp
);
JSONObject
respObj
=
JSON
.
parseObject
(
resp
);
int
count
=
respObj
.
getInteger
(
"total_count"
);
JSONArray
list
=
respObj
.
getJSONArray
(
"logistics_ticket_list"
);
if
(!
list
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
JSONObject
ticket
=
list
.
getJSONObject
(
i
);
GDTicketRepsonse
gdTicketRepsonse
=
ticket
.
toJavaObject
(
GDTicketRepsonse
.
class
);
// todo 保存数据
}
}
return
respObj
;
}
public
JSONObject
replyTicket
()
{
Long
ticketId
=
1L
;
String
waybill_no
=
"waybill_no"
;
GDTicketReplyRequest
replyRequest
=
new
GDTicketReplyRequest
();
replyRequest
.
setTicket_id
(
ticketId
);
replyRequest
.
setWaybill_no
(
waybill_no
);
replyRequest
.
setHandle_result
(
"无"
);
replyRequest
.
setSign_state
(
1
);
replyRequest
.
setCompensate_state
(
1
);
replyRequest
.
setDuty
(
0
);
replyRequest
.
setExpress_dealer
(
"XXX"
);
replyRequest
.
setExpress_dealer_contact
(
"18599877823"
);
replyRequest
.
setReply_type
(
1
);
JYBaseRequestModel
requestModel
=
new
JYBaseRequestModel
();
requestModel
.
setRequest
(
JSON
.
toJSONString
(
replyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.logistics.ticket.get"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
requestModel
);
log
.
info
(
"resp = {}"
,
resp
);
JSONObject
respObj
=
JSON
.
parseObject
(
resp
);
JSONObject
respObject
=
respObj
.
getJSONObject
(
"logistics_ticket_notify_response"
);
GDTicketReplyRepsonse
replyRepsonse
=
respObject
.
toJavaObject
(
GDTicketReplyRepsonse
.
class
);
log
.
info
(
"replyRepsonse is_success:{}"
,
replyRepsonse
.
getIs_success
());
return
respObj
;
}
@Resource
@Resource
GDTicketImpl
gdTicketImpl
;
GDTicketImpl
gdTicketImpl
;
...
@@ -154,13 +81,13 @@ public class PddGDController {
...
@@ -154,13 +81,13 @@ public class PddGDController {
/*上传图片*/
/*上传图片*/
@PostMapping
(
"/uploadImage"
)
@PostMapping
(
"/uploadImage"
)
public
JSONObject
uploadImage
(
HttpServletRequest
request
,
@RequestBody
GDUploadRequest
gdUploadRequest
)
throws
IOException
{
public
JSONObject
uploadImage
(
HttpServletRequest
request
,
@RequestBody
GDUploadRequest
gdUploadRequest
)
throws
IOException
{
gdUploadRequest
.
setClient_id
(
CLIENT_ID
);
gdUploadRequest
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
gdUploadRequest
.
setType
(
"pdd.logistics.ticket.image.upload"
);
gdUploadRequest
.
setType
(
"pdd.logistics.ticket.image.upload"
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
gdUploadRequest
.
setTimestamp
(
time
);
gdUploadRequest
.
setTimestamp
(
time
);
gdUploadRequest
.
setImage
(
new
ImageUtils
().
downloadCompressToBase64
(
gdUploadRequest
.
getImage
()));
gdUploadRequest
.
setImage
(
new
ImageUtils
().
downloadCompressToBase64
(
gdUploadRequest
.
getImage
()));
gdUploadRequest
.
setSign
(
PddSignTool
.
generateSign
(
gdUploadRequest
,
CLIENT_SECRET
));
gdUploadRequest
.
setSign
(
PddSignTool
.
generateSign
(
gdUploadRequest
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
gdUploadRequest
);
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
gdUploadRequest
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resp
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resp
);
...
@@ -196,12 +123,12 @@ public class PddGDController {
...
@@ -196,12 +123,12 @@ public class PddGDController {
String
attach_path_list
=
JSONArray
.
toJSONString
(
replyRequest
.
getAttach_path_list
());
String
attach_path_list
=
JSONArray
.
toJSONString
(
replyRequest
.
getAttach_path_list
());
replyRequest
.
setAttach_path_list
(
attach_path_list
);
replyRequest
.
setAttach_path_list
(
attach_path_list
);
replyRequest
.
setClient_id
(
CLIENT_ID
);
replyRequest
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
replyRequest
.
setType
(
"pdd.logistics.ticket.notify"
);
replyRequest
.
setType
(
"pdd.logistics.ticket.notify"
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
replyRequest
.
setTimestamp
(
time
);
replyRequest
.
setTimestamp
(
time
);
replyRequest
.
setSign
(
PddSignTool
.
generateSign
(
replyRequest
,
CLIENT_SECRET
));
replyRequest
.
setSign
(
PddSignTool
.
generateSign
(
replyRequest
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
replyRequest
);
String
resp
=
PddHttpTool
.
sendJsonPostGD
(
replyRequest
);
log
.
info
(
"resp = {}"
,
resp
);
log
.
info
(
"resp = {}"
,
resp
);
...
...
PddServer/src/main/java/org/ta/pddserver/controller/PddLocalController.java
View file @
afa547f2
...
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.model.api.request.*
;
import
org.ta.pddserver.model.api.request.*
;
import
org.ta.pddserver.model.api.response.*
;
import
org.ta.pddserver.model.api.response.*
;
...
@@ -49,17 +50,6 @@ public class PddLocalController {
...
@@ -49,17 +50,6 @@ public class PddLocalController {
@Resource
@Resource
PackageNoticeImpl
packageNoticeImpl
;
PackageNoticeImpl
packageNoticeImpl
;
private
static
final
String
PROVIDER_CODE
=
"HAIJI_KR"
;
private
static
final
String
WAREHOUSE_CODE
=
"HJJY001"
;
// 测试
// private static final String CLIENT_ID = "d0217707e1194c46b57e696ac7619a06";
// private static final String CLIENT_SECRET = "a5aba84483d8387030899f01276b06a194942470";
// 正式
private
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
private
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
@Resource
@Resource
private
CollectReceiverDetailImpl
collectReceiverDetailImpl
;
private
CollectReceiverDetailImpl
collectReceiverDetailImpl
;
@Resource
@Resource
...
@@ -71,7 +61,7 @@ public class PddLocalController {
...
@@ -71,7 +61,7 @@ public class PddLocalController {
/*集运单列表*/
/*集运单列表*/
@PostMapping
(
"/logOrderList"
)
@PostMapping
(
"/logOrderList"
)
public
JSONObject
logOrderList
(
HttpServletRequest
request
,
@RequestBody
LogOrderListRequest
logOrderListRequest
)
{
public
JSONObject
logOrderList
(
HttpServletRequest
request
,
@RequestBody
LogOrderListRequest
logOrderListRequest
)
{
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
logOrderImpl
.
getListByRequest
(
logOrderListRequest
));
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
logOrderImpl
.
getListByRequest
(
logOrderListRequest
));
}
}
/*包裹列表*/
/*包裹列表*/
...
@@ -98,15 +88,15 @@ public class PddLocalController {
...
@@ -98,15 +88,15 @@ public class PddLocalController {
@PostMapping
(
"/packageScan"
)
@PostMapping
(
"/packageScan"
)
public
Map
<
String
,
Object
>
packageScan
(
HttpServletRequest
request
,
@RequestBody
MailNoRequest
mailNoRequest
)
{
public
Map
<
String
,
Object
>
packageScan
(
HttpServletRequest
request
,
@RequestBody
MailNoRequest
mailNoRequest
)
{
List
<
LogOrderMailDetailEntity
>
list
=
logOrderMailDetailImpl
.
getListByCode
(
mailNoRequest
.
getMailNo
());
List
<
LogOrderMailDetailEntity
>
list
=
logOrderMailDetailImpl
.
getListByCode
(
mailNoRequest
.
getMailNo
());
if
(
list
.
isEmpty
())
{
if
(
list
.
isEmpty
())
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查上传信息"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查上传信息"
);
}
}
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
list
.
get
(
0
).
getLogisticsOrderCode
());
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
list
.
get
(
0
).
getLogisticsOrderCode
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"logOrder"
,
logOrderEntity
);
map
.
put
(
"logOrder"
,
logOrderEntity
);
map
.
put
(
"list"
,
list
);
map
.
put
(
"list"
,
list
);
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
map
);
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
map
);
}
}
...
@@ -189,7 +179,7 @@ public class PddLocalController {
...
@@ -189,7 +179,7 @@ public class PddLocalController {
String
action
=
receiveRequest
.
getAction
();
String
action
=
receiveRequest
.
getAction
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
...
@@ -210,7 +200,7 @@ public class PddLocalController {
...
@@ -210,7 +200,7 @@ public class PddLocalController {
notifyResult
.
setDesc
(
receiveRequest
.
getDesc
());
notifyResult
.
setDesc
(
receiveRequest
.
getDesc
());
notifyResult
.
setRemark
(
receiveRequest
.
getDesc
());
notifyResult
.
setRemark
(
receiveRequest
.
getDesc
());
if
(
receiveRequest
.
getLength
()
!=
null
&&
receiveRequest
.
getLength
()
>
0
)
{
if
(
receiveRequest
.
getLength
()
!=
null
&&
receiveRequest
.
getLength
()
>
0
)
{
notifyRequest
.
setPackageInfo
(
new
PddServiceConsoFirstBizActionNotifyRequest
.
PackageInfo
());
notifyRequest
.
setPackageInfo
(
new
PddServiceConsoFirstBizActionNotifyRequest
.
PackageInfo
());
notifyRequest
.
getPackageInfo
().
setWeight
(
receiveRequest
.
getWeight
());
notifyRequest
.
getPackageInfo
().
setWeight
(
receiveRequest
.
getWeight
());
...
@@ -234,11 +224,11 @@ public class PddLocalController {
...
@@ -234,11 +224,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
//更新log_order_mail_detail
//更新log_order_mail_detail
...
@@ -263,42 +253,38 @@ public class PddLocalController {
...
@@ -263,42 +253,38 @@ public class PddLocalController {
@PostMapping
(
"/inBound"
)
@PostMapping
(
"/inBound"
)
public
JSONObject
inBound
(
HttpServletRequest
request
,
@RequestBody
InBoundRequest
inBoundRequest
)
{
public
JSONObject
inBound
(
HttpServletRequest
request
,
@RequestBody
InBoundRequest
inBoundRequest
)
{
LogOrderMailDetailEntity
mailNoResponse
=
logOrderMailDetailImpl
.
getByMailNo
(
inBoundRequest
.
getMailNo
());
LogOrderMailDetailEntity
mailNoResponse
=
logOrderMailDetailImpl
.
getByMailNo
(
inBoundRequest
.
getMailNo
());
PddServiceConsoInboundRequest
notifyRequest
=
new
PddServiceConsoInboundRequest
();
PddServiceConsoInboundRequest
notifyRequest
=
new
PddServiceConsoInboundRequest
();
// 查询orderNO 下所有mailNo,判断是全部还是部分
// 查询orderNO 下所有mailNo,判断是全部还是部分
Long
unNum
=
logOrderMailDetailImpl
.
getSumByCodeStatus
(
mailNoResponse
.
getLogisticsOrderCode
(),
(
long
)
StatusEnum
.
SIGNED
.
getCode
());
Long
unNum
=
logOrderMailDetailImpl
.
getSumByCodeStatus
(
mailNoResponse
.
getLogisticsOrderCode
(),
(
long
)
StatusEnum
.
SIGNED
.
getCode
());
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
Long
num
=
(
long
)
logOrderEntity
.
getNum
();
Long
num
=
(
long
)
logOrderEntity
.
getNum
();
log
.
info
(
"已入库数量 {} ; 未入库数量 {}"
,
num
,
unNum
);
//判断是否存在入库信息
//判断是否存在入库信息
if
(
mailNoResponse
.
getStatus
()
!=
StatusEnum
.
INBOUND
.
getCode
())
{
if
(
mailNoResponse
.
getStatus
()
==
StatusEnum
.
INBOUND
.
getCode
())
{
//重复入库
//重复入库
notifyRequest
.
setPackageQuantity
(
num
);
// 已入库数量
mailNoResponse
.
setEnterTime
(
timeTool
.
getNowDate
());
mailNoResponse
.
setEnterTime
(
timeTool
.
getNowDate
());
mailNoResponse
.
setStatus
(
StatusEnum
.
INBOUND
.
getCode
());
}
else
{
num
+=
1
;
}
else
{
notifyRequest
.
setPackageQuantity
(
num
+
1
);
// 已入库数量 + 1
mailNoResponse
.
setEnterTime
(
timeTool
.
getNowDate
());
mailNoResponse
.
setEnterTime
(
timeTool
.
getNowDate
());
mailNoResponse
.
setStatus
(
StatusEnum
.
INBOUND
.
getCode
());
mailNoResponse
.
setStatus
(
StatusEnum
.
INBOUND
.
getCode
());
}
}
notifyRequest
.
setPackageQuantity
(
num
);
mailNoResponse
.
setLength
(
inBoundRequest
.
getLength
().
intValue
());
mailNoResponse
.
setLength
(
inBoundRequest
.
getLength
().
intValue
());
mailNoResponse
.
setWidth
(
inBoundRequest
.
getWidth
().
intValue
());
mailNoResponse
.
setWidth
(
inBoundRequest
.
getWidth
().
intValue
());
mailNoResponse
.
setHeight
(
inBoundRequest
.
getHeight
().
intValue
());
mailNoResponse
.
setHeight
(
inBoundRequest
.
getHeight
().
intValue
());
mailNoResponse
.
setWeight
(
inBoundRequest
.
getWeight
().
intValue
());
mailNoResponse
.
setWeight
(
inBoundRequest
.
getWeight
().
intValue
());
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
if
(
unNum
-
1
==
0
&&
notifyRequest
.
getPackageQuantity
()
>
num
){
if
(
notifyRequest
.
getPackageQuantity
()
==
num
)
{
notifyRequest
.
setStatus
(
"FULL_INBOUND"
);
notifyRequest
.
setStatus
(
"FULL_INBOUND"
);
}
else
{
}
else
{
notifyRequest
.
setStatus
(
"INBOUND"
);
notifyRequest
.
setStatus
(
"
PART_
INBOUND"
);
}
}
notifyRequest
.
setPackageInfo
(
new
PddServiceConsoInboundRequest
.
PackageInfo
());
notifyRequest
.
setPackageInfo
(
new
PddServiceConsoInboundRequest
.
PackageInfo
());
...
@@ -318,11 +304,11 @@ public class PddLocalController {
...
@@ -318,11 +304,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
LogOrderMailDetailIoEntity
logOrderMailDetailIoEntity
=
new
LogOrderMailDetailIoEntity
();
LogOrderMailDetailIoEntity
logOrderMailDetailIoEntity
=
new
LogOrderMailDetailIoEntity
();
...
@@ -344,10 +330,10 @@ public class PddLocalController {
...
@@ -344,10 +330,10 @@ public class PddLocalController {
logOrderEntity
.
setNum
(
notifyRequest
.
getPackageQuantity
().
intValue
());
logOrderEntity
.
setNum
(
notifyRequest
.
getPackageQuantity
().
intValue
());
//判断是否全部入库
//判断是否全部入库
if
(
unNum
-
1
==
0
&&
notifyRequest
.
getPackageQuantity
()
>
num
)
{
if
(
notifyRequest
.
getPackageQuantity
()
<=
num
)
{
//全部入库
//全部入库
logOrderEntity
.
setStatus
(
StatusEnum
.
FULLINBOUND
.
getCode
());
logOrderEntity
.
setStatus
(
StatusEnum
.
FULLINBOUND
.
getCode
());
}
else
{
}
else
{
logOrderEntity
.
setStatus
(
StatusEnum
.
PARTINBOUND
.
getCode
());
logOrderEntity
.
setStatus
(
StatusEnum
.
PARTINBOUND
.
getCode
());
}
}
...
@@ -372,19 +358,19 @@ public class PddLocalController {
...
@@ -372,19 +358,19 @@ public class PddLocalController {
Long
num
=
(
long
)
logOrderEntity
.
getNum
();
Long
num
=
(
long
)
logOrderEntity
.
getNum
();
// 查询orderNO 下所有mailNo,判断是全部还是部分
// 查询orderNO 下所有mailNo,判断是全部还是部分
Long
unNum
=
logOrderMailDetailImpl
.
getSumByCodeStatus
(
mailNoResponse
.
getLogisticsOrderCode
(),
(
long
)
StatusEnum
.
SIGNED
.
getCode
());
//
Long unNum = logOrderMailDetailImpl.getSumByCodeStatus(mailNoResponse.getLogisticsOrderCode(), (long) StatusEnum.SIGNED.getCode());
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
notifyRequest
.
setLogisticsOrderCode
(
mailNoResponse
.
getLogisticsOrderCode
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowDate
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowDate
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
if
(
unNum
>
1
)
{
if
(
num
>=
logOrderEntity
.
getPackageQuantity
().
intValue
())
{
//部分入库
//部分入库
notifyRequest
.
setStatus
(
"PART_INBOUND"
);
notifyRequest
.
setStatus
(
"PART_INBOUND"
);
logOrderEntity
.
setStatus
(
StatusEnum
.
PARTINBOUND
.
getCode
());
logOrderEntity
.
setStatus
(
StatusEnum
.
PARTINBOUND
.
getCode
());
}
else
{
}
else
{
//全部入库
//全部入库
notifyRequest
.
setStatus
(
"FULL_INBOUND"
);
notifyRequest
.
setStatus
(
"FULL_INBOUND"
);
logOrderEntity
.
setStatus
(
StatusEnum
.
FULLINBOUND
.
getCode
());
logOrderEntity
.
setStatus
(
StatusEnum
.
FULLINBOUND
.
getCode
());
...
@@ -411,11 +397,11 @@ public class PddLocalController {
...
@@ -411,11 +397,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -447,7 +433,7 @@ public class PddLocalController {
...
@@ -447,7 +433,7 @@ public class PddLocalController {
CollectOrderEntity
collectOrderEntity
=
new
CollectOrderEntity
();
CollectOrderEntity
collectOrderEntity
=
new
CollectOrderEntity
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
finishUnpackRequest
.
getOrderCode
());
notifyRequest
.
setOrderCode
(
finishUnpackRequest
.
getOrderCode
());
notifyRequest
.
setBizAction
(
finishUnpackRequest
.
getAction
());
notifyRequest
.
setBizAction
(
finishUnpackRequest
.
getAction
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowDate
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowDate
());
...
@@ -459,8 +445,8 @@ public class PddLocalController {
...
@@ -459,8 +445,8 @@ public class PddLocalController {
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
collectOrderEntity
==
null
)
{
if
(
collectOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
}
}
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
BEGINPICKERROR
.
getCode
());
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
BEGINPICKERROR
.
getCode
());
...
@@ -472,26 +458,26 @@ public class PddLocalController {
...
@@ -472,26 +458,26 @@ public class PddLocalController {
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
collectOrderEntity
==
null
)
{
if
(
collectOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
}
}
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHPICKERROR
.
getCode
());
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHPICKERROR
.
getCode
());
notifyRequest
.
setBizActionDesc
(
"拣货完成"
);
notifyRequest
.
setBizActionDesc
(
"拣货完成"
);
}
else
if
((
"finish_unpack"
).
equals
(
finishUnpackRequest
.
getAction
()))
{
}
else
if
((
"finish_unpack"
).
equals
(
finishUnpackRequest
.
getAction
()))
{
PackageNoticeEntity
packageNoticeEntity
=
packageNoticeImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
PackageNoticeEntity
packageNoticeEntity
=
packageNoticeImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
packageNoticeEntity
==
null
)
{
if
(
packageNoticeEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到拆包信息,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到拆包信息,请检查参数"
);
}
}
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
logOrderEntity
==
null
)
{
if
(
logOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到集运单信息,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到集运单信息,请检查参数"
);
}
}
...
@@ -501,7 +487,7 @@ public class PddLocalController {
...
@@ -501,7 +487,7 @@ public class PddLocalController {
notifyRequest
.
setPackageInfos
(
new
ArrayList
<>());
notifyRequest
.
setPackageInfos
(
new
ArrayList
<>());
for
(
FinishUnpackRequest
.
PackageInfo
lists:
finishUnpackRequest
.
getPackageInfo
())
{
for
(
FinishUnpackRequest
.
PackageInfo
lists
:
finishUnpackRequest
.
getPackageInfo
())
{
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
packageInfo
=
new
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
();
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
packageInfo
=
new
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
();
packageInfo
.
setWeight
(
lists
.
getWeight
());
packageInfo
.
setWeight
(
lists
.
getWeight
());
packageInfo
.
setWidth
(
lists
.
getWidth
());
packageInfo
.
setWidth
(
lists
.
getWidth
());
...
@@ -543,11 +529,11 @@ public class PddLocalController {
...
@@ -543,11 +529,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -584,7 +570,7 @@ public class PddLocalController {
...
@@ -584,7 +570,7 @@ public class PddLocalController {
String
action
=
finishUnpackRequest
.
getAction
();
String
action
=
finishUnpackRequest
.
getAction
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
finishUnpackRequest
.
getOrderCode
());
notifyRequest
.
setOrderCode
(
finishUnpackRequest
.
getOrderCode
());
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
...
@@ -600,8 +586,8 @@ public class PddLocalController {
...
@@ -600,8 +586,8 @@ public class PddLocalController {
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
collectOrderEntity
==
null
)
{
if
(
collectOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
}
}
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
BEGINPICK
.
getCode
());
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
BEGINPICK
.
getCode
());
...
@@ -612,8 +598,8 @@ public class PddLocalController {
...
@@ -612,8 +598,8 @@ public class PddLocalController {
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
collectOrderEntity
=
collectOrderImpl
.
getAllInfoByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
collectOrderEntity
==
null
)
{
if
(
collectOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"信息获取失败,请检查参数"
);
}
}
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHPICK
.
getCode
());
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHPICK
.
getCode
());
...
@@ -624,14 +610,14 @@ public class PddLocalController {
...
@@ -624,14 +610,14 @@ public class PddLocalController {
PackageNoticeEntity
packageNoticeEntity
=
packageNoticeImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
PackageNoticeEntity
packageNoticeEntity
=
packageNoticeImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
packageNoticeEntity
==
null
)
{
if
(
packageNoticeEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到拆包信息,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到拆包信息,请检查参数"
);
}
}
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
LogOrderEntity
logOrderEntity
=
logOrderImpl
.
getByOrderCode
(
finishUnpackRequest
.
getOrderCode
());
if
(
logOrderEntity
==
null
)
{
if
(
logOrderEntity
==
null
)
{
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到集运单信息,请检查参数"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"未查到集运单信息,请检查参数"
);
}
}
...
@@ -644,7 +630,7 @@ public class PddLocalController {
...
@@ -644,7 +630,7 @@ public class PddLocalController {
List
<
LogOrderPackageEntity
>
list
=
new
ArrayList
<>();
List
<
LogOrderPackageEntity
>
list
=
new
ArrayList
<>();
for
(
FinishUnpackRequest
.
PackageInfo
lists:
finishUnpackRequest
.
getPackageInfo
())
{
for
(
FinishUnpackRequest
.
PackageInfo
lists
:
finishUnpackRequest
.
getPackageInfo
())
{
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
packageInfo
=
new
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
();
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
packageInfo
=
new
PddServiceConsoCoBizActionNotifyRequest
.
PackageInfo
();
packageInfo
.
setWeight
(
lists
.
getWeight
());
packageInfo
.
setWeight
(
lists
.
getWeight
());
...
@@ -683,11 +669,11 @@ public class PddLocalController {
...
@@ -683,11 +669,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -716,7 +702,6 @@ public class PddLocalController {
...
@@ -716,7 +702,6 @@ public class PddLocalController {
}
}
/*通知拆包后拣货*/
/*通知拆包后拣货*/
@PostMapping
(
"/finishUnpackPackage"
)
@PostMapping
(
"/finishUnpackPackage"
)
public
JSONObject
finishUnpackPackage
(
HttpServletRequest
request
,
@RequestBody
FinishUnpackRequest
finishUnpackRequest
)
{
public
JSONObject
finishUnpackPackage
(
HttpServletRequest
request
,
@RequestBody
FinishUnpackRequest
finishUnpackRequest
)
{
...
@@ -737,7 +722,7 @@ public class PddLocalController {
...
@@ -737,7 +722,7 @@ public class PddLocalController {
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHUNPACK
.
getCode
());
logOrderMailDetailIoEntity
.
setStatus
(
StatusEnum
.
FINISHUNPACK
.
getCode
());
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
logOrderPackageEntity
.
getLogisticsOrderCode
());
notifyRequest
.
setOrderCode
(
logOrderPackageEntity
.
getLogisticsOrderCode
());
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
...
@@ -763,11 +748,11 @@ public class PddLocalController {
...
@@ -763,11 +748,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
logOrderMailDetailIoEntity
.
setReq
(
JSON
.
toJSONString
(
requestModel
));
logOrderMailDetailIoEntity
.
setReq
(
JSON
.
toJSONString
(
requestModel
));
...
@@ -804,9 +789,9 @@ public class PddLocalController {
...
@@ -804,9 +789,9 @@ public class PddLocalController {
List
<
OutBoundRequest
.
OutBoundList
>
toRemoveOutBound
=
new
ArrayList
<>();
List
<
OutBoundRequest
.
OutBoundList
>
toRemoveOutBound
=
new
ArrayList
<>();
for
(
CollectOutMailDetailResponse
lists:
list
)
{
for
(
CollectOutMailDetailResponse
lists
:
list
)
{
for
(
OutBoundRequest
.
OutBoundList
outBoundLists:
outBoundList
)
{
for
(
OutBoundRequest
.
OutBoundList
outBoundLists
:
outBoundList
)
{
if
(
lists
.
getMailNo
().
equals
(
outBoundLists
.
getMailNo
()))
{
if
(
lists
.
getMailNo
().
equals
(
outBoundLists
.
getMailNo
()))
{
toRemoveList
.
add
(
lists
);
toRemoveList
.
add
(
lists
);
toRemoveOutBound
.
add
(
outBoundLists
);
toRemoveOutBound
.
add
(
outBoundLists
);
}
}
...
@@ -816,17 +801,14 @@ public class PddLocalController {
...
@@ -816,17 +801,14 @@ public class PddLocalController {
list
.
removeAll
(
toRemoveList
);
list
.
removeAll
(
toRemoveList
);
outBoundList
.
removeAll
(
toRemoveOutBound
);
outBoundList
.
removeAll
(
toRemoveOutBound
);
if
(
list
.
size
()
>
0
||
outBoundList
.
size
()
>
0
)
{
if
(
list
.
size
()>
0
||
outBoundList
.
size
()
>
0
){
//出库信息与已存信息不匹配,无法出库
//出库信息与已存信息不匹配,无法出库
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"出库单数异常"
);
return
JsonResponse
.
generateLocalCommonFailedResponse
(
"-1"
,
"出库单数异常"
);
}
}
CollectOrderResponse
collectOrderResponse
=
collectOrderImpl
.
getByOrderCode
(
outBoundRequest
.
getOrderCode
());
CollectOrderResponse
collectOrderResponse
=
collectOrderImpl
.
getByOrderCode
(
outBoundRequest
.
getOrderCode
());
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
outBoundRequest
.
getOrderCode
());
notifyRequest
.
setOrderCode
(
outBoundRequest
.
getOrderCode
());
notifyRequest
.
setSegmentCode
(
collectOrderResponse
.
getSegmentCode
());
notifyRequest
.
setSegmentCode
(
collectOrderResponse
.
getSegmentCode
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
notifyRequest
.
setExecuteTime
(
timeTool
.
getNowString
());
...
@@ -877,11 +859,11 @@ public class PddLocalController {
...
@@ -877,11 +859,11 @@ public class PddLocalController {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
LogOrderMailDetailIoEntity
logOrderMailDetailIoEntity
=
new
LogOrderMailDetailIoEntity
();
LogOrderMailDetailIoEntity
logOrderMailDetailIoEntity
=
new
LogOrderMailDetailIoEntity
();
...
@@ -896,7 +878,7 @@ public class PddLocalController {
...
@@ -896,7 +878,7 @@ public class PddLocalController {
logOrderMailDetailIoImpl
.
save
(
logOrderMailDetailIoEntity
);
logOrderMailDetailIoImpl
.
save
(
logOrderMailDetailIoEntity
);
//更新collect_mail_detail
//更新collect_mail_detail
for
(
CollectOutMailDetailResponse
lists
:
list
)
{
for
(
CollectOutMailDetailResponse
lists
:
list
)
{
Boolean
result
=
collectMailDetailImpl
.
updateByMailNo
(
lists
.
getMailNo
(),
logOrderMailDetailIoEntity
.
getStatus
());
Boolean
result
=
collectMailDetailImpl
.
updateByMailNo
(
lists
.
getMailNo
(),
logOrderMailDetailIoEntity
.
getStatus
());
}
}
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
true
);
return
JsonResponse
.
generateLocalCommonSuccessResponse
(
true
);
...
...
PddServer/src/main/java/org/ta/pddserver/controller/PddOpenController.java
View file @
afa547f2
...
@@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServletRequest;
...
@@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServletRequest;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.entity.*
;
import
org.ta.pddserver.model.api.response.CollectOrderResponse
;
import
org.ta.pddserver.model.api.response.CollectOrderResponse
;
import
org.ta.pddserver.model.enums.IdentityErrorType
;
import
org.ta.pddserver.model.enums.IdentityErrorType
;
...
@@ -102,7 +103,7 @@ public class PddOpenController {
...
@@ -102,7 +103,7 @@ public class PddOpenController {
log
.
info
(
"Request:\n{}"
,
body
);
log
.
info
(
"Request:\n{}"
,
body
);
try
{
try
{
if
(!
PddSignTool
.
verifySignFromBody
(
body
,
"
281d79ad5117d20a51efb9e7b0d5f7ee336399b0
"
,
pdd_sign
))
{
if
(!
PddSignTool
.
verifySignFromBody
(
body
,
"
PddAPIConfig.CLIENT_SECRET
"
,
pdd_sign
))
{
log
.
error
(
"验签失败"
);
log
.
error
(
"验签失败"
);
}
}
switch
(
requestParam
.
getType
())
{
switch
(
requestParam
.
getType
())
{
...
@@ -294,7 +295,7 @@ public class PddOpenController {
...
@@ -294,7 +295,7 @@ public class PddOpenController {
// requestParam.getTarget_client_id(), requestParam.getClient_id(), requestParam.getSign(), requestParam.getTimestamp(), requestParam.getType()
// requestParam.getTarget_client_id(), requestParam.getClient_id(), requestParam.getSign(), requestParam.getTimestamp(), requestParam.getType()
// );
// );
if
(!
PddSignTool
.
verifyLGSign
(
requestParam
,
"4be28e29e58012b72b080431a8d47ec2ba7cab4d"
))
{
if
(!
PddSignTool
.
verifyLGSign
(
requestParam
,
PddAPIConfig
.
CLIENT_SECRET
))
{
log
.
error
(
"验签失败"
);
log
.
error
(
"验签失败"
);
}
}
String
body
=
getStringFromRequest
(
request
);
String
body
=
getStringFromRequest
(
request
);
...
...
PddServer/src/main/java/org/ta/pddserver/utils/PddHttpTool.java
View file @
afa547f2
...
@@ -8,6 +8,7 @@ import org.springframework.http.MediaType;
...
@@ -8,6 +8,7 @@ import org.springframework.http.MediaType;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.model.pddjy.request.JYBaseRequestModel
;
import
org.ta.pddserver.model.pddjy.request.JYBaseRequestModel
;
import
org.ta.pddserver.model.pddlg.request.LGBaseModel
;
import
org.ta.pddserver.model.pddlg.request.LGBaseModel
;
...
@@ -17,10 +18,7 @@ import java.util.Map;
...
@@ -17,10 +18,7 @@ import java.util.Map;
@Slf4j
@Slf4j
public
class
PddHttpTool
{
public
class
PddHttpTool
{
// private static final String URL = "https://opengw-api.hutaojie.com/ark/router";
// private static final String URL_GD = "https://opengw-api.hutaojie.com/api/router";
private
static
final
String
URL
=
"https://ark-api.pinduoduo.com/ark/router"
;
private
static
final
String
URL_GD
=
"https://gw-api.pinduoduo.com/api/router"
;
public
static
String
postRequest
(
JYBaseRequestModel
request
)
{
public
static
String
postRequest
(
JYBaseRequestModel
request
)
{
...
@@ -34,7 +32,7 @@ public class PddHttpTool {
...
@@ -34,7 +32,7 @@ public class PddHttpTool {
HttpEntity
<
MultiValueMap
<
String
,
String
>>
requestEntity
=
new
HttpEntity
<
MultiValueMap
<
String
,
String
>>(
params
,
headers
);
HttpEntity
<
MultiValueMap
<
String
,
String
>>
requestEntity
=
new
HttpEntity
<
MultiValueMap
<
String
,
String
>>(
params
,
headers
);
// 3. 发送 POST 请求,获取响应
// 3. 发送 POST 请求,获取响应
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
URL
,
requestEntity
,
String
.
class
);
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
PddAPIConfig
.
URL
,
requestEntity
,
String
.
class
);
// 4. 返回响应体(根据实际需求处理响应状态码、响应头)
// 4. 返回响应体(根据实际需求处理响应状态码、响应头)
return
response
.
getBody
();
return
response
.
getBody
();
...
@@ -50,7 +48,7 @@ public class PddHttpTool {
...
@@ -50,7 +48,7 @@ public class PddHttpTool {
// 2. 封装请求实体(参数 + 头信息)
// 2. 封装请求实体(参数 + 头信息)
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
URL
,
requestEntity
,
String
.
class
);
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
PddAPIConfig
.
URL
,
requestEntity
,
String
.
class
);
log
.
info
(
"RESP:{}"
,
resp
.
getBody
());
log
.
info
(
"RESP:{}"
,
resp
.
getBody
());
return
resp
.
getBody
();
return
resp
.
getBody
();
}
}
...
@@ -65,7 +63,7 @@ public class PddHttpTool {
...
@@ -65,7 +63,7 @@ public class PddHttpTool {
// 2. 封装请求实体(参数 + 头信息)
// 2. 封装请求实体(参数 + 头信息)
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
URL_GD
,
requestEntity
,
String
.
class
);
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
PddAPIConfig
.
URL_GD
,
requestEntity
,
String
.
class
);
log
.
info
(
"RESP:{}"
,
resp
.
getBody
());
log
.
info
(
"RESP:{}"
,
resp
.
getBody
());
return
resp
.
getBody
();
return
resp
.
getBody
();
}
}
...
...
PddServer/src/test/java/org/ta/pddserver/CommonTest.java
View file @
afa547f2
...
@@ -3,6 +3,7 @@ package org.ta.pddserver;
...
@@ -3,6 +3,7 @@ package org.ta.pddserver;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.model.enums.OrderProblemType
;
import
org.ta.pddserver.model.enums.OrderProblemType
;
import
org.ta.pddserver.model.pddjy.request.*
;
import
org.ta.pddserver.model.pddjy.request.*
;
import
org.ta.pddserver.model.pddjy.response.PddServiceConsoDerelictionResponse
;
import
org.ta.pddserver.model.pddjy.response.PddServiceConsoDerelictionResponse
;
...
@@ -16,12 +17,6 @@ import java.util.Date;
...
@@ -16,12 +17,6 @@ import java.util.Date;
@Slf4j
@Slf4j
public
class
CommonTest
{
public
class
CommonTest
{
private
static
final
String
PROVIDER_CODE
=
"HAIJI_KR"
;
private
static
final
String
WAREHOUSE_CODE
=
"HJJY001"
;
private
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
private
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
private
String
firstLogisticsOrderCode
=
"PC25110715653142530023271"
;
private
String
firstLogisticsOrderCode
=
"PC25110715653142530023271"
;
private
static
String
getNowString
()
{
private
static
String
getNowString
()
{
...
@@ -33,7 +28,7 @@ public class CommonTest {
...
@@ -33,7 +28,7 @@ public class CommonTest {
@Test
@Test
public
void
Test1
()
{
public
void
Test1
()
{
PddServiceConsoDerelictionRequest
derelictionRequest
=
new
PddServiceConsoDerelictionRequest
();
PddServiceConsoDerelictionRequest
derelictionRequest
=
new
PddServiceConsoDerelictionRequest
();
derelictionRequest
.
setProviderCode
(
PROVIDER_CODE
);
derelictionRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
derelictionRequest
.
setExecuteTime
(
"2025-10-23 14:53:22"
);
derelictionRequest
.
setExecuteTime
(
"2025-10-23 14:53:22"
);
derelictionRequest
.
setTimeZone
(
"UTC+8"
);
derelictionRequest
.
setTimeZone
(
"UTC+8"
);
derelictionRequest
.
setMailNo
(
"2343534632"
);
derelictionRequest
.
setMailNo
(
"2343534632"
);
...
@@ -44,11 +39,11 @@ public class CommonTest {
...
@@ -44,11 +39,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
derelictionRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
derelictionRequest
));
requestModel
.
setRequest_id
(
"111"
);
requestModel
.
setRequest_id
(
"111"
);
requestModel
.
setType
(
"pdd.service.conso.dereliction"
);
requestModel
.
setType
(
"pdd.service.conso.dereliction"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -58,7 +53,7 @@ public class CommonTest {
...
@@ -58,7 +53,7 @@ public class CommonTest {
@Test
@Test
public
void
Test2
()
{
public
void
Test2
()
{
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
"2025-10-23 14:53:22"
);
notifyRequest
.
setExecuteTime
(
"2025-10-23 14:53:22"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
"xx198985333"
);
notifyRequest
.
setLogisticsOrderCode
(
"xx198985333"
);
...
@@ -75,11 +70,11 @@ public class CommonTest {
...
@@ -75,11 +70,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
"111"
);
requestModel
.
setRequest_id
(
"111"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -96,7 +91,7 @@ public class CommonTest {
...
@@ -96,7 +91,7 @@ public class CommonTest {
String
expressCode
=
"SF"
;
String
expressCode
=
"SF"
;
String
action
=
"warehouse_sign"
;
String
action
=
"warehouse_sign"
;
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
...
@@ -125,11 +120,11 @@ public class CommonTest {
...
@@ -125,11 +120,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -145,7 +140,7 @@ public class CommonTest {
...
@@ -145,7 +140,7 @@ public class CommonTest {
String
expressCode
=
"STO"
;
String
expressCode
=
"STO"
;
String
action
=
"warehouse_reject_sign"
;
String
action
=
"warehouse_reject_sign"
;
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
...
@@ -181,11 +176,11 @@ public class CommonTest {
...
@@ -181,11 +176,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -204,7 +199,7 @@ public class CommonTest {
...
@@ -204,7 +199,7 @@ public class CommonTest {
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
// notifyRequest.setExecuteTime("2025-05-04 00:00:00");
// notifyRequest.setExecuteTime("2025-05-04 00:00:00");
...
@@ -232,11 +227,11 @@ public class CommonTest {
...
@@ -232,11 +227,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -251,7 +246,7 @@ public class CommonTest {
...
@@ -251,7 +246,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
action
=
"begin_pick"
;
String
action
=
"begin_pick"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -280,11 +275,11 @@ public class CommonTest {
...
@@ -280,11 +275,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -299,7 +294,7 @@ public class CommonTest {
...
@@ -299,7 +294,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
action
=
"finish_pick"
;
String
action
=
"finish_pick"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -318,11 +313,11 @@ public class CommonTest {
...
@@ -318,11 +313,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -344,7 +339,7 @@ public class CommonTest {
...
@@ -344,7 +339,7 @@ public class CommonTest {
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -420,11 +415,11 @@ public class CommonTest {
...
@@ -420,11 +415,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -439,7 +434,7 @@ public class CommonTest {
...
@@ -439,7 +434,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110415653142528037527"
;
String
LogisticsOrderCode
=
"PP25110415653142528037527"
;
String
action
=
"finish_unpack"
;
String
action
=
"finish_unpack"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -470,11 +465,11 @@ public class CommonTest {
...
@@ -470,11 +465,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -490,7 +485,7 @@ public class CommonTest {
...
@@ -490,7 +485,7 @@ public class CommonTest {
String
expressCode
=
"STO"
;
String
expressCode
=
"STO"
;
String
dereRecogCode
=
"51103HHF52832"
;
String
dereRecogCode
=
"51103HHF52832"
;
PddServiceConsoDerelictionRequest
notifyRequest
=
new
PddServiceConsoDerelictionRequest
();
PddServiceConsoDerelictionRequest
notifyRequest
=
new
PddServiceConsoDerelictionRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setMailNo
(
mailNo
);
notifyRequest
.
setMailNo
(
mailNo
);
...
@@ -502,11 +497,11 @@ public class CommonTest {
...
@@ -502,11 +497,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.dereliction"
);
requestModel
.
setType
(
"pdd.service.conso.dereliction"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -524,7 +519,7 @@ public class CommonTest {
...
@@ -524,7 +519,7 @@ public class CommonTest {
String
mailNo
=
"773838955577767"
;
String
mailNo
=
"773838955577767"
;
String
expressCode
=
"STO"
;
String
expressCode
=
"STO"
;
PddServiceConsoProblemOrderNotifyRequest
notifyRequest
=
new
PddServiceConsoProblemOrderNotifyRequest
();
PddServiceConsoProblemOrderNotifyRequest
notifyRequest
=
new
PddServiceConsoProblemOrderNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setMailInfos
(
new
ArrayList
<>());
notifyRequest
.
setMailInfos
(
new
ArrayList
<>());
...
@@ -540,11 +535,11 @@ public class CommonTest {
...
@@ -540,11 +535,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.problem.order.notify"
);
requestModel
.
setType
(
"pdd.service.conso.problem.order.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -572,7 +567,7 @@ public class CommonTest {
...
@@ -572,7 +567,7 @@ public class CommonTest {
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -631,11 +626,11 @@ public class CommonTest {
...
@@ -631,11 +626,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -651,7 +646,7 @@ public class CommonTest {
...
@@ -651,7 +646,7 @@ public class CommonTest {
String
expressCode
=
"STO"
;
String
expressCode
=
"STO"
;
String
action
=
"destroy"
;
String
action
=
"destroy"
;
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
PddServiceConsoFirstBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoFirstBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setTimeZone
(
"UTC+8"
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
...
@@ -680,11 +675,11 @@ public class CommonTest {
...
@@ -680,11 +675,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.first.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -703,7 +698,7 @@ public class CommonTest {
...
@@ -703,7 +698,7 @@ public class CommonTest {
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
// PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setLogisticsOrderCode
(
firstLogisticsOrderCode
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
// notifyRequest.setExecuteTime("2025-05-04 00:00:00");
// notifyRequest.setExecuteTime("2025-05-04 00:00:00");
...
@@ -733,11 +728,11 @@ public class CommonTest {
...
@@ -733,11 +728,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setType
(
"pdd.service.conso.inbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -752,7 +747,7 @@ public class CommonTest {
...
@@ -752,7 +747,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
action
=
"begin_pick"
;
String
action
=
"begin_pick"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -775,11 +770,11 @@ public class CommonTest {
...
@@ -775,11 +770,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -794,7 +789,7 @@ public class CommonTest {
...
@@ -794,7 +789,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
LogisticsOrderCode
=
"PP25110414221207143137527"
;
String
action
=
"finish_pick"
;
String
action
=
"finish_pick"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -815,11 +810,11 @@ public class CommonTest {
...
@@ -815,11 +810,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -840,7 +835,7 @@ public class CommonTest {
...
@@ -840,7 +835,7 @@ public class CommonTest {
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
PddServiceConsoOutboundRequest
notifyRequest
=
new
PddServiceConsoOutboundRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setOrderCode
(
orderCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setSegmentCode
(
segmentCode
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -890,11 +885,11 @@ public class CommonTest {
...
@@ -890,11 +885,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setType
(
"pdd.service.conso.outbound"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
@@ -909,7 +904,7 @@ public class CommonTest {
...
@@ -909,7 +904,7 @@ public class CommonTest {
String
LogisticsOrderCode
=
"PP25110415653142528037527"
;
String
LogisticsOrderCode
=
"PP25110415653142528037527"
;
String
action
=
"finish_unpack"
;
String
action
=
"finish_unpack"
;
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
PddServiceConsoCoBizActionNotifyRequest
notifyRequest
=
new
PddServiceConsoCoBizActionNotifyRequest
();
notifyRequest
.
setProviderCode
(
PROVIDER_CODE
);
notifyRequest
.
setProviderCode
(
P
ddAPIConfig
.
P
ROVIDER_CODE
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setOrderCode
(
LogisticsOrderCode
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setBizAction
(
action
);
notifyRequest
.
setExecuteTime
(
getNowString
());
notifyRequest
.
setExecuteTime
(
getNowString
());
...
@@ -942,11 +937,11 @@ public class CommonTest {
...
@@ -942,11 +937,11 @@ public class CommonTest {
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest
(
JSON
.
toJSONString
(
notifyRequest
));
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setRequest_id
(
""
+
new
Date
().
getTime
());
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setType
(
"pdd.service.conso.co.biz.action.notify"
);
requestModel
.
setTarget_client_id
(
CLIENT_ID
);
requestModel
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
requestModel
.
setClient_id
(
CLIENT_ID
);
requestModel
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
long
time
=
new
Date
().
getTime
()
/
1000
;
long
time
=
new
Date
().
getTime
()
/
1000
;
requestModel
.
setTimestamp
(
time
);
requestModel
.
setTimestamp
(
time
);
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
CLIENT_SECRET
));
requestModel
.
setSign
(
PddSignTool
.
generateSign
(
requestModel
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
requestModel
));
// String resp = PddHttpTool.postRequest(requestModel);
// String resp = PddHttpTool.postRequest(requestModel);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
requestModel
);
...
...
PddServer/src/test/java/org/ta/pddserver/LGTest2.java
View file @
afa547f2
...
@@ -3,6 +3,7 @@ package org.ta.pddserver;
...
@@ -3,6 +3,7 @@ package org.ta.pddserver;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.ta.pddserver.config.PddAPIConfig
;
import
org.ta.pddserver.model.pddlg.common.TraceObject
;
import
org.ta.pddserver.model.pddlg.common.TraceObject
;
import
org.ta.pddserver.model.pddlg.request.PddLogisticsCoTrackNotifyRequest
;
import
org.ta.pddserver.model.pddlg.request.PddLogisticsCoTrackNotifyRequest
;
import
org.ta.pddserver.model.pddlg.request.PddLogisticsSecondaryCityGetRequest
;
import
org.ta.pddserver.model.pddlg.request.PddLogisticsSecondaryCityGetRequest
;
...
@@ -15,20 +16,17 @@ import java.util.ArrayList;
...
@@ -15,20 +16,17 @@ import java.util.ArrayList;
@Slf4j
@Slf4j
public
class
LGTest2
{
public
class
LGTest2
{
private
static
final
String
CLIENT_ID
=
"8f5f3f9c92e847b2894fc9c0afce3d61"
;
private
static
final
String
CLIENT_SECRET
=
"281d79ad5117d20a51efb9e7b0d5f7ee336399b0"
;
@Test
@Test
public
void
test1
()
{
public
void
test1
()
{
PddLogisticsCoTrackNotifyRequest
request
=
new
PddLogisticsCoTrackNotifyRequest
();
PddLogisticsCoTrackNotifyRequest
request
=
new
PddLogisticsCoTrackNotifyRequest
();
request
.
setClient_id
(
CLIENT_ID
);
request
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setShip_id
(
"567"
);
request
.
setShip_id
(
PddAPIConfig
.
SHIP_ID
);
request
.
setTarget_client_id
(
CLIENT_ID
);
request
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
PddLogisticsCoTrackNotifyRequest
.
DataObject
dataObject
=
getDataObject
();
PddLogisticsCoTrackNotifyRequest
.
DataObject
dataObject
=
getDataObject
();
request
.
setDataObject
(
dataObject
);
request
.
setDataObject
(
dataObject
);
request
.
encodeData
();
request
.
encodeData
();
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
CLIENT_SECRET
));
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
log
.
info
(
"resp = {}"
,
resp
);
log
.
info
(
"resp = {}"
,
resp
);
...
@@ -39,11 +37,11 @@ public class LGTest2 {
...
@@ -39,11 +37,11 @@ public class LGTest2 {
@Test
@Test
public
void
test2
()
{
public
void
test2
()
{
PddLogisticsSecondaryCityGetRequest
request
=
new
PddLogisticsSecondaryCityGetRequest
();
PddLogisticsSecondaryCityGetRequest
request
=
new
PddLogisticsSecondaryCityGetRequest
();
request
.
setClient_id
(
CLIENT_ID
);
request
.
setClient_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setShip_id
(
"567"
);
request
.
setShip_id
(
PddAPIConfig
.
SHIP_ID
);
request
.
setTarget_client_id
(
CLIENT_ID
);
request
.
setTarget_client_id
(
PddAPIConfig
.
CLIENT_ID
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
request
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
CLIENT_SECRET
));
request
.
setSign
(
PddSignTool
.
generateSign
(
request
,
PddAPIConfig
.
CLIENT_SECRET
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"requestModel:{}"
,
JSON
.
toJSONString
(
request
));
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
String
resp
=
PddHttpTool
.
sendJsonPost
(
request
);
log
.
info
(
"resp = {}"
,
resp
);
log
.
info
(
"resp = {}"
,
resp
);
...
...
PddServer/src/test/java/org/ta/pddserver/upload.json
View file @
afa547f2
{
{
"logistics_ticket_image_upload_response"
:
{
"client_id"
:
"8f5f3f9c92e847b2894fc9c0afce3d61"
,
"image_url"
:
"https://img-test.pddpic.com/open-gw/2066d9194a/de1e9e6a5adaee930456e4e521a6dcb2.jpg"
,
"request"
:
"{
\"
executeTime
\"
:
\"
2025-11-08 14:05:00
\"
,
\"
logisticsOrderCode
\"
:
\"
PC25110715653142530023271
\"
,
\"
packageInfo
\"
:{
\"
actualWeight
\"
:1000,
\"
expressCode
\"
:
\"
SF
\"
,
\"
goodsType
\"
:
\"
NORMAL
\"
,
\"
height
\"
:30,
\"
length
\"
:30,
\"
mailNo
\"
:
\"
SF3270717746148
\"
,
\"
weight
\"
:1000,
\"
width
\"
:30},
\"
packageQuantity
\"
:0,
\"
providerCode
\"
:
\"
HAIJI_KR
\"
,
\"
result
\"
:{
\"
code
\"
:0},
\"
status
\"
:
\"
INBOUND
\"
,
\"
timeZone
\"
:
\"
UTC+8
\"
}"
,
"request_id"
:
"17617922025930615"
"request_id"
:
"1762581900446"
,
}
"sign"
:
"07404C9CEE97F481CE968AA9299509C7"
,
"target_client_id"
:
"8f5f3f9c92e847b2894fc9c0afce3d61"
,
"timestamp"
:
1762581900
,
"type"
:
"pdd.service.conso.inbound"
}
}
\ No newline at end of file
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