Authored by wujiexiang

求购 -- 鉴定通过不统计卖家订单

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