diff --git a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java index ea2d2ec..ca07a1d 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java +++ b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java @@ -22,6 +22,7 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import java.util.regex.Pattern; /** * credit 模块 Excel 导入批处理支持: @@ -32,6 +33,7 @@ import java.util.function.Supplier; public class BatchImportSupport { private final TransactionTemplate requiresNewTx; + private static final Pattern PARTY_SPLIT_PATTERN = Pattern.compile("[,,;;、\\n\\r\\t/|]+"); public BatchImportSupport(PlatformTransactionManager transactionManager) { TransactionTemplate template = new TransactionTemplate(transactionManager); @@ -71,7 +73,7 @@ public class BatchImportSupport { /** * 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId。 * - *
默认仅更新 companyId=0 的记录(onlyNull=true);onlyNull=false 时会覆盖更新(仅当 companyId 不同)。
+ *默认仅更新 companyId 为空/0 的记录(onlyNull=true);onlyNull=false 时会覆盖更新(仅当 companyId 不同)。
* *注意:为避免跨租户误更新,当 currentTenantId 为空时会按记录自身 tenantId 维度匹配, * tenantId 为空的记录将被跳过并计入 notFound。
@@ -90,15 +92,80 @@ public class BatchImportSupport { BiConsumer按传入列顺序优先匹配:原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人等。
+ * + *同一列若匹配到多个不同企业则视为歧义;若最终无法得到唯一 companyId,则跳过并计入 ambiguous/notFound。
+ */ + @SafeVarargs + public final默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。
+ *默认仅更新 companyId 为空/0 的记录;如需覆盖更新,传 onlyNull=false。
*/ @PreAuthorize("hasAuthority('credit:creditGqdj:update')") @OperationLog @@ -160,7 +160,8 @@ public class CreditGqdjController extends BaseController { User loginUser = getLoginUser(); Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; - BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + // Match companyId by any party/company-name column (e.g. plaintiff/appellant, defendant/appellee). + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNames( creditGqdjService, creditCompanyService, currentTenantId, @@ -168,13 +169,14 @@ public class CreditGqdjController extends BaseController { limit, CreditGqdj::getId, CreditGqdj::setId, - CreditGqdj::getAppellee, CreditGqdj::getCompanyId, CreditGqdj::setCompanyId, CreditGqdj::getHasData, CreditGqdj::setHasData, CreditGqdj::getTenantId, - CreditGqdj::new + CreditGqdj::new, + CreditGqdj::getPlaintiffAppellant, + CreditGqdj::getAppellee ); if (!stats.anyDataRead) { diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java index e949e6a..2e95ef2 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java @@ -603,11 +603,24 @@ public class CreditXgxfController extends BaseController { entity.setCaseNumber(param.getCaseNumber()); entity.setType(param.getType()); entity.setDataType(param.getDataType()); + entity.setPlaintiffUser(param.getPlaintiffUser()); + entity.setDefendantUser(param.getDefendantUser()); + entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setDataStatus(param.getDataStatus()); entity.setAppellee(param.getAppellee()); - entity.setInvolvedAmount(param.getInvolvedAmount()); - entity.setOccurrenceTime(param.getOccurrenceTime()); - entity.setCourtName(param.getCourtName()); + + // 兼容不同模板字段:如果 *2 有值则以 *2 为准写入主字段 + entity.setInvolvedAmount(!ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount()); + entity.setOccurrenceTime(!ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime()); + entity.setCourtName(!ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName()); + entity.setReleaseDate(param.getReleaseDate()); entity.setComments(param.getComments()); diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java index 1dc9c0a..0be1895 100644 --- a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java @@ -39,4 +39,7 @@ public class CreditBreachOfTrustImportParam implements Serializable { @Excel(name = "备注") private String comments; +// @Excel(name = "原告/上诉人") +// private String plaintiffAppellant2; + } diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java index 6a57235..d0eb97d 100644 --- a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java +++ b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java @@ -31,9 +31,15 @@ public class CreditXgxfImportParam implements Serializable { @Excel(name = "涉案金额(元)") private String involvedAmount; + @Excel(name = "涉案金额") + private String involvedAmount2; + @Excel(name = "立案日期") private String occurrenceTime; + @Excel(name = "发生时间") + private String occurrenceTime2; + @Excel(name = "执行法院") private String courtName; @@ -43,4 +49,19 @@ public class CreditXgxfImportParam implements Serializable { @Excel(name = "备注") private String comments; + @Excel(name = "原告/上诉人") + private String plaintiffUser; + + @Excel(name = "被告/被上诉人") + private String defendantUser; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "法院") + private String courtName2; + }