Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangyingyang
2025-03-14 16:42:06 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
704e643723abfe488e4fb3678ec3dd117ea046a8
704e6437
1 parent
5c58d612
fix
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
src/main/java/com/infoloop/tianting/exception/ErrorCodeEnum.java
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
src/main/java/com/infoloop/tianting/exception/ErrorCodeEnum.java
View file @
704e643
...
...
@@ -34,7 +34,9 @@ public enum ErrorCodeEnum implements BaseEnum {
SKUS_STOCK_NO_ENOUGH_TODAY
(
406000008
,
"下单菜品: {0} 库存不足"
),
ORDER_CANCEL
(
406000009
,
"订单已自动取消"
)
ORDER_CANCEL
(
406000009
,
"订单已自动取消"
),
ORDER_PAY_CANCEL_FAILED
(
406000010
,
"支付撤销失败"
)
;
private
final
int
code
;
...
...
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
View file @
704e643
...
...
@@ -373,15 +373,16 @@ public class PayServiceClient {
// RequestBody body = RequestBody.create(mediaType, jsonDataString);
String
url
=
businessConfig
.
getCancelPayUrl
()
+
"?"
+
"appid="
+
appId
+
"&paycontent="
+
payContent
+
"&signinfo="
+
signInfo
;
log
.
info
(
"cancel order pay url:"
+
url
);
Request
request
=
new
Request
.
Builder
().
url
(
url
).
get
().
build
();
Response
payResponse
=
client
.
newCall
(
request
).
execute
();
if
(
payResponse
.
code
()
!=
200
)
{
log
.
error
(
"cancel order pay failed, resp http code:"
+
payResponse
.
code
());
return
false
;
}
String
cancelPayJsonData
=
payResponse
.
body
().
string
();
log
.
info
(
"
pay json
:"
+
cancelPayJsonData
);
log
.
info
(
"
cancel order pay resp
:"
+
cancelPayJsonData
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
objectMapper
.
configure
(
Feature
.
ALLOW_MISSING_VALUES
,
true
);
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
...
...
@@ -391,7 +392,8 @@ public class PayServiceClient {
objectMapper
.
readValue
(
cancelPayJsonData
,
CancelPayResponseDto
.
class
);
if
(
payResponseDto
.
getCode
()
!=
0
)
{
return
false
;
log
.
error
(
"cancel order pay failed, resp code:"
+
payResponseDto
.
getCode
());
throw
ClientEndExceptions
.
BusinessException
.
build
(
ErrorCodeEnum
.
ORDER_PAY_CANCEL_FAILED
);
}
else
{
// 更新订单撤销状态
final
var
build
=
...
...
@@ -404,8 +406,8 @@ public class PayServiceClient {
return
true
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
get
StackTrace
().
toString
());
return
false
;
log
.
error
(
e
.
get
Message
());
throw
ClientEndExceptions
.
BusinessException
.
build
(
ErrorCodeEnum
.
ORDER_PAY_CANCEL_FAILED
)
;
}
}
}
...
...
Please
register
or
login
to post a comment