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-11-17 11:10:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a3002524f9413c4bd4eb398c2ec114ece373fd5e
a3002524
1 parent
e63c3acb
feat(order): add support for partial order refund and not serve status
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
src/main/java/com/infoloop/tianting/controller/PayController.java
src/main/java/com/infoloop/tianting/model/dto/PayDTO.java
src/main/java/com/infoloop/tianting/service/client/OrderServiceRpcClient.java
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
src/main/java/com/infoloop/tianting/controller/PayController.java
View file @
a300252
...
...
@@ -60,4 +60,5 @@ public class PayController {
public
String
cancel
(
@Valid
@RequestBody
PayDTO
.
PayRefundRequestDto
payRefundRequestDto
)
{
return
payServiceClient
.
orderPayRefund
(
payRefundRequestDto
);
}
}
\ No newline at end of file
...
...
src/main/java/com/infoloop/tianting/model/dto/PayDTO.java
View file @
a300252
...
...
@@ -9,6 +9,8 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@ApiModel
(
description
=
"支付DTO"
)
public
class
PayDTO
{
...
...
@@ -31,6 +33,7 @@ public class PayDTO {
@AllArgsConstructor
public
static
class
PayRefundRequestDto
{
private
Integer
orderId
;
private
List
<
Integer
>
orderDetailIds
;
private
String
hospitalCode
;
}
...
...
src/main/java/com/infoloop/tianting/service/client/OrderServiceRpcClient.java
View file @
a300252
...
...
@@ -240,6 +240,7 @@ public class OrderServiceRpcClient {
final
var
operator
=
operatorServiceRpcClient
.
getCOperatorById
(
operatorLoginInfo
.
getId
());
final
var
idsOfNeedUpdateMenuDetails
=
new
ArrayList
<
Integer
>();
final
var
idsOfAddCount
=
new
ArrayList
<
Integer
>();
final
var
idsOfNoReject
=
new
ArrayList
<
Integer
>();
List
<
OrderDetailDto
>
originalOrderDetails
=
new
ArrayList
<>();
List
<
OrderDetailDto
>
newOrderDetails
;
final
var
modifications
=
orderDetailBatchUpdateDto
.
getDetails
().
stream
().
map
(
d
->
{
...
...
@@ -280,9 +281,11 @@ public class OrderServiceRpcClient {
.
build
();
}
}
ServeStatusEnum
serveStatus
=
ServeStatusEnum
.
UNKNOWN_SERVE_STATUS
;
if
(
d
.
getShouldUpdateServeStatus
())
{
if
(
d
.
getServeStatus
()
==
ServeStatusEnum
.
SERVE_REJECT
)
{
idsOfNoReject
.
add
(
d
.
getId
());
}
serveStatus
=
d
.
getServeStatus
();
}
Integer
count
=
0
;
...
...
@@ -319,7 +322,8 @@ public class OrderServiceRpcClient {
.
build
();
final
var
totalIds
=
new
ArrayList
<>(
idsOfNeedUpdateMenuDetails
);
totalIds
.
addAll
(
idsOfAddCount
);
if
(!
idsOfNeedUpdateMenuDetails
.
isEmpty
()
||
!
idsOfAddCount
.
isEmpty
())
{
totalIds
.
addAll
(
idsOfNoReject
);
if
(!
totalIds
.
isEmpty
())
{
final
var
orgionalResponseList
=
getClientCustomerOrderDetailsByIds
(
totalIds
);
originalOrderDetails
=
orgionalResponseList
.
stream
().
map
(
d
->
OrderDetailDto
.
builder
()
.
id
(
d
.
getId
())
...
...
@@ -357,7 +361,7 @@ public class OrderServiceRpcClient {
}
final
var
res
=
orderServiceRpcBlockingStub
.
batchUpdateClientCustomerOrderDetails
(
request
);
if
(
res
.
getIsUpdated
())
{
if
(!
idsOfNeedUpdateMenuDetails
.
isEmpty
()
||
!
idsOfAddCount
.
isEmpty
())
{
if
(!
totalIds
.
isEmpty
())
{
final
var
newResponseList
=
getClientCustomerOrderDetailsByIds
(
totalIds
);
newOrderDetails
=
newResponseList
.
stream
().
map
(
d
->
OrderDetailDto
.
builder
()
...
...
@@ -396,7 +400,7 @@ public class OrderServiceRpcClient {
// 替换菜品的操作记录
List
<
SingleOperationDto
>
operations
=
new
ArrayList
<>();
for
(
OrderDetailDto
originalDetail
:
originalOrderDetails
)
{
if
(!
idsOfNeedUpdateMenuDetails
.
contains
(
originalDetail
.
getId
())
&&
!
idsOfAddCount
.
contains
(
originalDetail
.
getId
()))
{
if
(!
totalIds
.
contains
(
originalDetail
.
getId
()))
{
continue
;
}
OrderOperationType
orderOperationType
=
OrderOperationType
.
UNKNOWN_OPERATION_TYPE
;
...
...
@@ -404,6 +408,8 @@ public class OrderServiceRpcClient {
orderOperationType
=
OrderOperationType
.
REPLACE_DISHES
;
}
else
if
(
idsOfAddCount
.
contains
(
originalDetail
.
getId
()))
{
orderOperationType
=
OrderOperationType
.
ADD_DISHES
;
}
else
if
(
idsOfNoReject
.
contains
(
originalDetail
.
getId
()))
{
orderOperationType
=
OrderOperationType
.
NOT_SERVE
;
}
String
originalDetailStr
;
String
newDetailStr
=
""
;
...
...
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
View file @
a300252
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment