package cn.iocoder.yudao.module.crm.enums.receivable; import cn.iocoder.yudao.framework.common.core.ArrayValuable; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.Arrays; /** * CRM 回款核销业务类型枚举 * * 数值与 ERP {@code ErpBizTypeEnum} 的销售侧保持一致,开票使用 23。 * * @author 超级管理员 */ @RequiredArgsConstructor @Getter public enum CrmReceivableBizTypeEnum implements ArrayValuable { SALE_ORDER(20, "销售订单"), SALE_OUT(21, "销售出库"), SALE_INVOICE(23, "开票"); public static final Integer[] ARRAYS = Arrays.stream(values()).map(CrmReceivableBizTypeEnum::getType).toArray(Integer[]::new); /** * 类型 */ private final Integer type; /** * 名称 */ private final String name; @Override public Integer[] array() { return ARRAYS; } public static CrmReceivableBizTypeEnum valueOf(Integer type) { return Arrays.stream(values()).filter(item -> item.getType().equals(type)).findFirst().orElse(null); } public static String getNameByType(Integer type) { CrmReceivableBizTypeEnum item = valueOf(type); return item == null ? String.valueOf(type) : item.getName(); } }