Authored by wujiexiang

Merge branch 'dev_bid' into test6.9.13

@@ -13,6 +13,9 @@ public class SellerOrderStatsConfig { @@ -13,6 +13,9 @@ public class SellerOrderStatsConfig {
13 private String excludeUid; 13 private String excludeUid;
14 //属性 14 //属性
15 private String skupType; 15 private String skupType;
  16 +
  17 + //求购方式
  18 + private String bidType;
16 //统计单位 19 //统计单位
17 private String statsUnit; 20 private String statsUnit;
18 //统计周期 21 //统计周期
@@ -6,12 +6,13 @@ @@ -6,12 +6,13 @@
6 <result column="stats_code" property="statsCode" jdbcType="VARCHAR" /> 6 <result column="stats_code" property="statsCode" jdbcType="VARCHAR" />
7 <result column="exclude_uid" property="excludeUid" jdbcType="VARCHAR" /> 7 <result column="exclude_uid" property="excludeUid" jdbcType="VARCHAR" />
8 <result column="skup_type" property="skupType" jdbcType="VARCHAR" /> 8 <result column="skup_type" property="skupType" jdbcType="VARCHAR" />
  9 + <result column="bid_type" property="bidType" jdbcType="VARCHAR" />
9 <result column="stats_unit" property="statsUnit" jdbcType="VARCHAR" /> 10 <result column="stats_unit" property="statsUnit" jdbcType="VARCHAR" />
10 <result column="stats_period" property="statsPeriod" jdbcType="INTEGER" /> 11 <result column="stats_period" property="statsPeriod" jdbcType="INTEGER" />
11 <result column="stats_processor" property="statsProcessor" jdbcType="VARCHAR" /> 12 <result column="stats_processor" property="statsProcessor" jdbcType="VARCHAR" />
12 </resultMap> 13 </resultMap>
13 <sql id="Base_Column_List" > 14 <sql id="Base_Column_List" >
14 - id, stats_code, exclude_uid, skup_type, stats_unit, stats_period, stats_processor 15 + id, stats_code, exclude_uid, skup_type, bid_type, stats_unit, stats_period, stats_processor
15 </sql> 16 </sql>
16 17
17 <select id="selectEnabledStatsConfig" resultMap="BaseResultMap" > 18 <select id="selectEnabledStatsConfig" resultMap="BaseResultMap" >
1 package com.yohoufo.order.controller; 1 package com.yohoufo.order.controller;
2 2
3 -import com.yohobuy.ufo.model.order.constants.OrderConstant;  
4 import com.yohobuy.ufo.model.order.constants.SkupType; 3 import com.yohobuy.ufo.model.order.constants.SkupType;
5 import com.yohoufo.common.ApiResponse; 4 import com.yohoufo.common.ApiResponse;
6 import com.yohoufo.order.constants.BidTimeLimit; 5 import com.yohoufo.order.constants.BidTimeLimit;
@@ -11,7 +10,6 @@ import com.yohoufo.order.service.impl.BuyerBidPublishService; @@ -11,7 +10,6 @@ import com.yohoufo.order.service.impl.BuyerBidPublishService;
11 import com.yohoufo.order.service.impl.BuyerBidPriceService; 10 import com.yohoufo.order.service.impl.BuyerBidPriceService;
12 import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor; 11 import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
13 import com.yohoufo.order.utils.LoggerUtils; 12 import com.yohoufo.order.utils.LoggerUtils;
14 -import com.yohoufo.order.utils.MathUtils;  
15 import org.slf4j.Logger; 13 import org.slf4j.Logger;
16 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.web.bind.annotation.RequestMapping; 15 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,9 +17,6 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -19,9 +17,6 @@ import org.springframework.web.bind.annotation.RequestParam;
19 import org.springframework.web.bind.annotation.ResponseBody; 17 import org.springframework.web.bind.annotation.ResponseBody;
20 import org.springframework.web.bind.annotation.RestController; 18 import org.springframework.web.bind.annotation.RestController;
21 19
22 -import java.util.LinkedList;  
23 -import java.util.List;  
24 -  
25 @RestController 20 @RestController
26 @RequestMapping(value = "/shopping/bid") 21 @RequestMapping(value = "/shopping/bid")
27 public class BuyerBidController { 22 public class BuyerBidController {
@@ -44,30 +39,7 @@ public class BuyerBidController { @@ -44,30 +39,7 @@ public class BuyerBidController {
44 */ 39 */
45 @RequestMapping(params = "method=ufo.buyer.bid.config") 40 @RequestMapping(params = "method=ufo.buyer.bid.config")
46 public ApiResponse config() { 41 public ApiResponse config() {
47 - BidConfigResponse response = new BidConfigResponse();  
48 - List<PromotionFormula> promotionFormulaList = new LinkedList<>();  
49 -  
50 - //商品金额  
51 - PromotionFormula goodsFormula = new PromotionFormula();  
52 - goodsFormula.setPromotion(OrderConstant.GOODS_PRICE);  
53 - goodsFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));  
54 - promotionFormulaList.add(goodsFormula);  
55 -  
56 - //运费  
57 - PromotionFormula expressFormula = new PromotionFormula();  
58 - expressFormula.setPromotion(OrderConstant.DELIVERY_DESC);  
59 - expressFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));  
60 - promotionFormulaList.add(expressFormula);  
61 -  
62 - //最终金额  
63 - PromotionFormula finalAmountFormula = new PromotionFormula();  
64 - finalAmountFormula.setPromotion(OrderConstant.GOODS_REAL_PRICE);  
65 - finalAmountFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));  
66 - promotionFormulaList.add(finalAmountFormula);  
67 -  
68 - response.setPromotionFormulaList(promotionFormulaList);  
69 -  
70 - return new ApiResponse.ApiResponseBuilder().code(200).data(response).message("ok").build(); 42 + return new ApiResponse.ApiResponseBuilder().code(200).data(new BidConfigResponse()).message("ok").build();
71 } 43 }
72 44
73 /** 45 /**
@@ -34,7 +34,7 @@ public class BuyerBidConfig { @@ -34,7 +34,7 @@ public class BuyerBidConfig {
34 //定金配置 34 //定金配置
35 @Data 35 @Data
36 public static class DepositConfig { 36 public static class DepositConfig {
37 - //定金比例 37 + //定金比例 求购价格占比
38 private double rate = 0.02; 38 private double rate = 0.02;
39 //最小金额 39 //最小金额
40 private double min = 20; 40 private double min = 20;
1 package com.yohoufo.order.model.response; 1 package com.yohoufo.order.model.response;
2 2
  3 +import com.yohobuy.ufo.model.order.constants.OrderConstant;
3 import com.yohoufo.order.constants.BidTimeLimit; 4 import com.yohoufo.order.constants.BidTimeLimit;
4 -import lombok.Builder; 5 +import com.yohoufo.order.utils.MathUtils;
5 import lombok.Data; 6 import lombok.Data;
6 -  
7 import java.util.Arrays; 7 import java.util.Arrays;
  8 +import java.util.LinkedList;
8 import java.util.List; 9 import java.util.List;
9 import java.util.stream.Collectors; 10 import java.util.stream.Collectors;
10 11
11 @Data 12 @Data
12 public class BidConfigResponse { 13 public class BidConfigResponse {
  14 +
  15 + public static final String TIPS_TEMPLATE = "求购须支付定金。卖家接单后,你需要在24小时内支付商品款。卖家将在你付款后36小时内发货。";
  16 +
  17 + public static final List<PromotionFormula> BASE_PROMOTION_FORMULA_LIST;
  18 +
  19 + private static final TimeLimit TIME_LIMIT = new TimeLimit();
  20 +
  21 +
  22 + static {
  23 + BASE_PROMOTION_FORMULA_LIST = new LinkedList<>();
  24 + //商品金额
  25 + PromotionFormula goodsFormula = new PromotionFormula();
  26 + goodsFormula.setPromotion(OrderConstant.GOODS_PRICE);
  27 + goodsFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));
  28 + BASE_PROMOTION_FORMULA_LIST.add(goodsFormula);
  29 +
  30 + //运费
  31 + PromotionFormula expressFormula = new PromotionFormula();
  32 + expressFormula.setPromotion(OrderConstant.DELIVERY_DESC);
  33 + expressFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));
  34 + BASE_PROMOTION_FORMULA_LIST.add(expressFormula);
  35 +
  36 + //最终金额
  37 + PromotionFormula finalAmountFormula = new PromotionFormula();
  38 + finalAmountFormula.setPromotion(OrderConstant.GOODS_REAL_PRICE);
  39 + finalAmountFormula.setPromotionAmount(MathUtils.formatCurrencyStr(0));
  40 + BASE_PROMOTION_FORMULA_LIST.add(finalAmountFormula);
  41 + }
  42 +
13 // 43 //
14 - private String tips = "求购须支付定金。卖家接单后,你需要在24小时内支付商品款。卖家将在你付款后36小时内发货。"; 44 + private String tips = TIPS_TEMPLATE;
15 //时限 45 //时限
16 private TimeLimit timeLimit = TIME_LIMIT; 46 private TimeLimit timeLimit = TIME_LIMIT;
17 47
18 /** 48 /**
19 * 费用列表 49 * 费用列表
20 */ 50 */
21 - List<PromotionFormula> promotionFormulaList;  
22 -  
23 - private static final TimeLimit TIME_LIMIT = new TimeLimit(); 51 + List<PromotionFormula> promotionFormulaList = BASE_PROMOTION_FORMULA_LIST;
24 @Data 52 @Data
25 public static class TimeLimit { 53 public static class TimeLimit {
26 private TimeLimitItem defaultItem; 54 private TimeLimitItem defaultItem;
@@ -57,6 +57,7 @@ public class SellerOrderStatsConfigCacheService { @@ -57,6 +57,7 @@ public class SellerOrderStatsConfigCacheService {
57 .statsCode(config.getStatsCode()) 57 .statsCode(config.getStatsCode())
58 .excludeUids(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getExcludeUid()).stream().map(uid -> Integer.parseInt(uid.trim())).collect(Collectors.toList())) 58 .excludeUids(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getExcludeUid()).stream().map(uid -> Integer.parseInt(uid.trim())).collect(Collectors.toList()))
59 .skupTypes(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getSkupType()).stream().map(code -> SkupType.getSkupType(Integer.parseInt(code.trim()))).collect(Collectors.toList())) 59 .skupTypes(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getSkupType()).stream().map(code -> SkupType.getSkupType(Integer.parseInt(code.trim()))).collect(Collectors.toList()))
  60 + .bidTypes(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getBidType()).stream().map(code -> Integer.parseInt(code.trim())).collect(Collectors.toList()))
