weaver-hrm-salary/src/com/engine/salary/enums/UserStatusEnum.java

82 lines
1.9 KiB
Java
Raw Normal View History

2022-03-18 18:00:51 +08:00
package com.engine.salary.enums;
2022-04-07 20:05:58 +08:00
import java.util.*;
import java.util.stream.Collectors;
2022-04-01 14:13:04 +08:00
2022-03-18 18:00:51 +08:00
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/17
* @Version V1.0
* The trial
* A formal
* temporary
* Try to postpone the
* fire
* departure
* retired
* invalid
**/
2022-03-22 19:47:46 +08:00
public enum UserStatusEnum {
2022-03-18 18:00:51 +08:00
2022-04-07 20:05:58 +08:00
TRIAL(0, "试用"),
FORMAL(1, "正式"),
TEMPORARY(2, "临时"),
DELAY(3, "试用延期"),
FIRE(4, "解雇"),
DEPARTURE(5, "离职"),
RETIRED(6, "退休"),
INVALID(7, "无效");
2022-03-18 18:00:51 +08:00
private Integer value;
private String description;
2022-03-22 19:47:46 +08:00
UserStatusEnum(Integer value, String description) {
2022-03-18 18:00:51 +08:00
this.value = value;
this.description = description;
}
public String getDescription() {
return this.description;
}
public Integer getValue() {
return value;
}
2022-04-01 13:50:24 +08:00
public static String getDefaultLabelByValue(Integer value) {
2022-04-01 14:13:04 +08:00
Optional<UserStatusEnum> optional = Arrays.stream(UserStatusEnum.values()).filter(r -> r.getValue().equals(value)).findFirst();
2022-04-01 13:50:24 +08:00
return optional.isPresent() ? optional.get().description : "";
}
2022-04-07 20:05:58 +08:00
public static List<Map<String, String>> getList() {
return Arrays.stream(UserStatusEnum.values()).map(v -> {
Map<String, String> m = new HashMap();
m.put("id", v.value.toString());
m.put("content", v.description);
return m;
}).collect(Collectors.toList());
}
2022-04-21 15:04:35 +08:00
2022-05-19 14:50:01 +08:00
/**
* 在职状态
*
* @return
*/
public static List<String> getNormalStatus() {
return Arrays.asList(TRIAL.getValue().toString(), FORMAL.getValue().toString(), TEMPORARY.getValue().toString(), DELAY.getValue().toString());
}
/**
* 在职状态
*
* @return
*/
public static List<String> getUnavailableStatus() {
return Arrays.asList(FIRE.getValue().toString(), DEPARTURE.getValue().toString(), RETIRED.getValue().toString());
}
2022-04-21 15:04:35 +08:00
2022-03-18 18:00:51 +08:00
}