...
|
...
|
@@ -29,40 +29,32 @@ public class ForbiddenPageIdsLogicService { |
|
|
|
|
|
private static final String key = "SEARCH_FORBIDDEN_SKNLIST_%s";
|
|
|
|
|
|
private Map<String, List<String>> skn_forbiddenPageIds_map = null;
|
|
|
private Map<String, List<String>> sknForbiddenPageIdsMap = null;
|
|
|
private Map<String, Integer> pageForbiddenSknCountMap = null;
|
|
|
|
|
|
public List<String> getPageIdForbiddenSkns(String pageId) {
|
|
|
if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
|
|
return new ArrayList<String>();
|
|
|
}
|
|
|
return skn_forbiddenPageIds_map.get(pageId);
|
|
|
}
|
|
|
|
|
|
public synchronized Map<String, Integer> reloadForbiddenPageIds() {
|
|
|
Map<String, Integer> pageCountMap = new HashMap<String, Integer>();
|
|
|
public synchronized void reloadForbiddenPageIds() {
|
|
|
try {
|
|
|
INDEX_REBUILD_LOG.info("do reloadForbiddenPageIds .........");
|
|
|
List<String> allPageIds = SearchPageIdDefine.getAllPgeIds();
|
|
|
Map<String, List<String>> temp = new HashMap<String, List<String>>();
|
|
|
Map<String, List<String>> sknForbiddenPageIdsMap_temp = new HashMap<String, List<String>>();
|
|
|
Map<String, Integer> pageForbiddenSknCountMap_temp = new HashMap<String, Integer>();
|
|
|
for (String pageId : allPageIds) {
|
|
|
Set<String> forbiddenSknSet = this.getPageForbiddenSknSet(pageId);
|
|
|
for (String forbiddenSkn : forbiddenSknSet) {
|
|
|
List<String> pageIds = temp.get(forbiddenSkn);
|
|
|
List<String> pageIds = sknForbiddenPageIdsMap_temp.get(forbiddenSkn);
|
|
|
if (pageIds == null) {
|
|
|
pageIds = new ArrayList<String>();
|
|
|
temp.put(forbiddenSkn, pageIds);
|
|
|
sknForbiddenPageIdsMap_temp.put(forbiddenSkn, pageIds);
|
|
|
}
|
|
|
pageIds.add(pageId);
|
|
|
}
|
|
|
pageCountMap.put(pageId, forbiddenSknSet.size());
|
|
|
pageForbiddenSknCountMap_temp.put(pageId, forbiddenSknSet.size());
|
|
|
}
|
|
|
skn_forbiddenPageIds_map = temp;
|
|
|
sknForbiddenPageIdsMap = sknForbiddenPageIdsMap_temp;
|
|
|
pageForbiddenSknCountMap = pageForbiddenSknCountMap_temp;
|
|
|
} catch (Exception e) {
|
|
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
|
|
} finally {
|
|
|
|
|
|
}
|
|
|
return pageCountMap;
|
|
|
}
|
|
|
|
|
|
private Set<String> getPageForbiddenSknSet(String pageId) {
|
...
|
...
|
@@ -78,7 +70,7 @@ public class ForbiddenPageIdsLogicService { |
|
|
}
|
|
|
|
|
|
private boolean isNeedReload() {
|
|
|
if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
|
|
if (sknForbiddenPageIdsMap == null || sknForbiddenPageIdsMap.isEmpty()) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
...
|
...
|
@@ -95,17 +87,29 @@ public class ForbiddenPageIdsLogicService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
public String getSknForbiddenPageIds(ProductIBO productIBO) {
|
|
|
public Map<String, Integer> getPageForbiddenSknCountMap() {
|
|
|
checkAndInit();
|
|
|
Integer productSkn = productIBO.getProductSkn();
|
|
|
if (productSkn == null) {
|
|
|
return this.pageForbiddenSknCountMap;
|
|
|
}
|
|
|
|
|
|
public String getSknForbiddenPageIds(String productSkn) {
|
|
|
checkAndInit();
|
|
|
if (StringUtils.isBlank(productSkn)) {
|
|
|
return "";
|
|
|
}
|
|
|
List<String> forbidPageIds = skn_forbiddenPageIds_map.get(productSkn.toString());
|
|
|
List<String> forbidPageIds = sknForbiddenPageIdsMap.get(productSkn);
|
|
|
if (forbidPageIds == null || forbidPageIds.isEmpty()) {
|
|
|
return "";
|
|
|
}
|
|
|
return StringUtils.join(forbidPageIds, ",");
|
|
|
}
|
|
|
|
|
|
public String getSknForbiddenPageIds(ProductIBO productIBO) {
|
|
|
Integer productSkn = productIBO.getProductSkn();
|
|
|
if (productSkn == null) {
|
|
|
return "";
|
|
|
}
|
|
|
return this.getSknForbiddenPageIds(productSkn.toString());
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|