Authored by sailing-PC\sailing

Merge branch 'master' into dev

# Conflicts:
#	order/src/main/java/com/yohoufo/order/controller/BuyerOrderController.java
Showing 19 changed files with 423 additions and 149 deletions
@@ -29,4 +29,30 @@ public class AddressUtil { @@ -29,4 +29,30 @@ public class AddressUtil {
29 return -1; 29 return -1;
30 30
31 } 31 }
  32 +
  33 +
  34 + /**
  35 + * 加密地址
  36 + * @param str
  37 + * @return
  38 + */
  39 + public static String getEncryptStr(String str){
  40 +
  41 + String encryptStr = str;
  42 + try{
  43 + encryptStr = AES.encrypt(DynamicPropertyFactory.getInstance().getStringProperty("password.aes.key", "yoho9646yoho9646").get(), str);
  44 + }catch (Exception e){
  45 + logger.error("getEncryptStr failed. str is {}, e is {}", str, e);
  46 + }
  47 +
  48 + logger.info("getEncryptStr, str is {}, encryptStr is {}", str, encryptStr);
  49 +
  50 + return encryptStr;
  51 +
  52 + }
  53 +
  54 +
  55 + public static void main(String[] args){
  56 + System.out.println(getEncryptStr("2395724"));
  57 + }
