diff --git a/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java b/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java index 5c4180f..983ea51 100644 --- a/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java +++ b/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java @@ -12,4 +12,7 @@ public interface ErrorCodeConstants { // ========== Fta 企业信息(1-040-100-000) ========== ErrorCode ENTERPRISE_INFORMATION_NOT_EXISTS = new ErrorCode(1_040_100_000, "企业信息不存在"); + // ========== Fta 企业信息变更(1-040-101-000) ========== + ErrorCode ENTERPRISE_CHANGE_NOT_EXISTS = new ErrorCode(1_040_101_000, "企业信息变更不存在"); + } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/EnterpriseChangeController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/EnterpriseChangeController.java new file mode 100644 index 0000000..65c2e7d --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/EnterpriseChangeController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo.*; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange.EnterpriseChangeDO; +import cn.iocoder.yudao.module.fta.service.enterprisechange.EnterpriseChangeService; + +@Tag(name = "管理后台 - 企业信息变更") +@RestController +@RequestMapping("/fta/enterprise-change") +@Validated +public class EnterpriseChangeController { + + @Resource + private EnterpriseChangeService enterpriseChangeService; + + @PostMapping("/create") + @Operation(summary = "创建企业信息变更") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:create')") + public CommonResult createEnterpriseChange(@Valid @RequestBody EnterpriseChangeSaveReqVO createReqVO) { + return success(enterpriseChangeService.createEnterpriseChange(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业信息变更") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:update')") + public CommonResult updateEnterpriseChange(@Valid @RequestBody EnterpriseChangeSaveReqVO updateReqVO) { + enterpriseChangeService.updateEnterpriseChange(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业信息变更") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:delete')") + public CommonResult deleteEnterpriseChange(@RequestParam("id") Long id) { + enterpriseChangeService.deleteEnterpriseChange(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业信息变更") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:query')") + public CommonResult getEnterpriseChange(@RequestParam("id") Long id) { + EnterpriseChangeDO enterpriseChange = enterpriseChangeService.getEnterpriseChange(id); + return success(BeanUtils.toBean(enterpriseChange, EnterpriseChangeRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得企业信息变更分页") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:query')") + public CommonResult> getEnterpriseChangePage(@Valid EnterpriseChangePageReqVO pageReqVO) { + PageResult pageResult = enterpriseChangeService.getEnterpriseChangePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EnterpriseChangeRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出企业信息变更 Excel") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportEnterpriseChangeExcel(@Valid EnterpriseChangePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = enterpriseChangeService.getEnterpriseChangePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业信息变更.xls", "数据", EnterpriseChangeRespVO.class, + BeanUtils.toBean(list, EnterpriseChangeRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangePageReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangePageReqVO.java new file mode 100644 index 0000000..72d7feb --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangePageReqVO.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 企业信息变更分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class EnterpriseChangePageReqVO extends PageParam { + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "审批结果", example = "2") + private Integer status; + + @Schema(description = "变更前企业名称", example = "赵六") + private String oldEnterpriseName; + + @Schema(description = "变更前企业法定代表人") + private String oldLegalPerson; + + @Schema(description = "企业名称", example = "张三") + private String name; + + @Schema(description = "企业法定代表人") + private String legalPerson; + + @Schema(description = "统一社会信用代码") + private String unifiedCreditCode; + + @Schema(description = "经营状态") + private Integer operateState; + + @Schema(description = "企业类型", example = "2") + private Integer enterpriseType; + + @Schema(description = "企业所属行业") + private String enterpriseBelongingToIndustry; + + @Schema(description = "是否涉及危化证") + private Integer isSecure; + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeRespVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeRespVO.java new file mode 100644 index 0000000..a22137f --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeRespVO.java @@ -0,0 +1,108 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 企业信息变更 Response VO") +@Data +@ExcelIgnoreUnannotated +public class EnterpriseChangeRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30728") + @ExcelProperty("编号") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "流程实例编号", example = "28590") + @ExcelProperty("流程实例编号") + private String processInstanceId; + + @Schema(description = "审批结果", example = "2") + @ExcelProperty(value = "审批结果", converter = DictConvert.class) + @DictFormat("bpm_process_instance_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "变更前企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @ExcelProperty("变更前企业名称") + private String oldEnterpriseName; + + @Schema(description = "变更前企业法定代表人", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("变更前企业法定代表人") + private String oldLegalPerson; + + @Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @ExcelProperty("企业名称") + private String name; + + @Schema(description = "企业法定代表人", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("企业法定代表人") + private String legalPerson; + + @Schema(description = "统一社会信用代码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("统一社会信用代码") + private String unifiedCreditCode; + + @Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("电话") + private String telephone; + + @Schema(description = "邮箱", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("邮箱") + private String mailbox; + + @Schema(description = "注册地址", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("注册地址") + private String registerAddress; + + @Schema(description = "通信地址", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("通信地址") + private String communicationAddress; + + @Schema(description = "经营状态", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty(value = "经营状态", converter = DictConvert.class) + @DictFormat("enterprise_operate_state") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer operateState; + + @Schema(description = "成立日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("成立日期") + private LocalDate establishDate; + + @Schema(description = "企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty(value = "企业类型", converter = DictConvert.class) + @DictFormat("enterprise_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer enterpriseType; + + @Schema(description = "企业所属地区", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("企业所属地区") + private String enterpriseBelongingToRegion; + + @Schema(description = "企业所属行业", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("企业所属行业") + private String enterpriseBelongingToIndustry; + + @Schema(description = "登记机关", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("登记机关") + private String registerOffice; + + @Schema(description = "经营许可范围", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("经营许可范围") + private String operatePermitRange; + + @Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty(value = "是否涉及危化证", converter = DictConvert.class) + @DictFormat("enterprise_is_secure") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer isSecure; + +} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeSaveReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeSaveReqVO.java new file mode 100644 index 0000000..9b87b78 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeSaveReqVO.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 企业信息变更新增/修改 Request VO") +@Data +public class EnterpriseChangeSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30728") + private Long id; + + @Schema(description = "变更前企业信息Json字符串", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "变更前企业信息Json字符串不能为空") + private String oldEnterpriseJson; + + @Schema(description = "变更前企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "变更前企业名称不能为空") + private String oldEnterpriseName; + + @Schema(description = "变更前企业法定代表人", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "变更前企业法定代表人不能为空") + private String oldLegalPerson; + + @Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @NotEmpty(message = "企业名称不能为空") + private String name; + + @Schema(description = "企业法定代表人", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "企业法定代表人不能为空") + private String legalPerson; + + @Schema(description = "统一社会信用代码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "统一社会信用代码不能为空") + private String unifiedCreditCode; + + @Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "电话不能为空") + private String telephone; + + @Schema(description = "邮箱", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "邮箱不能为空") + private String mailbox; + + @Schema(description = "注册地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "注册地址不能为空") + private String registerAddress; + + @Schema(description = "通信地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "通信地址不能为空") + private String communicationAddress; + + @Schema(description = "经营状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "经营状态不能为空") + private Integer operateState; + + @Schema(description = "成立日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "成立日期不能为空") + private LocalDate establishDate; + + @Schema(description = "企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "企业类型不能为空") + private Integer enterpriseType; + + @Schema(description = "企业所属地区", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "企业所属地区不能为空") + private String enterpriseBelongingToRegion; + + @Schema(description = "企业所属行业", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "企业所属行业不能为空") + private String enterpriseBelongingToIndustry; + + @Schema(description = "登记机关", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "登记机关不能为空") + private String registerOffice; + + @Schema(description = "经营许可范围", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "经营许可范围不能为空") + private String operatePermitRange; + + @Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否涉及危化证不能为空") + private Integer isSecure; + +} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java index 7eb0a4c..562dbb8 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/EnterpriseInformationController.java @@ -79,6 +79,14 @@ public class EnterpriseInformationController { return success(BeanUtils.toBean(pageResult, EnterpriseInformationRespVO.class)); } + @GetMapping("/passPage") + @Operation(summary = "获得已经通过审核的企业信息分页") + @PreAuthorize("@ss.hasPermission('fta:enterprise-information:query')") + public CommonResult> getEnterpriseInformationPassPage(@Valid EnterpriseInformationPageReqVO pageReqVO) { + PageResult pageResult = enterpriseInformationService.getEnterpriseInformationPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EnterpriseInformationRespVO.class)); + } + @GetMapping("/export-excel") @Operation(summary = "导出企业信息 Excel") @PreAuthorize("@ss.hasPermission('fta:enterprise-information:export')") @@ -92,4 +100,4 @@ public class EnterpriseInformationController { BeanUtils.toBean(list, EnterpriseInformationRespVO.class)); } -} \ No newline at end of file +} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java index 7d94248..6e32982 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/EnterpriseInformationSaveReqVO.java @@ -78,4 +78,96 @@ public class EnterpriseInformationSaveReqVO { @NotEmpty(message = "审批人不能为空") private Map> startUserSelectAssignees; + @Schema(description = "负责人证号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "负责人证号不能为空") + private String principalCertificateNumber; + + @Schema(description = "负责人姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "负责人姓名不能为空") + private String principalName; + + @Schema(description = "负责人人员类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "负责人人员类型不能为空") + private String principalPersonnelType; + + @Schema(description = "负责人性别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人性别不能为空") + private Integer principalSex; + + @Schema(description = "负责人行业类别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "负责人行业类别不能为空") + private String principalCategoryOfEmployment; + + @Schema(description = "负责人证初领日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人证初领日期不能为空") + private LocalDate principalDateOfIssue; + + @Schema(description = "负责人证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人证到期日期不能为空") + private LocalDate principalExpiryDate; + + @Schema(description = "负责人证签发机关", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人证签发机关不能为空") + private String principalLicenceIssuingAuthority; + + @Schema(description = "负责人证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人证图片不能为空") + private String principalImageUrl; + + @Schema(description = "安全员证号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员证号不能为空") + private String securityCertificateNumber; + + @Schema(description = "安全员姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员姓名不能为空") + private String securityName; + + @Schema(description = "安全员人员类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员人员类型不能为空") + private String securityPersonnelType; + + @Schema(description = "安全员性别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员性别不能为空") + private Integer securitySex; + + @Schema(description = "安全员行业类别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员行业类别不能为空") + private String securityCategoryOfEmployment; + + @Schema(description = "安全员证初领日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员证初领日期不能为空") + private LocalDate securityDateOfIssue; + + @Schema(description = "安全员证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员证到期日期不能为空") + private LocalDate securityExpiryDate; + + @Schema(description = "安全员证签发机关", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员证签发机关不能为空") + private String securityLicenceIssuingAuthority; + + @Schema(description = "安全员证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "安全员证图片不能为空") + private String securityImageUrl; + + @Schema(description = "危化证经营方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "危化证经营方式不能为空") + private String dangerBusinessPattern; + + @Schema(description = "危化证发证机关", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "危化证发证机关不能为空") + private String dangerLicenceIssuingAuthority; + + @Schema(description = "危化证发证日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "危化证发证日期不能为空") + private LocalDate dangerDateOfIssue; + + @Schema(description = "危化证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "危化证到期日期不能为空") + private LocalDate dangerExpiryDate; + + @Schema(description = "危化证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "危化证图片不能为空") + private String dangerImageUrl; + } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterprisechange/EnterpriseChangeDO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterprisechange/EnterpriseChangeDO.java new file mode 100644 index 0000000..8c98914 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterprisechange/EnterpriseChangeDO.java @@ -0,0 +1,121 @@ +package cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange; + +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 企业信息变更 DO + * + * @author 王长久 + */ +@TableName("fta_enterprise_change") +@KeySequence("fta_enterprise_change_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EnterpriseChangeDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 流程实例编号 + */ + private String processInstanceId; + /** + * 审批结果 + * + * 枚举 {@link TODO bpm_process_instance_status 对应的类} + */ + private Integer status; + /** + * 变更前企业信息Json字符串 + */ + private String oldEnterpriseJson; + /** + * 变更前企业名称 + */ + private String oldEnterpriseName; + /** + * 变更前企业法定代表人 + */ + private String oldLegalPerson; + /** + * 企业名称 + */ + private String name; + /** + * 企业法定代表人 + */ + private String legalPerson; + /** + * 统一社会信用代码 + */ + private String unifiedCreditCode; + /** + * 电话 + */ + private String telephone; + /** + * 邮箱 + */ + private String mailbox; + /** + * 注册地址 + */ + private String registerAddress; + /** + * 通信地址 + */ + private String communicationAddress; + /** + * 经营状态 + * + * 枚举 {@link TODO enterprise_operate_state 对应的类} + */ + private Integer operateState; + /** + * 成立日期 + */ + private LocalDate establishDate; + /** + * 企业类型 + * + * 枚举 {@link TODO enterprise_type 对应的类} + */ + private Integer enterpriseType; + /** + * 企业所属地区 + */ + private String enterpriseBelongingToRegion; + /** + * 企业所属行业 + */ + private String enterpriseBelongingToIndustry; + /** + * 登记机关 + */ + private String registerOffice; + /** + * 经营许可范围 + */ + private String operatePermitRange; + /** + * 是否涉及危化证 + * + * 枚举 {@link TODO enterprise_is_secure 对应的类} + */ + private Integer isSecure; + +} diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterprisechange/EnterpriseChangeMapper.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterprisechange/EnterpriseChangeMapper.java new file mode 100644 index 0000000..689aab6 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterprisechange/EnterpriseChangeMapper.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.fta.dal.mysql.enterprisechange; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange.EnterpriseChangeDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo.*; + +/** + * 企业信息变更 Mapper + * + * @author 王长久 + */ +@Mapper +public interface EnterpriseChangeMapper extends BaseMapperX { + + default PageResult selectPage(EnterpriseChangePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .betweenIfPresent(EnterpriseChangeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(EnterpriseChangeDO::getStatus, reqVO.getStatus()) + .likeIfPresent(EnterpriseChangeDO::getOldEnterpriseName, reqVO.getOldEnterpriseName()) + .eqIfPresent(EnterpriseChangeDO::getOldLegalPerson, reqVO.getOldLegalPerson()) + .likeIfPresent(EnterpriseChangeDO::getName, reqVO.getName()) + .eqIfPresent(EnterpriseChangeDO::getLegalPerson, reqVO.getLegalPerson()) + .eqIfPresent(EnterpriseChangeDO::getUnifiedCreditCode, reqVO.getUnifiedCreditCode()) + .eqIfPresent(EnterpriseChangeDO::getOperateState, reqVO.getOperateState()) + .eqIfPresent(EnterpriseChangeDO::getEnterpriseType, reqVO.getEnterpriseType()) + .likeIfPresent(EnterpriseChangeDO::getEnterpriseBelongingToIndustry, reqVO.getEnterpriseBelongingToIndustry()) + .eqIfPresent(EnterpriseChangeDO::getIsSecure, reqVO.getIsSecure()) + .orderByDesc(EnterpriseChangeDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java index abef2c2..2af5371 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java @@ -5,6 +5,7 @@ import java.util.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; @@ -34,4 +35,12 @@ public interface EnterpriseInformationMapper extends BaseMapperX selectPassPage(EnterpriseInformationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(EnterpriseInformationDO::getName, reqVO.getName()) + .likeIfPresent(EnterpriseInformationDO::getLegalPerson, reqVO.getLegalPerson()) + .eqIfPresent(EnterpriseInformationDO::getStatus, BpmTaskStatusEnum.APPROVE.getStatus()) + .orderByDesc(EnterpriseInformationDO::getId)); + } + } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeService.java new file mode 100644 index 0000000..4d45bb8 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.fta.service.enterprisechange; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo.*; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange.EnterpriseChangeDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 企业信息变更 Service 接口 + * + * @author 王长久 + */ +public interface EnterpriseChangeService { + + /** + * 创建企业信息变更 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createEnterpriseChange(@Valid EnterpriseChangeSaveReqVO createReqVO); + + /** + * 更新企业信息变更 + * + * @param updateReqVO 更新信息 + */ + void updateEnterpriseChange(@Valid EnterpriseChangeSaveReqVO updateReqVO); + + /** + * 删除企业信息变更 + * + * @param id 编号 + */ + void deleteEnterpriseChange(Long id); + + /** + * 获得企业信息变更 + * + * @param id 编号 + * @return 企业信息变更 + */ + EnterpriseChangeDO getEnterpriseChange(Long id); + + /** + * 获得企业信息变更分页 + * + * @param pageReqVO 分页查询 + * @return 企业信息变更分页 + */ + PageResult getEnterpriseChangePage(EnterpriseChangePageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImpl.java new file mode 100644 index 0000000..80870e6 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.fta.service.enterprisechange; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo.*; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange.EnterpriseChangeDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.fta.dal.mysql.enterprisechange.EnterpriseChangeMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; + +/** + * 企业信息变更 Service 实现类 + * + * @author 王长久 + */ +@Service +@Validated +public class EnterpriseChangeServiceImpl implements EnterpriseChangeService { + + @Resource + private EnterpriseChangeMapper enterpriseChangeMapper; + + @Override + public Long createEnterpriseChange(EnterpriseChangeSaveReqVO createReqVO) { + // 插入 + EnterpriseChangeDO enterpriseChange = BeanUtils.toBean(createReqVO, EnterpriseChangeDO.class); + enterpriseChangeMapper.insert(enterpriseChange); + // 返回 + return enterpriseChange.getId(); + } + + @Override + public void updateEnterpriseChange(EnterpriseChangeSaveReqVO updateReqVO) { + // 校验存在 + validateEnterpriseChangeExists(updateReqVO.getId()); + // 更新 + EnterpriseChangeDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseChangeDO.class); + enterpriseChangeMapper.updateById(updateObj); + } + + @Override + public void deleteEnterpriseChange(Long id) { + // 校验存在 + validateEnterpriseChangeExists(id); + // 删除 + enterpriseChangeMapper.deleteById(id); + } + + private void validateEnterpriseChangeExists(Long id) { + if (enterpriseChangeMapper.selectById(id) == null) { + throw exception(ENTERPRISE_CHANGE_NOT_EXISTS); + } + } + + @Override + public EnterpriseChangeDO getEnterpriseChange(Long id) { + return enterpriseChangeMapper.selectById(id); + } + + @Override + public PageResult getEnterpriseChangePage(EnterpriseChangePageReqVO pageReqVO) { + return enterpriseChangeMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java index 29aae05..54cbf4a 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java @@ -52,6 +52,14 @@ public interface EnterpriseInformationService { */ PageResult getEnterpriseInformationPage(EnterpriseInformationPageReqVO pageReqVO); + /** + * 获得已经通过审核的企业信息分页 + * + * @param pageReqVO 分页查询 + * @return 企业信息分页 + */ + PageResult getEnterpriseInformationPassPage(EnterpriseInformationPageReqVO pageReqVO); + /** * 更新企业基本信息申请的状态 * diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java index 681d085..a5ec75a 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java @@ -49,6 +49,13 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); enterpriseInformationMapper.insert(enterpriseInformation); + // 插入 企业负责人证件 + + + // 插入 企业安全员证件 + + // 判断 如果涉及危化证则插入危化证信息 + // 发起 BPM 流程 Map processInstanceVariables = new HashMap<>(); String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(), @@ -96,6 +103,11 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe return enterpriseInformationMapper.selectPage(pageReqVO); } + @Override + public PageResult getEnterpriseInformationPassPage(EnterpriseInformationPageReqVO pageReqVO) { + return enterpriseInformationMapper.selectPassPage(pageReqVO); + } + @Override public void updateEnterpriseInformationStatus(long id, Integer status) { validateLeaveExists(id); diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterprisechange/EnterpriseChangeMapper.xml b/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterprisechange/EnterpriseChangeMapper.xml new file mode 100644 index 0000000..27a3b2b --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterprisechange/EnterpriseChangeMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/test/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImplTest.java b/yudao-module-fta/yudao-module-fta-biz/src/test/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImplTest.java new file mode 100644 index 0000000..454b688 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/test/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeServiceImplTest.java @@ -0,0 +1,170 @@ +package cn.iocoder.yudao.module.fta.service.enterprisechange; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +import javax.annotation.Resource; + +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; + +import cn.iocoder.yudao.module.fta.controller.admin.enterprisechange.vo.*; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterprisechange.EnterpriseChangeDO; +import cn.iocoder.yudao.module.fta.dal.mysql.enterprisechange.EnterpriseChangeMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import javax.annotation.Resource; +import org.springframework.context.annotation.Import; +import java.util.*; +import java.time.LocalDateTime; + +import static cn.hutool.core.util.RandomUtil.*; +import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * {@link EnterpriseChangeServiceImpl} 的单元测试类 + * + * @author 王长久 + */ +@Import(EnterpriseChangeServiceImpl.class) +public class EnterpriseChangeServiceImplTest extends BaseDbUnitTest { + + @Resource + private EnterpriseChangeServiceImpl enterpriseChangeService; + + @Resource + private EnterpriseChangeMapper enterpriseChangeMapper; + + @Test + public void testCreateEnterpriseChange_success() { + // 准备参数 + EnterpriseChangeSaveReqVO createReqVO = randomPojo(EnterpriseChangeSaveReqVO.class).setId(null); + + // 调用 + Long enterpriseChangeId = enterpriseChangeService.createEnterpriseChange(createReqVO); + // 断言 + assertNotNull(enterpriseChangeId); + // 校验记录的属性是否正确 + EnterpriseChangeDO enterpriseChange = enterpriseChangeMapper.selectById(enterpriseChangeId); + assertPojoEquals(createReqVO, enterpriseChange, "id"); + } + + @Test + public void testUpdateEnterpriseChange_success() { + // mock 数据 + EnterpriseChangeDO dbEnterpriseChange = randomPojo(EnterpriseChangeDO.class); + enterpriseChangeMapper.insert(dbEnterpriseChange);// @Sql: 先插入出一条存在的数据 + // 准备参数 + EnterpriseChangeSaveReqVO updateReqVO = randomPojo(EnterpriseChangeSaveReqVO.class, o -> { + o.setId(dbEnterpriseChange.getId()); // 设置更新的 ID + }); + + // 调用 + enterpriseChangeService.updateEnterpriseChange(updateReqVO); + // 校验是否更新正确 + EnterpriseChangeDO enterpriseChange = enterpriseChangeMapper.selectById(updateReqVO.getId()); // 获取最新的 + assertPojoEquals(updateReqVO, enterpriseChange); + } + + @Test + public void testUpdateEnterpriseChange_notExists() { + // 准备参数 + EnterpriseChangeSaveReqVO updateReqVO = randomPojo(EnterpriseChangeSaveReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> enterpriseChangeService.updateEnterpriseChange(updateReqVO), ENTERPRISE_CHANGE_NOT_EXISTS); + } + + @Test + public void testDeleteEnterpriseChange_success() { + // mock 数据 + EnterpriseChangeDO dbEnterpriseChange = randomPojo(EnterpriseChangeDO.class); + enterpriseChangeMapper.insert(dbEnterpriseChange);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbEnterpriseChange.getId(); + + // 调用 + enterpriseChangeService.deleteEnterpriseChange(id); + // 校验数据不存在了 + assertNull(enterpriseChangeMapper.selectById(id)); + } + + @Test + public void testDeleteEnterpriseChange_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> enterpriseChangeService.deleteEnterpriseChange(id), ENTERPRISE_CHANGE_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetEnterpriseChangePage() { + // mock 数据 + EnterpriseChangeDO dbEnterpriseChange = randomPojo(EnterpriseChangeDO.class, o -> { // 等会查询到 + o.setCreateTime(null); + o.setStatus(null); + o.setOldEnterpriseName(null); + o.setOldLegalPerson(null); + o.setName(null); + o.setLegalPerson(null); + o.setUnifiedCreditCode(null); + o.setOperateState(null); + o.setEnterpriseType(null); + o.setEnterpriseBelongingToIndustry(null); + o.setIsSecure(null); + }); + enterpriseChangeMapper.insert(dbEnterpriseChange); + // 测试 createTime 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setCreateTime(null))); + // 测试 status 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setStatus(null))); + // 测试 oldEnterpriseName 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setOldEnterpriseName(null))); + // 测试 oldLegalPerson 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setOldLegalPerson(null))); + // 测试 name 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setName(null))); + // 测试 legalPerson 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setLegalPerson(null))); + // 测试 unifiedCreditCode 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setUnifiedCreditCode(null))); + // 测试 operateState 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setOperateState(null))); + // 测试 enterpriseType 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setEnterpriseType(null))); + // 测试 enterpriseBelongingToIndustry 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setEnterpriseBelongingToIndustry(null))); + // 测试 isSecure 不匹配 + enterpriseChangeMapper.insert(cloneIgnoreId(dbEnterpriseChange, o -> o.setIsSecure(null))); + // 准备参数 + EnterpriseChangePageReqVO reqVO = new EnterpriseChangePageReqVO(); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setStatus(null); + reqVO.setOldEnterpriseName(null); + reqVO.setOldLegalPerson(null); + reqVO.setName(null); + reqVO.setLegalPerson(null); + reqVO.setUnifiedCreditCode(null); + reqVO.setOperateState(null); + reqVO.setEnterpriseType(null); + reqVO.setEnterpriseBelongingToIndustry(null); + reqVO.setIsSecure(null); + + // 调用 + PageResult pageResult = enterpriseChangeService.getEnterpriseChangePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbEnterpriseChange, pageResult.getList().get(0)); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/clean.sql b/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/clean.sql index c86daf0..ce0ce7d 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/clean.sql +++ b/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/clean.sql @@ -1,2 +1,3 @@ -- 将该删表 SQL 语句,添加到 yudao-module-fta-biz 模块的 test/resources/sql/clean.sql 文件里 DELETE FROM "fta_enterprise_information"; +DELETE FROM "fta_enterprise_change"; diff --git a/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/create_tables.sql b/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/create_tables.sql index 5963146..b7b8628 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-fta/yudao-module-fta-biz/src/test/resources/sql/create_tables.sql @@ -23,3 +23,34 @@ CREATE TABLE IF NOT EXISTS "fta_enterprise_information" ( "operate_permit_range" varchar NOT NULL, PRIMARY KEY ("id") ) COMMENT '企业信息'; + +CREATE TABLE IF NOT EXISTS "fta_enterprise_change" ( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "process_instance_id" varchar, + "status" int, + "tenant_id" bigint NOT NULL, + "old_enterprise_json" varchar NOT NULL, + "old_enterprise_name" varchar NOT NULL, + "old_legal_person" varchar NOT NULL, + "name" varchar NOT NULL, + "legal_person" varchar NOT NULL, + "unified_credit_code" varchar NOT NULL, + "telephone" varchar NOT NULL, + "mailbox" varchar NOT NULL, + "register_address" varchar NOT NULL, + "communication_address" varchar NOT NULL, + "operate_state" int NOT NULL, + "establish_date" varchar NOT NULL, + "enterprise_type" int NOT NULL, + "enterprise_belonging_to_region" varchar NOT NULL, + "enterprise_belonging_to_industry" varchar NOT NULL, + "register_office" varchar NOT NULL, + "operate_permit_range" varchar NOT NULL, + "is_secure" int NOT NULL, + PRIMARY KEY ("id") + ) COMMENT '企业信息变更';