From 8a0c190cf7ed823d67b358c09894c097d3fb79e2 Mon Sep 17 00:00:00 2001 From: chenlin Date: Wed, 25 Dec 2024 10:33:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0"=E5=8E=82=E5=AE=B6=E7=BC=96=E7=A0=81"=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/commodity.go | 8 ++ docs/docs.go | 152 ++++++++++++++++++++++++++++++++++ docs/swagger.json | 152 ++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 107 ++++++++++++++++++++++++ 4 files changed, 419 insertions(+) diff --git a/app/admin/models/commodity.go b/app/admin/models/commodity.go index 81f82f3..36b1a45 100644 --- a/app/admin/models/commodity.go +++ b/app/admin/models/commodity.go @@ -306,6 +306,7 @@ func (c *ErpCommodity) SetErpCategory() error { type ErpCommodityListReq struct { SerialNumber string `json:"serial_number"` // 商品编号 + ManufacturerCode string `json:"manufacturer_code"` // 厂家编码 ErpCommodityName string `json:"erp_commodity_name"` // 商品名称 ErpCategoryId uint32 `json:"erp_category_id"` // 商品分类id IMEI string `json:"imei"` // 串码 @@ -436,6 +437,9 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) { if m.SerialNumber != "" { qs = qs.Where("serial_number = ?", m.SerialNumber) } + if m.ManufacturerCode != "" { + qs = qs.Where("manufacturer_code = ?", m.ManufacturerCode) + } if m.ErpCommodityName != "" { qs = qs.Where("name LIKE ?", "%"+m.ErpCommodityName+"%") } @@ -526,6 +530,10 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) { startIndex = 0 page = 0 } + if startIndex > len(commodities) { + startIndex = 0 + page = 0 + } endIndex := (page + 1) * m.PageSize if endIndex > len(commodities) { endIndex = len(commodities) diff --git a/docs/docs.go b/docs/docs.go index 1b314f9..24fcdce 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1175,6 +1175,39 @@ const docTemplate = `{ } } }, + "/api/v1/decision/store_sales_report": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "门店销售对比", + "parameters": [ + { + "description": "门店销售对比数据模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpStoreSalesDataReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpStoreSalesDataResp" + } + } + } + } + }, "/api/v1/dept": { "put": { "security": [ @@ -8913,6 +8946,10 @@ const docTemplate = `{ "description": "1-导出", "type": "integer" }, + "manufacturer_code": { + "description": "厂家编码", + "type": "string" + }, "pageIndex": { "description": "页码", "type": "integer" @@ -12725,6 +12762,88 @@ const docTemplate = `{ } } }, + "models.ErpStoreSalesDataReq": { + "type": "object", + "properties": { + "end_time": { + "description": "结束时间", + "type": "string" + }, + "is_export": { + "description": "1-导出", + "type": "integer" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "sort_type": { + "description": "排序类型:desc 降序、asc 升序", + "type": "string" + }, + "start_time": { + "description": "开始时间", + "type": "string" + }, + "store_id": { + "description": "门店ID", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "models.ErpStoreSalesDataResp": { + "type": "object", + "properties": { + "export_url": { + "type": "string" + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.StoreSalesData" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + }, + "total_count": { + "description": "总销售数量", + "type": "integer" + }, + "total_promotion_fee": { + "description": "总推广费", + "type": "number" + }, + "total_sales_amount": { + "description": "总销售额", + "type": "number" + }, + "total_sales_profit": { + "description": "总销售毛利", + "type": "number" + }, + "total_staff_profit": { + "description": "总员工毛利", + "type": "number" + } + } + }, "models.ExecuteData": { "type": "object", "properties": { @@ -17290,6 +17409,39 @@ const docTemplate = `{ } } }, + "models.StoreSalesData": { + "type": "object", + "properties": { + "count": { + "description": "销售数量", + "type": "integer" + }, + "promotion_fee": { + "description": "推广费", + "type": "number" + }, + "sales_profit": { + "description": "销售毛利", + "type": "number" + }, + "staff_profit": { + "description": "员工毛利", + "type": "number" + }, + "store_id": { + "description": "门店id", + "type": "integer" + }, + "store_name": { + "description": "门店名称", + "type": "string" + }, + "total_sales_amount": { + "description": "销售额", + "type": "number" + } + } + }, "models.Supplier": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 92bf0b9..17aaf93 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1164,6 +1164,39 @@ } } }, + "/api/v1/decision/store_sales_report": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "门店销售对比", + "parameters": [ + { + "description": "门店销售对比数据模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpStoreSalesDataReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpStoreSalesDataResp" + } + } + } + } + }, "/api/v1/dept": { "put": { "security": [ @@ -8902,6 +8935,10 @@ "description": "1-导出", "type": "integer" }, + "manufacturer_code": { + "description": "厂家编码", + "type": "string" + }, "pageIndex": { "description": "页码", "type": "integer" @@ -12714,6 +12751,88 @@ } } }, + "models.ErpStoreSalesDataReq": { + "type": "object", + "properties": { + "end_time": { + "description": "结束时间", + "type": "string" + }, + "is_export": { + "description": "1-导出", + "type": "integer" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "sort_type": { + "description": "排序类型:desc 降序、asc 升序", + "type": "string" + }, + "start_time": { + "description": "开始时间", + "type": "string" + }, + "store_id": { + "description": "门店ID", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "models.ErpStoreSalesDataResp": { + "type": "object", + "properties": { + "export_url": { + "type": "string" + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.StoreSalesData" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + }, + "total_count": { + "description": "总销售数量", + "type": "integer" + }, + "total_promotion_fee": { + "description": "总推广费", + "type": "number" + }, + "total_sales_amount": { + "description": "总销售额", + "type": "number" + }, + "total_sales_profit": { + "description": "总销售毛利", + "type": "number" + }, + "total_staff_profit": { + "description": "总员工毛利", + "type": "number" + } + } + }, "models.ExecuteData": { "type": "object", "properties": { @@ -17279,6 +17398,39 @@ } } }, + "models.StoreSalesData": { + "type": "object", + "properties": { + "count": { + "description": "销售数量", + "type": "integer" + }, + "promotion_fee": { + "description": "推广费", + "type": "number" + }, + "sales_profit": { + "description": "销售毛利", + "type": "number" + }, + "staff_profit": { + "description": "员工毛利", + "type": "number" + }, + "store_id": { + "description": "门店id", + "type": "integer" + }, + "store_name": { + "description": "门店名称", + "type": "string" + }, + "total_sales_amount": { + "description": "销售额", + "type": "number" + } + } + }, "models.Supplier": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index c4b76aa..e5fc5c6 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1629,6 +1629,9 @@ definitions: is_export: description: 1-导出 type: integer + manufacturer_code: + description: 厂家编码 + type: string pageIndex: description: 页码 type: integer @@ -4413,6 +4416,65 @@ definitions: description: 数据总条数 type: integer type: object + models.ErpStoreSalesDataReq: + properties: + end_time: + description: 结束时间 + type: string + is_export: + description: 1-导出 + type: integer + pageIndex: + description: 页码 + type: integer + pageSize: + description: 页面条数 + type: integer + sort_type: + description: 排序类型:desc 降序、asc 升序 + type: string + start_time: + description: 开始时间 + type: string + store_id: + description: 门店ID + items: + type: integer + type: array + type: object + models.ErpStoreSalesDataResp: + properties: + export_url: + type: string + list: + items: + $ref: '#/definitions/models.StoreSalesData' + type: array + pageIndex: + description: 页码 + type: integer + pageSize: + description: 每页展示条数 + type: integer + total: + description: 总条数 + type: integer + total_count: + description: 总销售数量 + type: integer + total_promotion_fee: + description: 总推广费 + type: number + total_sales_amount: + description: 总销售额 + type: number + total_sales_profit: + description: 总销售毛利 + type: number + total_staff_profit: + description: 总员工毛利 + type: number + type: object models.ExecuteData: properties: commodity_serial_number: @@ -7693,6 +7755,30 @@ definitions: description: 销售额 type: number type: object + models.StoreSalesData: + properties: + count: + description: 销售数量 + type: integer + promotion_fee: + description: 推广费 + type: number + sales_profit: + description: 销售毛利 + type: number + staff_profit: + description: 员工毛利 + type: number + store_id: + description: 门店id + type: integer + store_name: + description: 门店名称 + type: string + total_sales_amount: + description: 销售额 + type: number + type: object models.Supplier: properties: account_holder: @@ -9702,6 +9788,27 @@ paths: summary: 进销存报表 tags: - 决策中心,V1.4.0 + /api/v1/decision/store_sales_report: + post: + consumes: + - application/json + parameters: + - description: 门店销售对比数据模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpStoreSalesDataReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.ErpStoreSalesDataResp' + summary: 门店销售对比 + tags: + - 决策中心,V1.4.0 /api/v1/dept: post: consumes: