gaoluyang
4 天以前 d39e4f7d839167c16425086dfa2f8747bccfdff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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<Integer> {
 
    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();
    }
 
}