Commit 02e9a20e authored by alex yao's avatar alex yao

fix: 知识库状态判断修正

parent 271fb965
...@@ -133,6 +133,23 @@ public class KnowledgeServiceImpl implements KnowledgeService { ...@@ -133,6 +133,23 @@ public class KnowledgeServiceImpl implements KnowledgeService {
bizKnowledgeDocumentService.deleted(kdId); bizKnowledgeDocumentService.deleted(kdId);
bizMemberKnowledgeRelationService.deletedByKdId(kdId); bizMemberKnowledgeRelationService.deletedByKdId(kdId);
bizKnowledgeInfoService.removeDocument(knowledgeInfoId, kdId); bizKnowledgeInfoService.removeDocument(knowledgeInfoId, kdId);
BizKnowledgeInfoEntity bizKnowledgeInfoEntity = bizKnowledgeInfoService.get(knowledgeInfoId);
String kdIds = bizKnowledgeInfoEntity.getKdIds();
List<Integer> kdIdList = JsonUtils.deSerialize(kdIds, new TypeReference<List<Integer>>() {
}.getType());
List<KnowledgeQueryItem> knowledgeQueryItems = bizKnowledgeDocumentService.searchKnowledge(null, null, bizKnowledgeInfoEntity.getMemberId(), null, kdIdList, null);
boolean isCompleted = true;
for (KnowledgeQueryItem knowledgeQueryItem : knowledgeQueryItems) {
if (!KnowledgeConstant.TrainStatus.COMPLETE.equals(knowledgeQueryItem.getTrainStatus())) {
isCompleted = false;
break;
}
}
if (isCompleted) {
bizKnowledgeInfoEntity.setTrainStatus(KnowledgeConstant.TrainStatus.COMPLETE);
bizKnowledgeInfoService.update(bizKnowledgeInfoEntity);
}
return true; return true;
} }
......
...@@ -12,13 +12,13 @@ import java.util.List; ...@@ -12,13 +12,13 @@ import java.util.List;
public interface BizKnowledgeInfoService extends BaseService { public interface BizKnowledgeInfoService extends BaseService {
BizKnowledgeInfoEntity get(java.lang.Integer id) throws Exception; BizKnowledgeInfoEntity get(java.lang.Integer id);
List<BizKnowledgeInfoEntity> findByExample(BizKnowledgeInfoEntity example, PagingInfo pagingInfo) throws Exception; List<BizKnowledgeInfoEntity> findByExample(BizKnowledgeInfoEntity example, PagingInfo pagingInfo) throws Exception;
BizKnowledgeInfoEntity save(BizKnowledgeInfoEntity entity) throws Exception; BizKnowledgeInfoEntity save(BizKnowledgeInfoEntity entity) throws Exception;
BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity) throws Exception; BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity);
void deletedById(java.lang.Integer id) throws Exception; void deletedById(java.lang.Integer id) throws Exception;
......
...@@ -31,7 +31,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl ...@@ -31,7 +31,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl
@Resource @Resource
private BizKnowledgeInfoRepository repository; private BizKnowledgeInfoRepository repository;
public BizKnowledgeInfoEntity get(java.lang.Integer id) throws Exception { public BizKnowledgeInfoEntity get(java.lang.Integer id) {
Assert.notNull(id); Assert.notNull(id);
BizKnowledgeInfoModel model = this.repository.get(id); BizKnowledgeInfoModel model = this.repository.get(id);
if (model == null) { if (model == null) {
...@@ -67,7 +67,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl ...@@ -67,7 +67,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl
return BizKnowledgeInfoConvert.modelToEntity(saveModel); return BizKnowledgeInfoConvert.modelToEntity(saveModel);
} }
public BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity) throws Exception { public BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity){
Assert.notNull(entity); Assert.notNull(entity);
Assert.notNull(entity.getId(), "update pk can not be null"); Assert.notNull(entity.getId(), "update pk can not be null");
BizKnowledgeInfoModel model = this.repository.get(entity.getId()); BizKnowledgeInfoModel model = this.repository.get(entity.getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment