feat(credit): 添加批量导入功能和下载模板功能
- 为行政许可控制器添加批量导入和下载模板功能 - 为破产重整控制器添加批量导入和下载模板功能 - 为分支机构控制器添加批量导入和下载模板功能 - 为历史法定代表人控制器添加批量导入和下载模板功能 - 为附近企业控制器添加批量导入和下载模板功能 - 实现Excel导入数据验证和错误处理机制 - 添加导入参数实体类和转换方法 - 实现超链接读取和数据映射功能 - 添加导入模板生成和下载功能
This commit is contained in:
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditAdministrativeLicense;
|
||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
||||
import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 行政许可控制器
|
||||
@@ -121,4 +130,188 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入行政许可
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')")
|
||||
@Operation(summary = "批量导入行政许可")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditAdministrativeLicenseImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditAdministrativeLicenseImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditAdministrativeLicenseImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号");
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditAdministrativeLicenseImportParam param = list.get(i);
|
||||
try {
|
||||
CreditAdministrativeLicense item = convertImportParamToEntity(param);
|
||||
String link = null;
|
||||
if (!ImportHelper.isBlank(item.getCode())) {
|
||||
link = urlByCode.get(item.getCode().trim());
|
||||
}
|
||||
if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) {
|
||||
link = urlByName.get(item.getName().trim());
|
||||
}
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getName())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:决定文书/许可证名称不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditAdministrativeLicenseService.save(item);
|
||||
if (!saved) {
|
||||
CreditAdministrativeLicense existing = null;
|
||||
if (!ImportHelper.isBlank(item.getCode())) {
|
||||
existing = creditAdministrativeLicenseService.lambdaQuery()
|
||||
.eq(CreditAdministrativeLicense::getCode, item.getCode())
|
||||
.one();
|
||||
}
|
||||
if (existing == null) {
|
||||
existing = creditAdministrativeLicenseService.lambdaQuery()
|
||||
.eq(CreditAdministrativeLicense::getName, item.getName())
|
||||
.one();
|
||||
}
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditAdministrativeLicenseService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载行政许可导入模板
|
||||
*/
|
||||
@Operation(summary = "下载行政许可导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditAdministrativeLicenseImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditAdministrativeLicenseImportParam example = new CreditAdministrativeLicenseImportParam();
|
||||
example.setCode("(2024)示例许可编号");
|
||||
example.setName("示例行政许可名称");
|
||||
example.setStatusText("有效");
|
||||
example.setType("行政许可");
|
||||
example.setValidityStart("2024-01-01");
|
||||
example.setValidityEnd("2029-01-01");
|
||||
example.setLicensingAuthority("某某许可机关");
|
||||
example.setLicenseContent("许可内容示例");
|
||||
example.setDataSourceUnit("数据来源单位示例");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("行政许可导入模板", "行政许可", CreditAdministrativeLicenseImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_administrative_license_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditAdministrativeLicenseImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getCode())
|
||||
&& ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getStatusText());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditAdministrativeLicenseImportParam param) {
|
||||
return isHeaderValue(param.getCode(), "决定文书/许可编号")
|
||||
|| isHeaderValue(param.getName(), "决定文书/许可证名称")
|
||||
|| isHeaderValue(param.getStatusText(), "许可状态");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditAdministrativeLicense convertImportParamToEntity(CreditAdministrativeLicenseImportParam param) {
|
||||
CreditAdministrativeLicense entity = new CreditAdministrativeLicense();
|
||||
|
||||
entity.setCode(param.getCode());
|
||||
entity.setName(param.getName());
|
||||
entity.setStatusText(param.getStatusText());
|
||||
entity.setType(param.getType());
|
||||
entity.setValidityStart(param.getValidityStart());
|
||||
entity.setValidityEnd(param.getValidityEnd());
|
||||
entity.setLicensingAuthority(param.getLicensingAuthority());
|
||||
entity.setLicenseContent(param.getLicenseContent());
|
||||
entity.setDataSourceUnit(param.getDataSourceUnit());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditBankruptcy;
|
||||
import com.gxwebsoft.credit.param.CreditBankruptcyImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditBankruptcyParam;
|
||||
import com.gxwebsoft.credit.service.CreditBankruptcyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 破产重整控制器
|
||||
@@ -121,4 +130,167 @@ public class CreditBankruptcyController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入破产重整
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditBankruptcy:save')")
|
||||
@Operation(summary = "批量导入破产重整")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditBankruptcyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditBankruptcyImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditBankruptcyImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditBankruptcyImportParam param = list.get(i);
|
||||
try {
|
||||
CreditBankruptcy item = convertImportParamToEntity(param);
|
||||
if (!ImportHelper.isBlank(item.getCode())) {
|
||||
String link = urlByCode.get(item.getCode().trim());
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getCode())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:案号不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditBankruptcyService.save(item);
|
||||
if (!saved) {
|
||||
CreditBankruptcy existing = creditBankruptcyService.lambdaQuery()
|
||||
.eq(CreditBankruptcy::getCode, item.getCode())
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditBankruptcyService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载破产重整导入模板
|
||||
*/
|
||||
@Operation(summary = "下载破产重整导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditBankruptcyImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditBankruptcyImportParam example = new CreditBankruptcyImportParam();
|
||||
example.setCode("(2024)示例案号");
|
||||
example.setType("破产清算");
|
||||
example.setParty("某某公司");
|
||||
example.setCourt("某某人民法院");
|
||||
example.setPublicDate("2024-01-10");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("破产重整导入模板", "破产重整", CreditBankruptcyImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_bankruptcy_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditBankruptcyImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getCode())
|
||||
&& ImportHelper.isBlank(param.getParty())
|
||||
&& ImportHelper.isBlank(param.getCourt());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditBankruptcyImportParam param) {
|
||||
return isHeaderValue(param.getCode(), "案号")
|
||||
|| isHeaderValue(param.getType(), "案件类型")
|
||||
|| isHeaderValue(param.getParty(), "当事人");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditBankruptcy convertImportParamToEntity(CreditBankruptcyImportParam param) {
|
||||
CreditBankruptcy entity = new CreditBankruptcy();
|
||||
|
||||
entity.setCode(param.getCode());
|
||||
entity.setType(param.getType());
|
||||
entity.setParty(param.getParty());
|
||||
entity.setCourt(param.getCourt());
|
||||
entity.setPublicDate(param.getPublicDate());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditBranch;
|
||||
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditBranchParam;
|
||||
import com.gxwebsoft.credit.service.CreditBranchService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分支机构控制器
|
||||
@@ -121,4 +130,167 @@ public class CreditBranchController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入分支机构
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditBranch:save')")
|
||||
@Operation(summary = "批量导入分支机构")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditBranchImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditBranchImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditBranchImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditBranchImportParam param = list.get(i);
|
||||
try {
|
||||
CreditBranch item = convertImportParamToEntity(param);
|
||||
if (!ImportHelper.isBlank(item.getName())) {
|
||||
String link = urlByName.get(item.getName().trim());
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getName())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:分支机构名称不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditBranchService.save(item);
|
||||
if (!saved) {
|
||||
CreditBranch existing = creditBranchService.lambdaQuery()
|
||||
.eq(CreditBranch::getName, item.getName())
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditBranchService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载分支机构导入模板
|
||||
*/
|
||||
@Operation(summary = "下载分支机构导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditBranchImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditBranchImportParam example = new CreditBranchImportParam();
|
||||
example.setName("某某公司分支机构");
|
||||
example.setCurator("张三");
|
||||
example.setRegion("广西南宁");
|
||||
example.setEstablishDate("2020-06-01");
|
||||
example.setStatusText("存续");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("分支机构导入模板", "分支机构", CreditBranchImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_branch_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditBranchImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getCurator())
|
||||
&& ImportHelper.isBlank(param.getRegion());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditBranchImportParam param) {
|
||||
return isHeaderValue(param.getName(), "分支机构名称")
|
||||
|| isHeaderValue(param.getCurator(), "负责人")
|
||||
|| isHeaderValue(param.getRegion(), "地区");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditBranch convertImportParamToEntity(CreditBranchImportParam param) {
|
||||
CreditBranch entity = new CreditBranch();
|
||||
|
||||
entity.setName(param.getName());
|
||||
entity.setCurator(param.getCurator());
|
||||
entity.setRegion(param.getRegion());
|
||||
entity.setEstablishDate(param.getEstablishDate());
|
||||
entity.setStatusText(param.getStatusText());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditHistoricalLegalPerson;
|
||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
||||
import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 历史法定代表人控制器
|
||||
@@ -121,4 +130,164 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入历史法定代表人
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')")
|
||||
@Operation(summary = "批量导入历史法定代表人")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditHistoricalLegalPersonImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditHistoricalLegalPersonImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditHistoricalLegalPersonImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditHistoricalLegalPersonImportParam param = list.get(i);
|
||||
try {
|
||||
CreditHistoricalLegalPerson item = convertImportParamToEntity(param);
|
||||
if (!ImportHelper.isBlank(item.getName())) {
|
||||
String link = urlByName.get(item.getName().trim());
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getName())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:名称不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditHistoricalLegalPersonService.save(item);
|
||||
if (!saved) {
|
||||
CreditHistoricalLegalPerson existing = creditHistoricalLegalPersonService.lambdaQuery()
|
||||
.eq(CreditHistoricalLegalPerson::getName, item.getName())
|
||||
.eq(!ImportHelper.isBlank(item.getRegisterDate()), CreditHistoricalLegalPerson::getRegisterDate, item.getRegisterDate())
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditHistoricalLegalPersonService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载历史法定代表人导入模板
|
||||
*/
|
||||
@Operation(summary = "下载历史法定代表人导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditHistoricalLegalPersonImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditHistoricalLegalPersonImportParam example = new CreditHistoricalLegalPersonImportParam();
|
||||
example.setName("张三");
|
||||
example.setRegisterDate("2020-01-01");
|
||||
example.setPublicDate("2023-06-01");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("历史法定代表人导入模板", "历史法定代表人", CreditHistoricalLegalPersonImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_historical_legal_person_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditHistoricalLegalPersonImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getRegisterDate())
|
||||
&& ImportHelper.isBlank(param.getPublicDate());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditHistoricalLegalPersonImportParam param) {
|
||||
return isHeaderValue(param.getName(), "名称")
|
||||
|| isHeaderValue(param.getRegisterDate(), "任职日期")
|
||||
|| isHeaderValue(param.getPublicDate(), "卸任日期");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditHistoricalLegalPerson convertImportParamToEntity(CreditHistoricalLegalPersonImportParam param) {
|
||||
CreditHistoricalLegalPerson entity = new CreditHistoricalLegalPerson();
|
||||
|
||||
entity.setName(param.getName());
|
||||
entity.setRegisterDate(param.getRegisterDate());
|
||||
entity.setPublicDate(param.getPublicDate());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditNearbyCompany;
|
||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
||||
import com.gxwebsoft.credit.service.CreditNearbyCompanyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 附近企业控制器
|
||||
@@ -121,4 +130,223 @@ public class CreditNearbyCompanyController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入附近企业
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')")
|
||||
@Operation(summary = "批量导入附近企业")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "parentId", required = false) Integer parentId,
|
||||
@RequestParam(value = "type", required = false) Integer type) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditNearbyCompanyImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditNearbyCompanyImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditNearbyCompanyImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码");
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditNearbyCompanyImportParam param = list.get(i);
|
||||
try {
|
||||
CreditNearbyCompany item = convertImportParamToEntity(param);
|
||||
String link = null;
|
||||
if (!ImportHelper.isBlank(item.getCode())) {
|
||||
link = urlByCode.get(item.getCode().trim());
|
||||
}
|
||||
if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) {
|
||||
link = urlByName.get(item.getName().trim());
|
||||
}
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
|
||||
if (item.getParentId() == null && parentId != null) {
|
||||
item.setParentId(parentId);
|
||||
}
|
||||
if (item.getType() == null && type != null) {
|
||||
item.setType(type);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getName())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditNearbyCompanyService.save(item);
|
||||
if (!saved) {
|
||||
CreditNearbyCompany existing = creditNearbyCompanyService.lambdaQuery()
|
||||
.eq(!ImportHelper.isBlank(item.getCode()), CreditNearbyCompany::getCode, item.getCode())
|
||||
.eq(ImportHelper.isBlank(item.getCode()), CreditNearbyCompany::getName, item.getName())
|
||||
.eq(parentId != null, CreditNearbyCompany::getParentId, parentId)
|
||||
.eq(type != null, CreditNearbyCompany::getType, type)
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditNearbyCompanyService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载附近企业导入模板
|
||||
*/
|
||||
@Operation(summary = "下载附近企业导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditNearbyCompanyImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditNearbyCompanyImportParam example = new CreditNearbyCompanyImportParam();
|
||||
example.setName("示例科技有限公司");
|
||||
example.setRegistrationStatus("存续");
|
||||
example.setLegalPerson("李四");
|
||||
example.setRegisteredCapital("1000万人民币");
|
||||
example.setPaidinCapital("200万人民币");
|
||||
example.setEstablishDate("2018-06-01");
|
||||
example.setCode("91440101MA5XXXXXXX");
|
||||
example.setAddress("广西南宁市某某路1号");
|
||||
example.setPhone("13800000000");
|
||||
example.setEmail("demo@example.com");
|
||||
example.setProvince("广西");
|
||||
example.setCity("南宁");
|
||||
example.setRegion("青秀区");
|
||||
example.setDomain("https://example.com");
|
||||
example.setInstitutionType("有限责任公司");
|
||||
example.setCompanySize("小微企业");
|
||||
example.setRegistrationAuthority("南宁市市场监督管理局");
|
||||
example.setTaxpayerQualification("一般纳税人");
|
||||
example.setLatestAnnualReportYear("2023");
|
||||
example.setLatestAnnualReportOnOperatingRevenue("1000万");
|
||||
example.setEnterpriseScoreCheck("85");
|
||||
example.setCreditRating("A级");
|
||||
example.setCechnologyScore("70");
|
||||
example.setCechnologyLevel("良好");
|
||||
example.setSmallEnterprise("是");
|
||||
example.setCompanyProfile("企业简介示例");
|
||||
example.setNatureOfBusiness("经营范围示例");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("附近企业导入模板", "附近企业", CreditNearbyCompanyImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_nearby_company_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditNearbyCompanyImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getCode())
|
||||
&& ImportHelper.isBlank(param.getLegalPerson());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditNearbyCompanyImportParam param) {
|
||||
return isHeaderValue(param.getName(), "企业名称")
|
||||
|| isHeaderValue(param.getCode(), "统一社会信用代码")
|
||||
|| isHeaderValue(param.getLegalPerson(), "法定代表人");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditNearbyCompany convertImportParamToEntity(CreditNearbyCompanyImportParam param) {
|
||||
CreditNearbyCompany entity = new CreditNearbyCompany();
|
||||
|
||||
entity.setName(param.getName());
|
||||
entity.setRegistrationStatus(param.getRegistrationStatus());
|
||||
entity.setLegalPerson(param.getLegalPerson());
|
||||
entity.setRegisteredCapital(param.getRegisteredCapital());
|
||||
entity.setPaidinCapital(param.getPaidinCapital());
|
||||
entity.setEstablishDate(param.getEstablishDate());
|
||||
entity.setCode(param.getCode());
|
||||
entity.setAddress(param.getAddress());
|
||||
entity.setPhone(param.getPhone());
|
||||
entity.setEmail(param.getEmail());
|
||||
entity.setProvince(param.getProvince());
|
||||
entity.setCity(param.getCity());
|
||||
entity.setRegion(param.getRegion());
|
||||
entity.setDomain(param.getDomain());
|
||||
entity.setInstitutionType(param.getInstitutionType());
|
||||
entity.setCompanySize(param.getCompanySize());
|
||||
entity.setRegistrationAuthority(param.getRegistrationAuthority());
|
||||
entity.setTaxpayerQualification(param.getTaxpayerQualification());
|
||||
entity.setLatestAnnualReportYear(param.getLatestAnnualReportYear());
|
||||
entity.setLatestAnnualReportOnOperatingRevenue(param.getLatestAnnualReportOnOperatingRevenue());
|
||||
entity.setEnterpriseScoreCheck(param.getEnterpriseScoreCheck());
|
||||
entity.setCreditRating(param.getCreditRating());
|
||||
entity.setCechnologyScore(param.getCechnologyScore());
|
||||
entity.setCechnologyLevel(param.getCechnologyLevel());
|
||||
entity.setSmallEnterprise(param.getSmallEnterprise());
|
||||
entity.setCompanyProfile(param.getCompanyProfile());
|
||||
entity.setNatureOfBusiness(param.getNatureOfBusiness());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditPatent;
|
||||
import com.gxwebsoft.credit.param.CreditPatentImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditPatentParam;
|
||||
import com.gxwebsoft.credit.service.CreditPatentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 专利控制器
|
||||
@@ -121,4 +130,180 @@ public class CreditPatentController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入专利
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditPatent:save')")
|
||||
@Operation(summary = "批量导入专利")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditPatentImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditPatentImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditPatentImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByRegisterNo = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "申请号");
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "发明名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditPatentImportParam param = list.get(i);
|
||||
try {
|
||||
CreditPatent item = convertImportParamToEntity(param);
|
||||
String link = null;
|
||||
if (!ImportHelper.isBlank(item.getRegisterNo())) {
|
||||
link = urlByRegisterNo.get(item.getRegisterNo().trim());
|
||||
}
|
||||
if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) {
|
||||
link = urlByName.get(item.getName().trim());
|
||||
}
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getRegisterNo())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:申请号不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditPatentService.save(item);
|
||||
if (!saved) {
|
||||
CreditPatent existing = creditPatentService.lambdaQuery()
|
||||
.eq(CreditPatent::getRegisterNo, item.getRegisterNo())
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditPatentService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载专利导入模板
|
||||
*/
|
||||
@Operation(summary = "下载专利导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditPatentImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditPatentImportParam example = new CreditPatentImportParam();
|
||||
example.setName("一种示例装置及方法");
|
||||
example.setType("发明专利");
|
||||
example.setStatusText("有效");
|
||||
example.setRegisterNo("CN2024XXXXXXXX.X");
|
||||
example.setRegisterDate("2024-01-01");
|
||||
example.setPublicNo("CN1XXXXXXXXX");
|
||||
example.setPublicDate("2024-06-01");
|
||||
example.setInventor("张三;李四");
|
||||
example.setPatentApplicant("示例科技有限公司");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("专利导入模板", "专利", CreditPatentImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_patent_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditPatentImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getRegisterNo())
|
||||
&& ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getPatentApplicant());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditPatentImportParam param) {
|
||||
return isHeaderValue(param.getRegisterNo(), "申请号")
|
||||
|| isHeaderValue(param.getName(), "发明名称")
|
||||
|| isHeaderValue(param.getPatentApplicant(), "申请(专利权)人");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditPatent convertImportParamToEntity(CreditPatentImportParam param) {
|
||||
CreditPatent entity = new CreditPatent();
|
||||
|
||||
entity.setName(param.getName());
|
||||
entity.setType(param.getType());
|
||||
entity.setStatusText(param.getStatusText());
|
||||
entity.setRegisterNo(param.getRegisterNo());
|
||||
entity.setRegisterDate(param.getRegisterDate());
|
||||
entity.setPublicNo(param.getPublicNo());
|
||||
entity.setPublicDate(param.getPublicDate());
|
||||
entity.setInventor(param.getInventor());
|
||||
entity.setPatentApplicant(param.getPatentApplicant());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,16 +5,25 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
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.CreditSuspectedRelationship;
|
||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
||||
import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 疑似关系控制器
|
||||
@@ -121,4 +130,179 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入疑似关系
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')")
|
||||
@Operation(summary = "批量导入疑似关系")
|
||||
@PostMapping("/import")
|
||||
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "companyId", required = false) Integer companyId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
ExcelImportSupport.ImportResult<CreditSuspectedRelationshipImportParam> importResult = ExcelImportSupport.readAnySheet(
|
||||
file, CreditSuspectedRelationshipImportParam.class, this::isEmptyImportRow);
|
||||
List<CreditSuspectedRelationshipImportParam> list = importResult.getData();
|
||||
int usedTitleRows = importResult.getTitleRows();
|
||||
int usedHeadRows = importResult.getHeadRows();
|
||||
int usedSheetIndex = importResult.getSheetIndex();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||
}
|
||||
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CreditSuspectedRelationshipImportParam param = list.get(i);
|
||||
try {
|
||||
CreditSuspectedRelationship item = convertImportParamToEntity(param);
|
||||
if (!ImportHelper.isBlank(item.getName())) {
|
||||
String link = urlByName.get(item.getName().trim());
|
||||
if (link != null && !link.isEmpty()) {
|
||||
item.setUrl(link);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getCompanyId() == null && companyId != null) {
|
||||
item.setCompanyId(companyId);
|
||||
}
|
||||
if (item.getUserId() == null && currentUserId != null) {
|
||||
item.setUserId(currentUserId);
|
||||
}
|
||||
if (item.getTenantId() == null && currentTenantId != null) {
|
||||
item.setTenantId(currentTenantId);
|
||||
}
|
||||
if (item.getStatus() == null) {
|
||||
item.setStatus(0);
|
||||
}
|
||||
if (item.getRecommend() == null) {
|
||||
item.setRecommend(0);
|
||||
}
|
||||
if (item.getDeleted() == null) {
|
||||
item.setDeleted(0);
|
||||
}
|
||||
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
if (ImportHelper.isBlank(item.getName())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空");
|
||||
continue;
|
||||
}
|
||||
if (ImportHelper.isBlank(item.getRelatedParty())) {
|
||||
errorMessages.add("第" + excelRowNumber + "行:关联方不能为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean saved = creditSuspectedRelationshipService.save(item);
|
||||
if (!saved) {
|
||||
CreditSuspectedRelationship existing = creditSuspectedRelationshipService.lambdaQuery()
|
||||
.eq(CreditSuspectedRelationship::getName, item.getName())
|
||||
.eq(CreditSuspectedRelationship::getRelatedParty, item.getRelatedParty())
|
||||
.eq(!ImportHelper.isBlank(item.getType()), CreditSuspectedRelationship::getType, item.getType())
|
||||
.one();
|
||||
if (existing != null) {
|
||||
item.setId(existing.getId());
|
||||
if (creditSuspectedRelationshipService.updateById(item)) {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
errorMessages.add("第" + excelRowNumber + "行:保存失败");
|
||||
} catch (Exception e) {
|
||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||
errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessages.isEmpty()) {
|
||||
return success("成功导入" + successCount + "条数据", null);
|
||||
} else {
|
||||
return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return fail("导入失败:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载疑似关系导入模板
|
||||
*/
|
||||
@Operation(summary = "下载疑似关系导入模板")
|
||||
@GetMapping("/import/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
List<CreditSuspectedRelationshipImportParam> templateList = new ArrayList<>();
|
||||
|
||||
CreditSuspectedRelationshipImportParam example = new CreditSuspectedRelationshipImportParam();
|
||||
example.setName("示例科技有限公司");
|
||||
example.setStatusText("存续");
|
||||
example.setLegalPerson("李四");
|
||||
example.setRegisteredCapital("1000万人民币");
|
||||
example.setCreateDate("2018-06-01");
|
||||
example.setRelatedParty("关联方示例");
|
||||
example.setType("股权关联");
|
||||
example.setDetail("疑似关系详情示例");
|
||||
example.setComments("备注信息");
|
||||
templateList.add(example);
|
||||
|
||||
Workbook workbook = ExcelImportSupport.buildTemplate("疑似关系导入模板", "疑似关系", CreditSuspectedRelationshipImportParam.class, templateList);
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=credit_suspected_relationship_import_template.xlsx");
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private boolean isEmptyImportRow(CreditSuspectedRelationshipImportParam param) {
|
||||
if (param == null) {
|
||||
return true;
|
||||
}
|
||||
if (isImportHeaderRow(param)) {
|
||||
return true;
|
||||
}
|
||||
return ImportHelper.isBlank(param.getName())
|
||||
&& ImportHelper.isBlank(param.getRelatedParty())
|
||||
&& ImportHelper.isBlank(param.getType());
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditSuspectedRelationshipImportParam param) {
|
||||
return isHeaderValue(param.getName(), "企业名称")
|
||||
|| isHeaderValue(param.getRelatedParty(), "关联方")
|
||||
|| isHeaderValue(param.getType(), "疑似关系类型");
|
||||
}
|
||||
|
||||
private static boolean isHeaderValue(String value, String headerText) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return headerText.equals(value.trim());
|
||||
}
|
||||
|
||||
private CreditSuspectedRelationship convertImportParamToEntity(CreditSuspectedRelationshipImportParam param) {
|
||||
CreditSuspectedRelationship entity = new CreditSuspectedRelationship();
|
||||
|
||||
entity.setName(param.getName());
|
||||
entity.setStatusText(param.getStatusText());
|
||||
entity.setLegalPerson(param.getLegalPerson());
|
||||
entity.setRegisteredCapital(param.getRegisteredCapital());
|
||||
entity.setCreateDate(param.getCreateDate());
|
||||
entity.setRelatedParty(param.getRelatedParty());
|
||||
entity.setType(param.getType());
|
||||
entity.setDetail(param.getDetail());
|
||||
entity.setComments(param.getComments());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gxwebsoft.credit.param;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 行政许可导入参数
|
||||
*/
|
||||
@Data
|
||||
public class CreditAdministrativeLicenseImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "决定文书/许可编号")
|
||||
private String code;
|
||||
|
||||
@Excel(name = "决定文书/许可证名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "许可状态")
|
||||
private String statusText;
|
||||
|
||||
@Excel(name = "许可类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "有效期自")
|
||||
private String validityStart;
|
||||
|
||||
@Excel(name = "有效期至")
|
||||
private String validityEnd;
|
||||
|
||||
@Excel(name = "许可机关")
|
||||
private String licensingAuthority;
|
||||
|
||||
@Excel(name = "许可内容")
|
||||
private String licenseContent;
|
||||
|
||||
@Excel(name = "数据来源单位")
|
||||
private String dataSourceUnit;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -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 CreditBankruptcyImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "案号")
|
||||
private String code;
|
||||
|
||||
@Excel(name = "案件类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "当事人")
|
||||
private String party;
|
||||
|
||||
@Excel(name = "经办法院")
|
||||
private String court;
|
||||
|
||||
@Excel(name = "公开日期")
|
||||
private String publicDate;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -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 CreditBranchImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "分支机构名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "负责人")
|
||||
private String curator;
|
||||
|
||||
@Excel(name = "地区")
|
||||
private String region;
|
||||
|
||||
@Excel(name = "成立日期")
|
||||
private String establishDate;
|
||||
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.gxwebsoft.credit.param;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 历史法定代表人导入参数
|
||||
*/
|
||||
@Data
|
||||
public class CreditHistoricalLegalPersonImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "任职日期")
|
||||
private String registerDate;
|
||||
|
||||
@Excel(name = "卸任日期")
|
||||
private String publicDate;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.gxwebsoft.credit.param;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 附近企业导入参数
|
||||
*/
|
||||
@Data
|
||||
public class CreditNearbyCompanyImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "企业名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "登记状态")
|
||||
private String registrationStatus;
|
||||
|
||||
@Excel(name = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
@Excel(name = "注册资本")
|
||||
private String registeredCapital;
|
||||
|
||||
@Excel(name = "实缴资本")
|
||||
private String paidinCapital;
|
||||
|
||||
@Excel(name = "成立日期")
|
||||
private String establishDate;
|
||||
|
||||
@Excel(name = "统一社会信用代码")
|
||||
private String code;
|
||||
|
||||
@Excel(name = "注册地址")
|
||||
private String address;
|
||||
|
||||
@Excel(name = "有效手机号")
|
||||
private String phone;
|
||||
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Excel(name = "所属省份")
|
||||
private String province;
|
||||
|
||||
@Excel(name = "所属城市")
|
||||
private String city;
|
||||
|
||||
@Excel(name = "所属区县")
|
||||
private String region;
|
||||
|
||||
@Excel(name = "官网网址")
|
||||
private String domain;
|
||||
|
||||
@Excel(name = "企业(机构)类型")
|
||||
private String institutionType;
|
||||
|
||||
@Excel(name = "企业规模")
|
||||
private String companySize;
|
||||
|
||||
@Excel(name = "登记机关")
|
||||
private String registrationAuthority;
|
||||
|
||||
@Excel(name = "纳税人资质")
|
||||
private String taxpayerQualification;
|
||||
|
||||
@Excel(name = "最新年报年份")
|
||||
private String latestAnnualReportYear;
|
||||
|
||||
@Excel(name = "最新年报营业收入")
|
||||
private String latestAnnualReportOnOperatingRevenue;
|
||||
|
||||
@Excel(name = "企查分")
|
||||
private String enterpriseScoreCheck;
|
||||
|
||||
@Excel(name = "信用等级")
|
||||
private String creditRating;
|
||||
|
||||
@Excel(name = "科创分")
|
||||
private String cechnologyScore;
|
||||
|
||||
@Excel(name = "科创等级")
|
||||
private String cechnologyLevel;
|
||||
|
||||
@Excel(name = "是否小微企业")
|
||||
private String smallEnterprise;
|
||||
|
||||
@Excel(name = "企业简介")
|
||||
private String companyProfile;
|
||||
|
||||
@Excel(name = "经营范围")
|
||||
private String natureOfBusiness;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gxwebsoft.credit.param;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 专利导入参数
|
||||
*/
|
||||
@Data
|
||||
public class CreditPatentImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "发明名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "专利类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "法律状态")
|
||||
private String statusText;
|
||||
|
||||
@Excel(name = "申请号")
|
||||
private String registerNo;
|
||||
|
||||
@Excel(name = "申请日")
|
||||
private String registerDate;
|
||||
|
||||
@Excel(name = "公开(公告)号")
|
||||
private String publicNo;
|
||||
|
||||
@Excel(name = "公开(公告)日期")
|
||||
private String publicDate;
|
||||
|
||||
@Excel(name = "发明人")
|
||||
private String inventor;
|
||||
|
||||
@Excel(name = "申请(专利权)人")
|
||||
private String patentApplicant;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.credit.param;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 疑似关系导入参数
|
||||
*/
|
||||
@Data
|
||||
public class CreditSuspectedRelationshipImportParam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "企业名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
@Excel(name = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
@Excel(name = "注册资本")
|
||||
private String registeredCapital;
|
||||
|
||||
@Excel(name = "成立日期")
|
||||
private String createDate;
|
||||
|
||||
@Excel(name = "关联方")
|
||||
private String relatedParty;
|
||||
|
||||
@Excel(name = "疑似关系类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "疑似关系详情")
|
||||
private String detail;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comments;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user