20 lines
1.2 KiB
Java
20 lines
1.2 KiB
Java
package com.baiyue.integration.config;
|
|
|
|
import java.time.Instant;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
import org.springframework.boot.context.properties.bind.DefaultValue;
|
|
|
|
/** Fixed one-shot scope. No refresh/restart may extend the configured absolute window. */
|
|
@ConfigurationProperties("baiyue.integration.lingxing-wms.quantity-capture")
|
|
public record LingxingQuantityCaptureProperties(@DefaultValue("false") boolean enabled,
|
|
String captureId, String sourceAccount, String rootTaskId, String sessionId,
|
|
String warehouseCode, String customerCode, Instant startsAt, Instant expiresAt) {
|
|
public boolean valid() {
|
|
return text(captureId) && text(sourceAccount) && text(rootTaskId) && text(sessionId)
|
|
&& text(warehouseCode) && text(customerCode) && startsAt != null && expiresAt != null
|
|
&& expiresAt.isAfter(startsAt) && !expiresAt.isAfter(startsAt.plusSeconds(1800));
|
|
}
|
|
private static boolean text(String value) { return value != null && !value.isBlank() && value.length() <= 128; }
|
|
@Override public String toString() { return "LingxingQuantityCaptureProperties[enabled=" + enabled + "]"; }
|
|
}
|