60 .statsUnit(StatsUnit.find(config.getStatsUnit())) 61 .statsUnit(StatsUnit.find(config.getStatsUnit()))
61 .statsPeriod(config.getStatsPeriod()) 62 .statsPeriod(config.getStatsPeriod())
62 .statsProcessorName(config.getStatsProcessor()) 63 .statsProcessorName(config.getStatsProcessor())
@@ -374,6 +374,18 @@ public class MetaConfigService { @@ -374,6 +374,18 @@ public class MetaConfigService {
374 } 374 }
375 375
376 /** 376 /**
  377 + *
  378 + * {
  379 + * "basConfig": {
  380 + * "minBidPrice": 29,
  381 + * "suggestRate": 0.95
  382 + * },
  383 + * "dConfig": {
  384 + * "rate": 0.02,
  385 + * "min": 20,
  386 + * "max": 200
  387 + * }
  388 + * }
377 * 求购定金配置(比例、最小、最大金额) 389 * 求购定金配置(比例、最小、最大金额)
378 * @return 390 * @return
379 */ 391 */
@@ -390,6 +390,7 @@ public class BuyerOrderChangeBusinessPostProcessor { @@ -390,6 +390,7 @@ public class BuyerOrderChangeBusinessPostProcessor {
390 .sellerUid(buyerOrder.getSellerUid()) 390 .sellerUid(buyerOrder.getSellerUid())
391 .entrySellerType(entrySellerType) 391 .entrySellerType(entrySellerType)
392 .skupType(SkupType.getSkupType(sellerOrderGoods.getAttributes())) 392 .skupType(SkupType.getSkupType(sellerOrderGoods.getAttributes()))
  393 + .bidType(sellerOrderGoods.getBidType())
393 .build(); 394 .build();
394 //统计项配置 395 //统计项配置
395 SellerOrderStatsConfiguration statsConfig = statsConfigurationManager.getStatsConfig(statsEntry); 396 SellerOrderStatsConfiguration statsConfig = statsConfigurationManager.getStatsConfig(statsEntry);
@@ -31,6 +31,8 @@ public class SellerOrderStatsConfiguration implements StatsConfiguration { @@ -31,6 +31,8 @@ public class SellerOrderStatsConfiguration implements StatsConfiguration {
31 private List<Integer> excludeUids; 31 private List<Integer> excludeUids;
32 //属性 32 //属性
33 private List<SkupType> skupTypes; 33 private List<SkupType> skupTypes;
  34 + //求购方式
  35 + private List<Integer> bidTypes;
34 private StatsUnit statsUnit; 36 private StatsUnit statsUnit;
35 private int statsPeriod; 37 private int statsPeriod;
36 private String statsProcessorName; 38 private String statsProcessorName;
@@ -50,6 +50,7 @@ public class SellerOrderStatsConfigurationManager implements StatsConfigManager< @@ -50,6 +50,7 @@ public class SellerOrderStatsConfigurationManager implements StatsConfigManager<
50 //根据skup_type,exclud_uid(反向)过滤 50 //根据skup_type,exclud_uid(反向)过滤
51 Optional<SellerOrderStatsConfiguration> configurationOp = configurations.stream() 51 Optional<SellerOrderStatsConfiguration> configurationOp = configurations.stream()
52 .filter(config -> config.getSkupTypes().contains(statsEntry.getSkupType())) 52 .filter(config -> config.getSkupTypes().contains(statsEntry.getSkupType()))
  53 + .filter(config -> config.getBidTypes().contains(statsEntry.getBidType()))
53 .filter(config -> !config.getExcludeUids().contains(statsEntry.getSellerUid())) 54 .filter(config -> !config.getExcludeUids().contains(statsEntry.getSellerUid()))
54 .findFirst(); 55 .findFirst();
55 if (!configurationOp.isPresent()) { 56 if (!configurationOp.isPresent()) {
@@ -19,6 +19,7 @@ public class SellerOrderStatsEntry implements StatsEntry { @@ -19,6 +19,7 @@ public class SellerOrderStatsEntry implements StatsEntry {
19 private int buyerUid; 19 private int buyerUid;
20 private long buyerOrderCode; 20 private long buyerOrderCode;
21 private SkupType skupType; 21 private SkupType skupType;
  22 + private Integer bidType;
22 //查询时间 23 //查询时间
23 private int time; 24 private int time;
24 } 25 }