Kaynağa Gözat

更新

master
huangjiajun 2 hafta önce
ebeveyn
işleme
e993981bb4
10 değiştirilmiş dosya ile 728 ekleme ve 9 silme
  1. +59
    -0
      app/hdl/hdl_financial_dynamics.go
  2. +35
    -0
      app/md/md_financial_dynamics.go
  3. +4
    -0
      app/md/md_settle_center.go
  4. +13
    -8
      app/router/router.go
  5. +71
    -0
      app/svc/svc_financial_dynamics.go
  6. +2
    -0
      app/svc/svc_settle_center.go
  7. +203
    -0
      docs/docs.go
  8. +203
    -0
      docs/swagger.json
  9. +137
    -0
      docs/swagger.yaml
  10. +1
    -1
      go.mod

+ 59
- 0
app/hdl/hdl_financial_dynamics.go Dosyayı Görüntüle

@@ -0,0 +1,59 @@
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/total [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
}

+ 35
- 0
app/md/md_financial_dynamics.go Dosyayı Görüntüle

@@ -0,0 +1,35 @@
package md

type FinancialDynamicsMediumListReq struct {
Limit string `json:"limit"`
Page string `json:"page" `
StartTime string `json:"start_time" example:"2024-08-29 00:00:00"`
EndTime string `json:"end_time" `
}
type FinancialDynamicsMediumTotalReq struct {
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"`
BusinessKind []SelectData `json:"business_kind"`
PayMethod []SelectData `json:"pay_method"`
}

