Commit c8e3c0962942990cf10c9a6f856a42f3a280d114
1 parent
eab8b35d
已完成订单提交逻辑,不过dao层还有些问题
Showing
49 changed files
with
969 additions
and
992 deletions
b2c-orders-client/pom.xml
... | ... | @@ -57,6 +57,10 @@ |
57 | 57 | </exclusions> |
58 | 58 | </dependency> |
59 | 59 | <dependency> |
60 | + <groupId>org.springframework</groupId> | |
61 | + <artifactId>spring-context-support</artifactId> | |
62 | + </dependency> | |
63 | + <dependency> | |
60 | 64 | <groupId>org.hibernate</groupId> |
61 | 65 | <artifactId>hibernate-validator</artifactId> |
62 | 66 | </dependency> |
... | ... | @@ -80,22 +84,45 @@ |
80 | 84 | <groupId>org.slf4j</groupId> |
81 | 85 | <artifactId>slf4j-api</artifactId> |
82 | 86 | </dependency> |
83 | - <!-- <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> | |
84 | - </dependency> Just the annotations; use this dependency if you want to attach | |
85 | - annotations to classes without connecting them to the code. <dependency> | |
86 | - <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> | |
87 | - </dependency> databinding; ObjectMapper, JsonNode and related classes are | |
88 | - here <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> | |
89 | - </dependency> smile (binary JSON). Other artifacts in this group do other | |
90 | - formats. <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> | |
91 | - <artifactId>jackson-dataformat-smile</artifactId> </dependency> <dependency> | |
92 | - <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> | |
93 | - </dependency> <dependency> <groupId>org.codehaus.woodstox</groupId> <artifactId>woodstox-core-asl</artifactId> | |
94 | - </dependency> JAX-RS provider <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> | |
95 | - <artifactId>jackson-jaxrs-json-provider</artifactId> </dependency> Support | |
96 | - for JAX-B annotations as additional configuration <dependency> <groupId>com.fasterxml.jackson.module</groupId> | |
97 | - <artifactId>jackson-module-jaxb-annotations</artifactId> </dependency> --> | |
98 | - <!-- <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> | |
99 | - </dependency> --> | |
87 | + <dependency> | |
88 | + <groupId>com.fasterxml.jackson.core</groupId> | |
89 | + <artifactId>jackson-core</artifactId> | |
90 | + </dependency> | |
91 | + | |
92 | + <!-- Just the annotations; use this dependency if you want to attach annotations | |
93 | + to classes without connecting them to the code. --> | |
94 | + <dependency> | |
95 | + <groupId>com.fasterxml.jackson.core</groupId> | |
96 | + <artifactId>jackson-annotations</artifactId> | |
97 | + </dependency> | |
98 | + | |
99 | + <!-- databinding; ObjectMapper, JsonNode and related classes are here --> | |
100 | + <dependency> | |
101 | + <groupId>com.fasterxml.jackson.core</groupId> | |
102 | + <artifactId>jackson-databind</artifactId> | |
103 | + </dependency> | |
104 | + <!-- smile (binary JSON). Other artifacts in this group do other formats. --> | |
105 | + <dependency> | |
106 | + <groupId>com.fasterxml.jackson.dataformat</groupId> | |
107 | + <artifactId>jackson-dataformat-smile</artifactId> | |
108 | + </dependency> | |
109 | + <dependency> | |
110 | + <groupId>com.fasterxml.jackson.dataformat</groupId> | |
111 | + <artifactId>jackson-dataformat-xml</artifactId> | |
112 | + </dependency> | |
113 | + <dependency> | |
114 | + <groupId>org.codehaus.woodstox</groupId> | |
115 | + <artifactId>woodstox-core-asl</artifactId> | |
116 | + </dependency> | |
117 | + <!-- JAX-RS provider --> | |
118 | + <dependency> | |
119 | + <groupId>com.fasterxml.jackson.jaxrs</groupId> | |
120 | + <artifactId>jackson-jaxrs-json-provider</artifactId> | |
121 | + </dependency> | |
122 | + <!-- Support for JAX-B annotations as additional configuration --> | |
123 | + <dependency> | |
124 | + <groupId>com.fasterxml.jackson.module</groupId> | |
125 | + <artifactId>jackson-module-jaxb-annotations</artifactId> | |
126 | + </dependency> | |
100 | 127 | </dependencies> |
101 | 128 | </project> |
102 | 129 | \ No newline at end of file | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/client/domain/dto/request/OrderItemDto.java
... | ... | @@ -2,10 +2,9 @@ package com.b2c.orders.client.domain.dto.request; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | 4 | |
5 | -import javax.validation.constraints.Min; | |
6 | 5 | import javax.validation.constraints.NotNull; |
7 | 6 | |
8 | -import org.hibernate.validator.constraints.NotBlank; | |
7 | +import io.swagger.annotations.ApiParam; | |
9 | 8 | |
10 | 9 | public class OrderItemDto implements Serializable { |
11 | 10 | |
... | ... | @@ -14,19 +13,36 @@ public class OrderItemDto implements Serializable { |
14 | 13 | */ |
15 | 14 | private static final long serialVersionUID = 2876508071333281636L; |
16 | 15 | |
17 | -// @ApiParam(value = "商品id", required = true) | |
16 | + @ApiParam("商品id") | |
17 | + @NotNull(message = "商品id不能为空") | |
18 | 18 | private Long productId; |
19 | -// @ApiParam(value = "商品sku", required = true) | |
20 | - @NotBlank(message = "商品sku不能为空") | |
19 | + @ApiParam("买家id") | |
20 | + @NotNull(message = "买家id不能为空") | |
21 | + private Long buyerId; | |
22 | + @ApiParam("商家id") | |
23 | + @NotNull(message = "商家id不能为空") | |
24 | + private Long sellerId; | |
25 | + @ApiParam("sku编号") | |
26 | + @NotNull(message = "sku编号不能为空") | |
21 | 27 | private String sku; |
22 | -// @ApiParam(value = "购买数量", required = true) | |
23 | - @NotNull(message = "商品购买数量amount不能为空") | |
24 | - @Min(value = 1, message = "商品购买数量amount必须大于等于1") | |
28 | + @ApiParam("sku标题") | |
29 | + @NotNull(message = "sku标题不能为空") | |
30 | + private String skuTitle; | |
31 | + @ApiParam("sku属性") | |
32 | + @NotNull(message = "sku属性不能为空") | |
33 | + private String skuAttributes; | |
34 | + @ApiParam("购买数量") | |
35 | + @NotNull(message = "购买数量不能为空") | |
25 | 36 | private Integer amount; |
26 | -// @ApiParam(value = "商品价格,整型,单位:分 ", required = true) | |
27 | - @NotNull(message = "商品价格price不能为空") | |
28 | - @Min(value = 0, message = "商品价格price必须大于等于0分") | |
29 | - private Long price; | |
37 | + @ApiParam("sku价格") | |
38 | + @NotNull(message = "sku价格不能为空") | |
39 | + private Long skuPrice; | |
40 | + @ApiParam("sku图片") | |
41 | + @NotNull(message = "sku图片不能为空") | |
42 | + private String skuPicture; | |
43 | + @ApiParam("sku单位") | |
44 | + @NotNull(message = "单位不能为空") | |
45 | + private String priceUnit; | |
30 | 46 | |
31 | 47 | public Long getProductId() { |
32 | 48 | return productId; |
... | ... | @@ -36,6 +52,22 @@ public class OrderItemDto implements Serializable { |
36 | 52 | this.productId = productId; |
37 | 53 | } |
38 | 54 | |
55 | + public Long getBuyerId() { | |
56 | + return buyerId; | |
57 | + } | |
58 | + | |
59 | + public void setBuyerId(Long buyerId) { | |
60 | + this.buyerId = buyerId; | |
61 | + } | |
62 | + | |
63 | + public Long getSellerId() { | |
64 | + return sellerId; | |
65 | + } | |
66 | + | |
67 | + public void setSellerId(Long sellerId) { | |
68 | + this.sellerId = sellerId; | |
69 | + } | |
70 | + | |
39 | 71 | public String getSku() { |
40 | 72 | return sku; |
41 | 73 | } |
... | ... | @@ -44,6 +76,22 @@ public class OrderItemDto implements Serializable { |
44 | 76 | this.sku = sku; |
45 | 77 | } |
46 | 78 | |
79 | + public String getSkuTitle() { | |
80 | + return skuTitle; | |
81 | + } | |
82 | + | |
83 | + public void setSkuTitle(String skuTitle) { | |
84 | + this.skuTitle = skuTitle; | |
85 | + } | |
86 | + | |
87 | + public String getSkuAttributes() { | |
88 | + return skuAttributes; | |
89 | + } | |
90 | + | |
91 | + public void setSkuAttributes(String skuAttributes) { | |
92 | + this.skuAttributes = skuAttributes; | |
93 | + } | |
94 | + | |
47 | 95 | public Integer getAmount() { |
48 | 96 | return amount; |
49 | 97 | } |
... | ... | @@ -52,12 +100,28 @@ public class OrderItemDto implements Serializable { |
52 | 100 | this.amount = amount; |
53 | 101 | } |
54 | 102 | |
55 | - public Long getPrice() { | |
56 | - return price; | |
103 | + public Long getSkuPrice() { | |
104 | + return skuPrice; | |
105 | + } | |
106 | + | |
107 | + public void setSkuPrice(Long skuPrice) { | |
108 | + this.skuPrice = skuPrice; | |
109 | + } | |
110 | + | |
111 | + public String getSkuPicture() { | |
112 | + return skuPicture; | |
113 | + } | |
114 | + | |
115 | + public void setSkuPicture(String skuPicture) { | |
116 | + this.skuPicture = skuPicture; | |
117 | + } | |
118 | + | |
119 | + public String getPriceUnit() { | |
120 | + return priceUnit; | |
57 | 121 | } |
58 | 122 | |
59 | - public void setPrice(Long price) { | |
60 | - this.price = price; | |
123 | + public void setPriceUnit(String priceUnit) { | |
124 | + this.priceUnit = priceUnit; | |
61 | 125 | } |
62 | 126 | |
63 | 127 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/client/domain/dto/request/SubmitOrderRequestDto.java
... | ... | @@ -4,9 +4,11 @@ import java.io.Serializable; |
4 | 4 | import java.util.Date; |
5 | 5 | import java.util.List; |
6 | 6 | |
7 | -import com.b2c.orders.enums.OrderDeliveryType; | |
7 | +import com.b2c.orders.enums.DeliveryType; | |
8 | 8 | import com.b2c.orders.enums.PayType; |
9 | 9 | |
10 | +import io.swagger.annotations.ApiParam; | |
11 | + | |
10 | 12 | public class SubmitOrderRequestDto implements Serializable { |
11 | 13 | |
12 | 14 | /** |
... | ... | @@ -14,26 +16,23 @@ public class SubmitOrderRequestDto implements Serializable { |
14 | 16 | */ |
15 | 17 | private static final long serialVersionUID = 5060629945327592074L; |
16 | 18 | |
17 | -// @ApiParam(value = "买家id", required = true) | |
19 | + @ApiParam(value = "买家id", required = true) | |
18 | 20 | private Long buyerId; |
19 | -// @ApiParam(value = "卖家id", required = true) | |
21 | + @ApiParam(value = "卖家id", required = true) | |
20 | 22 | private Long sellerId; |
21 | - private String sellerName; | |
22 | -// @ApiParam(value = "配送类型", required = true) | |
23 | - private OrderDeliveryType deliveryType; | |
24 | -// @ApiParam(value = "买家备注说明", required = true) | |
23 | + @ApiParam(value = "配送类型", required = true) | |
24 | + private Integer deliveryType; | |
25 | + @ApiParam(value = "买家备注说明", required = true) | |
25 | 26 | private String buyerMemo; |
26 | -// @ApiParam(value = "支付类型", required = true) | |
27 | - private PayType payType; | |
28 | -// @ApiParam(value = "最新商品总金额", required = true) | |
29 | - private Long priceTotal; | |
30 | -// @ApiParam(value = "店铺ID", required = true) | |
27 | + @ApiParam(value = "支付类型", required = true) | |
28 | + private Integer payType; | |
29 | + @ApiParam(value = "店铺ID", required = true) | |
31 | 30 | private Long shopId; |
32 | -// @ApiParam(value = "送货时间") | |
33 | - private Date deliveryTime; | |
34 | -// @ApiParam(value = "提货时间") | |
35 | - private Date reservationTime; | |
36 | -// @ApiParam(value = "订单项", required = true) | |
31 | + @ApiParam(value = "送货时间") | |
32 | + private String deliveryTime; | |
33 | + @ApiParam(value = "提货时间") | |
34 | + private String reservationTime; | |
35 | + @ApiParam(value = "订单项", required = true) | |
37 | 36 | private List<OrderItemDto> orderItems; |
38 | 37 | |
39 | 38 | public Long getBuyerId() { |
... | ... | @@ -52,19 +51,11 @@ public class SubmitOrderRequestDto implements Serializable { |
52 | 51 | this.sellerId = sellerId; |
53 | 52 | } |
54 | 53 | |
55 | - public String getSellerName() { | |
56 | - return sellerName; | |
57 | - } | |
58 | - | |
59 | - public void setSellerName(String sellerName) { | |
60 | - this.sellerName = sellerName; | |
61 | - } | |
62 | - | |
63 | - public OrderDeliveryType getDeliveryType() { | |
54 | + public Integer getDeliveryType() { | |
64 | 55 | return deliveryType; |
65 | 56 | } |
66 | 57 | |
67 | - public void setDeliveryType(OrderDeliveryType deliveryType) { | |
58 | + public void setDeliveryType(Integer deliveryType) { | |
68 | 59 | this.deliveryType = deliveryType; |
69 | 60 | } |
70 | 61 | |
... | ... | @@ -76,22 +67,14 @@ public class SubmitOrderRequestDto implements Serializable { |
76 | 67 | this.buyerMemo = buyerMemo; |
77 | 68 | } |
78 | 69 | |
79 | - public PayType getPayType() { | |
70 | + public Integer getPayType() { | |
80 | 71 | return payType; |
81 | 72 | } |
82 | 73 | |
83 | - public void setPayType(PayType payType) { | |
74 | + public void setPayType(Integer payType) { | |
84 | 75 | this.payType = payType; |
85 | 76 | } |
86 | 77 | |
87 | - public Long getPriceTotal() { | |
88 | - return priceTotal; | |
89 | - } | |
90 | - | |
91 | - public void setPriceTotal(Long priceTotal) { | |
92 | - this.priceTotal = priceTotal; | |
93 | - } | |
94 | - | |
95 | 78 | public Long getShopId() { |
96 | 79 | return shopId; |
97 | 80 | } |
... | ... | @@ -100,28 +83,28 @@ public class SubmitOrderRequestDto implements Serializable { |
100 | 83 | this.shopId = shopId; |
101 | 84 | } |
102 | 85 | |
103 | - public List<OrderItemDto> getOrderItems() { | |
104 | - return orderItems; | |
105 | - } | |
106 | - | |
107 | - public void setOrderItems(List<OrderItemDto> orderItems) { | |
108 | - this.orderItems = orderItems; | |
109 | - } | |
110 | - | |
111 | - public Date getDeliveryTime() { | |
86 | + public String getDeliveryTime() { | |
112 | 87 | return deliveryTime; |
113 | 88 | } |
114 | 89 | |
115 | - public void setDeliveryTime(Date deliveryTime) { | |
90 | + public void setDeliveryTime(String deliveryTime) { | |
116 | 91 | this.deliveryTime = deliveryTime; |
117 | 92 | } |
118 | 93 | |
119 | - public Date getReservationTime() { | |
94 | + public String getReservationTime() { | |
120 | 95 | return reservationTime; |
121 | 96 | } |
122 | 97 | |
123 | - public void setReservationTime(Date reservationTime) { | |
98 | + public void setReservationTime(String reservationTime) { | |
124 | 99 | this.reservationTime = reservationTime; |
125 | 100 | } |
126 | 101 | |
102 | + public List<OrderItemDto> getOrderItems() { | |
103 | + return orderItems; | |
104 | + } | |
105 | + | |
106 | + public void setOrderItems(List<OrderItemDto> orderItems) { | |
107 | + this.orderItems = orderItems; | |
108 | + } | |
109 | + | |
127 | 110 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/client/domain/dto/response/OrderListResponseDto.java
... | ... | @@ -3,7 +3,7 @@ package com.b2c.orders.client.domain.dto.response; |
3 | 3 | import java.util.Date; |
4 | 4 | import java.util.List; |
5 | 5 | |
6 | -import com.b2c.orders.enums.OrderDeliveryType; | |
6 | +import com.b2c.orders.enums.DeliveryType; | |
7 | 7 | import com.b2c.orders.enums.OrderStatus; |
8 | 8 | import com.b2c.orders.enums.PayStatus; |
9 | 9 | import com.b2c.orders.enums.PayType; |
... | ... | @@ -23,7 +23,7 @@ public class OrderListResponseDto { |
23 | 23 | */ |
24 | 24 | private Long buyerId; |
25 | 25 | /** 配送类型 */ |
26 | - private OrderDeliveryType deliveryType; | |
26 | + private DeliveryType deliveryType; | |
27 | 27 | /** 订单状态 */ |
28 | 28 | private OrderStatus orderStatus; |
29 | 29 | /** 支付状态 */ |
... | ... | @@ -77,11 +77,11 @@ public class OrderListResponseDto { |
77 | 77 | this.buyerId = buyerId; |
78 | 78 | } |
79 | 79 | |
80 | - public OrderDeliveryType getDeliveryType() { | |
80 | + public DeliveryType getDeliveryType() { | |
81 | 81 | return deliveryType; |
82 | 82 | } |
83 | 83 | |
84 | - public void setDeliveryType(OrderDeliveryType deliveryType) { | |
84 | + public void setDeliveryType(DeliveryType deliveryType) { | |
85 | 85 | this.deliveryType = deliveryType; |
86 | 86 | } |
87 | 87 | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/StockLockType.java renamed to b2c-orders-client/src/main/java/com/b2c/orders/enums/Action.java
1 | 1 | package com.b2c.orders.enums; |
2 | 2 | |
3 | -/** | |
4 | - * 库存锁类型:10扣量,20返量 | |
5 | - */ | |
6 | -public enum StockLockType { | |
7 | - /** 10扣量 */ | |
8 | - DecraseStock(10), | |
9 | - /** 20返量 */ | |
10 | - IncraseStock(20); | |
11 | - | |
12 | - // 成员变量 | |
13 | - private int index; | |
14 | - | |
15 | - public static StockLockType getStockLockType(int index) { | |
16 | - for (StockLockType c : StockLockType.values()) { | |
17 | - if (c.getIndex() == index) { | |
18 | - return c; | |
19 | - } | |
20 | - } | |
21 | - return null; | |
22 | - } | |
23 | - | |
24 | - // 构造方法 | |
25 | - private StockLockType(int index) { | |
26 | - this.index = index; | |
27 | - } | |
28 | - | |
29 | - public int getIndex() { | |
30 | - return index; | |
31 | - } | |
32 | - | |
33 | - public void setIndex(int index) { | |
34 | - this.index = index; | |
35 | - } | |
36 | -} | |
37 | 3 | \ No newline at end of file |
4 | +import com.fasterxml.jackson.annotation.JsonValue; | |
5 | + | |
6 | +public enum Action { | |
7 | + | |
8 | + BUYER_PLACE_ORDER(10, "买家下单"); | |
9 | + | |
10 | + private int index; | |
11 | + private String name; | |
12 | + | |
13 | + private Action(int index, String name) { | |
14 | + } | |
15 | + | |
16 | + @JsonValue | |
17 | + public int getIndex() { | |
18 | + return index; | |
19 | + } | |
20 | + | |
21 | + public String getName() { | |
22 | + return name; | |
23 | + } | |
24 | + | |
25 | + public static Action get(Integer index) { | |
26 | + for (Action c : Action.values()) { | |
27 | + if (c.getIndex() == index) { | |
28 | + return c; | |
29 | + } | |
30 | + } | |
31 | + return null; | |
32 | + } | |
33 | + | |
34 | +} | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderDeliveryType.java renamed to b2c-orders-client/src/main/java/com/b2c/orders/enums/DeliveryType.java
... | ... | @@ -2,44 +2,42 @@ package com.b2c.orders.enums; |
2 | 2 | |
3 | 3 | import java.util.Map; |
4 | 4 | |
5 | +import com.fasterxml.jackson.annotation.JsonValue; | |
5 | 6 | import com.google.common.collect.Maps; |
6 | 7 | |
7 | -import lombok.Getter; | |
8 | - | |
9 | 8 | /** |
10 | 9 | * 订单配送方式:上门自提 10、送货上门 20、现场交易 30、物流配送40 |
11 | 10 | */ |
12 | -public enum OrderDeliveryType { | |
11 | +public enum DeliveryType { | |
13 | 12 | /** 上门自提 10 */ |
14 | 13 | Self(10, "上门自提"), |
15 | 14 | /** 送货上门 20 */ |
16 | 15 | Delivery(20, "送货上门"); |
17 | 16 | |
18 | 17 | // 成员变量 |
19 | - @Getter | |
20 | 18 | private int index; |
21 | - @Getter | |
22 | 19 | private String desc; |
23 | 20 | |
24 | 21 | /** |
25 | 22 | * 内部静态map对象 |
26 | 23 | */ |
27 | - private static Map<Integer, OrderDeliveryType> initMaps = Maps.newHashMap(); | |
24 | + private static Map<Integer, DeliveryType> initMaps = Maps.newHashMap(); | |
28 | 25 | |
29 | 26 | /** |
30 | 27 | * 静态初始化到map中 |
31 | 28 | */ |
32 | 29 | static { |
33 | - for (OrderDeliveryType c : OrderDeliveryType.values()) { | |
30 | + for (DeliveryType c : DeliveryType.values()) { | |
34 | 31 | initMaps.put(c.getIndex(), c); |
35 | 32 | } |
36 | 33 | } |
37 | 34 | |
38 | - OrderDeliveryType(int index, String desc) { | |
35 | + DeliveryType(int index, String desc) { | |
39 | 36 | this.index = index; |
40 | 37 | this.desc = desc; |
41 | 38 | } |
42 | 39 | |
40 | + @JsonValue | |
43 | 41 | public int getIndex() { |
44 | 42 | return index; |
45 | 43 | } |
... | ... | @@ -56,7 +54,10 @@ public enum OrderDeliveryType { |
56 | 54 | this.desc = desc; |
57 | 55 | } |
58 | 56 | |
59 | - public static OrderDeliveryType getDeliveryType(Integer index) { | |
57 | + public static DeliveryType getDeliveryType(Integer index) { | |
58 | + if (!initMaps.containsKey(index)) { | |
59 | + throw new IllegalArgumentException("未知的配送类型"); | |
60 | + } | |
60 | 61 | return initMaps.get(index); |
61 | 62 | } |
62 | 63 | |
... | ... | @@ -76,7 +77,7 @@ public enum OrderDeliveryType { |
76 | 77 | * @param deliveryType |
77 | 78 | * @return |
78 | 79 | */ |
79 | - public static boolean isSelf(OrderDeliveryType deliveryType) { | |
80 | + public static boolean isSelf(DeliveryType deliveryType) { | |
80 | 81 | return deliveryType == Self ? true : false; |
81 | 82 | } |
82 | 83 | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/MarketDelivery.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Map; | |
7 | - | |
8 | -/** | |
9 | - * <B>是否市场内交割</B> <B>Copyright</B> 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | - * <B>地利集团</B> | |
11 | - * | |
12 | - * @author yuehongbo | |
13 | - * @createTime 2016/9/10 10:43 | |
14 | - */ | |
15 | -public enum MarketDelivery { | |
16 | - /** 市场内交割 */ | |
17 | - YES(1, "是"), | |
18 | - /** 市场外交割 */ | |
19 | - NO(2, "否"),; | |
20 | - @Getter | |
21 | - private int index; | |
22 | - @Getter | |
23 | - private String value; | |
24 | - | |
25 | - private static Map<Integer, MarketDelivery> initMaps = Maps.newHashMap(); | |
26 | - | |
27 | - static { | |
28 | - for (MarketDelivery m : MarketDelivery.values()) { | |
29 | - initMaps.put(m.getIndex(), m); | |
30 | - } | |
31 | - } | |
32 | - | |
33 | - MarketDelivery(int index, String value) { | |
34 | - this.index = index; | |
35 | - this.value = value; | |
36 | - } | |
37 | - | |
38 | - public static MarketDelivery get(Integer index) { | |
39 | - return initMaps.get(index); | |
40 | - } | |
41 | -} |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderBrokerageStatus.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Map; | |
7 | - | |
8 | -/** | |
9 | - * <B>订单的佣金信息状态</B> | |
10 | - * <B>Copyright</B> | |
11 | - * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | - * <B>地利集团</B> | |
13 | - * | |
14 | - * @author yuehongbo | |
15 | - * @createTime 2016/9/19 14:28 | |
16 | - */ | |
17 | -public enum OrderBrokerageStatus { | |
18 | - | |
19 | - VALID(10, "有效"), | |
20 | - INVALID(20, "无效"), | |
21 | - ; | |
22 | - | |
23 | - @Getter | |
24 | - private int index; | |
25 | - @Getter | |
26 | - private String value; | |
27 | - | |
28 | - private static Map<Integer, OrderBrokerageStatus> initMaps = Maps.newHashMap(); | |
29 | - | |
30 | - static { | |
31 | - for (OrderBrokerageStatus o : OrderBrokerageStatus.values()) { | |
32 | - initMaps.put(o.getIndex(), o); | |
33 | - } | |
34 | - } | |
35 | - | |
36 | - OrderBrokerageStatus(int index, String value) { | |
37 | - this.index = index; | |
38 | - this.value = value; | |
39 | - } | |
40 | - | |
41 | - public int getIndex() { | |
42 | - return index; | |
43 | - } | |
44 | - | |
45 | - public void setIndex(int index) { | |
46 | - this.index = index; | |
47 | - } | |
48 | - | |
49 | - public String getValue() { | |
50 | - return value; | |
51 | - } | |
52 | - | |
53 | - public void setValue(String value) { | |
54 | - this.value = value; | |
55 | - } | |
56 | - | |
57 | - public static OrderBrokerageStatus getStatus(Integer index) { | |
58 | - return initMaps.get(index); | |
59 | - } | |
60 | -} |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderComeFrom.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Arrays; | |
7 | -import java.util.List; | |
8 | -import java.util.Map; | |
9 | - | |
10 | -/** | |
11 | - * 订单的来源终端 | |
12 | - */ | |
13 | -public enum OrderComeFrom { | |
14 | - | |
15 | - PC("PC", 10), | |
16 | - iOS("iOS", 20), | |
17 | - Android("Android", 30), | |
18 | - Wap("Wap", 40); | |
19 | - | |
20 | - @Getter | |
21 | - private String name; | |
22 | - @Getter | |
23 | - private int index; | |
24 | - | |
25 | - private static Map<Integer,OrderComeFrom> initMaps = Maps.newHashMap(); | |
26 | - | |
27 | - static { | |
28 | - for (OrderComeFrom c : OrderComeFrom.values()) { | |
29 | - initMaps.put(c.getIndex(),c); | |
30 | - } | |
31 | - } | |
32 | - | |
33 | - OrderComeFrom(String name, int index) { | |
34 | - this.name = name; | |
35 | - this.index = index; | |
36 | - } | |
37 | - | |
38 | - public String getName() { | |
39 | - return name; | |
40 | - } | |
41 | - | |
42 | - public void setName(String name) { | |
43 | - this.name = name; | |
44 | - } | |
45 | - | |
46 | - public int getIndex() { | |
47 | - return index; | |
48 | - } | |
49 | - | |
50 | - public void setIndex(int index) { | |
51 | - this.index = index; | |
52 | - } | |
53 | - | |
54 | - public static OrderComeFrom get(Integer index){ | |
55 | - return initMaps.get(index); | |
56 | - } | |
57 | - | |
58 | - public static String getComeFromName(Integer index) { | |
59 | - if (initMaps.containsKey(index)){ | |
60 | - return initMaps.get(index).getName(); | |
61 | - } | |
62 | - return null; | |
63 | - } | |
64 | - | |
65 | - public static List<OrderComeFrom> getEnumItemList() { | |
66 | - OrderComeFrom[] itemList = OrderComeFrom.values(); | |
67 | - return Arrays.asList(itemList); | |
68 | - } | |
69 | -} | |
70 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderRemindKey.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | - | |
4 | -/** | |
5 | - * 订单记数key | |
6 | - */ | |
7 | -public enum OrderRemindKey { | |
8 | - /** 卖家已操作延期提货次数 */ | |
9 | - seller_delayed_num, | |
10 | - /** 买家已操作延期提货次数 */ | |
11 | - buyer_delayed_num, | |
12 | - /** 已提醒买家付款次数 */ | |
13 | - reminded_buyer_payment_num, | |
14 | - /** 已提醒卖家发货次数 */ | |
15 | - reminded_seller_shipment_num, | |
16 | - /** 已提醒买家确认提(收)货次数 */ | |
17 | - reminded_buyer_receive_num, | |
18 | - /** 订单已提交退款申请次数 */ | |
19 | - reorder_submit_num, | |
20 | - /** 订单已提交理赔申请次数 */ | |
21 | - claimsorder_submit_num, | |
22 | - ; | |
23 | -} | |
24 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderStatus.java
... | ... | @@ -2,6 +2,7 @@ package com.b2c.orders.enums; |
2 | 2 | |
3 | 3 | import java.util.Map; |
4 | 4 | |
5 | +import com.fasterxml.jackson.annotation.JsonValue; | |
5 | 6 | import com.google.common.collect.Maps; |
6 | 7 | |
7 | 8 | /** |
... | ... | @@ -70,7 +71,7 @@ public enum OrderStatus { |
70 | 71 | /** |
71 | 72 | * 获取所有订单类型的状态 |
72 | 73 | */ |
73 | - public static OrderStatus getOrderManStatus(int index) { | |
74 | + public static OrderStatus getOrderStatus(int index) { | |
74 | 75 | return initMaps.get(index); |
75 | 76 | } |
76 | 77 | |
... | ... | @@ -84,6 +85,7 @@ public enum OrderStatus { |
84 | 85 | return orderStatus.isRuningStatus; |
85 | 86 | } |
86 | 87 | |
88 | + @JsonValue | |
87 | 89 | public int getIndex() { |
88 | 90 | return index; |
89 | 91 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderType.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Map; | |
7 | - | |
8 | -/** | |
9 | - * 订单类型(后台使用) | |
10 | - */ | |
11 | -public enum OrderType { | |
12 | - /** 普通订单 */ | |
13 | - COMMON(10,"普通订单"), | |
14 | - /** 样品订单 */ | |
15 | - SAMPLE(20,"样品订单"), | |
16 | - /** 甩货订单 */ | |
17 | - CLEARANCE(30,"甩货订单"), | |
18 | - /** 赊账订单 */ | |
19 | - CREDIT(40,"赊账订单"), | |
20 | - /** 拼购订单 */ | |
21 | - SHARING(50,"拼购订单"); | |
22 | - | |
23 | - // 成员变量 | |
24 | - @Getter | |
25 | - private Integer index; | |
26 | - @Getter | |
27 | - private String name; | |
28 | - | |
29 | - | |
30 | - private static Map<Integer,OrderType> initMaps = Maps.newHashMap(); | |
31 | - | |
32 | - /** | |
33 | - * 初始化到静态变量里 | |
34 | - */ | |
35 | - static { | |
36 | - for (OrderType ot : OrderType.values()){ | |
37 | - initMaps.put(ot.getIndex(),ot); | |
38 | - } | |
39 | - } | |
40 | - | |
41 | - OrderType(Integer index, String name) { | |
42 | - this.index = index; | |
43 | - this.name = name; | |
44 | - } | |
45 | - | |
46 | - public Integer getIndex() { | |
47 | - return index; | |
48 | - } | |
49 | - | |
50 | - public void setIndex(Integer index) { | |
51 | - this.index = index; | |
52 | - } | |
53 | - | |
54 | - public String getName() { | |
55 | - return name; | |
56 | - } | |
57 | - | |
58 | - public void setName(String name) { | |
59 | - this.name = name; | |
60 | - } | |
61 | - | |
62 | - public static OrderType getOrderType(Integer code) { | |
63 | - return initMaps.get(code); | |
64 | - } | |
65 | - | |
66 | -} | |
67 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderWebStatus.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.List; | |
5 | - | |
6 | -/** | |
7 | - * 订单状态(前端) | |
8 | - */ | |
9 | -public enum OrderWebStatus { | |
10 | - /** 待付款10 */ | |
11 | - PayWait(10), | |
12 | - /** 待审核15 --赊帐付款订单 */ | |
13 | - waitAudit(15), | |
14 | -// /** 待分单20 */ | |
15 | -// @Deprecated | |
16 | -// DivideWait(20), | |
17 | - /** 已付款待确认 */ | |
18 | - WaitConfirm(20), | |
19 | - /** 备货中30 */ | |
20 | - Divided(30), | |
21 | - /** 待提货 40 */ | |
22 | - waitTake(40), | |
23 | - /** 待收货 45 */ | |
24 | - waitReceive(45), | |
25 | - /** 已提货50 */ | |
26 | - Delivered(50), | |
27 | - /** 已失效60 */ | |
28 | - Failed(60), | |
29 | - /** 已取消70 */ | |
30 | - Cancled(70), | |
31 | - /** 申请退款中 80 */ | |
32 | - RefundApplied(80), | |
33 | - /** 退款申诉中 85 */ | |
34 | - RefundAppealing(85), | |
35 | - /** 已退款90 */ | |
36 | - RefundComplete(90), | |
37 | - /** 提货超时100 */ | |
38 | - // DeliveredOut("提货超时", 100) | |
39 | - ; | |
40 | - | |
41 | - // 成员变量 | |
42 | - private int index; | |
43 | - | |
44 | - // 构造方法 | |
45 | - private OrderWebStatus(int index) { | |
46 | - this.index = index; | |
47 | - } | |
48 | - | |
49 | - public static OrderWebStatus getOrderWebStatus(int index) { | |
50 | - for (OrderWebStatus c : OrderWebStatus.values()) { | |
51 | - if (c.getIndex() == index) { | |
52 | - return c; | |
53 | - } | |
54 | - } | |
55 | - return null; | |
56 | - } | |
57 | - | |
58 | - public static List<OrderWebStatus> getEnumItemList() { | |
59 | - OrderWebStatus[] itemList = OrderWebStatus.values(); | |
60 | - List<OrderWebStatus> filteredItemList = new ArrayList<OrderWebStatus>(); | |
61 | - for (OrderWebStatus status : itemList) { | |
62 | - filteredItemList.add(status); | |
63 | - } | |
64 | - return filteredItemList; | |
65 | - } | |
66 | - | |
67 | - public int getIndex() { | |
68 | - return index; | |
69 | - } | |
70 | - | |
71 | - public void setIndex(int index) { | |
72 | - this.index = index; | |
73 | - } | |
74 | -} | |
75 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/PayStatus.java
1 | 1 | package com.b2c.orders.enums; |
2 | 2 | |
3 | +import com.fasterxml.jackson.annotation.JsonValue; | |
4 | + | |
3 | 5 | /** |
4 | 6 | * 订单支付状态:未付款10、已付款20 |
5 | 7 | */ |
... | ... | @@ -21,6 +23,7 @@ public enum PayStatus { |
21 | 23 | this.index = index; |
22 | 24 | } |
23 | 25 | |
26 | + @JsonValue | |
24 | 27 | public int getIndex() { |
25 | 28 | return index; |
26 | 29 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/PayType.java
... | ... | @@ -2,6 +2,7 @@ package com.b2c.orders.enums; |
2 | 2 | |
3 | 3 | import java.util.Map; |
4 | 4 | |
5 | +import com.fasterxml.jackson.annotation.JsonValue; | |
5 | 6 | import com.google.common.collect.Maps; |
6 | 7 | |
7 | 8 | /** |
... | ... | @@ -37,6 +38,7 @@ public enum PayType { |
37 | 38 | this.value = value; |
38 | 39 | } |
39 | 40 | |
41 | + @JsonValue | |
40 | 42 | public int getIndex() { |
41 | 43 | return index; |
42 | 44 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/ReOrderStatus.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -/** | |
4 | - * 退款状态(管理端) | |
5 | - */ | |
6 | -public enum ReOrderStatus { | |
7 | - /** 10卖家待审核 */ | |
8 | - CheckWait(10), | |
9 | - /** 20卖家审核通过 */ | |
10 | - CheckPass(20), | |
11 | - /** 90卖家审核通过等待打款 */ | |
12 | - WaitRepayment(90), | |
13 | - /** 30卖家审核拒绝 */ | |
14 | - CheckNotPass(30), | |
15 | - /** 40退款申请取消 */ | |
16 | - CheckCancel(40), | |
17 | - | |
18 | - /** 50退款申诉处理中 */ | |
19 | - Appealing(50), | |
20 | - /** 60退款申诉成功 */ | |
21 | - AppealPass(60), | |
22 | - /** 70退款申诉失败 */ | |
23 | - AppealNotPass(70), | |
24 | - /** 80退款申诉取消 */ | |
25 | - AppealCancel(80), ; | |
26 | - | |
27 | - // 成员变量 | |
28 | - private int index; | |
29 | - | |
30 | - // 构造方法 | |
31 | - ReOrderStatus(int index) { | |
32 | - this.index = index; | |
33 | - } | |
34 | - | |
35 | - public static ReOrderStatus getReOrderStatus(Integer index) { | |
36 | - for (ReOrderStatus c : ReOrderStatus.values()) { | |
37 | - if (c.getIndex() == index) { | |
38 | - return c; | |
39 | - } | |
40 | - } | |
41 | - return null; | |
42 | - } | |
43 | - | |
44 | - public int getIndex() { | |
45 | - return index; | |
46 | - } | |
47 | - | |
48 | - public void setIndex(int index) { | |
49 | - this.index = index; | |
50 | - } | |
51 | -} | |
52 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/RemitAuditStatus.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Map; | |
7 | - | |
8 | -/** | |
9 | - * 订单的汇款信息的审核状态 | |
10 | - * Created by yuehongbo on 2016/9/2. | |
11 | - */ | |
12 | -public enum RemitAuditStatus { | |
13 | - UNAUDITED(10,"未审核",false), | |
14 | - PASS(20,"通过",true), | |
15 | - UNPASS(30,"未通过",true), | |
16 | - ; | |
17 | - @Getter | |
18 | - private Integer index; | |
19 | - @Getter | |
20 | - private String value; | |
21 | - @Getter | |
22 | - private boolean viewAudit; | |
23 | - | |
24 | - private static Map<Integer,RemitAuditStatus> initMaps = Maps.newHashMap(); | |
25 | - | |
26 | - static { | |
27 | - for (RemitAuditStatus status : RemitAuditStatus.values()){ | |
28 | - initMaps.put(status.getIndex(),status); | |
29 | - } | |
30 | - } | |
31 | - | |
32 | - RemitAuditStatus(Integer index, String value, boolean viewAudit) { | |
33 | - this.index = index; | |
34 | - this.value = value; | |
35 | - this.viewAudit = viewAudit; | |
36 | - } | |
37 | - | |
38 | - public Integer getIndex() { | |
39 | - return index; | |
40 | - } | |
41 | - | |
42 | - public void setIndex(Integer index) { | |
43 | - this.index = index; | |
44 | - } | |
45 | - | |
46 | - public String getValue() { | |
47 | - return value; | |
48 | - } | |
49 | - | |
50 | - public void setValue(String value) { | |
51 | - this.value = value; | |
52 | - } | |
53 | - | |
54 | - public boolean isViewAudit() { | |
55 | - return viewAudit; | |
56 | - } | |
57 | - | |
58 | - public void setViewAudit(boolean viewAudit) { | |
59 | - this.viewAudit = viewAudit; | |
60 | - } | |
61 | - | |
62 | - public static RemitAuditStatus get(Integer index){ | |
63 | - return initMaps.get(index); | |
64 | - } | |
65 | - | |
66 | - /** | |
67 | - * 是否审核不通过 | |
68 | - * @param index | |
69 | - * @return true - 是 | |
70 | - */ | |
71 | - public static boolean isUnpass(int index){ | |
72 | - return UNPASS == get(index); | |
73 | - } | |
74 | - | |
75 | - /** | |
76 | - * 是否审核通过 | |
77 | - * @param index | |
78 | - * @return true - 是 | |
79 | - */ | |
80 | - public static boolean isPass(int index){ | |
81 | - return PASS == get(index); | |
82 | - } | |
83 | -} |
b2c-orders-client/src/main/java/com/b2c/orders/enums/SaleType.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | -import com.google.common.collect.Maps; | |
4 | -import lombok.Getter; | |
5 | - | |
6 | -import java.util.Map; | |
7 | - | |
8 | -/** | |
9 | - * 商品销售模式(商品来源) | |
10 | - */ | |
11 | -public enum SaleType { | |
12 | - /* 自营10 */ | |
13 | - SaleSelf(10, "自营"), | |
14 | - /* 代销20 */ | |
15 | - SaleAgent(20, "代销"), | |
16 | - /* 第三方卖家30 */ | |
17 | - SaleThird(30, "第三方卖家"); | |
18 | - | |
19 | - // 成员变量 | |
20 | - @Getter | |
21 | - private Integer index; | |
22 | - @Getter | |
23 | - private String name; | |
24 | - | |
25 | - private static Map<Integer, SaleType> initMaps = Maps.newHashMap(); | |
26 | - | |
27 | - static { | |
28 | - for (SaleType st : SaleType.values()) { | |
29 | - initMaps.put(st.getIndex(), st); | |
30 | - } | |
31 | - } | |
32 | - | |
33 | - SaleType(Integer index, String name) { | |
34 | - this.index = index; | |
35 | - this.name = name; | |
36 | - } | |
37 | - | |
38 | - public Integer getIndex() { | |
39 | - return index; | |
40 | - } | |
41 | - | |
42 | - public void setIndex(Integer index) { | |
43 | - this.index = index; | |
44 | - } | |
45 | - | |
46 | - public String getName() { | |
47 | - return name; | |
48 | - } | |
49 | - | |
50 | - public void setName(String name) { | |
51 | - this.name = name; | |
52 | - } | |
53 | - | |
54 | - public static SaleType getSaleType(Integer index) { | |
55 | - return initMaps.get(index); | |
56 | - } | |
57 | - | |
58 | -} | |
59 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/ShopType.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | - | |
4 | -/** | |
5 | - * 商户类型 | |
6 | - */ | |
7 | -public enum ShopType { | |
8 | - /** 批发商户, 1 */ | |
9 | - Wholesale(1), | |
10 | - /** 产地商户, 2 */ | |
11 | - Place(2), | |
12 | - /** 农户商户,3 */ | |
13 | - Peasant(3), | |
14 | - /** 零售商户,4 */ | |
15 | - Retail(4), | |
16 | - /** 代购商户,5 */ | |
17 | - Purchase(5), | |
18 | - /** 物流商户,6 */ | |
19 | - Logistics(6) | |
20 | - ; | |
21 | - | |
22 | - // 成员变量 | |
23 | - private int index; | |
24 | - | |
25 | - // 构造方法 | |
26 | - private ShopType(int index) { | |
27 | - this.index = index; | |
28 | - } | |
29 | - | |
30 | - public int getIndex() { | |
31 | - return index; | |
32 | - } | |
33 | - public void setIndex(int index) { | |
34 | - this.index = index; | |
35 | - } | |
36 | -} | |
37 | 0 | \ No newline at end of file |
b2c-orders-client/src/main/java/com/b2c/orders/enums/OpUserRole.java renamed to b2c-orders-client/src/main/java/com/b2c/orders/enums/UserType.java
1 | 1 | package com.b2c.orders.enums; |
2 | 2 | |
3 | +import com.fasterxml.jackson.annotation.JsonValue; | |
3 | 4 | |
4 | 5 | /** |
5 | 6 | * 操作人员类型(角色) <br /> |
6 | - * <B>Copyright</B> Copyright (c) 2015 www.diligrp.com All rights reserved. <br /> | |
7 | + * <B>Copyright</B> Copyright (c) 2015 www.diligrp.com All rights reserved. | |
8 | + * <br /> | |
7 | 9 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
8 | 10 | * <B>Company</B> 地利集团 |
9 | 11 | */ |
10 | -public enum OpUserRole { | |
11 | - | |
12 | - /**地利买家*/ | |
13 | - DILI_BUYER(10,"买家","【买家】"), | |
14 | - | |
15 | - /**地利卖家*/ | |
16 | - DILI_SELLER(20,"卖家","【卖家】"), | |
17 | - | |
18 | - /**地利网站用户(买家or卖家)*/ | |
19 | - DILI_WEB_USER(30,"客户","【客户】"), | |
20 | - | |
21 | - /**地利网站匿名用户(id=999L)*/ | |
22 | - DILI_WEB_ANONYMOUS_USEER(999L,"匿名用户","【匿名用户】"), | |
23 | - | |
24 | - /**地利后台管理人员*/ | |
25 | - DILI_BACKEND_MANAGER(1000,"后台","【后台】"), | |
26 | - | |
27 | - /**地利支付*/ | |
28 | - DILI_PAY(50,"支付","【支付】"), | |
29 | - | |
30 | - /**地利后台系统用户(id=9999999999999L)*/ | |
31 | - DILI_BACKEND_SYSTEM(9999999999999L,"系统","【系统】"); | |
12 | +public enum UserType { | |
32 | 13 | |
33 | - private long index; | |
34 | - private String name; | |
35 | - private String prefix; | |
36 | - public static OpUserRole get(long index) { | |
37 | - for (OpUserRole c : OpUserRole.values()) { | |
38 | - if (c.getIndex() == index) { | |
39 | - return c; | |
40 | - } | |
41 | - } | |
42 | - return null; | |
43 | - } | |
14 | + /** 地利买家 */ | |
15 | + BUYER(10, "买家", "【买家】"), | |
44 | 16 | |
45 | - private OpUserRole(long index,String name,String prefix) { | |
46 | - this.index = index; | |
47 | - this.name=name; | |
48 | - this.prefix= prefix; | |
49 | - } | |
17 | + /** 地利卖家 */ | |
18 | + SELLER(20, "卖家", "【卖家】"), | |
50 | 19 | |
51 | - public long getIndex() { | |
52 | - return index; | |
53 | - } | |
20 | + /** 地利后台系统用户 */ | |
21 | + SYSTEM(30L, "系统", "【系统】"); | |
54 | 22 | |
55 | - public void setIndex(long index) { | |
56 | - this.index = index; | |
57 | - } | |
23 | + private long index; | |
24 | + private String name; | |
25 | + private String prefix; | |
58 | 26 | |
59 | - | |
60 | - public String getPrefix() { | |
61 | - return prefix; | |
62 | - } | |
63 | - | |
64 | - public void setPrefix(String prefix) { | |
65 | - this.prefix = prefix; | |
66 | - } | |
67 | - | |
68 | - public String getName(){ | |
69 | - return this.name; | |
70 | - } | |
27 | + public static UserType get(long index) { | |
28 | + for (UserType c : UserType.values()) { | |
29 | + if (c.getIndex() == index) { | |
30 | + return c; | |
31 | + } | |
32 | + } | |
33 | + return null; | |
34 | + } | |
35 | + | |
36 | + private UserType(long index, String name, String prefix) { | |
37 | + this.index = index; | |
38 | + this.name = name; | |
39 | + this.prefix = prefix; | |
40 | + } | |
41 | + | |
42 | + @JsonValue | |
43 | + public long getIndex() { | |
44 | + return index; | |
45 | + } | |
46 | + | |
47 | + public void setIndex(long index) { | |
48 | + this.index = index; | |
49 | + } | |
50 | + | |
51 | + public String getPrefix() { | |
52 | + return prefix; | |
53 | + } | |
54 | + | |
55 | + public void setPrefix(String prefix) { | |
56 | + this.prefix = prefix; | |
57 | + } | |
58 | + | |
59 | + public String getName() { | |
60 | + return this.name; | |
61 | + } | |
71 | 62 | } | ... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/WarrantType.java deleted
100644 → 0
1 | -package com.b2c.orders.enums; | |
2 | - | |
3 | - | |
4 | -import com.google.common.collect.Maps; | |
5 | -import lombok.Getter; | |
6 | - | |
7 | -import java.util.Map; | |
8 | - | |
9 | -/** | |
10 | - * 交易担保,交割保:10,不需要担保:20,其他:30 | |
11 | - */ | |
12 | -public enum WarrantType { | |
13 | - | |
14 | - Warran("Warran", 10,"交割保"), | |
15 | - Not_Warran("Not_Warran", 20,"不需要担保"), | |
16 | - Other("Other", 30,"其他"); | |
17 | - | |
18 | - //成员变量 | |
19 | - @Getter | |
20 | - private String name; | |
21 | - @Getter | |
22 | - private int index; | |
23 | - @Getter | |
24 | - private String desc; | |
25 | - | |
26 | - private static Map<Integer,WarrantType> initMaps = Maps.newHashMap(); | |
27 | - | |
28 | - static { | |
29 | - for (WarrantType c : WarrantType.values()) { | |
30 | - initMaps.put(c.getIndex(),c); | |
31 | - } | |
32 | - } | |
33 | - | |
34 | - WarrantType(String name, int index, String desc) { | |
35 | - this.name = name; | |
36 | - this.index = index; | |
37 | - this.desc = desc; | |
38 | - } | |
39 | - | |
40 | - public String getName() { | |
41 | - return name; | |
42 | - } | |
43 | - | |
44 | - public void setName(String name) { | |
45 | - this.name = name; | |
46 | - } | |
47 | - | |
48 | - public int getIndex() { | |
49 | - return index; | |
50 | - } | |
51 | - | |
52 | - public void setIndex(int index) { | |
53 | - this.index = index; | |
54 | - } | |
55 | - | |
56 | - public String getDesc() { | |
57 | - return desc; | |
58 | - } | |
59 | - | |
60 | - public void setDesc(String desc) { | |
61 | - this.desc = desc; | |
62 | - } | |
63 | - | |
64 | - public static WarrantType getWarrantType(Integer index) { | |
65 | - return initMaps.get(index); | |
66 | - } | |
67 | -} | |
68 | 0 | \ No newline at end of file |
b2c-orders-dao/pom.xml
... | ... | @@ -15,6 +15,10 @@ |
15 | 15 | <version>${project.version}</version> |
16 | 16 | </dependency> |
17 | 17 | <dependency> |
18 | + <groupId>cglib</groupId> | |
19 | + <artifactId>cglib</artifactId> | |
20 | + </dependency> | |
21 | + <dependency> | |
18 | 22 | <groupId>com.b2c.website</groupId> |
19 | 23 | <artifactId>diligrp-website-util</artifactId> |
20 | 24 | <exclusions> | ... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/OrderItemDao.java
0 → 100644
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/OrderDaoBean.java
1 | 1 | package com.b2c.orders.dao.impl; |
2 | 2 | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
3 | 4 | import org.springframework.stereotype.Repository; |
4 | 5 | |
5 | 6 | import com.b2c.orders.dao.OrderDao; |
7 | +import com.b2c.orders.dao.OrderItemDao; | |
6 | 8 | import com.b2c.orders.domain.Order; |
9 | +import com.b2c.orders.domain.OrderItem; | |
7 | 10 | import com.diligrp.website.util.dao.impl.BaseDaoImpl; |
8 | 11 | |
9 | 12 | @Repository |
10 | 13 | public class OrderDaoBean extends BaseDaoImpl<Order> implements OrderDao { |
11 | 14 | |
15 | + @Autowired | |
16 | + private OrderItemDao orderItemDao; | |
17 | + | |
18 | + @Override | |
19 | + public boolean save(Order entity) { | |
20 | + if (super.save(entity)) { | |
21 | + return false; | |
22 | + } | |
23 | + for (OrderItem item : entity.getOrderItems()) { | |
24 | + if (!this.orderItemDao.save(item)) { | |
25 | + return false; | |
26 | + } | |
27 | + } | |
28 | + return true; | |
29 | + } | |
30 | + | |
12 | 31 | } | ... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/OrderItemDaoBean.java
0 → 100644
1 | +package com.b2c.orders.dao.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Repository; | |
4 | + | |
5 | +import com.b2c.orders.dao.OrderItemDao; | |
6 | +import com.b2c.orders.domain.OrderItem; | |
7 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
8 | + | |
9 | +@Repository | |
10 | +public class OrderItemDaoBean extends BaseDaoImpl<OrderItem> implements OrderItemDao { | |
11 | + | |
12 | +} | ... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/utils/PayTypeTypeHandler.java
0 → 100644
1 | +package com.b2c.orders.dao.utils; | |
2 | + | |
3 | +import java.sql.CallableStatement; | |
4 | +import java.sql.PreparedStatement; | |
5 | +import java.sql.ResultSet; | |
6 | +import java.sql.SQLException; | |
7 | + | |
8 | +import org.apache.ibatis.type.BaseTypeHandler; | |
9 | +import org.apache.ibatis.type.JdbcType; | |
10 | + | |
11 | +import com.b2c.orders.enums.PayType; | |
12 | + | |
13 | +public class PayTypeTypeHandler extends BaseTypeHandler<PayType> { | |
14 | + | |
15 | + @Override | |
16 | + public void setNonNullParameter(PreparedStatement ps, int i, PayType parameter, JdbcType jdbcType) | |
17 | + throws SQLException { | |
18 | + ps.setInt(i, parameter.getIndex()); | |
19 | + } | |
20 | + | |
21 | + @Override | |
22 | + public PayType getNullableResult(ResultSet rs, String columnName) throws SQLException { | |
23 | + if (rs.wasNull()) { | |
24 | + return null; | |
25 | + } | |
26 | + int value = rs.getInt(columnName); | |
27 | + return PayType.getPayType(value); | |
28 | + } | |
29 | + | |
30 | + @Override | |
31 | + public PayType getNullableResult(ResultSet rs, int columnIndex) throws SQLException { | |
32 | + if (rs.wasNull()) { | |
33 | + return null; | |
34 | + } | |
35 | + int value = rs.getInt(columnIndex); | |
36 | + return PayType.getPayType(value); | |
37 | + } | |
38 | + | |
39 | + @Override | |
40 | + public PayType getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { | |
41 | + if (cs.wasNull()) { | |
42 | + return null; | |
43 | + } | |
44 | + int value = cs.getInt(columnIndex); | |
45 | + return PayType.getPayType(value); | |
46 | + } | |
47 | + | |
48 | +} | ... | ... |
b2c-orders-dao/src/main/resources/sqlmap-config.xml
... | ... | @@ -3,6 +3,10 @@ |
3 | 3 | |
4 | 4 | <configuration> |
5 | 5 | <settings> |
6 | + <!-- 开启全局性设置懒加载 --> | |
7 | + <setting name="lazyLoadingEnabled" value="true" /> | |
8 | + <!-- 开启按需加载 --> | |
9 | + <setting name="aggressiveLazyLoading" value="false" /> | |
6 | 10 | <!-- 全局映射器启用缓存 --> |
7 | 11 | <setting name="cacheEnabled" value="true" /> |
8 | 12 | <!-- 对于未知的SQL查询,允许返回不同的结果集以达到通用的效果 --> |
... | ... | @@ -16,23 +20,20 @@ |
16 | 20 | |
17 | 21 | <!-- 全局别名设置,在映射文件中只需写别名,而不必写出整个类路径 --> |
18 | 22 | <typeAliases> |
19 | - <typeAlias type="com.b2c.orders.domain.OrderMaxid" alias="orderMaxid"/> | |
23 | + <typeAlias type="com.b2c.orders.domain.OrderMaxid" alias="orderMaxid" /> | |
24 | + <typeAlias type="com.diligrp.website.util.dao.BaseQuery" | |
25 | + alias="Query" /> | |
20 | 26 | </typeAliases> |
21 | 27 | |
22 | 28 | <typeHandlers> |
23 | - <!-- <typeHandler handler="com.b2c.dtms.dao.typehandler.OrderManStatusHandler" | |
24 | - javaType="com.b2c.dtms.common.enums.order.OrderManStatus" /> | |
25 | - <typeHandler handler="com.b2c.dtms.dao.typehandler.OrderPayTypeHandler" | |
26 | - javaType="com.b2c.dtms.publics.enums.PayType" /> | |
27 | - <typeHandler handler="com.b2c.dtms.dao.typehandler.OrderPayStatusHandler" | |
28 | - javaType="com.b2c.dtms.publics.enums.PayStatus" /> | |
29 | - <typeHandler handler="com.b2c.dtms.dao.typehandler.OrderDeliveryTypeHandler" | |
30 | - javaType="com.b2c.dtms.publics.enums.OrderDeliveryType" /> --> | |
29 | + <package name="com.b2c.orders.dao.utils" /> | |
31 | 30 | </typeHandlers> |
32 | 31 | |
33 | 32 | <!-- 映射文件路径 --> |
34 | 33 | <mappers> |
35 | 34 | <mapper resource="sqlmap/OrderMaxid.xml" /> |
35 | + <mapper resource="sqlmap/OrderMapper.xml" /> | |
36 | + <mapper resource="sqlmap/OrderItemMapper.xml" /> | |
36 | 37 | </mappers> |
37 | 38 | |
38 | 39 | ... | ... |
b2c-orders-dao/src/main/resources/sqlmap/OrderItemMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.b2c.orders.dao.impl.OrderItemDaoBean"> | |
4 | + <resultMap id="OrderItemRM" type="com.b2c.orders.domain.OrderItem"> | |
5 | + <id property="id" column="id" /> | |
6 | + <result property="orderId" column="order_id" /> | |
7 | + <result property="productId" column="product_id" /> | |
8 | + <result property="buyerId" column="buyer_id" /> | |
9 | + <result property="sellerId" column="seller_id" /> | |
10 | + <result property="shopId" column="shop_id" /> | |
11 | + <result property="sku" column="sku" /> | |
12 | + <result property="skuTitle" column="sku_title" /> | |
13 | + <result property="skuAttributes" column="sku_attributes" /> | |
14 | + <result property="amount" column="amount" /> | |
15 | + <result property="skuPrice" column="sku_price" /> | |
16 | + <result property="priceUnit" column="price_unit" /> | |
17 | + <result property="skuPicture" column="sku_picture" /> | |
18 | + <result property="versionNum" column="version_num" /> | |
19 | + <result property="editTime" column="edit_time" /> | |
20 | + <result property="createTime" column="create_time" /> | |
21 | + </resultMap> | |
22 | + | |
23 | + <sql id="selectCondition"> | |
24 | + <if test="param != null"> | |
25 | + <if test="param.id != null and param.id != ''"> | |
26 | + and id = #{param.id} | |
27 | + </if> | |
28 | + <if test="param.orderId != null and param.orderId != ''"> | |
29 | + and order_id = #{param.orderId} | |
30 | + </if> | |
31 | + <if test="param.productId != null and param.productId != ''"> | |
32 | + and product_id = #{param.productId} | |
33 | + </if> | |
34 | + <if test="param.buyerId != null and param.buyerId != ''"> | |
35 | + and buyer_id = #{param.buyerId} | |
36 | + </if> | |
37 | + <if test="param.sellerId != null and param.sellerId != ''"> | |
38 | + and seller_id = #{param.sellerId} | |
39 | + </if> | |
40 | + <if test="param.shopId != null and param.shopId != ''"> | |
41 | + and shop_id = #{param.shopId} | |
42 | + </if> | |
43 | + <if test="param.sku != null and param.sku != ''"> | |
44 | + and sku = #{param.sku} | |
45 | + </if> | |
46 | + <if test="param.skuTitle != null and param.skuTitle != ''"> | |
47 | + and sku_title = #{param.skuTitle} | |
48 | + </if> | |
49 | + <if test="param.skuAttributes != null and param.skuAttributes != ''"> | |
50 | + and sku_attributes = #{param.skuAttributes} | |
51 | + </if> | |
52 | + <if test="param.amount != null and param.amount != ''"> | |
53 | + and amount = #{param.amount} | |
54 | + </if> | |
55 | + <if test="param.skuPrice != null and param.skuPrice != ''"> | |
56 | + and sku_price = #{param.skuPrice} | |
57 | + </if> | |
58 | + <if test="param.priceUnit != null and param.priceUnit != ''"> | |
59 | + and price_unit = #{param.priceUnit} | |
60 | + </if> | |
61 | + </if> | |
62 | + </sql> | |
63 | + | |
64 | + <select id="findByOrderId" resultMap="OrderItemRM"> | |
65 | + <![CDATA[ | |
66 | + SELECT | |
67 | + id | |
68 | + order_id, | |
69 | + product_id, | |
70 | + seller_id, | |
71 | + shop_id, | |
72 | + sku, | |
73 | + sku_title, | |
74 | + sku_attributes, | |
75 | + amount, | |
76 | + sku_price, | |
77 | + price_unit, | |
78 | + sku_picture, | |
79 | + version_num, | |
80 | + edit_time, | |
81 | + create_time | |
82 | + FROM t_order_item | |
83 | + WHERE order_id = #{orderId} | |
84 | + ]]> | |
85 | + </select> | |
86 | + | |
87 | + <insert id="save" parameterType="com.b2c.orders.domain.OrderItem"> | |
88 | + <![CDATA[ | |
89 | + INSERT INTO t_order_item( | |
90 | + id, | |
91 | + order_id, | |
92 | + product_id, | |
93 | + buyer_id, | |
94 | + seller_id, | |
95 | + shop_id, | |
96 | + sku, | |
97 | + sku_title, | |
98 | + sku_attributes, | |
99 | + amount, | |
100 | + sku_price, | |
101 | + price_unit, | |
102 | + sku_picture | |
103 | + ) VALUES( | |
104 | + #{id}, | |
105 | + #{orderId}, | |
106 | + #{productId}, | |
107 | + #{buyerId}, | |
108 | + #{sellerId}, | |
109 | + #{shopId}, | |
110 | + #{sku}, | |
111 | + #{skuTitle}, | |
112 | + #{skuAttributes}, | |
113 | + #{amount}, | |
114 | + #{skuPrice}, | |
115 | + #{priceUnit}, | |
116 | + #{skuPicture} | |
117 | + ) | |
118 | + ]]> | |
119 | + </insert> | |
120 | + | |
121 | +</mapper> | |
0 | 122 | \ No newline at end of file | ... | ... |
b2c-orders-dao/src/main/resources/sqlmap/OrderMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.b2c.orders.dao.impl.OrderDaoBean"> | |
4 | + <resultMap id="OrderRM" type="com.b2c.orders.domain.Order"> | |
5 | + <id property="id" column="id" /> | |
6 | + <result property="buyerId" column="buyer_id" /> | |
7 | + <result property="sellerId" column="seller_id" /> | |
8 | + <result property="deliveryType" column="delivery_type" /> | |
9 | + <result property="orderStatus" column="order_status" /> | |
10 | + <result property="payStatus" column="pay_status" /> | |
11 | + <result property="buyerMemo" column="buyer_memo" /> | |
12 | + <result property="payTime" column="pay_time" /> | |
13 | + <result property="deliveryTime" column="delivery_time" /> | |
14 | + <result property="buyerConfirmTime" column="buyer_confirm_time" /> | |
15 | + <result property="sellerConfirmTime" column="seller_confirm_time" /> | |
16 | + <result property="reservationTime" column="reservation_time" /> | |
17 | + <result property="submitTime" column="submit_time" /> | |
18 | + <result property="payType" column="pay_type" /> | |
19 | + <result property="totalPrice" column="total_price" /> | |
20 | + <result property="realTotalPrice" column="real_total_price" /> | |
21 | + <result property="versionNum" column="version_num" /> | |
22 | + <result property="delete" column="delete_flag" /> | |
23 | + <collection property="orderItems" column="id" | |
24 | + select="com.b2c.orders.dao.impl.OrderItemDaoBean.findByOrderId" /> | |
25 | + </resultMap> | |
26 | + | |
27 | + <sql id="selectCondition"> | |
28 | + <if test="param != null"> | |
29 | + <if test="param.id != null and param.id != ''"> | |
30 | + and id = #{param.id} | |
31 | + </if> | |
32 | + <if test="param.buyerId != null and param.buyerId != ''"> | |
33 | + and buyer_id = #{param.buyerId} | |
34 | + </if> | |
35 | + <if test="param.sellerId != null and param.sellerId != ''"> | |
36 | + and seller_id = #{param.sellerId} | |
37 | + </if> | |
38 | + <if test="param.deliveryType != null and param.deliveryType != ''"> | |
39 | + and delivery_type = #{param.deliveryType} | |
40 | + </if> | |
41 | + <if test="param.orderStatus != null and param.orderStatus != ''"> | |
42 | + and order_status = #{param.orderStatus} | |
43 | + </if> | |
44 | + <if test="param.payStatus != null and param.payStatus != ''"> | |
45 | + and pay_status = #{param.payStatus} | |
46 | + </if> | |
47 | + <if test="param.buyerMemo != null and param.buyerMemo != ''"> | |
48 | + and buyer_memo = #{param.buyerMemo} | |
49 | + </if> | |
50 | + <if test="param.payBeginTime != null and param.payBeginTime != ''"> | |
51 | + <![CDATA[and pay_time >= #{param.payBeginTime}]]> | |
52 | + </if> | |
53 | + <if test="param.payEndTime != null and param.payEndTime != ''"> | |
54 | + <![CDATA[and pay_time <= #{param.payEndTime}]]> | |
55 | + </if> | |
56 | + <if | |
57 | + test="param.deliveryBeginTime != null and param.deliveryBeginTime != ''"> | |
58 | + <![CDATA[and delivery_time >= #{param.deliveryBeginTime}]]> | |
59 | + </if> | |
60 | + <if test="param.deliveryEndTime != null and param.deliveryEndTime != ''"> | |
61 | + <![CDATA[and delivery_time <= #{param.deliveryEndTime}]]> | |
62 | + </if> | |
63 | + <if | |
64 | + test="param.buyerConfirmEndTime != null and param.buyerConfirmBeginTime != ''"> | |
65 | + <![CDATA[and buyer_confirm_time >= #{param.buyerConfirmBeginTime}]]> | |
66 | + </if> | |
67 | + <if | |
68 | + test="param.buyerConfirmEndTime != null and param.buyerConfirmEndTime != ''"> | |
69 | + <![CDATA[and buyer_confirm_time <= #{param.buyerConfirmEndTime}]]> | |
70 | + </if> | |
71 | + <if | |
72 | + test="param.sellerConfirmBeginTime != null and param.sellerConfirmBeginTime != ''"> | |
73 | + <![CDATA[and seller_confirm_time >= #{param.sellerConfirmBeginTime}]]> | |
74 | + </if> | |
75 | + <if | |
76 | + test="param.sellerConfirmEndTime != null and param.sellerConfirmEndTime != ''"> | |
77 | + <![CDATA[and seller_confirm_time <= #{param.sellerConfirmEndTime}]]> | |
78 | + </if> | |
79 | + <if | |
80 | + test="param.reservationBeginTime != null and param.reservationBeginTime != ''"> | |
81 | + <![CDATA[and reservation_time >= #{param.reservationBeginTime}]]> | |
82 | + </if> | |
83 | + <if | |
84 | + test="param.reservationEndTime != null and param.reservationEndTime != ''"> | |
85 | + <![CDATA[and reservation_time <= #{param.reservationEndTime}]]> | |
86 | + </if> | |
87 | + <if test="param.submitBeginTime != null and param.submitBeginTime != ''"> | |
88 | + <![CDATA[and submit_time >= #{param.submitBeginTime}]]> | |
89 | + </if> | |
90 | + <if test="param.submitEndTime != null and param.submitEndTime != ''"> | |
91 | + <![CDATA[and submit_time <= #{param.submitEndTime}]]> | |
92 | + </if> | |
93 | + <if test="param.buyerMemo != null and param.buyerMemo != ''"> | |
94 | + and pay_type = #{param.payType} | |
95 | + </if> | |
96 | + <if test="param.buyerMemo != null and param.buyerMemo != ''"> | |
97 | + and total_price = #{param.totalPrice} | |
98 | + </if> | |
99 | + </if> | |
100 | + and delete_flag = 0 | |
101 | + </sql> | |
102 | + | |
103 | + <insert id="save" parameterType="com.b2c.orders.domain.Order"> | |
104 | + <![CDATA[ | |
105 | + INSERT INTO t_order( | |
106 | + id, | |
107 | + buyer_id, | |
108 | + seller_id, | |
109 | + delivery_type, | |
110 | + order_status, | |
111 | + pay_status, | |
112 | + buyer_memo, | |
113 | + delivery_time, | |
114 | + pay_type, | |
115 | + total_price | |
116 | + ) VALUES( | |
117 | + #{id}, | |
118 | + #{buyerId}, | |
119 | + #{sellerId}, | |
120 | + #{deliveryType}, | |
121 | + #{orderStatus}, | |
122 | + #{payStatus}, | |
123 | + #{buyerMemo}, | |
124 | + #{deliveryTime}, | |
125 | + #{payType}, | |
126 | + #{totalPrice} | |
127 | + ) | |
128 | + ]]> | |
129 | + </insert> | |
130 | + | |
131 | + <update id="update" parameterType="com.b2c.orders.domain.Order"> | |
132 | + <![CDATA[ | |
133 | + UPDATE t_order set | |
134 | + order_status=#{orderStatus}, | |
135 | + pay_status=#{payStatus}, | |
136 | + buyer_memo=#{buyerMemo}, | |
137 | + pay_time=#{payTime}, | |
138 | + delivery_time=#{deliveryTime}, | |
139 | + buyer_confirm_time=#{buyerConfirm_time}, | |
140 | + seller_confirm_time=#{sellerConfirmTime}, | |
141 | + real_total_price=#{realTotalPrice}, | |
142 | + submit_time=#{submitTime}, | |
143 | + version_num=version_num + 1 | |
144 | + where 1=1 | |
145 | + and version_num=#{versionNum} and id = #{id} | |
146 | + ]]> | |
147 | + </update> | |
148 | + | |
149 | + <select id="countByCondition" parameterType="Query" resultType="Integer"> | |
150 | + <![CDATA[ | |
151 | + SELECT count(1) FROM t_order where 1=1 | |
152 | + ]]> | |
153 | + <include refid="selectCondition" /> | |
154 | + </select> | |
155 | + | |
156 | + <select id="listByCondition" parameterType="Query" resultMap="OrderRM"> | |
157 | + <![CDATA[ | |
158 | + SELECT | |
159 | + id | |
160 | + ,buyer_id | |
161 | + ,seller_id | |
162 | + ,delivery_type | |
163 | + ,order_status | |
164 | + ,pay_status | |
165 | + ,buyer_memo | |
166 | + ,pay_time | |
167 | + ,delivery_time | |
168 | + ,reservation_time | |
169 | + ,buyer_confirm_time | |
170 | + ,seller_confirm_time | |
171 | + ,submit_time | |
172 | + ,pay_type | |
173 | + ,total_price | |
174 | + ,real_total_price | |
175 | + ,version_num | |
176 | + FROM t_order where 1=1 | |
177 | + ]]> | |
178 | + <include refid="selectCondition" /> | |
179 | + order by id desc | |
180 | + <![CDATA[ | |
181 | + limit #{startRow},#{pageSize} | |
182 | + ]]> | |
183 | + </select> | |
184 | + | |
185 | + | |
186 | + <update id="deleteById" parameterType="Long"> | |
187 | + <![CDATA[ | |
188 | + update t_order set delete_flag = 1,version_num=version_num + 1 | |
189 | + where 1 = 1 | |
190 | + and id = #{id} and version_num=#{versionNum} | |
191 | + ]]> | |
192 | + </update> | |
193 | + | |
194 | +</mapper> | |
0 | 195 | \ No newline at end of file | ... | ... |
b2c-orders-dao/src/main/resources/sqlmap/OrderMaxid.xml
... | ... | @@ -24,27 +24,6 @@ |
24 | 24 | </where> |
25 | 25 | </sql> |
26 | 26 | |
27 | - <!-- 智能排序与分页 --> | |
28 | - <sql id="QUERY_ORDER_LIMIT_CONDTION"> | |
29 | - <choose> | |
30 | - <when test="orderField != null and orderField != ''"> | |
31 | - <choose> | |
32 | - <when test="orderFieldType != null and orderFieldType != ''"> | |
33 | - <![CDATA[ORDER BY ${orderField} ${orderFieldType}]]> | |
34 | - </when> | |
35 | - <otherwise> | |
36 | - <![CDATA[ORDER BY ${orderField} desc]]> | |
37 | - </otherwise> | |
38 | - </choose> | |
39 | - </when> | |
40 | - <otherwise> | |
41 | - <![CDATA[ORDER BY id desc]]> | |
42 | - </otherwise> | |
43 | - </choose> | |
44 | - <if | |
45 | - test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | |
46 | - </sql> | |
47 | - | |
48 | 27 | <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> |
49 | 28 | <sql id="UPDATE_COLUMN_SET"> |
50 | 29 | <set> |
... | ... | @@ -108,7 +87,6 @@ |
108 | 87 | <include refid="QUERY_COLUMN_LIST" /> |
109 | 88 | <include refid="QUERY_FROM_TABLE" /> |
110 | 89 | <include refid="QUERY_WHERE_CLAUSE" /> |
111 | - <include refid="QUERY_ORDER_LIMIT_CONDTION" /> | |
112 | 90 | </select> |
113 | 91 | |
114 | 92 | <!-- 总数查询,通过条件 --> | ... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/Order.java
... | ... | @@ -4,14 +4,21 @@ |
4 | 4 | */ |
5 | 5 | package com.b2c.orders.domain; |
6 | 6 | |
7 | +import java.text.DateFormat; | |
8 | +import java.text.ParseException; | |
9 | +import java.text.SimpleDateFormat; | |
10 | +import java.util.ArrayList; | |
7 | 11 | import java.util.Date; |
8 | 12 | import java.util.List; |
9 | 13 | |
14 | +import org.apache.http.util.TextUtils; | |
15 | + | |
16 | +import com.b2c.orders.client.domain.dto.request.OrderItemDto; | |
10 | 17 | import com.b2c.orders.client.domain.dto.request.SubmitOrderRequestDto; |
11 | 18 | import com.b2c.orders.commons.exceptions.ApplicationException; |
12 | 19 | import com.b2c.orders.commons.exceptions.OrderException; |
13 | 20 | import com.b2c.orders.commons.utils.OrderIdGenerator; |
14 | -import com.b2c.orders.enums.OrderDeliveryType; | |
21 | +import com.b2c.orders.enums.DeliveryType; | |
15 | 22 | import com.b2c.orders.enums.OrderStatus; |
16 | 23 | import com.b2c.orders.enums.PayStatus; |
17 | 24 | import com.b2c.orders.enums.PayType; |
... | ... | @@ -39,13 +46,13 @@ public class Order extends BaseDomain { |
39 | 46 | /** |
40 | 47 | * 买家 |
41 | 48 | */ |
42 | - private Buyer buyer; | |
49 | + private Long buyerId; | |
43 | 50 | /** |
44 | 51 | * 卖家 |
45 | 52 | */ |
46 | - private Seller seller; | |
53 | + private Long sellerId; | |
47 | 54 | /** 配送类型 */ |
48 | - private OrderDeliveryType deliveryType; | |
55 | + private DeliveryType deliveryType; | |
49 | 56 | /** 订单状态 */ |
50 | 57 | private OrderStatus orderStatus; |
51 | 58 | /** 支付状态 */ |
... | ... | @@ -74,8 +81,12 @@ public class Order extends BaseDomain { |
74 | 81 | private Date submitTime; |
75 | 82 | /** 支付类型 */ |
76 | 83 | private PayType payType; |
77 | - /** 总金额 */ | |
84 | + /** 预计总金额 */ | |
78 | 85 | private Long totalPrice; |
86 | + /** | |
87 | + * 实际价格,有商家接单后修改 | |
88 | + */ | |
89 | + private Long realTotalPrice; | |
79 | 90 | /** 乐观锁(版本号) */ |
80 | 91 | private Long versionNum; |
81 | 92 | /** 删除标志 */ |
... | ... | @@ -83,7 +94,7 @@ public class Order extends BaseDomain { |
83 | 94 | /** |
84 | 95 | * 店铺 |
85 | 96 | */ |
86 | - private Shop shop; | |
97 | + private Long shopId; | |
87 | 98 | /** 进入当前状态说明或原因,如取消原因,退款审批通过原因等 */ |
88 | 99 | private String statusInReason; |
89 | 100 | /** |
... | ... | @@ -96,10 +107,48 @@ public class Order extends BaseDomain { |
96 | 107 | * |
97 | 108 | * @param vo |
98 | 109 | * 订单属性 |
110 | + * @throws ParseException | |
99 | 111 | */ |
100 | - public void submit(SubmitOrderRequestDto vo, OrderIdGenerator idGenerator) { | |
112 | + public void submit(SubmitOrderRequestDto vo, OrderIdGenerator idGenerator) throws ParseException { | |
113 | + Long orderId = idGenerator.getOrdersNewSeqNo(); | |
114 | + this.setId(orderId); | |
115 | + this.buyerId = vo.getBuyerId(); | |
116 | + this.buyerMemo = vo.getBuyerMemo(); | |
117 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
118 | + if (!TextUtils.isEmpty(vo.getDeliveryTime())) { | |
119 | + this.deliveryTime = df.parse(vo.getDeliveryTime()); | |
120 | + } | |
121 | + this.deliveryType = DeliveryType.getDeliveryType(vo.getDeliveryType()); | |
122 | + this.payType = PayType.getPayType(vo.getPayType()); | |
101 | 123 | this.payStatus = PayStatus.PayWait; |
102 | 124 | this.orderStatus = OrderStatus.PendingTake; |
125 | + if (!TextUtils.isEmpty(vo.getReservationTime())) { | |
126 | + this.reservationTime = df.parse(vo.getReservationTime()); | |
127 | + } | |
128 | + this.sellerId = vo.getSellerId(); | |
129 | + long totalPrice = 0; | |
130 | + List<OrderItem> orderItems = new ArrayList<>(vo.getOrderItems().size()); | |
131 | + int itemIdx = 1; | |
132 | + for (OrderItemDto orderItemDto : vo.getOrderItems()) { | |
133 | + Long orderItemId = idGenerator.getOrdersItemNewSeqNo(orderId, itemIdx++); | |
134 | + OrderItem orderItem = new OrderItem(); | |
135 | + orderItem.setBuyerId(vo.getBuyerId()); | |
136 | + orderItem.setId(orderItemId); | |
137 | + orderItem.setOrderId(orderId); | |
138 | + orderItem.setPriceUnit(orderItemDto.getPriceUnit()); | |
139 | + orderItem.setProductId(orderItemDto.getProductId()); | |
140 | + orderItem.setSellerId(orderItemDto.getSellerId()); | |
141 | + orderItem.setShopId(vo.getShopId()); | |
142 | + orderItem.setSku(orderItemDto.getSku()); | |
143 | + orderItem.setSkuAttributes(orderItem.getSkuAttributes()); | |
144 | + orderItem.setAmount(orderItemDto.getAmount()); | |
145 | + orderItem.setSkuPicture(orderItemDto.getSkuPicture()); | |
146 | + orderItem.setSkuPrice(orderItemDto.getSkuPrice()); | |
147 | + orderItem.setSkuTitle(orderItemDto.getSkuTitle()); | |
148 | + orderItems.add(orderItem); | |
149 | + totalPrice += orderItemDto.getSkuPrice(); | |
150 | + } | |
151 | + this.totalPrice = totalPrice; | |
103 | 152 | } |
104 | 153 | |
105 | 154 | /** |
... | ... | @@ -117,9 +166,9 @@ public class Order extends BaseDomain { |
117 | 166 | if (this.payType.equals(PayType.Online)) { |
118 | 167 | this.orderStatus = OrderStatus.PendingPayment; |
119 | 168 | } else if (this.payType.equals(PayType.Offline)) { |
120 | - if (this.deliveryType.equals(OrderDeliveryType.Delivery)) { | |
169 | + if (this.deliveryType.equals(DeliveryType.Delivery)) { | |
121 | 170 | this.orderStatus = OrderStatus.PendingDelivery; |
122 | - } else if (this.deliveryType.equals(OrderDeliveryType.Self)) { | |
171 | + } else if (this.deliveryType.equals(DeliveryType.Self)) { | |
123 | 172 | this.orderStatus = OrderStatus.PendingStoreMention; |
124 | 173 | } else { |
125 | 174 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "未知的配送类型"); |
... | ... | @@ -127,7 +176,7 @@ public class Order extends BaseDomain { |
127 | 176 | } else { |
128 | 177 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "未知的支付类型"); |
129 | 178 | } |
130 | - this.totalPrice = totalPrice; | |
179 | + this.realTotalPrice = totalPrice; | |
131 | 180 | } |
132 | 181 | |
133 | 182 | /** |
... | ... | @@ -144,9 +193,9 @@ public class Order extends BaseDomain { |
144 | 193 | } |
145 | 194 | this.payStatus = PayStatus.Paid; |
146 | 195 | this.payTime = new Date(); |
147 | - if (this.deliveryType.equals(OrderDeliveryType.Delivery)) { | |
196 | + if (this.deliveryType.equals(DeliveryType.Delivery)) { | |
148 | 197 | this.orderStatus = OrderStatus.PendingDelivery; |
149 | - } else if (this.deliveryType.equals(OrderDeliveryType.Self)) { | |
198 | + } else if (this.deliveryType.equals(DeliveryType.Self)) { | |
150 | 199 | this.orderStatus = OrderStatus.PendingStoreMention; |
151 | 200 | } else { |
152 | 201 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "未知的支付类型"); | ... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/OrderItem.java
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | */ |
5 | 5 | package com.b2c.orders.domain; |
6 | 6 | |
7 | -import java.util.Date; | |
7 | +import java.sql.Timestamp; | |
8 | 8 | |
9 | 9 | import lombok.Data; |
10 | 10 | import lombok.EqualsAndHashCode; |
... | ... | @@ -34,12 +34,10 @@ public class OrderItem extends BaseDomain { |
34 | 34 | private String sku; |
35 | 35 | private String skuTitle; |
36 | 36 | private String skuAttributes; |
37 | - private Integer skuNum; | |
37 | + private Integer amount; | |
38 | 38 | private Long skuPrice; |
39 | - private Long realPrice; | |
40 | - private Date createTime; | |
41 | - private Date editTime; | |
42 | - private Integer isCommented; | |
39 | + private Timestamp createTime; | |
40 | + private Timestamp editTime; | |
43 | 41 | private Long versionNum; |
44 | 42 | private String skuPicture; |
45 | 43 | private String priceUnit; | ... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/OrderLog.java
0 → 100644
1 | +package com.b2c.orders.domain; | |
2 | + | |
3 | +import java.sql.Timestamp; | |
4 | + | |
5 | +import com.b2c.orders.enums.Action; | |
6 | +import com.b2c.orders.enums.UserType; | |
7 | + | |
8 | +import lombok.Data; | |
9 | +import lombok.EqualsAndHashCode; | |
10 | +import lombok.NoArgsConstructor; | |
11 | + | |
12 | +@Data | |
13 | +@EqualsAndHashCode(callSuper = true) | |
14 | +@NoArgsConstructor | |
15 | +public class OrderLog extends BaseDomain { | |
16 | + | |
17 | + /** | |
18 | + * | |
19 | + */ | |
20 | + private static final long serialVersionUID = 6172890206387936046L; | |
21 | + | |
22 | + private Action action; | |
23 | + private Timestamp actionTime; | |
24 | + private Long userId; | |
25 | + private UserType userType; | |
26 | + private Long orderId; | |
27 | + | |
28 | +} | ... | ... |
b2c-orders-manager/src/main/java/com/b2c/orders/manager/OrderManager.java
... | ... | @@ -12,8 +12,9 @@ public interface OrderManager { |
12 | 12 | * @param orderVo |
13 | 13 | * 订单属性 |
14 | 14 | * @throws DtmsRpcException |
15 | + * @throws OrderException | |
15 | 16 | */ |
16 | - void submit(SubmitOrderRequestDto orderVo) throws DtmsRpcException; | |
17 | + void submit(SubmitOrderRequestDto orderVo) throws DtmsRpcException, OrderException; | |
17 | 18 | |
18 | 19 | /** |
19 | 20 | * 接单 | ... | ... |
b2c-orders-manager/src/main/java/com/b2c/orders/manager/impl/OrderManagerBean.java
1 | 1 | package com.b2c.orders.manager.impl; |
2 | 2 | |
3 | +import java.text.ParseException; | |
4 | + | |
3 | 5 | import org.slf4j.Logger; |
4 | 6 | import org.slf4j.LoggerFactory; |
5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -18,9 +20,7 @@ import com.b2c.orders.commons.exceptions.OrderException; |
18 | 20 | import com.b2c.orders.commons.exceptions.OrderRepositoryException; |
19 | 21 | import com.b2c.orders.commons.utils.OrderIdGenerator; |
20 | 22 | import com.b2c.orders.dao.OrderDao; |
21 | -import com.b2c.orders.domain.Buyer; | |
22 | 23 | import com.b2c.orders.domain.Order; |
23 | -import com.b2c.orders.domain.Seller; | |
24 | 24 | import com.b2c.orders.manager.OrderManager; |
25 | 25 | import com.b2c.orders.rpc.DtmsRPCService; |
26 | 26 | import com.b2c.orders.rpc.exception.DtmsRpcException; |
... | ... | @@ -39,9 +39,14 @@ public class OrderManagerBean implements OrderManager { |
39 | 39 | private DtmsRPCService dtmsService; |
40 | 40 | |
41 | 41 | @Override |
42 | - public void submit(SubmitOrderRequestDto orderVo) throws DtmsRpcException { | |
42 | + public void submit(SubmitOrderRequestDto orderVo) throws DtmsRpcException, OrderException { | |
43 | 43 | Order po = new Order(); |
44 | - po.submit(orderVo, this.IdGenerator); | |
44 | + try { | |
45 | + po.submit(orderVo, this.IdGenerator); | |
46 | + } catch (ParseException e) { | |
47 | + LOG.error(e.getMessage(), e); | |
48 | + throw new OrderException(ApplicationException.DATA_EXCEPTION, "提交订单失败"); | |
49 | + } | |
45 | 50 | this.orderDao.save(po); |
46 | 51 | DtmsProduceRequestDto request = new DtmsProduceRequestDto(); |
47 | 52 | request.setBizId(po.getId().toString()); |
... | ... | @@ -62,11 +67,10 @@ public class OrderManagerBean implements OrderManager { |
62 | 67 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
63 | 68 | String.format("未找到id为%s的订单", orderId)); |
64 | 69 | } |
65 | - Seller seller = po.getSeller(); | |
66 | - if (seller == null) { | |
70 | + if (po.getSellerId() == null) { | |
67 | 71 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "卖家信息不存在"); |
68 | 72 | } |
69 | - if (!seller.equals(sellerId)) { | |
73 | + if (!po.getSellerId().equals(sellerId)) { | |
70 | 74 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能接单"); |
71 | 75 | } |
72 | 76 | po.take(totalPrice); |
... | ... | @@ -90,11 +94,10 @@ public class OrderManagerBean implements OrderManager { |
90 | 94 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
91 | 95 | String.format("未找到id为%s的订单", orderId)); |
92 | 96 | } |
93 | - Buyer buyer = po.getBuyer(); | |
94 | - if (buyer == null) { | |
97 | + if (po.getBuyerId() == null) { | |
95 | 98 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "买家信息不存在"); |
96 | 99 | } |
97 | - if (!buyer.getId().equals(buyerId)) { | |
100 | + if (!po.getBuyerId().equals(buyerId)) { | |
98 | 101 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能支付"); |
99 | 102 | } |
100 | 103 | po.pay(); |
... | ... | @@ -108,11 +111,10 @@ public class OrderManagerBean implements OrderManager { |
108 | 111 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
109 | 112 | String.format("未找到id为%s的订单", orderId)); |
110 | 113 | } |
111 | - Buyer buyer = po.getBuyer(); | |
112 | - if (buyer == null) { | |
114 | + if (po.getBuyerId() == null) { | |
113 | 115 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "买家信息不存在"); |
114 | 116 | } |
115 | - if (!buyer.getId().equals(buyerId)) { | |
117 | + if (!po.getBuyerId().equals(buyerId)) { | |
116 | 118 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能确认收货"); |
117 | 119 | } |
118 | 120 | po.confirm(); |
... | ... | @@ -126,11 +128,10 @@ public class OrderManagerBean implements OrderManager { |
126 | 128 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
127 | 129 | String.format("未找到id为%s的订单", orderId)); |
128 | 130 | } |
129 | - Seller seller = po.getSeller(); | |
130 | - if (seller == null) { | |
131 | + if (po.getSellerId() == null) { | |
131 | 132 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "卖家信息不存在"); |
132 | 133 | } |
133 | - if (!seller.equals(sellerId)) { | |
134 | + if (!po.getSellerId().equals(sellerId)) { | |
134 | 135 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能收款"); |
135 | 136 | } |
136 | 137 | po.confirm(); |
... | ... | @@ -144,11 +145,10 @@ public class OrderManagerBean implements OrderManager { |
144 | 145 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
145 | 146 | String.format("未找到id为%s的订单", orderId)); |
146 | 147 | } |
147 | - Seller seller = po.getSeller(); | |
148 | - if (seller == null) { | |
148 | + if (po.getSellerId() == null) { | |
149 | 149 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "卖家信息不存在"); |
150 | 150 | } |
151 | - if (!seller.equals(sellerId)) { | |
151 | + if (!po.getSellerId().equals(sellerId)) { | |
152 | 152 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能接单"); |
153 | 153 | } |
154 | 154 | po.refuse(); |
... | ... | @@ -163,11 +163,10 @@ public class OrderManagerBean implements OrderManager { |
163 | 163 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
164 | 164 | String.format("未找到id为%s的订单", orderId)); |
165 | 165 | } |
166 | - Buyer buyer = po.getBuyer(); | |
167 | - if (buyer == null) { | |
166 | + if (po.getBuyerId() == null) { | |
168 | 167 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "买家信息不存在"); |
169 | 168 | } |
170 | - if (!buyer.getId().equals(buyerId)) { | |
169 | + if (!po.getBuyerId().equals(buyerId)) { | |
171 | 170 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能取消啊"); |
172 | 171 | } |
173 | 172 | po.cancel(); | ... | ... |
b2c-orders-service/src/main/java/com/b2c/orders/service/OrderService.java
... | ... | @@ -13,8 +13,9 @@ public interface OrderService { |
13 | 13 | * @param order |
14 | 14 | * 订单id |
15 | 15 | * @throws DtmsRpcException |
16 | + * @throws OrderException | |
16 | 17 | */ |
17 | - void submit(SubmitOrderRequestDto order) throws DtmsRpcException; | |
18 | + void submit(SubmitOrderRequestDto order) throws DtmsRpcException, OrderException; | |
18 | 19 | |
19 | 20 | /** |
20 | 21 | * 商家接单 | ... | ... |
b2c-orders-service/src/main/java/com/b2c/orders/service/impl/OrderServiceBean.java
... | ... | @@ -21,7 +21,7 @@ public class OrderServiceBean implements OrderService { |
21 | 21 | private OrderManager orderManager; |
22 | 22 | |
23 | 23 | @Override |
24 | - public void submit(SubmitOrderRequestDto order) throws DtmsRpcException { | |
24 | + public void submit(SubmitOrderRequestDto order) throws DtmsRpcException, OrderException { | |
25 | 25 | this.orderManager.submit(order); |
26 | 26 | } |
27 | 27 | ... | ... |
b2c-orders-web/pom.xml
... | ... | @@ -82,10 +82,6 @@ |
82 | 82 | <groupId>io.swagger</groupId> |
83 | 83 | <artifactId>swagger-annotations</artifactId> |
84 | 84 | </dependency> |
85 | - <!-- https://mvnrepository.com/artifact/com.mangofactory/swagger-springmvc --> | |
86 | - <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> | |
87 | - <!-- <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> | |
88 | - </dependency> --> | |
89 | 85 | <dependency> |
90 | 86 | <groupId>com.b2c.dtms</groupId> |
91 | 87 | <artifactId>dtms-client</artifactId> |
... | ... | @@ -128,11 +124,6 @@ |
128 | 124 | <artifactId>hibernate-validator</artifactId> |
129 | 125 | </dependency> |
130 | 126 | |
131 | - <!-- if you enable json support in spring mvc. --> | |
132 | - <dependency> | |
133 | - <groupId>org.codehaus.jackson</groupId> | |
134 | - <artifactId>jackson-mapper-asl</artifactId> | |
135 | - </dependency> | |
136 | 127 | <!-- if you use fileupload in spring mvc --> |
137 | 128 | <dependency> |
138 | 129 | <groupId>commons-fileupload</groupId> | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/restful/OrderRestController.java
... | ... | @@ -42,13 +42,13 @@ public class OrderRestController { |
42 | 42 | |
43 | 43 | @ApiOperation("提交订单") |
44 | 44 | @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) |
45 | - public SubmitOrderResponseDto submit(@RequestBody @Valid SubmitOrderRequestDto order, BindingResult br) { | |
45 | + public SubmitOrderResponseDto submit(@RequestBody SubmitOrderRequestDto order) { | |
46 | 46 | SubmitOrderResponseDto dto = new SubmitOrderResponseDto(); |
47 | 47 | try { |
48 | 48 | this.orderService.submit(order); |
49 | 49 | dto.setCode(BaseResponseDto.RESPONSE_CODE_SUCCESS); |
50 | 50 | dto.setSuccess(true); |
51 | - } catch (DtmsRpcException e) { | |
51 | + } catch (ApplicationException e) { | |
52 | 52 | dto.setMessage(e.getMessage()); |
53 | 53 | } |
54 | 54 | return dto; | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/ActionConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.Action; | |
6 | + | |
7 | +public class ActionConverter implements Converter<String, Action> { | |
8 | + | |
9 | + @Override | |
10 | + public Action convert(String source) { | |
11 | + return Action.get(Integer.valueOf(source)); | |
12 | + } | |
13 | + | |
14 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/DateConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import java.text.ParseException; | |
4 | +import java.text.SimpleDateFormat; | |
5 | +import java.util.Date; | |
6 | + | |
7 | +import org.slf4j.Logger; | |
8 | +import org.slf4j.LoggerFactory; | |
9 | +import org.springframework.core.convert.converter.Converter; | |
10 | + | |
11 | +public class DateConverter implements Converter<String, Date> { | |
12 | + | |
13 | + private static final Logger LOG = LoggerFactory.getLogger(DateConverter.class); | |
14 | + | |
15 | + @Override | |
16 | + public Date convert(String source) { | |
17 | + try { | |
18 | + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(source); | |
19 | + } catch (ParseException e) { | |
20 | + LOG.error(e.getMessage(), e); | |
21 | + return null; | |
22 | + } | |
23 | + } | |
24 | + | |
25 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/OrderDeliveryTypeConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.DeliveryType; | |
6 | + | |
7 | +public class OrderDeliveryTypeConverter implements Converter<String, DeliveryType> { | |
8 | + | |
9 | + @Override | |
10 | + public DeliveryType convert(String source) { | |
11 | + return DeliveryType.getDeliveryType(Integer.valueOf(source)); | |
12 | + } | |
13 | + | |
14 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/OrderStatusConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.OrderStatus; | |
6 | + | |
7 | +public class OrderStatusConverter implements Converter<String, OrderStatus> { | |
8 | + | |
9 | + @Override | |
10 | + public OrderStatus convert(String source) { | |
11 | + Integer value = Integer.valueOf(source); | |
12 | + return OrderStatus.getOrderStatus(value); | |
13 | + } | |
14 | + | |
15 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/PayStatusConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.PayStatus; | |
6 | + | |
7 | +public class PayStatusConverter implements Converter<String, PayStatus> { | |
8 | + | |
9 | + @Override | |
10 | + public PayStatus convert(String source) { | |
11 | + return PayStatus.getPayStatus(Integer.valueOf(source)); | |
12 | + } | |
13 | + | |
14 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/PayTypeConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.PayType; | |
6 | + | |
7 | +public class PayTypeConverter implements Converter<String, PayType> { | |
8 | + | |
9 | + @Override | |
10 | + public PayType convert(String source) { | |
11 | + return PayType.getPayType(Integer.valueOf(source)); | |
12 | + } | |
13 | + | |
14 | +} | ... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/utils/UserTypeConverter.java
0 → 100644
1 | +package com.b2c.orders.web.utils; | |
2 | + | |
3 | +import org.springframework.core.convert.converter.Converter; | |
4 | + | |
5 | +import com.b2c.orders.enums.UserType; | |
6 | + | |
7 | +public class UserTypeConverter implements Converter<String, UserType> { | |
8 | + | |
9 | + @Override | |
10 | + public UserType convert(String source) { | |
11 | + return UserType.get(Integer.valueOf(source)); | |
12 | + } | |
13 | + | |
14 | +} | ... | ... |
b2c-orders-web/src/main/resources/springmvc-config.xml
... | ... | @@ -79,4 +79,21 @@ |
79 | 79 | <property name="cookieMaxAge" value="2147483647" /> |
80 | 80 | </bean> |
81 | 81 | |
82 | + <bean id="conversionService" | |
83 | + class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> | |
84 | + <property name="converters"> | |
85 | + <list> | |
86 | + <bean class="com.b2c.orders.web.utils.OrderStatusConverter" /> | |
87 | + <bean class="com.b2c.orders.web.utils.UserTypeConverter" /> | |
88 | + <bean class="com.b2c.orders.web.utils.ActionConverter" /> | |
89 | + <bean class="com.b2c.orders.web.utils.OrderDeliveryTypeConverter" /> | |
90 | + <bean class="com.b2c.orders.web.utils.PayStatusConverter" /> | |
91 | + <bean class="com.b2c.orders.web.utils.PayTypeConverter" /> | |
92 | + <bean class="com.b2c.orders.web.utils.DateConverter" /> | |
93 | + </list> | |
94 | + </property> | |
95 | + </bean> | |
96 | + | |
97 | + <mvc:annotation-driven conversion-service="conversionService" /> | |
98 | + | |
82 | 99 | </beans> |
83 | 100 | \ No newline at end of file | ... | ... |
b2c-orders-web/src/main/resources/sqlmap-config.xml deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" ?> | |
2 | -<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> | |
3 | - | |
4 | -<configuration> | |
5 | - <settings> | |
6 | - <!-- 全局映射器启用缓存 --> | |
7 | - <setting name="cacheEnabled" value="true" /> | |
8 | - <!-- 对于未知的SQL查询,允许返回不同的结果集以达到通用的效果 --> | |
9 | - <setting name="multipleResultSetsEnabled" value="true" /> | |
10 | - <!-- 允许使用列标签代替列名 --> | |
11 | - <setting name="useColumnLabel" value="true" /> | |
12 | - <!-- 数据库超过25000秒仍未响应则超时 --> | |
13 | - <setting name="defaultStatementTimeout" value="25000" /> | |
14 | - <setting name="logImpl" value="STDOUT_LOGGING" /> | |
15 | - </settings> | |
16 | - | |
17 | - <!-- 全局别名设置,在映射文件中只需写别名,而不必写出整个类路径 --> | |
18 | - <typeAliases> | |
19 | - <!-- <typeAlias type="com.diligrp.orders.domain.OrderItem" alias="orderItem"/> | |
20 | - <typeAlias type="com.diligrp.orders.domain.OrderStockLocker" alias="orderStockLocker"/> | |
21 | - <typeAlias type="com.diligrp.orders.domain.OrderTraceInfo" alias="orderTraceInfo"/> | |
22 | - <typeAlias type="com.diligrp.orders.domain.Orders" alias="orders"/> | |
23 | - <typeAlias type="com.diligrp.orders.domain.ReOrder" alias="reOrder"/> | |
24 | - <typeAlias type="com.diligrp.orders.domain.ClaimsOrder" alias="claimsOrder"/> | |
25 | - <typeAlias type="com.diligrp.orders.domain.ClaimsOrderTraceInfo" alias="claimsOrderTraceInfo"/> | |
26 | - <typeAlias type="com.diligrp.orders.domain.ReorderTraceInfo" alias="reorderTraceInfo"/> | |
27 | - <typeAlias type="com.diligrp.orders.domain.OrderMaxid" alias="orderMaxid"/> | |
28 | - <typeAlias type="com.diligrp.orders.domain.SettleBill" alias="settleBill"/> | |
29 | - <typeAlias type="com.diligrp.orders.domain.SettleCapitalFlow" alias="settleCapitalFlow"/> | |
30 | - <typeAlias type="com.diligrp.orders.domain.SettleRemitRecord" alias="settleRemitRecord"/> | |
31 | - <typeAlias type="com.diligrp.orders.domain.OrdersJob" alias="ordersJob"/> | |
32 | - <typeAlias type="com.diligrp.orders.domain.OrderShipInfo" alias="orderShipInfo"/> | |
33 | - <typeAlias type="com.diligrp.orders.domain.OrderRemindNumInfo" alias="orderRemindNumInfo"/> | |
34 | - <typeAlias type="com.diligrp.orders.domain.OrderPrint" alias="orderPrint"/> | |
35 | - <typeAlias type="com.diligrp.orders.domain.OrderReceiver" alias="orderReceiver" /> | |
36 | - <typeAlias type="com.diligrp.orders.domain.OrderBrokerage" alias="orderBrokerage" /> | |
37 | - | |
38 | - <typeAlias type="com.diligrp.orders.vo.OrdersSumVO" alias="ordersSumVO"/> | |
39 | - <typeAlias type="com.diligrp.orders.vo.OrderItemVO" alias="orderItemVO"/> | |
40 | - <typeAlias type="com.diligrp.orders.vo.SettleBillVO" alias="settleBillVO"/> | |
41 | - <typeAlias type="com.diligrp.orders.vo.SettleBillSumVO" alias="settleBillSumVO"/> | |
42 | - <typeAlias type="com.diligrp.orders.vo.SettleRemitRecordVO" alias="settleRemitRecordVO"/> | |
43 | - <typeAlias type="com.diligrp.orders.vo.SettleCapitalFlowVO" alias="settleCapitalFlowVO"/> | |
44 | - <typeAlias type="com.diligrp.orders.vo.KeyValueVO" alias="keyValueVO"/> | |
45 | - <typeAlias type="com.diligrp.orders.vo.OrdersVO" alias="ordersVO"/> | |
46 | - | |
47 | - <typeAlias type="com.diligrp.orders.domain.dtms.DtmsMessage" alias="dtmsMessage"/> | |
48 | - <typeAlias type="com.diligrp.orders.domain.dtms.DtmsMessageException" alias="dtmsMessageException"/> | |
49 | - <typeAlias type="com.diligrp.orders.domain.dtms.DtmsMessageConfig" alias="dtmsMessageConfig"/> | |
50 | - <typeAlias type="com.diligrp.orders.domain.dtms.DtmsMessageHistory" alias="dtmsMessageHistory"/> --> | |
51 | - | |
52 | - | |
53 | - </typeAliases> | |
54 | - | |
55 | - <typeHandlers> | |
56 | - <!-- <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderManStatusHandler" javaType="com.diligrp.orders.common.enums.order.OrderManStatus" /> | |
57 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderPayTypeHandler" javaType="com.diligrp.orders.publics.enums.PayType" /> | |
58 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.ReOrderStatusHandler" javaType="com.diligrp.orders.publics.enums.ReOrderStatus" /> | |
59 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.MarketDeliveryHandler" javaType="com.diligrp.orders.publics.enums.MarketDelivery" /> | |
60 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.RefundTypeHandler" javaType="com.diligrp.orders.common.enums.reorder.RefundType" /> | |
61 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.ClaimsOrderStatusHandler" javaType="com.diligrp.orders.publics.enums.ClaimsOrderStatus" /> | |
62 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.TraceTypeHandler" javaType="com.diligrp.orders.common.enums.TraceType" /> | |
63 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderPayStatusHandler" javaType="com.diligrp.orders.publics.enums.PayStatus" /> | |
64 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.ClaimsDemandHandler" javaType="com.diligrp.orders.publics.enums.ClaimsDemand" /> | |
65 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderTypeHandler" javaType="com.diligrp.orders.publics.enums.OrderType" /> | |
66 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.AuditResultHandler" javaType="com.diligrp.orders.publics.enums.AuditResult" /> | |
67 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderBrokerageStatusHandler" javaType="com.diligrp.orders.common.enums.order.OrderBrokerageStatus" /> | |
68 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.RemitAuditStatusHandler" javaType="com.diligrp.orders.publics.enums.RemitAuditStatus" /> | |
69 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderDeliveryTypeHandler" javaType="com.diligrp.orders.publics.enums.OrderDeliveryType" /> | |
70 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.OrderComeFromHandler" javaType="com.diligrp.orders.publics.enums.OrderComeFrom" /> | |
71 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.WarrantTypeHandler" javaType="com.diligrp.orders.publics.enums.WarrantType" /> | |
72 | - <typeHandler handler="com.diligrp.orders.dao.typehandler.InvoiceTypeHandler" javaType="com.diligrp.orders.publics.enums.InvoiceType" /> --> | |
73 | - </typeHandlers> | |
74 | - | |
75 | - <!-- 映射文件路径 --> | |
76 | - <mappers> | |
77 | - <mapper resource="sqlmap/OrderMaxid.xml" /> | |
78 | - </mappers> | |
79 | - | |
80 | - | |
81 | -</configuration> | |
82 | 0 | \ No newline at end of file |
pom.xml
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | <maven.compiler.encoding>UTF-8</maven.compiler.encoding> |
13 | 13 | <spring.version>4.3.2.RELEASE</spring.version> |
14 | 14 | <aspectj.version>1.6.11</aspectj.version> |
15 | - <jackson.version>1.9.2</jackson.version> | |
15 | + <jackson.version>2.8.5</jackson.version> | |
16 | 16 | <slf4j.version>1.7.21</slf4j.version> |
17 | 17 | <logback.version>1.1.3</logback.version> |
18 | 18 | <titan.devlop.version>0.0.3-SNAPSHOT</titan.devlop.version> |
... | ... | @@ -50,6 +50,7 @@ |
50 | 50 | <orders.paramLog.enabled>true</orders.paramLog.enabled> |
51 | 51 | <mariadb-java-client.version>1.5.5</mariadb-java-client.version> |
52 | 52 | <aspectjweaver.version>1.7.2</aspectjweaver.version> |
53 | + <woodstox.version>4.4.1</woodstox.version> | |
53 | 54 | </properties> |
54 | 55 | |
55 | 56 | <dependencyManagement> |
... | ... | @@ -127,16 +128,55 @@ |
127 | 128 | </exclusion> |
128 | 129 | </exclusions> |
129 | 130 | </dependency> |
131 | + <!-- the core, which includes Streaming API, shared low-level abstractions | |
132 | + (but NOT data-binding) --> | |
130 | 133 | <dependency> |
131 | 134 | <groupId>com.fasterxml.jackson.core</groupId> |
132 | 135 | <artifactId>jackson-core</artifactId> |
133 | - <version>2.8.1</version> | |
136 | + <version>${jackson.version}</version> | |
137 | + </dependency> | |
138 | + | |
139 | + <!-- Just the annotations; use this dependency if you want to attach annotations | |
140 | + to classes without connecting them to the code. --> | |
141 | + <dependency> | |
142 | + <groupId>com.fasterxml.jackson.core</groupId> | |
143 | + <artifactId>jackson-annotations</artifactId> | |
144 | + <version>${jackson.version}</version> | |
134 | 145 | </dependency> |
135 | 146 | |
147 | + <!-- databinding; ObjectMapper, JsonNode and related classes are here --> | |
136 | 148 | <dependency> |
137 | 149 | <groupId>com.fasterxml.jackson.core</groupId> |
138 | 150 | <artifactId>jackson-databind</artifactId> |
139 | - <version>2.8.5</version> | |
151 | + <version>${jackson.version}</version> | |
152 | + </dependency> | |
153 | + <!-- smile (binary JSON). Other artifacts in this group do other formats. --> | |
154 | + <dependency> | |
155 | + <groupId>com.fasterxml.jackson.dataformat</groupId> | |
156 | + <artifactId>jackson-dataformat-smile</artifactId> | |
157 | + <version>${jackson.version}</version> | |
158 | + </dependency> | |
159 | + <dependency> | |
160 | + <groupId>com.fasterxml.jackson.dataformat</groupId> | |
161 | + <artifactId>jackson-dataformat-xml</artifactId> | |
162 | + <version>${jackson.version}</version> | |
163 | + </dependency> | |
164 | + <dependency> | |
165 | + <groupId>org.codehaus.woodstox</groupId> | |
166 | + <artifactId>woodstox-core-asl</artifactId> | |
167 | + <version>${woodstox.version}</version> | |
168 | + </dependency> | |
169 | + <!-- JAX-RS provider --> | |
170 | + <dependency> | |
171 | + <groupId>com.fasterxml.jackson.jaxrs</groupId> | |
172 | + <artifactId>jackson-jaxrs-json-provider</artifactId> | |
173 | + <version>${jackson.version}</version> | |
174 | + </dependency> | |
175 | + <!-- Support for JAX-B annotations as additional configuration --> | |
176 | + <dependency> | |
177 | + <groupId>com.fasterxml.jackson.module</groupId> | |
178 | + <artifactId>jackson-module-jaxb-annotations</artifactId> | |
179 | + <version>${jackson.version}</version> | |
140 | 180 | </dependency> |
141 | 181 | <dependency> |
142 | 182 | <groupId>com.yqyw</groupId> |
... | ... | @@ -350,8 +390,8 @@ |
350 | 390 | </dependency> |
351 | 391 | <dependency> |
352 | 392 | <groupId>cglib</groupId> |
353 | - <artifactId>cglib-nodep</artifactId> | |
354 | - <version>2.1_3</version> | |
393 | + <artifactId>cglib</artifactId> | |
394 | + <version>3.2.4</version> | |
355 | 395 | </dependency> |
356 | 396 | <dependency> |
357 | 397 | <groupId>org.apache.commons</groupId> |
... | ... | @@ -378,11 +418,8 @@ |
378 | 418 | <version>5.1.3.Final</version> |
379 | 419 | </dependency> |
380 | 420 | <!-- if you enable json support in spring mvc. --> |
381 | - <dependency> | |
382 | - <groupId>org.codehaus.jackson</groupId> | |
383 | - <artifactId>jackson-mapper-asl</artifactId> | |
384 | - <version>${jackson.version}</version> | |
385 | - </dependency> | |
421 | + <!-- <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> | |
422 | + <version>${jackson.version}</version> </dependency> --> | |
386 | 423 | <!-- if you use fileupload in spring mvc --> |
387 | 424 | <dependency> |
388 | 425 | <groupId>commons-fileupload</groupId> | ... | ... |