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

@ -58,4 +58,6 @@ public interface IKmDocService extends IService<KmDoc> {
Result<?> deleteDoc(String docId,HttpServletRequest req); Result<?> deleteDoc(String docId,HttpServletRequest req);
KmDocEsVO getEsDocByDocId(String indexId); 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.system.vo.LoginUser;
import org.jeecg.common.util.CommonUtils; import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.KM.VO.*; import org.jeecg.modules.KM.VO.*;
import org.jeecg.modules.KM.common.config.BaseConfig; 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); 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 @Autowired
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;
@Autowired
private IKmDocService docService;
private boolean checkTemplateExists(String templateName)throws IOException { private boolean checkTemplateExists(String templateName)throws IOException {
@ -42,6 +44,7 @@ public class KmEsMgntServiceImpl implements IKmEsMgntService {
log.error(result.getMessage()); log.error(result.getMessage());
return result; return result;
} }
docService.initESIndex();
} }
if(!checkTemplateExists(KMConstant.KMSearchRecordIndexName)){ if(!checkTemplateExists(KMConstant.KMSearchRecordIndexName)){
result = initKmSearchRecordTemplate(); result = initKmSearchRecordTemplate();

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

Loading…
Cancel
Save