feat(controller): 更新批量导入公司ID匹配逻辑

- 将公司名称匹配方法从精确匹配改为包含匹配模式
- 添加当事人角色字段的优先级处理机制:原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
- 在多个控制器中统一实现新的匹配策略
- 为CreditJudgmentDebtorController添加备用名称字段回退机制
- 移除原有的单一字段匹配参数,改用多角色字段组合匹配
This commit is contained in:
2026-02-06 18:42:04 +08:00
parent 6b401b8286
commit f8d134a330
8 changed files with 55 additions and 24 deletions

View File

@@ -156,7 +156,9 @@ public class CreditBreachOfTrustController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditBreachOfTrustService,
creditCompanyService,
currentTenantId,
@@ -164,13 +166,15 @@ public class CreditBreachOfTrustController extends BaseController {
limit,
CreditBreachOfTrust::getId,
CreditBreachOfTrust::setId,
CreditBreachOfTrust::getPlaintiffAppellant,
CreditBreachOfTrust::getCompanyId,
CreditBreachOfTrust::setCompanyId,
CreditBreachOfTrust::getHasData,
CreditBreachOfTrust::setHasData,
CreditBreachOfTrust::getTenantId,
CreditBreachOfTrust::new
CreditBreachOfTrust::new,
CreditBreachOfTrust::getPlaintiffAppellant,
CreditBreachOfTrust::getAppellee,
CreditBreachOfTrust::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -159,7 +159,9 @@ public class CreditCourtAnnouncementController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditCourtAnnouncementService,
creditCompanyService,
currentTenantId,
@@ -167,13 +169,15 @@ public class CreditCourtAnnouncementController extends BaseController {
limit,
CreditCourtAnnouncement::getId,
CreditCourtAnnouncement::setId,
CreditCourtAnnouncement::getAppellee,
CreditCourtAnnouncement::getCompanyId,
CreditCourtAnnouncement::setCompanyId,
CreditCourtAnnouncement::getHasData,
CreditCourtAnnouncement::setHasData,
CreditCourtAnnouncement::getTenantId,
CreditCourtAnnouncement::new
CreditCourtAnnouncement::new,
CreditCourtAnnouncement::getPlaintiffAppellant,
CreditCourtAnnouncement::getAppellee,
CreditCourtAnnouncement::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -160,7 +160,9 @@ public class CreditCourtSessionController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditCourtSessionService,
creditCompanyService,
currentTenantId,
@@ -168,13 +170,15 @@ public class CreditCourtSessionController extends BaseController {
limit,
CreditCourtSession::getId,
CreditCourtSession::setId,
CreditCourtSession::getAppellee,
CreditCourtSession::getCompanyId,
CreditCourtSession::setCompanyId,
CreditCourtSession::getHasData,
CreditCourtSession::setHasData,
CreditCourtSession::getTenantId,
CreditCourtSession::new
CreditCourtSession::new,
CreditCourtSession::getPlaintiffAppellant,
CreditCourtSession::getAppellee,
CreditCourtSession::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -159,7 +159,9 @@ public class CreditDeliveryNoticeController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditDeliveryNoticeService,
creditCompanyService,
currentTenantId,
@@ -167,13 +169,15 @@ public class CreditDeliveryNoticeController extends BaseController {
limit,
CreditDeliveryNotice::getId,
CreditDeliveryNotice::setId,
CreditDeliveryNotice::getOtherPartiesThirdParty,
CreditDeliveryNotice::getCompanyId,
CreditDeliveryNotice::setCompanyId,
CreditDeliveryNotice::getHasData,
CreditDeliveryNotice::setHasData,
CreditDeliveryNotice::getTenantId,
CreditDeliveryNotice::new
CreditDeliveryNotice::new,
CreditDeliveryNotice::getPlaintiffAppellant,
CreditDeliveryNotice::getAppellee,
CreditDeliveryNotice::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -160,7 +160,9 @@ public class CreditFinalVersionController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditFinalVersionService,
creditCompanyService,
currentTenantId,
@@ -168,13 +170,15 @@ public class CreditFinalVersionController extends BaseController {
limit,
CreditFinalVersion::getId,
CreditFinalVersion::setId,
CreditFinalVersion::getAppellee,
CreditFinalVersion::getCompanyId,
CreditFinalVersion::setCompanyId,
CreditFinalVersion::getHasData,
CreditFinalVersion::setHasData,
CreditFinalVersion::getTenantId,
CreditFinalVersion::new
CreditFinalVersion::new,
CreditFinalVersion::getPlaintiffAppellant,
CreditFinalVersion::getAppellee,
CreditFinalVersion::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -169,7 +169,8 @@ public class CreditJudgmentDebtorController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditJudgmentDebtorService,
creditCompanyService,
currentTenantId,
@@ -177,13 +178,17 @@ public class CreditJudgmentDebtorController extends BaseController {
limit,
CreditJudgmentDebtor::getId,
CreditJudgmentDebtor::setId,
CreditJudgmentDebtor::getName,
CreditJudgmentDebtor::getCompanyId,
CreditJudgmentDebtor::setCompanyId,
CreditJudgmentDebtor::getHasData,
CreditJudgmentDebtor::setHasData,
CreditJudgmentDebtor::getTenantId,
CreditJudgmentDebtor::new
CreditJudgmentDebtor::new,
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人; fall back to "name" if party columns are empty.
CreditJudgmentDebtor::getPlaintiffAppellant,
CreditJudgmentDebtor::getAppellee,
CreditJudgmentDebtor::getOtherPartiesThirdParty,
CreditJudgmentDebtor::getName
);
if (!stats.anyDataRead) {

View File

@@ -159,7 +159,8 @@ public class CreditMediationController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
// Special: otherPartiesThirdParty may contain multiple roles + names; match if any company name is contained in the text.
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditMediationService,
creditCompanyService,
@@ -174,8 +175,9 @@ public class CreditMediationController extends BaseController {
CreditMediation::setHasData,
CreditMediation::getTenantId,
CreditMediation::new,
CreditMediation::getOtherPartiesThirdParty,
CreditMediation::getAppellee
CreditMediation::getPlaintiffAppellant,
CreditMediation::getAppellee,
CreditMediation::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {

View File

@@ -160,7 +160,9 @@ public class CreditXgxfController extends BaseController {
User loginUser = getLoginUser();
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
// Party columns may contain multiple roles/names; match if any company name is contained in the text.
// Priority: 原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNameContainedInText(
creditXgxfService,
creditCompanyService,
currentTenantId,
@@ -168,13 +170,15 @@ public class CreditXgxfController extends BaseController {
limit,
CreditXgxf::getId,
CreditXgxf::setId,
CreditXgxf::getDataType,
CreditXgxf::getCompanyId,
CreditXgxf::setCompanyId,
CreditXgxf::getHasData,
CreditXgxf::setHasData,
CreditXgxf::getTenantId,
CreditXgxf::new
CreditXgxf::new,
CreditXgxf::getPlaintiffAppellant,
CreditXgxf::getAppellee,
CreditXgxf::getOtherPartiesThirdParty
);
if (!stats.anyDataRead) {