...
|
...
|
@@ -61,8 +61,7 @@ public class SuggestConversionCustomMqListener extends AbstractMqListener implem |
|
|
}
|
|
|
// 更新数据库
|
|
|
suggestConversionCustomService.saveOrUpdate(suggestConversionCustom);
|
|
|
logger.info("[func=updateData][step=success][id={}][cost={}ms]", suggestConversionCustom.getId(), (System.currentTimeMillis() - begin));
|
|
|
|
|
|
logger.info("[func=updateData][id={}][cost={}ms]", suggestConversionCustom.getId(), (System.currentTimeMillis() - begin));
|
|
|
// 更新索引
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
dataMap.put("source", suggestConversionCustom.getSource());
|
...
|
...
|
@@ -70,7 +69,7 @@ public class SuggestConversionCustomMqListener extends AbstractMqListener implem |
|
|
dataMap.put("updateTime", suggestConversionCustom.getUpdateTime());
|
|
|
dataMap.put("status", suggestConversionCustom.getStatus());
|
|
|
indexService.updateIndexData(ISearchConstants.INDEX_NAME_CONVERSION, MD5Util.string2MD5(dataMap.get("source").toString().trim().toLowerCase()), dataMap);
|
|
|
logger.info("[func=updateDataToES][step=success][source={}][cost={}ms]", suggestConversionCustom.getSource(), (System.currentTimeMillis() - begin));
|
|
|
logger.info("[func=updateDataToES][source={}][cost={}ms]", suggestConversionCustom.getSource(), (System.currentTimeMillis() - begin));
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -79,14 +78,12 @@ public class SuggestConversionCustomMqListener extends AbstractMqListener implem |
|
|
return;
|
|
|
}
|
|
|
long begin = System.currentTimeMillis();
|
|
|
|
|
|
SuggestConversionCustom sourceData = suggestConversionCustomService.selectByPrimaryKey(Integer.valueOf(id));
|
|
|
SuggestConversion suggestConversion;
|
|
|
if (sourceData != null) {
|
|
|
// 删除数据
|
|
|
suggestConversionCustomService.delete(Integer.valueOf(id));
|
|
|
logger.info("[func=deleteData][step=success][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
|
|
|
logger.info("[func=deleteData][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
if ((suggestConversion = suggestConversionService.selectBySource(sourceData.getSource())) != null) {
|
|
|
// 还原成自动爬虫生成的数据
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
...
|
...
|
@@ -95,10 +92,10 @@ public class SuggestConversionCustomMqListener extends AbstractMqListener implem |
|
|
dataMap.put("updateTime", suggestConversion.getUpdateTime());
|
|
|
dataMap.put("status", SuggestionConstants.VALID_STATUS);
|
|
|
indexService.updateIndexData(ISearchConstants.INDEX_NAME_CONVERSION, MD5Util.string2MD5(sourceData.getSource().trim().toLowerCase()), dataMap);
|
|
|
logger.info("[func=updateDataToES][step=success][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
logger.info("[func=updateDataToES][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
} else {
|
|
|
indexService.deleteIndexData(ISearchConstants.INDEX_NAME_CONVERSION, MD5Util.string2MD5(sourceData.getSource().trim().toLowerCase()));
|
|
|
logger.info("[func=deleteDataFromES][step=success][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
logger.info("[func=deleteDataFromES][id={}][cost={}ms]", id, System.currentTimeMillis() - begin);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|