package com.engine.salary.transmethod; import com.engine.salary.enums.datacollection.AttendQuoteFieldSourceTypeEnum; import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum; import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class TransMethod { public static String timeToDate(String time) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String format = ""; try { Date parse = timeFormat.parse(time); format = dateFormat.format(parse); } catch (ParseException e) { e.printStackTrace(); } return format; } public static String timeToMoth(String time) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String format = ""; try { Date parse = timeFormat.parse(time); format = dateFormat.format(parse); } catch (ParseException e) { e.printStackTrace(); } return format; } /** * 字段来源类型 * @param sourceType * @return */ public static String fieldSourceType(String sourceType) { return AttendQuoteFieldSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(sourceType)); } /** * 字段类型 * @param sourceType * @return */ public static String fieldType(String sourceType) { return AttendQuoteFieldTypeEnum.getDefaultLabelByValue(Integer.valueOf(sourceType)); } /** * 考勤来源类型 * @param sourceType * @return */ public static String sourceType(String sourceType) { return AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(sourceType)); } }