wangyingyang

add order cancel

...@@ -51,7 +51,8 @@ ALTER TABLE `client_customer_orders` ...@@ -51,7 +51,8 @@ ALTER TABLE `client_customer_orders`
51 ADD COLUMN `closeTimeType` tinyint(4) NOT NULL COMMENT '餐单截单类型;0:立即,1:预定' AFTER `menuId`, 51 ADD COLUMN `closeTimeType` tinyint(4) NOT NULL COMMENT '餐单截单类型;0:立即,1:预定' AFTER `menuId`,
52 ADD COLUMN `isRead` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已读;0:未读,1:已读' AFTER `isDeleted`, 52 ADD COLUMN `isRead` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已读;0:未读,1:已读' AFTER `isDeleted`,
53 ADD COLUMN `isConfirm` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否确认;0:未确认,1:已确认' AFTER `isRead`, 53 ADD COLUMN `isConfirm` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否确认;0:未确认,1:已确认' AFTER `isRead`,
54 -ADD COLUMN `isAllocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否调拨;0:未调拨,1:已调拨' AFTER `isConfirm`; 54 +ADD COLUMN `isAllocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否调拨;0:未调拨,1:已调拨' AFTER `isConfirm`,
55 +ADD COLUMN `isCanceled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否撤销;0:未撤销,1:已撤销' AFTER `isAllocation`;
55 56
56 CREATE TABLE `client_customer_order_details` ( 57 CREATE TABLE `client_customer_order_details` (
57 `id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '订单详情表主键,自增整数', 58 `id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '订单详情表主键,自增整数',
......
...@@ -177,4 +177,8 @@ public class OrderDb extends Model<OrderDb> implements Serializable { ...@@ -177,4 +177,8 @@ public class OrderDb extends Model<OrderDb> implements Serializable {
177 * 是否调拨至厨房 177 * 是否调拨至厨房
178 */ 178 */
179 private Boolean isAllocation; 179 private Boolean isAllocation;
180 + /**
181 + * 是否撤销订单
182 + */
183 + private Boolean isCanceled;
180 } 184 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -368,6 +368,9 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu ...@@ -368,6 +368,9 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu
368 if (request.getShouldFilterStatues()) { 368 if (request.getShouldFilterStatues()) {
369 queryWrapper.in(OrderDb::getStatus, request.getStatuesList().stream().map(OrderStatusEnum::getNumber).collect(Collectors.toList())); 369 queryWrapper.in(OrderDb::getStatus, request.getStatuesList().stream().map(OrderStatusEnum::getNumber).collect(Collectors.toList()));
370 } 370 }
371 + if (request.getShouldFilterIsCanceled()) {
372 + queryWrapper.eq(OrderDb::getIsCanceled, request.getIsCanceled());
373 + }
371 queryWrapper.orderByDesc(OrderDb::getCreatedAt); 374 queryWrapper.orderByDesc(OrderDb::getCreatedAt);
372 final var list = orderDbService.list(queryWrapper); 375 final var list = orderDbService.list(queryWrapper);
373 if (!list.isEmpty()) { 376 if (!list.isEmpty()) {
......
...@@ -119,6 +119,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl ...@@ -119,6 +119,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
119 orderDb.setIsDeleted(false); 119 orderDb.setIsDeleted(false);
120 orderDb.setIsConfirm(false); 120 orderDb.setIsConfirm(false);
121 orderDb.setIsAllocation(false); 121 orderDb.setIsAllocation(false);
122 + orderDb.setIsCanceled(false);
122 boolean res = this.save(orderDb); 123 boolean res = this.save(orderDb);
123 if (!res) { 124 if (!res) {
124 throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_GEN_FAIL); 125 throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_GEN_FAIL);
...@@ -337,6 +338,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl ...@@ -337,6 +338,7 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
337 orderDb.setIsDeleted(false); 338 orderDb.setIsDeleted(false);
338 orderDb.setIsConfirm(false); 339 orderDb.setIsConfirm(false);
339 orderDb.setIsAllocation(false); 340 orderDb.setIsAllocation(false);
341 + orderDb.setIsCanceled(false);
340 boolean res = this.save(orderDb); 342 boolean res = this.save(orderDb);
341 if (!res) { 343 if (!res) {
342 throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_GEN_FAIL); 344 throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_GEN_FAIL);
...@@ -501,6 +503,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl ...@@ -501,6 +503,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
501 if (updateOrderRequest.getModification().getShouldUpdateIsAllocation()) { 503 if (updateOrderRequest.getModification().getShouldUpdateIsAllocation()) {
502 orderDb.setIsAllocation(updateOrderRequest.getModification().getIsAllocation()); 504 orderDb.setIsAllocation(updateOrderRequest.getModification().getIsAllocation());
503 } 505 }
506 + if (updateOrderRequest.getModification().getShouldUpdateIsCanceled()) {
507 + orderDb.setIsCanceled(updateOrderRequest.getModification().getIsCanceled());
508 + }
504 return orderDbMapper.updateById(orderDb) > 0; 509 return orderDbMapper.updateById(orderDb) > 0;
505 } 510 }
506 511
...@@ -602,6 +607,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl ...@@ -602,6 +607,9 @@ public class OrderDbServiceImpl extends ServiceImpl<OrderDbMapper, OrderDb> impl
602 if (modification.getShouldUpdateSyncRoomNo()) { 607 if (modification.getShouldUpdateSyncRoomNo()) {
603 orderDb.setSyncRoomNo(modification.getSyncRoomNo()); 608 orderDb.setSyncRoomNo(modification.getSyncRoomNo());
604 } 609 }
610 + if (modification.getShouldUpdateIsCanceled()) {
611 + orderDb.setIsCanceled(modification.getIsCanceled());
612 + }
605 return orderDb; 613 return orderDb;
606 }).collect(Collectors.toList()); 614 }).collect(Collectors.toList());
607 return SpringUtil.getBean(OrderDbServiceImpl.class).updateBatchById(list); 615 return SpringUtil.getBean(OrderDbServiceImpl.class).updateBatchById(list);
......
...@@ -128,6 +128,10 @@ public class DbToProtoUtil { ...@@ -128,6 +128,10 @@ public class DbToProtoUtil {
128 protoBuilder.setIsAllocation(orderDb.getIsAllocation()); 128 protoBuilder.setIsAllocation(orderDb.getIsAllocation());
129 } 129 }
130 130
131 + if (orderDb.getIsCanceled()!= null) {
132 + protoBuilder.setIsCanceled(orderDb.getIsCanceled());
133 + }
134 +
131 if (orderDb.getSyncRoomNo()!= null) { 135 if (orderDb.getSyncRoomNo()!= null) {
132 protoBuilder.setSyncRoomNo(orderDb.getSyncRoomNo()); 136 protoBuilder.setSyncRoomNo(orderDb.getSyncRoomNo());
133 } 137 }
......
...@@ -139,6 +139,7 @@ message SingleClientCustomerOrderRpcResponse { ...@@ -139,6 +139,7 @@ message SingleClientCustomerOrderRpcResponse {
139 bool isConfirm = 34; 139 bool isConfirm = 34;
140 bool isAllocation = 35; 140 bool isAllocation = 35;
141 string syncRoomNo = 36; 141 string syncRoomNo = 36;
142 + bool isCanceled = 37;
142 } 143 }
143 144
144 message GetClientCustomerOrderByIdRpcRequest { 145 message GetClientCustomerOrderByIdRpcRequest {
...@@ -173,12 +174,15 @@ message GetClientCustomerOrdersByCustomerIdRpcResponse { ...@@ -173,12 +174,15 @@ message GetClientCustomerOrdersByCustomerIdRpcResponse {
173 174
174 message QueryClientCustomerOrdersByPaginationRpcRequest { 175 message QueryClientCustomerOrdersByPaginationRpcRequest {
175 string keyword = 1; 176 string keyword = 1;
176 - OrderStatusEnum status = 2; 177 + bool shouldFilterStatus = 2;
177 - int32 clientId = 3; 178 + OrderStatusEnum status = 3;
178 - int32 enterpriseId = 4; 179 + int32 clientId = 4;
179 - int32 pageNo = 5; 180 + int32 enterpriseId = 5;
180 - int32 pageSize = 6; 181 + int32 pageNo = 6;
181 - repeated int32 stallIds = 7; 182 + int32 pageSize = 7;
183 + repeated int32 stallIds = 8;
184 + bool shouldFilterIsCanceled = 9;
185 + bool isCanceled = 10;
182 } 186 }
183 187
184 message OrderCountByStatus { 188 message OrderCountByStatus {
...@@ -246,6 +250,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest { ...@@ -246,6 +250,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest {
246 bool isAllocation = 47; 250 bool isAllocation = 47;
247 bool shouldFilterStatues = 48; 251 bool shouldFilterStatues = 48;
248 repeated OrderStatusEnum statues = 49; 252 repeated OrderStatusEnum statues = 49;
253 + bool shouldFilterIsCanceled = 50;
254 + bool isCanceled = 51;
249 } 255 }
250 256
251 message QueryClientCustomerOrdersByConditionRpcResponse { 257 message QueryClientCustomerOrdersByConditionRpcResponse {
...@@ -375,6 +381,8 @@ message ClientCustomerOrderModification { ...@@ -375,6 +381,8 @@ message ClientCustomerOrderModification {
375 bool isAllocation = 53; 381 bool isAllocation = 53;
376 bool shouldUpdateSyncRoomNo = 54; 382 bool shouldUpdateSyncRoomNo = 54;
377 string syncRoomNo = 55; 383 string syncRoomNo = 55;
384 + bool shouldUpdateIsCanceled = 56;
385 + bool isCanceled = 57;
378 } 386 }
379 387
380 message UpdateClientCustomerOrderRpcRequest { 388 message UpdateClientCustomerOrderRpcRequest {
......