refactor(judicial): 优化法院公告和送达公告的数据结构和导入功能

- 重命名 CreditJudicialImportParam 为 CreditCourtAnnouncementImportParam 和 CreditDeliveryNoticeImportParam
- 更新实体类字段描述,将 dataType 改为 公告类型,plaintiffAppellant 改为 公告人,occurrenceTime 改为 刊登日期
- 移除不再使用的字段如 appellee、involvedAmount、courtName、dataStatus 等
- 添加送达公告的 url 字段用于存储链接地址
- 更新导入模板生成逻辑,适配新的参数类结构
- 优化导入验证方法,移除对已删除字段的检查
- 在送达公告导入中增加超链接提取功能,从案号列读取URL信息
- 更新数据库查询条件,移除对已删除字段的过滤条件
This commit is contained in:
2026-01-18 11:44:46 +08:00
parent 4794a9af3e
commit e62b900bb1
8 changed files with 138 additions and 104 deletions

View File

@@ -7,7 +7,7 @@ import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.credit.entity.CreditCourtAnnouncement;
import com.gxwebsoft.credit.param.CreditJudicialImportParam;
import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam;
import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam;
import com.gxwebsoft.credit.service.CreditCourtAnnouncementService;
import io.swagger.v3.oas.annotations.Operation;
@@ -144,9 +144,9 @@ public class CreditCourtAnnouncementController extends BaseController {
int successCount = 0;
try {
ExcelImportSupport.ImportResult<CreditJudicialImportParam> importResult = ExcelImportSupport.read(
file, CreditJudicialImportParam.class, this::isEmptyImportRow);
List<CreditJudicialImportParam> list = importResult.getData();
ExcelImportSupport.ImportResult<CreditCourtAnnouncementImportParam> importResult = ExcelImportSupport.read(
file, CreditCourtAnnouncementImportParam.class, this::isEmptyImportRow);
List<CreditCourtAnnouncementImportParam> list = importResult.getData();
int usedTitleRows = importResult.getTitleRows();
int usedHeadRows = importResult.getHeadRows();
@@ -164,7 +164,7 @@ public class CreditCourtAnnouncementController extends BaseController {
List<Integer> chunkRowNumbers = new ArrayList<>(chunkSize);
for (int i = 0; i < list.size(); i++) {
CreditJudicialImportParam param = list.get(i);
CreditCourtAnnouncementImportParam param = list.get(i);
try {
CreditCourtAnnouncement item = convertImportParamToEntity(param);
@@ -294,23 +294,19 @@ public class CreditCourtAnnouncementController extends BaseController {
@Operation(summary = "下载法院公告司法大数据导入模板")
@GetMapping("/import/template")
public void downloadTemplate(HttpServletResponse response) throws IOException {
List<CreditJudicialImportParam> templateList = new ArrayList<>();
List<CreditCourtAnnouncementImportParam> templateList = new ArrayList<>();
CreditJudicialImportParam example = new CreditJudicialImportParam();
CreditCourtAnnouncementImportParam example = new CreditCourtAnnouncementImportParam();
example.setDataType("法院公告");
example.setPlaintiffAppellant("原告示例");
example.setAppellee("被告示例");
example.setOtherPartiesThirdParty("第三人示例");
example.setOccurrenceTime("2024-01-01");
example.setCaseNumber("2024示例案号");
example.setCauseOfAction("案由示例");
example.setInvolvedAmount("100000");
example.setCourtName("示例法院");
example.setDataStatus("已公开");
example.setComments("备注信息");
templateList.add(example);
Workbook workbook = ExcelImportSupport.buildTemplate("法院公告导入模板", "法院公告", CreditJudicialImportParam.class, templateList);
Workbook workbook = ExcelImportSupport.buildTemplate("法院公告导入模板", "法院公告", CreditCourtAnnouncementImportParam.class, templateList);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=credit_court_announcement_import_template.xlsx");
@@ -319,29 +315,23 @@ public class CreditCourtAnnouncementController extends BaseController {
workbook.close();
}
private boolean isEmptyImportRow(CreditJudicialImportParam param) {
private boolean isEmptyImportRow(CreditCourtAnnouncementImportParam param) {
if (param == null) {
return true;
}
return ImportHelper.isBlank(param.getCaseNumber())
&& ImportHelper.isBlank(param.getPlaintiffAppellant())
&& ImportHelper.isBlank(param.getAppellee())
&& ImportHelper.isBlank(param.getCauseOfAction());
}
private CreditCourtAnnouncement convertImportParamToEntity(CreditJudicialImportParam param) {
private CreditCourtAnnouncement convertImportParamToEntity(CreditCourtAnnouncementImportParam param) {
CreditCourtAnnouncement entity = new CreditCourtAnnouncement();
entity.setDataType(param.getDataType());
entity.setPlaintiffAppellant(param.getPlaintiffAppellant());
entity.setAppellee(param.getAppellee());
entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty());
entity.setOccurrenceTime(param.getOccurrenceTime());
entity.setCaseNumber(param.getCaseNumber());
entity.setCauseOfAction(param.getCauseOfAction());
entity.setInvolvedAmount(param.getInvolvedAmount());
entity.setCourtName(param.getCourtName());
entity.setDataStatus(param.getDataStatus());
entity.setComments(param.getComments());
return entity;

View File

@@ -7,8 +7,8 @@ import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.credit.entity.CreditDeliveryNotice;
import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam;
import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam;
import com.gxwebsoft.credit.param.CreditJudicialImportParam;
import com.gxwebsoft.credit.service.CreditDeliveryNoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 送达公告司法大数据控制器
@@ -144,11 +145,13 @@ public class CreditDeliveryNoticeController extends BaseController {
int successCount = 0;
try {
ExcelImportSupport.ImportResult<CreditJudicialImportParam> importResult = ExcelImportSupport.read(
file, CreditJudicialImportParam.class, this::isEmptyImportRow);
List<CreditJudicialImportParam> list = importResult.getData();
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "送达公告", 0);
ExcelImportSupport.ImportResult<CreditDeliveryNoticeImportParam> importResult = ExcelImportSupport.read(
file, CreditDeliveryNoticeImportParam.class, this::isEmptyImportRow, sheetIndex);
List<CreditDeliveryNoticeImportParam> list = importResult.getData();
int usedTitleRows = importResult.getTitleRows();
int usedHeadRows = importResult.getHeadRows();
int usedSheetIndex = importResult.getSheetIndex();
if (CollectionUtils.isEmpty(list)) {
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
@@ -157,6 +160,9 @@ public class CreditDeliveryNoticeController extends BaseController {
User loginUser = getLoginUser();
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
// URL 通常以超链接形式存在于“案号”列里
Map<String, String> urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(
file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
final int chunkSize = 500;
final int mpBatchSize = 500;
@@ -164,9 +170,15 @@ public class CreditDeliveryNoticeController extends BaseController {
List<Integer> chunkRowNumbers = new ArrayList<>(chunkSize);
for (int i = 0; i < list.size(); i++) {
CreditJudicialImportParam param = list.get(i);
CreditDeliveryNoticeImportParam param = list.get(i);
try {
CreditDeliveryNotice item = convertImportParamToEntity(param);
if (!ImportHelper.isBlank(item.getCaseNumber())) {
String link = urlByCaseNumber.get(item.getCaseNumber().trim());
if (link != null && !link.isEmpty()) {
item.setUrl(link);
}
}
if (item.getCompanyId() == null && companyId != null) {
item.setCompanyId(companyId);
@@ -294,23 +306,18 @@ public class CreditDeliveryNoticeController extends BaseController {
@Operation(summary = "下载送达公告导入模板")
@GetMapping("/import/template")
public void downloadTemplate(HttpServletResponse response) throws IOException {
List<CreditJudicialImportParam> templateList = new ArrayList<>();
List<CreditDeliveryNoticeImportParam> templateList = new ArrayList<>();
CreditJudicialImportParam example = new CreditJudicialImportParam();
example.setDataType("送达公告");
example.setPlaintiffAppellant("原告示例");
example.setAppellee("被告示例");
CreditDeliveryNoticeImportParam example = new CreditDeliveryNoticeImportParam();
example.setOtherPartiesThirdParty("第三人示例");
example.setOccurrenceTime("2024-01-01");
example.setCaseNumber("2024示例案号");
example.setCauseOfAction("案由示例");
example.setInvolvedAmount("100000");
example.setCourtName("示例法院");
example.setDataStatus("已公开");
example.setComments("备注信息");
templateList.add(example);
Workbook workbook = ExcelImportSupport.buildTemplate("送达公告导入模板", "送达公告", CreditJudicialImportParam.class, templateList);
Workbook workbook = ExcelImportSupport.buildTemplate("送达公告导入模板", "送达公告", CreditDeliveryNoticeImportParam.class, templateList);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=credit_delivery_notice_import_template.xlsx");
@@ -319,29 +326,22 @@ public class CreditDeliveryNoticeController extends BaseController {
workbook.close();
}
private boolean isEmptyImportRow(CreditJudicialImportParam param) {
private boolean isEmptyImportRow(CreditDeliveryNoticeImportParam param) {
if (param == null) {
return true;
}
return ImportHelper.isBlank(param.getCaseNumber())
&& ImportHelper.isBlank(param.getPlaintiffAppellant())
&& ImportHelper.isBlank(param.getAppellee())
&& ImportHelper.isBlank(param.getCauseOfAction());
}
private CreditDeliveryNotice convertImportParamToEntity(CreditJudicialImportParam param) {
private CreditDeliveryNotice convertImportParamToEntity(CreditDeliveryNoticeImportParam param) {
CreditDeliveryNotice entity = new CreditDeliveryNotice();
entity.setDataType(param.getDataType());
entity.setPlaintiffAppellant(param.getPlaintiffAppellant());
entity.setAppellee(param.getAppellee());
entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty());
entity.setOccurrenceTime(param.getOccurrenceTime());
entity.setCaseNumber(param.getCaseNumber());
entity.setCauseOfAction(param.getCauseOfAction());
entity.setInvolvedAmount(param.getInvolvedAmount());
entity.setCourtName(param.getCourtName());
entity.setDataStatus(param.getDataStatus());
entity.setComments(param.getComments());
return entity;

View File

@@ -30,10 +30,10 @@ public class CreditCourtAnnouncement implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@Schema(description = "数据类型")
@Schema(description = "公告类型")
private String dataType;
@Schema(description = "原告/上诉")
@Schema(description = "公告")
private String plaintiffAppellant;
@Schema(description = "被告/被上诉人")
@@ -43,7 +43,7 @@ public class CreditCourtAnnouncement implements Serializable {
@Schema(description = "其他当事人/第三人")
private String otherPartiesThirdParty;
@Schema(description = "发生时间")
@Schema(description = "刊登日期")
private String occurrenceTime;
@Schema(description = "案号")

View File

@@ -30,36 +30,39 @@ public class CreditDeliveryNotice implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@Schema(description = "数据类型")
private String dataType;
@Schema(description = "案号")
private String caseNumber;
@Schema(description = "原告/上诉人")
private String plaintiffAppellant;
@Schema(description = "链接地址")
private String url;
@Schema(description = "被告/被上诉人")
@TableField("Appellee")
private String appellee;
@Schema(description = "案由")
private String causeOfAction;
@Schema(description = "其他当事人/第三")
private String otherPartiesThirdParty;
@Schema(description = "当事")
private String otherPartiesThirdParty;
@Schema(description = "发生时间")
private String occurrenceTime;
@Schema(description = "法院")
private String courtName;
@Schema(description = "案号")
private String caseNumber;
@Schema(description = "发布日期")
private String occurrenceTime;
@Schema(description = "案由")
private String causeOfAction;
// @Schema(description = "数据类型")
// private String dataType;
//
// @Schema(description = "原告/上诉人")
// private String plaintiffAppellant;
//
// @Schema(description = "被告/被上诉人")
// @TableField("Appellee")
// private String appellee;
@Schema(description = "涉案金额")
private String involvedAmount;
@Schema(description = "法院")
private String courtName;
@Schema(description = "数据状态")
private String dataStatus;
// @Schema(description = "涉案金额")
// private String involvedAmount;
//
// @Schema(description = "数据状态")
// private String dataStatus;
@Schema(description = "企业ID")
private Integer companyId;

View File

@@ -11,17 +11,8 @@
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.companyId != null">
AND a.company_id = #{param.companyId}
</if>
<if test="param.dataType != null">
AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%')
</if>
<if test="param.plaintiffAppellant != null">
AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%')
</if>
<if test="param.appellee != null">
AND a.appellee LIKE CONCAT('%', #{param.defendant appellee}, '%')
<if test="param.companyId != null">
AND a.company_id = #{param.companyId}
</if>
<if test="param.otherPartiesThirdParty != null">
AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%')
@@ -35,15 +26,9 @@
<if test="param.causeOfAction != null">
AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%')
</if>
<if test="param.involvedAmount != null">
AND a.involved_amount = #{param.involvedAmount}
</if>
<if test="param.courtName != null">
AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%')
</if>
<if test="param.dataStatus != null">
AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.credit.param;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 司法通用导入参数
*/
@Data
public class CreditCourtAnnouncementImportParam implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "案号")
private String caseNumber;
@Excel(name = "案由")
private String causeOfAction;
@Excel(name = "当事人")
private String otherPartiesThirdParty;
@Schema(description = "公告类型")
private String dataType;
@Schema(description = "公告人")
private String plaintiffAppellant;
@Excel(name = "刊登日期")
private String occurrenceTime;
@Excel(name = "备注")
private String comments;
}

View File

@@ -0,0 +1,33 @@
package com.gxwebsoft.credit.param;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
/**
* 司法通用导入参数
*/
@Data
public class CreditDeliveryNoticeImportParam implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "案号")
private String caseNumber;
@Excel(name = "案由")
private String causeOfAction;
@Excel(name = "当事人")
private String otherPartiesThirdParty;
@Excel(name = "法院")
private String courtName;
@Excel(name = "发布日期")
private String occurrenceTime;
@Excel(name = "备注")
private String comments;
}

View File

@@ -27,35 +27,21 @@ public class CreditDeliveryNoticeParam extends BaseParam {
@QueryField(type = QueryType.EQ)
private Integer id;
@Schema(description = "数据类型")
private String dataType;
@Schema(description = "原告/上诉人")
private String plaintiffAppellant;
@Schema(description = "被告/被上诉人")
private String appellee;
@Schema(description = "其他当事人/第三人")
private String otherPartiesThirdParty;
@Schema(description = "发生时间")
private String occurrenceTime;
@Schema(description = "案号")
private String caseNumber;
@Schema(description = "案由")
private String causeOfAction;
@Schema(description = "涉案金额")
private String involvedAmount;
@Schema(description = "当事人")
private String otherPartiesThirdParty;
@Schema(description = "法院")
private String courtName;
@Schema(description = "数据状态")
private String dataStatus;
@Schema(description = "发布日期")
private String occurrenceTime;
@Schema(description = "企业ID")
private Integer companyId;