Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-service
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-04-10 13:12:45 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
dd0a6ac5592e68a179f1c4b36784bc374089c602
dd0a6ac5
2 parents
050017d0
e7e938fb
Merge branch 'feature/order_cancel' into 'master'
Feature/order cancel See merge request
!1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
8 deletions
sql/table.sql
src/main/java/com/tianting/infoloop/model/db/OrderDb.java
src/main/java/com/tianting/infoloop/service/grpc/OrderGrpcService.java
src/main/java/com/tianting/infoloop/service/impl/OrderDbServiceImpl.java
src/main/java/com/tianting/infoloop/utils/DbToProtoUtil.java
src/main/proto/ClientCustomerOrderService.proto
sql/table.sql
View file @
dd0a6ac
...
...
@@ -51,7 +51,8 @@ ALTER TABLE `client_customer_orders`
ADD
COLUMN
`closeTimeType`
tinyint
(
4
)
NOT
NULL
COMMENT
'餐单截单类型;0:立即,1:预定'
AFTER
`menuId`
,
ADD
COLUMN
`isRead`
tinyint
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'是否已读;0:未读,1:已读'
AFTER
`isDeleted`
,
ADD
COLUMN
`isConfirm`
TINYINT
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'是否确认;0:未确认,1:已确认'
AFTER
`isRead`
,
ADD
COLUMN
`isAllocation`
tinyint
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'是否调拨;0:未调拨,1:已调拨'
AFTER
`isConfirm`
;
ADD
COLUMN
`isAllocation`
tinyint
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'是否调拨;0:未调拨,1:已调拨'
AFTER
`isConfirm`
,
ADD
COLUMN
`isCanceled`
tinyint
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'是否撤销;0:未撤销,1:已撤销'
AFTER
`isAllocation`
;
CREATE
TABLE
`client_customer_order_details`
(
`id`
INT
AUTO_INCREMENT
PRIMARY
KEY
COMMENT
'订单详情表主键,自增整数'
,
...
...
src/main/java/com/tianting/infoloop/model/db/OrderDb.java
View file @
dd0a6ac
...
...
@@ -177,4 +177,8 @@ public class OrderDb extends Model<OrderDb> implements Serializable {
* 是否调拨至厨房
*/
private
Boolean
isAllocation
;
/**
* 是否撤销订单
*/
private
Boolean
isCanceled
;
}
\ No newline at end of file
...
...
src/main/java/com/tianting/infoloop/service/grpc/OrderGrpcService.java
View file @
dd0a6ac
...
...
@@ -214,7 +214,11 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu
queryWrapper
.
eq
(
OrderDb:
:
getClientId
,
request
.
getClientId
());
queryWrapper
.
in
(
OrderDb:
:
getStallId
,
request
.
getStallIdsList
());
queryWrapper
.
eq
(
OrderDb:
:
getStatus
,
request
.
getStatusValue
());
queryWrapper
.
in
(
OrderDb:
:
getPayStatus
,
List
.
of
(
PayStatusEnum
.
SUCCEED_VALUE
,
PayStatusEnum
.
PAY_CANCELED_VALUE
));
if
(
request
.
getShouldFilterPayStatus
())
{
queryWrapper
.
eq
(
OrderDb:
:
getPayStatus
,
request
.
getPayStatus
());
}
else
{
queryWrapper
.
in
(
OrderDb:
:
getPayStatus
,
List
.
of
(
PayStatusEnum
.
SUCCEED_VALUE
,
PayStatusEnum
.
PAY_CANCELED_VALUE
));
}
queryWrapper
.
orderByDesc
(
OrderDb:
:
getCreatedAt
);
final
var
result
=
orderDbService
.
page
(
page
,
queryWrapper
);
...
...
@@ -247,12 +251,22 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu
canceledCount
+=
(
int
)
count
;
}
}
LambdaQueryWrapper
<
OrderDb
>
queryRefundCountWrapper
=
Wrappers
.
lambdaQuery
();
if
(!
request
.
getKeyword
().
isEmpty
())
{
queryRefundCountWrapper
.
like
(
OrderDb:
:
getMealTime
,
request
.
getKeyword
());
}
queryRefundCountWrapper
.
eq
(
OrderDb:
:
getEnterpriseId
,
request
.
getEnterpriseId
());
queryRefundCountWrapper
.
eq
(
OrderDb:
:
getClientId
,
request
.
getClientId
());
queryRefundCountWrapper
.
in
(
OrderDb:
:
getStallId
,
request
.
getStallIdsList
());
queryRefundCountWrapper
.
in
(
OrderDb:
:
getPayStatus
,
List
.
of
(
PayStatusEnum
.
REFUND_VALUE
));
final
var
refundCount
=
orderDbService
.
count
(
queryRefundCountWrapper
);
builder
.
setCountByStatus
(
OrderCountByStatus
.
newBuilder
()
.
setUnknownCount
(
unknownCount
)
.
setToPrepareCount
(
toPrepareCount
)
.
setPreparingCount
(
preparingCount
)
.
setAllServedCount
(
allServedCount
)
.
setCanceledCount
(
canceledCount
)
.
setRefundCount
((
int
)
refundCount
)
.
build
());
builder
.
setTotal
(
result
.
getTotal
());
builder
.
setPages
(
result
.
getPages
());
...
...
@@ -368,6 +382,9 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu
if
(
request
.
getShouldFilterStatues
())
{
queryWrapper
.
in
(
OrderDb:
:
getStatus
,
request
.
getStatuesList
().
stream
().
map
(
OrderStatusEnum:
:
getNumber
).
collect
(
Collectors
.
toList
()));
}
if
(
request
.
getShouldFilterIsCanceled
())
{
queryWrapper
.
eq
(
OrderDb:
:
getIsCanceled
,
request
.
getIsCanceled
());
}
queryWrapper
.
orderByDesc
(
OrderDb:
:
getCreatedAt
);
final
var
list
=
orderDbService
.
list
(
queryWrapper
);
if
(!
list
.
isEmpty
())
{
...
...
src/main/java/com/tianting/infoloop/service/impl/OrderDbServiceImpl.java
View file @
dd0a6ac
...
...
@@ -119,6 +119,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
orderDb
.
setIsDeleted
(
false
);
orderDb
.
setIsConfirm
(
false
);
orderDb
.
setIsAllocation
(
false
);
orderDb
.
setIsCanceled
(
false
);
boolean
res
=
this
.
save
(
orderDb
);
if
(!
res
)
{
throw
ServiceExceptionUtil
.
exception
(
ErrorCodeConstants
.
ORDER_GEN_FAIL
);
...
...
@@ -337,6 +338,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
orderDb
.
setIsDeleted
(
false
);
orderDb
.
setIsConfirm
(
false
);
orderDb
.
setIsAllocation
(
false
);
orderDb
.
setIsCanceled
(
false
);
boolean
res
=
this
.
save
(
orderDb
);
if
(!
res
)
{
throw
ServiceExceptionUtil
.
exception
(
ErrorCodeConstants
.
ORDER_GEN_FAIL
);
...
...
@@ -501,6 +503,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
if
(
updateOrderRequest
.
getModification
().
getShouldUpdateIsAllocation
())
{
orderDb
.
setIsAllocation
(
updateOrderRequest
.
getModification
().
getIsAllocation
());
}
if
(
updateOrderRequest
.
getModification
().
getShouldUpdateIsCanceled
())
{
orderDb
.
setIsCanceled
(
updateOrderRequest
.
getModification
().
getIsCanceled
());
}
return
orderDbMapper
.
updateById
(
orderDb
)
>
0
;
}
...
...
@@ -602,6 +607,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
if
(
modification
.
getShouldUpdateSyncRoomNo
())
{
orderDb
.
setSyncRoomNo
(
modification
.
getSyncRoomNo
());
}
if
(
modification
.
getShouldUpdateIsCanceled
())
{
orderDb
.
setIsCanceled
(
modification
.
getIsCanceled
());
}
return
orderDb
;
}).
collect
(
Collectors
.
toList
());
return
SpringUtil
.
getBean
(
OrderDbServiceImpl
.
class
).
updateBatchById
(
list
);
...
...
src/main/java/com/tianting/infoloop/utils/DbToProtoUtil.java
View file @
dd0a6ac
...
...
@@ -128,10 +128,18 @@ public class DbToProtoUtil {
protoBuilder
.
setIsAllocation
(
orderDb
.
getIsAllocation
());
}
if
(
orderDb
.
getIsCanceled
()!=
null
)
{
protoBuilder
.
setIsCanceled
(
orderDb
.
getIsCanceled
());
}
if
(
orderDb
.
getSyncRoomNo
()!=
null
)
{
protoBuilder
.
setSyncRoomNo
(
orderDb
.
getSyncRoomNo
());
}
if
(
orderDb
.
getPayTime
()
!=
null
)
{
protoBuilder
.
setPayTime
((
orderDb
.
getPayTime
().
toEpochSecond
(
ZoneOffset
.
UTC
)
*
1000
));
}
// 处理嵌套的CustomerNotice字段
if
(
orderDb
.
getCustomerNoticeJson
()!=
null
)
{
// Constructor<CustomerNotice> customerNoticeConstructor =
...
...
src/main/proto/ClientCustomerOrderService.proto
View file @
dd0a6ac
...
...
@@ -74,6 +74,7 @@ enum PayStatusEnum {
SUCCEED
=
3
;
FAILED
=
4
;
PAY_CANCELED
=
5
;
REFUND
=
6
;
}
enum
CloseTimeType
{
...
...
@@ -139,6 +140,7 @@ message SingleClientCustomerOrderRpcResponse {
bool
isConfirm
=
34
;
bool
isAllocation
=
35
;
string
syncRoomNo
=
36
;
bool
isCanceled
=
37
;
}
message
GetClientCustomerOrderByIdRpcRequest
{
...
...
@@ -173,12 +175,15 @@ message GetClientCustomerOrdersByCustomerIdRpcResponse {
message
QueryClientCustomerOrdersByPaginationRpcRequest
{
string
keyword
=
1
;
OrderStatusEnum
status
=
2
;
int32
clientId
=
3
;
int32
enterpriseId
=
4
;
int32
pageNo
=
5
;
int32
pageSize
=
6
;
repeated
int32
stallIds
=
7
;
bool
shouldFilterStatus
=
2
;
OrderStatusEnum
status
=
3
;
int32
clientId
=
4
;
int32
enterpriseId
=
5
;
int32
pageNo
=
6
;
int32
pageSize
=
7
;
repeated
int32
stallIds
=
8
;
bool
shouldFilterPayStatus
=
9
;
PayStatusEnum
payStatus
=
10
;
}
message
OrderCountByStatus
{
...
...
@@ -187,6 +192,7 @@ message OrderCountByStatus {
int32
preparingCount
=
3
;
int32
allServedCount
=
4
;
int32
canceledCount
=
5
;
int32
refundCount
=
6
;
}
message
QueryClientCustomerOrdersByPaginationRpcResponse
{
...
...
@@ -246,6 +252,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest {
bool
isAllocation
=
47
;
bool
shouldFilterStatues
=
48
;
repeated
OrderStatusEnum
statues
=
49
;
bool
shouldFilterIsCanceled
=
50
;
bool
isCanceled
=
51
;
}
message
QueryClientCustomerOrdersByConditionRpcResponse
{
...
...
@@ -375,6 +383,8 @@ message ClientCustomerOrderModification {
bool
isAllocation
=
53
;
bool
shouldUpdateSyncRoomNo
=
54
;
string
syncRoomNo
=
55
;
bool
shouldUpdateIsCanceled
=
56
;
bool
isCanceled
=
57
;
}
message
UpdateClientCustomerOrderRpcRequest
{
...
...
Please
register
or
login
to post a comment