删除案件时同步删除相关数据

topo_dev
DESKTOP-DDTUS3E\yaxin 7 months ago
parent eca79588ee
commit 3661db24ba

@ -66,6 +66,12 @@ public class ModelCaseController {
return modelCaseService.addOrUpd(modelCaseBase);
}
/**
* ID
*
* @param ids ID
* @return R
*/
@DeleteMapping("/realDeleteByIds")
public R<?> realDeleteByIds(@RequestBody List<String> ids) {
return modelCaseService.realDeleteByIds(ids);
@ -132,8 +138,8 @@ public class ModelCaseController {
*/
@PostMapping("/getIndexDetail")
public R<IPage<IndexDetail>> getIndexDetail(@RequestBody IndexResultQuery query,
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) {
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) {
IPage<IndexDetail> indexDetail = modelCaseService.getIndexDetail(query, page, size);
return R.ok(indexDetail);
}

@ -8,6 +8,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -56,8 +57,6 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
private final ModelCaseMapper modelCaseMapper;
private final CasePersonService casePersonService;
private final CaseStatusManageService caseStatusManageService;
private final LangChainChatService langChainChatService;
@ -66,6 +65,10 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
@Autowired
private NoteRecordSplitService noteRecordSplitService;
@Autowired
private NoteRecordService noteRecordService;
@Autowired
private CasePersonService casePersonService;
/**
*
@ -198,10 +201,13 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
LangChainChatRes<Object> langChainChatRes = langChainChatService.deleteBase(modelCase.getCaseNo());
if (200 != langChainChatRes.getCode()) {
log.error("删除知识库失败:{}, caseNo:{}", langChainChatRes.getMsg(), modelCase.getCaseNo());
throw new BusinessException("删除知识库失败");
// throw new BusinessException("删除知识库失败");
}
});
}
noteRecordService.list(new QueryWrapper<NoteRecord>().in("case_id", ids)).forEach(noteRecord -> noteRecordSplitService.delRecords(noteRecord.getId()));
List<String> personIds = casePersonService.list(new QueryWrapper<CasePerson>().in("case_id", ids)).stream().map(CasePerson::getId).collect(Collectors.toList());
personIds.forEach(personId -> casePersonService.removeById(personId));
int i = modelCaseMapper.deleteBatchIds(ids);
if (i > 0) {
return R.okMsg("删除成功");
@ -358,7 +364,7 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
Assert.notEmpty(query.getCaseId(), "案件id不能为空");
Assert.notEmpty(query.getIndexType(), "指标类型不能为空");
IPage<IndexDetail> iPage = modelCaseMapper.pageListIndexResult(query,Page.of(pageNum, pageSize));
IPage<IndexDetail> iPage = modelCaseMapper.pageListIndexResult(query, Page.of(pageNum, pageSize));
List<IndexDetail> records = iPage.getRecords();
// 添加 附属内容
@ -370,11 +376,12 @@ public class ModelCaseServiceImpl extends ServiceImpl<ModelCaseMapper, ModelCase
/**
*
* @param caseId id
*
* @param caseId id
* @param indexDetails
*/
private void attachRecord(String caseId,List<IndexDetail> indexDetails) {
if (CollUtil.isEmpty(indexDetails)){
private void attachRecord(String caseId, List<IndexDetail> indexDetails) {
if (CollUtil.isEmpty(indexDetails)) {
return;
}

Loading…
Cancel
Save