|
@ -64,7 +64,6 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
|
|
|
|
|
|
private final ContractualRegulationNamesMapper baseMapper; |
|
|
private final ContractualRegulationNamesMapper baseMapper; |
|
|
private final ContractualRegulationArticlesMapper articlesMapper; |
|
|
private final ContractualRegulationArticlesMapper articlesMapper; |
|
|
private final IContractualRegulationArticlesService articlesService; |
|
|
|
|
|
private final ISysOssService ossService; |
|
|
private final ISysOssService ossService; |
|
|
private static final Logger log = LoggerFactory.getLogger(ContractualRegulationNamesServiceImpl.class); |
|
|
private static final Logger log = LoggerFactory.getLogger(ContractualRegulationNamesServiceImpl.class); |
|
|
|
|
|
|
|
@ -72,7 +71,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
protected String fileRootPath; |
|
|
protected String fileRootPath; |
|
|
@Value("${chat.chatUrl}") |
|
|
@Value("${chat.chatUrl}") |
|
|
protected String chatUrl; |
|
|
protected String chatUrl; |
|
|
|
|
|
|
|
|
// Milvus配置
|
|
|
// Milvus配置
|
|
|
@Value("${milvus.host:10.1.21.250}") |
|
|
@Value("${milvus.host:10.1.21.250}") |
|
|
private String milvusHost; |
|
|
private String milvusHost; |
|
@ -80,7 +79,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
private int milvusPort; |
|
|
private int milvusPort; |
|
|
@Value("${milvus.collection.name:contractual_regulation_articles}") |
|
|
@Value("${milvus.collection.name:contractual_regulation_articles}") |
|
|
private String milvusCollectionName; |
|
|
private String milvusCollectionName; |
|
|
|
|
|
|
|
|
private MilvusServiceClient milvusClient; |
|
|
private MilvusServiceClient milvusClient; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -255,7 +254,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
boolean allSuccess = true; |
|
|
boolean allSuccess = true; |
|
|
|
|
|
|
|
|
// 逐个删除法规及其相关数据
|
|
|
// 逐个删除法规及其相关数据
|
|
|
for (Long id : ids) { |
|
|
for (Long id : ids) { |
|
|
try { |
|
|
try { |
|
@ -264,11 +263,11 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
if (!milvusDeleted) { |
|
|
if (!milvusDeleted) { |
|
|
log.warn("法规ID {} 的Milvus向量数据删除失败,但继续删除其他数据", id); |
|
|
log.warn("法规ID {} 的Milvus向量数据删除失败,但继续删除其他数据", id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 2. 删除法规条款(真实删除)
|
|
|
// 2. 删除法规条款(真实删除)
|
|
|
int deletedArticles = articlesMapper.realDeleteByRegulationNameId(id); |
|
|
int deletedArticles = articlesMapper.realDeleteByRegulationNameId(id); |
|
|
log.info("法规ID {} 删除了 {} 条法规条款", id, deletedArticles); |
|
|
log.info("法规ID {} 删除了 {} 条法规条款", id, deletedArticles); |
|
|
|
|
|
|
|
|
// 3. 删除法规主记录(真实删除)
|
|
|
// 3. 删除法规主记录(真实删除)
|
|
|
int deletedRegulation = baseMapper.realDeleteById(id); |
|
|
int deletedRegulation = baseMapper.realDeleteById(id); |
|
|
if (deletedRegulation > 0) { |
|
|
if (deletedRegulation > 0) { |
|
@ -277,7 +276,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
log.warn("删除法规ID {} 失败", id); |
|
|
log.warn("删除法规ID {} 失败", id); |
|
|
allSuccess = false; |
|
|
allSuccess = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("删除法规ID {} 时出错: {}", id, e.getMessage(), e); |
|
|
log.error("删除法规ID {} 时出错: {}", id, e.getMessage(), e); |
|
|
allSuccess = false; |
|
|
allSuccess = false; |
|
@ -592,7 +591,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
} |
|
|
} |
|
|
return milvusClient; |
|
|
return milvusClient; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 从Milvus中删除法规相关的向量数据 |
|
|
* 从Milvus中删除法规相关的向量数据 |
|
|
*/ |
|
|
*/ |
|
@ -603,17 +602,17 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
log.warn("Milvus客户端未初始化,跳过向量数据删除"); |
|
|
log.warn("Milvus客户端未初始化,跳过向量数据删除"); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 构造删除表达式 - 删除指定法规ID的所有向量
|
|
|
// 构造删除表达式 - 删除指定法规ID的所有向量
|
|
|
String deleteExpr = String.format("regulation_name_id == %d", regulationNameId); |
|
|
String deleteExpr = String.format("regulation_name_id == %d", regulationNameId); |
|
|
|
|
|
|
|
|
DeleteParam deleteParam = DeleteParam.newBuilder() |
|
|
DeleteParam deleteParam = DeleteParam.newBuilder() |
|
|
.withCollectionName(milvusCollectionName) |
|
|
.withCollectionName(milvusCollectionName) |
|
|
.withExpr(deleteExpr) |
|
|
.withExpr(deleteExpr) |
|
|
.build(); |
|
|
.build(); |
|
|
|
|
|
|
|
|
R<MutationResult> response = client.delete(deleteParam); |
|
|
R<MutationResult> response = client.delete(deleteParam); |
|
|
|
|
|
|
|
|
if (response.getStatus() == R.Status.Success.getCode()) { |
|
|
if (response.getStatus() == R.Status.Success.getCode()) { |
|
|
MutationResult mutationResponse = response.getData(); |
|
|
MutationResult mutationResponse = response.getData(); |
|
|
long deleteCount = mutationResponse.getDeleteCnt(); |
|
|
long deleteCount = mutationResponse.getDeleteCnt(); |
|
@ -623,7 +622,7 @@ public class ContractualRegulationNamesServiceImpl implements IContractualRegula |
|
|
log.error("从Milvus删除向量数据失败: {}", response.getMessage()); |
|
|
log.error("从Milvus删除向量数据失败: {}", response.getMessage()); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("从Milvus删除向量数据时出错: {}", e.getMessage(), e); |
|
|
log.error("从Milvus删除向量数据时出错: {}", e.getMessage(), e); |
|
|
return false; |
|
|
return false; |
|
|