96 lines
2.5 KiB
Java
96 lines
2.5 KiB
Java
package com.engine.salary.enums;
|
|
|
|
import com.engine.salary.entity.hrm.HrmStatus;
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* @Author weaver_cl
|
|
*
|
|
* @Date 2022/3/17
|
|
* @Version V1.0
|
|
* The trial
|
|
* A formal
|
|
* temporary
|
|
* Try to postpone the
|
|
* fire
|
|
* departure
|
|
* retired
|
|
* invalid
|
|
**/
|
|
public enum UserStatusEnum {
|
|
|
|
TRIAL(0, "试用"),
|
|
FORMAL(1, "正式"),
|
|
TEMPORARY(2, "临时"),
|
|
DELAY(3, "试用延期"),
|
|
FIRE(4, "解雇"),
|
|
DEPARTURE(5, "离职"),
|
|
RETIRED(6, "退休"),
|
|
INVALID(7, "无效");
|
|
|
|
private Integer value;
|
|
private String description;
|
|
|
|
|
|
UserStatusEnum(Integer value, String description) {
|
|
this.value = value;
|
|
this.description = description;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return this.description;
|
|
}
|
|
|
|
public Integer getValue() {
|
|
return value;
|
|
}
|
|
|
|
public static String getDefaultLabelByValue(Integer value) {
|
|
Optional<UserStatusEnum> optional = Arrays.stream(UserStatusEnum.values()).filter(r -> r.getValue().equals(value)).findFirst();
|
|
return optional.isPresent() ? optional.get().description : "";
|
|
}
|
|
|
|
public static List<Map<String, String>> getList() {
|
|
return Arrays.stream(UserStatusEnum.values())
|
|
.filter(v -> v != INVALID)
|
|
.map(v -> {
|
|
Map<String, String> m = new HashMap();
|
|
m.put("id", v.value.toString());
|
|
m.put("content", v.description);
|
|
return m;
|
|
}).collect(Collectors.toList());
|
|
}
|
|
|
|
/**
|
|
* 在职状态
|
|
*
|
|
* @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());
|
|
}
|
|
|
|
public static List<UserStatusEnum> getEffectiveList() {
|
|
return Arrays.stream(UserStatusEnum.values()).filter(v -> v != INVALID).collect(Collectors.toList());
|
|
}
|
|
|
|
public static List<HrmStatus> getHrmStatusList() {
|
|
return Arrays.stream(UserStatusEnum.values())
|
|
.filter(v -> v != INVALID)
|
|
.map(v -> HrmStatus.builder().id(v.value.toString()).name(v.description).build()).collect(Collectors.toList());
|
|
}
|
|
|
|
|
|
}
|