Commit bc9a98bd8d63389192abd060e9dbd08050feb943
1 parent
3f8d8472
调整订单列表查询参数,订单详情,订单日志,增加缓存,买家删除订单,卖家删除订单
Showing
52 changed files
with
1348 additions
and
159 deletions
b2c-orders-client/src/main/java/com/b2c/orders/domain/client/dto/request/OrderListRequestDto.java
1 | 1 | package com.b2c.orders.domain.client.dto.request; |
2 | 2 | |
3 | -import io.swagger.annotations.ApiParam; | |
3 | +import io.swagger.annotations.ApiModelProperty; | |
4 | 4 | |
5 | 5 | public class OrderListRequestDto { |
6 | 6 | |
7 | 7 | /** |
8 | 8 | * 买家 |
9 | 9 | */ |
10 | - @ApiParam(value = "买家id") | |
11 | - private Long buyerId; | |
10 | + @ApiModelProperty(value = "买家id") | |
11 | + private Long shopBuyerId; | |
12 | 12 | /** |
13 | 13 | * 卖家 |
14 | 14 | */ |
15 | - @ApiParam("卖家id") | |
15 | + @ApiModelProperty("卖家id") | |
16 | 16 | private Long sellerId; |
17 | 17 | /** 订单状态 */ |
18 | - @ApiParam("订单状态") | |
18 | + @ApiModelProperty("订单状态") | |
19 | 19 | private Integer orderStatus; |
20 | - @ApiParam("每页显示记录数") | |
20 | + @ApiModelProperty("每页显示记录数") | |
21 | 21 | private Integer pageSize = 10; |
22 | - @ApiParam("第几页") | |
22 | + @ApiModelProperty("第几页") | |
23 | 23 | private Integer page = 1; |
24 | + @ApiModelProperty("用户类型:买家,卖家") | |
25 | + private Integer userType; | |
26 | + @ApiModelProperty("订单查询参数") | |
27 | + private String queryString; | |
24 | 28 | |
25 | - public Long getBuyerId() { | |
26 | - return buyerId; | |
29 | + public Long getShopBuyerId() { | |
30 | + return shopBuyerId; | |
27 | 31 | } |
28 | 32 | |
29 | - public void setBuyerId(Long buyerId) { | |
30 | - this.buyerId = buyerId; | |
33 | + public void setShopBuyerId(Long buyerId) { | |
34 | + this.shopBuyerId = buyerId; | |
31 | 35 | } |
32 | 36 | |
33 | 37 | public Long getSellerId() { |
... | ... | @@ -62,4 +66,20 @@ public class OrderListRequestDto { |
62 | 66 | this.page = page; |
63 | 67 | } |
64 | 68 | |
69 | + public Integer getUserType() { | |
70 | + return userType; | |
71 | + } | |
72 | + | |
73 | + public void setUserType(Integer userType) { | |
74 | + this.userType = userType; | |
75 | + } | |
76 | + | |
77 | + public String getQueryString() { | |
78 | + return queryString; | |
79 | + } | |
80 | + | |
81 | + public void setQueryString(String queryString) { | |
82 | + this.queryString = queryString; | |
83 | + } | |
84 | + | |
65 | 85 | } |
... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/domain/client/dto/request/SubmitOrderRequestDto.java
... | ... | @@ -3,7 +3,7 @@ package com.b2c.orders.domain.client.dto.request; |
3 | 3 | import java.io.Serializable; |
4 | 4 | import java.util.List; |
5 | 5 | |
6 | -import io.swagger.annotations.ApiParam; | |
6 | +import io.swagger.annotations.ApiModelProperty; | |
7 | 7 | |
8 | 8 | public class SubmitOrderRequestDto implements Serializable { |
9 | 9 | |
... | ... | @@ -12,23 +12,25 @@ public class SubmitOrderRequestDto implements Serializable { |
12 | 12 | */ |
13 | 13 | private static final long serialVersionUID = 5060629945327592074L; |
14 | 14 | |
15 | - @ApiParam(value = "买家绑定店铺的id") | |
15 | + @ApiModelProperty(value = "买家绑定店铺的id") | |
16 | 16 | private Long shopBuyerId; |
17 | - @ApiParam(value = "市场id", required = true) | |
17 | + @ApiModelProperty(value = "市场id", required = true) | |
18 | 18 | private Long marketId; |
19 | - @ApiParam(value = "配送类型", required = true) | |
19 | + @ApiModelProperty(value = "配送类型", required = true) | |
20 | 20 | private Integer deliveryType; |
21 | - @ApiParam(value = "买家备注说明", required = true) | |
21 | + @ApiModelProperty(value = "买家备注说明", required = true) | |
22 | 22 | private String buyerMemo; |
23 | - @ApiParam(value = "送货时间") | |
23 | + @ApiModelProperty(value = "送货时间") | |
24 | 24 | private String deliveryTime; |
25 | - @ApiParam("送货地址") | |
25 | + @ApiModelProperty("收货人姓名") | |
26 | + private String receiverName; | |
27 | + @ApiModelProperty("送货地址") | |
26 | 28 | private String deliveryAddress; |
27 | - @ApiParam("收货人电话") | |
29 | + @ApiModelProperty("收货人电话") | |
28 | 30 | private String receiverPhoneNumber; |
29 | - @ApiParam(value = "提货时间") | |
31 | + @ApiModelProperty(value = "提货时间") | |
30 | 32 | private String reservationTime; |
31 | - @ApiParam(value = "订单项", required = true) | |
33 | + @ApiModelProperty(value = "订单项", required = true) | |
32 | 34 | private List<OrderItemDto> orderItems; |
33 | 35 | |
34 | 36 | public Long getShopBuyerId() { |
... | ... | @@ -71,6 +73,14 @@ public class SubmitOrderRequestDto implements Serializable { |
71 | 73 | this.deliveryTime = deliveryTime; |
72 | 74 | } |
73 | 75 | |
76 | + public String getReceiverName() { | |
77 | + return receiverName; | |
78 | + } | |
79 | + | |
80 | + public void setReceiverName(String receiverName) { | |
81 | + this.receiverName = receiverName; | |
82 | + } | |
83 | + | |
74 | 84 | public String getDeliveryAddress() { |
75 | 85 | return deliveryAddress; |
76 | 86 | } |
... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/Action.java
1 | 1 | package com.b2c.orders.enums; |
2 | 2 | |
3 | +import com.fasterxml.jackson.annotation.JsonCreator; | |
3 | 4 | import com.fasterxml.jackson.annotation.JsonValue; |
4 | 5 | |
5 | 6 | public enum Action { |
... | ... | @@ -49,6 +50,8 @@ public enum Action { |
49 | 50 | private String name; |
50 | 51 | |
51 | 52 | private Action(int index, String name) { |
53 | + this.index = index; | |
54 | + this.name = name; | |
52 | 55 | } |
53 | 56 | |
54 | 57 | @JsonValue |
... | ... | @@ -60,6 +63,7 @@ public enum Action { |
60 | 63 | return name; |
61 | 64 | } |
62 | 65 | |
66 | + @JsonCreator | |
63 | 67 | public static Action get(Integer index) { |
64 | 68 | for (Action c : Action.values()) { |
65 | 69 | if (c.getIndex() == index) { |
... | ... |
b2c-orders-client/src/main/java/com/b2c/orders/enums/DeliveryType.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.JsonCreator; | |
5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; |
6 | 7 | import com.google.common.collect.Maps; |
7 | 8 | |
... | ... | @@ -46,6 +47,7 @@ public enum DeliveryType { |
46 | 47 | return name; |
47 | 48 | } |
48 | 49 | |
50 | + @JsonCreator | |
49 | 51 | public static DeliveryType getDeliveryType(Integer index) { |
50 | 52 | if (!initMaps.containsKey(index)) { |
51 | 53 | throw new IllegalArgumentException("未知的配送类型"); |
... | ... |
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.JsonCreator; | |
5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; |
6 | 7 | import com.google.common.collect.Maps; |
7 | 8 | |
... | ... | @@ -78,6 +79,7 @@ public enum OrderStatus { |
78 | 79 | /** |
79 | 80 | * 获取所有订单类型的状态 |
80 | 81 | */ |
82 | + @JsonCreator | |
81 | 83 | public static OrderStatus getOrderStatus(int index) { |
82 | 84 | return initMaps.get(index); |
83 | 85 | } |
... | ... |
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.JsonCreator; | |
3 | 4 | import com.fasterxml.jackson.annotation.JsonValue; |
4 | 5 | |
5 | 6 | /** |
... | ... | @@ -30,6 +31,7 @@ public enum PayStatus { |
30 | 31 | return index; |
31 | 32 | } |
32 | 33 | |
34 | + @JsonCreator | |
33 | 35 | public static PayStatus getPayStatus(int index) { |
34 | 36 | for (PayStatus c : PayStatus.values()) { |
35 | 37 | if (c.getIndex() == index) { |
... | ... |
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.JsonCreator; | |
5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; |
6 | 7 | import com.google.common.collect.Maps; |
7 | 8 | |
... | ... | @@ -26,6 +27,7 @@ public enum PayType { |
26 | 27 | } |
27 | 28 | } |
28 | 29 | |
30 | + @JsonCreator | |
29 | 31 | public static PayType getPayType(Integer index) { |
30 | 32 | if (initMaps.containsKey(index)) { |
31 | 33 | return initMaps.get(index); |
... | ... |
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.JsonCreator; | |
3 | 4 | import com.fasterxml.jackson.annotation.JsonValue; |
4 | 5 | |
5 | 6 | /** |
... | ... | @@ -24,6 +25,7 @@ public enum UserType { |
24 | 25 | private String name; |
25 | 26 | private String prefix; |
26 | 27 | |
28 | + @JsonCreator | |
27 | 29 | public static UserType get(int index) { |
28 | 30 | for (UserType c : UserType.values()) { |
29 | 31 | if (c.getIndex() == index) { |
... | ... |
b2c-orders-commons/src/main/java/com/b2c/orders/commons/exceptions/ShopBuyerException.java
0 → 100644
1 | +package com.b2c.orders.commons.exceptions; | |
2 | + | |
3 | +public class ShopBuyerException extends ApplicationException { | |
4 | + | |
5 | + /** | |
6 | + * | |
7 | + */ | |
8 | + private static final long serialVersionUID = -2401169219685419941L; | |
9 | + | |
10 | + public ShopBuyerException(int code, String message, Throwable cause, boolean enableSuppression, | |
11 | + boolean writableStackTrace) { | |
12 | + super(code, message, cause, enableSuppression, writableStackTrace); | |
13 | + // TODO Auto-generated constructor stub | |
14 | + } | |
15 | + | |
16 | + public ShopBuyerException(int code, String message, Throwable cause) { | |
17 | + super(code, message, cause); | |
18 | + // TODO Auto-generated constructor stub | |
19 | + } | |
20 | + | |
21 | + public ShopBuyerException(int code, String message) { | |
22 | + super(code, message); | |
23 | + // TODO Auto-generated constructor stub | |
24 | + } | |
25 | + | |
26 | + public ShopBuyerException(int code, Throwable cause) { | |
27 | + super(code, cause); | |
28 | + // TODO Auto-generated constructor stub | |
29 | + } | |
30 | + | |
31 | + public ShopBuyerException(int code) { | |
32 | + super(code); | |
33 | + // TODO Auto-generated constructor stub | |
34 | + } | |
35 | + | |
36 | +} | |
... | ... |
b2c-orders-commons/src/main/java/com/b2c/orders/commons/exceptions/ShopException.java
0 → 100644
1 | +package com.b2c.orders.commons.exceptions; | |
2 | + | |
3 | +public class ShopException extends ApplicationException { | |
4 | + | |
5 | + /** | |
6 | + * | |
7 | + */ | |
8 | + private static final long serialVersionUID = 2285912454247692652L; | |
9 | + | |
10 | + public ShopException(int code) { | |
11 | + super(code); | |
12 | + // TODO Auto-generated constructor stub | |
13 | + } | |
14 | + | |
15 | + public ShopException(int code, String message, Throwable cause, boolean enableSuppression, | |
16 | + boolean writableStackTrace) { | |
17 | + super(code, message, cause, enableSuppression, writableStackTrace); | |
18 | + // TODO Auto-generated constructor stub | |
19 | + } | |
20 | + | |
21 | + public ShopException(int code, String message, Throwable cause) { | |
22 | + super(code, message, cause); | |
23 | + // TODO Auto-generated constructor stub | |
24 | + } | |
25 | + | |
26 | + public ShopException(int code, String message) { | |
27 | + super(code, message); | |
28 | + // TODO Auto-generated constructor stub | |
29 | + } | |
30 | + | |
31 | + public ShopException(int code, Throwable cause) { | |
32 | + super(code, cause); | |
33 | + // TODO Auto-generated constructor stub | |
34 | + } | |
35 | + | |
36 | +} | |
... | ... |
b2c-orders-dao/pom.xml
... | ... | @@ -14,10 +14,10 @@ |
14 | 14 | <artifactId>b2c-orders-domain</artifactId> |
15 | 15 | <version>${project.version}</version> |
16 | 16 | </dependency> |
17 | - <!-- <dependency> | |
18 | - <groupId>cglib</groupId> | |
19 | - <artifactId>cglib</artifactId> | |
20 | - </dependency> --> | |
17 | + <dependency> | |
18 | + <groupId>redis.clients</groupId> | |
19 | + <artifactId>jedis</artifactId> | |
20 | + </dependency> | |
21 | 21 | <dependency> |
22 | 22 | <groupId>com.b2c.website</groupId> |
23 | 23 | <artifactId>diligrp-website-util</artifactId> |
... | ... | @@ -30,6 +30,10 @@ |
30 | 30 | <groupId>org.apache.hbase</groupId> |
31 | 31 | <artifactId>hbase-client</artifactId> |
32 | 32 | </exclusion> |
33 | + <exclusion> | |
34 | + <groupId>redis.clients</groupId> | |
35 | + <artifactId>jedis</artifactId> | |
36 | + </exclusion> | |
33 | 37 | </exclusions> |
34 | 38 | </dependency> |
35 | 39 | <dependency> |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/BuyerDao.java
1 | 1 | package com.b2c.orders.dao; |
2 | 2 | |
3 | 3 | import com.b2c.orders.commons.exceptions.BuyerException; |
4 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
4 | 5 | import com.b2c.orders.domain.Buyer; |
5 | 6 | |
6 | 7 | public interface BuyerDao { |
7 | 8 | |
8 | - Buyer findByBuyerShopId(Long buyerShopId) throws BuyerException; | |
9 | + Buyer findByBuyerShopId(Long buyerShopId) throws BuyerException, ShopBuyerException; | |
9 | 10 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/OrderDao.java
1 | 1 | package com.b2c.orders.dao; |
2 | 2 | |
3 | +import com.b2c.orders.commons.exceptions.OrderRepositoryException; | |
3 | 4 | import com.b2c.orders.domain.Order; |
4 | 5 | import com.diligrp.website.util.dao.IBaseDao; |
5 | 6 | |
6 | 7 | public interface OrderDao extends IBaseDao<Order> { |
7 | 8 | |
9 | + void buyerRemove(Long orderId) throws OrderRepositoryException; | |
10 | + | |
11 | + void sellerRemove(Long orderId) throws OrderRepositoryException; | |
12 | + | |
8 | 13 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/OrderLogDao.java
b2c-orders-dao/src/main/java/com/b2c/orders/dao/SellerDao.java
1 | 1 | package com.b2c.orders.dao; |
2 | 2 | |
3 | 3 | import com.b2c.orders.commons.exceptions.SellerException; |
4 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
4 | 5 | import com.b2c.orders.domain.Seller; |
5 | 6 | |
6 | 7 | public interface SellerDao { |
7 | 8 | |
8 | - Seller findByBuyerShopId(Long buyerShopId) throws SellerException; | |
9 | + Seller findByBuyerShopId(Long buyerShopId) throws SellerException, ShopBuyerException; | |
9 | 10 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/ShopBuyerDao.java
0 → 100644
1 | +package com.b2c.orders.dao; | |
2 | + | |
3 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; | |
4 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
5 | + | |
6 | +public interface ShopBuyerDao { | |
7 | + | |
8 | + ShopBuyerKeyOutput findByShopBuyerId(Long shopBuyerId) throws ShopBuyerException; | |
9 | +} | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/ShopDao.java
1 | 1 | package com.b2c.orders.dao; |
2 | 2 | |
3 | -import com.b2c.orders.commons.exceptions.SellerException; | |
3 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
4 | +import com.b2c.orders.commons.exceptions.ShopException; | |
4 | 5 | import com.b2c.orders.domain.Shop; |
5 | 6 | |
6 | 7 | public interface ShopDao { |
7 | 8 | |
8 | - Shop findByBuyerShopId(Long shopBuyerId) throws SellerException; | |
9 | + Shop findByBuyerShopId(Long shopBuyerId) throws ShopException, ShopBuyerException; | |
9 | 10 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/cache/CacheManager.java
0 → 100644
1 | +package com.b2c.orders.dao.cache; | |
2 | + | |
3 | +import org.slf4j.Logger; | |
4 | +import org.slf4j.LoggerFactory; | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Component; | |
7 | +import org.springframework.util.StringUtils; | |
8 | + | |
9 | +import com.b2c.orders.dao.utils.JedisUtils; | |
10 | +import com.fasterxml.jackson.annotation.JsonInclude.Include; | |
11 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
12 | + | |
13 | +@Component | |
14 | +public class CacheManager { | |
15 | + | |
16 | + private static final Logger LOG = LoggerFactory.getLogger(CacheManager.class); | |
17 | + private static final ObjectMapper MAPPER = new ObjectMapper(); | |
18 | + | |
19 | + static { | |
20 | + MAPPER.setSerializationInclusion(Include.NON_NULL); | |
21 | + } | |
22 | + | |
23 | + @Autowired | |
24 | + private JedisUtils jedisUtils; | |
25 | + | |
26 | + public <T> T get(String key, Class<T> type) { | |
27 | + String value = this.jedisUtils.get(key); | |
28 | + if (StringUtils.isEmpty(value)) { | |
29 | + return null; | |
30 | + } | |
31 | + try { | |
32 | + return MAPPER.readValue(value, type); | |
33 | + } catch (Exception e) { | |
34 | + LOG.error(e.getMessage(), e); | |
35 | + return null; | |
36 | + } | |
37 | + } | |
38 | + | |
39 | + public void put(String key, Object value) { | |
40 | + try { | |
41 | + this.jedisUtils.set(key, MAPPER.writeValueAsString(value)); | |
42 | + } catch (Exception e) { | |
43 | + LOG.error(e.getMessage(), e); | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + public void put(String key, Object value, int expire) { | |
48 | + try { | |
49 | + this.jedisUtils.set(key, MAPPER.writeValueAsString(value), expire); | |
50 | + } catch (Exception e) { | |
51 | + LOG.error(e.getMessage(), e); | |
52 | + } | |
53 | + } | |
54 | + | |
55 | + public void remove(String key) { | |
56 | + this.jedisUtils.del(key); | |
57 | + } | |
58 | +} | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/BuyerDaoBean.java
... | ... | @@ -8,36 +8,45 @@ import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; |
8 | 8 | import com.b2c.myapp.common.utils.BaseOutput; |
9 | 9 | import com.b2c.myapp.sdk.MyAppClient; |
10 | 10 | import com.b2c.myapp.sdk.service.BuyerInfoService; |
11 | -import com.b2c.myapp.sdk.service.ShopBuyerService; | |
12 | 11 | import com.b2c.orders.commons.exceptions.ApplicationException; |
13 | 12 | import com.b2c.orders.commons.exceptions.BuyerException; |
13 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
14 | 14 | import com.b2c.orders.dao.BuyerDao; |
15 | +import com.b2c.orders.dao.ShopBuyerDao; | |
16 | +import com.b2c.orders.dao.cache.CacheManager; | |
15 | 17 | import com.b2c.orders.domain.Buyer; |
16 | 18 | |
17 | 19 | @Repository |
18 | 20 | public class BuyerDaoBean implements BuyerDao { |
19 | 21 | |
22 | + private static final String BUYER_CACHE_KEY = "b2c_redis_buyer_"; | |
23 | + | |
24 | + @Autowired | |
25 | + private CacheManager cacheManager; | |
20 | 26 | @Autowired |
21 | 27 | private MyAppClient myAppClient; |
28 | + @Autowired | |
29 | + private ShopBuyerDao shopBuyerDao; | |
22 | 30 | |
23 | 31 | @Override |
24 | - public Buyer findByBuyerShopId(Long buyerShopId) throws BuyerException { | |
25 | - ShopBuyerService sbs = this.myAppClient.getShopBuyerService(); | |
26 | - BaseOutput<ShopBuyerKeyOutput> response = sbs.getShopBuyerKeys(buyerShopId); | |
27 | - if (response == null || !response.getCode().equals("200")) { | |
28 | - throw new BuyerException(ApplicationException.DATA_EXCEPTION, "获取买家信息失败"); | |
32 | + public Buyer findByBuyerShopId(Long shopBuyerId) throws BuyerException, ShopBuyerException { | |
33 | + ShopBuyerKeyOutput output = this.shopBuyerDao.findByShopBuyerId(shopBuyerId); | |
34 | + if (output == null) { | |
35 | + return null; | |
29 | 36 | } |
30 | - ShopBuyerKeyOutput output = response.getData(); | |
37 | + String key = BUYER_CACHE_KEY + output.getBuyerId(); | |
38 | + Buyer buyer = this.cacheManager.get(key, Buyer.class); | |
31 | 39 | BuyerInfoService bis = this.myAppClient.getBuyerInfoService(); |
32 | 40 | BaseOutput<BuyerInfoOutput> bo = bis.getBuyerInfoById(output.getBuyerId()); |
33 | 41 | if (bo == null || !bo.getCode().equals("200")) { |
34 | 42 | throw new BuyerException(ApplicationException.DATA_EXCEPTION, "获取买家信息失败"); |
35 | 43 | } |
36 | 44 | BuyerInfoOutput bio = bo.getData(); |
37 | - Buyer buyer = new Buyer(); | |
45 | + buyer = new Buyer(); | |
38 | 46 | buyer.setId(bio.getId()); |
39 | 47 | buyer.setName(bio.getAccountName()); |
40 | 48 | buyer.setPhoneNumber(bio.getMobilePhone()); |
49 | + this.cacheManager.put(key, buyer); | |
41 | 50 | return buyer; |
42 | 51 | } |
43 | 52 | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/OrderDaoBean.java
... | ... | @@ -3,8 +3,11 @@ package com.b2c.orders.dao.impl; |
3 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | 4 | import org.springframework.stereotype.Repository; |
5 | 5 | |
6 | +import com.b2c.orders.commons.exceptions.ApplicationException; | |
7 | +import com.b2c.orders.commons.exceptions.OrderRepositoryException; | |
6 | 8 | import com.b2c.orders.dao.OrderDao; |
7 | 9 | import com.b2c.orders.dao.OrderItemDao; |
10 | +import com.b2c.orders.dao.cache.CacheManager; | |
8 | 11 | import com.b2c.orders.domain.Order; |
9 | 12 | import com.b2c.orders.domain.OrderItem; |
10 | 13 | import com.diligrp.website.util.dao.impl.BaseDaoImpl; |
... | ... | @@ -12,6 +15,9 @@ import com.diligrp.website.util.dao.impl.BaseDaoImpl; |
12 | 15 | @Repository |
13 | 16 | public class OrderDaoBean extends BaseDaoImpl<Order> implements OrderDao { |
14 | 17 | |
18 | + private static final String ORDER_CACHE_KEY = "b2c_redis_order_"; | |
19 | + @Autowired | |
20 | + private CacheManager cacheManager; | |
15 | 21 | @Autowired |
16 | 22 | private OrderItemDao orderItemDao; |
17 | 23 | |
... | ... | @@ -28,4 +34,41 @@ public class OrderDaoBean extends BaseDaoImpl<Order> implements OrderDao { |
28 | 34 | return true; |
29 | 35 | } |
30 | 36 | |
37 | + @Override | |
38 | + public boolean update(Order order) { | |
39 | + String key = ORDER_CACHE_KEY + order.getId(); | |
40 | + this.cacheManager.remove(key); | |
41 | + return super.update(order); | |
42 | + } | |
43 | + | |
44 | + @Override | |
45 | + public Order getById(Long id) { | |
46 | + String key = ORDER_CACHE_KEY + id; | |
47 | + Order order = this.cacheManager.get(key, Order.class); | |
48 | + if (order != null) { | |
49 | + return order; | |
50 | + } | |
51 | + order = super.getById(id); | |
52 | + if (order != null) { | |
53 | + this.cacheManager.put(key, order); | |
54 | + } | |
55 | + return order; | |
56 | + } | |
57 | + | |
58 | + @Override | |
59 | + public void buyerRemove(Long orderId) throws OrderRepositoryException { | |
60 | + int rows = this.getSqlSessionTemplate().update(this.getClass().getCanonicalName() + ".buyerRemove", orderId); | |
61 | + if (rows <= 0) { | |
62 | + throw new OrderRepositoryException(ApplicationException.DATA_EXCEPTION, "删除订单失败"); | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + @Override | |
67 | + public void sellerRemove(Long orderId) throws OrderRepositoryException { | |
68 | + int rows = this.getSqlSessionTemplate().update(this.getClass().getCanonicalName() + ".sellerRemove", orderId); | |
69 | + if (rows <= 0) { | |
70 | + throw new OrderRepositoryException(ApplicationException.DATA_EXCEPTION, "删除订单失败"); | |
71 | + } | |
72 | + } | |
73 | + | |
31 | 74 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/OrderLogDaoBean.java
1 | 1 | package com.b2c.orders.dao.impl; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
3 | 5 | import org.springframework.stereotype.Repository; |
4 | 6 | |
5 | 7 | import com.b2c.orders.dao.OrderLogDao; |
... | ... | @@ -9,4 +11,9 @@ import com.diligrp.website.util.dao.impl.BaseDaoImpl; |
9 | 11 | @Repository |
10 | 12 | public class OrderLogDaoBean extends BaseDaoImpl<OrderLog> implements OrderLogDao { |
11 | 13 | |
14 | + @Override | |
15 | + public List<OrderLog> findByOrderId(Long orderId) { | |
16 | + return this.getSqlSessionTemplate().selectList(this.getClass().getCanonicalName()+".findByOrderId", orderId); | |
17 | + } | |
18 | + | |
12 | 19 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/ProductDaoBean.java
1 | 1 | package com.b2c.orders.dao.impl; |
2 | 2 | |
3 | -import java.io.IOException; | |
4 | -import java.io.InputStream; | |
3 | +import java.util.Arrays; | |
5 | 4 | import java.util.Map; |
6 | 5 | import java.util.Map.Entry; |
7 | 6 | |
... | ... | @@ -18,11 +17,7 @@ import com.b2c.orders.dao.ProductDao; |
18 | 17 | import com.b2c.orders.domain.rpc.Product; |
19 | 18 | import com.diligrp.titan.sdk.TitanClient; |
20 | 19 | import com.diligrp.titan.sdk.output.BaseOutput; |
21 | -import com.fasterxml.jackson.annotation.JsonInclude.Include; | |
22 | -import com.fasterxml.jackson.databind.DeserializationFeature; | |
23 | -import com.fasterxml.jackson.databind.JsonNode; | |
24 | -import com.fasterxml.jackson.databind.ObjectMapper; | |
25 | -import com.fasterxml.jackson.databind.type.MapType; | |
20 | +import com.diligrp.titan.sdk.service.ProductService; | |
26 | 21 | |
27 | 22 | @Repository |
28 | 23 | public class ProductDaoBean implements ProductDao { |
... | ... | @@ -39,28 +34,9 @@ public class ProductDaoBean implements ProductDao { |
39 | 34 | |
40 | 35 | @Override |
41 | 36 | public Product findBySku(String sku) throws ProductException { |
42 | - // ProductService productRPCService = | |
43 | - // this.titanClient.getProductService(); | |
44 | - // BaseOutput<Map<String, com.diligrp.titan.sdk.domain.Product>> | |
45 | - // rpcResponse = productRPCService | |
46 | - // .getSkuInfoMap(Arrays.asList(sku)); | |
47 | - InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("product.json"); | |
48 | - ObjectMapper mapper = new ObjectMapper(); | |
49 | - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | |
50 | - mapper.setSerializationInclusion(Include.NON_NULL); | |
51 | - BaseOutput<Map<String, com.diligrp.titan.sdk.domain.Product>> rpcResponse = new BaseOutput<>(); | |
52 | - try { | |
53 | - JsonNode rootNode = mapper.readTree(in); | |
54 | - rpcResponse.setCode(rootNode.get("code").asInt()); | |
55 | - String json = rootNode.get("data").toString(); | |
56 | - MapType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, | |
57 | - com.diligrp.titan.sdk.domain.Product.class); | |
58 | - Map<String, com.diligrp.titan.sdk.domain.Product> map = mapper.readValue(json, type); | |
59 | - rpcResponse.setData(map); | |
60 | - rpcResponse.setResult(rootNode.get("result").toString()); | |
61 | - } catch (IOException e) { | |
62 | - throw new RuntimeException(e); | |
63 | - } | |
37 | + ProductService productRPCService = this.titanClient.getProductService(); | |
38 | + BaseOutput<Map<String, com.diligrp.titan.sdk.domain.Product>> rpcResponse = productRPCService | |
39 | + .getSkuInfoMap(Arrays.asList(sku)); | |
64 | 40 | if (rpcResponse.getCode() != 200) { |
65 | 41 | LOG.error(rpcResponse.getResult()); |
66 | 42 | throw new ProductException(ApplicationException.DATA_EXCEPTION, "根据sku查询商品信息失败"); |
... | ... | @@ -73,14 +49,14 @@ public class ProductDaoBean implements ProductDao { |
73 | 49 | Product product = new Product(); |
74 | 50 | product.setId(rpcProduct.getPid()); |
75 | 51 | product.setName(rpcProduct.getName()); |
76 | - product.setPriceUnit(rpcProduct.getSaleUnit()); | |
52 | + product.setPriceUnit("个"); | |
77 | 53 | product.setSku(sku); |
78 | 54 | if (CollectionUtils.isEmpty(rpcProduct.getSkus())) { |
79 | 55 | throw new ProductException(ApplicationException.DATA_EXCEPTION, "商品sku信息为空"); |
80 | 56 | } |
81 | 57 | com.diligrp.titan.sdk.domain.Sku targetSku = null; |
82 | 58 | for (com.diligrp.titan.sdk.domain.Sku skuInfo : rpcProduct.getSkus()) { |
83 | - if (skuInfo.getDecodeSku().equals(sku)) { | |
59 | + if (skuInfo.getSku().equals(sku)) { | |
84 | 60 | targetSku = skuInfo; |
85 | 61 | } |
86 | 62 | } |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/SellerDaoBean.java
... | ... | @@ -8,35 +8,48 @@ import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; |
8 | 8 | import com.b2c.myapp.common.utils.BaseOutput; |
9 | 9 | import com.b2c.myapp.sdk.MyAppClient; |
10 | 10 | import com.b2c.myapp.sdk.service.SellerInfoService; |
11 | -import com.b2c.myapp.sdk.service.ShopBuyerService; | |
12 | 11 | import com.b2c.orders.commons.exceptions.ApplicationException; |
13 | 12 | import com.b2c.orders.commons.exceptions.SellerException; |
13 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
14 | 14 | import com.b2c.orders.dao.SellerDao; |
15 | +import com.b2c.orders.dao.ShopBuyerDao; | |
16 | +import com.b2c.orders.dao.cache.CacheManager; | |
15 | 17 | import com.b2c.orders.domain.Seller; |
16 | 18 | |
17 | 19 | @Repository |
18 | 20 | public class SellerDaoBean implements SellerDao { |
19 | 21 | |
22 | + private static final String SELLER_CACHE_KEY = "b2c_redis_seller_"; | |
23 | + | |
20 | 24 | @Autowired |
21 | 25 | private MyAppClient myAppClient; |
26 | + @Autowired | |
27 | + private CacheManager cacheManager; | |
28 | + @Autowired | |
29 | + private ShopBuyerDao shopBuyerDao; | |
22 | 30 | |
23 | 31 | @Override |
24 | - public Seller findByBuyerShopId(Long buyerShopId) throws SellerException { | |
25 | - ShopBuyerService sbs = this.myAppClient.getShopBuyerService(); | |
26 | - BaseOutput<ShopBuyerKeyOutput> response = sbs.getShopBuyerKeys(buyerShopId); | |
27 | - if (response == null || !response.getCode().equals("200")) { | |
28 | - throw new SellerException(ApplicationException.DATA_EXCEPTION, "获取卖家信息失败"); | |
32 | + public Seller findByBuyerShopId(Long shopBuyerId) throws SellerException, ShopBuyerException { | |
33 | + ShopBuyerKeyOutput output = this.shopBuyerDao.findByShopBuyerId(shopBuyerId); | |
34 | + if (output == null) { | |
35 | + return null; | |
36 | + } | |
37 | + String key = SELLER_CACHE_KEY + output.getSellerId(); | |
38 | + Seller seller = this.cacheManager.get(key, Seller.class); | |
39 | + if (seller != null) { | |
40 | + return seller; | |
29 | 41 | } |
30 | - ShopBuyerKeyOutput output = response.getData(); | |
31 | 42 | SellerInfoService sis = this.myAppClient.getSellerInfoService(); |
32 | 43 | BaseOutput<SellerInfoOutput> bo = sis.getSellerInfoById(output.getSellerId()); |
33 | 44 | if (bo == null || !bo.getCode().equals("200")) { |
34 | 45 | throw new SellerException(ApplicationException.DATA_EXCEPTION, "获取卖家信息失败"); |
35 | 46 | } |
36 | 47 | SellerInfoOutput sio = bo.getData(); |
37 | - Seller seller = new Seller(); | |
48 | + seller = new Seller(); | |
38 | 49 | seller.setId(sio.getId()); |
39 | 50 | seller.setName(sio.getAccountName()); |
51 | + seller.setPhoneNumber(sio.getMobilePhone()); | |
52 | + this.cacheManager.put(key, seller); | |
40 | 53 | return seller; |
41 | 54 | } |
42 | 55 | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/ShopBuyerDaoBean.java
0 → 100644
1 | +package com.b2c.orders.dao.impl; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Repository; | |
5 | + | |
6 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; | |
7 | +import com.b2c.myapp.common.utils.BaseOutput; | |
8 | +import com.b2c.myapp.sdk.MyAppClient; | |
9 | +import com.b2c.myapp.sdk.service.ShopBuyerService; | |
10 | +import com.b2c.orders.commons.exceptions.ApplicationException; | |
11 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
12 | +import com.b2c.orders.dao.ShopBuyerDao; | |
13 | +import com.b2c.orders.dao.cache.CacheManager; | |
14 | + | |
15 | +@Repository | |
16 | +public class ShopBuyerDaoBean implements ShopBuyerDao { | |
17 | + | |
18 | + private static final String SHOP_BUYER_CACHE_KEY = "b2c_redis_shop_buyer_"; | |
19 | + | |
20 | + @Autowired | |
21 | + private MyAppClient myAppClient; | |
22 | + @Autowired | |
23 | + private CacheManager cacheManager; | |
24 | + | |
25 | + @Override | |
26 | + public ShopBuyerKeyOutput findByShopBuyerId(Long buyerShopId) throws ShopBuyerException { | |
27 | + ShopBuyerService sbs = this.myAppClient.getShopBuyerService(); | |
28 | + String key = SHOP_BUYER_CACHE_KEY + buyerShopId; | |
29 | + ShopBuyerKeyOutput output = this.cacheManager.get(key, ShopBuyerKeyOutput.class); | |
30 | + if (output == null) { | |
31 | + BaseOutput<ShopBuyerKeyOutput> response = sbs.getShopBuyerKeys(buyerShopId); | |
32 | + if (response == null || !response.getCode().equals("200")) { | |
33 | + throw new ShopBuyerException(ApplicationException.DATA_EXCEPTION, "获取卖家信息失败"); | |
34 | + } | |
35 | + output = response.getData(); | |
36 | + if (output != null) { | |
37 | + this.cacheManager.put(key, output); | |
38 | + } | |
39 | + } | |
40 | + return output; | |
41 | + } | |
42 | + | |
43 | +} | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/ShopDaoBean.java
... | ... | @@ -9,41 +9,55 @@ import com.b2c.myapp.common.api.shop.output.ShopOutput; |
9 | 9 | import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; |
10 | 10 | import com.b2c.myapp.common.utils.BaseOutput; |
11 | 11 | import com.b2c.myapp.sdk.MyAppClient; |
12 | -import com.b2c.myapp.sdk.service.ShopBuyerService; | |
13 | 12 | import com.b2c.myapp.sdk.service.ShopInfoService; |
14 | 13 | import com.b2c.orders.commons.exceptions.ApplicationException; |
15 | -import com.b2c.orders.commons.exceptions.SellerException; | |
14 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
15 | +import com.b2c.orders.commons.exceptions.ShopException; | |
16 | +import com.b2c.orders.dao.ShopBuyerDao; | |
16 | 17 | import com.b2c.orders.dao.ShopDao; |
18 | +import com.b2c.orders.dao.cache.CacheManager; | |
17 | 19 | import com.b2c.orders.domain.Shop; |
18 | 20 | |
19 | 21 | @Repository |
20 | 22 | public class ShopDaoBean implements ShopDao { |
21 | 23 | |
22 | 24 | private static final Logger LOG = LoggerFactory.getLogger(ShopDaoBean.class); |
25 | + private static final String SHOP_CACHE_KEY = "b2c_redis_shop_"; | |
23 | 26 | |
24 | 27 | @Autowired |
28 | + private CacheManager cacheManager; | |
29 | + @Autowired | |
30 | + private ShopBuyerDao shopBuyerDao; | |
31 | + @Autowired | |
25 | 32 | private MyAppClient myAppClient; |
26 | 33 | |
27 | 34 | @Override |
28 | - public Shop findByBuyerShopId(Long shopBuyerId) throws SellerException { | |
29 | - ShopBuyerService sbs = this.myAppClient.getShopBuyerService(); | |
30 | - BaseOutput<ShopBuyerKeyOutput> response = sbs.getShopBuyerKeys(shopBuyerId); | |
31 | - if (response == null || !response.getCode().equals("200")) { | |
32 | - LOG.error(String.format("调用店铺接口失败,Api:ShopBuyerService,Method:getShopBuyerKeys,params:%s", shopBuyerId)); | |
33 | - throw new SellerException(ApplicationException.DATA_EXCEPTION, "获取卖家信息失败"); | |
35 | + public Shop findByBuyerShopId(Long shopBuyerId) throws ShopException, ShopBuyerException { | |
36 | + ShopBuyerKeyOutput sbkOutput = this.shopBuyerDao.findByShopBuyerId(shopBuyerId); | |
37 | + if (sbkOutput == null) { | |
38 | + return null; | |
39 | + } | |
40 | + String key = SHOP_CACHE_KEY + sbkOutput.getShopId(); | |
41 | + Shop shop = this.cacheManager.get(key, Shop.class); | |
42 | + if (shop != null) { | |
43 | + return shop; | |
34 | 44 | } |
35 | - ShopBuyerKeyOutput sbkOutput = response.getData(); | |
36 | 45 | ShopInfoService sis = this.myAppClient.getShopInfoService(); |
37 | 46 | BaseOutput<ShopOutput> shopResponse = sis.getShopByShopId(sbkOutput.getShopId()); |
38 | - if (response == null || !response.getCode().equals("200")) { | |
47 | + if (shopResponse == null || !shopResponse.getCode().equals("200")) { | |
39 | 48 | LOG.error( |
40 | 49 | String.format("调用店铺接口失败,ShopInfoService,Method:getShopByShopId,params:%s", sbkOutput.getShopId())); |
41 | - throw new SellerException(ApplicationException.DATA_EXCEPTION, "获取卖家信息失败"); | |
50 | + throw new ShopException(ApplicationException.DATA_EXCEPTION, "获取店铺信息失败"); | |
42 | 51 | } |
43 | 52 | ShopOutput rpcShop = shopResponse.getData(); |
44 | - Shop shop = new Shop(); | |
53 | + shop = new Shop(); | |
45 | 54 | shop.setId(rpcShop.getId()); |
46 | 55 | shop.setName(rpcShop.getShopName()); |
56 | + shop.setShopAddress(rpcShop.getAddressDetail()); | |
57 | + shop.setShopPhoneNumber(rpcShop.getServiceTel()); | |
58 | + shop.setFreeShippingPrice(rpcShop.getFreeShippingPrice()); | |
59 | + shop.setPostage(rpcShop.getPostage()); | |
60 | + this.cacheManager.put(key, shop); | |
47 | 61 | return shop; |
48 | 62 | } |
49 | 63 | |
... | ... |
b2c-orders-dao/src/main/java/com/b2c/orders/dao/utils/JedisUtils.java
0 → 100644
1 | +package com.b2c.orders.dao.utils; | |
2 | + | |
3 | +import java.io.UnsupportedEncodingException; | |
4 | +import java.util.Arrays; | |
5 | +import java.util.Set; | |
6 | + | |
7 | +import org.slf4j.Logger; | |
8 | +import org.slf4j.LoggerFactory; | |
9 | + | |
10 | +import redis.clients.jedis.JedisPoolConfig; | |
11 | +import redis.clients.jedis.JedisShardInfo; | |
12 | +import redis.clients.jedis.ShardedJedis; | |
13 | +import redis.clients.jedis.ShardedJedisPool; | |
14 | + | |
15 | +public class JedisUtils { | |
16 | + | |
17 | + private static final Logger LOG = LoggerFactory.getLogger(JedisUtils.class); | |
18 | + | |
19 | + private JedisPoolConfig poolConfig; | |
20 | + private JedisShardInfo shardInfo; | |
21 | + | |
22 | + public JedisPoolConfig getPoolConfig() { | |
23 | + return poolConfig; | |
24 | + } | |
25 | + | |
26 | + public void setPoolConfig(JedisPoolConfig poolConfig) { | |
27 | + this.poolConfig = poolConfig; | |
28 | + } | |
29 | + | |
30 | + public JedisShardInfo getShardInfo() { | |
31 | + return shardInfo; | |
32 | + } | |
33 | + | |
34 | + public void setShardInfo(JedisShardInfo shardInfo) { | |
35 | + this.shardInfo = shardInfo; | |
36 | + } | |
37 | + | |
38 | + public Long hset(byte[] key, byte[] field, byte[] value) { | |
39 | + ShardedJedisPool jedisPool = null; | |
40 | + ShardedJedis jedis = null; | |
41 | + try { | |
42 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
43 | + jedis = jedisPool.getResource(); | |
44 | + return jedis.hset(key, field, value); | |
45 | + } catch (Exception e) { | |
46 | + LOG.error(e.getMessage(), e); | |
47 | + return 0L; | |
48 | + } finally { | |
49 | + try { | |
50 | + if (jedis != null) { | |
51 | + jedis.close(); | |
52 | + } | |
53 | + } catch (Exception e) { | |
54 | + LOG.error(e.getMessage(), e); | |
55 | + } finally { | |
56 | + if (jedisPool != null) { | |
57 | + jedisPool.close(); | |
58 | + } | |
59 | + } | |
60 | + } | |
61 | + } | |
62 | + | |
63 | + public byte[] hget(byte[] key, byte[] field) { | |
64 | + ShardedJedisPool jedisPool = null; | |
65 | + ShardedJedis jedis = null; | |
66 | + try { | |
67 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
68 | + jedis = jedisPool.getResource(); | |
69 | + return jedis.hget(key, field); | |
70 | + } catch (Exception e) { | |
71 | + LOG.error(e.getMessage(), e); | |
72 | + return null; | |
73 | + } finally { | |
74 | + try { | |
75 | + if (jedis != null) { | |
76 | + jedis.close(); | |
77 | + } | |
78 | + } catch (Exception e) { | |
79 | + LOG.error(e.getMessage(), e); | |
80 | + } finally { | |
81 | + if (jedisPool != null) { | |
82 | + jedisPool.close(); | |
83 | + } | |
84 | + } | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + public void hdel(String key, String... fields) { | |
89 | + ShardedJedisPool jedisPool = null; | |
90 | + ShardedJedis jedis = null; | |
91 | + try { | |
92 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
93 | + jedis = jedisPool.getResource(); | |
94 | + jedis.hdel(key, fields); | |
95 | + } catch (Exception e) { | |
96 | + LOG.error(e.getMessage(), e); | |
97 | + } finally { | |
98 | + try { | |
99 | + if (jedis != null) { | |
100 | + jedis.close(); | |
101 | + } | |
102 | + } catch (Exception e) { | |
103 | + LOG.error(e.getMessage(), e); | |
104 | + } finally { | |
105 | + if (jedisPool != null) { | |
106 | + jedisPool.close(); | |
107 | + } | |
108 | + } | |
109 | + } | |
110 | + } | |
111 | + | |
112 | + public Long del(String key) { | |
113 | + ShardedJedisPool jedisPool = null; | |
114 | + ShardedJedis jedis = null; | |
115 | + try { | |
116 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
117 | + jedis = jedisPool.getResource(); | |
118 | + return jedis.del(key); | |
119 | + } catch (Exception e) { | |
120 | + LOG.error(e.getMessage(), e); | |
121 | + return 0L; | |
122 | + } finally { | |
123 | + try { | |
124 | + if (jedis != null) { | |
125 | + jedis.close(); | |
126 | + } | |
127 | + } catch (Exception e) { | |
128 | + LOG.error(e.getMessage(), e); | |
129 | + } finally { | |
130 | + if (jedisPool != null) { | |
131 | + jedisPool.close(); | |
132 | + } | |
133 | + } | |
134 | + } | |
135 | + } | |
136 | + | |
137 | + public Set<String> smembers(String key) { | |
138 | + ShardedJedisPool jedisPool = null; | |
139 | + ShardedJedis jedis = null; | |
140 | + try { | |
141 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
142 | + jedis = jedisPool.getResource(); | |
143 | + return jedis.smembers(key); | |
144 | + } catch (Exception e) { | |
145 | + LOG.error(e.getMessage(), e); | |
146 | + return null; | |
147 | + } finally { | |
148 | + try { | |
149 | + if (jedis != null) { | |
150 | + jedis.close(); | |
151 | + } | |
152 | + } catch (Exception e) { | |
153 | + LOG.error(e.getMessage(), e); | |
154 | + } finally { | |
155 | + if (jedisPool != null) { | |
156 | + jedisPool.close(); | |
157 | + } | |
158 | + } | |
159 | + } | |
160 | + } | |
161 | + | |
162 | + public Long sadd(String key, String... members) { | |
163 | + ShardedJedisPool jedisPool = null; | |
164 | + ShardedJedis jedis = null; | |
165 | + try { | |
166 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
167 | + jedis = jedisPool.getResource(); | |
168 | + return jedis.sadd(key, members); | |
169 | + } catch (Exception e) { | |
170 | + LOG.error(e.getMessage(), e); | |
171 | + return 0L; | |
172 | + } finally { | |
173 | + try { | |
174 | + if (jedis != null) { | |
175 | + jedis.close(); | |
176 | + } | |
177 | + } catch (Exception e) { | |
178 | + LOG.error(e.getMessage(), e); | |
179 | + } finally { | |
180 | + if (jedisPool != null) { | |
181 | + jedisPool.close(); | |
182 | + } | |
183 | + } | |
184 | + } | |
185 | + } | |
186 | + | |
187 | + public String hget(String key, String value) { | |
188 | + byte[] bytes = this.hget(key.getBytes(), value.getBytes()); | |
189 | + try { | |
190 | + return new String(bytes, "UTF-8"); | |
191 | + } catch (UnsupportedEncodingException e) { | |
192 | + LOG.error(e.getMessage(), e); | |
193 | + return null; | |
194 | + } | |
195 | + } | |
196 | + | |
197 | + public void hset(String key, String field, String value) { | |
198 | + this.hset(key.getBytes(), field.getBytes(), value.getBytes()); | |
199 | + } | |
200 | + | |
201 | + public String get(String key) { | |
202 | + ShardedJedisPool jedisPool = null; | |
203 | + ShardedJedis jedis = null; | |
204 | + try { | |
205 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
206 | + jedis = jedisPool.getResource(); | |
207 | + return jedis.get(key); | |
208 | + } catch (Exception e) { | |
209 | + LOG.error(e.getMessage(), e); | |
210 | + return null; | |
211 | + } finally { | |
212 | + try { | |
213 | + if (jedis != null) { | |
214 | + jedis.close(); | |
215 | + } | |
216 | + } catch (Exception e) { | |
217 | + LOG.error(e.getMessage(), e); | |
218 | + } finally { | |
219 | + if (jedisPool != null) { | |
220 | + jedisPool.close(); | |
221 | + } | |
222 | + } | |
223 | + } | |
224 | + } | |
225 | + | |
226 | + public void set(String key, String value) { | |
227 | + this.set(key, value, -1); | |
228 | + } | |
229 | + | |
230 | + public void expire(String key, int seconds) { | |
231 | + ShardedJedisPool jedisPool = null; | |
232 | + ShardedJedis jedis = null; | |
233 | + try { | |
234 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
235 | + jedis = jedisPool.getResource(); | |
236 | + jedis.expire(key, seconds); | |
237 | + } catch (Exception e) { | |
238 | + LOG.error(e.getMessage(), e); | |
239 | + } finally { | |
240 | + try { | |
241 | + if (jedis != null) { | |
242 | + jedis.close(); | |
243 | + } | |
244 | + } catch (Exception e) { | |
245 | + LOG.error(e.getMessage(), e); | |
246 | + } finally { | |
247 | + if (jedisPool != null) { | |
248 | + jedisPool.close(); | |
249 | + } | |
250 | + } | |
251 | + } | |
252 | + } | |
253 | + | |
254 | + public void set(String key, String value, int expire) { | |
255 | + ShardedJedisPool jedisPool = null; | |
256 | + ShardedJedis jedis = null; | |
257 | + try { | |
258 | + jedisPool = new ShardedJedisPool(this.poolConfig, Arrays.asList(this.shardInfo)); | |
259 | + jedis = jedisPool.getResource(); | |
260 | + jedis.set(key, value); | |
261 | + if (expire > 0) { | |
262 | + jedis.expire(key, expire); | |
263 | + } | |
264 | + } catch (Exception e) { | |
265 | + LOG.error(e.getMessage(), e); | |
266 | + } finally { | |
267 | + try { | |
268 | + if (jedis != null) { | |
269 | + jedis.close(); | |
270 | + } | |
271 | + } catch (Exception e) { | |
272 | + LOG.error(e.getMessage(), e); | |
273 | + } finally { | |
274 | + if (jedisPool != null) { | |
275 | + jedisPool.close(); | |
276 | + } | |
277 | + } | |
278 | + } | |
279 | + } | |
280 | +} | |
... | ... |
b2c-orders-dao/src/main/resources/redis.properties
0 → 100644
1 | +redis.pool.maxActive=${redis.pool.maxActive} | |
2 | +redis.pool.maxIdle=${redis.pool.maxIdle} | |
3 | +redis.pool.minIdle=${redis.pool.minIdle} | |
4 | +redis.pool.maxWaitMillis=${redis.pool.maxWaitMillis} | |
5 | +redis.pool.maxWait=${redis.pool.maxWait} | |
6 | +redis.host=${redis.host} | |
7 | +redis.port=${redis.port} | |
8 | +redis.password=${redis.password} | |
9 | +redis.timeout=${redis.timeout} | |
10 | +redis.testOnBorrow=${redis.testOnBorrow} | |
11 | +redis.testOnReturn=${redis.testOnReturn} | |
0 | 12 | \ No newline at end of file |
... | ... |
b2c-orders-dao/src/main/resources/spring-redis.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <beans xmlns="http://www.springframework.org/schema/beans" |
3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" | |
4 | 4 | xmlns:context="http://www.springframework.org/schema/context" |
5 | - xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:cache="http://www.springframework.org/schema/cache" | |
6 | - xsi:schemaLocation="http://www.springframework.org/schema/beans | |
7 | - http://www.springframework.org/schema/beans/spring-beans-4.3.xsd | |
8 | - http://www.springframework.org/schema/context | |
9 | - http://www.springframework.org/schema/context/spring-context-4.3.xsd | |
10 | - http://www.springframework.org/schema/mvc | |
11 | - http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd | |
12 | - http://www.springframework.org/schema/cache | |
13 | - http://www.springframework.org/schema/cache/spring-cache-4.3.xsd"> | |
14 | - | |
15 | - <!-- 启用缓存注解功能,这个是必须的,否则注解不会生效,另外,该注解一定要声明在spring主配置文件中才会生效 --> | |
16 | - <cache:annotation-driven cache-manager="cacheManager" /> | |
5 | + xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx" | |
6 | + xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee" | |
7 | + xmlns:jms="http://www.springframework.org/schema/jms" xmlns:cache="http://www.springframework.org/schema/cache" | |
8 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | |
9 | + http://www.springframework.org/schema/beans/spring-beans.xsd | |
10 | + http://www.springframework.org/schema/aop | |
11 | + http://www.springframework.org/schema/aop/spring-aop-4.3.xsd | |
12 | + http://www.springframework.org/schema/context | |
13 | + http://www.springframework.org/schema/context/spring-context-4.3.xsd | |
14 | + http://www.springframework.org/schema/tx | |
15 | + http://www.springframework.org/schema/tx/spring-tx-4.3.xsd | |
16 | + http://www.springframework.org/schema/util | |
17 | + http://www.springframework.org/schema/util/spring-util-4.3.xsd | |
18 | + http://www.springframework.org/schema/jee | |
19 | + http://www.springframework.org/schema/jee/spring-jee-4.3.xsd | |
20 | + http://www.springframework.org/schema/jms | |
21 | + http://www.springframework.org/schema/jms/spring-jms-4.3.xsd | |
22 | + http://www.springframework.org/schema/cache | |
23 | + http://www.springframework.org/schema/cache/spring-cache-4.3.xsd"> | |
24 | + | |
25 | + <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> | |
26 | + <property name="maxTotal" value="${redis.pool.maxActive}" /> | |
27 | + <property name="maxIdle" value="${redis.pool.maxIdle}" /> | |
28 | + <property name="testOnBorrow" value="${redis.testOnBorrow}" /> | |
29 | + <property name="testOnReturn" value="${redis.testOnReturn}" /> | |
30 | + </bean> | |
31 | + | |
32 | + <bean id="jedisShardInfo" class="redis.clients.jedis.JedisShardInfo"> | |
33 | + <constructor-arg index="0" value="${redis.host}" /> | |
34 | + <constructor-arg index="1" value="${redis.port}" /> | |
35 | + </bean> | |
36 | + | |
37 | + <bean id="jedisUtils" class="com.b2c.orders.dao.utils.JedisUtils"> | |
38 | + <property name="poolConfig" ref="jedisPoolConfig" /> | |
39 | + <property name="shardInfo" ref="jedisShardInfo" /> | |
40 | + </bean> | |
41 | + | |
17 | 42 | </beans> |
18 | 43 | \ No newline at end of file |
... | ... |
b2c-orders-dao/src/main/resources/sqlmap/OrderLogMapper.xml
... | ... | @@ -4,6 +4,8 @@ |
4 | 4 | <resultMap id="OrderLogRM" type="OrderLog"> |
5 | 5 | <id property="id" column="id" /> |
6 | 6 | <result property="action" column="action" /> |
7 | + <result property="previousStatus" column="previous_status" /> | |
8 | + <result property="currentStatus" column="current_status" /> | |
7 | 9 | <result property="actionTime" column="action_time" /> |
8 | 10 | <result property="userId" column="user_id" /> |
9 | 11 | <result property="userType" column="user_type" /> |
... | ... | @@ -11,6 +13,18 @@ |
11 | 13 | <result property="description" column="description" /> |
12 | 14 | </resultMap> |
13 | 15 | |
16 | + <sql id="selectColumn"> | |
17 | + id | |
18 | + ,action | |
19 | + ,previous_status | |
20 | + ,current_status | |
21 | + ,action_time | |
22 | + ,user_id | |
23 | + ,user_type | |
24 | + ,order_id | |
25 | + ,description | |
26 | + </sql> | |
27 | + | |
14 | 28 | <sql id="selectCondition"> |
15 | 29 | <if test="param != null"> |
16 | 30 | <if test="param.id != null and param.id != ''"> |
... | ... | @@ -19,6 +33,12 @@ |
19 | 33 | <if test="param.action != null and param.action != ''"> |
20 | 34 | and action = #{param.action} |
21 | 35 | </if> |
36 | + <if test="param.previousStatus != null and param.previousStatus != ''"> | |
37 | + and action = #{param.previousStatus} | |
38 | + </if> | |
39 | + <if test="param.currentStatus != null and param.currentStatus != ''"> | |
40 | + and current_status = #{param.currentStatus} | |
41 | + </if> | |
22 | 42 | <if test="param.actionBeginTime != null and param.actionBeginTime != ''"> |
23 | 43 | <![CDATA[and action_time >= #{param.actionBeginTime}]]> |
24 | 44 | </if> |
... | ... | @@ -39,6 +59,8 @@ |
39 | 59 | INSERT INTO t_order_log( |
40 | 60 | id, |
41 | 61 | action, |
62 | + previous_status, | |
63 | + current_status, | |
42 | 64 | user_id, |
43 | 65 | user_type, |
44 | 66 | order_id, |
... | ... | @@ -46,6 +68,8 @@ |
46 | 68 | ) VALUES( |
47 | 69 | #{id}, |
48 | 70 | #{action}, |
71 | + #{previousStatus}, | |
72 | + #{currentStatus}, | |
49 | 73 | #{userId}, |
50 | 74 | #{userType}, |
51 | 75 | #{orderId}, |
... | ... | @@ -55,6 +79,14 @@ |
55 | 79 | </insert> |
56 | 80 | |
57 | 81 | |
82 | + <select id="findByOrderId" parameterType="Long" resultMap="OrderLogRM"> | |
83 | + SELECT | |
84 | + <include refid="selectColumn" /> | |
85 | + FROM t_order_log where 1=1 | |
86 | + AND order_id = #{orderId} | |
87 | + ORDER BY action_time DESC | |
88 | + </select> | |
89 | + | |
58 | 90 | <select id="countByCondition" parameterType="Query" resultType="Long"> |
59 | 91 | <![CDATA[ |
60 | 92 | SELECT count(1) FROM t_order_log where 1=1 |
... | ... | @@ -63,17 +95,9 @@ |
63 | 95 | </select> |
64 | 96 | |
65 | 97 | <select id="listByCondition" parameterType="Query" resultMap="OrderLogRM"> |
66 | - <![CDATA[ | |
67 | 98 | SELECT |
68 | - id | |
69 | - ,action | |
70 | - ,action_time | |
71 | - ,user_id | |
72 | - ,user_type | |
73 | - ,order_id | |
74 | - ,description | |
99 | + <include refid="selectColumn" /> | |
75 | 100 | FROM t_order_log where 1=1 |
76 | - ]]> | |
77 | 101 | <include refid="selectCondition" /> |
78 | 102 | order by id desc |
79 | 103 | <![CDATA[ |
... | ... |
b2c-orders-dao/src/main/resources/sqlmap/OrderMapper.xml
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | <result property="payTime" column="pay_time" /> |
13 | 13 | <result property="deliveryTime" column="delivery_time" /> |
14 | 14 | <result property="deliveryAddress" column="delivery_address" /> |
15 | + <result property="receiverName" column="receiver_name" /> | |
15 | 16 | <result property="receiverPhoneNumber" column="receiver_phone_number" /> |
16 | 17 | <result property="buyerConfirmTime" column="buyer_confirm_time" /> |
17 | 18 | <result property="sellerConfirmTime" column="seller_confirm_time" /> |
... | ... | @@ -20,6 +21,7 @@ |
20 | 21 | <result property="payType" column="pay_type" /> |
21 | 22 | <result property="totalPrice" column="total_price" /> |
22 | 23 | <result property="realTotalPrice" column="real_total_price" /> |
24 | + <result property="postage" column="postage" /> | |
23 | 25 | <result property="versionNum" column="version_num" /> |
24 | 26 | <result property="delete" column="delete_flag" /> |
25 | 27 | <result property="statusInReason" column="status_in_reason" /> |
... | ... | @@ -27,9 +29,13 @@ |
27 | 29 | <result property="buyerName" column="buyer_name" /> |
28 | 30 | <result property="buyerPhoneNumber" column="buyer_phone_number" /> |
29 | 31 | <result property="sellerId" column="seller_id" /> |
30 | - <result property="seller_name" column="seller_name" /> | |
32 | + <result property="sellerName" column="seller_name" /> | |
33 | + <result property="sellerPhoneNumber" column="seller_phone_number" /> | |
31 | 34 | <result property="shopId" column="shop_id" /> |
32 | 35 | <result property="shopName" column="shop_name" /> |
36 | + <result property="shopPhoneNumber" column="shop_phone_number" /> | |
37 | + <result property="shopAddress" column="shop_address" /> | |
38 | + <result property="tradeName" column="trade_name" /> | |
33 | 39 | <collection property="orderItems" column="id" |
34 | 40 | select="com.b2c.orders.dao.impl.OrderItemDaoBean.findByOrderId" /> |
35 | 41 | </resultMap> |
... | ... | @@ -40,6 +46,7 @@ |
40 | 46 | ,t1.buyer_name |
41 | 47 | ,t1.seller_id |
42 | 48 | ,t1.seller_name |
49 | + ,t1.seller_phone_number | |
43 | 50 | ,t1.shop_buyer_id |
44 | 51 | ,t1.market_id |
45 | 52 | ,t1.delivery_type |
... | ... | @@ -57,8 +64,14 @@ |
57 | 64 | ,t1.pay_type |
58 | 65 | ,t1.total_price |
59 | 66 | ,t1.real_total_price |
67 | + ,t1.postage | |
60 | 68 | ,t1.version_num |
61 | 69 | ,t1.status_in_reason |
70 | + ,t1.shop_id | |
71 | + ,t1.shop_name | |
72 | + ,t1.shop_phone_number | |
73 | + ,t1.shop_address | |
74 | + ,t1.trade_name | |
62 | 75 | </sql> |
63 | 76 | |
64 | 77 | <sql id="selectCondition"> |
... | ... | @@ -69,6 +82,9 @@ |
69 | 82 | <if test="param.buyerId != null and param.buyerId != ''"> |
70 | 83 | and t1.buyer_id = #{param.buyerId} |
71 | 84 | </if> |
85 | + <if test="param.shopBuyerId != null and param.shopBuyerId != ''"> | |
86 | + and t1.shop_buyer_id = #{param.shopBuyerId} | |
87 | + </if> | |
72 | 88 | <if test="param.buyerName != null and param.buyerName != ''"> |
73 | 89 | and t1.buyer_name = #{param.buyerName} |
74 | 90 | </if> |
... | ... | @@ -147,10 +163,15 @@ |
147 | 163 | and t1.total_price = #{param.totalPrice} |
148 | 164 | </if> |
149 | 165 | <if test="param.productName != null and param.productName != ''"> |
150 | - <![CDATA[and t2.product_name like CONCAT('%',#{param.productName},'%')]]> | |
166 | + <![CDATA[and t1.trade_name like CONCAT('%',#{param.productName},'%')]]> | |
167 | + </if> | |
168 | + <if test="param.buyerDelete != null and param.buyerDelete == false"> | |
169 | + and t1.buyer_delete = 0 | |
170 | + </if> | |
171 | + <if test="param.sellerDelete != null and param.sellerDelete == false"> | |
172 | + and t1.seller_delete = 0 | |
151 | 173 | </if> |
152 | 174 | </if> |
153 | - and delete_flag = 0 | |
154 | 175 | </sql> |
155 | 176 | |
156 | 177 | <sql id="joinOrderItem"> |
... | ... | @@ -175,8 +196,11 @@ |
175 | 196 | buyer_phone_number, |
176 | 197 | seller_id, |
177 | 198 | seller_name, |
199 | + seller_phone_number, | |
178 | 200 | shop_id, |
179 | 201 | shop_name, |
202 | + shop_address, | |
203 | + shop_phone_number, | |
180 | 204 | shop_buyer_id, |
181 | 205 | market_id, |
182 | 206 | delivery_type, |
... | ... | @@ -185,9 +209,11 @@ |
185 | 209 | buyer_memo, |
186 | 210 | delivery_time, |
187 | 211 | delivery_address, |
212 | + receiver_name, | |
188 | 213 | receiver_phone_number, |
189 | 214 | pay_type, |
190 | - total_price | |
215 | + total_price, | |
216 | + trade_name | |
191 | 217 | ) VALUES( |
192 | 218 | #{id}, |
193 | 219 | #{buyerId}, |
... | ... | @@ -195,8 +221,11 @@ |
195 | 221 | #{buyerPhoneNumber}, |
196 | 222 | #{sellerId}, |
197 | 223 | #{sellerName}, |
224 | + #{sellerPhoneNumber}, | |
198 | 225 | #{shopId}, |
199 | 226 | #{shopName}, |
227 | + #{shopAddress}, | |
228 | + #{shopPhoneNumber}, | |
200 | 229 | #{shopBuyerId}, |
201 | 230 | #{marketId}, |
202 | 231 | #{deliveryType}, |
... | ... | @@ -205,9 +234,11 @@ |
205 | 234 | #{buyerMemo}, |
206 | 235 | #{deliveryTime}, |
207 | 236 | #{deliveryAddress}, |
237 | + #{receiverName}, | |
208 | 238 | #{receiverPhoneNumber}, |
209 | 239 | #{payType}, |
210 | - #{totalPrice} | |
240 | + #{totalPrice}, | |
241 | + #{tradeName} | |
211 | 242 | ) |
212 | 243 | ]]> |
213 | 244 | </insert> |
... | ... | @@ -224,6 +255,7 @@ |
224 | 255 | buyer_confirm_time=#{buyerConfirmTime}, |
225 | 256 | seller_confirm_time=#{sellerConfirmTime}, |
226 | 257 | real_total_price=#{realTotalPrice}, |
258 | + postage=#{postage}, | |
227 | 259 | status_in_reason=#{statusInReason}, |
228 | 260 | version_num=version_num + 1 |
229 | 261 | where 1=1 |
... | ... | @@ -251,6 +283,16 @@ |
251 | 283 | ]]> |
252 | 284 | </select> |
253 | 285 | |
286 | + <update id="buyerRemove" parameterType="Long"> | |
287 | + UPDATE t_order SET | |
288 | + buyer_delete = 1 WHERE id = #{orderId} | |
289 | + </update> | |
290 | + | |
291 | + <update id="sellerRemove" parameterType="Long"> | |
292 | + UPDATE t_order SET | |
293 | + seller_delete = 1 WHERE id = #{orderId} | |
294 | + </update> | |
295 | + | |
254 | 296 | |
255 | 297 | <update id="deleteById" parameterType="Long"> |
256 | 298 | <![CDATA[ |
... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/Order.java
... | ... | @@ -13,11 +13,14 @@ import com.b2c.orders.enums.DeliveryType; |
13 | 13 | import com.b2c.orders.enums.OrderStatus; |
14 | 14 | import com.b2c.orders.enums.PayStatus; |
15 | 15 | import com.b2c.orders.enums.PayType; |
16 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
17 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
16 | 18 | |
17 | 19 | import lombok.Data; |
18 | 20 | import lombok.EqualsAndHashCode; |
19 | 21 | import lombok.NoArgsConstructor; |
20 | 22 | |
23 | +@JsonIgnoreProperties({ "handler" }) | |
21 | 24 | @Data |
22 | 25 | @NoArgsConstructor |
23 | 26 | @EqualsAndHashCode(callSuper = true) |
... | ... | @@ -35,6 +38,11 @@ public class Order extends BaseDomain { |
35 | 38 | private String buyerName; |
36 | 39 | private String buyerPhoneNumber; |
37 | 40 | /** |
41 | + * 收货人信息 | |
42 | + */ | |
43 | + private String receiverName; | |
44 | + private String receiverPhoneNumber; | |
45 | + /** | |
38 | 46 | * 资金账户id |
39 | 47 | */ |
40 | 48 | private Long shopBuyerId; |
... | ... | @@ -43,6 +51,7 @@ public class Order extends BaseDomain { |
43 | 51 | */ |
44 | 52 | private Long sellerId; |
45 | 53 | private String sellerName; |
54 | + private String sellerPhoneNumber; | |
46 | 55 | /** |
47 | 56 | * 市场id |
48 | 57 | */ |
... | ... | @@ -73,10 +82,6 @@ public class Order extends BaseDomain { |
73 | 82 | * 送货地址 |
74 | 83 | */ |
75 | 84 | private String deliveryAddress; |
76 | - /** | |
77 | - * 收货人电话 | |
78 | - */ | |
79 | - private String receiverPhoneNumber; | |
80 | 85 | /** 提货时间 */ |
81 | 86 | private Date reservationTime; |
82 | 87 | /** 买家确认收货时间 */ |
... | ... | @@ -95,6 +100,10 @@ public class Order extends BaseDomain { |
95 | 100 | * 实际价格,有商家接单后修改 |
96 | 101 | */ |
97 | 102 | private Long realTotalPrice; |
103 | + /** | |
104 | + * 运费 | |
105 | + */ | |
106 | + private Long postage; | |
98 | 107 | /** 乐观锁(版本号) */ |
99 | 108 | private Long versionNum; |
100 | 109 | /** 删除标志 */ |
... | ... | @@ -104,6 +113,8 @@ public class Order extends BaseDomain { |
104 | 113 | */ |
105 | 114 | private Long shopId; |
106 | 115 | private String shopName; |
116 | + private String shopPhoneNumber; | |
117 | + private String shopAddress; | |
107 | 118 | /** 进入当前状态说明或原因,如取消原因,退款审批通过原因等 */ |
108 | 119 | private String statusInReason; |
109 | 120 | /** |
... | ... | @@ -215,6 +226,7 @@ public class Order extends BaseDomain { |
215 | 226 | this.orderStatus = OrderStatus.PaymentTimeout; |
216 | 227 | } |
217 | 228 | |
229 | + @JsonIgnore | |
218 | 230 | public boolean isCanCancel() { |
219 | 231 | if (this.orderStatus.equals(OrderStatus.PendingTake)) { |
220 | 232 | return true; |
... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/OrderLog.java
... | ... | @@ -3,6 +3,7 @@ package com.b2c.orders.domain; |
3 | 3 | import java.sql.Timestamp; |
4 | 4 | |
5 | 5 | import com.b2c.orders.enums.Action; |
6 | +import com.b2c.orders.enums.OrderStatus; | |
6 | 7 | import com.b2c.orders.enums.UserType; |
7 | 8 | |
8 | 9 | import lombok.Data; |
... | ... | @@ -20,6 +21,8 @@ public class OrderLog extends BaseDomain { |
20 | 21 | private static final long serialVersionUID = 6172890206387936046L; |
21 | 22 | |
22 | 23 | private Action action; |
24 | + private OrderStatus previousStatus; | |
25 | + private OrderStatus currentStatus; | |
23 | 26 | private Timestamp actionTime; |
24 | 27 | private Long userId; |
25 | 28 | private UserType userType; |
... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/Seller.java
1 | 1 | package com.b2c.orders.domain; |
2 | 2 | |
3 | +import java.io.Serializable; | |
4 | + | |
3 | 5 | import lombok.Data; |
4 | 6 | |
5 | 7 | @Data |
6 | -public class Seller { | |
8 | +public class Seller implements Serializable { | |
9 | + | |
10 | + /** | |
11 | + * | |
12 | + */ | |
13 | + private static final long serialVersionUID = 7404217578749853392L; | |
7 | 14 | |
8 | 15 | private Long id; |
9 | 16 | private String name; |
17 | + private String phoneNumber; | |
10 | 18 | } |
... | ... |
b2c-orders-domain/src/main/java/com/b2c/orders/domain/Shop.java
b2c-orders-manager/src/main/java/com/b2c/orders/manager/OrderLogManager.java
0 → 100644
b2c-orders-manager/src/main/java/com/b2c/orders/manager/OrderManager.java
... | ... | @@ -6,9 +6,12 @@ import com.b2c.orders.commons.exceptions.OrderException; |
6 | 6 | import com.b2c.orders.commons.exceptions.OrderRepositoryException; |
7 | 7 | import com.b2c.orders.commons.exceptions.ProductException; |
8 | 8 | import com.b2c.orders.commons.exceptions.SellerException; |
9 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
10 | +import com.b2c.orders.commons.exceptions.ShopException; | |
9 | 11 | import com.b2c.orders.domain.Order; |
10 | 12 | import com.b2c.orders.domain.client.dto.request.SubmitOrderRequestDto; |
11 | 13 | import com.b2c.orders.enums.PayType; |
14 | +import com.b2c.orders.enums.UserType; | |
12 | 15 | import com.b2c.orders.rpc.exception.DtmsRPCException; |
13 | 16 | import com.diligrp.website.util.dao.BaseQuery; |
14 | 17 | import com.diligrp.website.util.web.PageTemplate; |
... | ... | @@ -24,9 +27,11 @@ public interface OrderManager { |
24 | 27 | * @throws ProductException |
25 | 28 | * @throws SellerException |
26 | 29 | * @throws BuyerException |
30 | + * @throws ShopBuyerException | |
31 | + * @throws ShopException | |
27 | 32 | */ |
28 | - void submit(SubmitOrderRequestDto orderVo) | |
29 | - throws DtmsRPCException, OrderException, ProductException, SellerException, BuyerException; | |
33 | + void submit(SubmitOrderRequestDto orderVo) throws DtmsRPCException, OrderException, ProductException, | |
34 | + SellerException, BuyerException, ShopException, ShopBuyerException; | |
30 | 35 | |
31 | 36 | /** |
32 | 37 | * 接单 |
... | ... | @@ -40,9 +45,12 @@ public interface OrderManager { |
40 | 45 | * @throws OrderException |
41 | 46 | * @throws OrderRepositoryException |
42 | 47 | * @throws DtmsRPCException |
48 | + * @throws SellerException | |
49 | + * @throws ShopBuyerException | |
50 | + * @throws ShopException | |
43 | 51 | */ |
44 | - void take(Long orderId, Long sellerId, Long totalPrice) | |
45 | - throws OrderException, OrderRepositoryException, DtmsRPCException; | |
52 | + void take(Long orderId, Long sellerId, Long totalPrice) throws OrderException, OrderRepositoryException, | |
53 | + DtmsRPCException, SellerException, ShopException, ShopBuyerException; | |
46 | 54 | |
47 | 55 | /** |
48 | 56 | * 支付 |
... | ... | @@ -149,5 +157,16 @@ public interface OrderManager { |
149 | 157 | */ |
150 | 158 | Order detail(Long orderId); |
151 | 159 | |
152 | - PageTemplate list(BaseQuery query); | |
160 | + /** | |
161 | + * 删除订单 | |
162 | + * | |
163 | + * @param userType | |
164 | + * 用户类型,买家或者卖家 | |
165 | + * @param orderId TODO | |
166 | + * @throws OrderRepositoryException | |
167 | + * @throws OrderException | |
168 | + */ | |
169 | + void remove(UserType userType, Long orderId) throws OrderRepositoryException, OrderException; | |
170 | + | |
171 | + PageTemplate list(BaseQuery query, UserType userType); | |
153 | 172 | } |
... | ... |
b2c-orders-manager/src/main/java/com/b2c/orders/manager/impl/OrderLogManagerBean.java
0 → 100644
1 | +package com.b2c.orders.manager.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Component; | |
7 | + | |
8 | +import com.b2c.orders.dao.OrderLogDao; | |
9 | +import com.b2c.orders.domain.OrderLog; | |
10 | +import com.b2c.orders.manager.OrderLogManager; | |
11 | + | |
12 | +@Component | |
13 | +public class OrderLogManagerBean implements OrderLogManager { | |
14 | + | |
15 | + @Autowired | |
16 | + private OrderLogDao orderLogDao; | |
17 | + | |
18 | + @Override | |
19 | + public List<OrderLog> findByOrderId(Long orderId) { | |
20 | + return this.orderLogDao.findByOrderId(orderId); | |
21 | + } | |
22 | + | |
23 | +} | |
... | ... |
b2c-orders-manager/src/main/java/com/b2c/orders/manager/impl/OrderManagerBean.java
... | ... | @@ -4,7 +4,9 @@ import java.text.DateFormat; |
4 | 4 | import java.text.ParseException; |
5 | 5 | import java.text.SimpleDateFormat; |
6 | 6 | import java.util.ArrayList; |
7 | +import java.util.LinkedHashSet; | |
7 | 8 | import java.util.List; |
9 | +import java.util.Set; | |
8 | 10 | |
9 | 11 | import org.apache.http.util.TextUtils; |
10 | 12 | import org.slf4j.Logger; |
... | ... | @@ -20,6 +22,8 @@ import com.b2c.orders.commons.exceptions.OrderException; |
20 | 22 | import com.b2c.orders.commons.exceptions.OrderRepositoryException; |
21 | 23 | import com.b2c.orders.commons.exceptions.ProductException; |
22 | 24 | import com.b2c.orders.commons.exceptions.SellerException; |
25 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
26 | +import com.b2c.orders.commons.exceptions.ShopException; | |
23 | 27 | import com.b2c.orders.commons.utils.OrderIdGenerator; |
24 | 28 | import com.b2c.orders.dao.BuyerDao; |
25 | 29 | import com.b2c.orders.dao.OrderDao; |
... | ... | @@ -78,8 +82,8 @@ public class OrderManagerBean implements OrderManager { |
78 | 82 | private BuyerManager buyerManager; |
79 | 83 | |
80 | 84 | @Override |
81 | - public void submit(SubmitOrderRequestDto orderVo) | |
82 | - throws DtmsRPCException, OrderException, ProductException, SellerException, BuyerException { | |
85 | + public void submit(SubmitOrderRequestDto orderVo) throws DtmsRPCException, OrderException, ProductException, | |
86 | + SellerException, BuyerException, ShopException, ShopBuyerException { | |
83 | 87 | Order po = new Order(); |
84 | 88 | try { |
85 | 89 | Long orderId = idGenerator.getOrdersNewSeqNo(); |
... | ... | @@ -92,14 +96,18 @@ public class OrderManagerBean implements OrderManager { |
92 | 96 | Seller seller = this.sellerDao.findByBuyerShopId(orderVo.getShopBuyerId()); |
93 | 97 | po.setSellerId(seller.getId()); |
94 | 98 | po.setSellerName(seller.getName()); |
99 | + po.setSellerPhoneNumber(seller.getPhoneNumber()); | |
95 | 100 | Shop shop = this.shopDao.findByBuyerShopId(orderVo.getShopBuyerId()); |
96 | 101 | po.setShopId(shop.getId()); |
97 | 102 | po.setShopName(shop.getName()); |
103 | + po.setShopAddress(shop.getShopAddress()); | |
104 | + po.setShopPhoneNumber(shop.getShopPhoneNumber()); | |
98 | 105 | po.setMarketId(orderVo.getMarketId()); |
99 | 106 | po.setBuyerMemo(orderVo.getBuyerMemo()); |
100 | 107 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
101 | 108 | po.setDeliveryType(DeliveryType.getDeliveryType(orderVo.getDeliveryType())); |
102 | 109 | po.setDeliveryAddress(orderVo.getDeliveryAddress()); |
110 | + po.setReceiverName(orderVo.getReceiverName()); | |
103 | 111 | po.setReceiverPhoneNumber(orderVo.getReceiverPhoneNumber()); |
104 | 112 | if (orderVo.getDeliveryType().equals(DeliveryType.Delivery.getIndex())) { |
105 | 113 | if (TextUtils.isEmpty(orderVo.getDeliveryTime())) { |
... | ... | @@ -118,6 +126,8 @@ public class OrderManagerBean implements OrderManager { |
118 | 126 | long totalPrice = 0; |
119 | 127 | List<OrderItem> orderItems = new ArrayList<>(orderVo.getOrderItems().size()); |
120 | 128 | int itemIdx = 1; |
129 | + Set<String> productNameSet = new LinkedHashSet<>(); | |
130 | + StringBuilder sb = new StringBuilder(); | |
121 | 131 | for (OrderItemDto orderItemDto : orderVo.getOrderItems()) { |
122 | 132 | Long orderItemId = idGenerator.getOrdersItemNewSeqNo(orderId, itemIdx++); |
123 | 133 | OrderItem orderItem = new OrderItem(); |
... | ... | @@ -126,6 +136,7 @@ public class OrderManagerBean implements OrderManager { |
126 | 136 | orderItem.setShopId(shop.getId()); |
127 | 137 | orderItem.setAmount(orderItemDto.getAmount()); |
128 | 138 | Product product = this.productDao.findBySku(orderItemDto.getSku()); |
139 | + productNameSet.add(product.getName()); | |
129 | 140 | orderItem.setProductId(product.getId()); |
130 | 141 | orderItem.setProductName(product.getName()); |
131 | 142 | orderItem.setSku(orderItemDto.getSku()); |
... | ... | @@ -137,6 +148,10 @@ public class OrderManagerBean implements OrderManager { |
137 | 148 | orderItems.add(orderItem); |
138 | 149 | totalPrice += product.getSkuPrice() * orderItemDto.getAmount(); |
139 | 150 | } |
151 | + for (String productName : productNameSet) { | |
152 | + sb.append(productName).append("+"); | |
153 | + } | |
154 | + po.setTradeName(sb.substring(0, sb.length() - 1)); | |
140 | 155 | po.setOrderItems(orderItems); |
141 | 156 | po.setTotalPrice(totalPrice); |
142 | 157 | } catch (ParseException e) { |
... | ... | @@ -147,6 +162,7 @@ public class OrderManagerBean implements OrderManager { |
147 | 162 | // 添加订单日志 |
148 | 163 | OrderLog log = new OrderLog(); |
149 | 164 | log.setAction(Action.BUYER_PLACE_ORDER); |
165 | + log.setCurrentStatus(po.getOrderStatus()); | |
150 | 166 | log.setOrderId(po.getId()); |
151 | 167 | log.setUserId(po.getBuyerId()); |
152 | 168 | log.setUserType(UserType.BUYER); |
... | ... | @@ -156,8 +172,8 @@ public class OrderManagerBean implements OrderManager { |
156 | 172 | } |
157 | 173 | |
158 | 174 | @Override |
159 | - public void take(Long orderId, Long sellerId, Long totalPrice) | |
160 | - throws OrderException, OrderRepositoryException, DtmsRPCException { | |
175 | + public void take(Long orderId, Long sellerId, Long totalPrice) throws OrderException, OrderRepositoryException, | |
176 | + DtmsRPCException, SellerException, ShopException, ShopBuyerException { | |
161 | 177 | Order po = this.orderDao.getById(orderId); |
162 | 178 | if (po == null) { |
163 | 179 | throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND, |
... | ... | @@ -169,10 +185,17 @@ public class OrderManagerBean implements OrderManager { |
169 | 185 | if (!po.getSellerId().equals(sellerId)) { |
170 | 186 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能接单"); |
171 | 187 | } |
188 | + OrderLog log = new OrderLog(); | |
189 | + log.setPreviousStatus(po.getOrderStatus()); | |
172 | 190 | po.take(totalPrice); |
191 | + log.setCurrentStatus(po.getOrderStatus()); | |
192 | + Shop shop = this.shopDao.findByBuyerShopId(po.getShopBuyerId()); | |
193 | + Long shippingPrice = shop.getFreeShippingPrice(); | |
194 | + if (shippingPrice != null && shippingPrice > 0 && shippingPrice < totalPrice) { | |
195 | + po.setPostage(shop.getPostage()); | |
196 | + } | |
173 | 197 | this.orderDao.update(po); |
174 | 198 | // 增加订单日志 |
175 | - OrderLog log = new OrderLog(); | |
176 | 199 | log.setAction(Action.SELLER_TAKEN); |
177 | 200 | log.setOrderId(orderId); |
178 | 201 | log.setUserId(sellerId); |
... | ... | @@ -197,9 +220,11 @@ public class OrderManagerBean implements OrderManager { |
197 | 220 | if (!po.getShopBuyerId().equals(shopBuyerId)) { |
198 | 221 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能支付"); |
199 | 222 | } |
223 | + OrderLog log = new OrderLog(); | |
224 | + log.setPreviousStatus(po.getOrderStatus()); | |
200 | 225 | po.pay(payType); |
226 | + log.setCurrentStatus(po.getOrderStatus()); | |
201 | 227 | this.orderDao.update(po); |
202 | - OrderLog log = new OrderLog(); | |
203 | 228 | log.setAction(Action.BUYER_PAY); |
204 | 229 | log.setOrderId(orderId); |
205 | 230 | log.setUserId(shopBuyerId); |
... | ... | @@ -229,9 +254,11 @@ public class OrderManagerBean implements OrderManager { |
229 | 254 | if (!po.getShopBuyerId().equals(shopBuyerId)) { |
230 | 255 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能确认收货"); |
231 | 256 | } |
257 | + OrderLog log = new OrderLog(); | |
258 | + log.setPreviousStatus(po.getOrderStatus()); | |
232 | 259 | po.confirm(); |
260 | + log.setCurrentStatus(po.getOrderStatus()); | |
233 | 261 | this.orderDao.update(po); |
234 | - OrderLog log = new OrderLog(); | |
235 | 262 | log.setAction(Action.BUYER_CONFIRM); |
236 | 263 | log.setOrderId(orderId); |
237 | 264 | log.setUserId(shopBuyerId); |
... | ... | @@ -258,9 +285,11 @@ public class OrderManagerBean implements OrderManager { |
258 | 285 | if (!po.getSellerId().equals(sellerId)) { |
259 | 286 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能收款"); |
260 | 287 | } |
288 | + OrderLog log = new OrderLog(); | |
289 | + log.setPreviousStatus(po.getOrderStatus()); | |
261 | 290 | po.confirm(); |
291 | + log.setPreviousStatus(po.getOrderStatus()); | |
262 | 292 | this.orderDao.update(po); |
263 | - OrderLog log = new OrderLog(); | |
264 | 293 | log.setAction(Action.SELLER_CONFIRM); |
265 | 294 | log.setOrderId(orderId); |
266 | 295 | log.setUserId(po.getSellerId()); |
... | ... | @@ -288,9 +317,11 @@ public class OrderManagerBean implements OrderManager { |
288 | 317 | if (!po.getSellerId().equals(sellerId)) { |
289 | 318 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能接单"); |
290 | 319 | } |
320 | + OrderLog log = new OrderLog(); | |
321 | + log.setPreviousStatus(po.getOrderStatus()); | |
291 | 322 | po.refuse(refuseReason); |
323 | + log.setPreviousStatus(po.getOrderStatus()); | |
292 | 324 | this.orderDao.update(po); |
293 | - OrderLog log = new OrderLog(); | |
294 | 325 | log.setAction(Action.SELLER_REFUSE); |
295 | 326 | log.setOrderId(orderId); |
296 | 327 | log.setUserId(sellerId); |
... | ... | @@ -311,9 +342,11 @@ public class OrderManagerBean implements OrderManager { |
311 | 342 | if (!po.getShopBuyerId().equals(shopBuyerId)) { |
312 | 343 | throw new OrderException(ApplicationException.DATA_EXCEPTION, "订单的卖家信息不符,不能取消啊"); |
313 | 344 | } |
345 | + OrderLog log = new OrderLog(); | |
346 | + log.setPreviousStatus(po.getOrderStatus()); | |
314 | 347 | po.cancel(); |
348 | + log.setPreviousStatus(po.getOrderStatus()); | |
315 | 349 | this.orderDao.update(po); |
316 | - OrderLog log = new OrderLog(); | |
317 | 350 | log.setAction(Action.BUYER_CANCEL); |
318 | 351 | log.setOrderId(orderId); |
319 | 352 | log.setUserId(shopBuyerId); |
... | ... | @@ -338,8 +371,10 @@ public class OrderManagerBean implements OrderManager { |
338 | 371 | } catch (OrderException e) { |
339 | 372 | throw e; |
340 | 373 | } |
341 | - this.orderDao.update(po); | |
342 | 374 | OrderLog log = new OrderLog(); |
375 | + log.setPreviousStatus(po.getOrderStatus()); | |
376 | + this.orderDao.update(po); | |
377 | + log.setPreviousStatus(po.getOrderStatus()); | |
343 | 378 | log.setAction(Action.TAKEN_TIMEOUT); |
344 | 379 | log.setDescription("商家接单超时"); |
345 | 380 | log.setOrderId(orderId); |
... | ... | @@ -359,8 +394,10 @@ public class OrderManagerBean implements OrderManager { |
359 | 394 | } catch (OrderException e) { |
360 | 395 | throw e; |
361 | 396 | } |
362 | - this.orderDao.update(po); | |
363 | 397 | OrderLog log = new OrderLog(); |
398 | + log.setPreviousStatus(po.getOrderStatus()); | |
399 | + this.orderDao.update(po); | |
400 | + log.setPreviousStatus(po.getOrderStatus()); | |
364 | 401 | log.setAction(Action.PAYMENT_TIMEOUT); |
365 | 402 | log.setDescription("买家付款超时"); |
366 | 403 | log.setOrderId(orderId); |
... | ... | @@ -380,8 +417,10 @@ public class OrderManagerBean implements OrderManager { |
380 | 417 | } catch (OrderException e) { |
381 | 418 | throw e; |
382 | 419 | } |
383 | - this.orderDao.update(po); | |
384 | 420 | OrderLog log = new OrderLog(); |
421 | + log.setPreviousStatus(po.getOrderStatus()); | |
422 | + this.orderDao.update(po); | |
423 | + log.setPreviousStatus(po.getOrderStatus()); | |
385 | 424 | log.setAction(Action.SYSTEM_CONFIRM); |
386 | 425 | log.setDescription("买家确认收货超时或商家确认收款超时,系统自动确认收货、收款"); |
387 | 426 | log.setOrderId(orderId); |
... | ... | @@ -398,12 +437,38 @@ public class OrderManagerBean implements OrderManager { |
398 | 437 | return this.orderDao.getById(orderId); |
399 | 438 | } |
400 | 439 | |
440 | + @Override | |
441 | + public void remove(UserType userType, Long orderId) throws OrderRepositoryException, OrderException { | |
442 | + Order po = this.orderDao.getById(orderId); | |
443 | + if (po == null) { | |
444 | + throw new OrderRepositoryException(ApplicationException.DATA_EXCEPTION, "订单不存在"); | |
445 | + } | |
446 | + if (OrderStatus.isRuningStatus(po.getOrderStatus())) { | |
447 | + throw new OrderException(ApplicationException.DATA_EXCEPTION, "当前订单状态不能删除"); | |
448 | + } | |
449 | + if (UserType.BUYER.equals(userType)) { | |
450 | + this.orderDao.buyerRemove(orderId); | |
451 | + } else if (UserType.SELLER.equals(userType)) { | |
452 | + this.orderDao.sellerRemove(orderId); | |
453 | + } else { | |
454 | + throw new IllegalArgumentException("未知的用户类型"); | |
455 | + } | |
456 | + } | |
457 | + | |
401 | 458 | @Transactional(propagation = Propagation.SUPPORTS) |
402 | 459 | @Override |
403 | - public PageTemplate list(BaseQuery query) { | |
460 | + public PageTemplate list(BaseQuery query, UserType userType) { | |
461 | + if (UserType.BUYER.equals(userType)) { | |
462 | + query.addParam("buyerDelete", Boolean.valueOf(false).toString()); | |
463 | + } else if (UserType.SELLER.equals(userType)) { | |
464 | + query.addParam("sellerDelete", Boolean.valueOf(false).toString()); | |
465 | + } else if (UserType.SYSTEM.equals(userType)) { | |
466 | + | |
467 | + } else { | |
468 | + throw new IllegalArgumentException("未知的用户类型"); | |
469 | + } | |
404 | 470 | List<Order> list = this.orderDao.listByCondition(query); |
405 | 471 | Integer count = this.orderDao.countByCondition(query); |
406 | 472 | return PageTemplate.create(query, count, list); |
407 | 473 | } |
408 | - | |
409 | 474 | } |
... | ... |
b2c-orders-rpc/src/main/java/com/b2c/orders/domain/rpc/Product.java
b2c-orders-rpc/src/main/resources/spring-rpc.xml
... | ... | @@ -20,9 +20,9 @@ |
20 | 20 | </bean> |
21 | 21 | |
22 | 22 | <bean id="titanClient" class="com.diligrp.titan.sdk.TitanClient"> |
23 | - <constructor-arg index="0" value="" type="java.lang.String" /> | |
24 | - <constructor-arg index="1" value="" type="java.lang.String" /> | |
25 | - <constructor-arg index="2" value="titan.zandeapp.com" | |
23 | + <constructor-arg index="0" value="111" type="java.lang.String" /> | |
24 | + <constructor-arg index="1" value="111" type="java.lang.String" /> | |
25 | + <constructor-arg index="2" value="http://api.titan.zandeapp.com" | |
26 | 26 | type="java.lang.String" /> |
27 | 27 | </bean> |
28 | 28 | |
... | ... |
b2c-orders-service/src/main/java/com/b2c/orders/service/OrderLogService.java
0 → 100644
b2c-orders-service/src/main/java/com/b2c/orders/service/OrderService.java
... | ... | @@ -6,9 +6,12 @@ import com.b2c.orders.commons.exceptions.OrderException; |
6 | 6 | import com.b2c.orders.commons.exceptions.OrderRepositoryException; |
7 | 7 | import com.b2c.orders.commons.exceptions.ProductException; |
8 | 8 | import com.b2c.orders.commons.exceptions.SellerException; |
9 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
10 | +import com.b2c.orders.commons.exceptions.ShopException; | |
9 | 11 | import com.b2c.orders.domain.Order; |
10 | 12 | import com.b2c.orders.domain.client.dto.request.SubmitOrderRequestDto; |
11 | 13 | import com.b2c.orders.enums.PayType; |
14 | +import com.b2c.orders.enums.UserType; | |
12 | 15 | import com.b2c.orders.rpc.exception.DtmsRPCException; |
13 | 16 | import com.diligrp.website.util.dao.BaseQuery; |
14 | 17 | import com.diligrp.website.util.web.PageTemplate; |
... | ... | @@ -25,9 +28,11 @@ public interface OrderService { |
25 | 28 | * @throws ProductException |
26 | 29 | * @throws BuyerException |
27 | 30 | * @throws SellerException |
31 | + * @throws ShopBuyerException | |
32 | + * @throws ShopException | |
28 | 33 | */ |
29 | 34 | void submit(SubmitOrderRequestDto order) |
30 | - throws DtmsRPCException, OrderException, ProductException, SellerException, BuyerException; | |
35 | + throws DtmsRPCException, OrderException, ProductException, SellerException, BuyerException, ShopException, ShopBuyerException; | |
31 | 36 | |
32 | 37 | /** |
33 | 38 | * 商家接单 |
... | ... | @@ -41,9 +46,12 @@ public interface OrderService { |
41 | 46 | * @throws OrderRepositoryException |
42 | 47 | * @throws OrderException |
43 | 48 | * @throws DtmsRPCException |
49 | + * @throws SellerException | |
50 | + * @throws ShopBuyerException | |
51 | + * @throws ShopException | |
44 | 52 | */ |
45 | 53 | void take(Long orderId, Long sellerId, Long totalPrice) |
46 | - throws OrderException, OrderRepositoryException, DtmsRPCException; | |
54 | + throws OrderException, OrderRepositoryException, DtmsRPCException, SellerException, ShopException, ShopBuyerException; | |
47 | 55 | |
48 | 56 | /** |
49 | 57 | * 买家支付 |
... | ... | @@ -153,8 +161,9 @@ public interface OrderService { |
153 | 161 | * |
154 | 162 | * @param query |
155 | 163 | * 查询条件 |
164 | + * @param userType TODO | |
156 | 165 | * @return 含分页信息的结果集 |
157 | 166 | */ |
158 | - PageTemplate list(BaseQuery query); | |
167 | + PageTemplate list(BaseQuery query, UserType userType); | |
159 | 168 | |
160 | 169 | } |
... | ... |
b2c-orders-service/src/main/java/com/b2c/orders/service/impl/OrderLogServiceBean.java
0 → 100644
1 | +package com.b2c.orders.service.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +import com.b2c.orders.domain.OrderLog; | |
9 | +import com.b2c.orders.manager.OrderLogManager; | |
10 | +import com.b2c.orders.service.OrderLogService; | |
11 | + | |
12 | +@Service | |
13 | +public class OrderLogServiceBean implements OrderLogService { | |
14 | + | |
15 | + @Autowired | |
16 | + private OrderLogManager logManager; | |
17 | + | |
18 | + @Override | |
19 | + public List<OrderLog> findByOrderId(Long orderId) { | |
20 | + return this.logManager.findByOrderId(orderId); | |
21 | + } | |
22 | + | |
23 | +} | |
... | ... |
b2c-orders-service/src/main/java/com/b2c/orders/service/impl/OrderServiceBean.java
... | ... | @@ -13,9 +13,12 @@ import com.b2c.orders.commons.exceptions.OrderException; |
13 | 13 | import com.b2c.orders.commons.exceptions.OrderRepositoryException; |
14 | 14 | import com.b2c.orders.commons.exceptions.ProductException; |
15 | 15 | import com.b2c.orders.commons.exceptions.SellerException; |
16 | +import com.b2c.orders.commons.exceptions.ShopBuyerException; | |
17 | +import com.b2c.orders.commons.exceptions.ShopException; | |
16 | 18 | import com.b2c.orders.domain.Order; |
17 | 19 | import com.b2c.orders.domain.client.dto.request.SubmitOrderRequestDto; |
18 | 20 | import com.b2c.orders.enums.PayType; |
21 | +import com.b2c.orders.enums.UserType; | |
19 | 22 | import com.b2c.orders.manager.OrderManager; |
20 | 23 | import com.b2c.orders.rpc.exception.DtmsRPCException; |
21 | 24 | import com.b2c.orders.service.OrderService; |
... | ... | @@ -32,14 +35,14 @@ public class OrderServiceBean implements OrderService { |
32 | 35 | private OrderManager orderManager; |
33 | 36 | |
34 | 37 | @Override |
35 | - public void submit(SubmitOrderRequestDto order) | |
36 | - throws DtmsRPCException, OrderException, ProductException, SellerException, BuyerException { | |
38 | + public void submit(SubmitOrderRequestDto order) throws DtmsRPCException, OrderException, ProductException, | |
39 | + SellerException, BuyerException, ShopException, ShopBuyerException { | |
37 | 40 | this.orderManager.submit(order); |
38 | 41 | } |
39 | 42 | |
40 | 43 | @Override |
41 | - public void take(Long orderId, Long sellerId, Long totalPrice) | |
42 | - throws OrderException, OrderRepositoryException, DtmsRPCException { | |
44 | + public void take(Long orderId, Long sellerId, Long totalPrice) throws OrderException, OrderRepositoryException, | |
45 | + DtmsRPCException, SellerException, ShopException, ShopBuyerException { | |
43 | 46 | this.orderManager.take(orderId, sellerId, totalPrice); |
44 | 47 | } |
45 | 48 | |
... | ... | @@ -101,8 +104,8 @@ public class OrderServiceBean implements OrderService { |
101 | 104 | |
102 | 105 | @Transactional(propagation = Propagation.SUPPORTS) |
103 | 106 | @Override |
104 | - public PageTemplate list(BaseQuery query) { | |
105 | - return this.orderManager.list(query); | |
107 | + public PageTemplate list(BaseQuery query, UserType userType) { | |
108 | + return this.orderManager.list(query, userType); | |
106 | 109 | } |
107 | 110 | |
108 | 111 | } |
... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/controller/OrderController.java
1 | 1 | package com.b2c.orders.web.controller; |
2 | 2 | |
3 | 3 | import java.util.HashMap; |
4 | +import java.util.List; | |
4 | 5 | import java.util.Map; |
5 | 6 | |
6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
7 | 8 | import org.springframework.stereotype.Controller; |
8 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
11 | +import org.springframework.web.bind.annotation.RequestParam; | |
10 | 12 | import org.springframework.web.servlet.ModelAndView; |
11 | 13 | |
14 | +import com.b2c.orders.domain.Order; | |
15 | +import com.b2c.orders.domain.OrderLog; | |
16 | +import com.b2c.orders.enums.UserType; | |
17 | +import com.b2c.orders.service.OrderLogService; | |
12 | 18 | import com.b2c.orders.service.OrderService; |
13 | 19 | import com.b2c.orders.web.common.VelocitySupport; |
14 | 20 | import com.diligrp.website.util.dao.BaseQuery; |
... | ... | @@ -20,6 +26,8 @@ public class OrderController extends VelocitySupport { |
20 | 26 | |
21 | 27 | @Autowired |
22 | 28 | private OrderService orderService; |
29 | + @Autowired | |
30 | + private OrderLogService orderLogService; | |
23 | 31 | |
24 | 32 | @Override |
25 | 33 | protected Map<String, Object> getDefaultContext() { |
... | ... | @@ -28,8 +36,20 @@ public class OrderController extends VelocitySupport { |
28 | 36 | |
29 | 37 | @RequestMapping(value = "/list", method = RequestMethod.GET) |
30 | 38 | public ModelAndView list(BaseQuery query) { |
31 | - PageTemplate pt = this.orderService.list(query); | |
39 | + PageTemplate pt = this.orderService.list(query, UserType.SYSTEM); | |
32 | 40 | return this.toVM("list", pt); |
33 | 41 | } |
34 | 42 | |
43 | + @RequestMapping(value = "/detail", method = RequestMethod.GET) | |
44 | + public ModelAndView detail(@RequestParam Long id, @RequestParam(defaultValue = "tabbasic") String tabType) { | |
45 | + ModelAndView mav = this.toVM("detail").addObject("tabType", tabType); | |
46 | + if (tabType.equals("tabbasic")) { | |
47 | + Order order = this.orderService.detail(id); | |
48 | + return mav.addObject("model", order); | |
49 | + } else { | |
50 | + List<OrderLog> logs = this.orderLogService.findByOrderId(id); | |
51 | + return mav.addObject("logs", logs); | |
52 | + } | |
53 | + } | |
54 | + | |
35 | 55 | } |
... | ... |
b2c-orders-web/src/main/java/com/b2c/orders/web/restful/OrderRestController.java
... | ... | @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 | import org.springframework.cglib.beans.BeanCopier; |
12 | 12 | import org.springframework.http.MediaType; |
13 | 13 | import org.springframework.util.CollectionUtils; |
14 | +import org.springframework.util.StringUtils; | |
14 | 15 | import org.springframework.validation.BindingResult; |
15 | 16 | import org.springframework.web.bind.annotation.RequestBody; |
16 | 17 | import org.springframework.web.bind.annotation.RequestMapping; |
... | ... | @@ -41,6 +42,7 @@ import com.b2c.orders.domain.client.dto.response.OrderDetailResponseDto; |
41 | 42 | import com.b2c.orders.domain.client.dto.response.OrderItemResponseDto; |
42 | 43 | import com.b2c.orders.domain.client.dto.response.OrderListResponseDto; |
43 | 44 | import com.b2c.orders.enums.PayType; |
45 | +import com.b2c.orders.enums.UserType; | |
44 | 46 | import com.b2c.orders.service.OrderService; |
45 | 47 | import com.diligrp.website.util.dao.BaseQuery; |
46 | 48 | import com.diligrp.website.util.web.PageTemplate; |
... | ... | @@ -224,7 +226,7 @@ public class OrderRestController { |
224 | 226 | @RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) |
225 | 227 | public ApiPageDataResponse<OrderListResponseDto> list(OrderListRequestDto request) { |
226 | 228 | BaseQuery query = this.buildQuery(request); |
227 | - PageTemplate page = this.orderService.list(query); | |
229 | + PageTemplate page = this.orderService.list(query, UserType.get(request.getUserType())); | |
228 | 230 | ApiPageDataResponse<OrderListResponseDto> pageResponse = new ApiPageDataResponse<>(); |
229 | 231 | pageResponse.setCurrentPage(page.getCurrPage()); |
230 | 232 | pageResponse.setPageSize(page.getPageSize()); |
... | ... | @@ -257,8 +259,8 @@ public class OrderRestController { |
257 | 259 | Query query = new Query(); |
258 | 260 | query.setCurrPage(request.getPage()); |
259 | 261 | query.setPageSize(request.getPageSize()); |
260 | - if (request.getBuyerId() != null) { | |
261 | - query.addParam("buyerId", request.getBuyerId().toString()); | |
262 | + if (request.getShopBuyerId() != null) { | |
263 | + query.addParam("shopBuyerId", request.getShopBuyerId().toString()); | |
262 | 264 | } |
263 | 265 | if (request.getSellerId() != null) { |
264 | 266 | query.addParam("sellerId", request.getSellerId().toString()); |
... | ... | @@ -266,6 +268,14 @@ public class OrderRestController { |
266 | 268 | if (request.getOrderStatus() != null) { |
267 | 269 | query.addParam("orderStatus", request.getOrderStatus().toString()); |
268 | 270 | } |
271 | + if (!StringUtils.isEmpty(request.getQueryString())) { | |
272 | + try { | |
273 | + Long orderId = Long.valueOf(request.getQueryString()); | |
274 | + query.addParam("id", orderId.toString()); | |
275 | + } catch (NumberFormatException e) { | |
276 | + query.addParam("productName", request.getQueryString()); | |
277 | + } | |
278 | + } | |
269 | 279 | return query; |
270 | 280 | } |
271 | 281 | |
... | ... |
b2c-orders-web/src/main/resources/spring-mvc.xml
... | ... | @@ -64,6 +64,7 @@ |
64 | 64 | <util:map id="viewTools"> |
65 | 65 | <entry key="webUtils" value-ref="webUtils" /> |
66 | 66 | <entry key="domain" value="${orders.contextPath}" /> |
67 | + <entry key="currencyTool" value-ref="currencyTool" /> | |
67 | 68 | <entry key="dateTool"> |
68 | 69 | <bean class="org.apache.velocity.tools.generic.DateTool" /> |
69 | 70 | </entry> |
... | ... |
b2c-orders-web/src/main/resources/spring.xml
... | ... | @@ -56,7 +56,5 @@ |
56 | 56 | <import resource="classpath*:spring-mvc.xml" /> |
57 | 57 | <import resource="classpath*:spring-dao.xml" /> |
58 | 58 | <import resource="classpath*:spring-rpc.xml" /> |
59 | - <!-- <import resource="classpath*:spring-redis.xml"/> --> | |
60 | - <!-- <import resource="classpath*:spring-website-redis.xml"/> --> | |
61 | - <!-- <import resource="classpath*:spring-config-dtms-forOrdersWeb.xml"/> --> | |
59 | + <import resource="classpath*:spring-redis.xml" /> | |
62 | 60 | </beans> |
63 | 61 | \ No newline at end of file |
... | ... |
b2c-orders-web/src/main/webapp/WEB-INF/vm/detail.vm
0 → 100644
1 | +<style> | |
2 | +.img { | |
3 | + position:absolute; | |
4 | + left:0px; | |
5 | + top:0px; | |
6 | + width:92px; | |
7 | + height:30px; | |
8 | +} | |
9 | +</style> | |
10 | +##<script src="$!{webUtils.getAssetsPath('/order/orderSelfDetailMain.js')}"></script> | |
11 | +<div class="page-content"> | |
12 | + <div id="navBar" class="page-header"> | |
13 | + 当前位置:<a href="$!{domain}/orderThird">买卖对接订单</a>>订单详情 | |
14 | + <div style="float:right"> | |
15 | + <a onclick="XUI.history.goBack('$!{backUrl}')">返回</a> | |
16 | + </div> | |
17 | + </div> | |
18 | + <span style="font-size:16px;font-weight:bold;">订单编号:</span> | |
19 | + <span style="font-size:16px;font-weight:bold;" class="red">$!{model.id}</span> | |
20 | + <ul id="tab" class="nav nav-tabs"> | |
21 | + <li #if($!{tabType}=="tabbasic")class="active"#end> | |
22 | + <a href="$!{domain}/order/detail?id=$!{model.id}&tabType=tabbasic">基本信息</a> | |
23 | + </li> | |
24 | + <li #if($!{tabType}=="tablog")class="active"#end> | |
25 | + <a href="$!{domain}/order/detail?id=$!{model.id}&tabType=tablog">订单日志</a> | |
26 | + </li> | |
27 | + </ul> | |
28 | + <div class="tab-content"> | |
29 | + <div #if($!{tabType}=="tabbasic") class="tab-pane active" #else class="tab-pane" #end> | |
30 | + #if($!{tabType}=="tabbasic") | |
31 | + #parse("tabbasic.vm") | |
32 | + #end | |
33 | + </div> | |
34 | + <div #if($!{tabType}=="tablog") class="tab-pane active" #else class="tab-pane" #end> | |
35 | + #if($!{tabType}=="tablog") | |
36 | + #parse("tablog.vm") | |
37 | + #end | |
38 | + </div> | |
39 | + </div> | |
40 | + <br/> | |
41 | + <div class="row"> | |
42 | + <div class="col-md-12 align-right"> | |
43 | + <button type="button" class="btn btn-default" onclick="XUI.history.goBack('$!{backUrl}')">返回</button> | |
44 | + </div> | |
45 | + </div> | |
46 | +</div> | |
0 | 47 | \ No newline at end of file |
... | ... |
b2c-orders-web/src/main/webapp/WEB-INF/vm/tabbasic.vm
0 → 100644
1 | +<div class="border-header"> | |
2 | + <div class="row mb5"> | |
3 | + <div class="col-md-12"> | |
4 | + <strong>基本信息</strong> | |
5 | + </div> | |
6 | + </div> | |
7 | + <div class="row"> | |
8 | + <div class="col-md-6"> | |
9 | + <span class="st2">订单状态 :<span>$!{model.orderStatus.name}</span> | |
10 | + </div> | |
11 | + <div class="col-md-6"> | |
12 | + <span class="st2">下单时间 :$dateTool.format('yyyy-MM-dd HH:mm:ss',${model.submitTime})</span> | |
13 | + </span> | |
14 | + </div> | |
15 | + </div> | |
16 | + <div class="row"> | |
17 | + <div class="col-md-6"> | |
18 | + <span class="st2">支付方式 :$!{model.payType.name}</span> | |
19 | + </div> | |
20 | + <div class="col-md-6"> | |
21 | + <span class="st2">支付时间 : | |
22 | + #if(${model.payTime})$dateTool.format('yyyy-MM-dd HH:mm:ss',$!{model.payTime})#end | |
23 | + </span> | |
24 | + </div> | |
25 | + </div> | |
26 | + <div class="row"> | |
27 | + <div class="col-md-6"> | |
28 | + <span class="st2">配送方式 :$!{model.deliveryType.name}</span> | |
29 | + </div> | |
30 | + <div class="col-md-6"> | |
31 | + <span class="st2">自提/送货时间 : | |
32 | + #if($!{model.deliveryType.index} == 10) | |
33 | + #if(${model.reservationTime})$dateTool.format('yyyy-MM-dd HH:mm:ss',$!{model.reservationTime})#end | |
34 | + #elseif($!{model.deliveryType.index} == 20) | |
35 | + #if(${model.deliveryTime})$dateTool.format('yyyy-MM-dd HH:mm:ss',$!{model.deliveryTime})#end | |
36 | + #end | |
37 | + </span> | |
38 | + </div> | |
39 | + </div> | |
40 | + <div class="row"> | |
41 | + <div class="col-md-12"> | |
42 | + <span class="st2">订单金额 :$!{model.deliveryType.name}</span> | |
43 | + </div> | |
44 | + </div> | |
45 | + <div class="row"> | |
46 | + <div class="col-md-12"> | |
47 | + <span class="st2">买家留言:#if("$!{model.buyerMemo}" != "") $!{model.buyerMemo} #else 无 #end </span> | |
48 | + </div> | |
49 | + </div> | |
50 | +</div> | |
51 | +<br/> | |
52 | +<table style="width:100%;"> | |
53 | + <td style="width:49%"> | |
54 | + <div class="border-header"> | |
55 | + <div class="row mb5"> | |
56 | + <div class="col-md-12"> | |
57 | + <strong>卖家信息 </strong> | |
58 | + </div> | |
59 | + </div> | |
60 | + <table> | |
61 | + <tr> | |
62 | + <td><span class="st2">账号:$!{model.sellerName}</span></td> | |
63 | + </tr> | |
64 | + <tr><td><span class="st2">店铺名称:$!{model.shopName}</span></td></tr> | |
65 | + <tr><td><span class="st2">联系电话:$!{model.shopPhoneNumber}</span></td></tr> | |
66 | + <tr><td><span class="st2">店铺地址:$!{model.shopAddress}</span></td></tr> | |
67 | + </table> | |
68 | + </div> | |
69 | + </td> | |
70 | + <td style="width:1%;"></td> | |
71 | + <td> | |
72 | + <div class="border-header"> | |
73 | + <div class="row mb5"> | |
74 | + <div class="col-md-12"> | |
75 | + <strong>买家信息</strong> | |
76 | + </div> | |
77 | + </div> | |
78 | + <table> | |
79 | + <tr> | |
80 | + <td><span class="st2">买家账号:$!{model.buyerName}</span></td> | |
81 | + </tr> | |
82 | + <tr><td><span class="st2">收货人:$!{model.receiverName}</span></td></tr> | |
83 | + <tr><td><span class="st2">联系电话:$!{model.receiverPhoneNumber}</span></td></tr> | |
84 | + <tr><td><span class="st2">联系电话:$!{model.deliveryAddress}</span></td></tr> | |
85 | + <tr><td> </td></tr> | |
86 | + </table> | |
87 | + </div> | |
88 | + </td> | |
89 | +</table> | |
90 | +</br> | |
91 | +<div class="border-header"> | |
92 | + <div class="row mb5"> | |
93 | + <div class="col-md-12"> | |
94 | + <strong>商品信息</strong> | |
95 | + </div> | |
96 | + </div> | |
97 | + <div class="row"> | |
98 | + <div class="col-md-12"> | |
99 | + <table id="sample-table-1" class="table table-striped table-bordered table-hover"> | |
100 | + <thead> | |
101 | + <tr> | |
102 | + <th class="center">商品名称</th> | |
103 | + <th class="center">价格</th> | |
104 | + <th class="center">数量</th> | |
105 | + <th class="center">预估金额</th> | |
106 | + <th class="center">实际金额</th> | |
107 | + <th class="center">运费</th> | |
108 | + <th class="center">总计</th> | |
109 | + </tr> | |
110 | + </thead> | |
111 | + <tbody> | |
112 | + #foreach(${item} in ${model.orderItems}) | |
113 | + <tr> | |
114 | + <td class="textC">$!{item.skuTitle}</td> | |
115 | + <td class="textC">$currencyTool.cent2TenNoSymbol($!{item.skuPrice})元/$!{item.priceUnit}</td> | |
116 | + <td class="textC">$!{item.amount}</td> | |
117 | + #if($!{velocityCount} == 1) | |
118 | + <td class="textC" rowspan="$!{model.orderItems.size()}"> | |
119 | + <span style="color:red"> | |
120 | + #if($!{model.totalPrice}!=0) | |
121 | + $currencyTool.cent2TenNoSymbol($!{model.totalPrice})元 | |
122 | + #end | |
123 | + </span> | |
124 | + </td> | |
125 | + <td class="textC" rowspan="$!{model.orderItems.size()}"> | |
126 | + <span style="color:red"> | |
127 | + #if($!{model.realTotalPrice}!=0) | |
128 | + $currencyTool.cent2TenNoSymbol($!{model.realTotalPrice})元 | |
129 | + #end | |
130 | + </span> | |
131 | + </td> | |
132 | + <td class="textC" rowspan="$!{model.orderItems.size()}"> | |
133 | + <span style="color:red"> | |
134 | + #if($!{model.postage}!=0) | |
135 | + $currencyTool.cent2TenNoSymbol($!{model.postage})元 | |
136 | + #end | |
137 | + </span> | |
138 | + </td> | |
139 | + <td class="textC" rowspan="$!{model.orderItems.size()}"> | |
140 | + #set($allPriceTotal=$!{model.postage}+$!{model.realTotalPrice}) | |
141 | + <span style="font-size:17px;color:red">$currencyTool.cent2TenNoSymbol(${allPriceTotal})元</span> | |
142 | + </td> | |
143 | + #end | |
144 | + </tr> | |
145 | + #end | |
146 | + </tbody> | |
147 | + </table> | |
148 | + </div> | |
149 | + </div> | |
150 | +</div> | |
151 | +</br> | |
152 | +<div class="row"> | |
153 | + <div class="col-md-12 align-right"> | |
154 | + <div align="right"> | |
155 | + <table> | |
156 | + <tr > | |
157 | + <td align="right"> | |
158 | + <span style="font-size:17px;">订单总金额:</span> | |
159 | + </td> | |
160 | + <td> | |
161 | + #if($!{model.realTotalPrice}) | |
162 | + <span style="font-size:17px;">$currencyTool.cent2TenNoSymbol($!{model.realTotalPrice})元</span> | |
163 | + #end | |
164 | + </td> | |
165 | + </tr> | |
166 | + <tr > | |
167 | + <td align="right"> | |
168 | + <span style="font-size:17px;">运费总金额:</span> | |
169 | + </td> | |
170 | + <td> | |
171 | + <span style="font-size:17px;">$currencyTool.cent2TenNoSymbol($!{model.postage})元</span> | |
172 | + </td> | |
173 | + </tr> | |
174 | + <tr> | |
175 | + <td colspan="2"> | |
176 | + <hr style="height:2px;border:none;border-top:2px ridge black;"> | |
177 | + </td> | |
178 | + </tr> | |
179 | + <tr> | |
180 | + <td align="right"> | |
181 | + <span style="font-size:17px;">总计:</span> | |
182 | + </td> | |
183 | + <td > | |
184 | + #set($allPriceTotal=$!{model.postage} + $!{model.realTotalPrice}) | |
185 | + <span style="font-size:17px;">$currencyTool.cent2TenNoSymbol($!{allPriceTotal})元</span> | |
186 | + </td> | |
187 | + </tr> | |
188 | + </table> | |
189 | + </div> | |
190 | + </div> | |
191 | +</div> | |
0 | 192 | \ No newline at end of file |
... | ... |
b2c-orders-web/src/main/webapp/WEB-INF/vm/tablog.vm
0 → 100644
1 | +<div class="order-border-header"> | |
2 | + <table class="table table-striped table-bordered table-condensed grid table-hover"> | |
3 | + <thead> | |
4 | + <tr> | |
5 | + <th>操作</th> | |
6 | + <th>操作前订单状态</th> | |
7 | + <th >操作后订单状态</th> | |
8 | + <th style="width:160px;">操作时间</th> | |
9 | + <th style="width:160px;">操作人</th> | |
10 | + </tr> | |
11 | + </thead> | |
12 | + <tbody> | |
13 | + #foreach(${item} in ${logs}) | |
14 | + <tr> | |
15 | + <td class="textL"> | |
16 | + $!{item.action.name} | |
17 | + </td> | |
18 | + <td class="textL break-word">$!{item.previousStatus.name}</td> | |
19 | + <td class="textC">$!{item.currentStatus.name}</td> | |
20 | + <td class="textC">#if($!{item.actionTime})$dateTool.format("yyyy-MM-dd HH:mm:ss",${item.actionTime})#end</td> | |
21 | + <td class="textC">【$!{item.userType.name}】$!{item.userId}</td> | |
22 | + </tr> | |
23 | + #end | |
24 | + </tbody> | |
25 | + </table> | |
26 | +</div> | |
0 | 27 | \ No newline at end of file |
... | ... |
pom.xml
... | ... | @@ -31,6 +31,18 @@ |
31 | 31 | <orders.paramLog.enabled>true</orders.paramLog.enabled> |
32 | 32 | <dtms.baseUrl>http://dtms.zandeapp.com:8080</dtms.baseUrl> |
33 | 33 | <dtms.token></dtms.token> |
34 | + <!-- redids配置 --> | |
35 | + <redis.pool.maxActive>200</redis.pool.maxActive> | |
36 | + <redis.pool.maxIdle>50</redis.pool.maxIdle> | |
37 | + <redis.pool.minIdle>10</redis.pool.minIdle> | |
38 | + <redis.pool.maxWaitMillis>20000</redis.pool.maxWaitMillis> | |
39 | + <redis.pool.maxWait>300</redis.pool.maxWait> | |
40 | + <redis.host>10.28.11.205</redis.host> | |
41 | + <redis.port>6379</redis.port> | |
42 | + <redis.password>123456</redis.password> | |
43 | + <redis.timeout>30000</redis.timeout> | |
44 | + <redis.testOnBorrow>true</redis.testOnBorrow> | |
45 | + <redis.testOnReturn>true</redis.testOnReturn> | |
34 | 46 | |
35 | 47 | <jdk.version>1.7</jdk.version> |
36 | 48 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
... | ... | @@ -59,6 +71,11 @@ |
59 | 71 | |
60 | 72 | <dependencyManagement> |
61 | 73 | <dependencies> |
74 | + <dependency> | |
75 | + <groupId>redis.clients</groupId> | |
76 | + <artifactId>jedis</artifactId> | |
77 | + <version>2.9.0</version> | |
78 | + </dependency> | |
62 | 79 | <!--swagger --> |
63 | 80 | <dependency> |
64 | 81 | <groupId>io.springfox</groupId> |
... | ... |