From d78ebd22cd4e37eef5c73bed2d5424aa38c0a36a Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 4 Sep 2024 10:29:39 +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_financial_dynamics.go | 62 ++++++++++++++++++++++++++++ app/md/md_financial_dynamics.go | 39 +++++++++++++++++ app/router/router.go | 7 +++- app/svc/svc_finance_center_agent.go | 2 + app/svc/svc_finance_center_medium.go | 1 + app/svc/svc_financial_dynamics.go | 51 +++++++++++++++++++++++ go.mod | 2 +- 7 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 app/hdl/hdl_financial_dynamics.go create mode 100644 app/md/md_financial_dynamics.go create mode 100644 app/svc/svc_financial_dynamics.go diff --git a/app/hdl/hdl_financial_dynamics.go b/app/hdl/hdl_financial_dynamics.go new file mode 100644 index 0000000..4e7e0cf --- /dev/null +++ b/app/hdl/hdl_financial_dynamics.go @@ -0,0 +1,62 @@ +package hdl + +import ( + "applet/app/e" + "applet/app/lib/validate" + "applet/app/md" + "applet/app/svc" + "github.com/gin-gonic/gin" +) + +// FinancialDynamicsMediumTotal +// @Summary 媒体预付-统计 +// @Tags 资产动态------嘉俊 +// @Description 资产动态-媒体预付-统计 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.FinancialDynamicsMediumTotalReq true "请求参数" +// @Success 200 {object} md.FinancialDynamicsMediumTotalRes "具体看返回内容 这是data里面的数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/financialDynamics/medium/list [POST] +func FinancialDynamicsMediumTotal(c *gin.Context) { + var req md.FinancialDynamicsMediumTotalReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + res := svc.FinancialDynamicsMediumTotal(c, req) + e.OutSuc(c, res, nil) + return +} + +// FinancialDynamicsMediumList +// @Summary 媒体预付 +// @Tags 资产动态------嘉俊 +// @Description 资产动态-媒体预付 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.FinancialDynamicsMediumListReq true "请求参数" +// @Success 200 {object} md.FinancialDynamicsMediumListRes "具体看返回内容 这是data里面的数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/financialDynamics/medium/list [POST] +func FinancialDynamicsMediumList(c *gin.Context) { + var req md.FinancialDynamicsMediumListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + res := svc.FinancialDynamicsMediumList(c, req) + e.OutSuc(c, res, nil) + return +} +func FinancialDynamicsMediumSave(c *gin.Context) { + +} diff --git a/app/md/md_financial_dynamics.go b/app/md/md_financial_dynamics.go new file mode 100644 index 0000000..318560b --- /dev/null +++ b/app/md/md_financial_dynamics.go @@ -0,0 +1,39 @@ +package md + +type FinancialDynamicsMediumListReq struct { + Limit string `json:"limit"` + Page string `json:"page" ` + Uid string `json:"uid" example:""` + StartTime string `json:"start_time" example:"2024-08-29 00:00:00"` + EndTime string `json:"end_time" ` +} +type FinancialDynamicsMediumTotalReq struct { + Uid string `json:"uid" example:""` + StartTime string `json:"start_time" example:"2024-08-29 00:00:00"` + EndTime string `json:"end_time" ` +} + +type FinancialDynamicsMediumListRes struct { + List []FinancialDynamicsMediumListData `json:"list" ` + Total int64 `json:"total"` + User []SelectData `json:"user"` + BusinessKind []SelectData `json:"business_kind"` + PayMethod []SelectData `json:"pay_method"` +} + +type FinancialDynamicsMediumListData struct { + Id string `json:"id"` + Name string `json:"name"` + PayTime string `json:"pay_time" example:"支付时间"` + Amount string `json:"amount" example:"支付金额"` + PayMethod string `json:"pay_method" example:"支付方式 0对私 1对公"` + Certificate string `json:"certificate" example:"支付凭证"` + Memo string `json:"memo" example:"备注"` + BusinessKind string `json:"business_kind" example:"支付类型(1:广告合作)"` +} +type FinancialDynamicsMediumTotalRes struct { + BalanceAmount string `json:"balance_amount" example:"账户余额"` + AllAmount string `json:"all_amount" example:"预付总金额"` + UseAmount string `json:"use_amount" example:"已消耗金额"` + PayCount string `json:"pay_count" example:"预付次数"` +} diff --git a/app/router/router.go b/app/router/router.go index 08b5500..7bffa2b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -74,7 +74,7 @@ func route(r *gin.RouterGroup) { rSettleCenter(r.Group("/settleCenter")) //结算中心 rFinanceCenter(r.Group("/financeCenter")) //财务中心 rIndex(r.Group("/index")) //首页 - + rFinancialDynamics(r.Group("/financialDynamics")) //资产动态 } func rIndex(r *gin.RouterGroup) { r.GET("/base", hdl.Base) //首页-基本信息 @@ -212,3 +212,8 @@ func rFinanceCenter(r *gin.RouterGroup) { r.POST("/agent/pay/save", hdl.FinanceCenterAgentPaySave) //财务中心-代理详情-确认支付 } +func rFinancialDynamics(r *gin.RouterGroup) { + r.POST("/medium/total", hdl.FinancialDynamicsMediumTotal) //资产动态-媒体预付统计 + r.POST("/medium/list", hdl.FinancialDynamicsMediumList) //资产动态-媒体预付 + r.POST("/medium/save", hdl.FinancialDynamicsMediumSave) //资产动态-媒体预付创建 +} diff --git a/app/svc/svc_finance_center_agent.go b/app/svc/svc_finance_center_agent.go index 389ff9b..522c955 100644 --- a/app/svc/svc_finance_center_agent.go +++ b/app/svc/svc_finance_center_agent.go @@ -106,6 +106,8 @@ func FinanceCenterAgentDetail(c *gin.Context, req md.CommDetailReq) md.FinanceCe invoice.Time = invoiceData.UpdateAt invoice.Count = utils.IntToStr(invoiceData.Count) json.Unmarshal([]byte(invoiceData.File), &file) + invoice.File = file + } tmp := md.FinanceCenterDataAgentDetail{ Source: "手动导入", diff --git a/app/svc/svc_finance_center_medium.go b/app/svc/svc_finance_center_medium.go index 0dcd994..e4170d1 100644 --- a/app/svc/svc_finance_center_medium.go +++ b/app/svc/svc_finance_center_medium.go @@ -106,6 +106,7 @@ func FinanceCenterMediumDetail(c *gin.Context, req md.CommDetailReq) md.FinanceC invoice.Time = invoiceData.UpdateAt invoice.Count = utils.IntToStr(invoiceData.Count) json.Unmarshal([]byte(invoiceData.File), &file) + invoice.File = file } tmp := md.FinanceCenterDataDetail{ Source: "手动导入", diff --git a/app/svc/svc_financial_dynamics.go b/app/svc/svc_financial_dynamics.go new file mode 100644 index 0000000..4fa95a1 --- /dev/null +++ b/app/svc/svc_financial_dynamics.go @@ -0,0 +1,51 @@ +package svc + +import ( + "applet/app/md" + "applet/app/utils" + db "code.fnuoos.com/zhimeng/model.git/src" + "code.fnuoos.com/zhimeng/model.git/src/super/implement" + "github.com/gin-gonic/gin" +) + +func FinancialDynamicsMediumList(c *gin.Context, req md.FinancialDynamicsMediumListReq) md.FinancialDynamicsMediumListRes { + engine := db.Db + NewMediumFinancialDynamicsDb := implement.NewMediumFinancialDynamicsDb(engine) + list, total, _ := NewMediumFinancialDynamicsDb.FindMediumFinancialDynamics(c.GetString("mid"), req.Uid, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) + data := make([]md.FinancialDynamicsMediumListData, 0) + if len(list) > 0 { + for _, v := range list { + var tmp = md.FinancialDynamicsMediumListData{ + Id: utils.IntToStr(v.Id), + PayTime: v.PayTime, + Amount: v.Amount, + PayMethod: utils.IntToStr(v.PayMethod), + Certificate: v.Certificate, + Memo: v.Memo, + BusinessKind: utils.IntToStr(v.BusinessKind), + } + medium := GetMediumInfo(c, v.MediumId) + if medium != nil { + tmp.Name = medium["name"] + } + data = append(data, tmp) + } + } + res := md.FinancialDynamicsMediumListRes{ + List: data, + Total: total, + BusinessKind: md.BusinessKind, + } + return res +} +func FinancialDynamicsMediumTotal(c *gin.Context, req md.FinancialDynamicsMediumTotalReq) md.FinancialDynamicsMediumTotalRes { + //engine := db.Db + //sql:=`select sum(amount) ` + res := md.FinancialDynamicsMediumTotalRes{ + BalanceAmount: "", + AllAmount: "", + UseAmount: "", + PayCount: "", + } + return res +} diff --git a/go.mod b/go.mod index ffc6f31..bcf4657 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 //replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models require ( - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240903070205-48027ef2892e + code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240904022854-1a778f869786 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