...
|
...
|
@@ -63,7 +63,7 @@ public class MetaConfigService { |
|
|
bp = JSONObject.parseObject(value, BuyerPenalty.class);
|
|
|
}catch (Exception ex){
|
|
|
bp = new BuyerPenalty();
|
|
|
logger.warn("in getBuyerPenalty parse config value fail, key {} value {}", key, value);
|
|
|
logger.warn("in getBuyerPenalty parse config value fail, key {} value {}", key, value, ex);
|
|
|
}
|
|
|
return bp;
|
|
|
}
|
...
|
...
|
@@ -95,7 +95,7 @@ public class MetaConfigService { |
|
|
logger.info("in getEntryThreshold from DB {}", metaConfig);
|
|
|
configVal=metaConfig.getValue();
|
|
|
if (StringUtils.isNotBlank(configVal)){
|
|
|
cacheClient.setEx(rkb, configVal, 300);
|
|
|
cacheClient.setEx(rkb, configVal, ExpiredTime.ORDER_BASE_CONFIG);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -108,6 +108,7 @@ public class MetaConfigService { |
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* {
|
...
|
...
|
@@ -116,12 +117,20 @@ public class MetaConfigService { |
|
|
* }
|
|
|
*/
|
|
|
public EarnestMoney getSellerEarnestMoney(SkupType skupType){
|
|
|
final String key = MetaConfigKey.SELLER_EARNEST_MONEY;
|
|
|
CacheKeyBuilder.KeyTemp kt = CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG;
|
|
|
RedisKeyBuilder rkb = kt.builderKeyOnlyFixed();
|
|
|
String configVal = cacheClient.get(rkb, String.class);
|
|
|
EarnestMoney em = null;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
String metaVal = metaConfig.getValue();
|
|
|
if (StringUtils.isBlank(configVal)) {
|
|
|
final String key = MetaConfigKey.SELLER_EARNEST_MONEY;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
configVal = metaConfig.getValue();
|
|
|
if (StringUtils.isNotBlank(configVal)){
|
|
|
cacheClient.setEx(rkb, configVal, ExpiredTime.ORDER_BASE_CONFIG);
|
|
|
}
|
|
|
}
|
|
|
try{
|
|
|
JSONObject emjo = JSONObject.parseObject(metaVal);
|
|
|
JSONObject emjo = JSONObject.parseObject(configVal);
|
|
|
String advanceSaleKey = "advanceSale", inStockKey = "inStock";
|
|
|
JSONObject asJO = emjo.getJSONObject(advanceSaleKey),
|
|
|
insJO = emjo.getJSONObject(inStockKey);
|
...
|
...
|
@@ -140,7 +149,7 @@ public class MetaConfigService { |
|
|
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("in getSellerEarnestMoney parseObject fail metaVal {}", metaVal);
|
|
|
logger.warn("in getSellerEarnestMoney parseObject fail metaVal {}", configVal, ex);
|
|
|
}
|
|
|
return em;
|
|
|
}
|
...
|
...
|
@@ -192,14 +201,25 @@ public class MetaConfigService { |
|
|
}
|
|
|
}
|
|
|
* */
|
|
|
final String key = MetaConfigKey.SELLER_PENALTY;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
String metaVal = metaConfig.getValue();
|
|
|
CacheKeyBuilder.KeyTemp kt = CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG;
|
|
|
RedisKeyBuilder rkb = kt.builderKeyOnlyFixed();
|
|
|
String configVal = cacheClient.get(rkb, String.class);
|
|
|
if (StringUtils.isBlank(configVal)) {
|
|
|
final String key = MetaConfigKey.SELLER_PENALTY;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
configVal = metaConfig.getValue();
|
|
|
|
|
|
if (StringUtils.isNotBlank(configVal)){
|
|
|
cacheClient.setEx(rkb, configVal, ExpiredTime.ORDER_BASE_CONFIG);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
BuyerPenalty sellerPenalty = new BuyerPenalty();
|
|
|
try{
|
|
|
sellerPenalty = JSONObject.parseObject(metaVal, BuyerPenalty.class);
|
|
|
sellerPenalty = JSONObject.parseObject(configVal, BuyerPenalty.class);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("in getSellerPenalty parseObject fail, metaVal {}", metaVal);
|
|
|
logger.warn("in getSellerPenalty parseObject fail, metaVal {}", configVal, ex);
|
|
|
}
|
|
|
return sellerPenalty;
|
|
|
}
|
...
|
...
|
@@ -210,12 +230,21 @@ public class MetaConfigService { |
|
|
* @return
|
|
|
*/
|
|
|
public PreSaleOrderConfig getPreSaleOrderConfig(){
|
|
|
String key = MetaConfigKey.PRESALE_THRESHOLD;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
String metaVal = metaConfig.getValue();
|
|
|
CacheKeyBuilder.KeyTemp kt = CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD;
|
|
|
RedisKeyBuilder rkb = kt.builderKeyOnlyFixed();
|
|
|
String configVal = cacheClient.get(rkb, String.class);
|
|
|
if (StringUtils.isBlank(configVal)) {
|
|
|
String key = MetaConfigKey.PRESALE_THRESHOLD;
|
|
|
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
|
|
|
configVal = metaConfig.getValue();
|
|
|
if (StringUtils.isNotBlank(configVal)){
|
|
|
cacheClient.setEx(rkb, configVal, ExpiredTime.ORDER_BASE_CONFIG);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
PreSaleOrderConfig psoc;
|
|
|
try {
|
|
|
JSONObject psocJO = JSONObject.parseObject(metaVal);
|
|
|
JSONObject psocJO = JSONObject.parseObject(configVal);
|
|
|
JSONObject ntrJO = psocJO.getJSONObject("notice").getJSONObject("timeRange");
|
|
|
TimeUnit ntrtu = "h".equalsIgnoreCase(ntrJO.getString("timeUnit")) ? TimeUnit.HOURS : TimeUnit.DAYS;
|
|
|
PreSaleOrderConfig.Range ntr = PreSaleOrderConfig.Range.builder()
|
...
|
...
|
@@ -232,7 +261,7 @@ public class MetaConfigService { |
|
|
psoc = PreSaleOrderConfig.builder().autoCancelRange(actr)
|
|
|
.noticeRange(ntr).build();
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("getPreSaleOrderConfig fail ,use default in Process self");
|
|
|
logger.warn("getPreSaleOrderConfig fail ,use default in Process self, configVal {}", configVal, ex);
|
|
|
psoc = PreSaleOrderConfig.getDefault();
|
|
|
}
|
|
|
return psoc;
|
...
|
...
|
|