@Override public NotifyResult process(Element root) { Element requestHeader = root.element("Header"); serialNo = XmlUtils.getChildElementContent(requestHeader, "SerialNo"); String memcached_key = "shholiday_notify_" + serialNo; if ("true".equals(MemcachedUtil.getInstance().get(memcached_key))) { result.setSuccess(header); // 直接正常返回 } else { Element body = root.element(bodyElementTag); handle(body); result.setSuccess(header); if (header.isSuccess()) { MemcachedUtil.getInstance().set(memcached_key, "true"); } } return result; }
/** * 初始化城市推荐信息. * * @param params */ public Map<String, Object> initRecommendCities(Map<String, Object> params, String blockIdstr) { Long blockId = getBlockIdByProperties(blockIdstr); params.put("parentId", blockId); // 根据拼音排序 params.put("orderByPin", "true"); // 从缓存中获取信息. String memcacheKey = getMemcacheKeyByParams(params); Object obj = getMemecachedInfo(memcacheKey); Map<String, Object> map = new HashMap<String, Object>(); if (null == obj) { // 查询子块 List<MobileRecommendBlock> blockList = mobileRecommendBlockService.queryMobileRecommendBlockByParam(params); List<Map<String, Object>> recommendMapList = new ArrayList<Map<String, Object>>(); // 存放每个字块的列表 // 字块数据 . if (null != blockList && !blockList.isEmpty()) { for (int i = 0; i < blockList.size(); i++) { MobileRecommendBlock mb = blockList.get(i); if (null == mb || mb.getId() == null || StringUtils.isEmpty(mb.getBlockName())) { continue; } Map<String, Object> t_map = new HashMap<String, Object>(); t_map.put("name", StringUtils.isEmpty(mb.getBlockName()) ? "" : mb.getBlockName()); t_map.put("subName", null == mb.getReserve2() ? "" : mb.getReserve2()); t_map.put( "pinyin", StringUtils.isEmpty(str2UpperCase(mb.getReserve1())) ? "" : str2UpperCase(mb.getReserve1())); // 国外 9 if ("9".equals(blockIdstr)) { t_map.put( "isHot", HOT_CITY_GUO_WAI.contains(null == mb.getBlockName() ? "" : mb.getBlockName())); } else { t_map.put( "isHot", HOT_CITY_GUONEI.contains(null == mb.getBlockName() ? "" : mb.getBlockName())); } t_map.put("id", mb.getId()); recommendMapList.add(t_map); } } map.put("datas", recommendMapList); if (recommendMapList != null && !recommendMapList.isEmpty()) { MemcachedUtil.getInstance() .set(MOBILE_RECOMMEND_CACHE + memcacheKey, MOBILE_MEMCACHE_SECOND, recommendMapList); } } else { map.put("datas", obj); } return initVersion(map, params); }
private boolean isKill(final BuyInfo buyInfo) { boolean isKill = false; for (Item item : buyInfo.getItemList()) { if ("true".equals(item.getIsDefault())) { String productId = (String) MemcachedUtil.getInstance().get("KILL_PRODUCT_" + item.getProductId()); if (productId != null && productId.equals("Y")) { isKill = true; } } } return isKill; }