fix
This commit is contained in:
@@ -93,21 +93,6 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
s.logger.Info("开始提交企业信息",
|
||||
zap.String("user_id", cmd.UserID))
|
||||
|
||||
// 验证验证码
|
||||
if err := s.smsCodeService.VerifyCode(ctx, cmd.LegalPersonPhone, cmd.VerificationCode, user_entities.SMSSceneCertification); err != nil {
|
||||
return nil, fmt.Errorf("验证码错误或已过期")
|
||||
}
|
||||
s.logger.Info("开始处理企业信息提交",
|
||||
zap.String("user_id", cmd.UserID))
|
||||
// 1. 检查企业信息是否重复(统一社会信用代码,已经认证了的,不能重复提交)
|
||||
exists, err := s.userAggregateService.CheckUnifiedSocialCodeExists(ctx, cmd.UnifiedSocialCode, cmd.UserID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("检查企业信息失败: %s", err.Error())
|
||||
}
|
||||
if exists {
|
||||
return nil, fmt.Errorf("该企业信息已被其他用户使用,请确认企业信息是否正确")
|
||||
}
|
||||
|
||||
// 1.5 插入企业信息提交记录
|
||||
record := entities.NewEnterpriseInfoSubmitRecord(
|
||||
cmd.UserID,
|
||||
@@ -118,6 +103,37 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
cmd.LegalPersonPhone,
|
||||
cmd.EnterpriseAddress,
|
||||
)
|
||||
|
||||
// 验证验证码
|
||||
if err := s.smsCodeService.VerifyCode(ctx, cmd.LegalPersonPhone, cmd.VerificationCode, user_entities.SMSSceneCertification); err != nil {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("验证码错误或已过期")
|
||||
}
|
||||
s.logger.Info("开始处理企业信息提交",
|
||||
zap.String("user_id", cmd.UserID))
|
||||
// 1. 检查企业信息是否重复(统一社会信用代码,已经认证了的,不能重复提交)
|
||||
exists, err := s.userAggregateService.CheckUnifiedSocialCodeExists(ctx, cmd.UnifiedSocialCode, cmd.UserID)
|
||||
if err != nil {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("检查企业信息失败: %s", err.Error())
|
||||
}
|
||||
if exists {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("该企业信息已被其他用户使用,请确认企业信息是否正确")
|
||||
}
|
||||
|
||||
enterpriseInfo := &certification_value_objects.EnterpriseInfo{
|
||||
CompanyName: cmd.CompanyName,
|
||||
UnifiedSocialCode: cmd.UnifiedSocialCode,
|
||||
@@ -130,15 +146,19 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
if err != nil {
|
||||
s.logger.Error("企业信息验证失败", zap.Error(err))
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("企业信息验证失败: %s", err.Error())
|
||||
}
|
||||
err = s.enterpriseInfoSubmitRecordService.ValidateWithWestdex(ctx, enterpriseInfo)
|
||||
if err != nil {
|
||||
s.logger.Error("企业信息验证失败", zap.Error(err))
|
||||
record.MarkAsFailed(err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
s.logger.Error("保存企业信息提交记录失败", zap.Error(saveErr))
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("企业信息验证失败, %s", err.Error())
|
||||
}
|
||||
@@ -956,7 +976,6 @@ func (s *CertificationApplicationServiceImpl) AddStatusMetadata(ctx context.Cont
|
||||
"legal_person_id": record.LegalPersonID,
|
||||
}
|
||||
metadata["enterprise_info"] = enterpriseInfo
|
||||
|
||||
}
|
||||
case enums.StatusCompleted:
|
||||
// 获取最终合同信息
|
||||
|
||||
Reference in New Issue
Block a user