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

fix: 知识库状态判断修正

parent 271fb965
......@@ -133,6 +133,23 @@ public class KnowledgeServiceImpl implements KnowledgeService {
bizKnowledgeDocumentService.deleted(kdId);
bizMemberKnowledgeRelationService.deletedByKdId(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;
}
......
......@@ -12,13 +12,13 @@ import java.util.List;
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;
BizKnowledgeInfoEntity save(BizKnowledgeInfoEntity entity) throws Exception;
BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity) throws Exception;
BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity);
void deletedById(java.lang.Integer id) throws Exception;
......
......@@ -31,7 +31,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl
@Resource
private BizKnowledgeInfoRepository repository;
public BizKnowledgeInfoEntity get(java.lang.Integer id) throws Exception {
public BizKnowledgeInfoEntity get(java.lang.Integer id) {
Assert.notNull(id);
BizKnowledgeInfoModel model = this.repository.get(id);
if (model == null) {
......@@ -67,7 +67,7 @@ public class BizKnowledgeInfoServiceImpl extends BaseServiceImpl
return BizKnowledgeInfoConvert.modelToEntity(saveModel);
}
public BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity) throws Exception {
public BizKnowledgeInfoEntity update(BizKnowledgeInfoEntity entity){
Assert.notNull(entity);
Assert.notNull(entity.getId(), "update pk can not be null");
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