zhuyifan

释放库存

package com.infoloop.tianting.logic.task;
import com.infoloop.tianting.service.client.OrderServiceRpcClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class ReleaseStockTask {
private final OrderServiceRpcClient orderServiceRpcClient;
@Scheduled(cron = "0 0 0 * * ?") // 每天 0 点执行
public void executeTask() {
log.info("ReleaseStockTask executeTask");
final var successful = orderServiceRpcClient.releaseSkusSellQuantities(488);
log.info("ReleaseStockTask executeTask result: {}", successful);
}
}
......@@ -32,6 +32,7 @@ import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrder
import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcResponse;
import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest;
import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallRpcRequest;
import com.infoloop.tianting.clientcustomerorderservice.ReleaseSkusSellQuantitiesRpcRequest;
import com.infoloop.tianting.clientcustomerorderservice.ServeStatusEnum;
import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse;
import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse;
......@@ -659,4 +660,10 @@ public class OrderServiceRpcClient {
.build()).getIsAdded();
}
public boolean releaseSkusSellQuantities(int enterpriseId) {
return orderServiceRpcBlockingStub.releaseSkusSellQuantities(ReleaseSkusSellQuantitiesRpcRequest.newBuilder()
.setEnterpriseId(enterpriseId)
.build()).getIsReleased();
}
}
......
......@@ -40,6 +40,7 @@ service ClientCustomerOrderServiceRpc {
rpc QuerySkuSellQuantitiesByStallAndSkuIds(QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest) returns (QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse) {}
rpc BatchSaveSkuSellQuantities(BatchSaveSkuSellQuantitiesRpcRequest) returns (BatchSaveSkuSellQuantitiesRpcResponse) {}
rpc AddSkusSellQuantities(AddSkusSellQuantitiesRpcRequest) returns (AddSkusSellQuantitiesRpcResponse) {}
rpc ReleaseSkusSellQuantities(ReleaseSkusSellQuantitiesRpcRequest) returns (ReleaseSkusSellQuantitiesRpcResponse) {}
}
......@@ -684,3 +685,11 @@ message SkuSellQuantity {
message AddSkusSellQuantitiesRpcResponse {
bool isAdded = 1;
}
message ReleaseSkusSellQuantitiesRpcRequest {
int32 enterpriseId = 1;
}
message ReleaseSkusSellQuantitiesRpcResponse {
bool isReleased = 1;
}
......