Merge branch 'feature/REQ-3488-zhh' into 'feature/REQ-3488'

Feature/req 3488 zhh

See merge request universal/infrastructure/backend/orgmanax!81
This commit is contained in:
张弘昊 2025-01-02 03:15:36 +00:00
commit ec5c35c1fb
8 changed files with 18 additions and 144 deletions

View File

@ -1,4 +1,4 @@
package cn.axzo.orgmanax.dto.unit.enums; package cn.axzo.orgmanax.dto.nodeuser.enums;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -12,7 +12,7 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum IdentityType { public enum IdentityTypeEnum {
/*人员身份类型*/ /*人员身份类型*/
NOT_SUPPORT(0, "NOT_SUPPORT", "无效类型"), NOT_SUPPORT(0, "NOT_SUPPORT", "无效类型"),
@ -28,9 +28,9 @@ public enum IdentityType {
private final String desc; private final String desc;
public static IdentityType getIdentityType(Integer code) { public static IdentityTypeEnum getIdentityType(Integer code) {
IdentityType[] values = values(); IdentityTypeEnum[] values = values();
for (IdentityType item : values) { for (IdentityTypeEnum item : values) {
if (item.getCode().equals(code)) { if (item.getCode().equals(code)) {
return item; return item;
} }
@ -38,9 +38,9 @@ public enum IdentityType {
return null; return null;
} }
public static IdentityType getIdentityType(String message) { public static IdentityTypeEnum getIdentityType(String message) {
IdentityType[] values = values(); IdentityTypeEnum[] values = values();
for (IdentityType item : values) { for (IdentityTypeEnum item : values) {
if (item.getMessage().equals(message)) { if (item.getMessage().equals(message)) {
return item; return item;
} }

View File

@ -1,94 +0,0 @@
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

@ -1,6 +1,6 @@
package cn.axzo.orgmanax.infra.client.profile.dto; package cn.axzo.orgmanax.infra.client.profile.dto;
import cn.axzo.orgmanax.infra.client.profile.enums.IdentityType; import cn.axzo.orgmanax.dto.nodeuser.enums.IdentityTypeEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -47,6 +47,6 @@ public class ProfileGetIdentityProfileLiteReq {
/** /**
* 身份类型 * 身份类型
*/ */
private IdentityType identityType; private IdentityTypeEnum identityType;
} }
} }

View File

@ -1,6 +1,6 @@
package cn.axzo.orgmanax.infra.client.profile.dto; package cn.axzo.orgmanax.infra.client.profile.dto;
import cn.axzo.orgmanax.infra.client.profile.enums.IdentityType; import cn.axzo.orgmanax.dto.nodeuser.enums.IdentityTypeEnum;
import cn.axzo.orgmanax.infra.client.profile.enums.SexType; import cn.axzo.orgmanax.infra.client.profile.enums.SexType;
import cn.axzo.orgmanax.infra.client.profile.enums.VerifyStatus; import cn.axzo.orgmanax.infra.client.profile.enums.VerifyStatus;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -28,7 +28,7 @@ public class ProfileGetIdentityProfileLiteResp {
/** /**
* 身份类型 1工人 2班组长 * 身份类型 1工人 2班组长
*/ */
private IdentityType identityType; private IdentityTypeEnum identityType;
/** /**
* 身份描述 * 身份描述

View File

@ -1,6 +1,6 @@
package cn.axzo.orgmanax.infra.client.profile.dto; package cn.axzo.orgmanax.infra.client.profile.dto;
import cn.axzo.orgmanax.infra.client.profile.enums.IdentityType; import cn.axzo.orgmanax.dto.nodeuser.enums.IdentityTypeEnum;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -16,5 +16,5 @@ import lombok.Setter;
@EqualsAndHashCode @EqualsAndHashCode
public class ProfileGetPersonIdListByIdentityReq { public class ProfileGetPersonIdListByIdentityReq {
private Long identityId; private Long identityId;
private IdentityType identityType; private IdentityTypeEnum identityType;
} }

View File

@ -1,6 +1,6 @@
package cn.axzo.orgmanax.infra.client.profile.dto; package cn.axzo.orgmanax.infra.client.profile.dto;
import cn.axzo.orgmanax.infra.client.profile.enums.IdentityType; import cn.axzo.orgmanax.dto.nodeuser.enums.IdentityTypeEnum;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -37,7 +37,7 @@ public class ProfileUserProfileCreateReq implements Serializable {
* 身份类型 * 身份类型
*/ */
@NotNull(message = "identityType can not be blank") @NotNull(message = "identityType can not be blank")
private IdentityType identityType; private IdentityTypeEnum identityType;
@Override @Override
public String toString() { public String toString() {

View File

@ -1,6 +1,6 @@
package cn.axzo.orgmanax.infra.client.profile.dto.model; package cn.axzo.orgmanax.infra.client.profile.dto.model;
import cn.axzo.orgmanax.infra.client.profile.enums.IdentityType; import cn.axzo.orgmanax.dto.nodeuser.enums.IdentityTypeEnum;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -18,7 +18,7 @@ public class AbstractIdentityProfileDto<T extends AbstractProfileDto<T>> extends
private String description = ""; private String description = "";
private IdentityType identityType = IdentityType.NOT_SUPPORT; private IdentityTypeEnum identityTypeEnum = IdentityTypeEnum.NOT_SUPPORT;
private PersonProfileDto personProfile; private PersonProfileDto personProfile;
} }

View File

@ -1,32 +0,0 @@
package cn.axzo.orgmanax.infra.client.profile.enums;
import cn.axzo.orgmanax.infra.client.profile.dto.model.CodeDefinition;
import com.baomidou.mybatisplus.annotation.EnumValue;
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 implements IEnum, CodeDefinition<Integer> {
/*人员身份类型*/
NOT_SUPPORT(0, "NOT_SUPPORT", "无效类型"),
WORKER(1, "WORKER", "工人"),
WORKER_LEADER(2, "WORKER_LEADER", "班组长"),
PRACTITIONER(3, "PRACTITIONER", "从业人员"),
REGULATOR(4, "REGULATOR", "监管人员"),
OPERATOR(5, "OPERATOR", "运营人员"),
;
@EnumValue
@JsonValue
private final Integer code;
private final String message;
private final String desc;
}