TransferToolObject.java
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 "";
        }
    }
}