f
This commit is contained in:
@@ -716,7 +716,7 @@ func (s *CertificationApplicationServiceImpl) HandleEsignCallback(
|
||||
}
|
||||
|
||||
// 生成合同
|
||||
err = s.generateAndAddContractFile(txCtx, cert, record.CompanyName, record.LegalPersonName, record.UnifiedSocialCode, record.EnterpriseAddress, record.LegalPersonPhone, record.LegalPersonID)
|
||||
err = s.generateAndAddContractFile(txCtx, cert, record.CompanyName, record.UnifiedSocialCode, record.EnterpriseAddress, pickAuthorizedRepName(record, record.LegalPersonName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ func (s *CertificationApplicationServiceImpl) completeEnterpriseVerification(
|
||||
}
|
||||
|
||||
// 生成合同
|
||||
err = s.generateAndAddContractFile(ctx, cert, record.CompanyName, record.LegalPersonName, record.UnifiedSocialCode, record.EnterpriseAddress, record.LegalPersonPhone, record.LegalPersonID)
|
||||
err = s.generateAndAddContractFile(ctx, cert, record.CompanyName, record.UnifiedSocialCode, record.EnterpriseAddress, pickAuthorizedRepName(record, record.LegalPersonName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1368,32 +1368,33 @@ func (s *CertificationApplicationServiceImpl) completeEnterpriseVerification(
|
||||
return nil
|
||||
}
|
||||
|
||||
// pickAuthorizedRepName 合同模板「客户授权代表」: 优先企业提交记录中的授权代表, 否则为法定代表人
|
||||
func pickAuthorizedRepName(record *entities.EnterpriseInfoSubmitRecord, legalPersonName string) string {
|
||||
if record != nil && strings.TrimSpace(record.AuthorizedRepName) != "" {
|
||||
return strings.TrimSpace(record.AuthorizedRepName)
|
||||
}
|
||||
return legalPersonName
|
||||
}
|
||||
|
||||
// generateAndAddContractFile 生成并添加合同文件的公共方法
|
||||
func (s *CertificationApplicationServiceImpl) generateAndAddContractFile(
|
||||
ctx context.Context,
|
||||
cert *entities.Certification,
|
||||
companyName string,
|
||||
legalPersonName string,
|
||||
unifiedSocialCode string,
|
||||
enterpriseAddress string,
|
||||
legalPersonPhone string,
|
||||
legalPersonID string,
|
||||
authorizedRepName string,
|
||||
) error {
|
||||
s.logger.Info("合同生成-步骤1-开始填充合同模板",
|
||||
zap.String("user_id", cert.UserID),
|
||||
zap.String("company_name", companyName))
|
||||
// 控件 key 与 e 签宝合同模板中控件名一致(新合同)
|
||||
fileComponent := map[string]string{
|
||||
"YFCompanyName": companyName,
|
||||
"YFCompanyName2": companyName,
|
||||
"YFLegalPersonName": legalPersonName,
|
||||
"YFLegalPersonName2": legalPersonName,
|
||||
"YFUnifiedSocialCode": unifiedSocialCode,
|
||||
"YFEnterpriseAddress": enterpriseAddress,
|
||||
"YFContactPerson": legalPersonName,
|
||||
"YFMobile": legalPersonPhone,
|
||||
"SignDate": time.Now().Format("2006年01月02日"),
|
||||
"SignDate2": time.Now().Format("2006年01月02日"),
|
||||
"SignDate3": time.Now().Format("2006年01月02日"),
|
||||
"jfqym": companyName,
|
||||
"jfqym2": companyName,
|
||||
"jfsqdb": authorizedRepName,
|
||||
"jftyshxydm": unifiedSocialCode,
|
||||
"jflxdz": enterpriseAddress,
|
||||
}
|
||||
fillTemplateResp, err := s.esignClient.FillTemplate(fileComponent)
|
||||
if err != nil {
|
||||
@@ -1423,8 +1424,12 @@ func (s *CertificationApplicationServiceImpl) updateContractFile(ctx context.Con
|
||||
return fmt.Errorf("获取企业信息失败: %w", err)
|
||||
}
|
||||
|
||||
ei := enterpriseInfo.EnterpriseInfo
|
||||
submitRec, _ := s.enterpriseInfoSubmitRecordRepo.FindLatestByUserID(ctx, cert.UserID)
|
||||
authRep := pickAuthorizedRepName(submitRec, ei.LegalPersonName)
|
||||
|
||||
// 生成合同
|
||||
err = s.generateAndAddContractFile(ctx, cert, enterpriseInfo.EnterpriseInfo.CompanyName, enterpriseInfo.EnterpriseInfo.LegalPersonName, enterpriseInfo.EnterpriseInfo.UnifiedSocialCode, enterpriseInfo.EnterpriseInfo.EnterpriseAddress, enterpriseInfo.EnterpriseInfo.LegalPersonPhone, enterpriseInfo.EnterpriseInfo.LegalPersonID)
|
||||
err = s.generateAndAddContractFile(ctx, cert, ei.CompanyName, ei.UnifiedSocialCode, ei.EnterpriseAddress, authRep)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user