refactor(credit): 重构司法信用实体和导入参数结构
- 修改 CreditBreachOfTrust 实体字段定义,调整案号、当事人、涉案金额等字段映射 - 创建新的 CreditBreachOfTrustImportParam 导入参数类替代原有司法通用参数 - 更新 Controller 中的导入功能实现,使用新的参数类进行数据转换 - 调整查询条件过滤逻辑,移除不必要的字段匹配 - 为终本案件模块创建独立的导入参数类 CreditFinalVersionImportParam - 优化导入模板生成逻辑,支持按标签页名称查找对应工作表 - 重构终本案件实体字段映射,调整被执行人和申请执行人字段定义 - 更新 Excel 导入验证逻辑,简化空行判断条件
This commit is contained in:
@@ -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.CreditGqdj;
|
||||
import com.gxwebsoft.credit.param.CreditGqdjImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditGqdjParam;
|
||||
import com.gxwebsoft.credit.param.CreditJudicialImportParam;
|
||||
import com.gxwebsoft.credit.service.CreditGqdjService;
|
||||
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 CreditGqdjController 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<CreditGqdjImportParam> importResult = ExcelImportSupport.read(
|
||||
file, CreditGqdjImportParam.class, this::isEmptyImportRow, sheetIndex);
|
||||
List<CreditGqdjImportParam> 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 CreditGqdjController extends BaseController {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
// easypoi 默认不会读取单元格超链接地址;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 CreditGqdjController extends BaseController {
|
||||
List<Integer> chunkRowNumbers = new ArrayList<>(chunkSize);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditJudicialImportParam param = list.get(i);
|
||||
CreditGqdjImportParam param = list.get(i);
|
||||
try {
|
||||
CreditGqdj 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,19 @@ public class CreditGqdjController extends BaseController {
|
||||
@Operation(summary = "下载股权冻结导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditJudicialImportParam> templateList = new ArrayList<>();
|
||||
List<CreditGqdjImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditJudicialImportParam example = new CreditJudicialImportParam();
|
||||
CreditGqdjImportParam example = new CreditGqdjImportParam();
|
||||
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("股权冻结导入模板", "股权冻结", CreditGqdjImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_gqdj_import_template.xlsx");
|
||||
@@ -319,27 +327,26 @@ public class CreditGqdjController extends BaseController {
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditJudicialImportParam param) {
|
||||
private boolean isEmptyImportRow(CreditGqdjImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getCaseNumber())
|
||||
&& ImportHelper.isBlank(param.getPlaintiffAppellant())
|
||||
&& ImportHelper.isBlank(param.getAppellee())
|
||||
&& ImportHelper.isBlank(param.getCauseOfAction());
|
||||
return ImportHelper.isBlank(param.getCaseNumber());
|
||||
}
|
||||
|
||||
private CreditGqdj convertImportParamToEntity(CreditJudicialImportParam param) {
|
||||
private CreditGqdj convertImportParamToEntity(CreditGqdjImportParam param) {
|
||||
CreditGqdj entity = new CreditGqdj();
|
||||
|
||||
entity.setDataType(param.getDataType());
|
||||
entity.setPlaintiffAppellant(param.getPlaintiffAppellant());
|
||||
entity.setAppellee(param.getAppellee());
|
||||
entity.setCaseNumber(param.getCaseNumber());
|
||||
entity.setAppellee(param.getAppellee());
|
||||
entity.setPlaintiffAppellant(param.getPlaintiffAppellant());
|
||||
entity.setInvolvedAmount(param.getInvolvedAmount());
|
||||
entity.setCourtName(param.getCourtName());
|
||||
entity.setDataStatus(param.getDataStatus());
|
||||
entity.setComments(param.getComments());
|
||||
entity.setDataType("股权冻结");
|
||||
entity.setPublicDate(param.getPublicDate());
|
||||
entity.setFreezeDateStart(param.getFreezeDateStart());
|
||||
entity.setFreezeDateEnd(param.getFreezeDateEnd());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user