Authored by chenchao

save one new goods of seller with skup-type

@@ -51,6 +51,9 @@ public class SellerOrderGoods { @@ -51,6 +51,9 @@ public class SellerOrderGoods {
51 @Getter@Setter 51 @Getter@Setter
52 private Integer storageNum; 52 private Integer storageNum;
53 53
  54 + @Getter@Setter
  55 + private Integer attributes;
  56 +
54 public String getImageUrl() { 57 public String getImageUrl() {
55 return imageUrl; 58 return imageUrl;
56 } 59 }
@@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
18 <result column="buyer_order_status" jdbcType="INTEGER" property="buyerOrderStatus" /> 18 <result column="buyer_order_status" jdbcType="INTEGER" property="buyerOrderStatus" />
19 <result column="seller_order_status" jdbcType="INTEGER" property="sellerOrderStatus" /> 19 <result column="seller_order_status" jdbcType="INTEGER" property="sellerOrderStatus" />
20 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" /> 20 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
21 -  
22 <result column="attributes" jdbcType="INTEGER" property="attributes" /> 21 <result column="attributes" jdbcType="INTEGER" property="attributes" />
23 </resultMap> 22 </resultMap>
24 <sql id="Base_Column_List"> 23 <sql id="Base_Column_List">
@@ -19,15 +19,16 @@ @@ -19,15 +19,16 @@
19 <result column="batch_no" jdbcType="BIGINT" property="batchNo" /> 19 <result column="batch_no" jdbcType="BIGINT" property="batchNo" />
20 <result column="num" jdbcType="INTEGER" property="num" /> 20 <result column="num" jdbcType="INTEGER" property="num" />
21 <result column="skup_list" jdbcType="VARCHAR" property="skupList" /> 21 <result column="skup_list" jdbcType="VARCHAR" property="skupList" />
  22 + <result column="attributes" jdbcType="INTEGER" property="attributes" />
22 </resultMap> 23 </resultMap>
23 <sql id="Base_Column_List"> 24 <sql id="Base_Column_List">
24 id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name, 25 id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name,
25 - color_id, color_name, goods_price, status, image_url, is_del, batch_no 26 + color_id, color_name, goods_price, status, image_url, is_del, batch_no, attributes
26 </sql> 27 </sql>
27 28
28 <sql id="Associated_Base_Column_List"> 29 <sql id="Associated_Base_Column_List">
29 sog.id, sog.uid, sog.product_id, sog.product_name, sog.storage_id, sog.depot_no, sog.size_id, sog.size_name, 30 sog.id, sog.uid, sog.product_id, sog.product_name, sog.storage_id, sog.depot_no, sog.size_id, sog.size_name,
30 - sog.color_id, sog.color_name, sog.goods_price, sog.status, sog.image_url, sog.is_del, sog.batch_no 31 + sog.color_id, sog.color_name, sog.goods_price, sog.status, sog.image_url, sog.is_del, sog.batch_no, sog.attributes
31 </sql> 32 </sql>
32 <select id="selectByPrimaryKey" resultMap="BaseResultMap"> 33 <select id="selectByPrimaryKey" resultMap="BaseResultMap">
33 select 34 select
@@ -192,6 +193,9 @@ @@ -192,6 +193,9 @@
192 <if test="batchNo != null"> 193 <if test="batchNo != null">
193 batch_no, 194 batch_no,
194 </if> 195 </if>
  196 + <if test="attributes != null">
  197 + attributes,
  198 + </if>
195 </trim> 199 </trim>
196 <trim prefix="values (" suffix=")" suffixOverrides=","> 200 <trim prefix="values (" suffix=")" suffixOverrides=",">
197 <if test="productId != null"> 201 <if test="productId != null">
@@ -233,11 +237,12 @@ @@ -233,11 +237,12 @@
233 <if test="batchNo != null"> 237 <if test="batchNo != null">
234 #{batchNo,jdbcType=BIGINT}, 238 #{batchNo,jdbcType=BIGINT},
235 </if> 239 </if>
  240 + <if test="attributes != null">
  241 + #{attributes,jdbcType=INTEGER},
  242 + </if>
236 </trim> 243 </trim>
237 </insert> 244 </insert>
238 245
239 -  
240 -  
241 <update id="updateStatusBySkpu" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods"> 246 <update id="updateStatusBySkpu" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods">
242 update seller_order_goods 247 update seller_order_goods
243 <set> 248 <set>
1 package com.yohoufo.order.convert; 1 package com.yohoufo.order.convert;
2 2
3 import com.yohobuy.ufo.model.order.common.SkupStatus; 3 import com.yohobuy.ufo.model.order.common.SkupStatus;
  4 +import com.yohobuy.ufo.model.order.constants.SkupType;
4 import com.yohoufo.common.helper.ImageUrlAssist; 5 import com.yohoufo.common.helper.ImageUrlAssist;
5 import com.yohoufo.dal.order.model.SellerOrderGoods; 6 import com.yohoufo.dal.order.model.SellerOrderGoods;
6 import com.yohoufo.order.model.response.GoodsInfo; 7 import com.yohoufo.order.model.response.GoodsInfo;
7 8
  9 +import java.util.Optional;
  10 +
8 /** 11 /**
9 * Created by chao.chen on 2018/11/2. 12 * Created by chao.chen on 2018/11/2.
10 */ 13 */
@@ -47,6 +50,8 @@ public class GoodsInfoConvertor { @@ -47,6 +50,8 @@ public class GoodsInfoConvertor {
47 sellerOrderGoods.setSizeName(goodsInfo.getSizeName()); 50 sellerOrderGoods.setSizeName(goodsInfo.getSizeName());
48 sellerOrderGoods.setImageUrl(goodsInfo.getImageUrl()); 51 sellerOrderGoods.setImageUrl(goodsInfo.getImageUrl());
49 sellerOrderGoods.setBatchNo(goodsInfo.getBatchNo()); 52 sellerOrderGoods.setBatchNo(goodsInfo.getBatchNo());
  53 + //default is in-stock
  54 + sellerOrderGoods.setAttributes(Optional.ofNullable(goodsInfo.getSkupType()).orElse(SkupType.IN_STOCK).prdAttributes().getCode());
50 return sellerOrderGoods; 55 return sellerOrderGoods;
51 } 56 }
52 } 57 }
1 package com.yohoufo.order.model; 1 package com.yohoufo.order.model;
2 2
3 import com.yohobuy.ufo.model.order.bo.GoodsInfo; 3 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
  4 +import com.yohobuy.ufo.model.order.constants.SkupType;
