|
@@ -8,11 +8,14 @@ import java.util.Deque;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
|
+import java.util.stream.Stream;
|
|
import javax.servlet.ServletRequestEvent;
|
|
import javax.servlet.ServletRequestEvent;
|
|
import javax.servlet.ServletRequestListener;
|
|
import javax.servlet.ServletRequestListener;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import com.chelvc.framework.base.annotation.Versions;
|
|
|
|
+import com.chelvc.framework.common.model.Compare;
|
|
import com.chelvc.framework.common.model.Platform;
|
|
import com.chelvc.framework.common.model.Platform;
|
|
import com.chelvc.framework.common.model.Terminal;
|
|
import com.chelvc.framework.common.model.Terminal;
|
|
import com.chelvc.framework.common.model.Version;
|
|
import com.chelvc.framework.common.model.Version;
|
|
@@ -461,6 +464,31 @@ public class SessionContextHolder implements ServletRequestListener {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 判断是否是指定版本
|
|
|
|
+ *
|
|
|
|
+ * @param versions 版本注解
|
|
|
|
+ * @return true/false
|
|
|
|
+ */
|
|
|
|
+ public static boolean isVersion(@NonNull Versions versions) {
|
|
|
|
+ return ObjectUtils.notEmpty(versions.value()) && Stream.of(versions.value()).anyMatch(version -> {
|
|
|
|
+ if (version.compare() == Compare.EQ) {
|
|
|
|
+ return isVersion(version.terminal(), version.value());
|
|
|
|
+ } else if (version.compare() == Compare.NE) {
|
|
|
|
+ return !isVersion(version.terminal(), version.value());
|
|
|
|
+ } else if (version.compare() == Compare.GT) {
|
|
|
|
+ return isAfterVersion(version.terminal(), version.value());
|
|
|
|
+ } else if (version.compare() == Compare.GE) {
|
|
|
|
+ return isAfterVersion(version.terminal(), version.value(), true);
|
|
|
|
+ } else if (version.compare() == Compare.LT) {
|
|
|
|
+ return isBeforeVersion(version.terminal(), version.value());
|
|
|
|
+ } else if (version.compare() == Compare.LE) {
|
|
|
|
+ return isBeforeVersion(version.terminal(), version.value(), true);
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 判断是否是指定版本
|
|
* 判断是否是指定版本
|
|
*
|
|
*
|