修正内容标签获取内容状态失败问题,修正删除索引异常,扩展模型资源文件上传组件异常修正

This commit is contained in:
liweiyi 2025-02-27 23:33:00 +08:00
parent 722eb3b9fb
commit df1edc879f
6 changed files with 28 additions and 19 deletions

View File

@ -106,6 +106,9 @@ public class TagContentVO extends TagBaseVO {
@XComment("内容属性标识列表") @XComment("内容属性标识列表")
private String[] attributes; private String[] attributes;
@XComment("内容状态")
private String status;
@XComment("是否链接内容") @XComment("是否链接内容")
private String linkFlag; private String linkFlag;

View File

@ -54,7 +54,7 @@ public class CatalogPageSizeProperty implements IProperty {
@Override @Override
public boolean validate(String value) { public boolean validate(String value) {
return StringUtils.isEmpty(value) || NumberUtils.isCreatable(value.toString()); return StringUtils.isEmpty(value) || NumberUtils.isCreatable(value);
} }
@Override @Override

View File

@ -37,7 +37,7 @@ public class ESSearchListener {
private final ContentIndexService contentIndexService; private final ContentIndexService contentIndexService;
@EventListener @EventListener
public void afterSiteDelete(AfterSiteDeleteEvent event) { public void afterSiteDelete(AfterSiteDeleteEvent event) throws IOException {
if (!contentIndexService.isElasticSearchAvailable()) { if (!contentIndexService.isElasticSearchAvailable()) {
return; return;
} }

View File

@ -130,16 +130,26 @@ public class ContentIndexService implements CommandLineRunner {
/** /**
* 删除站点索引库 * 删除站点索引库
*/ */
public void deleteIndex(CmsSite site) { public void deleteIndex(CmsSite site) throws IOException {
String indexName = CmsSearchConstants.indexName(site.getSiteId().toString()); String indexName = CmsSearchConstants.indexName(site.getSiteId().toString());
try { deleteIndex(indexName);
}
public void deleteIndex(String indexName) throws IOException {
boolean exists = esClient.indices().exists(fn -> fn.index(indexName)).value(); boolean exists = esClient.indices().exists(fn -> fn.index(indexName)).value();
if (exists) { if (!exists) {
return; return;
} }
esClient.indices().delete(fn -> fn.index(indexName)); esClient.indices().delete(fn -> fn.index(indexName));
} catch (IOException e) { while(exists) {
log.error("Delete elasticsearch index failed: " + indexName, e); exists = esClient.indices().exists(fn -> fn.index(indexName)).value();
if (exists) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
log.warn(e.getMessage(), e);
}
}
} }
} }
@ -267,14 +277,7 @@ public class ContentIndexService implements CommandLineRunner {
if (exists) { if (exists) {
// 先删除内容索引文档 // 先删除内容索引文档
deleteContentIndices(site); deleteContentIndices(site);
deleteIndex(indexName);
esClient.indices().delete(fn ->fn.index(indexName));
while(exists) {
exists = esClient.indices().exists(fn -> fn.index(indexName)).value();
if (exists) {
Thread.sleep(2000);
}
}
} }
createIndex(site); createIndex(site);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -147,6 +147,9 @@ export default {
getResourceFileIconClass(index) { getResourceFileIconClass(index) {
return getFileSvgIconClass(this.fileList[index].src) return getFileSvgIconClass(this.fileList[index].src)
}, },
isImageResource (index) {
return isImage(this.fileList[index].src);
},
} }
}; };
</script> </script>