...
|
...
|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference; |
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yohobuy.ufo.model.order.common.EntrySellerType;
|
|
|
import com.yohobuy.ufo.model.order.common.MetaConfigKey;
|
|
|
import com.yohobuy.ufo.model.order.constants.SkupType;
|
|
|
import com.yohobuy.ufo.model.order.resp.EntryThreshold;
|
|
|
import com.yohoufo.common.cache.CacheClient;
|
|
|
import com.yohoufo.dal.order.MetaConfigMapper;
|
...
|
...
|
@@ -40,7 +41,7 @@ public class MetaConfigService { |
|
|
@Autowired
|
|
|
private CacheClient cacheClient;
|
|
|
/**
|
|
|
* TODO use cache
|
|
|
* use cache
|
|
|
* @return
|
|
|
*/
|
|
|
public BuyerPenalty getBuyerPenalty(){
|
...
|
...
|
@@ -109,29 +110,46 @@ public class MetaConfigService { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* {"advanceSale":{"max":400,"min":40,"rate":0.08}}
|
|
|
* {
|
|
|
* "advanceSale":{"max":400,"min":40,"rate":0.08},
|
|
|
* "inStock":{"max":200,"min":20,"rate":0.04}
|
|
|
* }
|
|
|
*/
|
|
|
public EarnestMoney getSellerEarnestMoney(){
|
|
|
public EarnestMoney getSellerEarnestMoney(SkupType skupType){
|
|
|
final String key = MetaConfigKey.SELLER_EARNEST_MONEY;
|
|
|
EarnestMoney em = null;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
String metaVal = metaConfig.getValue();
|
|
|
|
|
|
try{
|
|
|
JSONObject emjo = JSONObject.parseObject(metaVal);
|
|
|
String advanceSale_key = "advanceSale";
|
|
|
JSONObject asJO = emjo.getJSONObject(advanceSale_key);
|
|
|
String advanceSaleKey = "advanceSale", inStockKey = "inStock";
|
|
|
JSONObject asJO = emjo.getJSONObject(advanceSaleKey),
|
|
|
insJO = emjo.getJSONObject(inStockKey);
|
|
|
switch (skupType){
|
|
|
case ADVANCE:
|
|
|
if (Objects.nonNull(asJO)){
|
|
|
em = new EarnestMoney();
|
|
|
em.setMin(asJO.getBigDecimal("min"));
|
|
|
em.setMax(asJO.getBigDecimal("max"));
|
|
|
em.setRate(asJO.getBigDecimal("rate"));
|
|
|
em = json2Bo(asJO);
|
|
|
}
|
|
|
break;
|
|
|
case IN_STOCK:
|
|
|
if (Objects.nonNull(insJO)){
|
|
|
em = json2Bo(insJO);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("in getSellerEarnestMoney parseObject fail metaVal {}", metaVal);
|
|
|
}
|
|
|
return em;
|
|
|
}
|
|
|
|
|
|
|
|
|
private EarnestMoney json2Bo(JSONObject jo){
|
|
|
EarnestMoney em = new EarnestMoney();
|
|
|
em.setMin(jo.getBigDecimal("min"));
|
|
|
em.setMax(jo.getBigDecimal("max"));
|
|
|
em.setRate(jo.getBigDecimal("rate"));
|
|
|
return em;
|
|
|
}
|
|
|
|
...
|
...
|
|