package com.qianwen.smartman.modules.andon.enums; import java.util.Arrays; import com.qianwen.core.tool.utils.Func; public enum DateType { DAY(1), WEEK(2), MONTH(3); private final Integer type; DateType(final Integer type) { this.type = type; } public Integer getType() { return this.type; } public static DateType findByType(Integer type) { if (Func.isNull(type)) { return DAY; } return (DateType) Arrays.stream(values()).filter(dt -> { return dt.getType().equals(type); }).findFirst().get(); } }