修复已入库费用发送状态回退
This commit is contained in:
@@ -243,13 +243,16 @@ public class FbaPricingRepository {
|
||||
.set(InboundFeeEntity::getSentAt, now));
|
||||
}
|
||||
|
||||
public int markInboundWaitingPallet(long tenantId, long inboundId) {
|
||||
return inbounds.update(null, new LambdaUpdateWrapper<InboundPricingEntity>()
|
||||
public int markInboundFeeSent(long tenantId, long inboundId, String processStatus) {
|
||||
LambdaUpdateWrapper<InboundPricingEntity> update = new LambdaUpdateWrapper<InboundPricingEntity>()
|
||||
.eq(InboundPricingEntity::getTenantId, tenantId).eq(InboundPricingEntity::getId, inboundId)
|
||||
.eq(InboundPricingEntity::getProcessStatus, "FEE_CONFIRMING")
|
||||
.eq(InboundPricingEntity::getProcessStatus, processStatus)
|
||||
.eq(InboundPricingEntity::getFeeStatus, "CONFIRMED")
|
||||
.set(InboundPricingEntity::getProcessStatus, "WAIT_PALLET")
|
||||
.set(InboundPricingEntity::getFeeStatus, "SENT"));
|
||||
.set(InboundPricingEntity::getFeeStatus, "SENT");
|
||||
if ("FEE_CONFIRMING".equals(processStatus)) {
|
||||
update.set(InboundPricingEntity::getProcessStatus, "WAIT_PALLET");
|
||||
}
|
||||
return inbounds.update(null, update);
|
||||
}
|
||||
|
||||
public InboundPricingIdempotencyEntity findIdempotency(long tenantId, long operatorId,
|
||||
|
||||
@@ -113,14 +113,16 @@ public class FbaPricingService {
|
||||
String hash = hash("SEND", inboundId, current.getId().toString());
|
||||
InboundPricingIdempotencyEntity token = beginIdempotency(
|
||||
tenantId, operatorId, inboundId, "FEE_SEND", idempotencyKey, hash);
|
||||
String nextProcessStatus = "INBOUNDED".equals(inbound.getProcessStatus())
|
||||
? "INBOUNDED" : "WAIT_PALLET";
|
||||
if ("COMPLETED".equals(token.getStatus())) {
|
||||
feeDetails.publishFreight(tenantId, inboundId, token.getResultResourceId(),
|
||||
operatorId, null, LocalDateTime.now(clock));
|
||||
return response(tenantId, token.getResultResourceId(), "WAIT_PALLET");
|
||||
return response(tenantId, token.getResultResourceId(), nextProcessStatus);
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now(clock);
|
||||
if (repository.sendFee(tenantId, current.getId(), operatorId, now) != 1
|
||||
|| repository.markInboundWaitingPallet(tenantId, inboundId) != 1) {
|
||||
|| repository.markInboundFeeSent(tenantId, inboundId, inbound.getProcessStatus()) != 1) {
|
||||
throw conflict("费用未确认或入库单状态已变化,不能发送");
|
||||
}
|
||||
feeDetails.publishFreight(tenantId, inboundId, current.getId(), operatorId, null, now);
|
||||
@@ -135,7 +137,7 @@ public class FbaPricingService {
|
||||
event.setCreatedAt(now);
|
||||
repository.insertOutbox(event);
|
||||
complete(token, current.getId(), now);
|
||||
return response(tenantId, current.getId(), "WAIT_PALLET");
|
||||
return response(tenantId, current.getId(), nextProcessStatus);
|
||||
}
|
||||
|
||||
public FeeSnapshotResponse latest(long tenantId, long inboundId) {
|
||||
|
||||
Reference in New Issue
Block a user