|
|
|
@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.supervision.chat.UploadParamEnum;
|
|
|
|
|
import com.supervision.chat.client.LangChainChatService;
|
|
|
|
|
import com.supervision.chat.client.dto.CreateBaseDTO;
|
|
|
|
|
import com.supervision.chat.client.dto.LangChainChatRes;
|
|
|
|
@ -55,6 +54,8 @@ import java.util.stream.Collectors;
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase> implements ModelCaseService {
|
|
|
|
|
|
|
|
|
|
private static final String DATA_STATUS_DEFAULT = "1";
|
|
|
|
|
|
|
|
|
|
private final ComDictionaryService comDictionaryService;
|
|
|
|
|
|
|
|
|
|
private final ModelCaseMapper modelCaseMapper;
|
|
|
|
@ -177,12 +178,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R<?> del(String id) {
|
|
|
|
|
|
|
|
|
|
ModelCase modelCase = modelCaseMapper.selectById(id);
|
|
|
|
|
LangChainChatRes langChainChatRes = langChainChatService.deleteBase(modelCase.getCaseNo());
|
|
|
|
|
if (200 != langChainChatRes.getCode()) {
|
|
|
|
|
log.info("删除知识库失败");
|
|
|
|
|
}
|
|
|
|
|
modelCase.setDataStatus(DataStatus.NOT_AVAILABLE.getCode());
|
|
|
|
|
int i = modelCaseMapper.updateById(modelCase);
|
|
|
|
|
if (i > 0) {
|
|
|
|
@ -192,6 +188,46 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public R<?> realDeleteByIds(List<String> ids) {
|
|
|
|
|
List<ModelCase> modelCases = modelCaseMapper.selectBatchIds(ids);
|
|
|
|
|
if (modelCases != null && !modelCases.isEmpty()) {
|
|
|
|
|
modelCases.forEach(modelCase -> {
|
|
|
|
|
LangChainChatRes<Object> langChainChatRes = langChainChatService.deleteBase(modelCase.getCaseNo());
|
|
|
|
|
if (200 != langChainChatRes.getCode()) {
|
|
|
|
|
log.error("删除知识库失败:{}, caseNo:{}", langChainChatRes.getMsg(), modelCase.getCaseNo());
|
|
|
|
|
throw new BusinessException("删除知识库失败");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
int i = modelCaseMapper.deleteBatchIds(ids);
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
return R.okMsg("删除成功");
|
|
|
|
|
} else {
|
|
|
|
|
return R.fail("删除失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public R<?> resetDataStatusByIds(List<String> ids) {
|
|
|
|
|
boolean result = false;
|
|
|
|
|
//批量查出案件,并更新案件状态
|
|
|
|
|
List<ModelCase> modelCases = modelCaseMapper.selectBatchIds(ids);
|
|
|
|
|
if (modelCases != null && !modelCases.isEmpty()) {
|
|
|
|
|
modelCases.forEach(modelCase -> {
|
|
|
|
|
modelCase.setDataStatus(DATA_STATUS_DEFAULT);
|
|
|
|
|
});
|
|
|
|
|
result = updateBatchById(modelCases);
|
|
|
|
|
}
|
|
|
|
|
if (result) {
|
|
|
|
|
return R.okMsg("恢复成功");
|
|
|
|
|
} else {
|
|
|
|
|
return R.fail("恢复失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R<List<CasePerson>> getPerson(String caseId, String name) {
|
|
|
|
|
LambdaQueryWrapper<CasePerson> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|