1、企业变更成功通过后改变企业基础信息及证件信息

This commit is contained in:
Wayne 2024-05-16 10:49:55 +08:00
parent 57cfd04fe8
commit a5b541038e
9 changed files with 503 additions and 41 deletions

View File

@ -1,5 +1,9 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterprisechange; 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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -38,11 +42,19 @@ public class EnterpriseChangeController {
@Resource @Resource
private EnterpriseChangeService enterpriseChangeService; private EnterpriseChangeService enterpriseChangeService;
@Resource
private EnterpriseInformationService enterpriseInformationService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建企业信息变更") @Operation(summary = "创建企业信息变更")
@PreAuthorize("@ss.hasPermission('fta:enterprise-change:create')") @PreAuthorize("@ss.hasPermission('fta:enterprise-change:create')")
public CommonResult<Long> createEnterpriseChange(@Valid @RequestBody EnterpriseChangeSaveReqVO createReqVO) { public CommonResult<Long> 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") @PutMapping("/update")
@ -68,7 +80,20 @@ public class EnterpriseChangeController {
@PreAuthorize("@ss.hasPermission('fta:enterprise-change:query')") @PreAuthorize("@ss.hasPermission('fta:enterprise-change:query')")
public CommonResult<EnterpriseChangeRespVO> getEnterpriseChange(@RequestParam("id") Long id) { public CommonResult<EnterpriseChangeRespVO> getEnterpriseChange(@RequestParam("id") Long id) {
EnterpriseChangeDO enterpriseChange = enterpriseChangeService.getEnterpriseChange(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<EnterpriseChangeRespVO> 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") @GetMapping("/page")

View File

@ -105,4 +105,96 @@ public class EnterpriseChangeRespVO {
@DictFormat("enterprise_is_secure") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中 @DictFormat("enterprise_is_secure") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer isSecure; 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;
} }

View File

@ -11,22 +11,10 @@ import javax.validation.constraints.*;
@Data @Data
public class EnterpriseChangeSaveReqVO { public class EnterpriseChangeSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30728") @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9")
private Long id; private Long id;
@Schema(description = "变更前企业信息Json字符串", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@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 = "企业名称不能为空") @NotEmpty(message = "企业名称不能为空")
private String name; private String name;
@ -34,8 +22,8 @@ public class EnterpriseChangeSaveReqVO {
@NotEmpty(message = "企业法定代表人不能为空") @NotEmpty(message = "企业法定代表人不能为空")
private String legalPerson; private String legalPerson;
@Schema(description = "统一社会信用代码", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "统一社会信用代码不能为空") @NotEmpty(message = "统一信用代码不能为空")
private String unifiedCreditCode; private String unifiedCreditCode;
@Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED)
@ -58,6 +46,10 @@ public class EnterpriseChangeSaveReqVO {
@NotNull(message = "经营状态不能为空") @NotNull(message = "经营状态不能为空")
private Integer operateState; private Integer operateState;
@Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否涉及危化证不能为空")
private Integer isSecure;
@Schema(description = "成立日期", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "成立日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "成立日期不能为空") @NotNull(message = "成立日期不能为空")
private LocalDate establishDate; private LocalDate establishDate;
@ -82,8 +74,95 @@ public class EnterpriseChangeSaveReqVO {
@NotEmpty(message = "经营许可范围不能为空") @NotEmpty(message = "经营许可范围不能为空")
private String operatePermitRange; private String operatePermitRange;
@Schema(description = "是否涉及危化证", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否涉及危化证不能为空") @NotEmpty(message = "审批人不能为空")
private Integer isSecure; private Map<String, List<Long>> 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;
} }

View File

@ -36,7 +36,7 @@ public class EnterpriseChangeDO extends BaseDO {
/** /**
* 审批结果 * 审批结果
* *
* 枚举 {@link TODO bpm_process_instance_status 对应的类} * 枚举
*/ */
private Integer status; private Integer status;
/** /**
@ -82,7 +82,7 @@ public class EnterpriseChangeDO extends BaseDO {
/** /**
* 经营状态 * 经营状态
* *
* 枚举 {@link TODO enterprise_operate_state 对应的类} * 枚举
*/ */
private Integer operateState; private Integer operateState;
/** /**
@ -92,7 +92,7 @@ public class EnterpriseChangeDO extends BaseDO {
/** /**
* 企业类型 * 企业类型
* *
* 枚举 {@link TODO enterprise_type 对应的类} * 枚举
*/ */
private Integer enterpriseType; private Integer enterpriseType;
/** /**
@ -114,7 +114,7 @@ public class EnterpriseChangeDO extends BaseDO {
/** /**
* 是否涉及危化证 * 是否涉及危化证
* *
* 枚举 {@link TODO enterprise_is_secure 对应的类} * 枚举
*/ */
private Integer isSecure; private Integer isSecure;

View File

@ -17,10 +17,11 @@ public interface EnterpriseChangeService {
/** /**
* 创建企业信息变更 * 创建企业信息变更
* *
* @param createReqVO 创建信息 * @param createReqVO 变更后的企业信息
* @param saveReqVO 变更前的企业信息
* @return 编号 * @return 编号
*/ */
Long createEnterpriseChange(@Valid EnterpriseChangeSaveReqVO createReqVO); Long createEnterpriseChange(@Valid EnterpriseChangeSaveReqVO createReqVO,@Valid EnterpriseChangeSaveReqVO saveReqVO);
/** /**
* 更新企业信息变更 * 更新企业信息变更
@ -52,4 +53,17 @@ public interface EnterpriseChangeService {
*/ */
PageResult<EnterpriseChangeDO> getEnterpriseChangePage(EnterpriseChangePageReqVO pageReqVO); PageResult<EnterpriseChangeDO> getEnterpriseChangePage(EnterpriseChangePageReqVO pageReqVO);
/**
* 查询该企业信息下的证书
* @param respVO
* @return
*/
EnterpriseChangeRespVO selectCredentialManagement(EnterpriseChangeRespVO respVO);
/**
* 企业变更流程审核通过
* @param id
* @param status
*/
void updateEnterpriseChangeStatus(long id, Integer status);
} }

View File

@ -1,5 +1,17 @@
package cn.iocoder.yudao.module.fta.service.enterprisechange; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; 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 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.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.*; import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
/** /**
@ -29,13 +42,104 @@ public class EnterpriseChangeServiceImpl implements EnterpriseChangeService {
@Resource @Resource
private EnterpriseChangeMapper enterpriseChangeMapper; 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 @Override
public Long createEnterpriseChange(EnterpriseChangeSaveReqVO createReqVO) { public Long createEnterpriseChange(EnterpriseChangeSaveReqVO createReqVO,EnterpriseChangeSaveReqVO saveReqVO) {
// 插入
EnterpriseChangeDO enterpriseChange = BeanUtils.toBean(createReqVO, EnterpriseChangeDO.class); // 将就得企业信息查询出来并做成一个json字符串
enterpriseChangeMapper.insert(enterpriseChange); 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<String, Object> 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 @Override
@ -71,4 +175,118 @@ public class EnterpriseChangeServiceImpl implements EnterpriseChangeService {
return enterpriseChangeMapper.selectPage(pageReqVO); return enterpriseChangeMapper.selectPage(pageReqVO);
} }
@Override
public EnterpriseChangeRespVO selectCredentialManagement(EnterpriseChangeRespVO respVO) {
// 查询负责人证件信息
LambdaQueryWrapper<CredentialManagementDO> 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<CredentialManagementDO> 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<CredentialManagementDO> 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<CredentialManagementDO> 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<CredentialManagementDO> principalUpdateWrapper = new LambdaUpdateWrapper<>();
principalUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,1);
credentialManagementMapper.update(newPrincipalCredentialManagementDO,principalUpdateWrapper);
// 覆盖安全证件信息
LambdaQueryWrapper<CredentialManagementDO> 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<CredentialManagementDO> securityUpdateWrapper = new LambdaUpdateWrapper<>();
securityUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,0);
credentialManagementMapper.update(newSecurityCredentialManagementDO,securityUpdateWrapper);
// 覆盖危化证信息
if (enterpriseChangeDO.getIsSecure() == 1){
LambdaQueryWrapper<CredentialManagementDO> 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<CredentialManagementDO> dangerUpdateWrapper = new LambdaUpdateWrapper<>();
dangerUpdateWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,2);
credentialManagementMapper.update(newDangerCredentialManagementDO,dangerUpdateWrapper);
}else {
credentialManagementMapper.insert(newDangerCredentialManagementDO);
}
} else {
LambdaQueryWrapper<CredentialManagementDO> removeDangerWrapper = new LambdaQueryWrapper<>();
removeDangerWrapper.eq(CredentialManagementDO::getInformationId,enterpriseChangeRespVO.getId()+"").eq(CredentialManagementDO::getIdType,2);
credentialManagementMapper.delete(removeDangerWrapper);
}
}
} }

View File

@ -174,7 +174,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
validateLeaveExists(id); validateLeaveExists(id);
enterpriseInformationMapper.updateById(new EnterpriseInformationDO().setId(id).setStatus(status)); enterpriseInformationMapper.updateById(new EnterpriseInformationDO().setId(id).setStatus(status));
LambdaUpdateWrapper<CredentialManagementDO> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CredentialManagementDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(CredentialManagementDO::getInformationId,id).set(CredentialManagementDO::getStatus,"已通过审核"); updateWrapper.eq(CredentialManagementDO::getInformationId,id+"").set(CredentialManagementDO::getStatus,"已通过审核");
credentialManagementMapper.update(updateWrapper); credentialManagementMapper.update(updateWrapper);
} }
@ -182,7 +182,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
public EnterpriseInformationRespVO selectCredentialManagement(EnterpriseInformationRespVO respVO) { public EnterpriseInformationRespVO selectCredentialManagement(EnterpriseInformationRespVO respVO) {
// 查询负责人证件信息 // 查询负责人证件信息
LambdaQueryWrapper<CredentialManagementDO> principalWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CredentialManagementDO> 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); CredentialManagementDO principalCredentialManagementDO = credentialManagementMapper.selectOne(principalWrapper);
if (principalCredentialManagementDO != null) { if (principalCredentialManagementDO != null) {
respVO.setPrincipalCertificateNumber(principalCredentialManagementDO.getCertificateNumber()); respVO.setPrincipalCertificateNumber(principalCredentialManagementDO.getCertificateNumber());
@ -198,7 +198,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
// 查询安全证件信息 // 查询安全证件信息
LambdaQueryWrapper<CredentialManagementDO> securityWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CredentialManagementDO> 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); CredentialManagementDO securityCredentialManagementDO = credentialManagementMapper.selectOne(securityWrapper);
if (securityCredentialManagementDO != null) { if (securityCredentialManagementDO != null) {
respVO.setSecurityCertificateNumber(securityCredentialManagementDO.getCertificateNumber()); respVO.setSecurityCertificateNumber(securityCredentialManagementDO.getCertificateNumber());
@ -215,7 +215,7 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
// 查询危化证信息 // 查询危化证信息
if (respVO.getIsSecure() == 1){ if (respVO.getIsSecure() == 1){
LambdaQueryWrapper<CredentialManagementDO> dangerWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CredentialManagementDO> 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); CredentialManagementDO dangerCredentialManagementDO = credentialManagementMapper.selectOne(dangerWrapper);
if (dangerCredentialManagementDO != null) { if (dangerCredentialManagementDO != null) {
respVO.setDangerBusinessPattern(dangerCredentialManagementDO.getBusinessPattern()); respVO.setDangerBusinessPattern(dangerCredentialManagementDO.getBusinessPattern());

View File

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

View File

@ -48,7 +48,7 @@ public class EnterpriseChangeServiceImplTest extends BaseDbUnitTest {
EnterpriseChangeSaveReqVO createReqVO = randomPojo(EnterpriseChangeSaveReqVO.class).setId(null); EnterpriseChangeSaveReqVO createReqVO = randomPojo(EnterpriseChangeSaveReqVO.class).setId(null);
// 调用 // 调用
Long enterpriseChangeId = enterpriseChangeService.createEnterpriseChange(createReqVO); Long enterpriseChangeId = enterpriseChangeService.createEnterpriseChange(createReqVO,createReqVO);
// 断言 // 断言
assertNotNull(enterpriseChangeId); assertNotNull(enterpriseChangeId);
// 校验记录的属性是否正确 // 校验记录的属性是否正确