feat(REQ-3488): 调整枚举

This commit is contained in:
zhanghonghao 2025-01-02 10:34:22 +08:00
parent 60879a7822
commit abed5e87b6
9 changed files with 590 additions and 0 deletions

View File

@ -0,0 +1,64 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* 审核状态
*/
public enum ApprovalStatusEnum {
CANCEL(0, "撤销", "撤销"),
AUDITING(10, "审核中", "认证中"),
AUDIT_REFUSE(20, "审核拒绝", "认证失败"),
AUDIT_PASS(30, "审核通过", "已认证"),
;
@JsonValue
private final Integer value;
private final String desc;
private final String certification;
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public String getCertification() {
return certification;
}
ApprovalStatusEnum(final Integer value, final String desc, final String certification) {
this.value = value;
this.desc = desc;
this.certification = certification;
}
public static String toDesc(Integer value) {
if (value == null) {
return "";
}
ApprovalStatusEnum[] values = ApprovalStatusEnum.values();
for (ApprovalStatusEnum item : values) {
if (item.value.equals(value)) {
return item.getDesc();
}
}
return "";
}
public static String toCertification(Integer value) {
if (value == null) {
return "";
}
ApprovalStatusEnum[] values = ApprovalStatusEnum.values();
for (ApprovalStatusEnum item : values) {
if (item.value.equals(value)) {
return item.getCertification();
}
}
return "";
}
}

View File