type FinancialDynamicsMediumListData struct {
Id string `json:"id"`
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:"预付次数"`
}

+ 4
- 0
app/md/md_settle_center.go Dosyayı Görüntüle

@@ -9,6 +9,10 @@ var AccountSettleState = []SelectData{
var BusinessKind = []SelectData{
{Name: "广告合作", Value: "1"},
}
var PayMethod = []SelectData{
{Name: "对私账户", Value: "0"},
{Name: "对公账户", Value: "1"},
}
var InvoiceCate = []SelectData{
{Name: "电子发票", Value: "0"},
{Name: "纸质发票", Value: "1"},


+ 13
- 8
app/router/router.go Dosyayı Görüntüle

@@ -64,14 +64,15 @@ func route(r *gin.RouterGroup) {
r.POST("/qiniuyun/upload", hdl.ImgReqUpload) //七牛云上传
r.POST("/sms", hdl.Sms) //短信发送
}
r.Use(mw.Auth) // 以下接口需要JWT验证
rRole(r.Group("/role")) //权限管理
rIndex(r.Group("/index")) //首页
rApplication(r.Group("/application")) //应用管理
rAccount(r.Group("/account")) //账号中心
rSettleCenter(r.Group("/settleCenter")) //结算中心
rInvoiceCenter(r.Group("/invoiceCenter")) //发票中心
rDataCenter(r.Group("/dataCenter")) //数据中心
r.Use(mw.Auth) // 以下接口需要JWT验证
rRole(r.Group("/role")) //权限管理
rIndex(r.Group("/index")) //首页
rApplication(r.Group("/application")) //应用管理
rAccount(r.Group("/account")) //账号中心
rSettleCenter(r.Group("/settleCenter")) //结算中心
rInvoiceCenter(r.Group("/invoiceCenter")) //发票中心
rDataCenter(r.Group("/dataCenter")) //数据中心
rFinancialDynamics(r.Group("/financialDynamics")) //资产动态
}

func rRole(r *gin.RouterGroup) {
@@ -128,3 +129,7 @@ func rIndex(r *gin.RouterGroup) {
r.GET("/total", hdl.IndexTotal) //首页-统计数据
r.POST("/app/list", hdl.IndexAppList) //首页-应用数据
}
func rFinancialDynamics(r *gin.RouterGroup) {
r.POST("/medium/total", hdl.FinancialDynamicsMediumTotal) //资产动态-媒体预付统计
r.POST("/medium/list", hdl.FinancialDynamicsMediumList) //资产动态-媒体预付
}

+ 71
- 0
app/svc/svc_financial_dynamics.go Dosyayı Görüntüle

@@ -0,0 +1,71 @@
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"
"fmt"
"github.com/gin-gonic/gin"
)

func FinancialDynamicsMediumList(c *gin.Context, req md.FinancialDynamicsMediumListReq) md.FinancialDynamicsMediumListRes {
engine := db.Db
NewMediumFinancialDynamicsDb := implement.NewMediumFinancialDynamicsDb(engine)
user := GetUser(c)
list, total, _ := NewMediumFinancialDynamicsDb.FindMediumFinancialDynamics(c.GetString("mid"), utils.IntToStr(user.MediumId), 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),
}
data = append(data, tmp)
}
}
res := md.FinancialDynamicsMediumListRes{
List: data,
Total: total,
PayMethod: md.PayMethod,
BusinessKind: md.BusinessKind,
}
return res
}
func FinancialDynamicsMediumTotal(c *gin.Context, req md.FinancialDynamicsMediumTotalReq) md.FinancialDynamicsMediumTotalRes {
engine := db.Db
sql := `select sum(amount) as amount,COUNT(*) as count from %s where %s`
where := "uuid=" + c.GetString("mid")
user := GetUser(c)
where += " and medium_id=" + utils.IntToStr(user.MediumId)
sql1 := fmt.Sprintf(sql, "medium_list", where)
res := md.FinancialDynamicsMediumTotalRes{
BalanceAmount: "0.00",
AllAmount: "0.00",
UseAmount: "0.00",
PayCount: "0",
}
nativeString, _ := db.QueryNativeString(engine, sql1)
for _, v := range nativeString {
if utils.StrToFloat64(v["amount"]) > 0 {
res.BalanceAmount = v["amount"]
}
}
sql2 := fmt.Sprintf(sql, "medium_financial_dynamics", where)
nativeString2, _ := db.QueryNativeString(engine, sql2)
for _, v := range nativeString2 {
if utils.StrToFloat64(v["amount"]) > 0 {
res.AllAmount = v["amount"]
}
if utils.StrToFloat64(v["count"]) > 0 {
res.PayCount = v["count"]
}
}
res.UseAmount = utils.Float64ToStr(utils.StrToFloat64(res.AllAmount) - utils.StrToFloat64(res.BalanceAmount))
return res
}

+ 2
- 0
app/svc/svc_settle_center.go Dosyayı Görüntüle

@@ -128,6 +128,8 @@ func SettleCenterInvoiceSave(c *gin.Context, req md.InvoiceReq) {
if invoice == nil {
invoice = &model.MediumInvoice{
SettlementId: data.Id,
Uuid: utils.StrToInt(c.GetString("mid")),
MediumId: data.MediumId,
CreateAt: time.Now().Format("2006-01-02 15:04:05"),
UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
}


+ 203
- 0
docs/docs.go Dosyayı Görüntüle

@@ -741,6 +741,100 @@ const docTemplate = `{
}
}
},
"/api/financialDynamics/medium/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.FinancialDynamicsMediumListReq"
}
}
],
"responses": {
"200": {
"description": "具体看返回内容 这是data里面的数据",
"schema": {
"$ref": "#/definitions/md.FinancialDynamicsMediumListRes"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/financialDynamics/medium/total": {
"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.FinancialDynamicsMediumTotalReq"
}
}
],
"responses": {
"200": {
"description": "具体看返回内容 这是data里面的数据",
"schema": {
"$ref": "#/definitions/md.FinancialDynamicsMediumTotalRes"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/index/app/list": {
"post": {
"description": "数据中心-数据明细",
@@ -2566,6 +2660,115 @@ const docTemplate = `{
}
}
},
"md.FinancialDynamicsMediumListData": {
"type": "object",
"properties": {
"amount": {
"type": "string",
"example": "支付金额"
},
"business_kind": {
"type": "string",
"example": "支付类型(1:广告合作)"
},
"certificate": {
"type": "string",
"example": "支付凭证"
},
"id": {
"type": "string"
},
"memo": {
"type": "string",
"example": "备注"
},
"pay_method": {
"type": "string",
"example": "支付方式 0对私 1对公"
},
"pay_time": {
"type": "string",
"example": "支付时间"
}
}
},
"md.FinancialDynamicsMediumListReq": {
"type": "object",
"properties": {
"end_time": {
"type": "string"
},
"limit": {
"type": "string"
},
"page": {
"type": "string"
},
"start_time": {
"type": "string",
"example": "2024-08-29 00:00:00"
}
}
},
"md.FinancialDynamicsMediumListRes": {
"type": "object",
"properties": {
"business_kind": {
"type": "array",
"items": {
"$ref": "#/definitions/md.SelectData"
}
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.FinancialDynamicsMediumListData"
}
},
"pay_method": {
"type": "array",
"items": {
"$ref": "#/definitions/md.SelectData"
}
},
"total": {
"type": "integer"
}
}
},
"md.FinancialDynamicsMediumTotalReq": {
"type": "object",
"properties": {
"end_time": {
"type": "string"
},
"start_time": {
"type": "string",
"example": "2024-08-29 00:00:00"
}
}
},
"md.FinancialDynamicsMediumTotalRes": {
"type": "object",
"properties": {
"all_amount": {
"type": "string",
"example": "预付总金额"
},
"balance_amount": {
"type": "string",
"example": "账户余额"
},
"pay_count": {
"type": "string",
"example": "预付次数"
},
"use_amount": {
"type": "string",
"example": "已消耗金额"
}
}
},
"md.ImgReqUpload": {
"type": "object",
"properties": {


+ 203
- 0
docs/swagger.json Dosyayı Görüntüle

@@ -733,6 +733,100 @@
}
}
},
"/api/financialDynamics/medium/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.FinancialDynamicsMediumListReq"
}
}
],
"responses": {
"200": {
"description": "具体看返回内容 这是data里面的数据",
"schema": {
"$ref": "#/definitions/md.FinancialDynamicsMediumListRes"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/financialDynamics/medium/total": {
"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.FinancialDynamicsMediumTotalReq"
}
}
],
"responses": {
"200": {
"description": "具体看返回内容 这是data里面的数据",
"schema": {
"$ref": "#/definitions/md.FinancialDynamicsMediumTotalRes"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/index/app/list": {
"post": {
"description": "数据中心-数据明细",
@@ -2558,6 +2652,115 @@
}
}
},
"md.FinancialDynamicsMediumListData": {
"type": "object",
"properties": {
"amount": {
"type": "string",
"example": "支付金额"
},
"business_kind": {
"type": "string",
"example": "支付类型(1:广告合作)"
},
"certificate": {
"type": "string",
"example": "支付凭证"
},
"id": {
"type": "string"
},
"memo": {
"type": "string",
"example": "备注"
},
"pay_method": {
"type": "string",
"example": "支付方式 0对私 1对公"
},
"pay_time": {
"type": "string",
"example": "支付时间"
}
}
},
"md.FinancialDynamicsMediumListReq": {
"type": "object",
"properties": {
"end_time": {
"type": "string"
},
"limit": {
"type": "string"
},
"page": {
"type": "string"
},
"start_time": {
"type": "string",
"example": "2024-08-29 00:00:00"
}
}
},
"md.FinancialDynamicsMediumListRes": {
"type": "object",
"properties": {
"business_kind": {
"type": "array",
"items": {
"$ref": "#/definitions/md.SelectData"
}
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.FinancialDynamicsMediumListData"
}
},
"pay_method": {
"type": "array",
"items": {
"$ref": "#/definitions/md.SelectData"
}
},
"total": {
"type": "integer"
}
}
},
"md.FinancialDynamicsMediumTotalReq": {
"type": "object",
"properties": {
"end_time": {
"type": "string"
},
"start_time": {
"type": "string",
"example": "2024-08-29 00:00:00"
}
}
},
"md.FinancialDynamicsMediumTotalRes": {
"type": "object",
"properties": {
"all_amount": {
"type": "string",
"example": "预付总金额"
},
"balance_amount": {
"type": "string",
"example": "账户余额"
},
"pay_count": {
"type": "string",
"example": "预付次数"
},
"use_amount": {
"type": "string",
"example": "已消耗金额"
}
}
},
"md.ImgReqUpload": {
"type": "object",
"properties": {


+ 137
- 0
docs/swagger.yaml Dosyayı Görüntüle

@@ -396,6 +396,81 @@ definitions:
platform_name:
type: string
type: object
md.FinancialDynamicsMediumListData:
properties:
amount:
example: 支付金额
type: string
business_kind:
example: 支付类型(1:广告合作)
type: string
certificate:
example: 支付凭证
type: string
id:
type: string
memo:
example: 备注
type: string
pay_method:
example: 支付方式 0对私 1对公
type: string
pay_time:
example: 支付时间
type: string
type: object
md.FinancialDynamicsMediumListReq:
properties:
end_time:
type: string
limit:
type: string
page:
type: string
start_time:
example: "2024-08-29 00:00:00"
type: string
type: object
md.FinancialDynamicsMediumListRes:
properties:
business_kind:
items:
$ref: '#/definitions/md.SelectData'
type: array
list:
items:
$ref: '#/definitions/md.FinancialDynamicsMediumListData'
type: array
pay_method:
items:
$ref: '#/definitions/md.SelectData'
type: array
total:
type: integer
type: object
md.FinancialDynamicsMediumTotalReq:
properties:
end_time:
type: string
start_time:
example: "2024-08-29 00:00:00"
type: string
type: object
md.FinancialDynamicsMediumTotalRes:
properties:
all_amount:
example: 预付总金额
type: string
balance_amount:
example: 账户余额
type: string
pay_count:
example: 预付次数
type: string
use_amount:
example: 已消耗金额
type: string
type: object
md.ImgReqUpload:
properties:
dir:
@@ -1391,6 +1466,68 @@ paths:
summary: 数据图表
tags:
- 数据中心------嘉俊
/api/financialDynamics/medium/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.FinancialDynamicsMediumListReq'
produces:
- application/json
responses:
"200":
description: 具体看返回内容 这是data里面的数据
schema:
$ref: '#/definitions/md.FinancialDynamicsMediumListRes'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 媒体预付
tags:
- 资产动态------嘉俊
/api/financialDynamics/medium/total:
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.FinancialDynamicsMediumTotalReq'
produces:
- application/json
responses:
"200":
description: 具体看返回内容 这是data里面的数据
schema:
$ref: '#/definitions/md.FinancialDynamicsMediumTotalRes'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 媒体预付-统计
tags:
- 资产动态------嘉俊
/api/index/app/list:
post:
consumes:


+ 1
- 1
go.mod Dosyayı Görüntüle

@@ -6,7 +6,7 @@ go 1.18

//
require (
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240902065422-a58ca385e5a0
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240904023523-1b174457882d
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


Yükleniyor…
İptal
Kaydet