Showing
3 changed files
with
38 additions
and
0 deletions
| 1 | +package com.infoloop.tianting.logic.task; | ||
| 2 | + | ||
| 3 | +import com.infoloop.tianting.service.client.OrderServiceRpcClient; | ||
| 4 | +import lombok.RequiredArgsConstructor; | ||
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +@Slf4j | ||
| 10 | +@Component | ||
| 11 | +@RequiredArgsConstructor | ||
| 12 | +public class ReleaseStockTask { | ||
| 13 | + | ||
| 14 | + private final OrderServiceRpcClient orderServiceRpcClient; | ||
| 15 | + | ||
| 16 | + @Scheduled(cron = "0 0 0 * * ?") // 每天 0 点执行 | ||
| 17 | + public void executeTask() { | ||
| 18 | + log.info("ReleaseStockTask executeTask"); | ||
| 19 | + final var successful = orderServiceRpcClient.releaseSkusSellQuantities(488); | ||
| 20 | + log.info("ReleaseStockTask executeTask result: {}", successful); | ||
| 21 | + } | ||
| 22 | +} |
| ... | @@ -32,6 +32,7 @@ import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrder | ... | @@ -32,6 +32,7 @@ import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrder |
| 32 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcResponse; | 32 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcResponse; |
| 33 | import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest; | 33 | import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest; |
| 34 | import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallRpcRequest; | 34 | import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallRpcRequest; |
| 35 | +import com.infoloop.tianting.clientcustomerorderservice.ReleaseSkusSellQuantitiesRpcRequest; | ||
| 35 | import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum; | 36 | import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum; |
| 36 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; | 37 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; |
| 37 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; | 38 | import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; |
| ... | @@ -659,4 +660,10 @@ public class OrderServiceRpcClient { | ... | @@ -659,4 +660,10 @@ public class OrderServiceRpcClient { |
| 659 | .build()).getIsAdded(); | 660 | .build()).getIsAdded(); |
| 660 | } | 661 | } |
| 661 | 662 | ||
| 663 | + public boolean releaseSkusSellQuantities(int enterpriseId) { | ||
| 664 | + return orderServiceRpcBlockingStub.releaseSkusSellQuantities(ReleaseSkusSellQuantitiesRpcRequest.newBuilder() | ||
| 665 | + .setEnterpriseId(enterpriseId) | ||
| 666 | + .build()).getIsReleased(); | ||
| 667 | + } | ||
| 668 | + | ||
| 662 | } | 669 | } | ... | ... |
| ... | @@ -40,6 +40,7 @@ service ClientCustomerOrderServiceRpc { | ... | @@ -40,6 +40,7 @@ service ClientCustomerOrderServiceRpc { |
| 40 | rpc QuerySkuSellQuantitiesByStallAndSkuIds(QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest) returns (QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse) {} | 40 | rpc QuerySkuSellQuantitiesByStallAndSkuIds(QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest) returns (QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse) {} |
| 41 | rpc BatchSaveSkuSellQuantities(BatchSaveSkuSellQuantitiesRpcRequest) returns (BatchSaveSkuSellQuantitiesRpcResponse) {} | 41 | rpc BatchSaveSkuSellQuantities(BatchSaveSkuSellQuantitiesRpcRequest) returns (BatchSaveSkuSellQuantitiesRpcResponse) {} |
| 42 | rpc AddSkusSellQuantities(AddSkusSellQuantitiesRpcRequest) returns (AddSkusSellQuantitiesRpcResponse) {} | 42 | rpc AddSkusSellQuantities(AddSkusSellQuantitiesRpcRequest) returns (AddSkusSellQuantitiesRpcResponse) {} |
| 43 | + rpc ReleaseSkusSellQuantities(ReleaseSkusSellQuantitiesRpcRequest) returns (ReleaseSkusSellQuantitiesRpcResponse) {} | ||
| 43 | 44 | ||
| 44 | } | 45 | } |
| 45 | 46 | ||
| ... | @@ -684,3 +685,11 @@ message SkuSellQuantity { | ... | @@ -684,3 +685,11 @@ message SkuSellQuantity { |
| 684 | message AddSkusSellQuantitiesRpcResponse { | 685 | message AddSkusSellQuantitiesRpcResponse { |
| 685 | bool isAdded = 1; | 686 | bool isAdded = 1; |
| 686 | } | 687 | } |
| 688 | + | ||
| 689 | +message ReleaseSkusSellQuantitiesRpcRequest { | ||
| 690 | + int32 enterpriseId = 1; | ||
| 691 | +} | ||
| 692 | + | ||
| 693 | +message ReleaseSkusSellQuantitiesRpcResponse { | ||
| 694 | + bool isReleased = 1; | ||
| 695 | +} | ... | ... |
-
Please register or login to post a comment