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
zhuyifan
2025-02-26 18:24:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
565df6f655b67fb988354c9b30795752e09b6e32
565df6f6
1 parent
f5f41162
支付中
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
src/main/java/com/infoloop/tianting/controller/PayController.java
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
src/main/java/com/infoloop/tianting/controller/PayController.java
View file @
565df6f
...
...
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
...
...
@@ -31,7 +32,7 @@ public class PayController {
private
final
PayServiceClient
payServiceClient
;
@SaIgnore
@ApiOperation
(
value
=
"支付"
)
@ApiOperation
(
value
=
"支付
信息
"
)
@PostMapping
(
"/pay/inform"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
PayResponseDto
pay
(
@Valid
@RequestBody
PayDTO
.
PayInformRequestDto
payInformRequestDto
)
{
...
...
@@ -39,6 +40,14 @@ public class PayController {
}
@SaIgnore
@ApiOperation
(
value
=
"支付中"
)
@PostMapping
(
"/order/{orderId}/pay/waiting"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
boolean
waiting
(
@PathVariable
(
"orderId"
)
Integer
orderId
)
{
return
payServiceClient
.
waiting
(
orderId
);
}
@SaIgnore
@ApiOperation
(
value
=
"支付通知"
)
@PostMapping
(
value
=
"/pay/callback"
)
@ResponseStatus
(
HttpStatus
.
OK
)
...
...
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
View file @
565df6f
...
...
@@ -116,7 +116,7 @@ public class PayServiceClient {
log
.
error
(
"Order not found, orderId: {}"
,
orderId
);
return
false
;
}
if
(
orderById
.
getPayStatus
()
==
PayStatusEnum
.
SUCCEED
||
orderById
.
getPayStatus
()
==
PayStatusEnum
.
FAILED
)
{
if
(
orderById
.
getPayStatus
()
!=
PayStatusEnum
.
IN_PROGRESS
)
{
log
.
info
(
"Order {} already processed, skipping."
,
orderId
);
return
true
;
}
...
...
@@ -155,4 +155,23 @@ public class PayServiceClient {
throw
new
RuntimeException
(
"支付通知处理失败"
,
e
);
}
}
public
boolean
waiting
(
Integer
orderId
)
{
final
var
orderById
=
orderServiceRpcClient
.
getOrderById
(
orderId
);
if
(
orderById
==
null
)
{
log
.
error
(
"waiting Order not found, orderId: {}"
,
orderId
);
return
false
;
}
if
(
orderById
.
getPayStatus
()
!=
PayStatusEnum
.
TO_PAY
)
{
log
.
info
(
"waiting Order {} already processed, skipping."
,
orderId
);
return
false
;
}
final
var
build
=
ClientCustomerOrderModification
.
newBuilder
()
.
setId
(
orderId
)
.
setShouldUpdatePayStatus
(
true
).
setPayStatus
(
PayStatusEnum
.
IN_PROGRESS
)
.
build
();
final
var
updateResponse
=
orderServiceRpcClient
.
updateClientCustomerOrderPaymentResult
(
orderById
,
build
);
log
.
info
(
"waiting updateClientCustomerOrder result: {}"
,
updateResponse
.
getIsUpdated
());
return
updateResponse
.
getIsUpdated
();
}
}
...
...
Please
register
or
login
to post a comment