From bd801656d1c2a39a32751e5f20bd1e7f32be7dbf Mon Sep 17 00:00:00 2001 From: JNG <365252428@qq.com> Date: Wed, 11 Mar 2026 20:01:48 +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/questionnaireSurvey.go | 22 ++++++++-------------- pkg/utils/pdf.go | 5 ----- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/pkg/service/bundle/questionnaireSurvey.go b/pkg/service/bundle/questionnaireSurvey.go index d583dd80..0ccc56d0 100644 --- a/pkg/service/bundle/questionnaireSurvey.go +++ b/pkg/service/bundle/questionnaireSurvey.go @@ -9,6 +9,7 @@ import ( "fonchain-fiee/pkg/service/bundle/model" "fonchain-fiee/pkg/service/upload" "fonchain-fiee/pkg/utils" + "strconv" "time" "github.com/gin-gonic/gin" @@ -73,20 +74,19 @@ func QuestionnaireSurveyCreate(c *gin.Context) { return } templateDir := "./data/满意度调成报告模板.pdf" - outputPath := "./data/" + req.UserTel + time.Now().Format("20060102150405") + ".pdf" - fmt.Println("1111111111111111111") + outputPath := "/data/questionnaire/" + req.UserTel + time.Now().Format("20060102150405") + ".pdf" err = utils.QuestionnaireSurveyPDF(templateDir, outputPath, &model.QuestionnairePDFData{ //CustomerNum: surveyInfo.BundleInfo., CustomerName: surveyInfo.UserName, BundleName: surveyInfo.BundleInfo.BundleName, BundleStartDate: surveyInfo.BundleInfo.StartAt, BundleEndDate: surveyInfo.BundleInfo.ExpiredAt, - VideoNum: string(surveyInfo.BundleInfo.BundleVideoNumber), - AccountNum: string(surveyInfo.BundleInfo.BundleAccountNumber), - ImagesNum: string(surveyInfo.BundleInfo.BundleImageNumber), - DataAnalysisNum: string(surveyInfo.BundleInfo.BundleDataNumber), - CompetitiveNum: string(surveyInfo.BundleInfo.BundleCompetitiveNumber), - ValueAddVideoNum: string(surveyInfo.BundleInfo.IncreaseVideoNumber), + VideoNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.BundleVideoNumber), 10), + AccountNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.BundleAccountNumber), 10), + ImagesNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.BundleImageNumber), 10), + DataAnalysisNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.BundleDataNumber), 10), + CompetitiveNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.BundleCompetitiveNumber), 10), + ValueAddVideoNum: strconv.FormatInt(int64(surveyInfo.BundleInfo.IncreaseVideoNumber), 10), Score1: int(req.SurveyAnswer.BundleAccountScore), Score2: int(req.SurveyAnswer.BundleAccountScore), Score3: int(req.SurveyAnswer.BundleImageScore), @@ -102,22 +102,16 @@ func QuestionnaireSurveyCreate(c *gin.Context) { Address: address, }) - fmt.Println("2222222222222222222") if err != nil { - fmt.Println("生成PDF失败: ", err) service.Error(c, err) return } - fmt.Println("333333333333333333") outputUrl, ossErr := upload.PutBos(outputPath, upload.PdfType, true) - fmt.Println("outputUrl======================>>>>", outputUrl) - fmt.Println("ossErr======================>>>>", ossErr) if ossErr != nil { service.Error(c, err) return } - fmt.Println("outputUrl======================>>>>", outputUrl) //service.Success(c, outputUrl) //return req.SurveyUrl = outputUrl diff --git a/pkg/utils/pdf.go b/pkg/utils/pdf.go index 3cc90681..9d62fd9c 100644 --- a/pkg/utils/pdf.go +++ b/pkg/utils/pdf.go @@ -605,17 +605,14 @@ func QuestionnaireSurveyPDF(templatePath, outputPath string, data *model.Questio pdf := gopdf.GoPdf{} pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4}) - fmt.Println("pdf111111111111111111111111111") if err := pdf.ImportPagesFromSource(templatePath, "/MediaBox"); err != nil { return fmt.Errorf("导入模板失败: %w", err) } - fmt.Println("pdf222222222222222222222222222") if err := pdf.AddTTFFont("simfang", "./data/simfang.ttf"); err != nil { return fmt.Errorf("加载字体失败: %w", err) } - fmt.Println("pdf333333333333333333333333333") if err := pdf.SetFont("simfang", "", 12); err != nil { return fmt.Errorf("设置字体失败: %w", err) } @@ -624,12 +621,10 @@ func QuestionnaireSurveyPDF(templatePath, outputPath string, data *model.Questio if err != nil { return fmt.Errorf("BundleStartDate格式错误: %w", err) } - fmt.Println("pdf4444444444444444444444444444444") endTime, err := parseFlexibleDate(data.BundleEndDate) if err != nil { return fmt.Errorf("BundleEndDate格式错误: %w", err) } - fmt.Println("pdf555555555555555555555555555555") submissionDate, err := parseFlexibleDate(data.SubmissionDate) if err != nil { return fmt.Errorf("SubmissionDate格式错误: %w", err)