Authored by wujiexiang

求购-建议价

Showing 20 changed files with 309 additions and 134 deletions
@@ -29,7 +29,7 @@ public class BidStoragePrice { @@ -29,7 +29,7 @@ public class BidStoragePrice {
29 29
30 private Integer createTime; 30 private Integer createTime;
31 31
32 - private Integer skupType; 32 + private Integer attribute;
33 33
34 //0:未上架,1:上架 34 //0:未上架,1:上架
35 private Integer status; 35 private Integer status;
@@ -11,11 +11,11 @@ @@ -11,11 +11,11 @@
11 <result column="price" jdbcType="DECIMAL" property="price"/> 11 <result column="price" jdbcType="DECIMAL" property="price"/>
12 <result column="update_time" jdbcType="INTEGER" property="updateTime"/> 12 <result column="update_time" jdbcType="INTEGER" property="updateTime"/>
13 <result column="create_time" jdbcType="INTEGER" property="createTime"/> 13 <result column="create_time" jdbcType="INTEGER" property="createTime"/>
14 - <result column="skup_type" jdbcType="INTEGER" property="skupType"/> 14 + <result column="attribute" jdbcType="INTEGER" property="attribute"/>
15 <result column="status" jdbcType="INTEGER" property="status"/> 15 <result column="status" jdbcType="INTEGER" property="status"/>
16 </resultMap> 16 </resultMap>
17 <sql id="Base_Column_List"> 17 <sql id="Base_Column_List">
18 - id, skup, product_id, goods_id, storage_id, bid_uid,price, update_time,create_time,skup_type,status 18 + id, skup, product_id, goods_id, storage_id, bid_uid,price, update_time,create_time,attribute,status
19 </sql> 19 </sql>
20 <insert id="insert" parameterType="com.yohoufo.dal.product.model.BidStoragePrice"> 20 <insert id="insert" parameterType="com.yohoufo.dal.product.model.BidStoragePrice">
21 insert into bid_storage_price (id, skup, product_id, goods_id, 21 insert into bid_storage_price (id, skup, product_id, goods_id,
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 values (#{id,jdbcType=INTEGER}, #{skup,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, 23 values (#{id,jdbcType=INTEGER}, #{skup,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER},
24 #{storageId,jdbcType=INTEGER}, #{bidUid,jdbcType=INTEGER}, 24 #{storageId,jdbcType=INTEGER}, #{bidUid,jdbcType=INTEGER},
25 #{price,jdbcType=DECIMAL}, #{updateTime,jdbcType=INTEGER}, 25 #{price,jdbcType=DECIMAL}, #{updateTime,jdbcType=INTEGER},
26 - #{createTime,jdbcType=INTEGER},#{skupType,jdbcType=INTEGER},#{status,jdbcType=INTEGER}) 26 + #{createTime,jdbcType=INTEGER},#{attribute,jdbcType=INTEGER},#{status,jdbcType=INTEGER})
27 </insert> 27 </insert>
28 28
29 <select id="selectBySkup" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 29 <select id="selectBySkup" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -6,6 +6,8 @@ import com.yohoufo.order.constants.BidTimeLimit; @@ -6,6 +6,8 @@ import com.yohoufo.order.constants.BidTimeLimit;
6 import com.yohoufo.order.model.request.BuyerBidChangePriceRequest; 6 import com.yohoufo.order.model.request.BuyerBidChangePriceRequest;
7 import com.yohoufo.order.model.request.BuyerBidPublishRequest; 7 import com.yohoufo.order.model.request.BuyerBidPublishRequest;
8 import com.yohoufo.order.model.response.BidComputeResponse; 8 import com.yohoufo.order.model.response.BidComputeResponse;
  9 +import com.yohoufo.order.model.response.BidConfigResponse;
  10 +import com.yohoufo.order.model.response.BidPrePublishResponse;
9 import com.yohoufo.order.model.response.BidPublishResponse; 11 import com.yohoufo.order.model.response.BidPublishResponse;
10 import com.yohoufo.order.service.impl.BuyerBidPublishService; 12 import com.yohoufo.order.service.impl.BuyerBidPublishService;
11 import com.yohoufo.order.service.impl.BuyerBidPriceService; 13 import com.yohoufo.order.service.impl.BuyerBidPriceService;
@@ -34,6 +36,16 @@ public class BuyerBidController { @@ -34,6 +36,16 @@ public class BuyerBidController {
34 private BuyerBidPriceService buyerBidPriceService; 36 private BuyerBidPriceService buyerBidPriceService;
35 37
36 /** 38 /**
  39 + * 求购基础信息
  40 + *
  41 + * @return
  42 + */
  43 + @RequestMapping(params = "method=ufo.buyer.bid.config")
  44 + public ApiResponse config() {
  45 + return new ApiResponse.ApiResponseBuilder().code(200).data(new BidConfigResponse()).message("ok").build();
  46 + }
  47 +
  48 + /**
37 * 出价计算 49 * 出价计算
38 * 50 *
39 * @param uid 51 * @param uid
@@ -55,6 +67,31 @@ public class BuyerBidController { @@ -55,6 +67,31 @@ public class BuyerBidController {
55 return new ApiResponse.ApiResponseBuilder().code(200).data(response).message("ok").build(); 67 return new ApiResponse.ApiResponseBuilder().code(200).data(response).message("ok").build();
56 } 68 }
57 69
  70 +
  71 + /**
  72 + * 预发布
  73 + * 计算费用并提示
  74 + *
  75 + * @param uid
  76 + * @param storage_id
  77 + * @param price
  78 + */
  79 + @RequestMapping(params = "method=ufo.buyer.bid.prePublish")
  80 + public ApiResponse prePublish(@RequestParam(name = "uid") int uid,
  81 + @RequestParam(name = "storage_id") int storage_id,
  82 + @RequestParam(name = "address_id", required = false) String address_id,
  83 + @RequestParam(name = "price") String price) {
  84 + logger.info("in ufo.buyer.bid.prePublish, uid:{},storage_id:{},address_id:{},price:{}", uid, storage_id, address_id, price);
  85 + //1.校验如下规则
  86 + //1.1求购价格以必须以9结尾的正整数
  87 + BuyerBidPublishRequest req = BuyerBidPublishRequest.builder().uid(uid).storageId(storage_id).addressId(address_id)
  88 + .price(priceComputePrepareProcessor.checkAndAcquireSalePrice(price, SkupType.IN_STOCK))
  89 + .build();
  90 + BidPrePublishResponse response = buyerBidPublishService.prePublish(req);
  91 + return new ApiResponse.ApiResponseBuilder().code(200).data(response).message("ok").build();
  92 + }
  93 +
  94 +
58 /** 95 /**
59 * 出价预发布 96 * 出价预发布
60 * 97 *
@@ -91,6 +128,7 @@ public class BuyerBidController { @@ -91,6 +128,7 @@ public class BuyerBidController {
91 128
92 /** 129 /**
93 * 单个订单变价 130 * 单个订单变价
  131 + *
94 * @param uid 132 * @param uid
95 * @param orderCode 133 * @param orderCode
96 * @param price 134 * @param price
@@ -99,8 +137,8 @@ public class BuyerBidController { @@ -99,8 +137,8 @@ public class BuyerBidController {
99 @RequestMapping(params = "method=ufo.buyer.bid.computeChangePrice") 137 @RequestMapping(params = "method=ufo.buyer.bid.computeChangePrice")
100 @ResponseBody 138 @ResponseBody
101 public ApiResponse computeChangePrice(@RequestParam(name = "uid") int uid, 139 public ApiResponse computeChangePrice(@RequestParam(name = "uid") int uid,
102 - @RequestParam(name = "orderCode") long orderCode,  
103 - @RequestParam(name="price")String price) { 140 + @RequestParam(name = "orderCode") long orderCode,
  141 + @RequestParam(name = "price") String price) {
104 logger.info("in ufo.buyer.bid.computeChangePrice, uid:{},orderCode:{},price:{}", uid, orderCode, price); 142 logger.info("in ufo.buyer.bid.computeChangePrice, uid:{},orderCode:{},price:{}", uid, orderCode, price);
105 BuyerBidChangePriceRequest req = BuyerBidChangePriceRequest.builder().uid(uid).orderCode(orderCode) 143 BuyerBidChangePriceRequest req = BuyerBidChangePriceRequest.builder().uid(uid).orderCode(orderCode)
106 .price(priceComputePrepareProcessor.checkAndAcquireSalePrice(price, SkupType.IN_STOCK)) 144 .price(priceComputePrepareProcessor.checkAndAcquireSalePrice(price, SkupType.IN_STOCK))
@@ -111,6 +149,7 @@ public class BuyerBidController { @@ -111,6 +149,7 @@ public class BuyerBidController {
111 149
112 /** 150 /**
113 * 单个订单变价 151 * 单个订单变价
  152 + *
114 * @param uid 153 * @param uid
115 * @param orderCode 154 * @param orderCode
116 * @param price 155 * @param price
@@ -120,7 +159,7 @@ public class BuyerBidController { @@ -120,7 +159,7 @@ public class BuyerBidController {
120 @ResponseBody 159 @ResponseBody
121 public ApiResponse changePriceOfSingleGoods(@RequestParam(name = "uid") int uid, 160 public ApiResponse changePriceOfSingleGoods(@RequestParam(name = "uid") int uid,
122 @RequestParam(name = "orderCode") long orderCode, 161 @RequestParam(name = "orderCode") long orderCode,
123 - @RequestParam(name="price")String price, 162 + @RequestParam(name = "price") String price,
124 @RequestParam(name = "channelNo", required = false) String channelNo, 163 @RequestParam(name = "channelNo", required = false) String channelNo,
125 @RequestParam(name = "client_type", required = false) String clientType) { 164 @RequestParam(name = "client_type", required = false) String clientType) {
126 logger.info("in ufo.buyer.bid.changePrice, uid:{},orderCode:{},price:{}", uid, orderCode, price); 165 logger.info("in ufo.buyer.bid.changePrice, uid:{},orderCode:{},price:{}", uid, orderCode, price);
1 package com.yohoufo.order.model.bo; 1 package com.yohoufo.order.model.bo;
2 2
  3 +import com.yoho.error.ServiceError;
  4 +import com.yoho.error.exception.ServiceException;
3 import com.yohobuy.ufo.model.order.common.EntrySellerType; 5 import com.yohobuy.ufo.model.order.common.EntrySellerType;
4 import com.yohoufo.common.exception.UfoServiceException; 6 import com.yohoufo.common.exception.UfoServiceException;
  7 +import com.yohoufo.order.model.response.BidComputeResponse;
  8 +import lombok.extern.slf4j.Slf4j;
5 9
6 import java.math.BigDecimal; 10 import java.math.BigDecimal;
7 import java.util.function.Supplier; 11 import java.util.function.Supplier;
@@ -10,6 +14,7 @@ import java.util.function.Supplier; @@ -10,6 +14,7 @@ import java.util.function.Supplier;
10 * 账户 14 * 账户
11 * 根据entrySellerTyp 15 * 根据entrySellerTyp
12 */ 16 */
  17 +@Slf4j(topic = "buyerOrderLog")
13 public abstract class Account { 18 public abstract class Account {
14 protected int uid; 19 protected int uid;
15 //入驻身份 20 //入驻身份
@@ -21,12 +26,21 @@ public abstract class Account { @@ -21,12 +26,21 @@ public abstract class Account {
21 } 26 }
22 27
23 /** 28 /**
24 - * 检测账户余额是否足够 29 + * 余额是否足够
25 * 30 *
26 * @param amount 31 * @param amount
  32 + * @return
27 */ 33 */
28 - public void checkBalanceEnough(BigDecimal amount) { 34 + public boolean isBalanceEnough(BigDecimal amount) {
  35 + return true;
  36 + }
29 37
  38 + /**
  39 + * 检测账户余额是否足够,不足够抛出异常
  40 + *
  41 + * @param amount
  42 + */
  43 + public void checkBalanceEnough(BigDecimal amount) {
30 } 44 }
31 45
32 /** 46 /**
@@ -40,9 +54,10 @@ public abstract class Account { @@ -40,9 +54,10 @@ public abstract class Account {
40 54
41 55
42 /** 56 /**
43 - * 记录支付明细  
44 - * 内部处理异常  
45 - * @param orderCode 支付订单号 57 + * 记录支付明细
  58 + * 内部处理异常
  59 + *
  60 + * @param orderCode 支付订单号
46 * @param accountPayResult 61 * @param accountPayResult
47 */ 62 */
48 public void recordPayDetail(long orderCode, AccountPayResult accountPayResult) { 63 public void recordPayDetail(long orderCode, AccountPayResult accountPayResult) {
@@ -2,6 +2,7 @@ package com.yohoufo.order.model.bo; @@ -2,6 +2,7 @@ package com.yohoufo.order.model.bo;
2 2
3 import com.yohobuy.ufo.model.order.bo.PrdPrice; 3 import com.yohobuy.ufo.model.order.bo.PrdPrice;
4 import com.yohoufo.common.exception.UfoServiceException; 4 import com.yohoufo.common.exception.UfoServiceException;
  5 +import lombok.ToString;
5 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
6 import org.springframework.util.Assert; 7 import org.springframework.util.Assert;
7 8
@@ -10,22 +11,30 @@ import java.math.BigDecimal; @@ -10,22 +11,30 @@ import java.math.BigDecimal;
10 /** 11 /**
11 * 出购价 12 * 出购价
12 */ 13 */
13 -@Slf4j  
14 -public class BidPrice { 14 +@Slf4j(topic = "buyerOrderLog")
  15 +@ToString
  16 +public class BidAndSuggestPrice {
  17 + //求购价
15 private BigDecimal price; 18 private BigDecimal price;
16 19
17 - public BidPrice(BigDecimal prdPrice, PrdPrice prdPriceRange) { 20 + //建议价 最低现货价*95%
  21 + private BigDecimal suggestPrice;
  22 +
  23 + public BidAndSuggestPrice(BigDecimal prdPrice, PrdPrice prdPriceRange, BuyerBidConfig.BidAndSuggestConfig bidAndSuggestConfig) {
18 Assert.notNull(prdPrice, "price must not be null"); 24 Assert.notNull(prdPrice, "price must not be null");
19 Assert.notNull(prdPrice, "prdPrice must not be null"); 25 Assert.notNull(prdPrice, "prdPrice must not be null");
20 - validate(prdPrice, prdPriceRange); 26 + Assert.notNull(prdPrice, "buyerBidConfig must not be null");
  27 + validateBase(prdPrice, prdPriceRange);
  28 + validateBidPriceConfig(prdPrice, BigDecimal.valueOf(bidAndSuggestConfig.getMinBidPrice()));
21 this.price = prdPrice; 29 this.price = prdPrice;
  30 + this.suggestPrice = calculateSuggestPrice(prdPriceRange.getLeastPrice(), bidAndSuggestConfig.getSuggestRate());
22 } 31 }
23 32
24 /** 33 /**
25 * 校验价格 34 * 校验价格
26 * 在商品价格范围内 35 * 在商品价格范围内
27 */ 36 */
28 - private void validate(BigDecimal prdPrice, PrdPrice prdPriceRange) { 37 + private void validateBase(BigDecimal prdPrice, PrdPrice prdPriceRange) {
29 BigDecimal minPrice = prdPriceRange.getMinPrice(); 38 BigDecimal minPrice = prdPriceRange.getMinPrice();
30 BigDecimal maxPrice = prdPriceRange.getMaxPrice(); 39 BigDecimal maxPrice = prdPriceRange.getMaxPrice();
31 if (prdPrice.subtract(minPrice).doubleValue() < 0D) { 40 if (prdPrice.subtract(minPrice).doubleValue() < 0D) {
@@ -39,7 +48,48 @@ public class BidPrice { @@ -39,7 +48,48 @@ public class BidPrice {
39 } 48 }
40 } 49 }
41 50
  51 + /**
  52 + * 校验价格
  53 + * 最小求购价格
  54 + */
  55 + private void validateBidPriceConfig(BigDecimal prdPrice, BigDecimal minBidPrice) {
  56 + if (prdPrice.subtract(minBidPrice).doubleValue() < 0D) {
  57 + log.warn("BidPrice validate,prdPrice:{} < minBidPrice:{}", prdPrice, minBidPrice);
  58 + throw new UfoServiceException(501, "您的出价过低");
  59 + }
  60 + }
  61 +
  62 + /**
  63 + * 计算建议价
  64 + *
  65 + * @param leastPrice 现货最低价
  66 + * @param suggestRate 建议比例
  67 + */
  68 + public BigDecimal calculateSuggestPrice(BigDecimal leastPrice, double suggestRate) {
  69 + log.info("leastPrice:{},suggestRate:{}", leastPrice, suggestRate);
  70 + String priceText = leastPrice.multiply(BigDecimal.valueOf(suggestRate)).setScale(0, BigDecimal.ROUND_DOWN).toPlainString();
  71 + String endNumber = "9";
  72 + if (!priceText.endsWith(endNumber)) {
  73 + //最后一位替换成9
  74 + priceText = priceText.substring(0, priceText.length() - 1) + endNumber;
  75 + }
  76 + return new BigDecimal(priceText);
  77 + }
  78 +
  79 + /**
  80 + * 是否建议
  81 + *
  82 + * @return
  83 + */
  84 + public boolean isSuggest() {
  85 + return price.compareTo(suggestPrice) == -1;
  86 + }
  87 +
42 public BigDecimal getPrice() { 88 public BigDecimal getPrice() {
43 return price; 89 return price;
44 } 90 }
  91 +
  92 + public BigDecimal getSuggestPrice() {
  93 + return suggestPrice;
  94 + }
45 } 95 }
@@ -5,21 +5,39 @@ import lombok.Data; @@ -5,21 +5,39 @@ import lombok.Data;
5 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
6 6
7 @Data 7 @Data
8 -public class BidDepositConfig { 8 +public class BuyerBidConfig {
9 9
10 - //定金比例  
11 - private double rate = 0.02;  
12 - //最小金额  
13 - private double min = 20;  
14 - //最大金额  
15 - private double max = 200; 10 + //求购价配置
  11 + private BidAndSuggestConfig basConfig;
16 12
17 - public static BidDepositConfig convert(String json) { 13 + //定金配置
  14 + private DepositConfig dConfig;
  15 +
  16 + public static BuyerBidConfig convert(String json) {
18 if (StringUtils.isEmpty(json)) { 17 if (StringUtils.isEmpty(json)) {
19 - return new BidDepositConfig(); 18 + return new BuyerBidConfig();
20 } else { 19 } else {
21 - BidDepositConfig config = BeanTool.string2Value(json, BidDepositConfig.class); 20 + BuyerBidConfig config = BeanTool.string2Value(json, BuyerBidConfig.class);
22 return config; 21 return config;
23 } 22 }
24 } 23 }
  24 +
  25 + @Data
  26 + public static class BidAndSuggestConfig {
  27 + //最小求购价
  28 + private double minBidPrice = 29;
  29 + //建议比例,影响建议价
  30 + private double suggestRate = 0.95;
  31 + }
  32 +
  33 + //定金配置
  34 + @Data
  35 + public static class DepositConfig {
  36 + //定金比例
  37 + private double rate = 0.02;
  38 + //最小金额
  39 + private double min = 20;
  40 + //最大金额
  41 + private double max = 200;
  42 + }
25 } 43 }
@@ -3,7 +3,6 @@ package com.yohoufo.order.model.bo; @@ -3,7 +3,6 @@ package com.yohoufo.order.model.bo;
3 import com.yohoufo.common.utils.YHMath; 3 import com.yohoufo.common.utils.YHMath;
4 import lombok.Getter; 4 import lombok.Getter;
5 import lombok.ToString; 5 import lombok.ToString;
6 -import lombok.extern.slf4j.Slf4j;  
7 6
8 /** 7 /**
9 * 定金 8 * 定金
@@ -15,15 +14,15 @@ public class Deposit { @@ -15,15 +14,15 @@ public class Deposit {
15 private double amount; 14 private double amount;
16 15
17 @Getter 16 @Getter
18 - private BidDepositConfig config; 17 + private BuyerBidConfig.DepositConfig config;
19 18
20 19
21 - public Deposit(BidPrice bidPrice, BidDepositConfig config) { 20 + public Deposit(BidAndSuggestPrice bidPrice, BuyerBidConfig.DepositConfig config) {
22 this.amount = compute(bidPrice.getPrice().doubleValue(), config); 21 this.amount = compute(bidPrice.getPrice().doubleValue(), config);
23 this.config = config; 22 this.config = config;
24 } 23 }
25 24
26 - private double compute(double bidPrice, BidDepositConfig config) { 25 + private double compute(double bidPrice, BuyerBidConfig.DepositConfig config) {
27 //根据比例计算的金额 26 //根据比例计算的金额
28 double depositAmount = YHMath.mul(bidPrice, config.getRate()); 27 double depositAmount = YHMath.mul(bidPrice, config.getRate());
29 depositAmount = Math.max(depositAmount, config.getMin()); 28 depositAmount = Math.max(depositAmount, config.getMin());
@@ -20,6 +20,9 @@ import java.util.List; @@ -20,6 +20,9 @@ import java.util.List;
20 import java.util.Objects; 20 import java.util.Objects;
21 import java.util.function.Supplier; 21 import java.util.function.Supplier;
22 22
  23 +/**
  24 + * 入驻商家
  25 + */
23 @Slf4j(topic = "buyerOrderLog") 26 @Slf4j(topic = "buyerOrderLog")
24 public class WalletAccount extends Account { 27 public class WalletAccount extends Account {
25 28
@@ -37,15 +40,27 @@ public class WalletAccount extends Account { @@ -37,15 +40,27 @@ public class WalletAccount extends Account {
37 } 40 }
38 41
39 42
  43 + /**
  44 + * 余额是否足够
  45 + *
  46 + * @param earestMoney
  47 + * @return
  48 + */
40 @Override 49 @Override
41 - public void checkBalanceEnough(BigDecimal earestMoney) { 50 + public boolean isBalanceEnough(BigDecimal earestMoney) {
42 if (!SellerHelper.isSuper(entrySellerType)) { 51 if (!SellerHelper.isSuper(entrySellerType)) {
43 - boolean isEnough = sellerAuthCheckService.isEnough(uid, earestMoney);  
44 - if (!isEnough) {  
45 - log.warn("[{}] checkBalanceEnough,wallet is not enough,earestMoney {}",  
46 - uid, earestMoney);  
47 - throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_IS_NOT_ENOUGH);  
48 - } 52 + return sellerAuthCheckService.isEnough(uid, earestMoney);
  53 + } else {
  54 + return true;
  55 + }
  56 + }
  57 +
  58 + @Override
  59 + public void checkBalanceEnough(BigDecimal earestMoney) {
  60 + if (!isBalanceEnough(earestMoney)) {
  61 + log.warn("[{}] checkBalanceEnough,wallet is not enough,earestMoney {}",
  62 + uid, earestMoney);
  63 + throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_IS_NOT_ENOUGH);
49 } 64 }
50 } 65 }
51 66
@@ -16,8 +16,6 @@ public class BidPublishResult { @@ -16,8 +16,6 @@ public class BidPublishResult {
16 private long orderCode; 16 private long orderCode;
17 //发布时间 17 //发布时间
18 private int publishTime; 18 private int publishTime;
19 - //定金已支付  
20 - private boolean finishedDepositPay;  
21 //定金金额 19 //定金金额
22 private BigDecimal orderAmount; 20 private BigDecimal orderAmount;
23 } 21 }
@@ -19,45 +19,10 @@ import java.util.stream.Collectors; @@ -19,45 +19,10 @@ import java.util.stream.Collectors;
19 @NoArgsConstructor 19 @NoArgsConstructor
20 public class BidComputeResponse { 20 public class BidComputeResponse {
21 21
22 - Deposit deposit;  
23 -  
24 String amount; 22 String amount;
25 23
26 /** 24 /**
27 * 费用列表 25 * 费用列表
28 */ 26 */
29 List<PromotionFormula> promotionFormulaList; 27 List<PromotionFormula> promotionFormulaList;
30 -  
31 - //时限  
32 - private TimeLimit timeLimit = TIME_LIMIT;  
33 -  
34 - @Data  
35 - @Builder  
36 - public static class Deposit {  
37 - private double amount;  
38 - }  
39 -  
40 - private static final TimeLimit TIME_LIMIT = new TimeLimit();  
41 - @Data  
42 - public static class TimeLimit {  
43 - private TimeLimitItem defaultItem;  
44 - private List<TimeLimitItem> items;  
45 -  
46 - public TimeLimit() {  
47 - defaultItem = new TimeLimitItem(BidTimeLimit.DAY_7.getId(), BidTimeLimit.DAY_7.getDesc());  
48 - items = Arrays.stream(BidTimeLimit.values()).map(e -> {  
49 - return new TimeLimitItem(e.getId(), e.getDesc());  
50 - }).collect(Collectors.toList());  
51 - }  
52 - }  
53 -  
54 - @Data  
55 - public static class TimeLimitItem {  
56 - private int id;  
57 - private String desc;  
58 - public TimeLimitItem(int id, String desc) {  
59 - this.id = id;  
60 - this.desc = desc;  
61 - }  
62 - }  
63 } 28 }
  1 +package com.yohoufo.order.model.response;
  2 +
  3 +import com.yohoufo.order.constants.BidTimeLimit;
  4 +import lombok.Builder;
  5 +import lombok.Data;
  6 +
  7 +import java.util.Arrays;
  8 +import java.util.List;
  9 +import java.util.stream.Collectors;
  10 +
  11 +@Data
  12 +public class BidConfigResponse {
  13 + //
  14 + private String tips = "求购须支付定金。卖家接单后,你需要在24小时内支付商品款。卖家将在你付款后36小时内发货。";
  15 + //时限
  16 + private TimeLimit timeLimit = TIME_LIMIT;
  17 +
  18 + private static final TimeLimit TIME_LIMIT = new TimeLimit();
  19 + @Data
  20 + public static class TimeLimit {
  21 + private TimeLimitItem defaultItem;
  22 + private List<TimeLimitItem> items;
  23 +
  24 + public TimeLimit() {
  25 + defaultItem = new TimeLimitItem(BidTimeLimit.DAY_7.getId(), BidTimeLimit.DAY_7.getDesc());
  26 + items = Arrays.stream(BidTimeLimit.values()).map(e -> {
  27 + return new TimeLimitItem(e.getId(), e.getDesc());
  28 + }).collect(Collectors.toList());
  29 + }
  30 + }
  31 +
  32 + @Data
  33 + public static class TimeLimitItem {
  34 + private int id;
  35 + private String desc;
  36 +
  37 + public TimeLimitItem(int id, String desc) {
  38 + this.id = id;
  39 + this.desc = desc;
  40 + }
  41 + }
  42 +}
  1 +package com.yohoufo.order.model.response;
  2 +
  3 +import lombok.Builder;
  4 +import lombok.Data;
  5 +
  6 +@Data
  7 +@Builder
  8 +public class BidPrePublishResponse {
  9 +
  10 + String amount;
  11 +
  12 + /**
  13 + * 对话框
  14 + */
  15 + private Dialog dialog;
  16 +
  17 + //对话框
  18 + @Data
  19 + @Builder
  20 + public static class Dialog {
  21 + //对话框类型 1:金额 2:建议
  22 + private String type;
  23 + private String title;
  24 + private String content;
  25 + private String cancel;
  26 + private String confirm;
  27 + }
  28 +
  29 +}
@@ -6,7 +6,6 @@ import com.yoho.error.exception.ServiceException; @@ -6,7 +6,6 @@ import com.yoho.error.exception.ServiceException;
6 import com.yohobuy.ufo.model.order.bo.OrderInfo; 6 import com.yohobuy.ufo.model.order.bo.OrderInfo;
7 import com.yohobuy.ufo.model.order.common.OrderCodeType; 7 import com.yohobuy.ufo.model.order.common.OrderCodeType;
8 import com.yohobuy.ufo.model.order.common.OrderStatus; 8 import com.yohobuy.ufo.model.order.common.OrderStatus;
9 -import com.yohobuy.ufo.model.order.common.Payment;  
10 import com.yohobuy.ufo.model.order.constants.OrderConstant; 9 import com.yohobuy.ufo.model.order.constants.OrderConstant;
11 import com.yohoufo.dal.order.BuyerOrderGoodsMapper; 10 import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
12 import com.yohoufo.dal.order.BuyerOrderMapper; 11 import com.yohoufo.dal.order.BuyerOrderMapper;
@@ -128,11 +127,6 @@ public class BuyerBidDepositPaymentService extends AbstractOrderPaymentService { @@ -128,11 +127,6 @@ public class BuyerBidDepositPaymentService extends AbstractOrderPaymentService {
128 orderInfo.getOrderCode(), orderInfo.getUid()); 127 orderInfo.getOrderCode(), orderInfo.getUid());
129 throw new ServiceException(ServiceError.ORDER_PAY_NOT_ALLOW); 128 throw new ServiceException(ServiceError.ORDER_PAY_NOT_ALLOW);
130 } 129 }
131 -  
132 - if (orderInfo.getPayment() == Payment.WALLET.getCode()) {  
133 - logger.warn("deposit is already payment by wallet, orderCode is {}, uid is {}", orderInfo.getOrderCode(), orderInfo.getUid());  
134 - throw new ServiceException(ServiceError.ORDER_PAY_NOT_ALLOW);  
135 - }  
136 } 130 }
137 131
138 @Override 132 @Override
@@ -86,8 +86,8 @@ public class CacheKeyBuilder { @@ -86,8 +86,8 @@ public class CacheKeyBuilder {
86 LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH("ufo:seller:largeSettlement:walletNotEnough:notice:","uid:{}:funcLevel:{}:cnt"), 86 LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH("ufo:seller:largeSettlement:walletNotEnough:notice:","uid:{}:funcLevel:{}:cnt"),
87 DEPOSIT_PLATFORM_FEE("ufo:order:deposit:platform:fee", ""), 87 DEPOSIT_PLATFORM_FEE("ufo:order:deposit:platform:fee", ""),
88 SELLER_SALE_PRICE_LIMIT("ufo:order:seller:salePrice:limit:config",""), 88 SELLER_SALE_PRICE_LIMIT("ufo:order:seller:salePrice:limit:config",""),
89 - //求购定金  
90 - BID_DEPOSIT_FEE("ufo:order:bid:deposit:fee:config",""), 89 + //买家求购
  90 + BUYER_BID_CONFIG("ufo:order:buyer:bid:config",""),
91 91
92 DISTRIBUTED_LOCK_DEPOSIT_GOODS(DISTRIBUTED_LOCK_PREFIX, "depositCode:{}"), 92 DISTRIBUTED_LOCK_DEPOSIT_GOODS(DISTRIBUTED_LOCK_PREFIX, "depositCode:{}"),
93 93
@@ -114,7 +114,7 @@ public class BuyerBidPriceService { @@ -114,7 +114,7 @@ public class BuyerBidPriceService {
114 } 114 }
115 // 返回结果 115 // 返回结果
116 return BidPublishResponse.builder().skup(bidPublishResult.getSkup()).orderCode(bidPublishResult.getOrderCode()) 116 return BidPublishResponse.builder().skup(bidPublishResult.getSkup()).orderCode(bidPublishResult.getOrderCode())
117 - .paymentStatus(bidPublishResult.isFinishedDepositPay() ? OrderConstant.Y_STR : OrderConstant.N_STR) 117 + .paymentStatus(OrderConstant.N_STR)
118 .build(); 118 .build();
119 } 119 }
120 120
@@ -25,6 +25,7 @@ import com.yohoufo.order.model.OrderBuilderFactory; @@ -25,6 +25,7 @@ import com.yohoufo.order.model.OrderBuilderFactory;
25 import com.yohoufo.order.model.request.BuyerBidPublishRequest; 25 import com.yohoufo.order.model.request.BuyerBidPublishRequest;
26 import com.yohoufo.order.model.request.ShoppingRequest; 26 import com.yohoufo.order.model.request.ShoppingRequest;
27 import com.yohoufo.order.model.response.BidComputeResponse; 27 import com.yohoufo.order.model.response.BidComputeResponse;
  28 +import com.yohoufo.order.model.response.BidPrePublishResponse;
28 import com.yohoufo.order.model.response.BidPublishResponse; 29 import com.yohoufo.order.model.response.BidPublishResponse;
29 import com.yohoufo.order.service.BuyerOrderStateChangers; 30 import com.yohoufo.order.service.BuyerOrderStateChangers;
30 import com.yohoufo.order.service.cache.CacheCleaner; 31 import com.yohoufo.order.service.cache.CacheCleaner;
@@ -112,18 +113,14 @@ public class BuyerBidPublishService { @@ -112,18 +113,14 @@ public class BuyerBidPublishService {
112 //1.1 sku必须存在的 113 //1.1 sku必须存在的
113 //1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高 114 //1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高
114 //求购金额 115 //求购金额
115 - BidPrice bidPrice = new BidPrice(request.getPrice(), productProxyService.getPrdPriceRange(request.getUid(), request.getStorageId())); 116 + BuyerBidConfig buyerBidConfig = metaConfigService.getBuyerBidConfig();
  117 + BidAndSuggestPrice bidPrice = new BidAndSuggestPrice(request.getPrice(),
  118 + productProxyService.getPrdPriceRange(request.getUid(), request.getStorageId()),
  119 + buyerBidConfig.getBasConfig());
116 //2.计算定金 120 //2.计算定金
117 - Deposit deposit = computeDeposit(bidPrice); 121 + Deposit deposit = computeDeposit(bidPrice, buyerBidConfig.getDConfig());
118 logger.info("[{}] buyerBid compute deposit result:{}", uid, deposit); 122 logger.info("[{}] buyerBid compute deposit result:{}", uid, deposit);
119 123
120 - //定金金额  
121 - BigDecimal earestMoney = BigDecimal.valueOf(deposit.getAmount());  
122 - //账户  
123 - Account account = accountFactory.get(uid);  
124 - //检测入驻用户账户金额  
125 - account.checkBalanceEnough(earestMoney);  
126 -  
127 //3.计算商品金额 + 运费 124 //3.计算商品金额 + 运费
128 ChargeContext chargeContext = computeGoods(request, bidPrice); 125 ChargeContext chargeContext = computeGoods(request, bidPrice);
129 126
@@ -132,12 +129,45 @@ public class BuyerBidPublishService { @@ -132,12 +129,45 @@ public class BuyerBidPublishService {
132 //返回结果 129 //返回结果
133 BidComputeResponse response = new BidComputeResponse(); 130 BidComputeResponse response = new BidComputeResponse();
134 response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult)); 131 response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult));
135 - response.setDeposit(BidComputeResponse.Deposit.builder().amount(deposit.getAmount()).build());  
136 response.setAmount(MathUtils.formatStr(deposit.getAmount())); 132 response.setAmount(MathUtils.formatStr(deposit.getAmount()));
137 133
138 return response; 134 return response;
139 } 135 }
140 136
  137 +
  138 + /**
  139 + * 计算及提示
  140 + * 主要包括两部分
  141 + * 1.定金(出价 * 比例)
  142 + * 2.商品金额 + 运费
  143 + */
  144 + public BidPrePublishResponse prePublish(BuyerBidPublishRequest request) {
  145 + int uid = request.getUid();
  146 + //1.校验如下规则
  147 + //1.1 sku必须存在的
  148 + //1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高
  149 + //比例配置
  150 + BuyerBidConfig buyerBidConfig = metaConfigService.getBuyerBidConfig();
  151 + //求购金额
  152 + BidAndSuggestPrice bidAndSuggestPrice = new BidAndSuggestPrice(request.getPrice(),
  153 + productProxyService.getPrdPriceRange(request.getUid(), request.getStorageId()), buyerBidConfig.getBasConfig());
  154 + //2.计算定金
  155 + Deposit deposit = computeDeposit(bidAndSuggestPrice, buyerBidConfig.getDConfig());
  156 + logger.info("[{}] buyerBid compute deposit result:{}", uid, deposit);
  157 +
  158 + BidPrePublishResponse.Dialog dialog = null;
  159 +
  160 + if (bidAndSuggestPrice.isSuggest()) {
  161 + logger.warn("[{}] Suggest,bidAndSuggestPrice:{}", uid, bidAndSuggestPrice);
  162 + //建议求购价
  163 + dialog = BidPrePublishResponse.Dialog.builder().type("suggest")
  164 + .title("建议求购价:" + OrderConstant.MONEY_SIGN + bidAndSuggestPrice.getSuggestPrice().toPlainString())
  165 + .content("高于建议求购价可以迅速提升求购速度成功率!").cancel("调整价格").confirm("继续求购").build();
  166 + }
  167 + return BidPrePublishResponse.builder().amount(MathUtils.formatStr(deposit.getAmount())).dialog(dialog).build();
  168 + }
  169 +
  170 +
141 /** 171 /**
142 * 预发布 172 * 预发布
143 */ 173 */
@@ -151,20 +181,21 @@ public class BuyerBidPublishService { @@ -151,20 +181,21 @@ public class BuyerBidPublishService {
151 181
152 // 返回结果 182 // 返回结果
153 return BidPublishResponse.builder().skup(bidPublishResult.getSkup()).orderCode(bidPublishResult.getOrderCode()) 183 return BidPublishResponse.builder().skup(bidPublishResult.getSkup()).orderCode(bidPublishResult.getOrderCode())
154 - .paymentStatus(bidPublishResult.isFinishedDepositPay() ? OrderConstant.Y_STR : OrderConstant.N_STR) 184 + .paymentStatus(OrderConstant.N_STR)
155 .build(); 185 .build();
156 } 186 }
157 187
158 /** 188 /**
159 * 计算定金 189 * 计算定金
  190 + *
160 * @param bidPrice 求购价 191 * @param bidPrice 求购价
161 * @return 192 * @return
162 */ 193 */
163 - private Deposit computeDeposit(BidPrice bidPrice) {  
164 - return new Deposit(bidPrice, metaConfigService.getBidDepositConfig()); 194 + private Deposit computeDeposit(BidAndSuggestPrice bidPrice, BuyerBidConfig.DepositConfig depositConfig) {
  195 + return new Deposit(bidPrice, depositConfig);
165 } 196 }
166 197
167 - private ChargeContext computeGoods(BuyerBidPublishRequest request, BidPrice bidPrice) { 198 + private ChargeContext computeGoods(BuyerBidPublishRequest request, BidAndSuggestPrice bidPrice) {
168 //构建算费上下文 199 //构建算费上下文
169 ChargeContext chargeContext = chargeContextFactory.buildChargeContext(newShoppingRequest(request), 200 ChargeContext chargeContext = chargeContextFactory.buildChargeContext(newShoppingRequest(request),
170 newSellerOrderGoods(0, 0, bidPrice.getPrice()), 201 newSellerOrderGoods(0, 0, bidPrice.getPrice()),
@@ -207,6 +238,7 @@ public class BuyerBidPublishService { @@ -207,6 +238,7 @@ public class BuyerBidPublishService {
207 238
208 /** 239 /**
209 * 发布 240 * 发布
  241 + *
210 * @param request 242 * @param request
211 * @return 243 * @return
212 */ 244 */
@@ -217,21 +249,15 @@ public class BuyerBidPublishService { @@ -217,21 +249,15 @@ public class BuyerBidPublishService {
217 //1.1 sku必须存在的 249 //1.1 sku必须存在的
218 //1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高 250 //1.2求购价格满足商品的最低和最高红线价,不满足提示价格过低,或者价格过高
219 //求购金额 251 //求购金额
220 - BidPrice bidPrice = new BidPrice(request.getPrice(), productProxyService.getPrdPriceRange(uid, storageId)); 252 + BuyerBidConfig buyerBidConfig = metaConfigService.getBuyerBidConfig();
  253 + BidAndSuggestPrice bidPrice = new BidAndSuggestPrice(request.getPrice(), productProxyService.getPrdPriceRange(uid, storageId),
  254 + buyerBidConfig.getBasConfig());
221 //2.计算定金 255 //2.计算定金
222 - Deposit deposit = computeDeposit(bidPrice); 256 + Deposit deposit = computeDeposit(bidPrice, buyerBidConfig.getDConfig());
223 logger.info("[{}] bid compute deposit result:{}", uid, deposit); 257 logger.info("[{}] bid compute deposit result:{}", uid, deposit);
224 //3.计算商品金额 + 运费 258 //3.计算商品金额 + 运费
225 ChargeContext chargeContext = computeGoods(request, bidPrice); 259 ChargeContext chargeContext = computeGoods(request, bidPrice);
226 260
227 - //定金金额  
228 - BigDecimal earestMoney = BigDecimal.valueOf(deposit.getAmount());  
229 -  
230 - //账户  
231 - Account account = accountFactory.get(uid);  
232 - //检测入驻用户账户金额  
233 - account.checkBalanceEnough(earestMoney);  
234 -  
235 //获取商品信息 261 //获取商品信息
236 GoodsInfo goodsInfo = skupService.getProductDetail(uid, storageId, bidPrice.getPrice(), SkupType.getSkupType(request.getSkupType())); 262 GoodsInfo goodsInfo = skupService.getProductDetail(uid, storageId, bidPrice.getPrice(), SkupType.getSkupType(request.getSkupType()));
237 263
@@ -239,9 +265,6 @@ public class BuyerBidPublishService { @@ -239,9 +265,6 @@ public class BuyerBidPublishService {
239 final int skup = createCannotSellSellerSkup(uid, goodsInfo); 265 final int skup = createCannotSellSellerSkup(uid, goodsInfo);
240 logger.info("[{}] generate new skup:{}", uid, skup); 266 logger.info("[{}] generate new skup:{}", uid, skup);
241 267
242 - //支付定金  
243 - AccountPayResult accountPayResult = account.tryPay(earestMoney,OrderConstant.PAY_LEVEL_DEPOSIT, () -> skup);  
244 -  
245 // 生成订单号 268 // 生成订单号
246 long orderCode = orderCodeGenerator.generate(OrderCodeType.BUYER_TYPE); 269 long orderCode = orderCodeGenerator.generate(OrderCodeType.BUYER_TYPE);
247 logger.info("[{}] generate new orderCode:{}", uid, orderCode); 270 logger.info("[{}] generate new orderCode:{}", uid, orderCode);
@@ -255,19 +278,12 @@ public class BuyerBidPublishService { @@ -255,19 +278,12 @@ public class BuyerBidPublishService {
255 chargeContext); 278 chargeContext);
256 //求购 定金 279 //求购 定金
257 BidOrderMetaBo bidOrderMetaBo = BidOrderMetaBo.builder().depositAmount(deposit.getAmount()).days(request.getDays()).build(); 280 BidOrderMetaBo bidOrderMetaBo = BidOrderMetaBo.builder().depositAmount(deposit.getAmount()).days(request.getDays()).build();
258 - if (accountPayResult.isFinishPay()) {  
259 - //钱包  
260 - bidOrderMetaBo.setPayment(Payment.WALLET.getCode());  
261 - } 281 +
262 // 创建买家订单 282 // 创建买家订单
263 BuyerOrderSubmitResult submitResult = buyerBidOrderSubmitService.submitOrder(orderBuilder, bidOrderMetaBo); 283 BuyerOrderSubmitResult submitResult = buyerBidOrderSubmitService.submitOrder(orderBuilder, bidOrderMetaBo);
264 284
265 - //记录支付明细  
266 - account.recordPayDetail(orderCode, accountPayResult);  
267 -  
268 BidPublishResult publishResult = BidPublishResult.builder().skup(skup).orderCode(orderCode) 285 BidPublishResult publishResult = BidPublishResult.builder().skup(skup).orderCode(orderCode)
269 .publishTime(submitResult.getSubmitTime()) 286 .publishTime(submitResult.getSubmitTime())
270 - .finishedDepositPay(accountPayResult.isFinishPay())  
271 .orderAmount(orderBuilder.getAmount()) 287 .orderAmount(orderBuilder.getAmount())
272 .build(); 288 .build();
273 289
@@ -305,10 +321,6 @@ public class BuyerBidPublishService { @@ -305,10 +321,6 @@ public class BuyerBidPublishService {
305 * @param bidPublishResult 321 * @param bidPublishResult
306 */ 322 */
307 public void processAfterBidPublish(int uid, BidPublishResult bidPublishResult) { 323 public void processAfterBidPublish(int uid, BidPublishResult bidPublishResult) {
308 - //已完成定金支付,直接变更订单状态为求购中  
309 - if (bidPublishResult.isFinishedDepositPay()) {  
310 - buyerOrderStateChangers.selectOneToChange(uid, bidPublishResult.getOrderCode(), OrderStatus.WAITING_PAY_DEPOSIT, OrderStatus.BIDING);  
311 - }  
312 //触发事件 324 //触发事件
313 fireCreateAsyncEvent(uid, bidPublishResult); 325 fireCreateAsyncEvent(uid, bidPublishResult);
314 //clean cache 326 //clean cache
@@ -15,7 +15,7 @@ import com.yohoufo.common.cache.CacheClient; @@ -15,7 +15,7 @@ import com.yohoufo.common.cache.CacheClient;
15 import com.yohoufo.dal.order.MetaConfigMapper; 15 import com.yohoufo.dal.order.MetaConfigMapper;
16 import com.yohoufo.dal.order.model.MetaConfig; 16 import com.yohoufo.dal.order.model.MetaConfig;
17 import com.yohoufo.order.charge.model.FeeNRate; 17 import com.yohoufo.order.charge.model.FeeNRate;
18 -import com.yohoufo.order.model.bo.BidDepositConfig; 18 +import com.yohoufo.order.model.bo.BuyerBidConfig;
19 import com.yohoufo.order.model.dto.*; 19 import com.yohoufo.order.model.dto.*;
20 import com.yohoufo.order.service.cache.CacheKeyBuilder; 20 import com.yohoufo.order.service.cache.CacheKeyBuilder;
21 import com.yohoufo.order.service.cache.ExpiredTime; 21 import com.yohoufo.order.service.cache.ExpiredTime;
@@ -377,11 +377,11 @@ public class MetaConfigService { @@ -377,11 +377,11 @@ public class MetaConfigService {
377 * 求购定金配置(比例、最小、最大金额) 377 * 求购定金配置(比例、最小、最大金额)
378 * @return 378 * @return
379 */ 379 */
380 - public BidDepositConfig getBidDepositConfig() {  
381 - CacheKeyBuilder.KeyTemp kt = CacheKeyBuilder.KeyTemp.BID_DEPOSIT_FEE; 380 + public BuyerBidConfig getBuyerBidConfig() {
  381 + CacheKeyBuilder.KeyTemp kt = CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG;
382 RedisKeyBuilder rkb = kt.builderKeyOnlyFixed(); 382 RedisKeyBuilder rkb = kt.builderKeyOnlyFixed();
383 - final String key = MetaConfigKey.BID_DEPOSIT_FEE; 383 + final String key = MetaConfigKey.BUYER_BID_CONFIG;
384 String configVal = new DataProcesser(rkb, key, ExpiredTime.ORDER_BASE_CONFIG).getConfigVal(); 384 String configVal = new DataProcesser(rkb, key, ExpiredTime.ORDER_BASE_CONFIG).getConfigVal();
385 - return BidDepositConfig.convert(configVal); 385 + return BuyerBidConfig.convert(configVal);
386 } 386 }
387 } 387 }
@@ -118,7 +118,7 @@ public class SellerBidPublishService { @@ -118,7 +118,7 @@ public class SellerBidPublishService {
118 //2.算费 118 //2.算费
119 //2.获取算费配置 119 //2.获取算费配置
120 int storageId = saleableBidSkup.getStorageId(); 120 int storageId = saleableBidSkup.getStorageId();
121 - SkupType skupType = SkupType.getSkupType(saleableBidSkup.getSkupType()); 121 + SkupType skupType = SkupType.getSkupType(saleableBidSkup.getAttribute());
122 logger.info("[{}] compute seller bid skup fee,skup:{},storageId:{},skupType:{}", uid, saleableBidSkup.getSkup(), storageId, skupType); 122 logger.info("[{}] compute seller bid skup fee,skup:{},storageId:{},skupType:{}", uid, saleableBidSkup.getSkup(), storageId, skupType);
123 boolean isImperfect = SellerGoodsHelper.isImperfectGoods(skupType); 123 boolean isImperfect = SellerGoodsHelper.isImperfectGoods(skupType);
124 PrdQueryReq pqr = PrdQueryReq.builder().uid(uid) 124 PrdQueryReq pqr = PrdQueryReq.builder().uid(uid)
1 package com.yohoufo.order.service.proxy; 1 package com.yohoufo.order.service.proxy;
2 2
3 import com.yohobuy.ufo.model.BidStoragePriceVo; 3 import com.yohobuy.ufo.model.BidStoragePriceVo;
4 -import com.yohobuy.ufo.model.order.constants.SkupType;  
5 -import com.yohoufo.common.exception.UfoServiceException; 4 +import com.yohobuy.ufo.model.order.common.OrderAttributes;
6 import com.yohoufo.dal.order.model.SellerOrderGoods; 5 import com.yohoufo.dal.order.model.SellerOrderGoods;
7 import org.slf4j.Logger; 6 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
@@ -32,7 +31,7 @@ public class BidProductProxyService extends AbsProxyService { @@ -32,7 +31,7 @@ public class BidProductProxyService extends AbsProxyService {
32 .storageId(goods.getStorageId()) 31 .storageId(goods.getStorageId())
33 .bidUid(bidUid) 32 .bidUid(bidUid)
34 .price(goods.getGoodsPrice()) 33 .price(goods.getGoodsPrice())
35 - .skupType(SkupType.IN_STOCK.getCode()) 34 + .attribute(OrderAttributes.COMMON_IN_STOCK.getCode())
36 .build(); 35 .build();
37 ufoServiceCaller.call(CREATE_API, bidStoragePriceBo); 36 ufoServiceCaller.call(CREATE_API, bidStoragePriceBo);
38 } 37 }
@@ -170,7 +170,7 @@ public class BidProductService { @@ -170,7 +170,7 @@ public class BidProductService {
170 sp.setSkup(skup); 170 sp.setSkup(skup);
171 sp.setCreateTime((int) (System.currentTimeMillis() / 1000)); 171 sp.setCreateTime((int) (System.currentTimeMillis() / 1000));
172 sp.setUpdateTime(0); 172 sp.setUpdateTime(0);
173 - sp.setSkupType(skupVo.getSkupType()); 173 + sp.setAttribute(skupVo.getAttribute());
174 logger.info("BidStoragePrice : {}", sp); 174 logger.info("BidStoragePrice : {}", sp);
175 return sp; 175 return sp;
176 } 176 }
@@ -186,7 +186,7 @@ public class BidProductService { @@ -186,7 +186,7 @@ public class BidProductService {
186 .storageId(storagePrice.getStorageId()) 186 .storageId(storagePrice.getStorageId())
187 .price(storagePrice.getPrice()) 187 .price(storagePrice.getPrice())
188 .skup(storagePrice.getSkup()) 188 .skup(storagePrice.getSkup())
189 - .skupType(storagePrice.getSkupType()) 189 + .attribute(storagePrice.getAttribute())
190 .bidUid(storagePrice.getBidUid()) 190 .bidUid(storagePrice.getBidUid())
191 .build(); 191 .build();
192 logger.info("BidStoragePriceBo : {}", vo); 192 logger.info("BidStoragePriceBo : {}", vo);