Merge branch 'feature/order_cancel' into 'master'
Feature/order cancel See merge request !1
Showing
6 changed files
with
55 additions
and
7 deletions
| ... | @@ -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 | ... | ... |
| ... | @@ -214,7 +214,11 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -214,7 +214,11 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 214 | queryWrapper.eq(OrderDb::getClientId, request.getClientId()); | 214 | queryWrapper.eq(OrderDb::getClientId, request.getClientId()); |
| 215 | queryWrapper.in(OrderDb::getStallId, request.getStallIdsList()); | 215 | queryWrapper.in(OrderDb::getStallId, request.getStallIdsList()); |
| 216 | queryWrapper.eq(OrderDb::getStatus, request.getStatusValue()); | 216 | queryWrapper.eq(OrderDb::getStatus, request.getStatusValue()); |
| 217 | + if (request.getShouldFilterPayStatus()) { | ||
| 218 | + queryWrapper.eq(OrderDb::getPayStatus, request.getPayStatus()); | ||
| 219 | + } else { | ||
| 217 | queryWrapper.in(OrderDb::getPayStatus, List.of(PayStatusEnum.SUCCEED_VALUE, PayStatusEnum.PAY_CANCELED_VALUE)); | 220 | queryWrapper.in(OrderDb::getPayStatus, List.of(PayStatusEnum.SUCCEED_VALUE, PayStatusEnum.PAY_CANCELED_VALUE)); |
| 221 | + } | ||
| 218 | queryWrapper.orderByDesc(OrderDb::getCreatedAt); | 222 | queryWrapper.orderByDesc(OrderDb::getCreatedAt); |
| 219 | final var result = orderDbService.page(page, queryWrapper); | 223 | final var result = orderDbService.page(page, queryWrapper); |
| 220 | 224 | ||
| ... | @@ -247,12 +251,22 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -247,12 +251,22 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 247 | canceledCount += (int) count; | 251 | canceledCount += (int) count; |
| 248 | } | 252 | } |
| 249 | } | 253 | } |
| 254 | + LambdaQueryWrapper<OrderDb> queryRefundCountWrapper = Wrappers.lambdaQuery(); | ||
| 255 | + if (!request.getKeyword().isEmpty()) { | ||
| 256 | + queryRefundCountWrapper.like(OrderDb::getMealTime, request.getKeyword()); | ||
| 257 | + } | ||
| 258 | + queryRefundCountWrapper.eq(OrderDb::getEnterpriseId, request.getEnterpriseId()); | ||
| 259 | + queryRefundCountWrapper.eq(OrderDb::getClientId, request.getClientId()); | ||
| 260 | + queryRefundCountWrapper.in(OrderDb::getStallId, request.getStallIdsList()); | ||
| 261 | + queryRefundCountWrapper.in(OrderDb::getPayStatus, List.of(PayStatusEnum.REFUND_VALUE)); | ||
| 262 | + final var refundCount = orderDbService.count(queryRefundCountWrapper); | ||
| 250 | builder.setCountByStatus(OrderCountByStatus.newBuilder() | 263 | builder.setCountByStatus(OrderCountByStatus.newBuilder() |
| 251 | .setUnknownCount(unknownCount) | 264 | .setUnknownCount(unknownCount) |
| 252 | .setToPrepareCount(toPrepareCount) | 265 | .setToPrepareCount(toPrepareCount) |
| 253 | .setPreparingCount(preparingCount) | 266 | .setPreparingCount(preparingCount) |
| 254 | .setAllServedCount(allServedCount) | 267 | .setAllServedCount(allServedCount) |
| 255 | .setCanceledCount(canceledCount) | 268 | .setCanceledCount(canceledCount) |
| 269 | + .setRefundCount((int)refundCount) | ||
| 256 | .build()); | 270 | .build()); |
| 257 | builder.setTotal(result.getTotal()); | 271 | builder.setTotal(result.getTotal()); |
| 258 | builder.setPages(result.getPages()); | 272 | builder.setPages(result.getPages()); |
| ... | @@ -368,6 +382,9 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -368,6 +382,9 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 368 | if (request.getShouldFilterStatues()) { | 382 | if (request.getShouldFilterStatues()) { |
| 369 | queryWrapper.in(OrderDb::getStatus, request.getStatuesList().stream().map(OrderStatusEnum::getNumber).collect(Collectors.toList())); | 383 | queryWrapper.in(OrderDb::getStatus, request.getStatuesList().stream().map(OrderStatusEnum::getNumber).collect(Collectors.toList())); |
| 370 | } | 384 | } |
| 385 | + if (request.getShouldFilterIsCanceled()) { | ||
| 386 | + queryWrapper.eq(OrderDb::getIsCanceled, request.getIsCanceled()); | ||
| 387 | + } | ||
| 371 | queryWrapper.orderByDesc(OrderDb::getCreatedAt); | 388 | queryWrapper.orderByDesc(OrderDb::getCreatedAt); |
| 372 | final var list = orderDbService.list(queryWrapper); | 389 | final var list = orderDbService.list(queryWrapper); |
| 373 | if (!list.isEmpty()) { | 390 | 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,10 +128,18 @@ public class DbToProtoUtil { | ... | @@ -128,10 +128,18 @@ 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 | } |
| 134 | 138 | ||
| 139 | + if (orderDb.getPayTime() != null) { | ||
| 140 | + protoBuilder.setPayTime((orderDb.getPayTime().toEpochSecond(ZoneOffset.UTC) * 1000)); | ||
| 141 | + } | ||
| 142 | + | ||
| 135 | // 处理嵌套的CustomerNotice字段 | 143 | // 处理嵌套的CustomerNotice字段 |
| 136 | if (orderDb.getCustomerNoticeJson()!= null) { | 144 | if (orderDb.getCustomerNoticeJson()!= null) { |
| 137 | // Constructor<CustomerNotice> customerNoticeConstructor = | 145 | // Constructor<CustomerNotice> customerNoticeConstructor = | ... | ... |
| ... | @@ -74,6 +74,7 @@ enum PayStatusEnum { | ... | @@ -74,6 +74,7 @@ enum PayStatusEnum { |
| 74 | SUCCEED = 3; | 74 | SUCCEED = 3; |
| 75 | FAILED = 4; | 75 | FAILED = 4; |
| 76 | PAY_CANCELED = 5; | 76 | PAY_CANCELED = 5; |
| 77 | + REFUND = 6; | ||
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | enum CloseTimeType { | 80 | enum CloseTimeType { |
| ... | @@ -139,6 +140,7 @@ message SingleClientCustomerOrderRpcResponse { | ... | @@ -139,6 +140,7 @@ message SingleClientCustomerOrderRpcResponse { |
| 139 | bool isConfirm = 34; | 140 | bool isConfirm = 34; |
| 140 | bool isAllocation = 35; | 141 | bool isAllocation = 35; |
| 141 | string syncRoomNo = 36; | 142 | string syncRoomNo = 36; |
| 143 | + bool isCanceled = 37; | ||
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | message GetClientCustomerOrderByIdRpcRequest { | 146 | message GetClientCustomerOrderByIdRpcRequest { |
| ... | @@ -173,12 +175,15 @@ message GetClientCustomerOrdersByCustomerIdRpcResponse { | ... | @@ -173,12 +175,15 @@ message GetClientCustomerOrdersByCustomerIdRpcResponse { |
| 173 | 175 | ||
| 174 | message QueryClientCustomerOrdersByPaginationRpcRequest { | 176 | message QueryClientCustomerOrdersByPaginationRpcRequest { |
| 175 | string keyword = 1; | 177 | string keyword = 1; |
| 176 | - OrderStatusEnum status = 2; | 178 | + bool shouldFilterStatus = 2; |
| 177 | - int32 clientId = 3; | 179 | + OrderStatusEnum status = 3; |
| 178 | - int32 enterpriseId = 4; | 180 | + int32 clientId = 4; |
| 179 | - int32 pageNo = 5; | 181 | + int32 enterpriseId = 5; |
| 180 | - int32 pageSize = 6; | 182 | + int32 pageNo = 6; |
| 181 | - repeated int32 stallIds = 7; | 183 | + int32 pageSize = 7; |
| 184 | + repeated int32 stallIds = 8; | ||
| 185 | + bool shouldFilterPayStatus = 9; | ||
| 186 | + PayStatusEnum payStatus = 10; | ||
| 182 | } | 187 | } |
| 183 | 188 | ||
| 184 | message OrderCountByStatus { | 189 | message OrderCountByStatus { |
| ... | @@ -187,6 +192,7 @@ message OrderCountByStatus { | ... | @@ -187,6 +192,7 @@ message OrderCountByStatus { |
| 187 | int32 preparingCount = 3; | 192 | int32 preparingCount = 3; |
| 188 | int32 allServedCount = 4; | 193 | int32 allServedCount = 4; |
| 189 | int32 canceledCount = 5; | 194 | int32 canceledCount = 5; |
| 195 | + int32 refundCount = 6; | ||
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | message QueryClientCustomerOrdersByPaginationRpcResponse { | 198 | message QueryClientCustomerOrdersByPaginationRpcResponse { |
| ... | @@ -246,6 +252,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest { | ... | @@ -246,6 +252,8 @@ message QueryClientCustomerOrdersByConditionRpcRequest { |
| 246 | bool isAllocation = 47; | 252 | bool isAllocation = 47; |
| 247 | bool shouldFilterStatues = 48; | 253 | bool shouldFilterStatues = 48; |
| 248 | repeated OrderStatusEnum statues = 49; | 254 | repeated OrderStatusEnum statues = 49; |
| 255 | + bool shouldFilterIsCanceled = 50; | ||
| 256 | + bool isCanceled = 51; | ||
| 249 | } | 257 | } |
| 250 | 258 | ||
| 251 | message QueryClientCustomerOrdersByConditionRpcResponse { | 259 | message QueryClientCustomerOrdersByConditionRpcResponse { |
| ... | @@ -375,6 +383,8 @@ message ClientCustomerOrderModification { | ... | @@ -375,6 +383,8 @@ message ClientCustomerOrderModification { |
| 375 | bool isAllocation = 53; | 383 | bool isAllocation = 53; |
| 376 | bool shouldUpdateSyncRoomNo = 54; | 384 | bool shouldUpdateSyncRoomNo = 54; |
| 377 | string syncRoomNo = 55; | 385 | string syncRoomNo = 55; |
| 386 | + bool shouldUpdateIsCanceled = 56; | ||
| 387 | + bool isCanceled = 57; | ||
| 378 | } | 388 | } |
| 379 | 389 | ||
| 380 | message UpdateClientCustomerOrderRpcRequest { | 390 | message UpdateClientCustomerOrderRpcRequest { | ... | ... |
-
Please register or login to post a comment