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 6e32982..27fee91 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 @@ -151,23 +151,18 @@ public class EnterpriseInformationSaveReqVO { 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/enterpriseinformation/CredentialManagementDO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java index 3d60386..7f5ff42 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java @@ -1,11 +1,12 @@ package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation; import lombok.*; + +import java.time.*; import java.util.*; import java.time.LocalDateTime; import java.time.LocalDateTime; import java.time.LocalDateTime; -import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @@ -43,7 +44,7 @@ public class CredentialManagementDO extends BaseDO { /** * 发证日期 */ - private LocalDateTime dateOfIssue; + private LocalDate dateOfIssue; /** * 流程状态 */ @@ -56,11 +57,11 @@ public class CredentialManagementDO extends BaseDO { /** * 到期时间 */ - private Date expiryDate; + private LocalDate expiryDate; /** * 证件类型(0安全员证,1安全负责人证,2危险品证) */ - private Boolean idType; + private Integer idType; /** * 证书编号 */ @@ -76,7 +77,7 @@ public class CredentialManagementDO extends BaseDO { /** * 性别(0男,1女) */ - private Boolean sex; + private Integer sex; /** * 行业类别 */ @@ -85,5 +86,9 @@ public class CredentialManagementDO extends BaseDO { * 企业名称 */ private String enterpriseName; + /** + * 证书图片地址 + */ + private String imageUrl; -} \ 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/EnterpriseInformationServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationServiceImpl.java index a5ec75a..d5a2fb0 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 @@ -1,13 +1,18 @@ package cn.iocoder.yudao.module.fta.service.enterpriseinformation; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; 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.mysql.enterpriseinformation.CredentialManagementMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; +import java.time.ZoneId; import java.util.*; import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; @@ -39,6 +44,9 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe @Resource private EnterpriseInformationMapper enterpriseInformationMapper; + @Resource + private CredentialManagementMapper credentialManagementMapper; + @Resource private BpmProcessInstanceApi processInstanceApi; @@ -50,11 +58,62 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe enterpriseInformationMapper.insert(enterpriseInformation); // 插入 企业负责人证件 - + CredentialManagementDO principal = new CredentialManagementDO(); + principal.setInformationId(enterpriseInformation.getId().toString()); + principal.setEnterpriseName(enterpriseInformation.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.getDangerImageUrl()); + credentialManagementMapper.insert(principal); // 插入 企业安全员证件 + CredentialManagementDO security = new CredentialManagementDO(); + security.setInformationId(enterpriseInformation.getId().toString()); + security.setEnterpriseName(enterpriseInformation.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(enterpriseInformation.getId().toString()); + danger.setEnterpriseName(enterpriseInformation.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<>();