Merge remote-tracking branch 'origin/dev_1.0.0' into dev_1.0.0

topo_dev
xueqingkun 9 months ago
commit 97d8f38f87

@ -67,6 +67,16 @@ public class ModelCaseController {
return modelCaseService.addOrUpd(modelCaseBase);
}
@DeleteMapping("/realDeleteByIds")
public R<?> realDeleteByIds(@RequestBody List<String> ids) {
return modelCaseService.realDeleteByIds(ids);
}
@PostMapping("/resetDataStatusByIds")
public R<?> resetDataStatusByIds(@RequestBody List<String> ids) {
return modelCaseService.resetDataStatusByIds(ids);
}
/**
*
*

@ -29,6 +29,10 @@ public interface ModelCaseService extends IService<ModelCase> {
R<?> del(String id);
R<?> realDeleteByIds(List<String> ids);
R<?> resetDataStatusByIds(List<String> ids);
R<List<CasePerson>> getPerson(String caseId, String name);
R<?> addPerson(CasePerson person);

@ -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();

@ -38,6 +38,9 @@ public class ModelCaseVO {
@Schema(description = "当事人")
private String lawParty;
@Schema(description = "删除状态,默认查询未删除数据")
private Boolean isDelete = false;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime updateStartTime;

@ -3,10 +3,16 @@
<mapper namespace="com.supervision.police.mapper.ModelCaseMapper">
<select id="selectAll" resultType="com.supervision.police.domain.ModelCase">
select * from model_case
where data_status = '1'
where 1=1
<if test="modelCase.id != null and modelCase.id != ''">
and id = #{modelCase.id}
</if>
<if test="modelCase.isDelete">
and data_status != '1'
</if>
<if test="!modelCase.isDelete">
and data_status = '1'
</if>
<if test="modelCase.caseNo != null and modelCase.caseNo != ''">
and case_no like concat('%', #{modelCase.caseNo}, '%')
</if>

Loading…
Cancel
Save