From a5b541038eed5ea55f861ed9ffc2598c9ea7f197 Mon Sep 17 00:00:00 2001 From: Wayne Date: Thu, 16 May 2024 10:49:55 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=81=E4=B8=9A=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E9=80=9A=E8=BF=87=E5=90=8E=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E5=8F=8A?= =?UTF-8?q?=E8=AF=81=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseChangeController.java | 31 ++- .../vo/EnterpriseChangeRespVO.java | 92 +++++++ .../vo/EnterpriseChangeSaveReqVO.java | 117 +++++++-- .../enterprisechange/EnterpriseChangeDO.java | 8 +- .../EnterpriseChangeService.java | 20 +- .../EnterpriseChangeServiceImpl.java | 230 +++++++++++++++++- .../EnterpriseInformationServiceImpl.java | 8 +- ...rpriseInformationChangeStatusListener.java | 34 +++ .../EnterpriseChangeServiceImplTest.java | 4 +- 9 files changed, 503 insertions(+), 41 deletions(-) create mode 100644 yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/oa/listener/FtaEnterpriseInformationChangeStatusListener.java 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 index 65c2e7d..1beb03a 100644 --- 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 @@ -1,5 +1,9 @@ package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.EnterpriseInformationRespVO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; +import cn.iocoder.yudao.module.fta.service.enterpriseinformation.EnterpriseInformationService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -38,11 +42,19 @@ public class EnterpriseChangeController { @Resource private EnterpriseChangeService enterpriseChangeService; + @Resource + private EnterpriseInformationService enterpriseInformationService; + @PostMapping("/create") @Operation(summary = "创建企业信息变更") @PreAuthorize("@ss.hasPermission('fta:enterprise-change:create')") public CommonResult createEnterpriseChange(@Valid @RequestBody EnterpriseChangeSaveReqVO createReqVO) { - return success(enterpriseChangeService.createEnterpriseChange(createReqVO)); + EnterpriseInformationDO enterpriseInformation = enterpriseInformationService.getEnterpriseInformation(createReqVO.getId()); + EnterpriseInformationRespVO respVO = BeanUtils.toBean(enterpriseInformation, EnterpriseInformationRespVO.class); + respVO = enterpriseInformationService.selectCredentialManagement(respVO); + EnterpriseChangeSaveReqVO saveReqVO = BeanUtils.toBean(respVO, EnterpriseChangeSaveReqVO.class); + saveReqVO.setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees()); + return success(enterpriseChangeService.createEnterpriseChange(createReqVO,saveReqVO)); } @PutMapping("/update") @@ -68,7 +80,20 @@ public class EnterpriseChangeController { @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)); + EnterpriseChangeRespVO respVO = BeanUtils.toBean(enterpriseChange, EnterpriseChangeRespVO.class); + respVO = enterpriseChangeService.selectCredentialManagement(respVO); + return success(respVO); + } + + @GetMapping("/getOldEnterprise") + @Operation(summary = "获得变更前企业信息企业信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('fta:enterprise-change:query')") + public CommonResult getOldEnterprise(@RequestParam("id") Long id) { + EnterpriseChangeDO enterpriseChange = enterpriseChangeService.getEnterpriseChange(id); + String oldEnterpriseJson = enterpriseChange.getOldEnterpriseJson(); + EnterpriseChangeRespVO enterpriseChangeRespVO = JSONUtil.toBean(oldEnterpriseJson, EnterpriseChangeRespVO.class); + return success(enterpriseChangeRespVO); } @GetMapping("/page") @@ -92,4 +117,4 @@ public class EnterpriseChangeController { 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/EnterpriseChangeRespVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterprisechange/vo/EnterpriseChangeRespVO.java index a22137f..654e369 100644 --- 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 @@ -105,4 +105,96 @@ public class EnterpriseChangeRespVO { @DictFormat("enterprise_is_secure") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 private Integer isSecure; + @Schema(description = "负责人证号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalCertificateNumber; + + @Schema(description = "负责人姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalName; + + @Schema(description = "负责人人员类型", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalPersonnelType; + + @Schema(description = "负责人性别", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private Integer principalSex; + + @Schema(description = "负责人行业类别", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalCategoryOfEmployment; + + @Schema(description = "负责人证初领日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate principalDateOfIssue; + + @Schema(description = "负责人证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate principalExpiryDate; + + @Schema(description = "负责人证签发机关", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalLicenceIssuingAuthority; + + @Schema(description = "负责人证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String principalImageUrl; + + @Schema(description = "安全员证号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityCertificateNumber; + + @Schema(description = "安全员姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityName; + + @Schema(description = "安全员人员类型", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityPersonnelType; + + @Schema(description = "安全员性别", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private Integer securitySex; + + @Schema(description = "安全员行业类别", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityCategoryOfEmployment; + + @Schema(description = "安全员证初领日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate securityDateOfIssue; + + @Schema(description = "安全员证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate securityExpiryDate; + + @Schema(description = "安全员证签发机关", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityLicenceIssuingAuthority; + + @Schema(description = "安全员证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String securityImageUrl; + + @Schema(description = "危化证经营方式", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String dangerBusinessPattern; + + @Schema(description = "危化证发证机关", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String dangerLicenceIssuingAuthority; + + @Schema(description = "危化证发证日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate dangerDateOfIssue; + + @Schema(description = "危化证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private LocalDate dangerExpiryDate; + + @Schema(description = "危化证图片", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelIgnore + private String dangerImageUrl; + } 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 index 9b87b78..6d655be 100644 --- 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 @@ -11,22 +11,10 @@ import javax.validation.constraints.*; @Data public class EnterpriseChangeSaveReqVO { - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30728") + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9") 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 = "张三") + @Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") @NotEmpty(message = "企业名称不能为空") private String name; @@ -34,8 +22,8 @@ public class EnterpriseChangeSaveReqVO { @NotEmpty(message = "企业法定代表人不能为空") private String legalPerson; - @Schema(description = "统一社会信用代码", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "统一社会信用代码不能为空") + @Schema(description = "统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "统一信用代码不能为空") private String unifiedCreditCode; @Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED) @@ -58,6 +46,10 @@ public class EnterpriseChangeSaveReqVO { @NotNull(message = "经营状态不能为空") private Integer operateState; + @Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否涉及危化证不能为空") + private Integer isSecure; + @Schema(description = "成立日期", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "成立日期不能为空") private LocalDate establishDate; @@ -82,8 +74,95 @@ public class EnterpriseChangeSaveReqVO { @NotEmpty(message = "经营许可范围不能为空") private String operatePermitRange; - @Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "是否涉及危化证不能为空") - private Integer isSecure; + @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}", requiredMode = Schema.RequiredMode.REQUIRED) + @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) + private String dangerBusinessPattern; + + @Schema(description = "危化证发证机关", requiredMode = Schema.RequiredMode.REQUIRED) + private String dangerLicenceIssuingAuthority; + + @Schema(description = "危化证发证日期", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDate dangerDateOfIssue; + + @Schema(description = "危化证到期日期", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDate dangerExpiryDate; + + @Schema(description = "危化证图片", requiredMode = Schema.RequiredMode.REQUIRED) + 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 index 8c98914..d2b5f97 100644 --- 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 @@ -36,7 +36,7 @@ public class EnterpriseChangeDO extends BaseDO { /** * 审批结果 * - * 枚举 {@link TODO bpm_process_instance_status 对应的类} + * 枚举 */ private Integer status; /** @@ -82,7 +82,7 @@ public class EnterpriseChangeDO extends BaseDO { /** * 经营状态 * - * 枚举 {@link TODO enterprise_operate_state 对应的类} + * 枚举 */ private Integer operateState; /** @@ -92,7 +92,7 @@ public class EnterpriseChangeDO extends BaseDO { /** * 企业类型 * - * 枚举 {@link TODO enterprise_type 对应的类} + * 枚举 */ private Integer enterpriseType; /** @@ -114,7 +114,7 @@ public class EnterpriseChangeDO extends BaseDO { /** * 是否涉及危化证 * - * 枚举 {@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/service/enterprisechange/EnterpriseChangeService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterprisechange/EnterpriseChangeService.java index 4d45bb8..65693ca 100644 --- 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 @@ -17,10 +17,11 @@ public interface EnterpriseChangeService { /** * 创建企业信息变更 * - * @param createReqVO 创建信息 + * @param createReqVO 变更后的企业信息 + * @param saveReqVO 变更前的企业信息 * @return 编号 */ - Long createEnterpriseChange(@Valid EnterpriseChangeSaveReqVO createReqVO); + Long createEnterpriseChange(@Valid EnterpriseChangeSaveReqVO createReqVO,@Valid EnterpriseChangeSaveReqVO saveReqVO); /** * 更新企业信息变更 @@ -52,4 +53,17 @@ public interface EnterpriseChangeService { */ PageResult getEnterpriseChangePage(EnterpriseChangePageReqVO pageReqVO); -} \ No newline at end of file + /** + * 查询该企业信息下的证书 + * @param respVO + * @return + */ + EnterpriseChangeRespVO selectCredentialManagement(EnterpriseChangeRespVO respVO); + + /** + * 企业变更流程审核通过 + * @param id + * @param status + */ + void updateEnterpriseChangeStatus(long id, Integer status); +} 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 index 80870e6..00cdbc6 100644 --- 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 @@ -1,5 +1,17 @@ package cn.iocoder.yudao.module.fta.service.enterprisechange; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; +import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.CredentialManagementMapper; +import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.EnterpriseInformationMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -15,6 +27,7 @@ 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.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; /** @@ -29,13 +42,104 @@ public class EnterpriseChangeServiceImpl implements EnterpriseChangeService { @Resource private EnterpriseChangeMapper enterpriseChangeMapper; + @Resource + private EnterpriseInformationMapper enterpriseInformationMapper; + + @Resource + private CredentialManagementMapper credentialManagementMapper; + + @Resource + private BpmProcessInstanceApi processInstanceApi; + + /** + * FTA 企业基础信息变更对应的流程定义 KEY + */ + public static final String PROCESS_KEY = "fta_enterprise_change"; + @Override - public Long createEnterpriseChange(EnterpriseChangeSaveReqVO createReqVO) { - // 插入 - EnterpriseChangeDO enterpriseChange = BeanUtils.toBean(createReqVO, EnterpriseChangeDO.class); - enterpriseChangeMapper.insert(enterpriseChange); + public Long createEnterpriseChange(EnterpriseChangeSaveReqVO createReqVO,EnterpriseChangeSaveReqVO saveReqVO) { + + // 将就得企业信息查询出来并做成一个json字符串 + String oldEnterprise = JSONUtil.toJsonStr(saveReqVO); + // 插入 企业变更基础信息填报 + EnterpriseChangeDO enterpriseChangeDO = BeanUtils.toBean(createReqVO, EnterpriseChangeDO.class) + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); + enterpriseChangeDO.setId(null); + enterpriseChangeDO.setOldEnterpriseJson(oldEnterprise); + enterpriseChangeDO.setOldEnterpriseName(saveReqVO.getName()); + enterpriseChangeDO.setOldLegalPerson(saveReqVO.getLegalPerson()); + enterpriseChangeMapper.insert(enterpriseChangeDO); + + // 插入 企业负责人证件 + CredentialManagementDO principal = new CredentialManagementDO(); + principal.setInformationId(enterpriseChangeDO.getId().toString() + "change"); + principal.setEnterpriseName(enterpriseChangeDO.getName()); + String principalStartDate = LocalDateTimeUtil.format(createReqVO.getPrincipalDateOfIssue(), DatePattern.CHINESE_DATE_PATTERN); + String principalEndDate = LocalDateTimeUtil.format(createReqVO.getPrincipalExpiryDate(), DatePattern.CHINESE_DATE_PATTERN); + principal.setUsefulLife(principalStartDate + "至" + principalEndDate); + principal.setExpiryDate(createReqVO.getPrincipalExpiryDate()); + principal.setLicenceIssuingAuthority(createReqVO.getPrincipalLicenceIssuingAuthority()); + principal.setDateOfIssue(createReqVO.getPrincipalDateOfIssue()); + principal.setIdType(1); + principal.setCertificateNumber(createReqVO.getPrincipalCertificateNumber()); + principal.setName(createReqVO.getPrincipalName()); + principal.setPersonnelType(createReqVO.getPrincipalPersonnelType()); + principal.setSex(createReqVO.getPrincipalSex()); + principal.setCategoryOfEmployment(createReqVO.getPrincipalCategoryOfEmployment()); + principal.setStatus("未通过审核"); + principal.setImageUrl(createReqVO.getPrincipalImageUrl()); + credentialManagementMapper.insert(principal); + + // 插入 企业安全员证件 + CredentialManagementDO security = new CredentialManagementDO(); + security.setInformationId(enterpriseChangeDO.getId().toString() + "change"); + security.setEnterpriseName(enterpriseChangeDO.getName()); + String securityStartDate = LocalDateTimeUtil.format(createReqVO.getSecurityDateOfIssue(), DatePattern.CHINESE_DATE_PATTERN); + String securityEndDate = LocalDateTimeUtil.format(createReqVO.getSecurityExpiryDate(), DatePattern.CHINESE_DATE_PATTERN); + security.setUsefulLife(securityStartDate + "至" + securityEndDate); + security.setExpiryDate(createReqVO.getSecurityExpiryDate()); + security.setLicenceIssuingAuthority(createReqVO.getSecurityLicenceIssuingAuthority()); + security.setDateOfIssue(createReqVO.getSecurityDateOfIssue()); + security.setIdType(0); + security.setCertificateNumber(createReqVO.getSecurityCertificateNumber()); + security.setName(createReqVO.getSecurityName()); + security.setPersonnelType(createReqVO.getSecurityPersonnelType()); + security.setSex(createReqVO.getSecuritySex()); + security.setCategoryOfEmployment(createReqVO.getSecurityCategoryOfEmployment()); + security.setStatus("未通过审核"); + security.setImageUrl(createReqVO.getSecurityImageUrl()); + credentialManagementMapper.insert(security); + + // 判断 如果涉及危化证则插入危化证信息 + if (createReqVO.getIsSecure() == 1) { + CredentialManagementDO danger = new CredentialManagementDO(); + danger.setInformationId(enterpriseChangeDO.getId().toString() + "change"); + danger.setEnterpriseName(enterpriseChangeDO.getName()); + String dangerStartDate = LocalDateTimeUtil.format(createReqVO.getDangerDateOfIssue(), DatePattern.CHINESE_DATE_PATTERN); + String dangerEndDate = LocalDateTimeUtil.format(createReqVO.getDangerExpiryDate(), DatePattern.CHINESE_DATE_PATTERN); + danger.setUsefulLife(dangerStartDate + "至" + dangerEndDate); + danger.setExpiryDate(createReqVO.getDangerExpiryDate()); + danger.setLicenceIssuingAuthority(createReqVO.getDangerLicenceIssuingAuthority()); + danger.setDateOfIssue(createReqVO.getDangerDateOfIssue()); + danger.setIdType(2); + danger.setStatus("未通过审核"); + danger.setImageUrl(createReqVO.getDangerImageUrl()); + danger.setBusinessPattern(createReqVO.getDangerBusinessPattern()); + credentialManagementMapper.insert(danger); + } + + // 发起 BPM 流程 + Map processInstanceVariables = new HashMap<>(); + String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(enterpriseChangeDO.getId())) + .setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees())); + + // 将工作流的编号,更新到企业基础信息填报 + enterpriseChangeMapper.updateById(new EnterpriseChangeDO().setId(enterpriseChangeDO.getId()).setProcessInstanceId(processInstanceId)); + // 返回 - return enterpriseChange.getId(); + return enterpriseChangeDO.getId(); } @Override @@ -71,4 +175,118 @@ public class EnterpriseChangeServiceImpl implements EnterpriseChangeService { return enterpriseChangeMapper.selectPage(pageReqVO); } -} \ No newline at end of file + @Override + public EnterpriseChangeRespVO selectCredentialManagement(EnterpriseChangeRespVO respVO) { + // 查询负责人证件信息 + LambdaQueryWrapper principalWrapper = new LambdaQueryWrapper<>(); + principalWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() + "change").eq(CredentialManagementDO::getIdType,1); + CredentialManagementDO principalCredentialManagementDO = credentialManagementMapper.selectOne(principalWrapper); + if (principalCredentialManagementDO != null) { + respVO.setPrincipalCertificateNumber(principalCredentialManagementDO.getCertificateNumber()); + respVO.setPrincipalName(principalCredentialManagementDO.getName()); + respVO.setPrincipalPersonnelType(principalCredentialManagementDO.getPersonnelType()); + respVO.setPrincipalSex(principalCredentialManagementDO.getSex()); + respVO.setPrincipalCategoryOfEmployment(principalCredentialManagementDO.getCategoryOfEmployment()); + respVO.setPrincipalDateOfIssue(principalCredentialManagementDO.getDateOfIssue()); + respVO.setPrincipalExpiryDate(principalCredentialManagementDO.getExpiryDate()); + respVO.setPrincipalLicenceIssuingAuthority(principalCredentialManagementDO.getLicenceIssuingAuthority()); + respVO.setPrincipalImageUrl(principalCredentialManagementDO.getImageUrl()); + } + + // 查询安全证件信息 + LambdaQueryWrapper securityWrapper = new LambdaQueryWrapper<>(); + securityWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() + "change").eq(CredentialManagementDO::getIdType,0); + CredentialManagementDO securityCredentialManagementDO = credentialManagementMapper.selectOne(securityWrapper); + if (securityCredentialManagementDO != null) { + respVO.setSecurityCertificateNumber(securityCredentialManagementDO.getCertificateNumber()); + respVO.setSecurityName(securityCredentialManagementDO.getName()); + respVO.setSecurityPersonnelType(securityCredentialManagementDO.getPersonnelType()); + respVO.setSecuritySex(securityCredentialManagementDO.getSex()); + respVO.setSecurityCategoryOfEmployment(securityCredentialManagementDO.getCategoryOfEmployment()); + respVO.setSecurityDateOfIssue(securityCredentialManagementDO.getDateOfIssue()); + respVO.setSecurityExpiryDate(securityCredentialManagementDO.getExpiryDate()); + respVO.setSecurityLicenceIssuingAuthority(securityCredentialManagementDO.getLicenceIssuingAuthority()); + respVO.setSecurityImageUrl(securityCredentialManagementDO.getImageUrl()); + } + + // 查询危化证信息 + if (respVO.getIsSecure() == 1){ + LambdaQueryWrapper dangerWrapper = new LambdaQueryWrapper<>(); + dangerWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() + "change").eq(CredentialManagementDO::getIdType,2); + CredentialManagementDO dangerCredentialManagementDO = credentialManagementMapper.selectOne(dangerWrapper); + if (dangerCredentialManagementDO != null) { + respVO.setDangerBusinessPattern(dangerCredentialManagementDO.getBusinessPattern()); + respVO.setDangerLicenceIssuingAuthority(dangerCredentialManagementDO.getLicenceIssuingAuthority()); + respVO.setDangerDateOfIssue(dangerCredentialManagementDO.getDateOfIssue()); + respVO.setDangerExpiryDate(dangerCredentialManagementDO.getExpiryDate()); + respVO.setDangerImageUrl(dangerCredentialManagementDO.getImageUrl()); + } + } + + return respVO; + } + + @Override + public void updateEnterpriseChangeStatus(long id, Integer status) { + validateEnterpriseChangeExists(id); + enterpriseChangeMapper.updateById(new EnterpriseChangeDO().setId(id).setStatus(status)); + + // 需要将旧的企业信息进行覆盖 + EnterpriseChangeDO enterpriseChangeDO = enterpriseChangeMapper.selectById(id); + String oldEnterpriseJson = enterpriseChangeDO.getOldEnterpriseJson(); + EnterpriseChangeRespVO enterpriseChangeRespVO = JSONUtil.toBean(oldEnterpriseJson, EnterpriseChangeRespVO.class); + EnterpriseInformationDO enterpriseInformationDO = enterpriseInformationMapper.selectById(enterpriseChangeRespVO.getId()); + EnterpriseInformationDO informationDO = BeanUtils.toBean(enterpriseChangeDO, EnterpriseInformationDO.class); + informationDO.setId(enterpriseInformationDO.getId()); + informationDO.setProcessInstanceId(enterpriseInformationDO.getProcessInstanceId()); + informationDO.setStatus(enterpriseInformationDO.getStatus()); + enterpriseInformationMapper.updateById(informationDO); + + // 需要将旧的证书信息进行覆盖 + // 覆盖负责人证件信息 + LambdaQueryWrapper principalWrapper = new LambdaQueryWrapper<>(); + principalWrapper.eq(CredentialManagementDO::getInformationId,id + "change").eq(CredentialManagementDO::getIdType,1); + CredentialManagementDO newPrincipalCredentialManagementDO = credentialManagementMapper.selectOne(principalWrapper); + newPrincipalCredentialManagementDO.setId(null); + newPrincipalCredentialManagementDO.setInformationId(enterpriseChangeRespVO.getId().toString()); + newPrincipalCredentialManagementDO.setStatus("已通过审核"); + LambdaUpdateWrapper principalUpdateWrapper = new LambdaUpdateWrapper<>(); + principalUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,1); + credentialManagementMapper.update(newPrincipalCredentialManagementDO,principalUpdateWrapper); + + + + // 覆盖安全证件信息 + LambdaQueryWrapper securityWrapper = new LambdaQueryWrapper<>(); + securityWrapper.eq(CredentialManagementDO::getInformationId,id + "change").eq(CredentialManagementDO::getIdType,0); + CredentialManagementDO newSecurityCredentialManagementDO = credentialManagementMapper.selectOne(securityWrapper); + newSecurityCredentialManagementDO.setId(null); + newSecurityCredentialManagementDO.setInformationId(enterpriseChangeRespVO.getId().toString()); + newSecurityCredentialManagementDO.setStatus("已通过审核"); + LambdaUpdateWrapper securityUpdateWrapper = new LambdaUpdateWrapper<>(); + securityUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,0); + credentialManagementMapper.update(newSecurityCredentialManagementDO,securityUpdateWrapper); + + // 覆盖危化证信息 + if (enterpriseChangeDO.getIsSecure() == 1){ + LambdaQueryWrapper dangerWrapper = new LambdaQueryWrapper<>(); + dangerWrapper.eq(CredentialManagementDO::getInformationId,id + "change").eq(CredentialManagementDO::getIdType,2); + CredentialManagementDO newDangerCredentialManagementDO = credentialManagementMapper.selectOne(dangerWrapper); + newDangerCredentialManagementDO.setId(null); + newDangerCredentialManagementDO.setInformationId(enterpriseChangeRespVO.getId().toString()); + newDangerCredentialManagementDO.setStatus("已通过审核"); + if (enterpriseInformationDO.getIsSecure() == 1){ + LambdaUpdateWrapper dangerUpdateWrapper = new LambdaUpdateWrapper<>(); + dangerUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,2); + credentialManagementMapper.update(newDangerCredentialManagementDO,dangerUpdateWrapper); + }else { + credentialManagementMapper.insert(newDangerCredentialManagementDO); + } + } else { + LambdaQueryWrapper removeDangerWrapper = new LambdaQueryWrapper<>(); + removeDangerWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,2); + credentialManagementMapper.delete(removeDangerWrapper); + } + } + +} 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 8483982..58d229d 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 @@ -174,7 +174,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe validateLeaveExists(id); enterpriseInformationMapper.updateById(new EnterpriseInformationDO().setId(id).setStatus(status)); LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(CredentialManagementDO::getInformationId,id).set(CredentialManagementDO::getStatus,"已通过审核"); + updateWrapper.eq(CredentialManagementDO::getInformationId,id+"").set(CredentialManagementDO::getStatus,"已通过审核"); credentialManagementMapper.update(updateWrapper); } @@ -182,7 +182,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe public EnterpriseInformationRespVO selectCredentialManagement(EnterpriseInformationRespVO respVO) { // 查询负责人证件信息 LambdaQueryWrapper principalWrapper = new LambdaQueryWrapper<>(); - principalWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId()).eq(CredentialManagementDO::getIdType,1); + principalWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() +"").eq(CredentialManagementDO::getIdType,1); CredentialManagementDO principalCredentialManagementDO = credentialManagementMapper.selectOne(principalWrapper); if (principalCredentialManagementDO != null) { respVO.setPrincipalCertificateNumber(principalCredentialManagementDO.getCertificateNumber()); @@ -198,7 +198,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe // 查询安全证件信息 LambdaQueryWrapper securityWrapper = new LambdaQueryWrapper<>(); - securityWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId()).eq(CredentialManagementDO::getIdType,0); + securityWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() +"").eq(CredentialManagementDO::getIdType,0); CredentialManagementDO securityCredentialManagementDO = credentialManagementMapper.selectOne(securityWrapper); if (securityCredentialManagementDO != null) { respVO.setSecurityCertificateNumber(securityCredentialManagementDO.getCertificateNumber()); @@ -215,7 +215,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe // 查询危化证信息 if (respVO.getIsSecure() == 1){ LambdaQueryWrapper dangerWrapper = new LambdaQueryWrapper<>(); - dangerWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId()).eq(CredentialManagementDO::getIdType,2); + dangerWrapper.eq(CredentialManagementDO::getInformationId,respVO.getId() +"").eq(CredentialManagementDO::getIdType,2); CredentialManagementDO dangerCredentialManagementDO = credentialManagementMapper.selectOne(dangerWrapper); if (dangerCredentialManagementDO != null) { respVO.setDangerBusinessPattern(dangerCredentialManagementDO.getBusinessPattern()); diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/oa/listener/FtaEnterpriseInformationChangeStatusListener.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/oa/listener/FtaEnterpriseInformationChangeStatusListener.java new file mode 100644 index 0000000..df0963c --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/oa/listener/FtaEnterpriseInformationChangeStatusListener.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.fta.service.oa.listener; + +import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent; +import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener; +import cn.iocoder.yudao.module.fta.service.enterprisechange.EnterpriseChangeService; +import cn.iocoder.yudao.module.fta.service.enterprisechange.EnterpriseChangeServiceImpl; +import cn.iocoder.yudao.module.fta.service.enterpriseinformation.EnterpriseInformationService; +import cn.iocoder.yudao.module.fta.service.enterpriseinformation.EnterpriseInformationServiceImpl; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * FTA 企业基本信息变更流程的结果的监听器实现类 + * + * @author 王长久 + */ +@Component +public class FtaEnterpriseInformationChangeStatusListener extends BpmProcessInstanceStatusEventListener { + + @Resource + private EnterpriseChangeService enterpriseChangeService; + + + @Override + protected String getProcessDefinitionKey() { + return EnterpriseChangeServiceImpl.PROCESS_KEY; + } + + @Override + protected void onEvent(BpmProcessInstanceStatusEvent event) { + enterpriseChangeService.updateEnterpriseChangeStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); + } +} 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 index 454b688..ce3767c 100644 --- 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 @@ -48,7 +48,7 @@ public class EnterpriseChangeServiceImplTest extends BaseDbUnitTest { EnterpriseChangeSaveReqVO createReqVO = randomPojo(EnterpriseChangeSaveReqVO.class).setId(null); // 调用 - Long enterpriseChangeId = enterpriseChangeService.createEnterpriseChange(createReqVO); + Long enterpriseChangeId = enterpriseChangeService.createEnterpriseChange(createReqVO,createReqVO); // 断言 assertNotNull(enterpriseChangeId); // 校验记录的属性是否正确 @@ -167,4 +167,4 @@ public class EnterpriseChangeServiceImplTest extends BaseDbUnitTest { assertPojoEquals(dbEnterpriseChange, pageResult.getList().get(0)); } -} \ No newline at end of file +}