From 8b36769df9c884585756e07611c50b971db03ef3 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 30 Oct 2024 15:17:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_settle_center.go | 2 +- app/md/md_settle_center.go | 2 ++ app/svc/svc_settle_center.go | 14 ++++++++++++++ go.mod | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/hdl/hdl_settle_center.go b/app/hdl/hdl_settle_center.go index bad8f9c..5d25087 100644 --- a/app/hdl/hdl_settle_center.go +++ b/app/hdl/hdl_settle_center.go @@ -203,7 +203,7 @@ func SettleCenterSettleFileDown(c *gin.Context) { pdf.Text(left, 230, "日期:") // 保存PDF文件 - pdfName := num + ".pdf" + pdfName := medium.CompanyName + "(" + strings.ReplaceAll(date, "-", "") + ")结算单.pdf" err := pdf.OutputFileAndClose(path + "/" + pdfName) if err != nil { fmt.Println(err) diff --git a/app/md/md_settle_center.go b/app/md/md_settle_center.go index d3403eb..2925530 100644 --- a/app/md/md_settle_center.go +++ b/app/md/md_settle_center.go @@ -64,6 +64,7 @@ type SettleCenterDataData struct { State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` Label string `json:"label"` SettleFile string `json:"settle_file" example:"结算单"` + DownUrl string `json:"down_url"` } type SettleCenterDataDetailRes struct { @@ -86,6 +87,7 @@ type SettleCenterDataDetail struct { OtherIncome string `json:"other_income" example:"其他调整"` PayState string `json:"pay_state" example:"结算单支付状态(0:未开始 1:待审核发票 2:发票审核中 3:发票审核拒绝 4:付款中 5:已付款)"` State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` + DownUrl string `json:"down_url"` } type Invoice struct { Type string `json:"type"` diff --git a/app/svc/svc_settle_center.go b/app/svc/svc_settle_center.go index a17944c..9588203 100644 --- a/app/svc/svc_settle_center.go +++ b/app/svc/svc_settle_center.go @@ -19,6 +19,12 @@ func SettleCenterList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCente MediumList, total, _ := NewMediumSettlementDb.FindMediumSettlementList(c.GetString("mid"), utils.IntToStr(user.MediumId), "", "", "", req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) data := make([]md.SettleCenterDataData, 0) if len(MediumList) > 0 { + NewUserAppDomainDb := implement.NewUserAppDomainDb(db.Db) + domain, _ := NewUserAppDomainDb.GetUserAppDomainByPlatform(utils.StrToInt(c.GetString("mid")), "medium") + host := c.Request.Host + if domain != nil { + host = domain.Domain + } for _, v := range MediumList { var tmp = md.SettleCenterDataData{ Id: utils.IntToStr(v.Id), @@ -32,6 +38,7 @@ func SettleCenterList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCente Label: "预估", SettleFile: v.SettleFile, } + tmp.DownUrl = "http://" + host + "/api/settle/file/down?id=" + utils.IntToStr(v.Id) if v.EndDate != "" && v.EndDate != "0000-00-00" { if v.EndDate != v.StartDate { tmp.TimeStr += "~" + v.EndDate @@ -88,6 +95,13 @@ func SettleCenterDetail(c *gin.Context, req md.CommDetailReq) md.SettleCenterDat tmp.TimeStr += "~" + data.EndDate } } + NewUserAppDomainDb := implement.NewUserAppDomainDb(db.Db) + domain, _ := NewUserAppDomainDb.GetUserAppDomainByPlatform(utils.StrToInt(c.GetString("mid")), "medium") + host := c.Request.Host + if domain != nil { + host = domain.Domain + } + tmp.DownUrl = "http://" + host + "/api/settle/file/down?id=" + utils.IntToStr(data.Id) res := md.SettleCenterDataDetailRes{ Data: tmp, InvoiceCate: md.InvoiceCate, diff --git a/go.mod b/go.mod index e5dd685..cde4efc 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ go 1.18 // require ( - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241030025944-2a0971f8eb9d + code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241030071009-67f1ca108f52 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/boombuler/barcode v1.0.1 github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5