feat(credit): 更新立案信息导入功能
- 修改CreditCaseFiling实体类中occurrenceTime字段描述为"立案时间" - 替换导入参数类从CreditJudicialImportParam为CreditCaseFilingImportParam - 更新导入接口文档注释从"司法大数据"为"立案信息" - 实现Excel导入时指定"立案信息"工作表索引进行读取 - 更新模板下载功能使用新的导入参数类并修改模板名称 - 新增CreditCaseFilingImportParam导入参数类定义立案信息字段 - 在CreditExternal实体类中新增url字段用于存储链接地址
This commit is contained in:
@@ -7,7 +7,7 @@ import com.gxwebsoft.common.core.web.BatchParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.credit.entity.CreditCaseFiling;
|
import com.gxwebsoft.credit.entity.CreditCaseFiling;
|
||||||
import com.gxwebsoft.credit.param.CreditJudicialImportParam;
|
import com.gxwebsoft.credit.param.CreditCaseFilingImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditCaseFilingParam;
|
import com.gxwebsoft.credit.param.CreditCaseFilingParam;
|
||||||
import com.gxwebsoft.credit.service.CreditCaseFilingService;
|
import com.gxwebsoft.credit.service.CreditCaseFilingService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -133,10 +133,10 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入司法大数据
|
* 批量导入立案信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAuthority('credit:creditCaseFiling:save')")
|
@PreAuthorize("hasAuthority('credit:creditCaseFiling:save')")
|
||||||
@Operation(summary = "批量导入司法大数据")
|
@Operation(summary = "批量导入立案信息")
|
||||||
@PostMapping("/import")
|
@PostMapping("/import")
|
||||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||||
@@ -144,9 +144,10 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExcelImportSupport.ImportResult<CreditJudicialImportParam> importResult = ExcelImportSupport.read(
|
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "立案信息", 0);
|
||||||
file, CreditJudicialImportParam.class, this::isEmptyImportRow);
|
ExcelImportSupport.ImportResult<CreditCaseFilingImportParam> importResult = ExcelImportSupport.read(
|
||||||
List<CreditJudicialImportParam> list = importResult.getData();
|
file, CreditCaseFilingImportParam.class, this::isEmptyImportRow, sheetIndex);
|
||||||
|
List<CreditCaseFilingImportParam> list = importResult.getData();
|
||||||
int usedTitleRows = importResult.getTitleRows();
|
int usedTitleRows = importResult.getTitleRows();
|
||||||
int usedHeadRows = importResult.getHeadRows();
|
int usedHeadRows = importResult.getHeadRows();
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
List<Integer> chunkRowNumbers = new ArrayList<>(chunkSize);
|
List<Integer> chunkRowNumbers = new ArrayList<>(chunkSize);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
CreditJudicialImportParam param = list.get(i);
|
CreditCaseFilingImportParam param = list.get(i);
|
||||||
try {
|
try {
|
||||||
CreditCaseFiling item = convertImportParamToEntity(param);
|
CreditCaseFiling item = convertImportParamToEntity(param);
|
||||||
|
|
||||||
@@ -289,14 +290,14 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载司法大数据导入模板
|
* 下载立案信息导入模板
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "下载司法大数据导入模板")
|
@Operation(summary = "下载立案信息导入模板")
|
||||||
@GetMapping("/import/template")
|
@GetMapping("/import/template")
|
||||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||||
List<CreditJudicialImportParam> templateList = new ArrayList<>();
|
List<CreditCaseFilingImportParam> templateList = new ArrayList<>();
|
||||||
|
|
||||||
CreditJudicialImportParam example = new CreditJudicialImportParam();
|
CreditCaseFilingImportParam example = new CreditCaseFilingImportParam();
|
||||||
example.setDataType("司法大数据");
|
example.setDataType("司法大数据");
|
||||||
example.setPlaintiffAppellant("原告示例");
|
example.setPlaintiffAppellant("原告示例");
|
||||||
example.setAppellee("被告示例");
|
example.setAppellee("被告示例");
|
||||||
@@ -310,7 +311,7 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
example.setComments("备注信息");
|
example.setComments("备注信息");
|
||||||
templateList.add(example);
|
templateList.add(example);
|
||||||
|
|
||||||
Workbook workbook = ExcelImportSupport.buildTemplate("司法大数据导入模板", "司法大数据", CreditJudicialImportParam.class, templateList);
|
Workbook workbook = ExcelImportSupport.buildTemplate("立案信息导入模板", "立案信息", CreditCaseFilingImportParam.class, templateList);
|
||||||
|
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=credit_case_filing_import_template.xlsx");
|
response.setHeader("Content-Disposition", "attachment; filename=credit_case_filing_import_template.xlsx");
|
||||||
@@ -319,7 +320,7 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
workbook.close();
|
workbook.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmptyImportRow(CreditJudicialImportParam param) {
|
private boolean isEmptyImportRow(CreditCaseFilingImportParam param) {
|
||||||
if (param == null) {
|
if (param == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -329,7 +330,7 @@ public class CreditCaseFilingController extends BaseController {
|
|||||||
&& ImportHelper.isBlank(param.getCauseOfAction());
|
&& ImportHelper.isBlank(param.getCauseOfAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
private CreditCaseFiling convertImportParamToEntity(CreditJudicialImportParam param) {
|
private CreditCaseFiling convertImportParamToEntity(CreditCaseFilingImportParam param) {
|
||||||
CreditCaseFiling entity = new CreditCaseFiling();
|
CreditCaseFiling entity = new CreditCaseFiling();
|
||||||
|
|
||||||
entity.setDataType(param.getDataType());
|
entity.setDataType(param.getDataType());
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class CreditCaseFiling implements Serializable {
|
|||||||
@Schema(description = "其他当事人/第三人")
|
@Schema(description = "其他当事人/第三人")
|
||||||
private String otherPartiesThirdParty;
|
private String otherPartiesThirdParty;
|
||||||
|
|
||||||
@Schema(description = "发生时间")
|
@Schema(description = "立案时间")
|
||||||
private String occurrenceTime;
|
private String occurrenceTime;
|
||||||
|
|
||||||
@Schema(description = "案号")
|
@Schema(description = "案号")
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public class CreditExternal implements Serializable {
|
|||||||
@Schema(description = "企业状态(如存续、注销等)")
|
@Schema(description = "企业状态(如存续、注销等)")
|
||||||
private String statusTxt;
|
private String statusTxt;
|
||||||
|
|
||||||
|
@Schema(description = "链接地址")
|
||||||
|
private String url;
|
||||||
|
|
||||||
@Schema(description = "法定代表人姓名")
|
@Schema(description = "法定代表人姓名")
|
||||||
private String legalRepresentative;
|
private String legalRepresentative;
|
||||||
|
|
||||||
|
|||||||
@@ -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 CreditCaseFilingImportParam 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;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user