4 import com.yohobuy.ufo.model.order.vo.AddressInfo; 5 import com.yohobuy.ufo.model.order.vo.AddressInfo;
5 import com.yohoufo.dal.order.model.SellerOrderGoods; 6 import com.yohoufo.dal.order.model.SellerOrderGoods;
6 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 7 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
@@ -47,4 +48,9 @@ public class SellerOrderContext { @@ -47,4 +48,9 @@ public class SellerOrderContext {
47 private transient SellerOrderGoods sellerOrderGoods; 48 private transient SellerOrderGoods sellerOrderGoods;
48 49
49 private String priceOverFlowTips; 50 private String priceOverFlowTips;
  51 +
  52 + /**
  53 + * 现货 or 预售
  54 + */
  55 + private SkupType skupType;
50 } 56 }
@@ -5,6 +5,7 @@ import com.yoho.error.exception.ServiceException; @@ -5,6 +5,7 @@ import com.yoho.error.exception.ServiceException;
5 import com.yohobuy.ufo.model.order.bo.GoodsInfo; 5 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
6 import com.yohobuy.ufo.model.order.common.SellerWalletType; 6 import com.yohobuy.ufo.model.order.common.SellerWalletType;
7 import com.yohobuy.ufo.model.order.constants.OrderConstant; 7 import com.yohobuy.ufo.model.order.constants.OrderConstant;
  8 +import com.yohobuy.ufo.model.order.constants.SkupType;
8 import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; 9 import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
9 import com.yohobuy.ufo.model.response.StorageDataResp; 10 import com.yohobuy.ufo.model.response.StorageDataResp;
10 import com.yohoufo.common.exception.GatewayException; 11 import com.yohoufo.common.exception.GatewayException;
@@ -105,7 +106,6 @@ public class SellerOrderPrepareProcessor { @@ -105,7 +106,6 @@ public class SellerOrderPrepareProcessor {
105 } 106 }
106 107
107 //the address of send back 2 seller 108 //the address of send back 2 seller
108 - //  
109 AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); 109 AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId);
110 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); 110 AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId);
111 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){ 111 if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){
@@ -144,6 +144,9 @@ public class SellerOrderPrepareProcessor { @@ -144,6 +144,9 @@ public class SellerOrderPrepareProcessor {
144 log.info("in buildSellerOrderContext , uid {}, storageId {}, price {}, computeResult {}", uid, storageId, 144 log.info("in buildSellerOrderContext , uid {}, storageId {}, price {}, computeResult {}", uid, storageId,
145 goodsInfo.getPrice(), computeResult); 145 goodsInfo.getPrice(), computeResult);
146 context.setSellerOrderComputeResult(computeResult); 146 context.setSellerOrderComputeResult(computeResult);
  147 + //
  148 + SkupType skupType = SkupType.getSkupType(req.getSkupType());
  149 + context.setSkupType(skupType);
147 return context; 150 return context;
148 } 151 }
149 152
@@ -171,6 +174,7 @@ public class SellerOrderPrepareProcessor { @@ -171,6 +174,7 @@ public class SellerOrderPrepareProcessor {
171 goodsInfo.setImageUrl(prdResp.getImageUrl()); 174 goodsInfo.setImageUrl(prdResp.getImageUrl());
172 goodsInfo.setPrice(salePrice); 175 goodsInfo.setPrice(salePrice);
173 goodsInfo.setStorageId(context.getStorageId()); 176 goodsInfo.setStorageId(context.getStorageId());
  177 + goodsInfo.setSkupType(context.getSkupType());
174 return goodsInfo; 178 return goodsInfo;
175 }catch (Exception ex){ 179 }catch (Exception ex){
176 log.warn("in getProductDetail occur error, uid {}, storageId {}", uid, storageId); 180 log.warn("in getProductDetail occur error, uid {}, storageId {}", uid, storageId);