32 } 58 }
@@ -11,7 +11,7 @@ public class BuyerOrder { @@ -11,7 +11,7 @@ public class BuyerOrder {
11 11
12 private Integer sellerUid; 12 private Integer sellerUid;
13 13
14 - private Byte clientType; 14 + private Integer clientType;
15 15
16 private Byte payment; 16 private Byte payment;
17 17
@@ -29,10 +29,12 @@ public class BuyerOrder { @@ -29,10 +29,12 @@ public class BuyerOrder {
29 29
30 private Integer updateTime; 30 private Integer updateTime;
31 31
32 - private Byte orderStatus;  
33 -  
34 private String channelNo; 32 private String channelNo;
35 33
  34 + private Integer buyerOrderStatus;
  35 +
  36 + private Integer sellerOrderStatus;
  37 +
36 public Integer getId() { 38 public Integer getId() {
37 return id; 39 return id;
38 } 40 }
@@ -65,11 +67,11 @@ public class BuyerOrder { @@ -65,11 +67,11 @@ public class BuyerOrder {
65 this.sellerUid = sellerUid; 67 this.sellerUid = sellerUid;
66 } 68 }
67 69
68 - public Byte getClientType() { 70 + public Integer getClientType() {
69 return clientType; 71 return clientType;
70 } 72 }
71 73
72 - public void setClientType(Byte clientType) { 74 + public void setClientType(Integer clientType) {
73 this.clientType = clientType; 75 this.clientType = clientType;
74 } 76 }
75 77
@@ -137,12 +139,21 @@ public class BuyerOrder { @@ -137,12 +139,21 @@ public class BuyerOrder {
137 this.updateTime = updateTime; 139 this.updateTime = updateTime;
138 } 140 }
139 141
140 - public Byte getOrderStatus() {  
141 - return orderStatus; 142 +
  143 + public Integer getBuyerOrderStatus() {
  144 + return buyerOrderStatus;
  145 + }
  146 +
  147 + public void setBuyerOrderStatus(Integer buyerOrderStatus) {
  148 + this.buyerOrderStatus = buyerOrderStatus;
  149 + }
  150 +
  151 + public Integer getSellerOrderStatus() {
  152 + return sellerOrderStatus;
142 } 153 }
143 154
144 - public void setOrderStatus(Byte orderStatus) {  
145 - this.orderStatus = orderStatus; 155 + public void setSellerOrderStatus(Integer sellerOrderStatus) {
  156 + this.sellerOrderStatus = sellerOrderStatus;
146 } 157 }
147 158
148 public String getChannelNo() { 159 public String getChannelNo() {
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <result column="uid" jdbcType="INTEGER" property="uid" /> 6 <result column="uid" jdbcType="INTEGER" property="uid" />
7 <result column="order_code" jdbcType="BIGINT" property="orderCode" /> 7 <result column="order_code" jdbcType="BIGINT" property="orderCode" />
8 <result column="seller_uid" jdbcType="INTEGER" property="sellerUid" /> 8 <result column="seller_uid" jdbcType="INTEGER" property="sellerUid" />
9 - <result column="client_type" jdbcType="TINYINT" property="clientType" /> 9 + <result column="client_type" jdbcType="INTEGER" property="clientType" />
10 <result column="payment" jdbcType="TINYINT" property="payment" /> 10 <result column="payment" jdbcType="TINYINT" property="payment" />
11 <result column="payment_type" jdbcType="TINYINT" property="paymentType" /> 11 <result column="payment_type" jdbcType="TINYINT" property="paymentType" />
12 <result column="is_cancel" jdbcType="TINYINT" property="isCancel" /> 12 <result column="is_cancel" jdbcType="TINYINT" property="isCancel" />
@@ -15,12 +15,13 @@ @@ -15,12 +15,13 @@
15 <result column="status" jdbcType="TINYINT" property="status" /> 15 <result column="status" jdbcType="TINYINT" property="status" />
16 <result column="create_time" jdbcType="INTEGER" property="createTime" /> 16 <result column="create_time" jdbcType="INTEGER" property="createTime" />
17 <result column="update_time" jdbcType="INTEGER" property="updateTime" /> 17 <result column="update_time" jdbcType="INTEGER" property="updateTime" />
18 - <result column="order_status" jdbcType="TINYINT" property="orderStatus" /> 18 + <result column="buyer_order_status" jdbcType="INTEGER" property="buyerOrderStatus" />
  19 + <result column="seller_order_status" jdbcType="INTEGER" property="sellerOrderStatus" />
19 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" /> 20 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
20 </resultMap> 21 </resultMap>
21 <sql id="Base_Column_List"> 22 <sql id="Base_Column_List">
22 id, uid, order_code, seller_uid, client_type, payment, payment_type, is_cancel, amount, 23 id, uid, order_code, seller_uid, client_type, payment, payment_type, is_cancel, amount,
23 - ship_fee, status, create_time, update_time, order_status, channel_no 24 + ship_fee, status, create_time, update_time, buyer_order_status, seller_order_status, channel_no
24 </sql> 25 </sql>
25 26
26 27
@@ -39,7 +40,7 @@ @@ -39,7 +40,7 @@
39 from buyer_order 40 from buyer_order
40 where 41 where
41 uid = #{uid,jdbcType=INTEGER} 42 uid = #{uid,jdbcType=INTEGER}
42 - and order_status = 1 43 + and buyer_order_status = 1
43 <if test="status != null"> 44 <if test="status != null">
44 and status in 45 and status in
45 <foreach item="item" index="index" collection="status" open="(" separator="," close=")"> 46 <foreach item="item" index="index" collection="status" open="(" separator="," close=")">
@@ -55,7 +56,7 @@ @@ -55,7 +56,7 @@
55 from buyer_order 56 from buyer_order
56 where 57 where
57 uid = #{uid,jdbcType=INTEGER} 58 uid = #{uid,jdbcType=INTEGER}
58 - and order_status = 1 59 + and buyer_order_status = 1
59 <if test="status != null"> 60 <if test="status != null">
60 and status in 61 and status in
61 <foreach item="item" index="index" collection="status" open="(" separator="," close=")"> 62 <foreach item="item" index="index" collection="status" open="(" separator="," close=")">
@@ -74,7 +75,7 @@ @@ -74,7 +75,7 @@
74 from buyer_order 75 from buyer_order
75 where order_code = #{orderCode,jdbcType=BIGINT} 76 where order_code = #{orderCode,jdbcType=BIGINT}
76 and uid = #{uid,jdbcType=INTEGER} 77 and uid = #{uid,jdbcType=INTEGER}
77 - and order_status = 1 78 + and buyer_order_status = 1
78 limit 1 79 limit 1
79 </select> 80 </select>
80 81
@@ -83,17 +84,18 @@ @@ -83,17 +84,18 @@
83 delete from buyer_order 84 delete from buyer_order
84 where id = #{id,jdbcType=INTEGER} 85 where id = #{id,jdbcType=INTEGER}
85 </delete> 86 </delete>
  87 +
86 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrder" useGeneratedKeys="true"> 88 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrder" useGeneratedKeys="true">
87 insert into buyer_order (uid, order_code, seller_uid, 89 insert into buyer_order (uid, order_code, seller_uid,
88 client_type, payment, payment_type, 90 client_type, payment, payment_type,
89 is_cancel, amount, ship_fee, 91 is_cancel, amount, ship_fee,
90 status, create_time, update_time, 92 status, create_time, update_time,
91 - order_status, channel_no) 93 + buyer_order_status, seller_order_status, channel_no)
92 values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{sellerUid,jdbcType=INTEGER}, 94 values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{sellerUid,jdbcType=INTEGER},
93 - #{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT}, #{paymentType,jdbcType=TINYINT}, 95 + #{clientType,jdbcType=INTEGER}, #{payment,jdbcType=TINYINT}, #{paymentType,jdbcType=TINYINT},
94 #{isCancel,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL}, 96 #{isCancel,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL},
95 #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, 97 #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
96 - #{orderStatus,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR}) 98 + #{buyerOrderStatus,jdbcType=INTEGER}, #{sellerOrderStatus,jdbcType=INTEGER}, #{channelNo,jdbcType=VARCHAR})
97 </insert> 99 </insert>
98 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrder" useGeneratedKeys="true"> 100 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrder" useGeneratedKeys="true">
99 insert into buyer_order 101 insert into buyer_order
@@ -134,8 +136,11 @@ @@ -134,8 +136,11 @@
134 <if test="updateTime != null"> 136 <if test="updateTime != null">
135 update_time, 137 update_time,
136 </if> 138 </if>
137 - <if test="orderStatus != null">  
138 - order_status, 139 + <if test="buyerOrderStatus != null">
  140 + buyer_order_status,
  141 + </if>
  142 + <if test="sellerOrderStatus != null">
  143 + seller_order_status,
139 </if> 144 </if>
140 <if test="channelNo != null"> 145 <if test="channelNo != null">
141 channel_no, 146 channel_no,
@@ -178,8 +183,11 @@ @@ -178,8 +183,11 @@
178 <if test="updateTime != null"> 183 <if test="updateTime != null">
179 #{updateTime,jdbcType=INTEGER}, 184 #{updateTime,jdbcType=INTEGER},
180 </if> 185 </if>
181 - <if test="orderStatus != null">  
182 - #{orderStatus,jdbcType=TINYINT}, 186 + <if test="buyerOrderStatus != null">
  187 + #{buyerOrderStatus,jdbcType=INTEGER},
  188 + </if>
  189 + <if test="sellerOrderStatus != null">
  190 + #{sellerOrderStatus,jdbcType=INTEGER},
183 </if> 191 </if>
184 <if test="channelNo != null"> 192 <if test="channelNo != null">
185 #{channelNo,jdbcType=VARCHAR}, 193 #{channelNo,jdbcType=VARCHAR},
@@ -225,8 +233,11 @@ @@ -225,8 +233,11 @@
225 <if test="updateTime != null"> 233 <if test="updateTime != null">
226 update_time = #{updateTime,jdbcType=INTEGER}, 234 update_time = #{updateTime,jdbcType=INTEGER},
227 </if> 235 </if>
228 - <if test="orderStatus != null">  
229 - order_status = #{orderStatus,jdbcType=TINYINT}, 236 + <if test="buyerOrderStatus != null">
  237 + buyer_order_status = #{buyerOrderStatus,jdbcType=INTEGER},
  238 + </if>
  239 + <if test="sellerOrderStatus != null">
  240 + seller_order_status = #{sellerOrderStatus,jdbcType=INTEGER},
230 </if> 241 </if>
231 <if test="channelNo != null"> 242 <if test="channelNo != null">
232 channel_no = #{channelNo,jdbcType=VARCHAR}, 243 channel_no = #{channelNo,jdbcType=VARCHAR},
@@ -248,7 +259,8 @@ @@ -248,7 +259,8 @@
248 status = #{status,jdbcType=TINYINT}, 259 status = #{status,jdbcType=TINYINT},
249 create_time = #{createTime,jdbcType=INTEGER}, 260 create_time = #{createTime,jdbcType=INTEGER},
250 update_time = #{updateTime,jdbcType=INTEGER}, 261 update_time = #{updateTime,jdbcType=INTEGER},
251 - order_status = #{orderStatus,jdbcType=TINYINT}, 262 + buyer_order_status = #{buyerOrderStatus,jdbcType=INTEGER},
  263 + seller_order_status = #{sellerOrderStatus,jdbcType=INTEGER},
252 channel_no = #{channelNo,jdbcType=VARCHAR} 264 channel_no = #{channelNo,jdbcType=VARCHAR}
253 where id = #{id,jdbcType=INTEGER} 265 where id = #{id,jdbcType=INTEGER}
254 </update> 266 </update>
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 </select> 59 </select>
60 <update id="addStorageNum"> 60 <update id="addStorageNum">
61 update storage set storage_num = storage_num + #{storageNum,jdbcType=INTEGER}, 61 update storage set storage_num = storage_num + #{storageNum,jdbcType=INTEGER},
62 - update_time = #{updateTime,jdbcType=INTEGER}, 62 + update_time = unix_timestamp()
63 where id = #{storageId,jdbcType=INTEGER} 63 where id = #{storageId,jdbcType=INTEGER}
64 </update> 64 </update>
65 65
@@ -61,12 +61,12 @@ @@ -61,12 +61,12 @@
61 </select> 61 </select>
62 <update id="saleSkup" parameterType="java.lang.Integer"> 62 <update id="saleSkup" parameterType="java.lang.Integer">
63 update storage_price set status = 2, 63 update storage_price set status = 2,
64 - update_time = unix_timestamp(), 64 + update_time = unix_timestamp()
65 where skup = #{skup,jdbcType=INTEGER} and status = 1 65 where skup = #{skup,jdbcType=INTEGER} and status = 1
66 </update> 66 </update>
67 <update id="cancelSaleSkup" parameterType="java.lang.Integer"> 67 <update id="cancelSaleSkup" parameterType="java.lang.Integer">
68 update storage_price set status = 1, 68 update storage_price set status = 1,
69 - update_time = unix_timestamp(), 69 + update_time = unix_timestamp()
70 where skup = #{skup,jdbcType=INTEGER} and status = 2 70 where skup = #{skup,jdbcType=INTEGER} and status = 2
71 </update> 71 </update>
72 <select id="selectLeastPrice" resultMap="BaseResultMap"> 72 <select id="selectLeastPrice" resultMap="BaseResultMap">
  1 +package com.yohoufo.order.common;
  2 +
  3 +public enum ClientType {
  4 +
  5 + PC(1, "pc"),
  6 + IPHONE(3, "iphone"),
  7 + ANDROID(4, "android"),
  8 + IPAD(5, "ipad"),
  9 + H5(6, "h5");
  10 +
  11 + int code;
  12 +
  13 + String value;
  14 +
  15 + ClientType(int code, String value) {
  16 + this.code = code;
  17 + this.value = value;
  18 + }
  19 +
  20 + public int getCode() {
  21 + return code;
  22 + }
  23 +
  24 + /**
  25 + *
  26 + * @param value
  27 + * @return
  28 + */
  29 + public static int getClientType(String value){
  30 + for(ClientType v : values()){
  31 + if(v.value.equals(value)){
  32 + return v.getCode();
  33 + }
  34 + }
  35 + return -1;
  36 + }
  37 +}
@@ -2,8 +2,8 @@ package com.yohoufo.order.common; @@ -2,8 +2,8 @@ package com.yohoufo.order.common;
2 2
3 public enum Payment { 3 public enum Payment {
4 4
5 - ALIPAY(1, "trade.precreate", "支付宝"),  
6 - WECHAT(2, "wx.unifiedOrder", "微信"); 5 + ALIPAY(2, "trade.precreate", "支付宝"),
  6 + WECHAT(1, "wx.unifiedOrder", "微信");
7 7
8 int code; 8 int code;
9 9
@@ -22,7 +22,7 @@ public interface OrderConstant { @@ -22,7 +22,7 @@ public interface OrderConstant {
22 22
23 String MONEY_SIGN = "¥"; 23 String MONEY_SIGN = "¥";
24 24
25 - String PLUS_SIGN = "+"; 25 + String PLUS_SIGN = "+ ";
26 26
27 String DAMAGES_DESC = "如卖家原因导致交易失败,您将获得赔偿金"; 27 String DAMAGES_DESC = "如卖家原因导致交易失败,您将获得赔偿金";
28 28
@@ -3,6 +3,7 @@ package com.yohoufo.order.controller; @@ -3,6 +3,7 @@ package com.yohoufo.order.controller;
3 import com.yohoufo.common.ApiResponse; 3 import com.yohoufo.common.ApiResponse;
4 import com.yohoufo.order.request.OrderListRequest; 4 import com.yohoufo.order.request.OrderListRequest;
5 import com.yohoufo.order.request.OrderRequest; 5 import com.yohoufo.order.request.OrderRequest;
  6 +import com.yohoufo.order.response.OrderDetailInfo;
6 import com.yohoufo.order.response.OrderListInfoRsp; 7 import com.yohoufo.order.response.OrderListInfoRsp;
7 import com.yohoufo.order.service.IBuyerOrderService; 8 import com.yohoufo.order.service.IBuyerOrderService;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +34,7 @@ public class BuyerOrderController { @@ -33,6 +34,7 @@ public class BuyerOrderController {
33 @ResponseBody 34 @ResponseBody
34 public ApiResponse getOrderList(@RequestParam("type") int type, 35 public ApiResponse getOrderList(@RequestParam("type") int type,
35 @RequestParam("uid") int uid, 36 @RequestParam("uid") int uid,
  37 + @RequestParam("tabType") String tabType,
36 @RequestParam(value = "page", required = false, defaultValue = "1") int page, 38 @RequestParam(value = "page", required = false, defaultValue = "1") int page,
37 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { 39 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
38 40
@@ -41,6 +43,7 @@ public class BuyerOrderController { @@ -41,6 +43,7 @@ public class BuyerOrderController {
41 .type(type) 43 .type(type)
42 .page(page) 44 .page(page)
43 .limit(limit) 45 .limit(limit)
  46 + .tabType(tabType)
44 .build(); 47 .build();
45 OrderListInfoRsp orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest); 48 OrderListInfoRsp orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
46 49
@@ -65,6 +68,46 @@ public class BuyerOrderController { @@ -65,6 +68,46 @@ public class BuyerOrderController {
65 .orderCode(orderCode) 68 .orderCode(orderCode)
66 .tabType(tabType) 69 .tabType(tabType)
67 .build(); 70 .build();
68 - return null; 71 + OrderDetailInfo orderDetailInfo = buyerOrderService.getOrderDetail(orderRequest);
  72 +
  73 + return new ApiResponse.ApiResponseBuilder().code(200).data(orderDetailInfo).message("订单详情").build();
  74 + }
  75 +
  76 +
  77 + /**
  78 + * 取消订单
  79 + */
  80 +
  81 + @RequestMapping(params = "method=app.buyer.cancel")
  82 + @ResponseBody
  83 + public ApiResponse cancel(@RequestParam("orderCode") long orderCode,
  84 + @RequestParam("uid") int uid) {
  85 +
  86 + OrderRequest orderRequest = OrderRequest.builder()
  87 + .uid(uid)
  88 + .orderCode(orderCode)
  89 + .build();
  90 + buyerOrderService.cancel(orderRequest);
  91 + return new ApiResponse.ApiResponseBuilder().code(200).message("取消").build();
  92 + }
  93 +
  94 +
  95 + /**
  96 + * 确认收货
  97 + * @param orderCode
  98 + * @param uid
  99 + * @return
  100 + */
  101 + @RequestMapping(params = "method=app.buyer.confirm")
  102 + @ResponseBody
  103 + public ApiResponse confirm(@RequestParam("orderCode") long orderCode,
  104 + @RequestParam("uid") int uid) {
  105 +
  106 + OrderRequest orderRequest = OrderRequest.builder()
  107 + .uid(uid)
  108 + .orderCode(orderCode)
  109 + .build();
  110 + buyerOrderService.confirm(orderRequest);
  111 + return new ApiResponse.ApiResponseBuilder().code(200).message("取消").build();
69 } 112 }
70 } 113 }
@@ -40,7 +40,7 @@ public class ShoppingController { @@ -40,7 +40,7 @@ public class ShoppingController {
40 @RequestParam(name = "skup") int skup, 40 @RequestParam(name = "skup") int skup,
41 @RequestParam(name = "channelNo") String channelNo, 41 @RequestParam(name = "channelNo") String channelNo,
42 @RequestParam(name = "addressId") String addressId, 42 @RequestParam(name = "addressId") String addressId,
43 - @RequestParam(name = "clientType") String clientType){ 43 + @RequestParam(name = "clientType", required = false) String clientType){
44 44
45 ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup).channelNo(channelNo).clientType(clientType).addressId(addressId).build(); 45 ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup).channelNo(channelNo).clientType(clientType).addressId(addressId).build();
46 OrderSubmitResponse paymentResponse = buyerOrderService.submit(request); 46 OrderSubmitResponse paymentResponse = buyerOrderService.submit(request);
@@ -54,4 +54,6 @@ public class ShoppingController { @@ -54,4 +54,6 @@ public class ShoppingController {
54 54
55 55
56 56
  57 +
  58 +
57 } 59 }
@@ -56,7 +56,7 @@ public class PaymentResponse { @@ -56,7 +56,7 @@ public class PaymentResponse {
56 56
57 private String deliveryWayName; 57 private String deliveryWayName;
58 58
59 - private int deliveryWayCost; 59 + private String deliveryWayCost;
60 } 60 }
61 61
62 62
1 package com.yohoufo.order.service; 1 package com.yohoufo.order.service;
2 2
3 import com.yohoufo.order.request.OrderListRequest; 3 import com.yohoufo.order.request.OrderListRequest;
  4 +import com.yohoufo.order.request.OrderRequest;
  5 +import com.yohoufo.order.response.OrderDetailInfo;
4 import com.yohoufo.order.response.OrderListInfoRsp; 6 import com.yohoufo.order.response.OrderListInfoRsp;
5 7
6 public interface IBuyerOrderService { 8 public interface IBuyerOrderService {
@@ -11,5 +13,27 @@ public interface IBuyerOrderService { @@ -11,5 +13,27 @@ public interface IBuyerOrderService {
11 * @param request 13 * @param request
12 * @return 14 * @return
13 */ 15 */
14 - public OrderListInfoRsp getOrderList(OrderListRequest request); 16 + OrderListInfoRsp getOrderList(OrderListRequest request);
  17 +
  18 +
  19 + /**
  20 + * 获取订单详情
  21 + * @param orderRequest
  22 + * @return
  23 + */
  24 + OrderDetailInfo getOrderDetail(OrderRequest orderRequest);
  25 +
  26 +
  27 + /**
  28 + * 取消订单
  29 + * @param orderRequest
  30 + */
  31 + public void cancel(OrderRequest orderRequest);
  32 +
  33 +
  34 + /**
  35 + * 提交订单
  36 + * @param orderRequest
  37 + */
  38 + public void confirm(OrderRequest orderRequest);
15 } 39 }
@@ -2,11 +2,11 @@ package com.yohoufo.order.service; @@ -2,11 +2,11 @@ package com.yohoufo.order.service;
2 2
3 import com.yohoufo.order.model.dto.OrderBuilder; 3 import com.yohoufo.order.model.dto.OrderBuilder;
4 4
5 -public interface IOrdeCreationService { 5 +public interface ISubmitOrderService {
6 6
7 /** 7 /**
8 * 创建订单 8 * 创建订单
9 * @param orderBuilder 9 * @param orderBuilder
10 */ 10 */
11 - public void create(OrderBuilder orderBuilder); 11 + public void doSumbitOrder(OrderBuilder orderBuilder);
12 } 12 }
@@ -49,6 +49,73 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -49,6 +49,73 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
49 BuyerOrderMetaMapper buyerOrderMetaMapper; 49 BuyerOrderMetaMapper buyerOrderMetaMapper;
50 50
51 51
  52 + /**
  53 + * 提交订单
  54 + * @param orderRequest
  55 + */
  56 + public void confirm(OrderRequest orderRequest){
  57 +
  58 + // 参数检查 ![待收货] 不合法
  59 + checkStatusAndRequest(orderRequest, OrderStatus.WAITING_RECEIVE);
  60 +
  61 + // TODO 更新状态为待收货
  62 + }
  63 +
  64 +
  65 + /**
  66 + * 取消订单
  67 + * @param orderRequest
  68 + */
  69 + public void cancel(OrderRequest orderRequest){
  70 +
  71 + // 状态 ![待付款] 不合法
  72 + checkStatusAndRequest(orderRequest, OrderStatus.WAITING_PAY);
  73 +
  74 + // TODO
  75 + // 更新订单状态
  76 + // 更新skup的状态[可售] 卖家订单为[出售中]
  77 + // 减product skup的库存
  78 +
  79 + }
  80 +
  81 + /**
  82 + *
  83 + * @param orderRequest
  84 + * @param orderStatusEx
  85 + */
  86 + private void checkStatusAndRequest(OrderRequest orderRequest, OrderStatus orderStatusEx ) {
  87 + // 参数检查
  88 + if (orderRequest.getUid() < 0
  89 + || orderRequest.getOrderCode() < 0){
  90 + logger.warn("check uid or orderCode empty");
  91 + throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
  92 + }
  93 +
  94 + // 订单存在 & 待付款的状态
  95 + // 查询订单状态
  96 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderRequest.getOrderCode(), orderRequest.getUid());
  97 + if (buyerOrder == null){
  98 + logger.warn("check orderCode exist, uid is {}, orderCode is {}",
  99 + orderRequest.getUid(), orderRequest.getOrderCode() );
  100 + throw new ServiceException(ServiceError.ORDER_NULL);
  101 + }
  102 +
  103 + // 检查 订单状态
  104 + int status = buyerOrder.getStatus() == null ? -1 : buyerOrder.getStatus().intValue();
  105 + OrderStatus orderStatus = OrderStatus.getOrderStatus(status);
  106 + if (orderStatus == null || orderStatus.getCode() != orderStatusEx.getCode()){
  107 + logger.warn("check status invalidate, uid is {}, orderCode is {}, status is {}",
  108 + orderRequest.getUid(), orderRequest.getOrderCode(), buyerOrder.getStatus());
  109 + throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
  110 + }
  111 + }
  112 +
  113 +
  114 + /**
  115 + * 获取订单详情
  116 + * @param orderRequest
  117 + * @return
  118 + */
52 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest){ 119 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest){
53 120
54 // 参数检查 121 // 参数检查
@@ -76,6 +76,36 @@ public class PaymentServiceImpl implements IPaymentService { @@ -76,6 +76,36 @@ public class PaymentServiceImpl implements IPaymentService {
76 @Autowired 76 @Autowired
77 OrderCodeGenerator orderCodeGenerator; 77 OrderCodeGenerator orderCodeGenerator;
78 78
  79 +
  80 +
  81 + public void payConfirm(PaymentRequest request){
  82 +
  83 + //
  84 +
  85 + }
  86 +
  87 +
  88 + /**
  89 + * 订单退款
  90 + * 使用场景: [卖家发布商品]页面的[不卖了],
  91 + * 后台[鉴定中心]页面的[鉴定通过],保证金退还给卖家
  92 + *
  93 + * @param request
  94 + */
  95 + public void refund(PaymentRequest request){
  96 +
  97 + // TODO 这笔钱也是提现的时候 随着 分账|划分 一起将数据给出的?
  98 +
  99 + // 入口参数检查
  100 +
  101 + // 根据订单号,反解 卖家订单号 or 买家订单号
  102 +
  103 + // 确认状态是已支付, 存在支付状态
  104 +
  105 + // 退款
  106 +
  107 + }
  108 +
79 /** 109 /**
80 * 支付 110 * 支付
81 * @param request 111 * @param request
@@ -14,7 +14,7 @@ import com.yohoufo.order.model.dto.OrderBuilder; @@ -14,7 +14,7 @@ import com.yohoufo.order.model.dto.OrderBuilder;
14 import com.yohoufo.order.request.ShoppingRequest; 14 import com.yohoufo.order.request.ShoppingRequest;
15 import com.yohoufo.order.response.OrderSubmitResponse; 15 import com.yohoufo.order.response.OrderSubmitResponse;
16 import com.yohoufo.order.response.PaymentResponse; 16 import com.yohoufo.order.response.PaymentResponse;
17 -import com.yohoufo.order.service.IOrdeCreationService; 17 +import com.yohoufo.order.service.ISubmitOrderService;
18 import com.yohoufo.order.service.IShoppingService; 18 import com.yohoufo.order.service.IShoppingService;
19 import com.yohoufo.order.service.proxy.UserProxyService; 19 import com.yohoufo.order.service.proxy.UserProxyService;
20 import com.yohoufo.order.service.support.ShoppingSupport; 20 import com.yohoufo.order.service.support.ShoppingSupport;
@@ -24,7 +24,6 @@ import org.slf4j.Logger; @@ -24,7 +24,6 @@ import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
25 import org.springframework.beans.factory.annotation.Autowired; 25 import org.springframework.beans.factory.annotation.Autowired;
26 import java.math.BigDecimal; 26 import java.math.BigDecimal;
27 -import java.util.Arrays;  
28 27
29 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
30 29
@@ -43,7 +42,7 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -43,7 +42,7 @@ public class ShoppingServiceImpl implements IShoppingService {
43 OrderCodeGenerator orderCodeGenerator; 42 OrderCodeGenerator orderCodeGenerator;
44 43
45 @Autowired 44 @Autowired
46 - IOrdeCreationService ordeCreationService; 45 + ISubmitOrderService ordeCreationService;
47 46
48 @Autowired 47 @Autowired
49 ServiceCaller serviceCaller; 48 ServiceCaller serviceCaller;
@@ -142,9 +141,12 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -142,9 +141,12 @@ public class ShoppingServiceImpl implements IShoppingService {
142 .amount(skup.getGoodsPrice().add(shipFee)) 141 .amount(skup.getGoodsPrice().add(shipFee))
143 .shipFee(shipFee) 142 .shipFee(shipFee)
144 .addressInfo(addressInfo) 143 .addressInfo(addressInfo)
  144 + .clientType(shoppingRequest.getClientType())
145 .build(); 145 .build();
146 146
147 - ordeCreationService.create(orderBuilder); 147 + ordeCreationService.doSumbitOrder(orderBuilder);
  148 +
  149 + // TODO 订单成功以后,开启15分取消消息
148 150
149 151
150 // 返回结果 152 // 返回结果
@@ -8,13 +8,13 @@ import com.yohoufo.common.ApiResponse; @@ -8,13 +8,13 @@ import com.yohoufo.common.ApiResponse;
8 import com.yohoufo.common.caller.UfoServiceCaller; 8 import com.yohoufo.common.caller.UfoServiceCaller;
9 import com.yohoufo.dal.order.*; 9 import com.yohoufo.dal.order.*;
10 import com.yohoufo.dal.order.model.*; 10 import com.yohoufo.dal.order.model.*;
  11 +import com.yohoufo.order.common.ClientType;
11 import com.yohoufo.order.common.OrderStatus; 12 import com.yohoufo.order.common.OrderStatus;
12 import com.yohoufo.order.common.SellerOrderStatus; 13 import com.yohoufo.order.common.SellerOrderStatus;
13 import com.yohoufo.order.common.SkupStatus; 14 import com.yohoufo.order.common.SkupStatus;
14 import com.yohoufo.order.constants.MetaKey; 15 import com.yohoufo.order.constants.MetaKey;
15 import com.yohoufo.order.model.dto.OrderBuilder; 16 import com.yohoufo.order.model.dto.OrderBuilder;
16 -import com.yohoufo.order.service.IOrdeCreationService;  
17 -import com.yohoufo.product.controller.ProductController; 17 +import com.yohoufo.order.service.ISubmitOrderService;
18 import org.slf4j.Logger; 18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
20 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,146 +22,165 @@ import org.springframework.stereotype.Service; @@ -22,146 +22,165 @@ import org.springframework.stereotype.Service;
22 import org.springframework.transaction.annotation.Transactional; 22 import org.springframework.transaction.annotation.Transactional;
23 23
24 @Service 24 @Service
25 -public class OrdeCreationServiceImpl implements IOrdeCreationService { 25 +public class SubmitOrderServiceImpl implements ISubmitOrderService {
26 26
27 - private final Logger logger = LoggerFactory.getLogger(OrdeCreationServiceImpl.class); 27 + private final Logger logger = LoggerFactory.getLogger(SubmitOrderServiceImpl.class);
28 28
29 @Autowired 29 @Autowired
30 - SellerOrderGoodsMapper sellerOrderGoodsMapper; 30 + OrderCreateService orderCreateService;
31 31
32 @Autowired 32 @Autowired
33 - SellerOrderMapper sellerOrderMapper; 33 + private UfoServiceCaller serviceCaller;
34 34
35 - @Autowired  
36 - BuyerOrderMapper buyerOrderMapper;  
37 35
38 - @Autowired  
39 - BuyerOrderGoodsMapper buyerOrderGoodsMapper; 36 + public void doSumbitOrder(OrderBuilder orderBuilder){
40 37
41 - @Autowired  
42 - BuyerOrderMetaMapper buyerOrderMetaMapper; 38 + // 减库存
  39 + descreaseStorage(orderBuilder);
43 40
44 - @Autowired  
45 - private UfoServiceCaller serviceCaller; 41 + // 创建订单
  42 + orderCreateService.createOrder(orderBuilder);
  43 + }
46 44
  45 + public void descreaseStorage(OrderBuilder orderBuilder){
47 46
48 - /**  
49 - * 创建订单  
50 - * @param orderBuilder  
51 - */  
52 - @Transactional  
53 - public void create(OrderBuilder orderBuilder){  
54 -  
55 - boolean increaseNeed = false;  
56 - try{  
57 -  
58 - // 扣减库存  
59 - // 入口参数:skup, product_id  
60 - ApiResponse apiResponse = serviceCaller.call("ufo.product.saleSkup",  
61 - ApiResponse.class, orderBuilder.getProductId(), orderBuilder.getSkup());  
62 - // 减库存失败  
63 - if (apiResponse.getCode() != 200){  
64 - logger.warn("submit create order, decrease storage faile, orderCode is {}, uid is {}, skup is {}, productId is {}",  
65 - orderBuilder.getOrderCode(), orderBuilder.getUid(), orderBuilder.getSkup(), orderBuilder.getProductId());  
66 - throw new ServiceException(ServiceError.ORDER_SKUP_CANNOT_SELL);  
67 - } 47 + ApiResponse apiResponse = serviceCaller.call("ufo.product.saleSkup",
  48 + ApiResponse.class, orderBuilder.getProductId(), orderBuilder.getSkup());
  49 + // 减库存失败
  50 + if (apiResponse.getCode() != 200){
  51 + logger.warn("submit create order, decrease storage faile, orderCode is {}, uid is {}, skup is {}, productId is {}",
  52 + orderBuilder.getOrderCode(), orderBuilder.getUid(), orderBuilder.getSkup(), orderBuilder.getProductId());
  53 + throw new ServiceException(ServiceError.ORDER_SKUP_CANNOT_SELL);
  54 + }
  55 + }
  56 +
  57 +
  58 +
  59 + @Service
  60 + public static class OrderCreateService{
  61 +
  62 + @Autowired
  63 + SellerOrderGoodsMapper sellerOrderGoodsMapper;
  64 +
  65 + @Autowired
  66 + SellerOrderMapper sellerOrderMapper;
  67 +
  68 + @Autowired
  69 + BuyerOrderMapper buyerOrderMapper;
  70 +
  71 + @Autowired
  72 + BuyerOrderGoodsMapper buyerOrderGoodsMapper;
  73 +
  74 + @Autowired
  75 + BuyerOrderMetaMapper buyerOrderMetaMapper;
68 76
69 - // product处减库存失败  
70 - increaseNeed = true; 77 + @Autowired
  78 + private UfoServiceCaller serviceCaller;
71 79
72 - /**  
73 - * 1.更新 表seller_order_goods skup的状态为不可售  
74 - * 2.更新 表seller_order 状态为已经售出  
75 - * 3.插入订单 表buyer_order  
76 - * 4.插入订单商品 buyer_order_goods  
77 - * 5.插入收货地址 buyer_order_meta  
78 - */  
79 80
80 - // 1.表seller_order_goods ==> 不可售  
81 - SellerOrderGoods sellerOrderGoods = updSellerOrderGoods(orderBuilder); 81 + /**
  82 + * 创建订单
  83 + * @param orderBuilder
  84 + */
  85 + @Transactional
  86 + public void createOrder(OrderBuilder orderBuilder){
82 87
83 - // 2.更新 表seller_order 状态 ==> 已售出  
84 - SellerOrder sellerOrder = updSellerOrder(orderBuilder); 88 + try{
85 89
86 - // 3.插入订单 表buyer_order  
87 - insertOrder(orderBuilder, sellerOrder.getUid()); 90 + /**
  91 + * 1.更新 表seller_order_goods skup的状态为不可售
  92 + * 2.更新 表seller_order 状态为已经售出
  93 + * 3.插入订单 表buyer_order
  94 + * 4.插入订单商品 buyer_order_goods
  95 + * 5.插入收货地址 buyer_order_meta
  96 + */
88 97
89 - // 4.插入订单商品 buyer_order_goods  
90 - insertOrderGoods(orderBuilder, sellerOrderGoods); 98 + // 1.表seller_order_goods ==> 不可售
  99 + SellerOrderGoods sellerOrderGoods = updSellerOrderGoods(orderBuilder);
91 100
92 - // 5.插入收货地址 buyer_order_meta 买家收货地址  
93 - insertOrderMeta(orderBuilder); 101 + // 2.更新 表seller_order 状态 ==> 已售出
  102 + SellerOrder sellerOrder = updSellerOrder(orderBuilder);
94 103
  104 + // 3.插入订单 表buyer_order
  105 + insertOrder(orderBuilder, sellerOrder.getUid());
95 106
96 - }catch (Exception ex){ 107 + // 4.插入订单商品 buyer_order_goods
  108 + insertOrderGoods(orderBuilder, sellerOrderGoods);
  109 +
  110 + // 5.插入收货地址 buyer_order_meta 买家收货地址
  111 + insertOrderMeta(orderBuilder);
  112 +
  113 +
  114 + }catch (Exception ex){
97 115
98 - if (increaseNeed){  
99 // order处 更新状态失败,需要补库存 116 // order处 更新状态失败,需要补库存
100 ApiResponse apiResponse = serviceCaller.call("ufo.product.cancelSaleSkup",ApiResponse.class, orderBuilder.getSkup()); 117 ApiResponse apiResponse = serviceCaller.call("ufo.product.cancelSaleSkup",ApiResponse.class, orderBuilder.getSkup());
101 // 补库存失败,需要报警手动补库存 TODO 118 // 补库存失败,需要报警手动补库存 TODO
102 if (apiResponse.getCode() != 200){ 119 if (apiResponse.getCode() != 200){
103 120
104 } 121 }
105 - }  
106 -  
107 122
108 - if (!(ex instanceof ServiceException)) {  
109 - //上报告警事件 123 + if (!(ex instanceof ServiceException)) {
  124 + //上报告警事件
110 // EventBusPublisher.publishEvent(new SmsAlarmEvent(OrderHanders.submit, "submit", "订单(" + order.getOrderCode() + ")创建失败")); 125 // EventBusPublisher.publishEvent(new SmsAlarmEvent(OrderHanders.submit, "submit", "订单(" + order.getOrderCode() + ")创建失败"));
111 - throw new ServiceException(ServiceError.SHOPPING_SUBMIT_ORDER_FAIL, ex); 126 + throw new ServiceException(ServiceError.SHOPPING_SUBMIT_ORDER_FAIL, ex);
  127 + }
  128 + throw ex;
112 } 129 }
113 - throw ex; 130 +
114 } 131 }
115 132
116 - } 133 + private void insertOrderMeta(OrderBuilder orderBuilder) {
  134 + BuyerOrderMeta buyerOrderMeta = new BuyerOrderMeta();
  135 + buyerOrderMeta.setUid(orderBuilder.getUid());
  136 + buyerOrderMeta.setOrderCode(orderBuilder.getOrderCode());
  137 + buyerOrderMeta.setMetaKey(MetaKey.BUYER_DELIVERY_ADDRESS);
  138 + buyerOrderMeta.setMetaValue(JSONObject.toJSONString(orderBuilder.getAddressInfo()));
  139 + buyerOrderMetaMapper.insert(buyerOrderMeta);
  140 + }
117 141
118 - private void insertOrderMeta(OrderBuilder orderBuilder) {  
119 - BuyerOrderMeta buyerOrderMeta = new BuyerOrderMeta();  
120 - buyerOrderMeta.setUid(orderBuilder.getUid());  
121 - buyerOrderMeta.setOrderCode(orderBuilder.getOrderCode());  
122 - buyerOrderMeta.setMetaKey(MetaKey.BUYER_DELIVERY_ADDRESS);  
123 - buyerOrderMeta.setMetaValue(JSONObject.toJSONString(orderBuilder.getAddressInfo()));  
124 - buyerOrderMetaMapper.insert(buyerOrderMeta);  
125 - } 142 + private void insertOrderGoods(OrderBuilder orderBuilder, SellerOrderGoods sellerOrderGoods) {
  143 + BuyerOrderGoods buyerOrderGoods = new BuyerOrderGoods();
  144 + buyerOrderGoods.setSkup(orderBuilder.getSkup());
  145 + buyerOrderGoods.setOrderCode(orderBuilder.getOrderCode());
  146 + buyerOrderGoods.setGoodsPrice(sellerOrderGoods.getGoodsPrice());
  147 + buyerOrderGoods.setGoodsAmount(sellerOrderGoods.getGoodsPrice());
  148 + buyerOrderGoodsMapper.insertSelective(buyerOrderGoods);
  149 + }
126 150
127 - private void insertOrderGoods(OrderBuilder orderBuilder, SellerOrderGoods sellerOrderGoods) {  
128 - BuyerOrderGoods buyerOrderGoods = new BuyerOrderGoods();  
129 - buyerOrderGoods.setSkup(orderBuilder.getSkup());  
130 - buyerOrderGoods.setOrderCode(orderBuilder.getOrderCode());  
131 - buyerOrderGoods.setGoodsPrice(sellerOrderGoods.getGoodsPrice());  
132 - buyerOrderGoods.setGoodsAmount(sellerOrderGoods.getGoodsPrice());  
133 - buyerOrderGoodsMapper.insertSelective(buyerOrderGoods);  
134 - } 151 + private void insertOrder(OrderBuilder orderBuilder, int sellerUid) {
  152 + BuyerOrder buyerOrder = new BuyerOrder();
  153 + buyerOrder.setUid(orderBuilder.getUid());
  154 + buyerOrder.setOrderCode(orderBuilder.getOrderCode());
  155 + buyerOrder.setSellerUid(sellerUid);
  156 + buyerOrder.setPaymentType((byte) orderBuilder.getPaymentType());
  157 + buyerOrder.setAmount(orderBuilder.getAmount());
  158 + buyerOrder.setShipFee(orderBuilder.getShipFee());
  159 + buyerOrder.setChannelNo(orderBuilder.getChannelNo());
  160 + int now = DateUtil.getCurrentTimeSecond();
  161 + buyerOrder.setClientType(ClientType.getClientType(orderBuilder.getClientType()));
  162 + buyerOrder.setCreateTime(now);
  163 + buyerOrder.setUpdateTime(now);
  164 + buyerOrder.setStatus((byte) OrderStatus.WAITING_PAY.getCode());
  165 + buyerOrderMapper.insert(buyerOrder);
  166 + }
135 167
136 - private void insertOrder(OrderBuilder orderBuilder, int sellerUid) {  
137 - BuyerOrder buyerOrder = new BuyerOrder();  
138 - buyerOrder.setUid(orderBuilder.getUid());  
139 - buyerOrder.setOrderCode(orderBuilder.getOrderCode());  
140 - buyerOrder.setSellerUid(sellerUid);  
141 - buyerOrder.setPaymentType((byte) orderBuilder.getPaymentType());  
142 - buyerOrder.setAmount(orderBuilder.getAmount());  
143 - buyerOrder.setShipFee(orderBuilder.getShipFee());  
144 - buyerOrder.setChannelNo(orderBuilder.getChannelNo());  
145 - int now = DateUtil.getCurrentTimeSecond();  
146 - buyerOrder.setCreateTime(now);  
147 - buyerOrder.setUpdateTime(now);  
148 - buyerOrder.setStatus((byte) OrderStatus.WAITING_PAY.getCode());  
149 - buyerOrderMapper.insert(buyerOrder);  
150 - } 168 + private SellerOrder updSellerOrder(OrderBuilder orderBuilder) {
  169 + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(orderBuilder.getSkup());
  170 + sellerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());
  171 + sellerOrder.setStatus(SellerOrderStatus.HAS_SELLED.getCode());
  172 + sellerOrderMapper.updateByPrimaryKeySelective(sellerOrder);
  173 + return sellerOrder;
  174 + }
151 175
152 - private SellerOrder updSellerOrder(OrderBuilder orderBuilder) {  
153 - SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(orderBuilder.getSkup());  
154 - sellerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());  
155 - sellerOrder.setStatus(SellerOrderStatus.HAS_SELLED.getCode());  
156 - sellerOrderMapper.updateByPrimaryKeySelective(sellerOrder);  
157 - return sellerOrder; 176 + private SellerOrderGoods updSellerOrderGoods(OrderBuilder orderBuilder) {
  177 + SellerOrderGoods sellerOrderGoods = new SellerOrderGoods();
  178 + sellerOrderGoods.setId(orderBuilder.getSkup());
  179 + sellerOrderGoods.setStatus(SkupStatus.CAN_NOT_SELL.getCode());
  180 + sellerOrderGoodsMapper.updateByPrimaryKeySelective(sellerOrderGoods);
  181 + return sellerOrderGoods;
  182 + }
158 } 183 }
159 184
160 - private SellerOrderGoods updSellerOrderGoods(OrderBuilder orderBuilder) {  
161 - SellerOrderGoods sellerOrderGoods = new SellerOrderGoods();  
162 - sellerOrderGoods.setId(orderBuilder.getSkup());  
163 - sellerOrderGoods.setStatus(SkupStatus.CAN_NOT_SELL.getCode());  
164 - sellerOrderGoodsMapper.updateByPrimaryKeySelective(sellerOrderGoods);  
165 - return sellerOrderGoods;  
166 - } 185 +
167 } 186 }
@@ -35,7 +35,7 @@ public class ShoppingSupport { @@ -35,7 +35,7 @@ public class ShoppingSupport {
35 // 快递方式 35 // 快递方式
36 PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay(); 36 PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay();
37 deliveryWay.setDeliveryWayId(OrderConstant.DELIVERY_WAY_SF); 37 deliveryWay.setDeliveryWayId(OrderConstant.DELIVERY_WAY_SF);
38 - deliveryWay.setDeliveryWayCost(OrderConstant.DELIVERY_WAY_SF_COST); 38 + deliveryWay.setDeliveryWayCost(OrderConstant.MONEY_SIGN + OrderConstant.DELIVERY_WAY_SF_COST);
39 deliveryWay.setDeliveryWayName(OrderConstant.DELIVERY_WAY_SF_NAME); 39 deliveryWay.setDeliveryWayName(OrderConstant.DELIVERY_WAY_SF_NAME);
40 return deliveryWay; 40 return deliveryWay;
41 } 41 }
@@ -48,6 +48,7 @@ public class ShoppingSupport { @@ -48,6 +48,7 @@ public class ShoppingSupport {
48 */ 48 */
49 public GoodsInfo getGoodsInfo(SellerOrderGoods skup) { 49 public GoodsInfo getGoodsInfo(SellerOrderGoods skup) {
50 GoodsInfo goods = new GoodsInfo(); 50 GoodsInfo goods = new GoodsInfo();
  51 + goods.setSkup(skup.getId());
51 goods.setProductName(skup.getProductName()); 52 goods.setProductName(skup.getProductName());
52 goods.setColorId(skup.getColorId() == null ? 0 : skup.getColorId()); 53 goods.setColorId(skup.getColorId() == null ? 0 : skup.getColorId());
53 goods.setColorName(skup.getColorName()); 54 goods.setColorName(skup.getColorName());
@@ -216,7 +216,7 @@ public class ProductServiceImpl implements ProductService{ @@ -216,7 +216,7 @@ public class ProductServiceImpl implements ProductService{
216 if (storageId == null) { 216 if (storageId == null) {
217 StoragePrice sp = storagePriceMapper.selectBySkup(skup); 217 StoragePrice sp = storagePriceMapper.selectBySkup(skup);
218 storageId = sp.getStorageId(); 218 storageId = sp.getStorageId();
219 - if (storageId == null) { 219 + if (sp == null || (storageId = sp.getStorageId()) == null) {
220 LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId, 220 LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId,
221 num); 221 num);
222 } 222 }