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;