package com.jeeplus.modules.sg.managementcenter.reserveManagement.utils;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

public class ReserveManagementUtil {

    public static String boolResultByInt(String str){
        if(StringUtils.isNotBlank(str)){
            switch (str){
                case "是":
                    str = "1";
                    break;
                case "否":
                    str = "0";
                    break;
                default:
                    str = "";
                    break;
            }
        }
        return str;
    }

    public static String boolResultByDegree(String str){
        if(StringUtils.isNotBlank(str)) {
            if (!NumberUtils.isDigits(str)) {
                str = "";
            }
        }
        return str;
    }

    public static String boolResultByCondition(String str){
        if(StringUtils.isNotBlank(str)) {
            switch (str) {
                case "已完成":
                    str = "1";
                    break;
                case "未完成":
                    str = "0";
                    break;
                default:
                    str = "";
                    break;
            }
        }
        return str;
    }

    public static String boolResultByReview(String str){
        if(StringUtils.isNotBlank(str)) {
            switch (str) {
                case "已通过":
                    str = "1";
                    break;
                case "未通过":
                    str = "0";
                    break;
                default:
                    str = "";
                    break;
            }
        }
        return str;
    }
}
