Authored by mali

Merge branch 'test6.9.17' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.17

... ... @@ -38,6 +38,7 @@ public class MetaConfigController {
@RequestMapping("/orderMetaConfig/cleanCacheByCode")
@ResponseBody
public ApiResponse cleanCacheByCode(@RequestBody JSONObject jsonObject){
logger.info("MetaConfigController.cleanCacheByCode in. req is :{}",jsonObject);
String code = jsonObject.getString("code");
if(null != code && !"".equals(code)){
logger.info("clean metaConfig cache by code :{}",code);
... ...
... ... @@ -436,52 +436,48 @@ public class MetaConfigService {
* @param code
*/
public void clearCacheByCode(String code){
switch (code){
case "buyer_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_CANCEL_PENALTY.builderKeyOnlyFixed().getKey());
break;
case "seller_enter_threshold":
cacheClient.delete(CacheKeyBuilder.KeyTemp.ENTRY_THRESHOLD.builderKeyOnlyFixed().getKey());
break;
case "seller_earnest_money":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "seller_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "presale_threshold":
cacheClient.delete(CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD.builderKeyOnlyFixed().getKey());
break;
case "order_code_rule":
cacheClient.delete(CacheKeyBuilder.KeyTemp.ORDER_CODE_RULE.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_fee_rate":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_platform_fee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_order_fee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_overseas_order_cut_policy":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_CUT_POLICY.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_price_limit":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_SALE_PRICE_LIMIT.builderKeyOnlyFixed().getKey());
break;
case "depositFee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.DEPOSIT_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_bid_config":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "seller_bid_goods_fee_rate":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_BID_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
break;
case "buyer_order_violation_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_VIOLATION_PENALTY.builderKeyOnlyFixed().getKey());
break;
CacheKeyBuilder.KeyTemp cacheKeyTemp = findMetaCodeCacheKeyMap().get(code);
if (Objects.isNull(cacheKeyTemp)){
logger.warn("clearCacheByCode find no cacheKeyTemp, code {}", code);
}else{
logger.info("clearCacheByCode find cacheKeyTemp {}, code {}", cacheKeyTemp, code);
cacheClient.delete(cacheKeyTemp.builderKeyOnlyFixed().getKey());
logger.info("clearCacheByCode finished, cacheKeyTemp {}, code {}", cacheKeyTemp, code);
}
}
/**
* delay load map data
*/
private static class DataHold{
private static final Map<String,CacheKeyBuilder.KeyTemp> MetaCodeCacheKeyMap ;
static {
MetaCodeCacheKeyMap = new HashMap<>(16);
MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_PENALTY, CacheKeyBuilder.KeyTemp.BUYER_CANCEL_PENALTY);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_ENTER_THRESHOLD, CacheKeyBuilder.KeyTemp.ENTRY_THRESHOLD);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_EARNEST_MONEY, CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_PENALTY, CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG);
MetaCodeCacheKeyMap.put(MetaConfigKey.PRESALE_THRESHOLD, CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD);
MetaCodeCacheKeyMap.put(MetaConfigKey.ORDER_CODE_RULE, CacheKeyBuilder.KeyTemp.ORDER_CODE_RULE);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_FEE_RATE, CacheKeyBuilder.KeyTemp.SELLER_GOODS_FEE_RATE);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_PLATFORM_FEE, CacheKeyBuilder.KeyTemp.SELLER_GOODS_PLATFORM_FEE);
MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_ORDER_FEE, CacheKeyBuilder.KeyTemp.BUYER_ORDER_FEE);
MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_OVERSEAS_ORDER_CUT_POLICY, CacheKeyBuilder.KeyTemp.BUYER_ORDER_CUT_POLICY);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_PRICE_LIMIT, CacheKeyBuilder.KeyTemp.SELLER_SALE_PRICE_LIMIT);
MetaCodeCacheKeyMap.put(MetaConfigKey.DEPOSIT_FEE_POLICY, CacheKeyBuilder.KeyTemp.DEPOSIT_PLATFORM_FEE);
MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_BID_CONFIG, CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG);
MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_BID_GOODS_FEE_RATE, CacheKeyBuilder.KeyTemp.SELLER_BID_GOODS_FEE_RATE);
MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_ORDER_VIOLATION_PENALTY, CacheKeyBuilder.KeyTemp.BUYER_ORDER_VIOLATION_PENALTY);
}
}
/**
* TODO replace all method of get cache key when time is enough
* @return
*/
protected static Map<String,CacheKeyBuilder.KeyTemp> findMetaCodeCacheKeyMap(){
return DataHold.MetaCodeCacheKeyMap;
}
}
... ...