Commit d6fdb7878c61f42772e21c2d6a1eac82d0900fe6

Authored by Jiang
1 parent de4a1cd3

把常量配置放到manweb里面,增加缓存

Showing 30 changed files with 483 additions and 221 deletions
b2c-orders-client/pom.xml
... ... @@ -86,50 +86,6 @@
86 86 <artifactId>http-request</artifactId>
87 87 </dependency>
88 88 <dependency>
89   - <groupId>org.slf4j</groupId>
90   - <artifactId>slf4j-api</artifactId>
91   - </dependency>
92   - <dependency>
93   - <groupId>com.fasterxml.jackson.core</groupId>
94   - <artifactId>jackson-core</artifactId>
95   - </dependency>
96   -
97   - <!-- Just the annotations; use this dependency if you want to attach annotations
98   - to classes without connecting them to the code. -->
99   - <dependency>
100   - <groupId>com.fasterxml.jackson.core</groupId>
101   - <artifactId>jackson-annotations</artifactId>
102   - </dependency>
103   -
104   - <!-- databinding; ObjectMapper, JsonNode and related classes are here -->
105   - <dependency>
106   - <groupId>com.fasterxml.jackson.core</groupId>
107   - <artifactId>jackson-databind</artifactId>
108   - </dependency>
109   - <!-- smile (binary JSON). Other artifacts in this group do other formats. -->
110   - <dependency>
111   - <groupId>com.fasterxml.jackson.dataformat</groupId>
112   - <artifactId>jackson-dataformat-smile</artifactId>
113   - </dependency>
114   - <dependency>
115   - <groupId>com.fasterxml.jackson.dataformat</groupId>
116   - <artifactId>jackson-dataformat-xml</artifactId>
117   - </dependency>
118   - <dependency>
119   - <groupId>org.codehaus.woodstox</groupId>
120   - <artifactId>woodstox-core-asl</artifactId>
121   - </dependency>
122   - <!-- JAX-RS provider -->
123   - <dependency>
124   - <groupId>com.fasterxml.jackson.jaxrs</groupId>
125   - <artifactId>jackson-jaxrs-json-provider</artifactId>
126   - </dependency>
127   - <!-- Support for JAX-B annotations as additional configuration -->
128   - <dependency>
129   - <groupId>com.fasterxml.jackson.module</groupId>
130   - <artifactId>jackson-module-jaxb-annotations</artifactId>
131   - </dependency>
132   - <dependency>
133 89 <groupId>junit</groupId>
134 90 <artifactId>junit</artifactId>
135 91 <scope>test</scope>
... ...
b2c-orders-client/src/main/java/com/b2c/orders/enums/OrderStatus.java
... ... @@ -93,6 +93,10 @@ public enum OrderStatus {
93 93 public static boolean isRuningStatus(OrderStatus orderStatus) {
94 94 return orderStatus.isRuningStatus;
95 95 }
  96 +
  97 + public static Map<Integer, OrderStatus> getInitMaps(){
  98 + return initMaps;
  99 + }
96 100  
97 101 @JsonValue
98 102 public int getIndex() {
... ...
b2c-orders-commons/pom.xml
... ... @@ -10,6 +10,54 @@
10 10  
11 11 <dependencies>
12 12 <dependency>
  13 + <groupId>redis.clients</groupId>
  14 + <artifactId>jedis</artifactId>
  15 + </dependency>
  16 + <dependency>
  17 + <groupId>org.slf4j</groupId>
  18 + <artifactId>slf4j-api</artifactId>
  19 + </dependency>
  20 + <dependency>
  21 + <groupId>com.fasterxml.jackson.core</groupId>
  22 + <artifactId>jackson-core</artifactId>
  23 + </dependency>
  24 +
  25 + <!-- Just the annotations; use this dependency if you want to attach annotations
  26 + to classes without connecting them to the code. -->
  27 + <dependency>
  28 + <groupId>com.fasterxml.jackson.core</groupId>
  29 + <artifactId>jackson-annotations</artifactId>
  30 + </dependency>
  31 +
  32 + <!-- databinding; ObjectMapper, JsonNode and related classes are here -->
  33 + <dependency>
  34 + <groupId>com.fasterxml.jackson.core</groupId>
  35 + <artifactId>jackson-databind</artifactId>
  36 + </dependency>
  37 + <!-- smile (binary JSON). Other artifacts in this group do other formats. -->
  38 + <dependency>
  39 + <groupId>com.fasterxml.jackson.dataformat</groupId>
  40 + <artifactId>jackson-dataformat-smile</artifactId>
  41 + </dependency>
  42 + <dependency>
  43 + <groupId>com.fasterxml.jackson.dataformat</groupId>
  44 + <artifactId>jackson-dataformat-xml</artifactId>
  45 + </dependency>
  46 + <dependency>
  47 + <groupId>org.codehaus.woodstox</groupId>
  48 + <artifactId>woodstox-core-asl</artifactId>
  49 + </dependency>
  50 + <!-- JAX-RS provider -->
  51 + <dependency>
  52 + <groupId>com.fasterxml.jackson.jaxrs</groupId>
  53 + <artifactId>jackson-jaxrs-json-provider</artifactId>
  54 + </dependency>
  55 + <!-- Support for JAX-B annotations as additional configuration -->
  56 + <dependency>
  57 + <groupId>com.fasterxml.jackson.module</groupId>
  58 + <artifactId>jackson-module-jaxb-annotations</artifactId>
  59 + </dependency>
  60 + <dependency>
13 61 <groupId>commons-lang</groupId>
14 62 <artifactId>commons-lang</artifactId>
15 63 </dependency>
... ...
b2c-orders-commons/src/main/java/com/b2c/orders/commons/cache/CacheManager.java 0 → 100644
  1 +package com.b2c.orders.commons.cache;
  2 +
  3 +public interface CacheManager {
  4 +
  5 + <T> T get(String key, Class<T> type);
  6 +
  7 + void put(String key, Object value);
  8 +
  9 + void put(String key, Object value, int expire);
  10 +
  11 + void remove(String key);
  12 +
  13 +}
0 14 \ No newline at end of file
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/cache/CacheManager.java renamed to b2c-orders-commons/src/main/java/com/b2c/orders/commons/cache/impl/CacheManagerBean.java
1   -package com.b2c.orders.dao.cache;
  1 +package com.b2c.orders.commons.cache.impl;
2 2  
  3 +import org.apache.commons.lang.StringUtils;
3 4 import org.slf4j.Logger;
4 5 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 6  
9   -import com.b2c.orders.dao.utils.JedisUtils;
  7 +import com.b2c.orders.commons.cache.CacheManager;
  8 +import com.b2c.orders.commons.utils.JedisUtils;
10 9 import com.fasterxml.jackson.annotation.JsonInclude.Include;
11 10 import com.fasterxml.jackson.databind.ObjectMapper;
12 11  
13   -@Component
14   -public class CacheManager {
  12 +public class CacheManagerBean implements CacheManager {
15 13  
16   - private static final Logger LOG = LoggerFactory.getLogger(CacheManager.class);
  14 + private static final Logger LOG = LoggerFactory.getLogger(CacheManagerBean.class);
17 15 private static final ObjectMapper MAPPER = new ObjectMapper();
18 16  
19 17 static {
20 18 MAPPER.setSerializationInclusion(Include.NON_NULL);
21 19 }
22 20  
23   - @Autowired
24 21 private JedisUtils jedisUtils;
25 22  
  23 + public CacheManagerBean(JedisUtils jedisUtils) {
  24 + this.jedisUtils = jedisUtils;
  25 + }
  26 +
  27 + /*
  28 + * (non-Javadoc)
  29 + *
  30 + * @see com.b2c.orders.commons.cache.CacheManager#get(java.lang.String,
  31 + * java.lang.Class)
  32 + */
  33 + @Override
26 34 public <T> T get(String key, Class<T> type) {
27 35 String value = this.jedisUtils.get(key);
28 36 if (StringUtils.isEmpty(value)) {
... ... @@ -36,6 +44,13 @@ public class CacheManager {
36 44 }
37 45 }
38 46  
  47 + /*
  48 + * (non-Javadoc)
  49 + *
  50 + * @see com.b2c.orders.commons.cache.CacheManager#put(java.lang.String,
  51 + * java.lang.Object)
  52 + */
  53 + @Override
39 54 public void put(String key, Object value) {
40 55 try {
41 56 this.jedisUtils.set(key, MAPPER.writeValueAsString(value));
... ... @@ -44,6 +59,13 @@ public class CacheManager {
44 59 }
45 60 }
46 61  
  62 + /*
  63 + * (non-Javadoc)
  64 + *
  65 + * @see com.b2c.orders.commons.cache.CacheManager#put(java.lang.String,
  66 + * java.lang.Object, int)
  67 + */
  68 + @Override
47 69 public void put(String key, Object value, int expire) {
48 70 try {
49 71 this.jedisUtils.set(key, MAPPER.writeValueAsString(value), expire);
... ... @@ -52,6 +74,12 @@ public class CacheManager {
52 74 }
53 75 }
54 76  
  77 + /*
  78 + * (non-Javadoc)
  79 + *
  80 + * @see com.b2c.orders.commons.cache.CacheManager#remove(java.lang.String)
  81 + */
  82 + @Override
55 83 public void remove(String key) {
56 84 this.jedisUtils.del(key);
57 85 }
... ...
b2c-orders-commons/src/main/java/com/b2c/orders/commons/constant/Constant.java
... ... @@ -2,28 +2,98 @@ package com.b2c.orders.commons.constant;
2 2  
3 3 public class Constant {
4 4  
5   - /**
6   - * 商家未接单,订单超时api接口地址
7   - */
8   - public static final String ORDER_TAKEN_TIMEOUT_CALL_URL = "http://orders.zandeapp.com/api/takenTimeout";
9   - /**
10   - * 买家未付款,订单超时api接口
11   - */
12   - public static final String ORDER_PAYMENT_TIMEOUT_CALL_URL = "http://orders.zandeapp.com/api/paymentTimeout";
13   - /**
14   - * 商家未接单,订单超时时间
15   - */
16   - public static final int ORDER_TAKEN_TIMEOUT_SECONDS = 2 * 60 * 60;
17   - /**
18   - * 买家未支付,订单超时时间
19   - */
20   - public static final int ORDER_PAYMENT_TIMEOUT_SECONDS = 24 * 60 * 60;
21   - /**
22   - * 买家超过{@link ORDER_CONFIRM_TIMEOUT_SECONDS}秒没有确认收货或者卖家超过{@link ORDER_CONFIRM_TIMEOUT_SECONDS}没有确认收款,dtms调用接口地址自动确认收货、收款
23   - */
24   - public static final String ORDER_CONFIRM_TIMEOUT_CALL_URL = "http://orders.zandeapp.com/api/dtmsConfirm";
25   - /**
26   - * 买家超过这个时间(单位:秒)没有确认收货或者卖家超过这个时间(单位:秒)没有确认收款,dtms调用{@link ORDER_CONFIRM_TIMEOUT_CALL_URL}订单接口确认收货、收款
27   - */
28   - public static final int ORDER_CONFIRM_TIMEOUT_SECONDS = 24 * 60 * 60;
  5 + // /**
  6 + // * 商家未接单,订单超时api接口地址
  7 + // */
  8 + // public static final String ORDER_TAKEN_TIMEOUT_CALL_URL =
  9 + // "http://orders.zandeapp.com/api/takenTimeout";
  10 + // /**
  11 + // * 买家未付款,订单超时api接口
  12 + // */
  13 + // public static final String ORDER_PAYMENT_TIMEOUT_CALL_URL =
  14 + // "http://orders.zandeapp.com/api/paymentTimeout";
  15 + // /**
  16 + // * 商家未接单,订单超时时间
  17 + // */
  18 + // public static final int ORDER_TAKEN_TIMEOUT_SECONDS = 2 * 60 * 60;
  19 + // /**
  20 + // * 买家未支付,订单超时时间
  21 + // */
  22 + // public static final int ORDER_PAYMENT_TIMEOUT_SECONDS = 60;
  23 + // /**
  24 + // * 买家超过{@link ORDER_CONFIRM_TIMEOUT_SECONDS}秒没有确认收货或者卖家超过{@link
  25 + // ORDER_CONFIRM_TIMEOUT_SECONDS}没有确认收款,dtms调用接口地址自动确认收货、收款
  26 + // */
  27 + // public static final String ORDER_CONFIRM_TIMEOUT_CALL_URL =
  28 + // "http://orders.zandeapp.com/api/dtmsConfirm";
  29 + // /**
  30 + // * 买家超过这个时间(单位:秒)没有确认收货或者卖家超过这个时间(单位:秒)没有确认收款,dtms调用{@link
  31 + // ORDER_CONFIRM_TIMEOUT_CALL_URL}订单接口确认收货、收款
  32 + // */
  33 + // public static final int ORDER_CONFIRM_TIMEOUT_SECONDS = 24 * 60 * 60;
  34 +
  35 + private String domain;
  36 + private String orderTakenTimeoutCallUrlKey;
  37 + private String orderPaymentTimeoutCallUrlKey;
  38 + private String orderTakenTimeoutSecondsKey;
  39 + private String orderPaymentTimeoutSecondsKey;
  40 + private String orderConfirmTimeoutCallUrlKey;
  41 + private String orderConfirmTimeoutSecondsKey;
  42 +
  43 + public String getDomain() {
  44 + return domain;
  45 + }
  46 +
  47 + public void setDomain(String domain) {
  48 + this.domain = domain;
  49 + }
  50 +
  51 + public String getOrderTakenTimeoutCallUrlKey() {
  52 + return orderTakenTimeoutCallUrlKey;
  53 + }
  54 +
  55 + public void setOrderTakenTimeoutCallUrlKey(String orderTakenTimeoutCallUrlKey) {
  56 + this.orderTakenTimeoutCallUrlKey = orderTakenTimeoutCallUrlKey;
  57 + }
  58 +
  59 + public String getOrderPaymentTimeoutCallUrlKey() {
  60 + return orderPaymentTimeoutCallUrlKey;
  61 + }
  62 +
  63 + public void setOrderPaymentTimeoutCallUrlKey(String orderPaymentTimeoutCallUrlKey) {
  64 + this.orderPaymentTimeoutCallUrlKey = orderPaymentTimeoutCallUrlKey;
  65 + }
  66 +
  67 + public String getOrderTakenTimeoutSecondsKey() {
  68 + return orderTakenTimeoutSecondsKey;
  69 + }
  70 +
  71 + public void setOrderTakenTimeoutSecondsKey(String orderTakenTimeoutSecondsKey) {
  72 + this.orderTakenTimeoutSecondsKey = orderTakenTimeoutSecondsKey;
  73 + }
  74 +
  75 + public String getOrderPaymentTimeoutSecondsKey() {
  76 + return orderPaymentTimeoutSecondsKey;
  77 + }
  78 +
  79 + public void setOrderPaymentTimeoutSecondsKey(String orderPaymentTimeoutSecondsKey) {
  80 + this.orderPaymentTimeoutSecondsKey = orderPaymentTimeoutSecondsKey;
  81 + }
  82 +
  83 + public String getOrderConfirmTimeoutCallUrlKey() {
  84 + return orderConfirmTimeoutCallUrlKey;
  85 + }
  86 +
  87 + public void setOrderConfirmTimeoutCallUrlKey(String orderConfirmTimeoutCallUrlKey) {
  88 + this.orderConfirmTimeoutCallUrlKey = orderConfirmTimeoutCallUrlKey;
  89 + }
  90 +
  91 + public String getOrderConfirmTimeoutSecondsKey() {
  92 + return orderConfirmTimeoutSecondsKey;
  93 + }
  94 +
  95 + public void setOrderConfirmTimeoutSecondsKey(String orderConfirmTimeoutSecondsKey) {
  96 + this.orderConfirmTimeoutSecondsKey = orderConfirmTimeoutSecondsKey;
  97 + }
  98 +
29 99 }
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/utils/JedisUtils.java renamed to b2c-orders-commons/src/main/java/com/b2c/orders/commons/utils/JedisUtils.java
1   -package com.b2c.orders.dao.utils;
  1 +package com.b2c.orders.commons.utils;
2 2  
3 3 import java.io.UnsupportedEncodingException;
4 4 import java.util.Arrays;
... ...
b2c-orders-dao/pom.xml
... ... @@ -15,10 +15,6 @@
15 15 <version>${project.version}</version>
16 16 </dependency>
17 17 <dependency>
18   - <groupId>redis.clients</groupId>
19   - <artifactId>jedis</artifactId>
20   - </dependency>
21   - <dependency>
22 18 <groupId>com.b2c.website</groupId>
23 19 <artifactId>diligrp-website-util</artifactId>
24 20 <exclusions>
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/BuyerDaoBean.java
... ... @@ -8,12 +8,12 @@ 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.orders.commons.cache.impl.CacheManagerBean;
11 12 import com.b2c.orders.commons.exceptions.ApplicationException;
12 13 import com.b2c.orders.commons.exceptions.BuyerException;
13 14 import com.b2c.orders.commons.exceptions.ShopBuyerException;
14 15 import com.b2c.orders.dao.BuyerDao;
15 16 import com.b2c.orders.dao.ShopBuyerDao;
16   -import com.b2c.orders.dao.cache.CacheManager;
17 17 import com.b2c.orders.domain.Buyer;
18 18  
19 19 @Repository
... ... @@ -22,7 +22,7 @@ public class BuyerDaoBean implements BuyerDao {
22 22 private static final String BUYER_CACHE_KEY = "b2c_redis_buyer_";
23 23  
24 24 @Autowired
25   - private CacheManager cacheManager;
  25 + private CacheManagerBean cacheManager;
26 26 @Autowired
27 27 private MyAppClient myAppClient;
28 28 @Autowired
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/OrderDaoBean.java
... ... @@ -3,11 +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.cache.impl.CacheManagerBean;
6 7 import com.b2c.orders.commons.exceptions.ApplicationException;
7 8 import com.b2c.orders.commons.exceptions.OrderRepositoryException;
8 9 import com.b2c.orders.dao.OrderDao;
9 10 import com.b2c.orders.dao.OrderItemDao;
10   -import com.b2c.orders.dao.cache.CacheManager;
11 11 import com.b2c.orders.domain.Order;
12 12 import com.b2c.orders.domain.OrderItem;
13 13 import com.diligrp.website.util.dao.impl.BaseDaoImpl;
... ... @@ -17,7 +17,7 @@ public class OrderDaoBean extends BaseDaoImpl&lt;Order&gt; implements OrderDao {
17 17  
18 18 private static final String ORDER_CACHE_KEY = "b2c_redis_order_";
19 19 @Autowired
20   - private CacheManager cacheManager;
  20 + private CacheManagerBean cacheManager;
21 21 @Autowired
22 22 private OrderItemDao orderItemDao;
23 23  
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/SellerDaoBean.java
... ... @@ -8,12 +8,12 @@ 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.orders.commons.cache.impl.CacheManagerBean;
11 12 import com.b2c.orders.commons.exceptions.ApplicationException;
12 13 import com.b2c.orders.commons.exceptions.SellerException;
13 14 import com.b2c.orders.commons.exceptions.ShopBuyerException;
14 15 import com.b2c.orders.dao.SellerDao;
15 16 import com.b2c.orders.dao.ShopBuyerDao;
16   -import com.b2c.orders.dao.cache.CacheManager;
17 17 import com.b2c.orders.domain.Seller;
18 18  
19 19 @Repository
... ... @@ -24,7 +24,7 @@ public class SellerDaoBean implements SellerDao {
24 24 @Autowired
25 25 private MyAppClient myAppClient;
26 26 @Autowired
27   - private CacheManager cacheManager;
  27 + private CacheManagerBean cacheManager;
28 28 @Autowired
29 29 private ShopBuyerDao shopBuyerDao;
30 30  
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/ShopBuyerDaoBean.java
... ... @@ -7,10 +7,10 @@ import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput;
7 7 import com.b2c.myapp.common.utils.BaseOutput;
8 8 import com.b2c.myapp.sdk.MyAppClient;
9 9 import com.b2c.myapp.sdk.service.ShopBuyerService;
  10 +import com.b2c.orders.commons.cache.impl.CacheManagerBean;
10 11 import com.b2c.orders.commons.exceptions.ApplicationException;
11 12 import com.b2c.orders.commons.exceptions.ShopBuyerException;
12 13 import com.b2c.orders.dao.ShopBuyerDao;
13   -import com.b2c.orders.dao.cache.CacheManager;
14 14  
15 15 @Repository
16 16 public class ShopBuyerDaoBean implements ShopBuyerDao {
... ... @@ -20,7 +20,7 @@ public class ShopBuyerDaoBean implements ShopBuyerDao {
20 20 @Autowired
21 21 private MyAppClient myAppClient;
22 22 @Autowired
23   - private CacheManager cacheManager;
  23 + private CacheManagerBean cacheManager;
24 24  
25 25 @Override
26 26 public ShopBuyerKeyOutput findByShopBuyerId(Long buyerShopId) throws ShopBuyerException {
... ...
b2c-orders-dao/src/main/java/com/b2c/orders/dao/impl/ShopDaoBean.java
... ... @@ -10,12 +10,12 @@ 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 12 import com.b2c.myapp.sdk.service.ShopInfoService;
  13 +import com.b2c.orders.commons.cache.impl.CacheManagerBean;
13 14 import com.b2c.orders.commons.exceptions.ApplicationException;
14 15 import com.b2c.orders.commons.exceptions.ShopBuyerException;
15 16 import com.b2c.orders.commons.exceptions.ShopException;
16 17 import com.b2c.orders.dao.ShopBuyerDao;
17 18 import com.b2c.orders.dao.ShopDao;
18   -import com.b2c.orders.dao.cache.CacheManager;
19 19 import com.b2c.orders.domain.Shop;
20 20  
21 21 @Repository
... ... @@ -25,7 +25,7 @@ public class ShopDaoBean implements ShopDao {
25 25 private static final String SHOP_CACHE_KEY = "b2c_redis_shop_";
26 26  
27 27 @Autowired
28   - private CacheManager cacheManager;
  28 + private CacheManagerBean cacheManager;
29 29 @Autowired
30 30 private ShopBuyerDao shopBuyerDao;
31 31 @Autowired
... ...
b2c-orders-dao/src/main/resources/spring-redis.xml
... ... @@ -34,7 +34,7 @@
34 34 <constructor-arg index="1" value="${redis.port}" />
35 35 </bean>
36 36  
37   - <bean id="jedisUtils" class="com.b2c.orders.dao.utils.JedisUtils">
  37 + <bean id="jedisUtils" class="com.b2c.orders.commons.utils.JedisUtils">
38 38 <property name="poolConfig" ref="jedisPoolConfig" />
39 39 <property name="shardInfo" ref="jedisShardInfo" />
40 40 </bean>
... ...
b2c-orders-dao/src/main/resources/sqlmap/OrderMapper.xml
... ... @@ -264,7 +264,7 @@
264 264 </update>
265 265  
266 266 <select id="countByCondition" parameterType="Query" resultType="Integer">
267   - SELECT count(1) FROM t_order
  267 + SELECT count(1) FROM t_order t1
268 268 <include refid="joinOrderItem" />
269 269 where 1=1
270 270 <include refid="selectCondition" />
... ...
b2c-orders-domain/src/main/java/com/b2c/orders/domain/Order.java
... ... @@ -208,8 +208,8 @@ public class Order extends BaseDomain {
208 208 * @throws OrderException
209 209 */
210 210 public void takenTimeout() throws OrderException {
211   - if (this.orderStatus.equals(OrderStatus.PendingTake)) {
212   - throw new OrderException(ApplicationException.DATA_EXCEPTION, "当前状态不能设置支付超时");
  211 + if (!this.orderStatus.equals(OrderStatus.PendingTake)) {
  212 + throw new OrderException(ApplicationException.DATA_EXCEPTION, "当前状态不能设置接单超时");
213 213 }
214 214 this.orderStatus = OrderStatus.TakenTimeout;
215 215 }
... ... @@ -220,7 +220,7 @@ public class Order extends BaseDomain {
220 220 * @throws OrderException
221 221 */
222 222 public void paymentTimeout() throws OrderException {
223   - if (this.orderStatus.equals(OrderStatus.PendingPayment)) {
  223 + if (!this.orderStatus.equals(OrderStatus.PendingPayment)) {
224 224 throw new OrderException(ApplicationException.DATA_EXCEPTION, "当前状态不能设置接单超时");
225 225 }
226 226 this.orderStatus = OrderStatus.PaymentTimeout;
... ...
b2c-orders-domain/src/main/java/com/b2c/orders/domain/OrderLog.java
... ... @@ -24,7 +24,10 @@ public class OrderLog extends BaseDomain {
24 24 private OrderStatus previousStatus;
25 25 private OrderStatus currentStatus;
26 26 private Timestamp actionTime;
27   - private Long userId;
  27 + /**
  28 + * 0表示dtms操作订单
  29 + */
  30 + private Long userId = 0L;
28 31 private UserType userType;
29 32 private Long orderId;
30 33 private String description;
... ...
b2c-orders-manager/src/main/java/com/b2c/orders/manager/impl/OrderManagerBean.java
... ... @@ -345,7 +345,7 @@ public class OrderManagerBean implements OrderManager {
345 345 OrderLog log = new OrderLog();
346 346 log.setPreviousStatus(po.getOrderStatus());
347 347 po.cancel();
348   - log.setPreviousStatus(po.getOrderStatus());
  348 + log.setCurrentStatus(po.getOrderStatus());
349 349 this.orderDao.update(po);
350 350 log.setAction(Action.BUYER_CANCEL);
351 351 log.setOrderId(orderId);
... ... @@ -366,15 +366,11 @@ public class OrderManagerBean implements OrderManager {
366 366 throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND,
367 367 String.format("未找到id为%s的订单", orderId));
368 368 }
369   - try {
370   - po.takenTimeout();
371   - } catch (OrderException e) {
372   - throw e;
373   - }
374 369 OrderLog log = new OrderLog();
375 370 log.setPreviousStatus(po.getOrderStatus());
  371 + po.takenTimeout();
  372 + log.setCurrentStatus(po.getOrderStatus());
376 373 this.orderDao.update(po);
377   - log.setPreviousStatus(po.getOrderStatus());
378 374 log.setAction(Action.TAKEN_TIMEOUT);
379 375 log.setDescription("商家接单超时");
380 376 log.setOrderId(orderId);
... ... @@ -389,15 +385,11 @@ public class OrderManagerBean implements OrderManager {
389 385 throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND,
390 386 String.format("未找到id为%s的订单", orderId));
391 387 }
392   - try {
393   - po.paymentTimeout();
394   - } catch (OrderException e) {
395   - throw e;
396   - }
397 388 OrderLog log = new OrderLog();
398 389 log.setPreviousStatus(po.getOrderStatus());
  390 + po.paymentTimeout();
  391 + log.setCurrentStatus(po.getOrderStatus());
399 392 this.orderDao.update(po);
400   - log.setPreviousStatus(po.getOrderStatus());
401 393 log.setAction(Action.PAYMENT_TIMEOUT);
402 394 log.setDescription("买家付款超时");
403 395 log.setOrderId(orderId);
... ... @@ -412,15 +404,11 @@ public class OrderManagerBean implements OrderManager {
412 404 throw new OrderRepositoryException(OrderRepositoryException.ENTITY_NOT_FOUND,
413 405 String.format("未找到id为%s的订单", orderId));
414 406 }
415   - try {
416   - po.confirm();
417   - } catch (OrderException e) {
418   - throw e;
419   - }
420 407 OrderLog log = new OrderLog();
421 408 log.setPreviousStatus(po.getOrderStatus());
  409 + po.confirm();
  410 + log.setCurrentStatus(po.getOrderStatus());
422 411 this.orderDao.update(po);
423   - log.setPreviousStatus(po.getOrderStatus());
424 412 log.setAction(Action.SYSTEM_CONFIRM);
425 413 log.setDescription("买家确认收货超时或商家确认收款超时,系统自动确认收货、收款");
426 414 log.setOrderId(orderId);
... ...
b2c-orders-rpc/pom.xml
... ... @@ -10,6 +10,10 @@
10 10  
11 11 <dependencies>
12 12 <dependency>
  13 + <groupId>com.b2c.website.web</groupId>
  14 + <artifactId>diligrp-website-api</artifactId>
  15 + </dependency>
  16 + <dependency>
13 17 <groupId>${project.groupId}</groupId>
14 18 <artifactId>b2c-orders-commons</artifactId>
15 19 <version>${project.parent.version}</version>
... ... @@ -17,7 +21,6 @@
17 21 <dependency>
18 22 <groupId>com.b2c.dtms</groupId>
19 23 <artifactId>dtms-client</artifactId>
20   - <version>0.0.1-SNAPSHOT</version>
21 24 </dependency>
22 25 <dependency>
23 26 <groupId>org.springframework</groupId>
... ...
b2c-orders-rpc/src/main/java/com/b2c/orders/rpc/SystemConfigRPCService.java 0 → 100644
  1 +package com.b2c.orders.rpc;
  2 +
  3 +public interface SystemConfigRPCService {
  4 +
  5 + String getOrderTakenTimeoutCallUrl();
  6 +
  7 + String getOrderPaymentTimeoutCallUrl();
  8 +
  9 + String getOrderConfirmTimeoutCallUrl();
  10 +
  11 + int getOrderTakenTimeoutSeconds();
  12 +
  13 + int getOrderPaymentTimeoutSeconds();
  14 +
  15 + int getOrderConfirmTimeoutSeconds();
  16 +
  17 +}
... ...
b2c-orders-rpc/src/main/java/com/b2c/orders/rpc/impl/DtmsRPCServiceBean.java
... ... @@ -4,17 +4,19 @@ import com.b2c.dtms.client.DtmsClient;
4 4 import com.b2c.dtms.client.domain.dto.request.DtmsProduceRequestDto;
5 5 import com.b2c.dtms.client.domain.dto.response.DtmsResponseDto;
6 6 import com.b2c.dtms.common.enums.dtms.DtmsMessageType;
7   -import com.b2c.orders.commons.constant.Constant;
8 7 import com.b2c.orders.commons.exceptions.ApplicationException;
9 8 import com.b2c.orders.rpc.DtmsRPCService;
  9 +import com.b2c.orders.rpc.SystemConfigRPCService;
10 10 import com.b2c.orders.rpc.exception.DtmsRPCException;
11 11  
12 12 public class DtmsRPCServiceBean implements DtmsRPCService {
13 13  
14 14 private DtmsClient dtmsClient;
  15 + private SystemConfigRPCService systemConfigService;
15 16  
16   - public DtmsRPCServiceBean(String baseUrl, String token) {
  17 + public DtmsRPCServiceBean(String baseUrl, String token, SystemConfigRPCService systemConfigService) {
17 18 this.dtmsClient = new DtmsClient(baseUrl, token);
  19 + this.systemConfigService = systemConfigService;
18 20 }
19 21  
20 22 @Override
... ... @@ -29,8 +31,8 @@ public class DtmsRPCServiceBean implements DtmsRPCService {
29 31 public void sendOrderPayTimeoutDtms(Long orderId) throws DtmsRPCException {
30 32 DtmsProduceRequestDto request = new DtmsProduceRequestDto();
31 33 request.setBizId(orderId.toString());
32   - request.setCallUrl(Constant.ORDER_PAYMENT_TIMEOUT_CALL_URL);
33   - request.setDelaySeconds(Constant.ORDER_PAYMENT_TIMEOUT_SECONDS);
  34 + request.setCallUrl(this.systemConfigService.getOrderPaymentTimeoutCallUrl());
  35 + request.setDelaySeconds(this.systemConfigService.getOrderPaymentTimeoutSeconds());
34 36 request.setType(DtmsMessageType.Timer.code());
35 37 this.produceDtmsMessage(request);
36 38 }
... ... @@ -39,8 +41,8 @@ public class DtmsRPCServiceBean implements DtmsRPCService {
39 41 public void sendOrderConfirmDtms(Long id) throws DtmsRPCException {
40 42 DtmsProduceRequestDto request = new DtmsProduceRequestDto();
41 43 request.setBizId(id.toString());
42   - request.setCallUrl(Constant.ORDER_CONFIRM_TIMEOUT_CALL_URL);
43   - request.setDelaySeconds(Constant.ORDER_CONFIRM_TIMEOUT_SECONDS);
  44 + request.setCallUrl(this.systemConfigService.getOrderConfirmTimeoutCallUrl());
  45 + request.setDelaySeconds(this.systemConfigService.getOrderConfirmTimeoutSeconds());
44 46 request.setType(DtmsMessageType.Timer.code());
45 47 this.produceDtmsMessage(request);
46 48 }
... ... @@ -49,8 +51,8 @@ public class DtmsRPCServiceBean implements DtmsRPCService {
49 51 public void sendOrderTakenTimeoutDtms(Long orderId) throws DtmsRPCException {
50 52 DtmsProduceRequestDto request = new DtmsProduceRequestDto();
51 53 request.setBizId(orderId.toString());
52   - request.setCallUrl(Constant.ORDER_TAKEN_TIMEOUT_CALL_URL);
53   - request.setDelaySeconds(Constant.ORDER_TAKEN_TIMEOUT_SECONDS);
  54 + request.setCallUrl(this.systemConfigService.getOrderTakenTimeoutCallUrl());
  55 + request.setDelaySeconds(this.systemConfigService.getOrderTakenTimeoutSeconds());
54 56 request.setType(DtmsMessageType.Timer.code());
55 57 this.produceDtmsMessage(request);
56 58 }
... ...
b2c-orders-rpc/src/main/java/com/b2c/orders/rpc/impl/SystemConfigRPCServiceBean.java 0 → 100644
  1 +package com.b2c.orders.rpc.impl;
  2 +
  3 +import org.springframework.util.StringUtils;
  4 +
  5 +import com.b2c.orders.commons.cache.CacheManager;
  6 +import com.b2c.orders.commons.constant.Constant;
  7 +import com.b2c.orders.rpc.SystemConfigRPCService;
  8 +import com.diligrp.website.web.interfaces.domain.output.BaseResp;
  9 +import com.diligrp.website.web.interfaces.domain.output.SysConfigResp;
  10 +import com.diligrp.website.web.interfaces.service.SysConfigService;
  11 +
  12 +public class SystemConfigRPCServiceBean implements SystemConfigRPCService {
  13 +
  14 + private SysConfigService sysConfigService;
  15 + private Constant constant;
  16 + private CacheManager cacheManager;
  17 + private static final String KEY_PREFIX = "b2c_";
  18 +
  19 + public SystemConfigRPCServiceBean(SysConfigService sysConfigService, Constant constant, CacheManager cacheManager) {
  20 + this.sysConfigService = sysConfigService;
  21 + this.constant = constant;
  22 + this.cacheManager = cacheManager;
  23 + }
  24 +
  25 + @Override
  26 + public String getOrderTakenTimeoutCallUrl() {
  27 + String key = KEY_PREFIX + this.constant.getOrderTakenTimeoutCallUrlKey();
  28 + String url = this.cacheManager.get(key, String.class);
  29 + if (!StringUtils.isEmpty(url)) {
  30 + return url;
  31 + }
  32 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderTakenTimeoutCallUrlKey());
  33 + if (response == null) {
  34 + throw new RuntimeException("获取接单超时dtms调用地址失败");
  35 + }
  36 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  37 + throw new RuntimeException("获取接单超时dtms调用地址失败");
  38 + }
  39 + StringBuilder sb = new StringBuilder("http://").append(this.constant.getDomain()).append("/")
  40 + .append(response.getValue());
  41 + url = sb.toString();
  42 + this.cacheManager.put(key, url);
  43 + return url;
  44 + }
  45 +
  46 + @Override
  47 + public String getOrderPaymentTimeoutCallUrl() {
  48 + String key = KEY_PREFIX + this.constant.getOrderPaymentTimeoutCallUrlKey();
  49 + String url = this.cacheManager.get(key, String.class);
  50 + if (!StringUtils.isEmpty(url)) {
  51 + return url;
  52 + }
  53 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderPaymentTimeoutCallUrlKey());
  54 + if (response == null) {
  55 + throw new RuntimeException("获取支付超时dtms调用地址失败");
  56 + }
  57 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  58 + throw new RuntimeException("获取支付超时dtms调用地址失败");
  59 + }
  60 + StringBuilder sb = new StringBuilder("http://").append(this.constant.getDomain()).append("/")
  61 + .append(response.getValue());
  62 + url = sb.toString();
  63 + this.cacheManager.put(key, url);
  64 + return url;
  65 + }
  66 +
  67 + @Override
  68 + public String getOrderConfirmTimeoutCallUrl() {
  69 + String key = KEY_PREFIX + this.constant.getOrderConfirmTimeoutCallUrlKey();
  70 + String url = this.cacheManager.get(key, String.class);
  71 + if (!StringUtils.isEmpty(url)) {
  72 + return url;
  73 + }
  74 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderConfirmTimeoutCallUrlKey());
  75 + if (response == null) {
  76 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  77 + }
  78 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  79 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  80 + }
  81 + StringBuilder sb = new StringBuilder("http://").append(this.constant.getDomain()).append("/")
  82 + .append(response.getValue());
  83 + url = sb.toString();
  84 + this.cacheManager.put(key, url);
  85 + return url;
  86 + }
  87 +
  88 + @Override
  89 + public int getOrderTakenTimeoutSeconds() {
  90 + String key = KEY_PREFIX + this.constant.getOrderTakenTimeoutSecondsKey();
  91 + Integer value = this.cacheManager.get(key, Integer.class);
  92 + if (value != null && value > 0) {
  93 + return Integer.valueOf(value);
  94 + }
  95 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderTakenTimeoutSecondsKey());
  96 + if (response == null) {
  97 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  98 + }
  99 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  100 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  101 + }
  102 + value = Integer.valueOf(response.getValue());
  103 + this.cacheManager.put(key, value);
  104 + return value;
  105 + }
  106 +
  107 + @Override
  108 + public int getOrderPaymentTimeoutSeconds() {
  109 + String key = KEY_PREFIX + this.constant.getOrderPaymentTimeoutSecondsKey();
  110 + Integer value = this.cacheManager.get(key, Integer.class);
  111 + if (value != null && value > 0) {
  112 + return Integer.valueOf(value);
  113 + }
  114 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderPaymentTimeoutSecondsKey());
  115 + if (response == null) {
  116 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  117 + }
  118 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  119 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  120 + }
  121 + value = Integer.valueOf(response.getValue());
  122 + this.cacheManager.put(key, value);
  123 + return value;
  124 + }
  125 +
  126 + @Override
  127 + public int getOrderConfirmTimeoutSeconds() {
  128 + String key = KEY_PREFIX + this.constant.getOrderConfirmTimeoutSecondsKey();
  129 + Integer value = this.cacheManager.get(key, Integer.class);
  130 + if (value != null && value > 0) {
  131 + return Integer.valueOf(value);
  132 + }
  133 + SysConfigResp response = this.sysConfigService.getSysConfig(this.constant.getOrderConfirmTimeoutSecondsKey());
  134 + if (response == null) {
  135 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  136 + }
  137 + if (response.getCode() != BaseResp.CODE_SUCCESS) {
  138 + throw new RuntimeException("获取订单确认超时dtms调用地址失败");
  139 + }
  140 + value = Integer.valueOf(response.getValue());
  141 + this.cacheManager.put(key, value);
  142 + return value;
  143 + }
  144 +
  145 +}
... ...
b2c-orders-rpc/src/main/resources/spring-rpc.xml
... ... @@ -31,4 +31,33 @@
31 31 <constructor-arg name="baseUrl" value="http://www.zandeapp.com" />
32 32 </bean>
33 33  
  34 + <bean id="websiteClient" class="com.diligrp.website.web.interfaces.WebsiteClient">
  35 + <constructor-arg name="token" value="${manweb.token}" />
  36 + <constructor-arg name="baseUrl" value="${manweb.baseUrl}" />
  37 + </bean>
  38 +
  39 + <bean id="sysConfigService"
  40 + class="com.diligrp.website.web.interfaces.service.SysConfigService"
  41 + factory-bean="websiteClient" factory-method="getSysConfigService" />
  42 +
  43 + <bean id="constant" class="com.b2c.orders.commons.constant.Constant">
  44 + <property name="domain" value="${orders.domain}" />
  45 + <property name="orderTakenTimeoutCallUrlKey" value="${orders.takenTimeoutCallUrlKey}" />
  46 + <property name="orderPaymentTimeoutCallUrlKey" value="${orders.paymentTimeoutCallUrlKey}" />
  47 + <property name="orderTakenTimeoutSecondsKey" value="${orders.takenTimeoutSecondsKey}" />
  48 + <property name="orderPaymentTimeoutSecondsKey" value="${orders.paymentTimeoutSecondsKey}" />
  49 + <property name="orderConfirmTimeoutCallUrlKey" value="${orders.confirmTimeoutCallUrlKey}" />
  50 + <property name="orderConfirmTimeoutSecondsKey" value="${orders.confirmTimeoutSecondsKey}" />
  51 + </bean>
  52 +
  53 + <bean id="cacheManager" class="com.b2c.orders.commons.cache.impl.CacheManagerBean">
  54 + <constructor-arg name="jedisUtils" ref="jedisUtils" />
  55 + </bean>
  56 +
  57 + <bean id="systemConfigRPCService" class="com.b2c.orders.rpc.impl.SystemConfigRPCServiceBean">
  58 + <constructor-arg name="sysConfigService" ref="sysConfigService" />
  59 + <constructor-arg name="constant" ref="constant" />
  60 + <constructor-arg name="cacheManager" ref="cacheManager" />
  61 + </bean>
  62 +
34 63 </beans>
35 64 \ No newline at end of file
... ...
b2c-orders-web/pom.xml
... ... @@ -83,11 +83,6 @@
83 83 <artifactId>swagger-annotations</artifactId>
84 84 </dependency>
85 85 <dependency>
86   - <groupId>com.b2c.dtms</groupId>
87   - <artifactId>dtms-client</artifactId>
88   - <version>0.0.1-SNAPSHOT</version>
89   - </dependency>
90   - <dependency>
91 86 <groupId>org.springframework</groupId>
92 87 <artifactId>spring-context-support</artifactId>
93 88 </dependency>
... ...
b2c-orders-web/src/main/java/com/b2c/orders/web/controller/OrderController.java
... ... @@ -6,6 +6,7 @@ import java.util.Map;
6 6  
7 7 import org.springframework.beans.factory.annotation.Autowired;
8 8 import org.springframework.stereotype.Controller;
  9 +import org.springframework.web.bind.annotation.ModelAttribute;
9 10 import org.springframework.web.bind.annotation.RequestMapping;
10 11 import org.springframework.web.bind.annotation.RequestMethod;
11 12 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -13,6 +14,8 @@ import org.springframework.web.servlet.ModelAndView;
13 14  
14 15 import com.b2c.orders.domain.Order;
15 16 import com.b2c.orders.domain.OrderLog;
  17 +import com.b2c.orders.enums.OrderStatus;
  18 +import com.b2c.orders.enums.PayType;
16 19 import com.b2c.orders.enums.UserType;
17 20 import com.b2c.orders.service.OrderLogService;
18 21 import com.b2c.orders.service.OrderService;
... ... @@ -20,7 +23,6 @@ import com.b2c.orders.web.common.VelocitySupport;
20 23 import com.diligrp.website.util.dao.BaseQuery;
21 24 import com.diligrp.website.util.web.PageTemplate;
22 25  
23   -@RequestMapping("/order")
24 26 @Controller
25 27 public class OrderController extends VelocitySupport {
26 28  
... ... @@ -37,12 +39,13 @@ public class OrderController extends VelocitySupport {
37 39 @RequestMapping(value = "/list", method = RequestMethod.GET)
38 40 public ModelAndView list(BaseQuery query) {
39 41 PageTemplate pt = this.orderService.list(query, UserType.SYSTEM);
40   - return this.toVM("list", pt);
  42 + return this.toVM("list", pt).addObject("queryParam", query).addObject("orderStatusMap",
  43 + OrderStatus.getInitMaps()).addObject("payTypes", PayType.values());
41 44 }
42 45  
43 46 @RequestMapping(value = "/detail", method = RequestMethod.GET)
44 47 public ModelAndView detail(@RequestParam Long id, @RequestParam(defaultValue = "tabbasic") String tabType) {
45   - ModelAndView mav = this.toVM("detail").addObject("tabType", tabType);
  48 + ModelAndView mav = this.toVM("detail").addObject("tabType", tabType).addObject("id", id);
46 49 if (tabType.equals("tabbasic")) {
47 50 Order order = this.orderService.detail(id);
48 51 return mav.addObject("model", order);
... ...
b2c-orders-web/src/main/java/com/b2c/orders/web/restful/OrderRestController.java
... ... @@ -18,18 +18,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
18 18 import org.springframework.web.bind.annotation.RequestMethod;
19 19 import org.springframework.web.bind.annotation.RestController;
20 20  
  21 +import com.b2c.dtms.client.domain.dto.DtmsCallbackMessage;
21 22 import com.b2c.dtms.common.enums.dtms.HandleCode;
22 23 import com.b2c.dtms.domain.DtmsCallBackReturn;
23 24 import com.b2c.orders.commons.exceptions.ApplicationException;
24   -import com.b2c.orders.commons.exceptions.OrderException;
25   -import com.b2c.orders.commons.exceptions.OrderRepositoryException;
26 25 import com.b2c.orders.dao.utils.Query;
27 26 import com.b2c.orders.domain.Order;
28 27 import com.b2c.orders.domain.OrderItem;
29 28 import com.b2c.orders.domain.client.dto.request.BuyerCancelRequestDto;
30 29 import com.b2c.orders.domain.client.dto.request.BuyerConfirmRequestDto;
31   -import com.b2c.orders.domain.client.dto.request.DtmsConfirmRequestDto;
32   -import com.b2c.orders.domain.client.dto.request.DtmsTimeoutRequestDto;
33 30 import com.b2c.orders.domain.client.dto.request.OrderDetailRequestDto;
34 31 import com.b2c.orders.domain.client.dto.request.OrderListRequestDto;
35 32 import com.b2c.orders.domain.client.dto.request.OrderRemoveRequestDto;
... ... @@ -135,10 +132,10 @@ public class OrderRestController {
135 132 }
136 133  
137 134 @RequestMapping(value = "/dtmsConfirm", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
138   - public DtmsCallBackReturn dtmsConfirm(@RequestBody @Valid DtmsConfirmRequestDto dto, BindingResult br) {
  135 + public DtmsCallBackReturn dtmsConfirm(@RequestBody DtmsCallbackMessage request, BindingResult br) {
139 136 DtmsCallBackReturn response = new DtmsCallBackReturn();
140 137 try {
141   - this.orderService.dtmsConfirm(dto.getOrderId());
  138 + this.orderService.dtmsConfirm(Long.valueOf(request.getBizId()));
142 139 response.setCode(HandleCode.SUCCESS.code());
143 140 } catch (ApplicationException e) {
144 141 response.setCode(HandleCode.FAILED.code());
... ... @@ -176,10 +173,10 @@ public class OrderRestController {
176 173 }
177 174  
178 175 @RequestMapping(value = "/takenTimeout", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
179   - public DtmsCallBackReturn takenTimeout(@RequestBody @Valid DtmsTimeoutRequestDto request, BindingResult br) {
  176 + public DtmsCallBackReturn takenTimeout(@RequestBody DtmsCallbackMessage request, BindingResult br) {
180 177 DtmsCallBackReturn response = new DtmsCallBackReturn();
181 178 try {
182   - this.orderService.takenTimeout(request.getOrderId());
  179 + this.orderService.takenTimeout(Long.valueOf(request.getBizId()));
183 180 response.setCode(HandleCode.SUCCESS.code());
184 181 } catch (ApplicationException e) {
185 182 response.setCode(HandleCode.FAILED.code());
... ... @@ -189,10 +186,10 @@ public class OrderRestController {
189 186 }
190 187  
191 188 @RequestMapping(value = "/paymentTimeout", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
192   - public DtmsCallBackReturn paymentTimeout(@RequestBody @Valid DtmsTimeoutRequestDto request, BindingResult br) {
  189 + public DtmsCallBackReturn paymentTimeout(@RequestBody DtmsCallbackMessage request, BindingResult br) {
193 190 DtmsCallBackReturn response = new DtmsCallBackReturn();
194 191 try {
195   - this.orderService.paymentTimeout(request.getOrderId());
  192 + this.orderService.paymentTimeout(Long.valueOf(request.getBizId()));
196 193 response.setCode(HandleCode.SUCCESS.code());
197 194 } catch (ApplicationException e) {
198 195 response.setCode(HandleCode.FAILED.code());
... ...
b2c-orders-web/src/main/webapp/WEB-INF/vm/detail.vm
... ... @@ -19,10 +19,10 @@
19 19 <span style="font-size:16px;font-weight:bold;" class="red">$!{model.id}</span>
20 20 <ul id="tab" class="nav nav-tabs">
21 21 <li #if($!{tabType}=="tabbasic")class="active"#end>
22   - <a href="$!{domain}/order/detail?id=$!{model.id}&tabType=tabbasic">基本信息</a>
  22 + <a href="$!{domain}/detail?id=$!{id}&tabType=tabbasic">基本信息</a>
23 23 </li>
24 24 <li #if($!{tabType}=="tablog")class="active"#end>
25   - <a href="$!{domain}/order/detail?id=$!{model.id}&tabType=tablog">订单日志</a>
  25 + <a href="$!{domain}/detail?id=$!{id}&tabType=tablog">订单日志</a>
26 26 </li>
27 27 </ul>
28 28 <div class="tab-content">
... ...
b2c-orders-web/src/main/webapp/WEB-INF/vm/list.vm
1   -##<script src="$!{webUtils.getAssetsPath("/order/orderThird.js")}"></script>
  1 +<script src="$!{webUtils.getAssetsPath("/order/orderThird.js")}"></script>
2 2 <script src="$!{webUtils.getAssetsPath("/js/template.js")}"></script>
3 3 <div class="page-content">
4 4 <div id="navBar" class="page-header">
5 5 当前位置:<a href="$!{domain}/orderThird">买卖对接订单</a>
6 6 </div>
7   - <form class="well form-search" role="form" id="queryForm" action="orderThird" method="POST">
  7 + <form class="well form-search" role="form" id="queryForm" method="get" >
8 8 <table class="table-condensed table-width">
9 9 <tr>
10 10 <td class="col-md-1">订单编号</td>
11   - <td class="col-md-2"><input type="text" name="orderId" placeholder="最大允许输入19位数字" value="$!{queryParam.orderId}"></td>
  11 + <td class="col-md-2"><input type="text" id="orderId" name="param[id]" placeholder="最大允许输入19位数字" value="$!{queryParam.param.id}"></td>
12 12 <td class="col-md-1">买家手机号</td>
13   - <td class="col-md-2"><input type="text" name="buyerMobile" placeholder="请输入11位手机号码" value="$!{queryParam.buyerMobile}"></td>
14   - <td class="col-md-1">店铺类型:</td>
15   - <td class="col-md-1"> <select name="shopType">
16   - <option value="">全部</option>
17   - <option value="1" #if($!queryParam.shopType == 1) selected="selected" #end>批发商户</option>
18   - <option value="2" #if($!queryParam.shopType == 2) selected="selected" #end>产地商户</option>
19   - <option value="3" #if($!queryParam.shopType == 3) selected="selected" #end>农户商户</option>
20   - <option value="4" #if($!queryParam.shopType == 4) selected="selected" #end>零售商户</option>
21   - </select>
22   - </td>
  13 + <td class="col-md-2"><input type="text" id="buyerPhoneNumber" name="param[buyerPhoneNumber]" placeholder="请输入11位手机号码" value="$!{queryParam.param.buyerPhoneNumber}"></td>
23 14 </tr>
24 15 <tr>
25 16 <td class="col-md-1">卖家手机号</td>
26   - <td class="col-md-2"><input type="text" name="sellerMobile" placeholder="请输入11位手机号码" value="$!{queryParam.sellerMobile}"></td>
  17 + <td class="col-md-2"><input type="text" id="sellerPhoneNumber" name="param[sellerPhoneNumber]" placeholder="请输入11位手机号码" value="$!{queryParam.param.sellerPhoneNumber}"></td>
27 18 <td class="col-md-1">订单状态</td>
28 19 <td class="col-md-2">
29   - <select name="orderState">
  20 + <select name="param[orderStatus]">
30 21 <option value="">全部</option>
31   - #foreach(${item} in ${queryParam.orderManStatusList})
32   - #if($!{queryParam.orderState}==$!{item.code})
33   - <option value="$!{item.code}" selected = "selected">$!{item.name}</option>
  22 + #foreach(${item} in ${orderStatusMap.entrySet()})
  23 + #if($!{queryParam.orderStatus}==$!{item.key})
  24 + <option value="$!{item.key}" selected = "selected">$!{item.value.name}</option>
34 25 #else
35   - <option value="$!{item.code}">$!{item.name}</option>
  26 + <option value="$!{item.key}">$!{item.value.name}</option>
36 27 #end
37 28 #end
38 29 </select>
39 30 </td>
40 31 <td class="col-md-1">付款方式</td>
41 32 <td class="col-md-2">
42   - <select name="payWay" id="payType">
  33 + <select name="param[payType]" id="payType">
43 34 <option value="">全部</option>
44   - #foreach(${item} in ${queryParam.payTypeList})
45   - #if($!{queryParam.payWay}==$!{item.code})
46   - <option value="$!{item.code}" selected = "selected">$!{item.name}</option>
  35 + #foreach(${item} in ${payTypes})
  36 + #if($!{queryParam.payType}==$!{item.index})
  37 + <option value="$!{item.index}" selected = "selected">$!{item.name}</option>
47 38 #else
48   - <option value="$!{item.code}">$!{item.name}</option>
  39 + <option value="$!{item.index}">$!{item.name}</option>
49 40 #end
50 41 #end
51 42 </select>
... ... @@ -82,57 +73,12 @@
82 73 <input type="text" name="shopName" value="$!{queryParam.shopName}">
83 74 </td>
84 75 </tr>
85   - <tr>
86   - <td>
87   - 店铺所属地
88   - </td>
89   - <td>
90   - <input type="text" name="shipingAddress" value="$!{queryParam.shipingAddress}">
91   - </td>
92   - <td>交货方式</td>
93   - <td >
94   - <select name="deliveryType" id="deliveryType">
95   - <option value="">全部</option>
96   - #foreach(${item} in ${queryParam.deliveryTypeList})
97   - #if($!{queryParam.deliveryType}==$!{item.code})
98   - <option value="$!{item.code}" selected = "selected">$!{item.name}</option>
99   - #else
100   - <option value="$!{item.code}">$!{item.name}</option>
101   - #end
102   - #end
103   - </select>
104   - </td>
105   - <td>下单终端</td>
106   - <td>
107   - #if($!{queryParam.selectedComeFromList} && $!{queryParam.selectedComeFromList.size()}>0)
108   - #foreach(${item} in ${queryParam.comeFromList})
109   - #foreach(${selectedComeFromValue} in ${queryParam.selectedComeFromList})
110   - #if(${item.index}==${selectedComeFromValue})
111   - #set($isSelected=1)
112   - #break
113   - #else
114   - #set($isSelected=0)
115   - #end
116   - #end
117   - #if($isSelected==1)
118   - <input type="checkbox" name="selectedComeFromList" checked value="${item.index}"/>${item.name}
119   - #else
120   - <input type="checkbox" name="selectedComeFromList" value="${item.index}"/>${item.name}
121   - #end
122   - #end
123   - #else
124   - #foreach(${item} in ${queryParam.comeFromList})
125   - <input type="checkbox" name="selectedComeFromList" value="${item.index}"/>${item.name}
126   - #end
127   - #end
128   - </td>
129   - </tr>
130 76 <tr>
131 77 <td>下单日期</td>
132 78 <td colspan='5'>
133   - <input name="orderBeginTime" id="orderBeginTime" readonly value="$!{queryParam.orderBeginTime}" onClick="WdatePicker({dateFmt:'yyyy-M-d HH:mm:ss',startDate:'%y-%M-%d 00:00:00'})" type="text" placeholder="开始时间"/>
  79 + <input name="param[submitBeginTime]" id="submitBeginTime" readonly value="$!{queryParam.submitBeginTime}" onClick="WdatePicker({dateFmt:'yyyy-M-d HH:mm:ss',startDate:'%y-%M-%d 00:00:00'})" type="text" placeholder="开始时间"/>
134 80 -
135   - <input name="orderEndTime" id="orderEndTime" readonly value="$!{queryParam.orderEndTime}" onClick="WdatePicker({dateFmt:'yyyy-M-d HH:mm:ss',startDate:'%y-%M-%d 23:59:59'})" type="text" placeholder="结束时间"/>
  81 + <input name="param[submitBeginTime]" id="submitEndTime" readonly value="$!{queryParam.submitEndTime}" onClick="WdatePicker({dateFmt:'yyyy-M-d HH:mm:ss',startDate:'%y-%M-%d 23:59:59'})" type="text" placeholder="结束时间"/>
136 82 </td>
137 83 </tr>
138 84 </table>
... ... @@ -182,7 +128,7 @@
182 128 $dateTool.format('yyyy-MM-dd HH:mm:ss',$!{item.submitTime})
183 129 </td>
184 130 <td class="textC">
185   - <a data="$!{item.id}" href="$!{domain}/order/detail?id=$!{item.id}">查看</a>
  131 + <a data="$!{item.id}" href="$!{domain}/detail?id=$!{item.id}">查看</a>
186 132 </td>
187 133 </tr>
188 134 <tr id="collapseOrderItem$!{item.id}" class="accordion-body collapse">
... ...
b2c-orders-web/src/main/webapp/assets/order/orderThird.js
... ... @@ -9,12 +9,12 @@ $(document).ready(function(){
9 9 minlength:0,
10 10 digits:true
11 11 },
12   - buyerMobile:{
  12 + buyerPhoneNumber:{
13 13 maxlength:11,
14 14 minlength:11,
15 15 digits:true
16 16 },
17   - sellerMobile:{
  17 + sellerPhoneNumber:{
18 18 maxlength:11,
19 19 minlength:11,
20 20 digits:true
... ...
... ... @@ -8,7 +8,16 @@
8 8  
9 9 <properties>
10 10  
11   - <orders.cache.main.key>1n4j_orders:data</orders.cache.main.key>
  11 + <manweb.token></manweb.token>
  12 + <manweb.baseUrl>http://manweb.zandeapp.com/</manweb.baseUrl>
  13 + <orders.cache.main.key>zandeapp_orders:data</orders.cache.main.key>
  14 + <orders.domain>orders.zandeapp.com</orders.domain>
  15 + <orders.takenTimeoutCallUrlKey>ORDER_TAKEN_TIMEOUT_CALL_URL</orders.takenTimeoutCallUrlKey>
  16 + <orders.paymentTimeoutCallUrlKey>ORDER_PAYMENT_TIMEOUT_CALL_URL</orders.paymentTimeoutCallUrlKey>
  17 + <orders.takenTimeoutSecondsKey>ORDER_TAKEN_TIMEOUT_SECONDS</orders.takenTimeoutSecondsKey>
  18 + <orders.paymentTimeoutSecondsKey>ORDER_PAYMENT_TIMEOUT_SECONDS</orders.paymentTimeoutSecondsKey>
  19 + <orders.confirmTimeoutCallUrlKey>ORDER_CONFIRM_TIMEOUT_CALL_URL</orders.confirmTimeoutCallUrlKey>
  20 + <orders.confirmTimeoutSecondsKey>ORDER_CONFIRM_TIMEOUT_SECONDS</orders.confirmTimeoutSecondsKey>
12 21 <!--订单获系统缓存开关 -->
13 22 <orders.cache.enabled>true</orders.cache.enabled>
14 23 <!--统一管理平台配置 -->
... ... @@ -72,6 +81,16 @@
72 81 <dependencyManagement>
73 82 <dependencies>
74 83 <dependency>
  84 + <groupId>com.b2c.website.web</groupId>
  85 + <artifactId>diligrp-website-api</artifactId>
  86 + <version>1.0.5-SNAPSHOT</version>
  87 + </dependency>
  88 + <dependency>
  89 + <groupId>com.b2c.dtms</groupId>
  90 + <artifactId>dtms-client</artifactId>
  91 + <version>0.0.2-SNAPSHOT</version>
  92 + </dependency>
  93 + <dependency>
75 94 <groupId>redis.clients</groupId>
76 95 <artifactId>jedis</artifactId>
77 96 <version>2.9.0</version>
... ...