@ -0,0 +1,50 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 人员身份类型枚举
*
* @author xuyaozuo
* @since 2022/5/9 21:59
*/
@Getter
@AllArgsConstructor
public enum IdentityType {
/*人员身份类型*/
NOT_SUPPORT(0, "NOT_SUPPORT", "无效类型"),
WORKER(1, "WORKER", "工人"),
WORKER_LEADER(2, "WORKER_LEADER", "班组长"),
PRACTITIONER(3, "PRACTITIONER", "从业人员"),
REGULATOR(4, "REGULATOR", "监管人员"),
OPERATOR(5, "OPERATOR", "运营人员"),
;
@JsonValue
private final Integer code;
private final String message;
private final String desc;
public static IdentityType getIdentityType(Integer code) {
IdentityType[] values = values();
for (IdentityType item : values) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
public static IdentityType getIdentityType(String message) {
IdentityType[] values = values();
for (IdentityType item : values) {
if (item.getMessage().equals(message)) {
return item;
}
}
return null;
}
}

View File

@ -0,0 +1,42 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* 主体类型
*/
public enum MainBodyTypeEnum {
OU(1, "企业"),
CORPS(2, "团队"),
;
@JsonValue
private final Integer value;
private final String desc;
public static String toDesc(Integer mainBodyType) {
if (mainBodyType == null) {
return "";
}
MainBodyTypeEnum[] values = MainBodyTypeEnum.values();
for (MainBodyTypeEnum item : values) {
if (item.value.equals(mainBodyType)) {
return item.getDesc();
}
}
return "";
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
MainBodyTypeEnum(final Integer value, final String desc) {
this.value = value;
this.desc = desc;
}
}

View File

@ -0,0 +1,44 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* 企业入驻操作类型
*/
public enum OrgUnitRegisterActiveTypeEnum {
APPLY(1, "提交申请"),
RE_APPLY(2, "重新提交"),
PASS(3, "审核通过"),
REFUSE(4, "审核拒绝"),
;
@JsonValue
private final Integer code;
private final String desc;
public static String toDesc(Integer code) {
if (code == null) {
return "";
}
OrgUnitRegisterActiveTypeEnum[] values = OrgUnitRegisterActiveTypeEnum.values();
for (OrgUnitRegisterActiveTypeEnum item : values) {
if (item.code.equals(code)) {
return item.getDesc();
}
}
return "";
}
public Integer getCode() {
return this.code;
}
public String getDesc() {
return this.desc;
}
OrgUnitRegisterActiveTypeEnum(final Integer value, final String desc) {
this.code = value;
this.desc = desc;
}
}

View File

@ -0,0 +1,94 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 组织节点类型枚举
*
* @author zhangran
* @since 2022/5/22 19:50
**/
@Getter
@AllArgsConstructor
public enum OrganizationalNodeTypeEnum {
/**
* 默认单位位为65535
*/
ALL_TYPE(0, "默认节点类型", 65535),
/**
* 部门(团队也归属于部门)
*/
DEPARTMENT(1, "部门", 1),
/**
* 平台班组
*/
TEAM(2, "平台班组", 2),
/**
* 小组
*/
GROUP(3, "小组", 3),
/**
* 项目内班组
*/
PROJECT_TEAM(4, "项目内班组", 4),
/**
* 项目内小组
*/
PROJECT_GROUP(5, "项目内小组", 5),
;
@JsonValue
private final Integer value;
private final String desc;
private final Integer bitValue;
private static Map<Integer, OrganizationalNodeTypeEnum> bitMap;
public boolean isSameOrChildNodeType(Integer nodeType) {
OrganizationalNodeTypeEnum typeByeCode = getByNodeType(nodeType);
if (typeByeCode == null) {
return false;
}
return isSameOrChildNodeType(typeByeCode);
}
public boolean isSameOrChildNodeType(OrganizationalNodeTypeEnum type) {
if (this == type)
return true;
if (this == OrganizationalNodeTypeEnum.PROJECT_TEAM)
return type == OrganizationalNodeTypeEnum.PROJECT_GROUP;
return false;
}
public static OrganizationalNodeTypeEnum bitValueOf(Integer valueBit) {
if (valueBit == null) {
return null;
}
if (bitMap == null) {
bitMap = Arrays.stream(values())
.collect(
Collectors.toMap(OrganizationalNodeTypeEnum::getBitValue, Function.identity()));
}
return bitMap.get(valueBit);
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static OrganizationalNodeTypeEnum getByNodeType(Integer value) {
return Arrays.stream(values()).filter(o -> o.getValue().equals(value)).findFirst()
.orElse(null);
}
}

View File

@ -0,0 +1,47 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 单位组织-单位来源场景
*/
@Getter
@AllArgsConstructor
public enum OrganizationalUnitSceneTypeEnum {
/**
* 其他
*/
OTHER(0, "其他"),
CUSTOMER_REGISTRATION(1, "客户注册"),
PLATFORM_ENTRY(2, "平台录入"),
GENERAL_PACKAGE_CREATION(3, "总包创建"),
WEB_SCRAPING(4, "网络抓取"),
CREW_CREATION(5, "班组创建"),
;
@JsonValue
private final Integer value;
private final String desc;
/**
* 通过类型获取枚举
*
* @param value
* @return
*/
public static OrganizationalUnitSceneTypeEnum getByType(Integer value) {
return Arrays.stream(values()).filter(o -> o.getValue().equals(value)).findFirst().orElse(null);
}
}

View File

@ -0,0 +1,59 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 单位组织-单位状态枚举
*
* @author xiajiafu
* @since 2022/5/22
*/
@Getter
@AllArgsConstructor
public enum OrganizationalUnitStatusEnum {
/**
* 初始化
*/
INIT(0, "初始化"),
/**
* 审核中
*/
AUDITING(10, "审核中"),
/**
* 审核拒绝
*/
AUDIT_REFUSE(20, "审核拒绝"),
/**
* 审核通过
*/
AUDIT_PASS(30, "审核通过"),
/**
* 未认证
*/
UN_AUTH(40, "未认证"),
/**
* 已认证
*/
AUTH(50, "已认证");
@JsonValue
private final Integer value;
private final String desc;
/**
* 通过类型获取
*
* @param value
* @return
*/
public static OrganizationalUnitStatusEnum getByValue(Integer value) {
return Arrays.stream(values()).filter(o -> o.getValue().equals(value)).findFirst().orElse(null);
}
}

View File

@ -0,0 +1,141 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 单位组织-单位类型枚举
*
* @author xiajiafu
* @since 2022/5/22
*/
@Getter
@AllArgsConstructor
public enum OrganizationalUnitTypeEnum {
/**
* 默认单位位为65535
*/
ALL_TYPE(0, "默认单位", 65535),
/**
* 总包单位
*/
PRIMARY_CONTRACTING_UNIT(1, "总包单位", 1),
/**
* 建设单位
*/
CONSTRUCTION_UNIT(2, "建设单位", 2),
/**
* 监理单位
*/
SUPERVISION_UNIT(3, "监理单位", 4),
/**
* 劳务分包
*/
LABOR_SUBCONTRACTING(4, "劳务分包", 8),
/**
* 专业分包
*/
PROFESSIONAL_SUBCONTRACTING(5, "专业分包", 16),
/**
* 项目外班组
*/
PROJECT_OUT_TEAM(6, "班组", 32),
/**
* 安心筑平台
*/
AXZ_PLATFORM(7, "安心筑平台", 64),
/**
* 地勘单位
*/
SURVEY_UNIT(12, "地勘单位", 256),
/**
* 设计单位
*/
DESIGN_UNIT(13, "设计单位", 512),
/**
* 其他
*/
OTHER(30, "其他", 128),
;
@JsonValue
private final Integer value;
private final String desc;
private final Integer bitValue;
private static Map<Integer, OrganizationalUnitTypeEnum> bitMap;
private static final List<OrganizationalUnitTypeEnum> AGENCY_UNIT_TYPES;
static {
AGENCY_UNIT_TYPES = new ArrayList<>();
AGENCY_UNIT_TYPES.add(LABOR_SUBCONTRACTING);
AGENCY_UNIT_TYPES.add(PROFESSIONAL_SUBCONTRACTING);
}
public static OrganizationalUnitTypeEnum bitValueOf(Integer valueBit) {
if (valueBit == null) {
return null;
}
if (bitMap == null) {
bitMap = Arrays.stream(values())
.collect(
Collectors.toMap(OrganizationalUnitTypeEnum::getBitValue, Function.identity()));
}
return bitMap.get(valueBit);
}
public static OrganizationalUnitTypeEnum getByType(Integer type) {
return Arrays.stream(values()).filter(o -> o.getValue().equals(type)).findFirst()
.orElse(null);
}
/**
* 获取分包
*
* @return
*/
public static List<OrganizationalUnitTypeEnum> getAgencyUnitTypes() {
return AGENCY_UNIT_TYPES;
}
/**
* 是否分包单位
*
* @param type
* @return
*/
public static Boolean isAgencyUnit(Integer type) {
return AGENCY_UNIT_TYPES.stream().anyMatch(o -> o.getValue().equals(type));
}
/**
* 判断单位类型是 (总包劳务分包专业分包)
*
* @return
*/
public boolean isPrimaryOrSubcontracting() {
return Arrays.asList(OrganizationalUnitTypeEnum.PRIMARY_CONTRACTING_UNIT, OrganizationalUnitTypeEnum.LABOR_SUBCONTRACTING, OrganizationalUnitTypeEnum.PROFESSIONAL_SUBCONTRACTING).contains(this);
}
}

View File

@ -0,0 +1,49 @@
package cn.axzo.orgmanax.dto.unit.enums;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* 注册类型1:单位注册 2:施工资质注册 3:单位注册施工资质注册
*/
public enum RegisterTypeEnum {
OU_CORPS_REGISTER(1, "单位注册"),
QUA_REGISTER(2, "施工资质注册"),
;
@JsonValue
private final Integer value;
private final String desc;
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
RegisterTypeEnum(final Integer value, final String desc) {
this.value = value;
this.desc = desc;
}
public boolean apply(Integer registerType) {
if (registerType == null) {
return false;
}
return registerType.equals(this.value);
}
public static String toDesc(Integer value) {
if (value == null) {
return "";
}
RegisterTypeEnum[] values = RegisterTypeEnum.values();
for (RegisterTypeEnum item : values) {
if (item.value.equals(value)) {
return item.getDesc();
}
}
return "";
}
}