From cdf8cdcb08d9e58e0bf82ca6c7d69372eeea0dc7 Mon Sep 17 00:00:00 2001 From: jhc Date: Wed, 12 Mar 2025 20:56:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/bundle/logic/signContract.go | 47 ++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/pkg/service/bundle/logic/signContract.go b/pkg/service/bundle/logic/signContract.go index 4b40ee3..1b4b92e 100644 --- a/pkg/service/bundle/logic/signContract.go +++ b/pkg/service/bundle/logic/signContract.go @@ -156,50 +156,51 @@ func InsertSignatureV1(templatePath, outputPath, signImgPath, companyImgPath, co // 写 buyer info pdf.SetPage(buyerPage) - pdf.SetX(145) - pdf.SetY(134) + pdf.SetX(149) + pdf.SetY(127) pdf.Cell(nil, contractNo) - pdf.SetX(145) - pdf.SetY(159) + pdf.SetX(149) + pdf.SetY(152) pdf.Cell(nil, time.Now().Format("2006-01-02")) pdf.SetX(180) - pdf.SetY(207) + pdf.SetY(203) pdf.Cell(nil, buyerName) pdf.SetX(210) - pdf.SetY(232) + pdf.SetY(229) pdf.Cell(nil, idNo) pdf.SetX(200) - pdf.SetY(257) + pdf.SetY(256) pdf.Cell(nil, telNum) pdf.SetX(200) - pdf.SetY(283) + pdf.SetY(282) pdf.Cell(nil, address) // 填 金额 pdf.SetPage(pricePage) - pdf.SetX(379) - pdf.SetY(639) + pdf.SetX(380) + pdf.SetY(626) // 保留整数 - pdf.Cell(nil, strconv.FormatFloat(float64(price), 'f', 0, 32)) + //pdf.Cell(nil, strconv.FormatFloat(float64(price), 'f', 0, 32)) + pdf.Cell(nil, strconv.FormatFloat(float64(price/10000.0), 'f', -1, 32)) // 写 有效期 t := time.Now().AddDate(int(contractDuration), 0, 0) pdf.SetPage(limitTimePage) - pdf.SetX(327) - pdf.SetY(358) + pdf.SetX(317) + pdf.SetY(327) pdf.Cell(nil, t.Format("2006")) - pdf.SetX(420) - pdf.SetY(358) + pdf.SetX(398) + pdf.SetY(327) pdf.Cell(nil, t.Format("01")) - pdf.SetX(486) - pdf.SetY(358) + pdf.SetX(456) + pdf.SetY(327) pdf.Cell(nil, t.Format("02")) // 只在目标页插入签名 @@ -238,14 +239,14 @@ func InsertSignatureV1(templatePath, outputPath, signImgPath, companyImgPath, co newSignHeight := (newSignWidth / float64(signImgw)) * float64(signImgh) // buyer sign - err = pdf.ImageByHolder(imgH1, 180, 560, &gopdf.Rect{W: newSignWidth, H: newSignHeight}) + err = pdf.ImageByHolder(imgH1, 175, 540, &gopdf.Rect{W: newSignWidth, H: newSignHeight}) if err != nil { fmt.Printf("插入签名失败: %v\n", err) return errors.New("error inserting signature") } - pdf.SetX(320) - pdf.SetY(585) + pdf.SetX(365) + pdf.SetY(560) pdf.Cell(nil, time.Now().Format("2006-01-02")) companyImgResp, companyImageErr := http.Get(companyImgPath) @@ -282,14 +283,14 @@ func InsertSignatureV1(templatePath, outputPath, signImgPath, companyImgPath, co newCompanyHeight := (newCompanyWidth / float64(companyImgw)) * float64(companyImgh) // seller sign - err = pdf.ImageByHolder(companyImgH1, 180, 610, &gopdf.Rect{W: newCompanyWidth, H: newCompanyHeight}) + err = pdf.ImageByHolder(companyImgH1, 175, 590, &gopdf.Rect{W: newCompanyWidth, H: newCompanyHeight}) if err != nil { fmt.Printf("插入公司章失败: %v\n", err) return errors.New("error inserting signature") } - pdf.SetX(320) - pdf.SetY(635) + pdf.SetX(365) + pdf.SetY(607) pdf.Cell(nil, time.Now().Format("2006-01-02")) // 生成新的 PDF