feat(credit): 新增企业管理功能模块

- 新增企业实体类CreditCompany,包含企业基本信息字段
- 新增企业控制器CreditCompanyController,提供CRUD接口
- 新增企业导入参数类CreditCompanyImportParam,支持Excel导入
- 新增企业查询参数类CreditCompanyParam,支持条件查询
- 新增企业Mapper接口及XML映射文件,实现关联查询
- 实
This commit is contained in:
2025-12-17 10:04:00 +08:00
parent 6321b69dc2
commit 57cdb72208
10 changed files with 1318 additions and 2 deletions

View File

@@ -0,0 +1,390 @@
package com.gxwebsoft.credit.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.gxwebsoft.common.core.annotation.OperationLog;
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.CreditCompany;
import com.gxwebsoft.credit.entity.CreditCompany;
import com.gxwebsoft.credit.param.CreditCompanyImportParam;
import com.gxwebsoft.credit.param.CreditCompanyParam;
import com.gxwebsoft.credit.param.CreditCompanyImportParam;
import com.gxwebsoft.credit.service.CreditCompanyService;
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;
/**
* 企业控制器
*
* @author 科技小王子
* @since 2025-12-17 08:28:03
*/
@Tag(name = "企业管理")
@RestController
@RequestMapping("/api/credit/credit-company")
public class CreditCompanyController extends BaseController {
@Resource
private CreditCompanyService creditCompanyService;
@Operation(summary = "分页查询企业")
@GetMapping("/page")
public ApiResult<PageResult<CreditCompany>> page(CreditCompanyParam param) {
// 使用关联查询
return success(creditCompanyService.pageRel(param));
}
@Operation(summary = "查询全部企业")
@GetMapping()
public ApiResult<List<CreditCompany>> list(CreditCompanyParam param) {
// 使用关联查询
return success(creditCompanyService.listRel(param));
}
@Operation(summary = "根据id查询企业")
@GetMapping("/{id}")
public ApiResult<CreditCompany> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(creditCompanyService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('credit:creditCompany:save')")
@OperationLog
@Operation(summary = "添加企业")
@PostMapping()
public ApiResult<?> save(@RequestBody CreditCompany creditCompany) {
if (creditCompanyService.save(creditCompany)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('credit:creditCompany:update')")
@OperationLog
@Operation(summary = "修改企业")
@PutMapping()
public ApiResult<?> update(@RequestBody CreditCompany creditCompany) {
if (creditCompanyService.updateById(creditCompany)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('credit:creditCompany:remove')")
@OperationLog
@Operation(summary = "删除企业")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (creditCompanyService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('credit:creditCompany:save')")
@OperationLog
@Operation(summary = "批量添加企业")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<CreditCompany> list) {
if (creditCompanyService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('credit:creditCompany:update')")
@OperationLog
@Operation(summary = "批量修改企业")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<CreditCompany> batchParam) {
if (batchParam.update(creditCompanyService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('credit:creditCompany:remove')")
@OperationLog
@Operation(summary = "批量删除企业")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (creditCompanyService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
/**
* 批量导入企业
*/
@PreAuthorize("hasAuthority('credit:creditJudiciary:save')")
@Operation(summary = "批量导入企业")
@PostMapping("/import")
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file) {
List<String> errorMessages = new ArrayList<>();
int successCount = 0;
try {
List<CreditCompanyImportParam> list = null;
int usedTitleRows = 0;
int usedHeadRows = 0;
int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}};
for (int[] config : tryConfigs) {
list = filterEmptyRows(tryImport(file, config[0], config[1]));
if (!CollectionUtils.isEmpty(list)) {
usedTitleRows = config[0];
usedHeadRows = config[1];
break;
}
}
if (CollectionUtils.isEmpty(list)) {
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
}
User loginUser = getLoginUser();
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
for (int i = 0; i < list.size(); i++) {
CreditCompanyImportParam param = list.get(i);
try {
CreditCompany item = convertImportParamToEntity(param);
// 设置默认值
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 (item.getName() == null || item.getName().trim().isEmpty()) {
errorMessages.add("" + excelRowNumber + "行:项目名称不能为空");
continue;
}
if (item.getCode() == null || item.getCode().trim().isEmpty()) {
errorMessages.add("" + excelRowNumber + "行:唯一标识不能为空");
continue;
}
boolean saved = creditCompanyService.save(item);
if (!saved) {
CreditCompany existing = creditCompanyService.getByMatchName(item.getName());
if (existing != null) {
item.setId(existing.getId());
if (creditCompanyService.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<CreditCompanyImportParam> templateList = new ArrayList<>();
CreditCompanyImportParam example = new CreditCompanyImportParam();
example.setName("示例客户");
example.setCode("C0001");
example.setMatchName("匹配名称");
example.setRegistrationStatus("登记状态");
example.setLegalPerson("法定代表人");
example.setRegisteredCapital("注册资本");
example.setPaidinCapital("实缴资本");
example.setEstablishDate("成立日期");
example.setAddress("地址");
example.setTel("电话");
example.setMoreTel("更多电话");
example.setEmail("邮箱");
example.setMoreEmail("更多邮箱");
example.setProvince("");
example.setCity("");
example.setRegion("");
example.setInstitutionType("机构类型");
example.setTaxpayerCode("纳税人识别号");
example.setRegistrationNumber("注册号");
example.setOrganizationalCode("组织机构代码");
example.setNumberOfInsuredPersons("参保人数");
example.setAnnualReport("入库时间");
example.setBusinessTerm("营业期限");
example.setNationalStandardIndustryCategories("国标行业门类");
example.setNationalStandardIndustryCategories2("国标行业大类");
example.setNationalStandardIndustryCategories3("国标行业中类");
example.setNationalStandardIndustryCategories4("国标行业小类");
example.setNationalStandardIndustryCategories5("企查查行业门类");
example.setNationalStandardIndustryCategories6("企查查行业大类");
example.setNationalStandardIndustryCategories7("企查查行业中类");
example.setNationalStandardIndustryCategories8("企查查行业小类");
example.setCompanySize("企业规模");
example.setFormerName("曾用名");
example.setEnglishName("英文名");
example.setDomain("官网");
example.setMailingAddress("通信地址");
example.setCompanyProfile("企业简介");
example.setNatureOfBusiness("经营范围");
example.setRegistrationAuthority("登记机关");
example.setTaxpayerQualification("纳税人资质");
example.setLatestAnnualReportYear("最新年报年份");
example.setLatestAnnualReportOnOperatingRevenue("最新年报营业额");
example.setEnterpriseScoreCheck("企查分");
example.setCreditRating("信用等级");
example.setCechnologyScore("科创分");
example.setCechnologyLevel("科创等级");
example.setSmallEnterprise("是否小微企业");
templateList.add(example);
ExportParams exportParams = new ExportParams("一级企业主表导入模板", "企业");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditCompanyImportParam.class, templateList);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=credit_company_import_template.xlsx");
workbook.write(response.getOutputStream());
workbook.close();
}
private List<CreditCompanyImportParam> tryImport(MultipartFile file, int titleRows, int headRows) throws Exception {
ImportParams importParams = new ImportParams();
importParams.setTitleRows(titleRows);
importParams.setHeadRows(headRows);
importParams.setStartSheetIndex(0);
importParams.setSheetNum(1);
return ExcelImportUtil.importExcel(file.getInputStream(), CreditCompanyImportParam.class, importParams);
}
/**
* 过滤掉完全空白的导入行,避免空行导致导入失败
*/
private List<CreditCompanyImportParam> filterEmptyRows(List<CreditCompanyImportParam> rawList) {
if (CollectionUtils.isEmpty(rawList)) {
return rawList;
}
rawList.removeIf(this::isEmptyImportRow);
return rawList;
}
private boolean isEmptyImportRow(CreditCompanyImportParam param) {
if (param == null) {
return true;
}
return isBlank(param.getName())
&& isBlank(param.getCode());
}
private boolean isBlank(String value) {
return value == null || value.trim().isEmpty();
}
/**
* 将CreditCompanyImportParam转换为CreditCompany实体
*/
private CreditCompany convertImportParamToEntity(CreditCompanyImportParam param) {
CreditCompany entity = new CreditCompany();
entity.setCode(param.getCode());
entity.setName(param.getName());
entity.setMatchName(param.getMatchName());
entity.setRegistrationStatus(param.getRegistrationStatus());
entity.setLegalPerson(param.getLegalPerson());
entity.setRegisteredCapital(param.getRegisteredCapital());
entity.setPaidinCapital(param.getPaidinCapital());
entity.setEstablishDate(param.getEstablishDate());
entity.setAddress(param.getAddress());
entity.setTel(param.getTel());
entity.setMoreTel(param.getMoreTel());
entity.setEmail(param.getEmail());
entity.setMoreEmail(param.getMoreEmail());
entity.setProvince(param.getProvince());
entity.setCity(param.getCity());
entity.setRegion(param.getRegion());
entity.setInstitutionType(param.getInstitutionType());
entity.setTaxpayerCode(param.getTaxpayerCode());
entity.setRegistrationNumber(param.getRegistrationNumber());
entity.setOrganizationalCode(param.getOrganizationalCode());
entity.setNumberOfInsuredPersons(param.getNumberOfInsuredPersons());
entity.setAnnualReport(param.getAnnualReport());
entity.setBusinessTerm(param.getBusinessTerm());
entity.setNationalStandardIndustryCategories(param.getNationalStandardIndustryCategories());
entity.setNationalStandardIndustryCategories2(param.getNationalStandardIndustryCategories2());
entity.setNationalStandardIndustryCategories3(param.getNationalStandardIndustryCategories3());
entity.setNationalStandardIndustryCategories4(param.getNationalStandardIndustryCategories4());
entity.setNationalStandardIndustryCategories5(param.getNationalStandardIndustryCategories5());
entity.setNationalStandardIndustryCategories6(param.getNationalStandardIndustryCategories6());
entity.setNationalStandardIndustryCategories7(param.getNationalStandardIndustryCategories7());
entity.setNationalStandardIndustryCategories8(param.getNationalStandardIndustryCategories8());
entity.setCompanySize(param.getCompanySize());
entity.setFormerName(param.getFormerName());
entity.setEnglishName(param.getEnglishName());
entity.setDomain(param.getDomain());
entity.setMailingAddress(param.getMailingAddress());
entity.setCompanyProfile(param.getCompanyProfile());
entity.setNatureOfBusiness(param.getNatureOfBusiness());
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());
return entity;
}
}

View File

@@ -0,0 +1,210 @@
package com.gxwebsoft.credit.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 企业
*
* @author 科技小王子
* @since 2025-12-17 08:28:03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "CreditCompany对象", description = "企业")
public class CreditCompany implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@Schema(description = "原文件导入名称")
private String name;
@Schema(description = "系统匹配企业名称")
private String matchName;
@Schema(description = "统一社会信用代码")
private String code;
@Schema(description = "类型")
private Integer type;
@Schema(description = "上级id, 0是顶级")
private Integer parentId;
@Schema(description = "登记状态")
private String registrationStatus;
@Schema(description = "法定代表人")
private String legalPerson;
@Schema(description = "注册资本")
private String registeredCapital;
@Schema(description = "实缴资本")
private String paidinCapital;
@Schema(description = "成立日期")
private String establishDate;
@Schema(description = "企业地址")
private String address;
@Schema(description = "电话")
private String tel;
@Schema(description = "更多电话")
private String moreTel;
@Schema(description = "邮箱")
private String email;
@Schema(description = "更多邮箱")
private String moreEmail;
@Schema(description = "所在国家")
private String country;
@Schema(description = "所属省份")
private String province;
@Schema(description = "所属城市")
private String city;
@Schema(description = "所属区县")
private String region;
@Schema(description = "企业(机构)类型")
private String institutionType;
@Schema(description = "纳税人识别号")
private String taxpayerCode;
@Schema(description = "注册号")
private String registrationNumber;
@Schema(description = "组织机构代码")
private String organizationalCode;
@Schema(description = "参保人数")
private String numberOfInsuredPersons;
@Schema(description = "参保人数所属年报")
private String annualReport;
@Schema(description = "营业期限")
private String businessTerm;
@Schema(description = "国标行业门类")
private String nationalStandardIndustryCategories;
@Schema(description = "国标行业大类")
private String nationalStandardIndustryCategories2;
@Schema(description = "国标行业中类")
private String nationalStandardIndustryCategories3;
@Schema(description = "国标行业小类")
private String nationalStandardIndustryCategories4;
@Schema(description = "企查查行业门类")
private String nationalStandardIndustryCategories5;
@Schema(description = "企查查行业大类")
private String nationalStandardIndustryCategories6;
@Schema(description = "企查查行业中类")
private String nationalStandardIndustryCategories7;
@Schema(description = "企查查行业小类")
private String nationalStandardIndustryCategories8;
@Schema(description = "企业规模")
private String companySize;
@Schema(description = "曾用名")
private String formerName;
@Schema(description = "英文名")
private String englishName;
@Schema(description = "官网")
private String domain;
@Schema(description = "通信地址")
private String mailingAddress;
@Schema(description = "企业简介")
private String companyProfile;
@Schema(description = "经营范围")
private String natureOfBusiness;
@Schema(description = "登记机关")
private String registrationAuthority;
@Schema(description = "纳税人资质")
private String taxpayerQualification;
@Schema(description = "最新年报年份")
private String latestAnnualReportYear;
@Schema(description = "最新年报营业收入")
private String latestAnnualReportOnOperatingRevenue;
@Schema(description = "企查分")
private String enterpriseScoreCheck;
@Schema(description = "信用等级")
private String creditRating;
@Schema(description = "科创分")
private String cechnologyScore;
@Schema(description = "科创等级")
private String cechnologyLevel;
@Schema(description = "是否小微企业")
private String smallEnterprise;
@Schema(description = "备注")
private String comments;
@Schema(description = "是否推荐")
private Integer recommend;
@Schema(description = "排序(数字越小越靠前)")
private Integer sortNumber;
@Schema(description = "状态, 0正常, 1冻结")
private Integer status;
@Schema(description = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@Schema(description = "用户ID")
private Integer userId;
@Schema(description = "租户id")
private Integer tenantId;
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@Schema(description = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.credit.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.credit.entity.CreditCompany;
import com.gxwebsoft.credit.param.CreditCompanyParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 企业Mapper
*
* @author 科技小王子
* @since 2025-12-17 08:28:03
*/
public interface CreditCompanyMapper extends BaseMapper<CreditCompany> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<CreditCompany>
*/
List<CreditCompany> selectPageRel(@Param("page") IPage<CreditCompany> page,
@Param("param") CreditCompanyParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<CreditCompany> selectListRel(@Param("param") CreditCompanyParam param);
}

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.credit.mapper.CreditCompanyMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM credit_company a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.matchName != null">
AND a.match_name LIKE CONCAT('%', #{param.matchName}, '%')
</if>
<if test="param.code != null">
AND a.code LIKE CONCAT('%', #{param.code}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</if>
<if test="param.registrationStatus != null">
AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%')
</if>
<if test="param.legalPerson != null">
AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%')
</if>
<if test="param.registeredCapital != null">
AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%')
</if>
<if test="param.paidinCapital != null">
AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%')
</if>
<if test="param.establishDate != null">
AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%')
</if>
<if test="param.address != null">
AND a.address LIKE CONCAT('%', #{param.address}, '%')
</if>
<if test="param.tel != null">
AND a.tel LIKE CONCAT('%', #{param.tel}, '%')
</if>
<if test="param.moreTel != null">
AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%')
</if>
<if test="param.email != null">
AND a.email LIKE CONCAT('%', #{param.email}, '%')
</if>
<if test="param.moreEmail != null">
AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%')
</if>
<if test="param.country != null">
AND a.country LIKE CONCAT('%', #{param.country}, '%')
</if>
<if test="param.province != null">
AND a.province LIKE CONCAT('%', #{param.province}, '%')
</if>
<if test="param.city != null">
AND a.city LIKE CONCAT('%', #{param.city}, '%')
</if>
<if test="param.region != null">
AND a.region LIKE CONCAT('%', #{param.region}, '%')
</if>
<if test="param.institutionType != null">
AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%')
</if>
<if test="param.taxpayerCode != null">
AND a.taxpayer_code LIKE CONCAT('%', #{param.taxpayerCode}, '%')
</if>
<if test="param.registrationNumber != null">
AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%')
</if>
<if test="param.organizationalCode != null">
AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%')
</if>
<if test="param.numberOfInsuredPersons != null">
AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%')
</if>
<if test="param.annualReport != null">
AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%')
</if>
<if test="param.businessTerm != null">
AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%')
</if>
<if test="param.nationalStandardIndustryCategories != null">
AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%')
</if>
<if test="param.nationalStandardIndustryCategories2 != null">
AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%')
</if>
<if test="param.nationalStandardIndustryCategories3 != null">
AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%')
</if>
<if test="param.nationalStandardIndustryCategories4 != null">
AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%')
</if>
<if test="param.nationalStandardIndustryCategories5 != null">
AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%')
</if>
<if test="param.nationalStandardIndustryCategories6 != null">
AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%')
</if>
<if test="param.nationalStandardIndustryCategories7 != null">
AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%')
</if>
<if test="param.nationalStandardIndustryCategories8 != null">
AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%')
</if>
<if test="param.companySize != null">
AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%')
</if>
<if test="param.formerName != null">
AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%')
</if>
<if test="param.englishName != null">
AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%')
</if>
<if test="param.domain != null">
AND a.domain LIKE CONCAT('%', #{param.domain}, '%')
</if>
<if test="param.mailingAddress != null">
AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%')
</if>
<if test="param.companyProfile != null">
AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%')
</if>
<if test="param.natureOfBusiness != null">
AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%')
</if>
<if test="param.registrationAuthority != null">
AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%')
</if>
<if test="param.taxpayerQualification != null">
AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%')
</if>
<if test="param.latestAnnualReportYear != null">
AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%')
</if>
<if test="param.latestAnnualReportOnOperatingRevenue != null">
AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%')
</if>
<if test="param.enterpriseScoreCheck != null">
AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%')
</if>
<if test="param.creditRating != null">
AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%')
</if>
<if test="param.cechnologyScore != null">
AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%')
</if>
<if test="param.cechnologyLevel != null">
AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%')
</if>
<if test="param.smallEnterprise != null">
AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.recommend != null">
AND a.recommend = #{param.recommend}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.credit.entity.CreditCompany">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.credit.entity.CreditCompany">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -89,7 +89,7 @@
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
AND (a.name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>

View File

@@ -83,7 +83,7 @@
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
AND (a.name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>

View File

@@ -0,0 +1,163 @@
package com.gxwebsoft.credit.param;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 企业导入参数
*
* @author 科技小王子
* @since 2025-12-15
*/
@Data
public class CreditCompanyImportParam implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "原文件导入名称")
private String name;
@Excel(name = "系统匹配企业名称")
private String matchName;
@Excel(name = "统一社会信用代码")
private String code;
@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 address;
@Excel(name = "电话")
private String tel;
@Excel(name = "更多电话")
private String moreTel;
@Excel(name = "邮箱")
private String email;
@Excel(name = "更多邮箱")
private String moreEmail;
@Excel(name = "所在国家")
private String country;
@Excel(name = "所属省份")
private String province;
@Excel(name = "所属城市")
private String city;
@Excel(name = "所属区县")
private String region;
@Excel(name = "企业(机构)类型")
private String institutionType;
@Excel(name = "纳税人识别号")
private String taxpayerCode;
@Excel(name = "注册号")
private String registrationNumber;
@Excel(name = "组织机构代码")
private String organizationalCode;
@Excel(name = "参保人数")
private String numberOfInsuredPersons;
@Excel(name = "参保人数所属年报")
private String annualReport;
@Excel(name = "营业期限")
private String businessTerm;
@Excel(name = "国标行业门类")
private String nationalStandardIndustryCategories;
@Excel(name = "国标行业大类")
private String nationalStandardIndustryCategories2;
@Excel(name = "国标行业中类")
private String nationalStandardIndustryCategories3;
@Excel(name = "国标行业小类")
private String nationalStandardIndustryCategories4;
@Excel(name = "企查查行业门类")
private String nationalStandardIndustryCategories5;
@Excel(name = "企查查行业大类")
private String nationalStandardIndustryCategories6;
@Excel(name = "企查查行业中类")
private String nationalStandardIndustryCategories7;
@Excel(name = "企查查行业小类")
private String nationalStandardIndustryCategories8;
@Excel(name = "企业规模")
private String companySize;
@Excel(name = "曾用名")
private String formerName;
@Excel(name = "英文名")
private String englishName;
@Excel(name = "官网")
private String domain;
@Excel(name = "通信地址")
private String mailingAddress;
@Excel(name = "企业简介")
private String companyProfile;
@Excel(name = "经营范围")
private String natureOfBusiness;
@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;
}

View File

@@ -0,0 +1,203 @@
package com.gxwebsoft.credit.param;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 企业查询参数
*
* @author 科技小王子
* @since 2025-12-17 08:28:02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(name = "CreditCompanyParam对象", description = "企业查询参数")
public class CreditCompanyParam extends BaseParam {
private static final long serialVersionUID = 1L;
@Schema(description = "ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@Schema(description = "原文件导入名称")
private String name;
@Schema(description = "系统匹配企业名称")
private String matchName;
@Schema(description = "统一社会信用代码")
private String code;
@Schema(description = "类型")
@QueryField(type = QueryType.EQ)
private Integer type;
@Schema(description = "上级id, 0是顶级")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@Schema(description = "登记状态")
private String registrationStatus;
@Schema(description = "法定代表人")
private String legalPerson;
@Schema(description = "注册资本")
private String registeredCapital;
@Schema(description = "实缴资本")
private String paidinCapital;
@Schema(description = "成立日期")
private String establishDate;
@Schema(description = "企业地址")
private String address;
@Schema(description = "电话")
private String tel;
@Schema(description = "更多电话")
private String moreTel;
@Schema(description = "邮箱")
private String email;
@Schema(description = "更多邮箱")
private String moreEmail;
@Schema(description = "所在国家")
private String country;
@Schema(description = "所属省份")
private String province;
@Schema(description = "所属城市")
private String city;
@Schema(description = "所属区县")
private String region;
@Schema(description = "企业(机构)类型")
private String institutionType;
@Schema(description = "纳税人识别号")
private String taxpayerCode;
@Schema(description = "注册号")
private String registrationNumber;
@Schema(description = "组织机构代码")
private String organizationalCode;
@Schema(description = "参保人数")
private String numberOfInsuredPersons;
@Schema(description = "参保人数所属年报")
private String annualReport;
@Schema(description = "营业期限")
private String businessTerm;
@Schema(description = "国标行业门类")
private String nationalStandardIndustryCategories;
@Schema(description = "国标行业大类")
private String nationalStandardIndustryCategories2;
@Schema(description = "国标行业中类")
private String nationalStandardIndustryCategories3;
@Schema(description = "国标行业小类")
private String nationalStandardIndustryCategories4;
@Schema(description = "企查查行业门类")
private String nationalStandardIndustryCategories5;
@Schema(description = "企查查行业大类")
private String nationalStandardIndustryCategories6;
@Schema(description = "企查查行业中类")
private String nationalStandardIndustryCategories7;
@Schema(description = "企查查行业小类")
private String nationalStandardIndustryCategories8;
@Schema(description = "企业规模")
private String companySize;
@Schema(description = "曾用名")
private String formerName;
@Schema(description = "英文名")
private String englishName;
@Schema(description = "官网")
private String domain;
@Schema(description = "通信地址")
private String mailingAddress;
@Schema(description = "企业简介")
private String companyProfile;
@Schema(description = "经营范围")
private String natureOfBusiness;
@Schema(description = "登记机关")
private String registrationAuthority;
@Schema(description = "纳税人资质")
private String taxpayerQualification;
@Schema(description = "最新年报年份")
private String latestAnnualReportYear;
@Schema(description = "最新年报营业收入")
private String latestAnnualReportOnOperatingRevenue;
@Schema(description = "企查分")
private String enterpriseScoreCheck;
@Schema(description = "信用等级")
private String creditRating;
@Schema(description = "科创分")
private String cechnologyScore;
@Schema(description = "科创等级")
private String cechnologyLevel;
@Schema(description = "是否小微企业")
private String smallEnterprise;
@Schema(description = "备注")
private String comments;
@Schema(description = "是否推荐")
@QueryField(type = QueryType.EQ)
private Integer recommend;
@Schema(description = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@Schema(description = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@Schema(description = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@Schema(description = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
}

View File

@@ -0,0 +1,45 @@
package com.gxwebsoft.credit.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.credit.entity.CreditCompany;
import com.gxwebsoft.credit.param.CreditCompanyParam;
import java.util.List;
/**
* 企业Service
*
* @author 科技小王子
* @since 2025-12-17 08:28:03
*/
public interface CreditCompanyService extends IService<CreditCompany> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<CreditCompany>
*/
PageResult<CreditCompany> pageRel(CreditCompanyParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<CreditCompany>
*/
List<CreditCompany> listRel(CreditCompanyParam param);
/**
* 根据id查询
*
* @param id ID
* @return CreditCompany
*/
CreditCompany getByIdRel(Integer id);
CreditCompany getByName(String name);
CreditCompany getByMatchName(String name);
}

View File

@@ -0,0 +1,61 @@
package com.gxwebsoft.credit.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.credit.entity.CreditCompany;
import com.gxwebsoft.credit.mapper.CreditCompanyMapper;
import com.gxwebsoft.credit.param.CreditCompanyParam;
import com.gxwebsoft.credit.service.CreditCompanyService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企业Service实现
*
* @author 科技小王子
* @since 2025-12-17 08:28:03
*/
@Service
public class CreditCompanyServiceImpl extends ServiceImpl<CreditCompanyMapper, CreditCompany> implements CreditCompanyService {
@Override
public PageResult<CreditCompany> pageRel(CreditCompanyParam param) {
PageParam<CreditCompany, CreditCompanyParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<CreditCompany> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<CreditCompany> listRel(CreditCompanyParam param) {
List<CreditCompany> list = baseMapper.selectListRel(param);
// 排序
PageParam<CreditCompany, CreditCompanyParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public CreditCompany getByIdRel(Integer id) {
CreditCompanyParam param = new CreditCompanyParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public CreditCompany getByName(String name) {
CreditCompanyParam param = new CreditCompanyParam();
param.setName(name);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public CreditCompany getByMatchName(String name) {
CreditCompanyParam param = new CreditCompanyParam();
param.setMatchName(name);
return param.getOne(baseMapper.selectListRel(param));
}
}