From 57cdb722080aabe34db274b0fa931badcea00e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 17 Dec 2025 10:04:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(credit):=20=E6=96=B0=E5=A2=9E=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增企业实体类CreditCompany,包含企业基本信息字段 - 新增企业控制器CreditCompanyController,提供CRUD接口 - 新增企业导入参数类CreditCompanyImportParam,支持Excel导入 - 新增企业查询参数类CreditCompanyParam,支持条件查询 - 新增企业Mapper接口及XML映射文件,实现关联查询 - 实 --- .../controller/CreditCompanyController.java | 390 ++++++++++++++++++ .../credit/entity/CreditCompany.java | 210 ++++++++++ .../credit/mapper/CreditCompanyMapper.java | 37 ++ .../credit/mapper/xml/CreditCompanyMapper.xml | 207 ++++++++++ .../mapper/xml/CreditJudiciaryMapper.xml | 2 +- .../credit/mapper/xml/CreditUserMapper.xml | 2 +- .../param/CreditCompanyImportParam.java | 163 ++++++++ .../credit/param/CreditCompanyParam.java | 203 +++++++++ .../credit/service/CreditCompanyService.java | 45 ++ .../impl/CreditCompanyServiceImpl.java | 61 +++ 10 files changed, 1318 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java create mode 100644 src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java create mode 100644 src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java create mode 100644 src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml create mode 100644 src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java create mode 100644 src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java create mode 100644 src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java create mode 100644 src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java new file mode 100644 index 0000000..4f23ecf --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java @@ -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> page(CreditCompanyParam param) { + // 使用关联查询 + return success(creditCompanyService.pageRel(param)); + } + + @Operation(summary = "查询全部企业") + @GetMapping() + public ApiResult> list(CreditCompanyParam param) { + // 使用关联查询 + return success(creditCompanyService.listRel(param)); + } + + @Operation(summary = "根据id查询企业") + @GetMapping("/{id}") + public ApiResult 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 list) { + if (creditCompanyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:update')") + @OperationLog + @Operation(summary = "批量修改企业") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam 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 ids) { + if (creditCompanyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 批量导入企业 + */ + @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") + @Operation(summary = "批量导入企业") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + + try { + List 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 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 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 filterEmptyRows(List 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; + } + + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java new file mode 100644 index 0000000..b48b437 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java new file mode 100644 index 0000000..bbd7c01 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java @@ -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 { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCompanyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCompanyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml new file mode 100644 index 0000000..1051282 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml @@ -0,0 +1,207 @@ + + + + + + + SELECT a.* + FROM credit_company a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.match_name LIKE CONCAT('%', #{param.matchName}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.parent_id = #{param.parentId} + + + AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') + + + AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') + + + AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') + + + AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%') + + + AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.tel LIKE CONCAT('%', #{param.tel}, '%') + + + AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%') + + + AND a.taxpayer_code LIKE CONCAT('%', #{param.taxpayerCode}, '%') + + + AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%') + + + AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%') + + + AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%') + + + AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%') + + + AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%') + + + AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%') + + + AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%') + + + AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%') + + + AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%') + + + AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%') + + + AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%') + + + AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%') + + + AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%') + + + AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%') + + + AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%') + + + AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%') + + + AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%') + + + AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%') + + + AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%') + + + AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%') + + + AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%') + + + AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%') + + + AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%') + + + AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%') + + + AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%') + + + AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%') + + + AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml index 2362dd6..3dc10a8 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml @@ -89,7 +89,7 @@ AND a.create_time <= #{param.createTimeEnd} - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') ) diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml index b283980..7e00d8a 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml @@ -83,7 +83,7 @@ AND a.create_time <= #{param.createTimeEnd} - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') ) diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java new file mode 100644 index 0000000..9db4d95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java new file mode 100644 index 0000000..e1db229 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java new file mode 100644 index 0000000..e96c34e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java @@ -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 { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCompanyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCompanyParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCompany + */ + CreditCompany getByIdRel(Integer id); + + CreditCompany getByName(String name); + + CreditCompany getByMatchName(String name); +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java new file mode 100644 index 0000000..ab591b3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java @@ -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 implements CreditCompanyService { + + @Override + public PageResult pageRel(CreditCompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCompanyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam 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)); + } + +}