# ApproveStatusEnum.java

    package cloud.wconnect.frontoffice.cons;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

    import java.util.Arrays;
    import java.util.Optional;

    /**
     * @author lichen
     * @description 审批枚举类 审批状态 1：pending 待送审 2:approveing 审核中 3: approved 审核结束 4:rejected 审核驳回
     * @date 2023/3/21 16:03
     */
    @AllArgsConstructor
    @Getter
    public enum ApproveStatusEnum {
        PENDING(1, "pending", "pending"),
        APPROVEING(2, "approving", "approving"),
        APPROVED(3, "approved", "approved"),
        REJECTED(4, "rejected", "rejected");

        private int status;

        private String desc;

        /**
         * 国际化code
         */
        private String i18nCode;

        public static String getDesc(int status) {
            ApproveStatusEnum[] values = ApproveStatusEnum.values();
            for (ApproveStatusEnum value : values) {
                if (value.getStatus() == status) {
                    return value.getDesc();
                }
            }
            return "";
        }

        /**
         * 获取国际化code
         *
         * @param status 状态
         * @return java.lang.String
         * @author lichen
         * @date 2024/1/11
         */
        public static String getI18nCode(int status) {
            Optional<ApproveStatusEnum> optional = Arrays.stream(ApproveStatusEnum.values()).filter(item -> item.getStatus() == status).findFirst();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }
    }