From 811c949b6c37c55749c5c79d5815ea1f38f97f5d Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 12 Nov 2024 17:02:10 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=9F=A5=E8=AF=A2=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../egg_energy/hdl_available_energy.go | 70 ++++++- .../egg_energy/md_available_energy.go | 43 +++++ .../{md_egg_energy.go => md_user_coin.go} | 14 +- app/router/router.go | 2 +- docs/docs.go | 176 ++++++++++++++++++ docs/swagger.json | 176 ++++++++++++++++++ docs/swagger.yaml | 118 ++++++++++++ 7 files changed, 588 insertions(+), 11 deletions(-) create mode 100644 app/md/institutional_management/egg_energy/md_available_energy.go rename app/md/institutional_management/egg_energy/{md_egg_energy.go => md_user_coin.go} (90%) diff --git a/app/hdl/institutional_management/egg_energy/hdl_available_energy.go b/app/hdl/institutional_management/egg_energy/hdl_available_energy.go index ae96dc8..99ebf86 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_available_energy.go +++ b/app/hdl/institutional_management/egg_energy/hdl_available_energy.go @@ -1,13 +1,31 @@ package egg_energy import ( + "applet/app/db" "applet/app/e" + md "applet/app/md/institutional_management/egg_energy" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/enum" - "fmt" "github.com/gin-gonic/gin" ) +// DynamicDataFlowList +// @Summary 制度中心-动态数据-动态数据流水(获取) +// @Tags 公排管理 +// @Description 动态数据流水(获取) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.DynamicDataFlowListReq true "页数、每页大小必传 起止时间、持有类型选传" +// @Success 200 {object} md.DynamicDataFlowListResp "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/availableEnergy/list [post] func DynamicDataFlowList(c *gin.Context) { + var req *md.DynamicDataFlowListReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } var kindList = []map[string]interface{}{ { @@ -48,6 +66,52 @@ func DynamicDataFlowList(c *gin.Context) { }, } - fmt.Println(kindList) - e.OutSuc(c, kindList, nil) + energyFlowDb := implement.NewEggEnergyAvailableEnergyFlowDb(db.Db) + flows, total, err := energyFlowDb.EggEnergyAvailableEnergyFlowFindAndCount(req.Kind, req.Page, req.PageSize, req.StartAt, req.EndAt) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + list := make([]md.EggEnergyAvailableEnergyFlow, len(flows)) + for i, flow := range flows { + list[i] = md.EggEnergyAvailableEnergyFlow{ + Id: flow.Id, + Kind: flow.Kind, + Title: flow.Title, + BeforePrice: flow.BeforePrice, + AfterPrice: flow.AfterPrice, + Amount: flow.Amount, + BeforeNowEnergyTotalNums: flow.BeforeNowEnergyTotalNums, + AfterNowEnergyTotalNums: flow.AfterNowEnergyTotalNums, + AfterPlanetTotalValue: flow.AfterPlanetTotalValue, + BeforePlanetTotalValue: flow.BeforePlanetTotalValue, + BeforeMarketplaceMerchantValues: flow.BeforeMarketplaceMerchantValues, + AfterMarketplaceMerchantValues: flow.AfterMarketplaceMerchantValues, + BeforeMarketplaceMerchantFundValues: flow.BeforeMarketplaceMerchantFundValues, + AfterMarketplaceMerchantFundValues: flow.AfterMarketplaceMerchantFundValues, + BeforeDevelopmentCommitteeValues: flow.BeforeDevelopmentCommitteeValues, + AfterDevelopmentCommitteeValues: flow.AfterDevelopmentCommitteeValues, + BeforePublicWelfareAndCharityValues: flow.BeforePublicWelfareAndCharityValues, + AfterPublicWelfareAndCharityValues: flow.AfterPublicWelfareAndCharityValues, + BeforeStarLevelDividendsValues: flow.BeforeStarLevelDividendsValues, + AfterStarLevelDividendsValues: flow.AfterStarLevelDividendsValues, + BeforeDestructionQuantityValues: flow.BeforeDestructionQuantityValues, + AfterDestructionQuantityValues: flow.AfterDestructionQuantityValues, + BeforeCommunityDividends: flow.BeforeCommunityDividends, + AfterCommunityDividends: flow.AfterCommunityDividends, + CreateTime: flow.CreateTime, + } + } + + resp := md.DynamicDataFlowListResp{ + KindList: kindList, + List: list, + Paginate: md.Paginate{ + Limit: req.PageSize, + Page: req.Page, + Total: total, + }, + } + + e.OutSuc(c, resp, nil) } diff --git a/app/md/institutional_management/egg_energy/md_available_energy.go b/app/md/institutional_management/egg_energy/md_available_energy.go new file mode 100644 index 0000000..9113e61 --- /dev/null +++ b/app/md/institutional_management/egg_energy/md_available_energy.go @@ -0,0 +1,43 @@ +package md + +type DynamicDataFlowListReq struct { + Kind int `json:"kind"` // 持有类型 + Page int `json:"page,required"` // 页数 + PageSize int `json:"page_size,required"` // 每页大小 + StartAt string `json:"start_at" example:"开始时间"` // 开始时间 + EndAt string `json:"end_at" example:"结束时间"` // 结束时间 +} + +type EggEnergyAvailableEnergyFlow struct { + Id int64 `json:"id"` + Kind int `json:"kind"` + Title string `json:"title"` + BeforePrice string `json:"before_price"` + AfterPrice string `json:"after_price"` + Amount string `json:"amount"` + BeforeNowEnergyTotalNums string `json:"before_now_energy_total_nums"` + AfterNowEnergyTotalNums string `json:"after_now_energy_total_nums"` + AfterPlanetTotalValue string `json:"after_planet_total_value"` + BeforePlanetTotalValue string `json:"before_planet_total_value"` + BeforeMarketplaceMerchantValues string `json:"before_marketplace_merchant_values"` + AfterMarketplaceMerchantValues string `json:"after_marketplace_merchant_values"` + BeforeMarketplaceMerchantFundValues string `json:"before_marketplace_merchant_fund_values"` + AfterMarketplaceMerchantFundValues string `json:"after_marketplace_merchant_fund_values"` + BeforeDevelopmentCommitteeValues string `json:"before_development_committee_values"` + AfterDevelopmentCommitteeValues string `json:"after_development_committee_values"` + BeforePublicWelfareAndCharityValues string `json:"before_public_welfare_and_charity_values"` + AfterPublicWelfareAndCharityValues string `json:"after_public_welfare_and_charity_values"` + BeforeStarLevelDividendsValues string `json:"before_star_level_dividends_values"` + AfterStarLevelDividendsValues string `json:"after_star_level_dividends_values"` + BeforeDestructionQuantityValues string `json:"before_destruction_quantity_values"` + AfterDestructionQuantityValues string `json:"after_destruction_quantity_values"` + BeforeCommunityDividends string `json:"before_community_dividends"` + AfterCommunityDividends string `json:"after_community_dividends"` + CreateTime string `json:"create_time"` +} + +type DynamicDataFlowListResp struct { + KindList []map[string]interface{} `json:"kind_list"` + List []EggEnergyAvailableEnergyFlow `json:"list"` + Paginate Paginate `json:"paginate"` +} diff --git a/app/md/institutional_management/egg_energy/md_egg_energy.go b/app/md/institutional_management/egg_energy/md_user_coin.go similarity index 90% rename from app/md/institutional_management/egg_energy/md_egg_energy.go rename to app/md/institutional_management/egg_energy/md_user_coin.go index 35ff21c..d7848bc 100644 --- a/app/md/institutional_management/egg_energy/md_egg_energy.go +++ b/app/md/institutional_management/egg_energy/md_user_coin.go @@ -91,13 +91,13 @@ type GetGreenEnergyUserCoinListResp struct { } type GetGreenEnergyUserCoinFlowListReq struct { - CoinId int `json:"coin_id"` // 货币类型 ID - Direction int `json:"direction"` // 流水方向:1收入 2支出 - StartAt string `json:"start_at"` // 开始时间 - EndAt string `json:"end_at"` // 结束时间 - Page int `json:"page"` // 页数 - PageSize int `json:"page_size"` // 每页大小 - Uid int64 `json:"uid"` // 用户 ID + CoinId int `json:"coin_id,required"` // 货币类型 ID + Direction int `json:"direction"` // 流水方向:1收入 2支出 + StartAt string `json:"start_at"` // 开始时间 + EndAt string `json:"end_at"` // 结束时间 + Page int `json:"page,required"` // 页数 + PageSize int `json:"page_size,required"` // 每页大小 + Uid int64 `json:"uid,required"` // 用户 ID } type GetGreenEnergyUserCoinFlowListResp struct { diff --git a/app/router/router.go b/app/router/router.go index c0fdd9d..a841c2c 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -95,7 +95,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rEggEnergyUserCoin.POST("/greenEnergyUserCoinList", egg_energy.GetGreenEnergyUserCoinList) rEggEnergyUserCoin.POST("/greenEnergyUserCoinFlowList", egg_energy.GetGreenEnergyUserCoinFlowList) } - rEggEnergyAvailableEnergy := rPublicPlatoon.Group("/availableEnergy") + rEggEnergyAvailableEnergy := rEggEnergy.Group("/availableEnergy") { rEggEnergyAvailableEnergy.POST("/list", egg_energy.DynamicDataFlowList) } diff --git a/docs/docs.go b/docs/docs.go index 4677830..1ae681e 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -63,6 +63,53 @@ const docTemplate = `{ } } }, + "/api/institutionalManagement/availableEnergy/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": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.DynamicDataFlowListReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.DynamicDataFlowListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/userCoin/activePointsUserCoinFlowList": { "post": { "description": "活跃积分持有流水(查询)", @@ -1036,6 +1083,135 @@ const docTemplate = `{ } } }, + "md.DynamicDataFlowListReq": { + "type": "object", + "properties": { + "end_at": { + "description": "结束时间", + "type": "string" + }, + "kind": { + "description": "持有类型", + "type": "integer" + }, + "page": { + "description": "页数", + "type": "integer" + }, + "page_size": { + "description": "每页大小", + "type": "integer" + }, + "start_at": { + "description": "开始时间", + "type": "string" + } + } + }, + "md.DynamicDataFlowListResp": { + "type": "object", + "properties": { + "kind_list": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.EggEnergyAvailableEnergyFlow" + } + }, + "paginate": { + "$ref": "#/definitions/applet_app_md_institutional_management_egg_energy.Paginate" + } + } + }, + "md.EggEnergyAvailableEnergyFlow": { + "type": "object", + "properties": { + "after_community_dividends": { + "type": "string" + }, + "after_destruction_quantity_values": { + "type": "string" + }, + "after_development_committee_values": { + "type": "string" + }, + "after_marketplace_merchant_fund_values": { + "type": "string" + }, + "after_marketplace_merchant_values": { + "type": "string" + }, + "after_now_energy_total_nums": { + "type": "string" + }, + "after_planet_total_value": { + "type": "string" + }, + "after_price": { + "type": "string" + }, + "after_public_welfare_and_charity_values": { + "type": "string" + }, + "after_star_level_dividends_values": { + "type": "string" + }, + "amount": { + "type": "string" + }, + "before_community_dividends": { + "type": "string" + }, + "before_destruction_quantity_values": { + "type": "string" + }, + "before_development_committee_values": { + "type": "string" + }, + "before_marketplace_merchant_fund_values": { + "type": "string" + }, + "before_marketplace_merchant_values": { + "type": "string" + }, + "before_now_energy_total_nums": { + "type": "string" + }, + "before_planet_total_value": { + "type": "string" + }, + "before_price": { + "type": "string" + }, + "before_public_welfare_and_charity_values": { + "type": "string" + }, + "before_star_level_dividends_values": { + "type": "string" + }, + "coin_id": { + "type": "integer" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "kind": { + "type": "integer" + }, + "title": { + "type": "string" + } + } + }, "md.EggEnergyCommunityDividends": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 2ade53c..e6da8bf 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -56,6 +56,53 @@ } } }, + "/api/institutionalManagement/availableEnergy/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": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.DynamicDataFlowListReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.DynamicDataFlowListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/userCoin/activePointsUserCoinFlowList": { "post": { "description": "活跃积分持有流水(查询)", @@ -1029,6 +1076,135 @@ } } }, + "md.DynamicDataFlowListReq": { + "type": "object", + "properties": { + "end_at": { + "description": "结束时间", + "type": "string" + }, + "kind": { + "description": "持有类型", + "type": "integer" + }, + "page": { + "description": "页数", + "type": "integer" + }, + "page_size": { + "description": "每页大小", + "type": "integer" + }, + "start_at": { + "description": "开始时间", + "type": "string" + } + } + }, + "md.DynamicDataFlowListResp": { + "type": "object", + "properties": { + "kind_list": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.EggEnergyAvailableEnergyFlow" + } + }, + "paginate": { + "$ref": "#/definitions/applet_app_md_institutional_management_egg_energy.Paginate" + } + } + }, + "md.EggEnergyAvailableEnergyFlow": { + "type": "object", + "properties": { + "after_community_dividends": { + "type": "string" + }, + "after_destruction_quantity_values": { + "type": "string" + }, + "after_development_committee_values": { + "type": "string" + }, + "after_marketplace_merchant_fund_values": { + "type": "string" + }, + "after_marketplace_merchant_values": { + "type": "string" + }, + "after_now_energy_total_nums": { + "type": "string" + }, + "after_planet_total_value": { + "type": "string" + }, + "after_price": { + "type": "string" + }, + "after_public_welfare_and_charity_values": { + "type": "string" + }, + "after_star_level_dividends_values": { + "type": "string" + }, + "amount": { + "type": "string" + }, + "before_community_dividends": { + "type": "string" + }, + "before_destruction_quantity_values": { + "type": "string" + }, + "before_development_committee_values": { + "type": "string" + }, + "before_marketplace_merchant_fund_values": { + "type": "string" + }, + "before_marketplace_merchant_values": { + "type": "string" + }, + "before_now_energy_total_nums": { + "type": "string" + }, + "before_planet_total_value": { + "type": "string" + }, + "before_price": { + "type": "string" + }, + "before_public_welfare_and_charity_values": { + "type": "string" + }, + "before_star_level_dividends_values": { + "type": "string" + }, + "coin_id": { + "type": "integer" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "kind": { + "type": "integer" + }, + "title": { + "type": "string" + } + } + }, "md.EggEnergyCommunityDividends": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index cfc8646..e49e3b3 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -99,6 +99,93 @@ definitions: description: 团队人数 type: integer type: object + md.DynamicDataFlowListReq: + properties: + end_at: + description: 结束时间 + type: string + kind: + description: 持有类型 + type: integer + page: + description: 页数 + type: integer + page_size: + description: 每页大小 + type: integer + start_at: + description: 开始时间 + type: string + type: object + md.DynamicDataFlowListResp: + properties: + kind_list: + items: + additionalProperties: true + type: object + type: array + list: + items: + $ref: '#/definitions/md.EggEnergyAvailableEnergyFlow' + type: array + paginate: + $ref: '#/definitions/applet_app_md_institutional_management_egg_energy.Paginate' + type: object + md.EggEnergyAvailableEnergyFlow: + properties: + after_community_dividends: + type: string + after_destruction_quantity_values: + type: string + after_development_committee_values: + type: string + after_marketplace_merchant_fund_values: + type: string + after_marketplace_merchant_values: + type: string + after_now_energy_total_nums: + type: string + after_planet_total_value: + type: string + after_price: + type: string + after_public_welfare_and_charity_values: + type: string + after_star_level_dividends_values: + type: string + amount: + type: string + before_community_dividends: + type: string + before_destruction_quantity_values: + type: string + before_development_committee_values: + type: string + before_marketplace_merchant_fund_values: + type: string + before_marketplace_merchant_values: + type: string + before_now_energy_total_nums: + type: string + before_planet_total_value: + type: string + before_price: + type: string + before_public_welfare_and_charity_values: + type: string + before_star_level_dividends_values: + type: string + coin_id: + type: integer + create_time: + type: string + id: + type: integer + kind: + type: integer + title: + type: string + type: object md.EggEnergyCommunityDividends: properties: coin_id: @@ -690,6 +777,37 @@ paths: summary: Demo测试 tags: - Demo + /api/institutionalManagement/availableEnergy/list: + post: + consumes: + - application/json + description: 动态数据流水(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 页数、每页大小必传 起止时间、持有类型选传 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.DynamicDataFlowListReq' + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + $ref: '#/definitions/md.DynamicDataFlowListResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-动态数据-动态数据流水(获取) + tags: + - 公排管理 /api/institutionalManagement/eggEnergy/userCoin/activePointsUserCoinFlowList: post: consumes: