pull/1/head
liuwx_gitee 1 year ago
parent 4e147fe326
commit 83211c92f0

@ -23,7 +23,7 @@ public interface IKmDocService extends IService<KmDoc> {
//首页最新发布文档列表
Page<KmDocVO> queryPublicPageList(Page<KmDocVO> page, KmDocParamVO kmDocParamVO,String orderBy);
void convertDocSync(KmDoc doc);
void indexDocSync(KmDoc doc);
@ -58,4 +58,6 @@ public interface IKmDocService extends IService<KmDoc> {
Result<?> deleteDoc(String docId,HttpServletRequest req);
KmDocEsVO getEsDocByDocId(String indexId);
void initESIndex();
}

@ -44,7 +44,6 @@ import org.jeecg.common.system.vo.KmSearchResultObjVO;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.KM.VO.*;
import org.jeecg.modules.KM.common.config.BaseConfig;
@ -1656,4 +1655,20 @@ public class KmDocServiceImpl extends ServiceImpl<KmDocMapper, KmDoc> implements
return kmDocMapper.queryKmDocStatistics(page,statisticsType,dbType);
}
@Override
public void initESIndex(){
KmDocEsVO kmEsVO = new KmDocEsVO();
kmEsVO.setTitle("for init");
kmEsVO.setDocId("1");
Result<?> result = saveDocToEs(kmEsVO, "");
if (result.isSuccess()) {
String indexId = (String) result.getResult();
if (indexId != null && !indexId.isEmpty()) {
Result<?> result1 = deleteDocFromEs(indexId);
if (result1.isSuccess()) {
log.info("init index success!");
}
}
}
}
}

@ -24,6 +24,8 @@ public class KmEsMgntServiceImpl implements IKmEsMgntService {
@Autowired
private RestHighLevelClient restHighLevelClient;
@Autowired
private IKmDocService docService;
private boolean checkTemplateExists(String templateName)throws IOException {
@ -42,6 +44,7 @@ public class KmEsMgntServiceImpl implements IKmEsMgntService {
log.error(result.getMessage());
return result;
}
docService.initESIndex();
}
if(!checkTemplateExists(KMConstant.KMSearchRecordIndexName)){
result = initKmSearchRecordTemplate();

@ -123,9 +123,11 @@ public class SysCategoryController {
public Result<?> add(@RequestBody SysCategory sysCategory) {
Result<SysCategory> result = new Result<SysCategory>();
try {
if(oConvertUtils.isNotEmpty(sysCategory.getPid()) && !sysCategory.getPid().equals("0") &&
sysCategory.getRecommend() != null
&& sysCategory.getRecommend() == true)
if(sysCategory.getPid() != null
&& oConvertUtils.isNotEmpty(sysCategory.getPid())
&& !sysCategory.getPid().equals("0")
&& sysCategory.getRecommend() != null
&& sysCategory.getRecommend())
return Result.error("只允许推荐根节点的专题");
sysCategoryService.addSysCategory(sysCategory);

Loading…
Cancel
Save