1、新增企业信息时插入证书信息

This commit is contained in:
Wayne 2024-05-14 10:57:30 +08:00
parent 4223630e1d
commit a3d175b678
3 changed files with 71 additions and 12 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<String, Object> processInstanceVariables = new HashMap<>();