f
This commit is contained in:
@@ -28,13 +28,13 @@ func (s *SignFlowService) UpdateConfig(config *Config) {
|
||||
// 创建包含多个签署人的签署流程,支持自动盖章和手动签署
|
||||
func (s *SignFlowService) Create(req *CreateSignFlowRequest) (string, error) {
|
||||
fmt.Println("开始创建签署流程...")
|
||||
fmt.Println("(将创建包含甲方自动盖章和乙方手动签署的流程)")
|
||||
fmt.Println("(将创建包含甲方手动签署和乙方自动盖章的流程)")
|
||||
|
||||
// 构建甲方签署人信息(自动盖章)
|
||||
partyASigner := s.buildPartyASigner(req.FileID)
|
||||
// 构建甲方签署人信息(手动签署)
|
||||
partyASigner := s.buildPartyASigner(req.FileID, req.SignerAccount, req.SignerName, req.TransactorPhone, req.TransactorName, req.TransactorIDCardNum)
|
||||
|
||||
// 构建乙方签署人信息(手动签署)
|
||||
partyBSigner := s.buildPartyBSigner(req.FileID, req.SignerAccount, req.SignerName, req.TransactorPhone, req.TransactorName, req.TransactorIDCardNum)
|
||||
// 构建乙方签署人信息(自动盖章)
|
||||
partyBSigner := s.buildPartyBSigner(req.FileID)
|
||||
|
||||
signers := []SignerInfo{partyASigner, partyBSigner}
|
||||
|
||||
@@ -128,34 +128,11 @@ func (s *SignFlowService) GetSignURL(signFlowID, psnAccount, orgName string) (st
|
||||
return response.Data.Url, response.Data.ShortUrl, nil
|
||||
}
|
||||
|
||||
// buildPartyASigner 构建甲方签署人信息(自动盖章)
|
||||
func (s *SignFlowService) buildPartyASigner(fileID string) SignerInfo {
|
||||
return SignerInfo{
|
||||
SignConfig: &SignConfig{SignOrder: 1},
|
||||
SignerType: SignerTypeOrg,
|
||||
SignFields: []SignField{
|
||||
{
|
||||
CustomBizNum: "甲方签章",
|
||||
FileId: fileID,
|
||||
NormalSignFieldConfig: &NormalSignFieldConfig{
|
||||
AutoSign: true,
|
||||
SignFieldStyle: SignFieldStyleNormal,
|
||||
SignFieldPosition: &SignFieldPosition{
|
||||
PositionPage: "8",
|
||||
PositionX: 200,
|
||||
PositionY: 430,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// buildPartyBSigner 构建乙方签署人信息(手动签署)
|
||||
func (s *SignFlowService) buildPartyBSigner(fileID, signerAccount, signerName, transactorPhone, transactorName, transactorIDCardNum string) SignerInfo {
|
||||
// buildPartyASigner 构建甲方签署人信息(手动签署)
|
||||
func (s *SignFlowService) buildPartyASigner(fileID, signerAccount, signerName, transactorPhone, transactorName, transactorIDCardNum string) SignerInfo {
|
||||
return SignerInfo{
|
||||
SignConfig: &SignConfig{
|
||||
SignOrder: 2,
|
||||
SignOrder: 1,
|
||||
},
|
||||
AuthConfig: &AuthConfig{
|
||||
PsnAvailableAuthModes: []string{AuthModeMobile3},
|
||||
@@ -182,19 +159,66 @@ func (s *SignFlowService) buildPartyBSigner(fileID, signerAccount, signerName, t
|
||||
},
|
||||
SignFields: []SignField{
|
||||
{
|
||||
CustomBizNum: "乙方签章",
|
||||
CustomBizNum: "甲方签章",
|
||||
FileId: fileID,
|
||||
NormalSignFieldConfig: &NormalSignFieldConfig{
|
||||
AutoSign: false,
|
||||
SignFieldStyle: SignFieldStyleNormal,
|
||||
SignFieldPosition: &SignFieldPosition{
|
||||
PositionPage: "8",
|
||||
PositionX: 450,
|
||||
PositionY: 430,
|
||||
PositionPage: "10",
|
||||
PositionX: 165,
|
||||
PositionY: 197,
|
||||
},
|
||||
OrgSealBizTypes: "PUBLIC",
|
||||
},
|
||||
},
|
||||
{
|
||||
CustomBizNum: "甲方骑缝章", // 建议设唯一标识,便于调试
|
||||
FileId: fileID,
|
||||
NormalSignFieldConfig: &NormalSignFieldConfig{
|
||||
AutoSign: false,
|
||||
SignFieldStyle: SignFieldStyleSeam, // 必须为 2(Edges)
|
||||
SignFieldPosition: &SignFieldPosition{
|
||||
AcrossPageMode: "ALL", // 覆盖全部页面(推荐)
|
||||
PositionY: 694.0, // 您指定的 Y 坐标(float64)
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// buildPartyBSigner 构建乙方签署人信息(自动盖章)
|
||||
func (s *SignFlowService) buildPartyBSigner(fileID string) SignerInfo {
|
||||
return SignerInfo{
|
||||
SignConfig: &SignConfig{SignOrder: 2},
|
||||
SignerType: SignerTypeOrg,
|
||||
SignFields: []SignField{
|
||||
{
|
||||
CustomBizNum: "乙方签章",
|
||||
FileId: fileID,
|
||||
NormalSignFieldConfig: &NormalSignFieldConfig{
|
||||
AutoSign: true,
|
||||
SignFieldStyle: SignFieldStyleNormal,
|
||||
SignFieldPosition: &SignFieldPosition{
|
||||
PositionPage: "10",
|
||||
PositionX: 403,
|
||||
PositionY: 197,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
CustomBizNum: "乙方骑缝章", // 建议设唯一标识,便于调试
|
||||
FileId: fileID,
|
||||
NormalSignFieldConfig: &NormalSignFieldConfig{
|
||||
AutoSign: true, // 骑缝章也支持自动签署
|
||||
SignFieldStyle: SignFieldStyleSeam, // 必须为 2(Edges)
|
||||
SignFieldPosition: &SignFieldPosition{
|
||||
AcrossPageMode: "ALL", // 覆盖全部页面(推荐)
|
||||
PositionY: 554.0, // 您指定的 Y 坐标(float64)
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -216,4 +240,4 @@ func (s *SignFlowService) buildSignFlowConfig() SignFlowConfig {
|
||||
RedirectUrl: s.config.Sign.RedirectUrl,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ func CreateDefaultComponents() []Component {
|
||||
},
|
||||
{
|
||||
ComponentKey: "QDRQ",
|
||||
ComponentValue: time.Now().Format("2006年01月02日"),
|
||||
ComponentValue: time.Now().Format("2006-01-02"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ type SignFlowConfig struct {
|
||||
|
||||
// RedirectConfig 重定向配置
|
||||
type RedirectConfig struct {
|
||||
RedirectUrl string `json:"redirectUrl"` // 重定向URL
|
||||
RedirectDelayTime int64 `json:"redirectDelayTime"` //重定向时间
|
||||
RedirectUrl string `json:"redirectUrl"` // 重定向URL
|
||||
RedirectDelayTime int64 `json:"redirectDelayTime"` //重定向时间
|
||||
}
|
||||
|
||||
// AuthConfig 认证配置
|
||||
@@ -170,9 +170,10 @@ type NormalSignFieldConfig struct {
|
||||
|
||||
// SignFieldPosition 签署区位置
|
||||
type SignFieldPosition struct {
|
||||
PositionPage string `json:"positionPage"` // 页码
|
||||
PositionX float64 `json:"positionX"` // X坐标
|
||||
PositionY float64 `json:"positionY"` // Y坐标
|
||||
PositionPage string `json:"positionPage,omitempty"` // 页码(骑缝章可与 acrossPageMode 组合)
|
||||
PositionX float64 `json:"positionX,omitempty"` // X坐标
|
||||
PositionY float64 `json:"positionY,omitempty"` // Y坐标
|
||||
AcrossPageMode string `json:"acrossPageMode,omitempty"` // 骑缝章跨页:如 ALL 表示全部页面
|
||||
}
|
||||
|
||||
// ==================== 签署页面链接相关结构体 ====================
|
||||
|
||||
@@ -104,11 +104,11 @@ func getCurrentDate() string {
|
||||
}
|
||||
|
||||
// formatDateForTemplate 格式化日期用于模板填写
|
||||
// 格式: "2006年01月02日"
|
||||
// e签宝日期控件通常预设为 yyyy-MM-dd,与中文年月日格式不兼容时需用本格式。
|
||||
//
|
||||
// 返回: 中文格式的日期字符串
|
||||
// 返回: yyyy-MM-dd
|
||||
func formatDateForTemplate() string {
|
||||
return time.Now().Format("2006年01月02日")
|
||||
return time.Now().Format("2006-01-02")
|
||||
}
|
||||
|
||||
// generateFileName 生成带时间戳的文件名
|
||||
|
||||
Reference in New Issue
Block a user