TransferToolObject.java 1.48 KB
package com.xiniunet.web.tool;

import com.xiniunet.framework.util.DateUtil;
import com.xiniunet.framework.util.MathUtil;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by xn on 16/4/8.
 */
public class TransferToolObject implements Serializable {
    private static final long serialVersionUID = -7507510429755782597L;


    public static Long toLong(Double num){
        return num.longValue();
    }

    public static boolean isLong(Double num){
        Long temp = num.longValue();
        Double diff = MathUtil.sub(num,temp);
        return diff.equals(0D);
    }

    public static String formatDate(Date date, String format){
        return DateUtil.formatDate(date,format);
    }

    public static String formatLeaveType(String type){
        if(type == null){
            return "";
        }
        switch (type){
            case "PERSONAL_LEAVE":
                return "事假";
            case "SICK_LEAVE":
                return "病假";
            case "ANNUAL_LEAVE":
                return "年假";
            case "DEFERED_LEAVE":
                return "调休";
            case "MARITAL_LEAVE":
                return "婚假";
            case "MATERNITY_LEAVE":
                return "产假";
            case "NURSE_LEAVE":
                return "看护假";
            case "FUNERAL_LEAVE":
                return "丧假";
            case "OTHER_LEAVE":
                return "其它";
            default:
                return "";

        }
    }


}