Commit 36d09647def7fafd4ee012c49f8c6b501a24129a
1 parent
ef078263
订单相关枚举类
Showing
5 changed files
with
215 additions
and
23 deletions
src/main/java/com/diligrp/xtrade/order/domain/emuns/IdGenerator.java
... | ... | @@ -33,7 +33,7 @@ public enum IdGenerator { |
33 | 33 | return name; |
34 | 34 | } |
35 | 35 | |
36 | - public static IdGenerator getByType(int code) { | |
36 | + public static IdGenerator getByCode(int code) { | |
37 | 37 | for (IdGenerator idGenerator : values()) { |
38 | 38 | if (idGenerator.getCode() == code) { |
39 | 39 | return idGenerator; |
... | ... | @@ -42,9 +42,9 @@ public enum IdGenerator { |
42 | 42 | return null; |
43 | 43 | } |
44 | 44 | |
45 | - public static String getName(int index) { | |
45 | + public static String getNameByCode(int code) { | |
46 | 46 | for (IdGenerator idGenerator : IdGenerator.values()) { |
47 | - if (idGenerator.getCode() == index) { | |
47 | + if (idGenerator.getCode() == code) { | |
48 | 48 | return idGenerator.name; |
49 | 49 | } |
50 | 50 | } | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/emuns/OrderCreateSrc.java
1 | -package com.diligrp.xtrade.order.domain.emuns; | |
2 | - | |
3 | -public enum OrderCreateSrc { | |
4 | - | |
5 | -} | |
1 | +package com.diligrp.xtrade.order.domain.emuns; | |
2 | + | |
3 | +/** | |
4 | + * @ClassName: OrderCreateSrc | |
5 | + * @Description 订单创建来源枚举类 | |
6 | + * @author zhangxing | |
7 | + * @date 2020年4月21日 | |
8 | + */ | |
9 | +public enum OrderCreateSrc { | |
10 | + | |
11 | + // 来源销售易app | |
12 | + APP(1, "销售易APP"); | |
13 | + | |
14 | + // 编码 | |
15 | + private int code; | |
16 | + | |
17 | + // 名称 | |
18 | + private String name; | |
19 | + | |
20 | + private OrderCreateSrc(int code, String name) { | |
21 | + this.code = code; | |
22 | + this.name = name; | |
23 | + } | |
24 | + | |
25 | + public int getCode() { | |
26 | + return code; | |
27 | + } | |
28 | + | |
29 | + public String getName() { | |
30 | + return name; | |
31 | + } | |
32 | + | |
33 | + public static OrderCreateSrc getByCode(int code) { | |
34 | + for (OrderCreateSrc orderCreateSrc : values()) { | |
35 | + if (orderCreateSrc.getCode() == code) { | |
36 | + return orderCreateSrc; | |
37 | + } | |
38 | + } | |
39 | + return null; | |
40 | + } | |
41 | + | |
42 | + public static String getNameByCode(int code) { | |
43 | + for (OrderCreateSrc orderCreateSrc : OrderCreateSrc.values()) { | |
44 | + if (orderCreateSrc.getCode() == code) { | |
45 | + return orderCreateSrc.name; | |
46 | + } | |
47 | + } | |
48 | + return null; | |
49 | + } | |
50 | +} | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/emuns/OrderStatus.java
1 | -package com.diligrp.xtrade.order.domain.emuns; | |
2 | - | |
3 | -public enum OrderStatus { | |
4 | - | |
5 | -} | |
1 | +package com.diligrp.xtrade.order.domain.emuns; | |
2 | + | |
3 | +/** | |
4 | + * @ClassName: OrderStatus | |
5 | + * @Description 订单状态枚举类 | |
6 | + * @author zhangxing | |
7 | + * @date 2020年4月21日 | |
8 | + */ | |
9 | +public enum OrderStatus { | |
10 | + | |
11 | + /** | |
12 | + * 未支付 | |
13 | + */ | |
14 | + UNPAIED(1, "未支付"); | |
15 | + | |
16 | + // 编码 | |
17 | + private int code; | |
18 | + | |
19 | + // 名称 | |
20 | + private String name; | |
21 | + | |
22 | + private OrderStatus(int code, String name) { | |
23 | + this.code = code; | |
24 | + this.name = name; | |
25 | + } | |
26 | + | |
27 | + public int getCode() { | |
28 | + return code; | |
29 | + } | |
30 | + | |
31 | + public String getName() { | |
32 | + return name; | |
33 | + } | |
34 | + | |
35 | + public static OrderStatus getByCode(int code) { | |
36 | + for (OrderStatus orderStatus : values()) { | |
37 | + if (orderStatus.getCode() == code) { | |
38 | + return orderStatus; | |
39 | + } | |
40 | + } | |
41 | + return null; | |
42 | + } | |
43 | + | |
44 | + public static String getNameByCode(int code) { | |
45 | + for (OrderStatus orderStatus : OrderStatus.values()) { | |
46 | + if (orderStatus.getCode() == code) { | |
47 | + return orderStatus.name; | |
48 | + } | |
49 | + } | |
50 | + return null; | |
51 | + } | |
52 | +} | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/emuns/PayType.java
1 | -package com.diligrp.xtrade.order.domain.emuns; | |
2 | - | |
3 | -public enum PayType { | |
4 | - | |
5 | -} | |
1 | +package com.diligrp.xtrade.order.domain.emuns; | |
2 | + | |
3 | +/** | |
4 | + * @ClassName: PayType | |
5 | + * @Description 支付方式枚举类 | |
6 | + * @author zhangxing | |
7 | + * @date 2020年4月21日 | |
8 | + */ | |
9 | +public enum PayType { | |
10 | + | |
11 | + /** | |
12 | + * 未支付 | |
13 | + */ | |
14 | + ACCOUNT(1, "账户支付"); | |
15 | + | |
16 | + // 编码 | |
17 | + private int code; | |
18 | + | |
19 | + // 名称 | |
20 | + private String name; | |
21 | + | |
22 | + private PayType(int code, String name) { | |
23 | + this.code = code; | |
24 | + this.name = name; | |
25 | + } | |
26 | + | |
27 | + public int getCode() { | |
28 | + return code; | |
29 | + } | |
30 | + | |
31 | + public String getName() { | |
32 | + return name; | |
33 | + } | |
34 | + | |
35 | + public static PayType getByCode(int code) { | |
36 | + for (PayType payType : values()) { | |
37 | + if (payType.getCode() == code) { | |
38 | + return payType; | |
39 | + } | |
40 | + } | |
41 | + return null; | |
42 | + } | |
43 | + | |
44 | + public static String getNameByCode(int code) { | |
45 | + for (PayType payType : PayType.values()) { | |
46 | + if (payType.getCode() == code) { | |
47 | + return payType.name; | |
48 | + } | |
49 | + } | |
50 | + return null; | |
51 | + } | |
52 | +} | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/emuns/SaleUnit.java
1 | -package com.diligrp.xtrade.order.domain.emuns; | |
2 | - | |
3 | -public enum SaleUnit { | |
4 | - | |
5 | -} | |
1 | +package com.diligrp.xtrade.order.domain.emuns; | |
2 | + | |
3 | +/** | |
4 | + * @ClassName: SaleUnit | |
5 | + * @Description 销售单位枚举类 | |
6 | + * @author zhangxing | |
7 | + * @date 2020年4月21日 | |
8 | + */ | |
9 | +public enum SaleUnit { | |
10 | + | |
11 | + /** | |
12 | + * 单位斤 | |
13 | + */ | |
14 | + KILO(1, "斤"), | |
15 | + | |
16 | + /** | |
17 | + * 单位件 | |
18 | + */ | |
19 | + PIECE(2, "斤"); | |
20 | + | |
21 | + // 编码 | |
22 | + private int code; | |
23 | + | |
24 | + // 名称 | |
25 | + private String name; | |
26 | + | |
27 | + private SaleUnit(int code, String name) { | |
28 | + this.code = code; | |
29 | + this.name = name; | |
30 | + } | |
31 | + | |
32 | + public int getCode() { | |
33 | + return code; | |
34 | + } | |
35 | + | |
36 | + public String getName() { | |
37 | + return name; | |
38 | + } | |
39 | + | |
40 | + public static SaleUnit getByCode(int code) { | |
41 | + for (SaleUnit saleUnit : values()) { | |
42 | + if (saleUnit.getCode() == code) { | |
43 | + return saleUnit; | |
44 | + } | |
45 | + } | |
46 | + return null; | |
47 | + } | |
48 | + | |
49 | + public static String getNameByCode(int code) { | |
50 | + for (SaleUnit saleUnit : SaleUnit.values()) { | |
51 | + if (saleUnit.getCode() == code) { | |
52 | + return saleUnit.name; | |
53 | + } | |
54 | + } | |
55 | + return null; | |
56 | + } | |
57 | + | |
58 | +} | ... | ... |