From c8561bc6cd67ecab0754b57ed78c9fde51c36a42 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 3 Sep 2024 15:01:30 +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_data_center_original_data.go | 2 +- app/hdl/hdl_finance_center_medium.go | 25 ++++ app/hdl/hdl_index.go | 6 +- app/md/md_finance_center.go | 24 ++++ app/router/router.go | 2 + app/svc/svc_finance_center_medium.go | 43 ++++-- docs/docs.go | 172 ++++++++++++++++++++++- docs/swagger.json | 172 ++++++++++++++++++++++- docs/swagger.yaml | 122 +++++++++++++++- go.mod | 2 +- 10 files changed, 545 insertions(+), 25 deletions(-) diff --git a/app/hdl/hdl_data_center_original_data.go b/app/hdl/hdl_data_center_original_data.go index f152a6c..78103aa 100644 --- a/app/hdl/hdl_data_center_original_data.go +++ b/app/hdl/hdl_data_center_original_data.go @@ -92,7 +92,7 @@ func OriginalDataDoing(c *gin.Context) { // @Accept json // @Produce json // @Param args body md.DataCenterOriginalDataCommReq true "请求参数" -// @Success 200 {string} "具体看返回内容 " +// @Success 200 {object} md.MediumDivisionStrategy "具体看返回内容 " // @Failure 400 {object} md.Response "具体错误" // @Router /api/dataCenter/original/data/total [POST] func OriginalDataTotal(c *gin.Context) { diff --git a/app/hdl/hdl_finance_center_medium.go b/app/hdl/hdl_finance_center_medium.go index 7a9cd66..f6da7e3 100644 --- a/app/hdl/hdl_finance_center_medium.go +++ b/app/hdl/hdl_finance_center_medium.go @@ -8,6 +8,31 @@ import ( "github.com/gin-gonic/gin" ) +// FinanceCenterPlatformList +// @Summary 平台报表 +// @Tags 财务中心------嘉俊 +// @Description 财务中心-平台报表 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.FinanceCenterPlatformDataReq true "请求参数" +// @Success 200 {object} md.FinanceCenterPlatformDataRes "具体看返回内容 这是data里面的数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/financeCenter/platform/list [POST] +func FinanceCenterPlatformList(c *gin.Context) { + var req md.FinanceCenterPlatformDataReq + 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.FinanceCenterPlatformList(c, req) + e.OutSuc(c, res, nil) + return +} + // FinanceCenterMediumList // @Summary 媒体列表 // @Tags 财务中心------嘉俊 diff --git a/app/hdl/hdl_index.go b/app/hdl/hdl_index.go index 563103c..11b1f40 100644 --- a/app/hdl/hdl_index.go +++ b/app/hdl/hdl_index.go @@ -46,9 +46,9 @@ func IndexTotal(c *gin.Context) { } // IndexAppList -// @Summary 数据明细 -// @Tags 数据中心------嘉俊 -// @Description 数据中心-数据明细 +// @Summary 应用数据 +// @Tags 首页------嘉俊 +// @Description 首页-应用数据 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json diff --git a/app/md/md_finance_center.go b/app/md/md_finance_center.go index 3e738b3..c378aa1 100644 --- a/app/md/md_finance_center.go +++ b/app/md/md_finance_center.go @@ -1,5 +1,29 @@ package md +type FinanceCenterPlatformDataReq struct { + Limit string `json:"limit"` + Page string `json:"page" ` + Date string `json:"date" example:"2024-08-29"` + StartTime string `json:"start_time" example:"2024-08-29"` + EndTime string `json:"end_time" ` +} + +type FinanceCenterPlatformDataRes struct { + List []FinanceCenterPlatformDataData `json:"list" ` + Total int64 `json:"total"` +} + +type FinanceCenterPlatformDataData struct { + Id string `json:"id"` + TimeStr string `json:"time_str" example:"业务时间"` + TopIncome string `json:"top_income" example:"上游结算"` + CommissionIncome string `json:"commission_income" example:"佣金留存"` + PlatformIncome string `json:"platform_income" example:"平台留存"` + ChangeIncome string `json:"change_income" example:"调价留存"` + MediumIncome string `json:"medium_income" example:"媒体结算"` + AgentIncome string `json:"agent_income" example:"代理结算"` + UpdateAt string `json:"update_at" example:"更新时间"` +} type FinanceCenterDataReq struct { Limit string `json:"limit"` Page string `json:"page" ` diff --git a/app/router/router.go b/app/router/router.go index bae5c45..08b5500 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -202,6 +202,8 @@ func rFinanceCenter(r *gin.RouterGroup) { r.POST("/medium/other/income/save", hdl.FinanceCenterMediumOtherIncomeSave) //财务中心-媒体详情-其他收益调整 r.POST("/medium/pay/save", hdl.FinanceCenterMediumPaySave) //财务中心-媒体详情-确认支付 + r.POST("/platform/list", hdl.FinanceCenterPlatformList) //财务中心-平台报表 + r.POST("/agent/list", hdl.FinanceCenterAgentList) //财务中心-代理列表 r.POST("/agent/detail", hdl.FinanceCenterAgentDetail) //财务中心-代理详情 r.POST("/agent/settle/file/save", hdl.FinanceCenterAgentSettleFileSave) //财务中心-代理详情-结算单上传 diff --git a/app/svc/svc_finance_center_medium.go b/app/svc/svc_finance_center_medium.go index c017860..0dcd994 100644 --- a/app/svc/svc_finance_center_medium.go +++ b/app/svc/svc_finance_center_medium.go @@ -112,10 +112,10 @@ func FinanceCenterMediumDetail(c *gin.Context, req md.CommDetailReq) md.FinanceC SettleFile: data.SettleFile, Invoice: invoice, AllIncome: utils.Float64ToStr(float64(data.OtherIncome+data.BasicIncome) / 100), - TopIncome: "", - CommissionIncome: "", - PlatformIncome: "", - ChangeIncome: "", + TopIncome: utils.Float64ToStr(float64(data.OriginalIncome) / 100), + CommissionIncome: utils.Float64ToStr(float64(data.CommissionRetention) / 100), + PlatformIncome: utils.Float64ToStr(float64(data.PlatformRetention) / 100), + ChangeIncome: utils.Float64ToStr(float64(data.PriceAdjustmentRetention) / 100), MediumIncome: utils.Float64ToStr(float64(data.BasicIncome) / 100), OtherIncome: utils.Float64ToStr(float64(data.OtherIncome) / 100), TimeStr: data.StartDate, @@ -157,10 +157,10 @@ func FinanceCenterMediumList(c *gin.Context, req md.FinanceCenterDataReq) md.Fin Id: utils.IntToStr(v.Id), Name: "", AllIncome: utils.Float64ToStr(float64(v.OtherIncome+v.BasicIncome) / 100), - TopIncome: "", - CommissionIncome: "", - PlatformIncome: "", - ChangeIncome: "", + TopIncome: utils.Float64ToStr(float64(v.OriginalIncome) / 100), + CommissionIncome: utils.Float64ToStr(float64(v.CommissionRetention) / 100), + PlatformIncome: utils.Float64ToStr(float64(v.PlatformRetention) / 100), + ChangeIncome: utils.Float64ToStr(float64(v.PriceAdjustmentRetention) / 100), MediumIncome: utils.Float64ToStr(float64(v.BasicIncome) / 100), OtherIncome: utils.Float64ToStr(float64(v.OtherIncome) / 100), TimeStr: v.StartDate, @@ -192,3 +192,30 @@ func FinanceCenterMediumList(c *gin.Context, req md.FinanceCenterDataReq) md.Fin } return res } +func FinanceCenterPlatformList(c *gin.Context, req md.FinanceCenterPlatformDataReq) md.FinanceCenterPlatformDataRes { + engine := db.Db + NewPlatformSettlementDb := implement.NewPlatformSettlementDb(engine) + MediumList, total, _ := NewPlatformSettlementDb.FindPlatformSettlementList(c.GetString("mid"), req.Date, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) + data := make([]md.FinanceCenterPlatformDataData, 0) + if len(MediumList) > 0 { + for _, v := range MediumList { + var tmp = md.FinanceCenterPlatformDataData{ + Id: utils.IntToStr(v.Id), + TopIncome: utils.Float64ToStr(float64(v.OriginalIncome) / 100), + CommissionIncome: utils.Float64ToStr(float64(v.CommissionRetention) / 100), + PlatformIncome: utils.Float64ToStr(float64(v.PlatformRetention) / 100), + ChangeIncome: utils.Float64ToStr(float64(v.PriceAdjustmentRetention) / 100), + MediumIncome: utils.Float64ToStr(float64(v.MediumIncome) / 100), + AgentIncome: utils.Float64ToStr(float64(v.AgentIncome) / 100), + TimeStr: v.StartDate, + UpdateAt: v.UpdateAt, + } + data = append(data, tmp) + } + } + res := md.FinanceCenterPlatformDataRes{ + List: data, + Total: total, + } + return res +} diff --git a/docs/docs.go b/docs/docs.go index 6e4ab8a..702cc9d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1114,7 +1114,7 @@ const docTemplate = `{ "200": { "description": "具体看返回内容 ", "schema": { - "type": "string" + "$ref": "#/definitions/md.MediumDivisionStrategy" } }, "400": { @@ -1831,9 +1831,56 @@ const docTemplate = `{ } } }, + "/api/financeCenter/platform/list": { + "post": { + "description": "财务中心-平台报表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务中心------嘉俊" + ], + "summary": "平台报表", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataReq" + } + } + ], + "responses": { + "200": { + "description": "具体看返回内容 这是data里面的数据", + "schema": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataRes" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/index/app/list": { "post": { - "description": "数据中心-数据明细", + "description": "首页-应用数据", "consumes": [ "application/json" ], @@ -1841,9 +1888,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "数据中心------嘉俊" + "首页------嘉俊" ], - "summary": "数据明细", + "summary": "应用数据", "parameters": [ { "type": "string", @@ -6484,6 +6531,82 @@ const docTemplate = `{ } } }, + "md.FinanceCenterPlatformDataData": { + "type": "object", + "properties": { + "agent_income": { + "type": "string", + "example": "代理结算" + }, + "change_income": { + "type": "string", + "example": "调价留存" + }, + "commission_income": { + "type": "string", + "example": "佣金留存" + }, + "id": { + "type": "string" + }, + "medium_income": { + "type": "string", + "example": "媒体结算" + }, + "platform_income": { + "type": "string", + "example": "平台留存" + }, + "time_str": { + "type": "string", + "example": "业务时间" + }, + "top_income": { + "type": "string", + "example": "上游结算" + }, + "update_at": { + "type": "string", + "example": "更新时间" + } + } + }, + "md.FinanceCenterPlatformDataReq": { + "type": "object", + "properties": { + "date": { + "type": "string", + "example": "2024-08-29" + }, + "end_time": { + "type": "string" + }, + "limit": { + "type": "string" + }, + "page": { + "type": "string" + }, + "start_time": { + "type": "string", + "example": "2024-08-29" + } + } + }, + "md.FinanceCenterPlatformDataRes": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataData" + } + }, + "total": { + "type": "integer" + } + } + }, "md.IndexAppListData": { "type": "object", "properties": { @@ -6641,6 +6764,47 @@ const docTemplate = `{ } } }, + "md.MediumDivisionStrategy": { + "type": "object", + "properties": { + "agent_revenue_rate": { + "type": "string", + "example": "代理收益百分比" + }, + "agreement_sharing_rate": { + "type": "string", + "example": "协议分成百分比" + }, + "commission_retention_rate": { + "type": "string", + "example": "佣金留存百分比" + }, + "ecpm": { + "type": "string", + "example": "现-ecpm(元)" + }, + "exposure_count": { + "type": "string", + "example": "曝光量" + }, + "extra_revenue_rate": { + "type": "string", + "example": "额外收益百分比" + }, + "media_revenue_rate": { + "type": "string", + "example": "媒体收益百分比" + }, + "old_ecpm": { + "type": "string", + "example": "原-ecpm(元)" + }, + "platform_retention_rate": { + "type": "string", + "example": "平台留存百分比" + } + } + }, "md.MediumListData": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 793a8de..09a3199 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1106,7 +1106,7 @@ "200": { "description": "具体看返回内容 ", "schema": { - "type": "string" + "$ref": "#/definitions/md.MediumDivisionStrategy" } }, "400": { @@ -1823,9 +1823,56 @@ } } }, + "/api/financeCenter/platform/list": { + "post": { + "description": "财务中心-平台报表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "财务中心------嘉俊" + ], + "summary": "平台报表", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataReq" + } + } + ], + "responses": { + "200": { + "description": "具体看返回内容 这是data里面的数据", + "schema": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataRes" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/index/app/list": { "post": { - "description": "数据中心-数据明细", + "description": "首页-应用数据", "consumes": [ "application/json" ], @@ -1833,9 +1880,9 @@ "application/json" ], "tags": [ - "数据中心------嘉俊" + "首页------嘉俊" ], - "summary": "数据明细", + "summary": "应用数据", "parameters": [ { "type": "string", @@ -6476,6 +6523,82 @@ } } }, + "md.FinanceCenterPlatformDataData": { + "type": "object", + "properties": { + "agent_income": { + "type": "string", + "example": "代理结算" + }, + "change_income": { + "type": "string", + "example": "调价留存" + }, + "commission_income": { + "type": "string", + "example": "佣金留存" + }, + "id": { + "type": "string" + }, + "medium_income": { + "type": "string", + "example": "媒体结算" + }, + "platform_income": { + "type": "string", + "example": "平台留存" + }, + "time_str": { + "type": "string", + "example": "业务时间" + }, + "top_income": { + "type": "string", + "example": "上游结算" + }, + "update_at": { + "type": "string", + "example": "更新时间" + } + } + }, + "md.FinanceCenterPlatformDataReq": { + "type": "object", + "properties": { + "date": { + "type": "string", + "example": "2024-08-29" + }, + "end_time": { + "type": "string" + }, + "limit": { + "type": "string" + }, + "page": { + "type": "string" + }, + "start_time": { + "type": "string", + "example": "2024-08-29" + } + } + }, + "md.FinanceCenterPlatformDataRes": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.FinanceCenterPlatformDataData" + } + }, + "total": { + "type": "integer" + } + } + }, "md.IndexAppListData": { "type": "object", "properties": { @@ -6633,6 +6756,47 @@ } } }, + "md.MediumDivisionStrategy": { + "type": "object", + "properties": { + "agent_revenue_rate": { + "type": "string", + "example": "代理收益百分比" + }, + "agreement_sharing_rate": { + "type": "string", + "example": "协议分成百分比" + }, + "commission_retention_rate": { + "type": "string", + "example": "佣金留存百分比" + }, + "ecpm": { + "type": "string", + "example": "现-ecpm(元)" + }, + "exposure_count": { + "type": "string", + "example": "曝光量" + }, + "extra_revenue_rate": { + "type": "string", + "example": "额外收益百分比" + }, + "media_revenue_rate": { + "type": "string", + "example": "媒体收益百分比" + }, + "old_ecpm": { + "type": "string", + "example": "原-ecpm(元)" + }, + "platform_retention_rate": { + "type": "string", + "example": "平台留存百分比" + } + } + }, "md.MediumListData": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8f4afa8..e6ddfcb 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1444,6 +1444,59 @@ definitions: total: type: integer type: object + md.FinanceCenterPlatformDataData: + properties: + agent_income: + example: 代理结算 + type: string + change_income: + example: 调价留存 + type: string + commission_income: + example: 佣金留存 + type: string + id: + type: string + medium_income: + example: 媒体结算 + type: string + platform_income: + example: 平台留存 + type: string + time_str: + example: 业务时间 + type: string + top_income: + example: 上游结算 + type: string + update_at: + example: 更新时间 + type: string + type: object + md.FinanceCenterPlatformDataReq: + properties: + date: + example: "2024-08-29" + type: string + end_time: + type: string + limit: + type: string + page: + type: string + start_time: + example: "2024-08-29" + type: string + type: object + md.FinanceCenterPlatformDataRes: + properties: + list: + items: + $ref: '#/definitions/md.FinanceCenterPlatformDataData' + type: array + total: + type: integer + type: object md.IndexAppListData: properties: list: @@ -1549,6 +1602,36 @@ definitions: token: type: string type: object + md.MediumDivisionStrategy: + properties: + agent_revenue_rate: + example: 代理收益百分比 + type: string + agreement_sharing_rate: + example: 协议分成百分比 + type: string + commission_retention_rate: + example: 佣金留存百分比 + type: string + ecpm: + example: 现-ecpm(元) + type: string + exposure_count: + example: 曝光量 + type: string + extra_revenue_rate: + example: 额外收益百分比 + type: string + media_revenue_rate: + example: 媒体收益百分比 + type: string + old_ecpm: + example: 原-ecpm(元) + type: string + platform_retention_rate: + example: 平台留存百分比 + type: string + type: object md.MediumListData: properties: account: @@ -2874,7 +2957,7 @@ paths: "200": description: '具体看返回内容 ' schema: - type: string + $ref: '#/definitions/md.MediumDivisionStrategy' "400": description: 具体错误 schema: @@ -3347,11 +3430,42 @@ paths: summary: 媒体详情-结算单保存 tags: - 财务中心------嘉俊 + /api/financeCenter/platform/list: + post: + consumes: + - application/json + description: 财务中心-平台报表 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.FinanceCenterPlatformDataReq' + produces: + - application/json + responses: + "200": + description: 具体看返回内容 这是data里面的数据 + schema: + $ref: '#/definitions/md.FinanceCenterPlatformDataRes' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 平台报表 + tags: + - 财务中心------嘉俊 /api/index/app/list: post: consumes: - application/json - description: 数据中心-数据明细 + description: 首页-应用数据 parameters: - description: 验证参数Bearer和token空格拼接 in: header @@ -3375,9 +3489,9 @@ paths: description: 具体错误 schema: $ref: '#/definitions/md.Response' - summary: 数据明细 + summary: 应用数据 tags: - - 数据中心------嘉俊 + - 首页------嘉俊 /api/index/base: get: consumes: diff --git a/go.mod b/go.mod index 2973b84..2255bf8 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +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.20240903070022-54fb3bc36c87 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 @@ -35,7 +36,6 @@ require ( require ( code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240902065422-a58ca385e5a0 github.com/jinzhu/copier v0.4.0 )