From 78b49f03c4dc2e5b6b00d99475e582834e4b5238 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 07 八月 2023 20:14:20 +0800 Subject: [PATCH] 销售发票管理 --- service/invoiceStatus.go | 66 constvar/invoiceType.go | 12 api/v1/invoiceType.go | 112 + api/v1/invoiceStatus.go | 112 + docs/swagger.yaml | 715 ++++++++ api/v1/invoice.go | 127 + router/courierCompany.go | 17 router/invoiceStatus.go | 17 constvar/invoice.go | 20 router/invoiceType.go | 17 constvar/invoiceStatus.go | 12 model/invoice.go | 160 ++ model/invoiceType.go | 140 + service/courierCompany.go | 66 router/invoice.go | 17 docs/docs.go | 1102 +++++++++++++- service/invoice.go | 87 + docs/swagger.json | 1102 +++++++++++++- constvar/courierCompany.go | 12 model/courierCompany.go | 140 + model/request/invoice.go | 43 model/request/invoiceStatus.go | 22 api/v1/courierCompany.go | 112 + model/serviceContract.go | 64 model/invoiceStatus.go | 140 + service/invoiceType.go | 66 router/index.go | 4 model/request/courierCompany.go | 22 model/request/invoiceType.go | 22 29 files changed, 4,256 insertions(+), 292 deletions(-) diff --git a/api/v1/courierCompany.go b/api/v1/courierCompany.go new file mode 100644 index 0000000..a4806b2 --- /dev/null +++ b/api/v1/courierCompany.go @@ -0,0 +1,112 @@ +package v1 + +import ( + "aps_crm/model/request" + "aps_crm/model/response" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "aps_crm/service" + "github.com/gin-gonic/gin" + "strconv" +) + +type CourierCompanyApi struct{} + +// Add +// @Tags 鐗╂祦鍏徃 +// @Summary 娣诲姞鐗╂祦鍏徃 +// @Produce application/json +// @Param object body request.AddCourierCompany true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/courierCompany/add [post] +func (s *CourierCompanyApi) Add(c *gin.Context) { + var params request.AddCourierCompany + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewCourierCompanyService().AddCourierCompany(¶ms.CourierCompany) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Delete +// @Tags 鐗╂祦鍏徃 +// @Summary 鍒犻櫎鐗╂祦鍏徃 +// @Produce application/json +// @Param id path int true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/courierCompany/delete/{id} [delete] +func (s *CourierCompanyApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewCourierCompanyService().DeleteCourierCompany(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 鐗╂祦鍏徃 +// @Summary 鏇存柊鐗╂祦鍏徃 +// @Produce application/json +// @Param object body request.UpdateCourierCompany true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/courierCompany/update [put] +func (s *CourierCompanyApi) Update(c *gin.Context) { + var params request.UpdateCourierCompany + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.CourierCompany.Id = params.Id + + errCode := service.NewCourierCompanyService().UpdateCourierCompany(¶ms.CourierCompany) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 鐗╂祦鍏徃 +// @Summary 鑾峰彇鐗╂祦鍏徃鍒楄〃 +// @Produce application/json +// @Param object query request.GetCourierCompanyList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.CourierCompany} +// @Router /api/courierCompany/list [get] +func (s *CourierCompanyApi) List(c *gin.Context) { + var params request.GetCourierCompanyList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + courierCompany, total, errCode := service.NewCourierCompanyService().GetCourierCompanyList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: courierCompany, + Count: total, + }) +} diff --git a/api/v1/invoice.go b/api/v1/invoice.go new file mode 100644 index 0000000..68f5ecc --- /dev/null +++ b/api/v1/invoice.go @@ -0,0 +1,127 @@ +package v1 + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/model/response" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "aps_crm/pkg/structx" + "aps_crm/service" + "github.com/gin-gonic/gin" + "strconv" +) + +type InvoiceApi struct{} + +// Add +// @Tags 閿�鍞彂绁� +// @Summary 娣诲姞閿�鍞彂绁� +// @Produce application/json +// @Param object body request.AddInvoice true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoice/add [post] +func (s *InvoiceApi) Add(c *gin.Context) { + var params request.AddInvoice + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + var invoice model.Invoice + err := structx.AssignTo(params, &invoice) + + if err != nil { + ctx.Fail(ecode.ParamsErr) + return + } + + errCode := service.NewInvoiceService().AddInvoice(&invoice) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Delete +// @Tags 閿�鍞彂绁� +// @Summary 鍒犻櫎閿�鍞彂绁� +// @Produce application/json +// @Param id path int true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoice/delete/{id} [delete] +func (s *InvoiceApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewInvoiceService().DeleteInvoice(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 閿�鍞彂绁� +// @Summary 鏇存柊閿�鍞彂绁� +// @Produce application/json +// @Param object body request.UpdateInvoice true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoice/update [put] +func (s *InvoiceApi) Update(c *gin.Context) { + var params request.UpdateInvoice + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + var invoice model.Invoice + err := structx.AssignTo(params, &invoice) + + if err != nil { + ctx.Fail(ecode.ParamsErr) + return + } + + errCode := service.NewInvoiceService().UpdateInvoice(&invoice) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 閿�鍞彂绁� +// @Summary 鑾峰彇閿�鍞彂绁ㄥ垪琛� +// @Produce application/json +// @Param object query request.GetInvoiceList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.Invoice} +// @Router /api/invoice/list [get] +func (s *InvoiceApi) List(c *gin.Context) { + var params request.GetInvoiceList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + invoice, total, errCode := service.NewInvoiceService().GetInvoiceList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: invoice, + Count: total, + }) +} diff --git a/api/v1/invoiceStatus.go b/api/v1/invoiceStatus.go new file mode 100644 index 0000000..0834088 --- /dev/null +++ b/api/v1/invoiceStatus.go @@ -0,0 +1,112 @@ +package v1 + +import ( + "aps_crm/model/request" + "aps_crm/model/response" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "aps_crm/service" + "github.com/gin-gonic/gin" + "strconv" +) + +type InvoiceStatusApi struct{} + +// Add +// @Tags 鍙戠エ鐘舵�� +// @Summary 娣诲姞鍙戠エ鐘舵�� +// @Produce application/json +// @Param object body request.AddInvoiceStatus true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceStatus/add [post] +func (s *InvoiceStatusApi) Add(c *gin.Context) { + var params request.AddInvoiceStatus + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewInvoiceStatusService().AddInvoiceStatus(¶ms.InvoiceStatus) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Delete +// @Tags 鍙戠エ鐘舵�� +// @Summary 鍒犻櫎鍙戠エ鐘舵�� +// @Produce application/json +// @Param id path int true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceStatus/delete/{id} [delete] +func (s *InvoiceStatusApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewInvoiceStatusService().DeleteInvoiceStatus(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 鍙戠エ鐘舵�� +// @Summary 鏇存柊鍙戠エ鐘舵�� +// @Produce application/json +// @Param object body request.UpdateInvoiceStatus true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceStatus/update [put] +func (s *InvoiceStatusApi) Update(c *gin.Context) { + var params request.UpdateInvoiceStatus + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.InvoiceStatus.Id = params.Id + + errCode := service.NewInvoiceStatusService().UpdateInvoiceStatus(¶ms.InvoiceStatus) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 鍙戠エ鐘舵�� +// @Summary 鑾峰彇鍙戠エ鐘舵�佸垪琛� +// @Produce application/json +// @Param object query request.GetInvoiceStatusList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.InvoiceStatus} +// @Router /api/invoiceStatus/list [get] +func (s *InvoiceStatusApi) List(c *gin.Context) { + var params request.GetInvoiceStatusList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + invoiceStatus, total, errCode := service.NewInvoiceStatusService().GetInvoiceStatusList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: invoiceStatus, + Count: total, + }) +} diff --git a/api/v1/invoiceType.go b/api/v1/invoiceType.go new file mode 100644 index 0000000..673bdf3 --- /dev/null +++ b/api/v1/invoiceType.go @@ -0,0 +1,112 @@ +package v1 + +import ( + "aps_crm/model/request" + "aps_crm/model/response" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "aps_crm/service" + "github.com/gin-gonic/gin" + "strconv" +) + +type InvoiceTypeApi struct{} + +// Add +// @Tags 鍙戠エ绫诲瀷 +// @Summary 娣诲姞鍙戠エ绫诲瀷 +// @Produce application/json +// @Param object body request.AddInvoiceType true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceType/add [post] +func (s *InvoiceTypeApi) Add(c *gin.Context) { + var params request.AddInvoiceType + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewInvoiceTypeService().AddInvoiceType(¶ms.InvoiceType) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Delete +// @Tags 鍙戠エ绫诲瀷 +// @Summary 鍒犻櫎鍙戠エ绫诲瀷 +// @Produce application/json +// @Param id path int true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceType/delete/{id} [delete] +func (s *InvoiceTypeApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewInvoiceTypeService().DeleteInvoiceType(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 鍙戠エ绫诲瀷 +// @Summary 鏇存柊鍙戠エ绫诲瀷 +// @Produce application/json +// @Param object body request.UpdateInvoiceType true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/invoiceType/update [put] +func (s *InvoiceTypeApi) Update(c *gin.Context) { + var params request.UpdateInvoiceType + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.InvoiceType.Id = params.Id + + errCode := service.NewInvoiceTypeService().UpdateInvoiceType(¶ms.InvoiceType) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 鍙戠エ绫诲瀷 +// @Summary 鑾峰彇鍙戠エ绫诲瀷鍒楄〃 +// @Produce application/json +// @Param object query request.GetInvoiceTypeList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.InvoiceType} +// @Router /api/invoiceType/list [get] +func (s *InvoiceTypeApi) List(c *gin.Context) { + var params request.GetInvoiceTypeList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + invoiceType, total, errCode := service.NewInvoiceTypeService().GetInvoiceTypeList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: invoiceType, + Count: total, + }) +} diff --git a/constvar/courierCompany.go b/constvar/courierCompany.go new file mode 100644 index 0000000..648d18a --- /dev/null +++ b/constvar/courierCompany.go @@ -0,0 +1,12 @@ +package constvar +type CourierCompanyQueryClass string + +const ( + CourierCompanyQueryClassExpireLessThen60Days CourierCompanyQueryClass = "" +) + +type CourierCompanyKeywordType string + +const ( + CourierCompanyKeywordCustomerName CourierCompanyKeywordType = "" +) diff --git a/constvar/invoice.go b/constvar/invoice.go new file mode 100644 index 0000000..687d301 --- /dev/null +++ b/constvar/invoice.go @@ -0,0 +1,20 @@ +package constvar + +type InvoiceQueryClass string + +const ( + InvoiceQueryClassExpireLessThen60Days InvoiceQueryClass = "" +) + +type InvoiceKeywordType string + +const ( + InvoiceKeywordCustomerName InvoiceKeywordType = "" +) + +type InvoiceSourceType int + +const ( + InvoiceSourceTypeSaleDetail InvoiceSourceType = 1 + InvoiceSourceTypeServiceContract InvoiceSourceType = 2 +) diff --git a/constvar/invoiceStatus.go b/constvar/invoiceStatus.go new file mode 100644 index 0000000..068f4d6 --- /dev/null +++ b/constvar/invoiceStatus.go @@ -0,0 +1,12 @@ +package constvar +type InvoiceStatusQueryClass string + +const ( + InvoiceStatusQueryClassExpireLessThen60Days InvoiceStatusQueryClass = "" +) + +type InvoiceStatusKeywordType string + +const ( + InvoiceStatusKeywordCustomerName InvoiceStatusKeywordType = "" +) diff --git a/constvar/invoiceType.go b/constvar/invoiceType.go new file mode 100644 index 0000000..fb019b6 --- /dev/null +++ b/constvar/invoiceType.go @@ -0,0 +1,12 @@ +package constvar +type InvoiceTypeQueryClass string + +const ( + InvoiceTypeQueryClassExpireLessThen60Days InvoiceTypeQueryClass = "" +) + +type InvoiceTypeKeywordType string + +const ( + InvoiceTypeKeywordCustomerName InvoiceTypeKeywordType = "" +) diff --git a/docs/docs.go b/docs/docs.go index 93d955e..a511f91 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1623,6 +1623,169 @@ } } }, + "/api/courierCompany/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "娣诲姞鐗╂祦鍏徃", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddCourierCompany" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/courierCompany/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鍒犻櫎鐗╂祦鍏徃", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/courierCompany/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鑾峰彇鐗╂祦鍏徃鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "CourierCompanyKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "CourierCompanyQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.CourierCompany" + } + } + } + } + ] + } + } + } + } + }, + "/api/courierCompany/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鏇存柊鐗╂祦鍏徃", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateCourierCompany" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/currency/add": { "post": { "produces": [ @@ -2637,36 +2800,6 @@ } } }, - "/api/file/update": { - "put": { - "produces": [ - "application/json" - ], - "tags": [ - "闄勪欢绠$悊" - ], - "summary": "鏇存柊闄勪欢", - "parameters": [ - { - "description": "鏌ヨ鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.UpdateFile" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, "/api/followRecord/add": { "post": { "produces": [ @@ -2934,6 +3067,495 @@ "required": true, "schema": { "$ref": "#/definitions/request.UpdateIndustries" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "娣诲姞閿�鍞彂绁�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoice" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鍒犻櫎閿�鍞彂绁�", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鑾峰彇閿�鍞彂绁ㄥ垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Invoice" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoice/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鏇存柊閿�鍞彂绁�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoice" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "娣诲姞鍙戠エ鐘舵��", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoiceStatus" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鍒犻櫎鍙戠エ鐘舵��", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鑾峰彇鍙戠エ鐘舵�佸垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceStatusKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceStatusQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.InvoiceStatus" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoiceStatus/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鏇存柊鍙戠エ鐘舵��", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoiceStatus" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "娣诲姞鍙戠エ绫诲瀷", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoiceType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鍒犻櫎鍙戠エ绫诲瀷", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鑾峰彇鍙戠エ绫诲瀷鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceTypeKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceTypeQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.InvoiceType" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoiceType/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鏇存柊鍙戠エ绫诲瀷", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoiceType" } } ], @@ -8768,6 +9390,24 @@ "CollectionStatusCollected" ] }, + "constvar.CourierCompanyKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "CourierCompanyKeywordCustomerName" + ] + }, + "constvar.CourierCompanyQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "CourierCompanyQueryClassExpireLessThen60Days" + ] + }, "constvar.FaqKeywordType": { "type": "string", "enum": [ @@ -8802,6 +9442,60 @@ ], "x-enum-varnames": [ "FileQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceKeywordCustomerName" + ] + }, + "constvar.InvoiceQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceStatusKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceStatusKeywordCustomerName" + ] + }, + "constvar.InvoiceStatusQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceStatusQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceTypeKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceTypeKeywordCustomerName" + ] + }, + "constvar.InvoiceTypeQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceTypeQueryClassExpireLessThen60Days" ] }, "constvar.PaymentTypeKeywordType": { @@ -9417,6 +10111,17 @@ } } }, + "model.CourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "model.Currency": { "type": "object", "properties": { @@ -9516,14 +10221,6 @@ "description": "瀵硅薄瀛樺偍bucket", "type": "string" }, - "content": { - "description": "鏂囦欢鍐呭", - "type": "string" - }, - "createTime": { - "description": "鍒涘缓鏃堕棿", - "type": "string" - }, "downloadCount": { "description": "涓嬫娆℃暟", "type": "integer" @@ -9535,9 +10232,6 @@ "fileType": { "description": "鏂囦欢绫诲瀷", "type": "string" - }, - "id": { - "type": "integer" }, "key": { "description": "瀵硅薄瀛樺偍key", @@ -9560,9 +10254,6 @@ }, "sourceType": { "description": "闄勪欢鏉ユ簮", - "type": "string" - }, - "updateTime": { "type": "string" } } @@ -9624,6 +10315,96 @@ } }, "model.Industry": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "model.Invoice": { + "type": "object", + "properties": { + "client": { + "$ref": "#/definitions/model.Client" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompany": { + "$ref": "#/definitions/model.CourierCompany" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "id": { + "type": "integer" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "string" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatus": { + "$ref": "#/definitions/model.InvoiceStatus" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceType": { + "$ref": "#/definitions/model.InvoiceType" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "model.InvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "model.InvoiceType": { "type": "object", "properties": { "id": { @@ -11219,6 +12000,17 @@ } } }, + "request.AddCourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddCurrency": { "type": "object", "required": [ @@ -11322,6 +12114,81 @@ "name" ], "properties": { + "name": { + "type": "string" + } + } + }, + "request.AddInvoice": { + "type": "object", + "properties": { + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "string" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "request.AddInvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "request.AddInvoiceType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, "name": { "type": "string" } @@ -13524,6 +14391,17 @@ } } }, + "request.UpdateCourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateCurrency": { "type": "object", "required": [ @@ -13679,64 +14557,6 @@ } } }, - "request.UpdateFile": { - "type": "object", - "properties": { - "bucket": { - "description": "瀵硅薄瀛樺偍bucket", - "type": "string" - }, - "content": { - "description": "鏂囦欢鍐呭", - "type": "string" - }, - "createTime": { - "description": "鍒涘缓鏃堕棿", - "type": "string" - }, - "downloadCount": { - "description": "涓嬫娆℃暟", - "type": "integer" - }, - "filePath": { - "description": "鏂囦欢璺緞", - "type": "string" - }, - "fileType": { - "description": "鏂囦欢绫诲瀷", - "type": "string" - }, - "id": { - "type": "integer" - }, - "key": { - "description": "瀵硅薄瀛樺偍key", - "type": "string" - }, - "name": { - "type": "string" - }, - "previewCount": { - "description": "棰勮娆℃暟", - "type": "integer" - }, - "size": { - "description": "鏂囦欢澶у皬", - "type": "integer" - }, - "sourceId": { - "description": "鏉ユ簮id", - "type": "integer" - }, - "sourceType": { - "description": "闄勪欢鏉ユ簮", - "type": "string" - }, - "updateTime": { - "type": "string" - } - } - }, "request.UpdateFollowRecord": { "type": "object", "required": [ @@ -13780,6 +14600,84 @@ } } }, + "request.UpdateInvoice": { + "type": "object", + "properties": { + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "id": { + "type": "integer" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "integer" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "request.UpdateInvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "request.UpdateInvoiceType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateIsInvoice": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 930c3eb..1d5007d 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1611,6 +1611,169 @@ } } }, + "/api/courierCompany/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "娣诲姞鐗╂祦鍏徃", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddCourierCompany" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/courierCompany/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鍒犻櫎鐗╂祦鍏徃", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/courierCompany/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鑾峰彇鐗╂祦鍏徃鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "CourierCompanyKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "CourierCompanyQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.CourierCompany" + } + } + } + } + ] + } + } + } + } + }, + "/api/courierCompany/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鐗╂祦鍏徃" + ], + "summary": "鏇存柊鐗╂祦鍏徃", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateCourierCompany" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/currency/add": { "post": { "produces": [ @@ -2625,36 +2788,6 @@ } } }, - "/api/file/update": { - "put": { - "produces": [ - "application/json" - ], - "tags": [ - "闄勪欢绠$悊" - ], - "summary": "鏇存柊闄勪欢", - "parameters": [ - { - "description": "鏌ヨ鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.UpdateFile" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, "/api/followRecord/add": { "post": { "produces": [ @@ -2922,6 +3055,495 @@ "required": true, "schema": { "$ref": "#/definitions/request.UpdateIndustries" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "娣诲姞閿�鍞彂绁�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoice" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鍒犻櫎閿�鍞彂绁�", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoice/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鑾峰彇閿�鍞彂绁ㄥ垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Invoice" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoice/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "閿�鍞彂绁�" + ], + "summary": "鏇存柊閿�鍞彂绁�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoice" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "娣诲姞鍙戠エ鐘舵��", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoiceStatus" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鍒犻櫎鍙戠エ鐘舵��", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceStatus/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鑾峰彇鍙戠エ鐘舵�佸垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceStatusKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceStatusQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.InvoiceStatus" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoiceStatus/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ鐘舵��" + ], + "summary": "鏇存柊鍙戠エ鐘舵��", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoiceStatus" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "娣诲姞鍙戠エ绫诲瀷", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddInvoiceType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/delete/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鍒犻櫎鍙戠エ绫诲瀷", + "parameters": [ + { + "type": "integer", + "description": "鏌ヨ鍙傛暟", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/invoiceType/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鑾峰彇鍙戠エ绫诲瀷鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceTypeKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "InvoiceTypeQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.InvoiceType" + } + } + } + } + ] + } + } + } + } + }, + "/api/invoiceType/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鍙戠エ绫诲瀷" + ], + "summary": "鏇存柊鍙戠エ绫诲瀷", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateInvoiceType" } } ], @@ -8756,6 +9378,24 @@ "CollectionStatusCollected" ] }, + "constvar.CourierCompanyKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "CourierCompanyKeywordCustomerName" + ] + }, + "constvar.CourierCompanyQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "CourierCompanyQueryClassExpireLessThen60Days" + ] + }, "constvar.FaqKeywordType": { "type": "string", "enum": [ @@ -8790,6 +9430,60 @@ ], "x-enum-varnames": [ "FileQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceKeywordCustomerName" + ] + }, + "constvar.InvoiceQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceStatusKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceStatusKeywordCustomerName" + ] + }, + "constvar.InvoiceStatusQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceStatusQueryClassExpireLessThen60Days" + ] + }, + "constvar.InvoiceTypeKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceTypeKeywordCustomerName" + ] + }, + "constvar.InvoiceTypeQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "InvoiceTypeQueryClassExpireLessThen60Days" ] }, "constvar.PaymentTypeKeywordType": { @@ -9405,6 +10099,17 @@ } } }, + "model.CourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "model.Currency": { "type": "object", "properties": { @@ -9504,14 +10209,6 @@ "description": "瀵硅薄瀛樺偍bucket", "type": "string" }, - "content": { - "description": "鏂囦欢鍐呭", - "type": "string" - }, - "createTime": { - "description": "鍒涘缓鏃堕棿", - "type": "string" - }, "downloadCount": { "description": "涓嬫娆℃暟", "type": "integer" @@ -9523,9 +10220,6 @@ "fileType": { "description": "鏂囦欢绫诲瀷", "type": "string" - }, - "id": { - "type": "integer" }, "key": { "description": "瀵硅薄瀛樺偍key", @@ -9548,9 +10242,6 @@ }, "sourceType": { "description": "闄勪欢鏉ユ簮", - "type": "string" - }, - "updateTime": { "type": "string" } } @@ -9612,6 +10303,96 @@ } }, "model.Industry": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "model.Invoice": { + "type": "object", + "properties": { + "client": { + "$ref": "#/definitions/model.Client" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompany": { + "$ref": "#/definitions/model.CourierCompany" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "id": { + "type": "integer" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "string" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatus": { + "$ref": "#/definitions/model.InvoiceStatus" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceType": { + "$ref": "#/definitions/model.InvoiceType" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "model.InvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "model.InvoiceType": { "type": "object", "properties": { "id": { @@ -11207,6 +11988,17 @@ } } }, + "request.AddCourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddCurrency": { "type": "object", "required": [ @@ -11310,6 +12102,81 @@ "name" ], "properties": { + "name": { + "type": "string" + } + } + }, + "request.AddInvoice": { + "type": "object", + "properties": { + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "string" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "request.AddInvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "request.AddInvoiceType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, "name": { "type": "string" } @@ -13512,6 +14379,17 @@ } } }, + "request.UpdateCourierCompany": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateCurrency": { "type": "object", "required": [ @@ -13667,64 +14545,6 @@ } } }, - "request.UpdateFile": { - "type": "object", - "properties": { - "bucket": { - "description": "瀵硅薄瀛樺偍bucket", - "type": "string" - }, - "content": { - "description": "鏂囦欢鍐呭", - "type": "string" - }, - "createTime": { - "description": "鍒涘缓鏃堕棿", - "type": "string" - }, - "downloadCount": { - "description": "涓嬫娆℃暟", - "type": "integer" - }, - "filePath": { - "description": "鏂囦欢璺緞", - "type": "string" - }, - "fileType": { - "description": "鏂囦欢绫诲瀷", - "type": "string" - }, - "id": { - "type": "integer" - }, - "key": { - "description": "瀵硅薄瀛樺偍key", - "type": "string" - }, - "name": { - "type": "string" - }, - "previewCount": { - "description": "棰勮娆℃暟", - "type": "integer" - }, - "size": { - "description": "鏂囦欢澶у皬", - "type": "integer" - }, - "sourceId": { - "description": "鏉ユ簮id", - "type": "integer" - }, - "sourceType": { - "description": "闄勪欢鏉ユ簮", - "type": "string" - }, - "updateTime": { - "type": "string" - } - } - }, "request.UpdateFollowRecord": { "type": "object", "required": [ @@ -13768,6 +14588,84 @@ } } }, + "request.UpdateInvoice": { + "type": "object", + "properties": { + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "courierCompanyId": { + "description": "鐗╂祦鍏徃", + "type": "integer" + }, + "courierNumber": { + "description": "鐗╂祦鍗曞彿", + "type": "string" + }, + "id": { + "type": "integer" + }, + "invoiceDate": { + "description": "寮�绁ㄦ棩鏈�", + "type": "integer" + }, + "invoiceNumber": { + "description": "鍙戠エ鍙风爜", + "type": "string" + }, + "invoiceStatusId": { + "description": "鍙戠エ鐘舵�乮d", + "type": "integer" + }, + "invoiceTypeId": { + "description": "鍙戠エ绫诲瀷id", + "type": "integer" + }, + "principalId": { + "description": "閿�鍞礋璐d汉id", + "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "type": "integer" + }, + "subject": { + "description": "涓婚", + "type": "string" + }, + "taxpayerIdNumber": { + "description": "绾崇◣璇嗗埆鍙�", + "type": "string" + } + } + }, + "request.UpdateInvoiceStatus": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "request.UpdateInvoiceType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateIsInvoice": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index de6c84e..c37fd64 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -22,6 +22,18 @@ x-enum-varnames: - CollectionStatusUnCollected - CollectionStatusCollected + constvar.CourierCompanyKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - CourierCompanyKeywordCustomerName + constvar.CourierCompanyQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - CourierCompanyQueryClassExpireLessThen60Days constvar.FaqKeywordType: enum: - "" @@ -46,6 +58,42 @@ type: string x-enum-varnames: - FileQueryClassExpireLessThen60Days + constvar.InvoiceKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceKeywordCustomerName + constvar.InvoiceQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceQueryClassExpireLessThen60Days + constvar.InvoiceStatusKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceStatusKeywordCustomerName + constvar.InvoiceStatusQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceStatusQueryClassExpireLessThen60Days + constvar.InvoiceTypeKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceTypeKeywordCustomerName + constvar.InvoiceTypeQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - InvoiceTypeQueryClassExpireLessThen60Days constvar.PaymentTypeKeywordType: enum: - "" @@ -478,6 +526,13 @@ $ref: '#/definitions/model.Province' type: array type: object + model.CourierCompany: + properties: + id: + type: integer + name: + type: string + type: object model.Currency: properties: id: @@ -542,12 +597,6 @@ bucket: description: 瀵硅薄瀛樺偍bucket type: string - content: - description: 鏂囦欢鍐呭 - type: string - createTime: - description: 鍒涘缓鏃堕棿 - type: string downloadCount: description: 涓嬫娆℃暟 type: integer @@ -557,8 +606,6 @@ fileType: description: 鏂囦欢绫诲瀷 type: string - id: - type: integer key: description: 瀵硅薄瀛樺偍key type: string @@ -575,8 +622,6 @@ type: integer sourceType: description: 闄勪欢鏉ユ簮 - type: string - updateTime: type: string type: object model.FollowRecord: @@ -617,6 +662,69 @@ type: string type: object model.Industry: + properties: + id: + type: integer + name: + type: string + type: object + model.Invoice: + properties: + client: + $ref: '#/definitions/model.Client' + clientId: + description: 瀹㈡埛id + type: integer + courierCompany: + $ref: '#/definitions/model.CourierCompany' + courierCompanyId: + description: 鐗╂祦鍏徃 + type: integer + courierNumber: + description: 鐗╂祦鍗曞彿 + type: string + id: + type: integer + invoiceDate: + description: 寮�绁ㄦ棩鏈� + type: string + invoiceNumber: + description: 鍙戠エ鍙风爜 + type: string + invoiceStatus: + $ref: '#/definitions/model.InvoiceStatus' + invoiceStatusId: + description: 鍙戠エ鐘舵�乮d + type: integer + invoiceType: + $ref: '#/definitions/model.InvoiceType' + invoiceTypeId: + description: 鍙戠エ绫诲瀷id + type: integer + principalId: + description: 閿�鍞礋璐d汉id + type: integer + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + type: integer + subject: + description: 涓婚 + type: string + taxpayerIdNumber: + description: 绾崇◣璇嗗埆鍙� + type: string + type: object + model.InvoiceStatus: + properties: + id: + type: integer + name: + type: string + type: object + model.InvoiceType: properties: id: type: integer @@ -1688,6 +1796,13 @@ description: 鍥藉鍚嶇О type: string type: object + request.AddCourierCompany: + properties: + id: + type: integer + name: + type: string + type: object request.AddCurrency: properties: name: @@ -1756,6 +1871,59 @@ type: string required: - name + type: object + request.AddInvoice: + properties: + clientId: + description: 瀹㈡埛id + type: integer + courierCompanyId: + description: 鐗╂祦鍏徃 + type: integer + courierNumber: + description: 鐗╂祦鍗曞彿 + type: string + invoiceDate: + description: 寮�绁ㄦ棩鏈� + type: string + invoiceNumber: + description: 鍙戠エ鍙风爜 + type: string + invoiceStatusId: + description: 鍙戠エ鐘舵�乮d + type: integer + invoiceTypeId: + description: 鍙戠エ绫诲瀷id + type: integer + principalId: + description: 閿�鍞礋璐d汉id + type: integer + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + type: integer + subject: + description: 涓婚 + type: string + taxpayerIdNumber: + description: 绾崇◣璇嗗埆鍙� + type: string + type: object + request.AddInvoiceStatus: + properties: + id: + type: integer + name: + type: string + type: object + request.AddInvoiceType: + properties: + id: + type: integer + name: + type: string type: object request.AddIsInvoice: properties: @@ -3253,6 +3421,13 @@ description: 鍥藉鍚嶇О type: string type: object + request.UpdateCourierCompany: + properties: + id: + type: integer + name: + type: string + type: object request.UpdateCurrency: properties: id: @@ -3354,48 +3529,6 @@ name: type: string type: object - request.UpdateFile: - properties: - bucket: - description: 瀵硅薄瀛樺偍bucket - type: string - content: - description: 鏂囦欢鍐呭 - type: string - createTime: - description: 鍒涘缓鏃堕棿 - type: string - downloadCount: - description: 涓嬫娆℃暟 - type: integer - filePath: - description: 鏂囦欢璺緞 - type: string - fileType: - description: 鏂囦欢绫诲瀷 - type: string - id: - type: integer - key: - description: 瀵硅薄瀛樺偍key - type: string - name: - type: string - previewCount: - description: 棰勮娆℃暟 - type: integer - size: - description: 鏂囦欢澶у皬 - type: integer - sourceId: - description: 鏉ユ簮id - type: integer - sourceType: - description: 闄勪欢鏉ユ簮 - type: string - updateTime: - type: string - type: object request.UpdateFollowRecord: properties: follow_record: @@ -3423,6 +3556,61 @@ required: - id - name + type: object + request.UpdateInvoice: + properties: + clientId: + description: 瀹㈡埛id + type: integer + courierCompanyId: + description: 鐗╂祦鍏徃 + type: integer + courierNumber: + description: 鐗╂祦鍗曞彿 + type: string + id: + type: integer + invoiceDate: + description: 寮�绁ㄦ棩鏈� + type: integer + invoiceNumber: + description: 鍙戠エ鍙风爜 + type: string + invoiceStatusId: + description: 鍙戠エ鐘舵�乮d + type: integer + invoiceTypeId: + description: 鍙戠エ绫诲瀷id + type: integer + principalId: + description: 閿�鍞礋璐d汉id + type: integer + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + type: integer + subject: + description: 涓婚 + type: string + taxpayerIdNumber: + description: 绾崇◣璇嗗埆鍙� + type: string + type: object + request.UpdateInvoiceStatus: + properties: + id: + type: integer + name: + type: string + type: object + request.UpdateInvoiceType: + properties: + id: + type: integer + name: + type: string type: object request.UpdateIsInvoice: properties: @@ -5984,6 +6172,107 @@ summary: 鏇存柊鍥藉 tags: - Country + /api/courierCompany/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddCourierCompany' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞鐗╂祦鍏徃 + tags: + - 鐗╂祦鍏徃 + /api/courierCompany/delete/{id}: + delete: + parameters: + - description: 鏌ヨ鍙傛暟 + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鍒犻櫎鐗╂祦鍏徃 + tags: + - 鐗╂祦鍏徃 + /api/courierCompany/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - CourierCompanyKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - CourierCompanyQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.CourierCompany' + type: array + type: object + summary: 鑾峰彇鐗╂祦鍏徃鍒楄〃 + tags: + - 鐗╂祦鍏徃 + /api/courierCompany/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateCourierCompany' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊鐗╂祦鍏徃 + tags: + - 鐗╂祦鍏徃 /api/currency/add: post: parameters: @@ -6609,25 +6898,6 @@ summary: 鑾峰彇闄勪欢鍒楄〃 tags: - 闄勪欢绠$悊 - /api/file/update: - put: - parameters: - - description: 鏌ヨ鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/request.UpdateFile' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/contextx.Response' - summary: 鏇存柊闄勪欢 - tags: - - 闄勪欢绠$悊 /api/followRecord/add: post: parameters: @@ -6798,6 +7068,309 @@ summary: 鏇存柊琛屼笟 tags: - Industry + /api/invoice/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddInvoice' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞閿�鍞彂绁� + tags: + - 閿�鍞彂绁� + /api/invoice/delete/{id}: + delete: + parameters: + - description: 鏌ヨ鍙傛暟 + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鍒犻櫎閿�鍞彂绁� + tags: + - 閿�鍞彂绁� + /api/invoice/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - InvoiceKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - InvoiceQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.Invoice' + type: array + type: object + summary: 鑾峰彇閿�鍞彂绁ㄥ垪琛� + tags: + - 閿�鍞彂绁� + /api/invoice/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateInvoice' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊閿�鍞彂绁� + tags: + - 閿�鍞彂绁� + /api/invoiceStatus/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddInvoiceStatus' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞鍙戠エ鐘舵�� + tags: + - 鍙戠エ鐘舵�� + /api/invoiceStatus/delete/{id}: + delete: + parameters: + - description: 鏌ヨ鍙傛暟 + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鍒犻櫎鍙戠エ鐘舵�� + tags: + - 鍙戠エ鐘舵�� + /api/invoiceStatus/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - InvoiceStatusKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - InvoiceStatusQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.InvoiceStatus' + type: array + type: object + summary: 鑾峰彇鍙戠エ鐘舵�佸垪琛� + tags: + - 鍙戠エ鐘舵�� + /api/invoiceStatus/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateInvoiceStatus' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊鍙戠エ鐘舵�� + tags: + - 鍙戠エ鐘舵�� + /api/invoiceType/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddInvoiceType' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞鍙戠エ绫诲瀷 + tags: + - 鍙戠エ绫诲瀷 + /api/invoiceType/delete/{id}: + delete: + parameters: + - description: 鏌ヨ鍙傛暟 + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鍒犻櫎鍙戠エ绫诲瀷 + tags: + - 鍙戠エ绫诲瀷 + /api/invoiceType/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - InvoiceTypeKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - InvoiceTypeQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.InvoiceType' + type: array + type: object + summary: 鑾峰彇鍙戠エ绫诲瀷鍒楄〃 + tags: + - 鍙戠エ绫诲瀷 + /api/invoiceType/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateInvoiceType' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊鍙戠エ绫诲瀷 + tags: + - 鍙戠エ绫诲瀷 /api/isInvoice/add: post: parameters: diff --git a/model/courierCompany.go b/model/courierCompany.go new file mode 100644 index 0000000..e78f481 --- /dev/null +++ b/model/courierCompany.go @@ -0,0 +1,140 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // CourierCompany 鐗╂祦鍏徃 + CourierCompany struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name"` + } + + // CourierCompanySearch 鐗╂祦鍏徃鎼滅储鏉′欢 + CourierCompanySearch struct { + CourierCompany + Orm *gorm.DB + QueryClass constvar.CourierCompanyQueryClass + KeywordType constvar.CourierCompanyKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (CourierCompany) TableName() string { + return "courier_company" +} + +func NewCourierCompanySearch() *CourierCompanySearch { + return &CourierCompanySearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *CourierCompanySearch) build() *gorm.DB { + var db = slf.Orm.Model(&CourierCompany{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *CourierCompanySearch) Create(record *CourierCompany) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *CourierCompanySearch) CreateBatch(records []*CourierCompany) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *CourierCompanySearch) Delete() error { + var db = slf.build() + return db.Delete(&CourierCompany{}).Error +} + +func (slf *CourierCompanySearch) Update(record *CourierCompany) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *CourierCompanySearch) FindAll() ([]*CourierCompany, error) { + var db = slf.build() + var record = make([]*CourierCompany, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *CourierCompanySearch) SetId(id int) *CourierCompanySearch { + slf.Id = id + return slf +} + +func (slf *CourierCompanySearch) SetOrm(tx *gorm.DB) *CourierCompanySearch { + slf.Orm = tx + return slf +} + +func (slf *CourierCompanySearch) First() (*CourierCompany, error) { + var db = slf.build() + var record = new(CourierCompany) + err := db.First(record).Error + return record, err +} + +func (slf *CourierCompanySearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *CourierCompanySearch) Save(record *CourierCompany) error { + if record.Id == 0 { + return errors.New("id涓虹┖") + } + var db = slf.build() + + if err := db.Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *CourierCompanySearch) Find() ([]*CourierCompany, int64, error) { + var db = slf.build() + var records = make([]*CourierCompany, 0) + var total int64 + if err := db.Count(&total).Error; err != nil { + return records, total, err + } + if slf.PageNum > 0 && slf.PageSize > 0 { + db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) + } + + err := db.Find(&records).Error + return records, total, err +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *CourierCompanySearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*CourierCompany{} + return slf.CreateBatch(records) +} diff --git a/model/invoice.go b/model/invoice.go new file mode 100644 index 0000000..ef97ed8 --- /dev/null +++ b/model/invoice.go @@ -0,0 +1,160 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // Invoice 閿�鍞彂绁� + Invoice struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + Client Client `gorm:"foreignKey:ClientId"` + InvoiceTypeId int `gorm:"invoice_type_id" json:"invoiceTypeId"` // 鍙戠エ绫诲瀷id + InvoiceType InvoiceType `gorm:"foreignKey:InvoiceTypeId"` + PrincipalId int `gorm:"principal_id" json:"principalId"` // 閿�鍞礋璐d汉id + Subject string `gorm:"subject" json:"subject"` // 涓婚 + InvoiceStatusId int `gorm:"invoice_status_id" json:"invoiceStatusId"` // 鍙戠エ鐘舵�乮d + InvoiceStatus InvoiceStatus `gorm:"foreignKey:InvoiceStatusId"` + SourceType constvar.InvoiceSourceType `gorm:"source_type" json:"sourceType"` // 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id + TaxpayerIdNumber string `gorm:"taxpayer_id_number" json:"taxpayerIdNumber"` // 绾崇◣璇嗗埆鍙� + InvoiceNumber string `gorm:"invoice_number" json:"invoiceNumber"` // 鍙戠エ鍙风爜 + InvoiceDate string `gorm:"invoice_date" json:"invoiceDate"` // 寮�绁ㄦ棩鏈� + CourierNumber string `gorm:"courier_number" json:"courierNumber"` // 鐗╂祦鍗曞彿 + CourierCompanyId int `gorm:"courier_company_id" json:"courierCompanyId"` // 鐗╂祦鍏徃 + CourierCompany CourierCompany `gorm:"foreignKey:CourierCompanyId"` + } + + // InvoiceSearch 閿�鍞彂绁ㄦ悳绱㈡潯浠� + InvoiceSearch struct { + Invoice + Orm *gorm.DB + QueryClass constvar.InvoiceQueryClass + KeywordType constvar.InvoiceKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (Invoice) TableName() string { + return "invoice" +} + +func NewInvoiceSearch() *InvoiceSearch { + return &InvoiceSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *InvoiceSearch) build() *gorm.DB { + var db = slf.Orm.Model(&Invoice{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *InvoiceSearch) Create(record *Invoice) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *InvoiceSearch) CreateBatch(records []*Invoice) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *InvoiceSearch) Delete() error { + var db = slf.build() + return db.Delete(&Invoice{}).Error +} + +func (slf *InvoiceSearch) Update(record *Invoice) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *InvoiceSearch) FindAll() ([]*Invoice, error) { + var db = slf.build() + var record = make([]*Invoice, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *InvoiceSearch) SetId(id int) *InvoiceSearch { + slf.Id = id + return slf +} + +func (slf *InvoiceSearch) SetOrm(tx *gorm.DB) *InvoiceSearch { + slf.Orm = tx + return slf +} + +func (slf *InvoiceSearch) First() (*Invoice, error) { + var db = slf.build() + var record = new(Invoice) + err := db.First(record).Error + return record, err +} + +func (slf *InvoiceSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *InvoiceSearch) Save(record *Invoice) error { + if record.Id == 0 { + return errors.New("id涓虹┖") + } + var db = slf.build() + + if err := db.Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *InvoiceSearch) Find() ([]*Invoice, int64, error) { + var db = slf.build() + var records = make([]*Invoice, 0) + var total int64 + if err := db.Count(&total).Error; err != nil { + return records, total, err + } + if slf.PageNum > 0 && slf.PageSize > 0 { + db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) + } + + err := db. + Preload("Client"). + Preload("InvoiceType"). + Preload("InvoiceStatus"). + Preload("CourierCompany"). + Find(&records).Error + return records, total, err +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *InvoiceSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*Invoice{} + return slf.CreateBatch(records) +} diff --git a/model/invoiceStatus.go b/model/invoiceStatus.go new file mode 100644 index 0000000..dadfe4e --- /dev/null +++ b/model/invoiceStatus.go @@ -0,0 +1,140 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // InvoiceStatus 鍙戠エ鐘舵�� + InvoiceStatus struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name"` + } + + // InvoiceStatusSearch 鍙戠エ鐘舵�佹悳绱㈡潯浠� + InvoiceStatusSearch struct { + InvoiceStatus + Orm *gorm.DB + QueryClass constvar.InvoiceStatusQueryClass + KeywordType constvar.InvoiceStatusKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (InvoiceStatus) TableName() string { + return "invoice_status" +} + +func NewInvoiceStatusSearch() *InvoiceStatusSearch { + return &InvoiceStatusSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *InvoiceStatusSearch) build() *gorm.DB { + var db = slf.Orm.Model(&InvoiceStatus{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *InvoiceStatusSearch) Create(record *InvoiceStatus) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *InvoiceStatusSearch) CreateBatch(records []*InvoiceStatus) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *InvoiceStatusSearch) Delete() error { + var db = slf.build() + return db.Delete(&InvoiceStatus{}).Error +} + +func (slf *InvoiceStatusSearch) Update(record *InvoiceStatus) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *InvoiceStatusSearch) FindAll() ([]*InvoiceStatus, error) { + var db = slf.build() + var record = make([]*InvoiceStatus, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *InvoiceStatusSearch) SetId(id int) *InvoiceStatusSearch { + slf.Id = id + return slf +} + +func (slf *InvoiceStatusSearch) SetOrm(tx *gorm.DB) *InvoiceStatusSearch { + slf.Orm = tx + return slf +} + +func (slf *InvoiceStatusSearch) First() (*InvoiceStatus, error) { + var db = slf.build() + var record = new(InvoiceStatus) + err := db.First(record).Error + return record, err +} + +func (slf *InvoiceStatusSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *InvoiceStatusSearch) Save(record *InvoiceStatus) error { + if record.Id == 0 { + return errors.New("id涓虹┖") + } + var db = slf.build() + + if err := db.Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *InvoiceStatusSearch) Find() ([]*InvoiceStatus, int64, error) { + var db = slf.build() + var records = make([]*InvoiceStatus, 0) + var total int64 + if err := db.Count(&total).Error; err != nil { + return records, total, err + } + if slf.PageNum > 0 && slf.PageSize > 0 { + db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) + } + + err := db.Find(&records).Error + return records, total, err +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *InvoiceStatusSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*InvoiceStatus{} + return slf.CreateBatch(records) +} diff --git a/model/invoiceType.go b/model/invoiceType.go new file mode 100644 index 0000000..55eced6 --- /dev/null +++ b/model/invoiceType.go @@ -0,0 +1,140 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // InvoiceType 鍙戠エ绫诲瀷 + InvoiceType struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name"` + } + + // InvoiceTypeSearch 鍙戠エ绫诲瀷鎼滅储鏉′欢 + InvoiceTypeSearch struct { + InvoiceType + Orm *gorm.DB + QueryClass constvar.InvoiceTypeQueryClass + KeywordType constvar.InvoiceTypeKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (InvoiceType) TableName() string { + return "invoice_type" +} + +func NewInvoiceTypeSearch() *InvoiceTypeSearch { + return &InvoiceTypeSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *InvoiceTypeSearch) build() *gorm.DB { + var db = slf.Orm.Model(&InvoiceType{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *InvoiceTypeSearch) Create(record *InvoiceType) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *InvoiceTypeSearch) CreateBatch(records []*InvoiceType) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *InvoiceTypeSearch) Delete() error { + var db = slf.build() + return db.Delete(&InvoiceType{}).Error +} + +func (slf *InvoiceTypeSearch) Update(record *InvoiceType) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *InvoiceTypeSearch) FindAll() ([]*InvoiceType, error) { + var db = slf.build() + var record = make([]*InvoiceType, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *InvoiceTypeSearch) SetId(id int) *InvoiceTypeSearch { + slf.Id = id + return slf +} + +func (slf *InvoiceTypeSearch) SetOrm(tx *gorm.DB) *InvoiceTypeSearch { + slf.Orm = tx + return slf +} + +func (slf *InvoiceTypeSearch) First() (*InvoiceType, error) { + var db = slf.build() + var record = new(InvoiceType) + err := db.First(record).Error + return record, err +} + +func (slf *InvoiceTypeSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *InvoiceTypeSearch) Save(record *InvoiceType) error { + if record.Id == 0 { + return errors.New("id涓虹┖") + } + var db = slf.build() + + if err := db.Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *InvoiceTypeSearch) Find() ([]*InvoiceType, int64, error) { + var db = slf.build() + var records = make([]*InvoiceType, 0) + var total int64 + if err := db.Count(&total).Error; err != nil { + return records, total, err + } + if slf.PageNum > 0 && slf.PageSize > 0 { + db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) + } + + err := db.Find(&records).Error + return records, total, err +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *InvoiceTypeSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*InvoiceType{} + return slf.CreateBatch(records) +} diff --git a/model/request/courierCompany.go b/model/request/courierCompany.go new file mode 100644 index 0000000..b01d559 --- /dev/null +++ b/model/request/courierCompany.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddCourierCompany struct { + model.CourierCompany +} + +type UpdateCourierCompany struct { + Id int `json:"id"` + model.CourierCompany +} + +type GetCourierCompanyList struct { + PageInfo + QueryClass constvar.CourierCompanyQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.CourierCompanyKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/request/invoice.go b/model/request/invoice.go new file mode 100644 index 0000000..1b1eddd --- /dev/null +++ b/model/request/invoice.go @@ -0,0 +1,43 @@ +package request + +import ( + "aps_crm/constvar" +) + +type AddInvoice struct { + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + InvoiceTypeId int `gorm:"invoice_type_id" json:"invoiceTypeId"` // 鍙戠エ绫诲瀷id + PrincipalId int `gorm:"principal_id" json:"principalId"` // 閿�鍞礋璐d汉id + Subject string `gorm:"subject" json:"subject"` // 涓婚 + InvoiceStatusId int `gorm:"invoice_status_id" json:"invoiceStatusId"` // 鍙戠エ鐘舵�乮d + SourceType constvar.InvoiceSourceType `gorm:"source_type" json:"sourceType"` // 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id + TaxpayerIdNumber string `gorm:"taxpayer_id_number" json:"taxpayerIdNumber"` // 绾崇◣璇嗗埆鍙� + InvoiceNumber string `gorm:"invoice_number" json:"invoiceNumber"` // 鍙戠エ鍙风爜 + InvoiceDate string `gorm:"invoice_date" json:"invoiceDate"` // 寮�绁ㄦ棩鏈� + CourierNumber string `gorm:"courier_number" json:"courierNumber"` // 鐗╂祦鍗曞彿 + CourierCompanyId int `gorm:"courier_company_id" json:"courierCompanyId"` // 鐗╂祦鍏徃 +} + +type UpdateInvoice struct { + Id int `json:"id"` + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + InvoiceTypeId int `gorm:"invoice_type_id" json:"invoiceTypeId"` // 鍙戠エ绫诲瀷id + PrincipalId int `gorm:"principal_id" json:"principalId"` // 閿�鍞礋璐d汉id + Subject string `gorm:"subject" json:"subject"` // 涓婚 + InvoiceStatusId int `gorm:"invoice_status_id" json:"invoiceStatusId"` // 鍙戠エ鐘舵�乮d + SourceType int `gorm:"source_type" json:"sourceType"` // 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id + TaxpayerIdNumber string `gorm:"taxpayer_id_number" json:"taxpayerIdNumber"` // 绾崇◣璇嗗埆鍙� + InvoiceNumber string `gorm:"invoice_number" json:"invoiceNumber"` // 鍙戠エ鍙风爜 + InvoiceDate int `gorm:"invoice_date" json:"invoiceDate"` // 寮�绁ㄦ棩鏈� + CourierNumber string `gorm:"courier_number" json:"courierNumber"` // 鐗╂祦鍗曞彿 + CourierCompanyId int `gorm:"courier_company_id" json:"courierCompanyId"` // 鐗╂祦鍏徃 +} + +type GetInvoiceList struct { + PageInfo + QueryClass constvar.InvoiceQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.InvoiceKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/request/invoiceStatus.go b/model/request/invoiceStatus.go new file mode 100644 index 0000000..608e149 --- /dev/null +++ b/model/request/invoiceStatus.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddInvoiceStatus struct { + model.InvoiceStatus +} + +type UpdateInvoiceStatus struct { + Id int `json:"id"` + model.InvoiceStatus +} + +type GetInvoiceStatusList struct { + PageInfo + QueryClass constvar.InvoiceStatusQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.InvoiceStatusKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/request/invoiceType.go b/model/request/invoiceType.go new file mode 100644 index 0000000..24d3ea5 --- /dev/null +++ b/model/request/invoiceType.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddInvoiceType struct { + model.InvoiceType +} + +type UpdateInvoiceType struct { + Id int `json:"id"` + model.InvoiceType +} + +type GetInvoiceTypeList struct { + PageInfo + QueryClass constvar.InvoiceTypeQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.InvoiceTypeKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/serviceContract.go b/model/serviceContract.go index d6a9c5f..f001ccf 100644 --- a/model/serviceContract.go +++ b/model/serviceContract.go @@ -3,29 +3,34 @@ import ( "aps_crm/constvar" "aps_crm/pkg/mysqlx" + "fmt" + "github.com/shopspring/decimal" "gorm.io/gorm" "time" ) type ( ServiceContract struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鍚堝悓缂栧彿"` - MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` - ContactId int `json:"contactId" gorm:"column:contact_id;type:int;comment:鑱旂郴浜篿d"` - SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` - ContractId int `json:"contractId" gorm:"column:contract_id;type:int;comment:鍚堝悓id"` - QuotationId int `json:"quotationId" gorm:"column:quotation_id;type:int;comment:鎶ヤ环鍗昳d"` - ServiceContractTypeId int `json:"serviceContractTypeId" gorm:"column:service_contract_type_id;type:int;comment:鍚堝悓绫诲瀷id"` - SignTime time.Time `json:"signTime" gorm:"column:sign_time;type:datetime;comment:绛剧害鏃堕棿"` - StartTime time.Time `json:"startTime" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` - EndTime time.Time `json:"endTime" gorm:"column:end_time;type:datetime;comment:缁撴潫鏃堕棿"` - ServiceContractStatusId int `json:"serviceContractStatusId" gorm:"column:service_contract_status_id;type:int;comment:鍚堝悓鐘舵�乮d"` - ServiceTimes int `json:"serviceTimes" gorm:"column:service_times;type:int;comment:鏈嶅姟娆℃暟"` - Terms string `json:"terms" gorm:"column:terms;type:text;comment:鏉℃"` - Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` - Products []Product `json:"products" gorm:"many2many:serviceContract_product;"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鍚堝悓缂栧彿"` + MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` + ContactId int `json:"contactId" gorm:"column:contact_id;type:int;comment:鑱旂郴浜篿d"` + SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` + ContractId int `json:"contractId" gorm:"column:contract_id;type:int;comment:鍚堝悓id"` + QuotationId int `json:"quotationId" gorm:"column:quotation_id;type:int;comment:鎶ヤ环鍗昳d"` + ServiceContractTypeId int `json:"serviceContractTypeId" gorm:"column:service_contract_type_id;type:int;comment:鍚堝悓绫诲瀷id"` + SignTime time.Time `json:"signTime" gorm:"column:sign_time;type:datetime;comment:绛剧害鏃堕棿"` + StartTime time.Time `json:"startTime" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` + EndTime time.Time `json:"endTime" gorm:"column:end_time;type:datetime;comment:缁撴潫鏃堕棿"` + ServiceContractStatusId int `json:"serviceContractStatusId" gorm:"column:service_contract_status_id;type:int;comment:鍚堝悓鐘舵�乮d"` + ServiceTimes int `json:"serviceTimes" gorm:"column:service_times;type:int;comment:鏈嶅姟娆℃暟"` + Terms string `json:"terms" gorm:"column:terms;type:text;comment:鏉℃"` + Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` + AmountReceivable decimal.Decimal `gorm:"amount_receivable" json:"amountReceivable"` // 搴旀敹閲戦 + AmountReceived decimal.Decimal `gorm:"amount_received" json:"amountReceived"` // 宸叉敹閲戦 + AmountInvoiced decimal.Decimal `gorm:"amount_invoiced" json:"amountInvoiced"` // 宸插紑绁ㄩ噾棰� + Products []Product `json:"products" gorm:"many2many:serviceContract_product;"` gorm.Model `json:"-"` } @@ -166,3 +171,28 @@ slf.OrderBy = order return slf } + +func (slf *ServiceContractSearch) UpdateByMap(upMap map[string]interface{}) error { + var ( + db = slf.build() + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) + } + + return nil +} + +func (slf *ServiceContractSearch) First() (*ServiceContract, error) { + var ( + record = new(ServiceContract) + db = slf.build() + ) + + if err := db.First(record).Error; err != nil { + return record, err + } + + return record, nil +} diff --git a/router/courierCompany.go b/router/courierCompany.go new file mode 100644 index 0000000..0356787 --- /dev/null +++ b/router/courierCompany.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitCourierCompanyRouter(router *gin.RouterGroup) { + CourierCompanyRouter := router.Group("courierCompany") + CourierCompanyApi := v1.CourierCompanyApi{} + { + CourierCompanyRouter.POST("add", CourierCompanyApi.Add) // 娣诲姞鐗╂祦鍏徃 + CourierCompanyRouter.DELETE("delete/:id", CourierCompanyApi.Delete) // 鍒犻櫎鐗╂祦鍏徃 + CourierCompanyRouter.PUT("update", CourierCompanyApi.Update) // 鏇存柊鐗╂祦鍏徃 + CourierCompanyRouter.GET("list", CourierCompanyApi.List) // 鑾峰彇鐗╂祦鍏徃鍒楄〃 + } +} diff --git a/router/index.go b/router/index.go index 001dd00..5a5f1cb 100644 --- a/router/index.go +++ b/router/index.go @@ -171,6 +171,10 @@ InitBankAccountRouter(PrivateGroup) InitPaymentTypeRouter(PrivateGroup) InitFileRouter(PrivateGroup) + InitInvoiceRouter(PrivateGroup) + InitInvoiceStatusRouter(PrivateGroup) + InitInvoiceTypeRouter(PrivateGroup) + InitCourierCompanyRouter(PrivateGroup) } return Router } diff --git a/router/invoice.go b/router/invoice.go new file mode 100644 index 0000000..d60183b --- /dev/null +++ b/router/invoice.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitInvoiceRouter(router *gin.RouterGroup) { + InvoiceRouter := router.Group("invoice") + InvoiceApi := v1.InvoiceApi{} + { + InvoiceRouter.POST("add", InvoiceApi.Add) // 娣诲姞閿�鍞彂绁� + InvoiceRouter.DELETE("delete/:id", InvoiceApi.Delete) // 鍒犻櫎閿�鍞彂绁� + InvoiceRouter.PUT("update", InvoiceApi.Update) // 鏇存柊閿�鍞彂绁� + InvoiceRouter.GET("list", InvoiceApi.List) // 鑾峰彇閿�鍞彂绁ㄥ垪琛� + } +} diff --git a/router/invoiceStatus.go b/router/invoiceStatus.go new file mode 100644 index 0000000..3b3a3cd --- /dev/null +++ b/router/invoiceStatus.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitInvoiceStatusRouter(router *gin.RouterGroup) { + InvoiceStatusRouter := router.Group("invoiceStatus") + InvoiceStatusApi := v1.InvoiceStatusApi{} + { + InvoiceStatusRouter.POST("add", InvoiceStatusApi.Add) // 娣诲姞鍙戠エ鐘舵�� + InvoiceStatusRouter.DELETE("delete/:id", InvoiceStatusApi.Delete) // 鍒犻櫎鍙戠エ鐘舵�� + InvoiceStatusRouter.PUT("update", InvoiceStatusApi.Update) // 鏇存柊鍙戠エ鐘舵�� + InvoiceStatusRouter.GET("list", InvoiceStatusApi.List) // 鑾峰彇鍙戠エ鐘舵�佸垪琛� + } +} diff --git a/router/invoiceType.go b/router/invoiceType.go new file mode 100644 index 0000000..387b10b --- /dev/null +++ b/router/invoiceType.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitInvoiceTypeRouter(router *gin.RouterGroup) { + InvoiceTypeRouter := router.Group("invoiceType") + InvoiceTypeApi := v1.InvoiceTypeApi{} + { + InvoiceTypeRouter.POST("add", InvoiceTypeApi.Add) // 娣诲姞鍙戠エ绫诲瀷 + InvoiceTypeRouter.DELETE("delete/:id", InvoiceTypeApi.Delete) // 鍒犻櫎鍙戠エ绫诲瀷 + InvoiceTypeRouter.PUT("update", InvoiceTypeApi.Update) // 鏇存柊鍙戠エ绫诲瀷 + InvoiceTypeRouter.GET("list", InvoiceTypeApi.List) // 鑾峰彇鍙戠エ绫诲瀷鍒楄〃 + } +} diff --git a/service/courierCompany.go b/service/courierCompany.go new file mode 100644 index 0000000..01b1e2d --- /dev/null +++ b/service/courierCompany.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type CourierCompanyService struct{} + +func NewCourierCompanyService() CourierCompanyService { + return CourierCompanyService{} +} + +func (CourierCompanyService) AddCourierCompany(courierCompany *model.CourierCompany) int { + err := model.NewCourierCompanySearch().Create(courierCompany) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (CourierCompanyService) DeleteCourierCompany(id int) int { + err := model.NewCourierCompanySearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (CourierCompanyService) GetCourierCompanyList() ([]*model.CourierCompany, int64, int) { + list, total, err := model.NewCourierCompanySearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (CourierCompanyService) UpdateCourierCompanys(CourierCompanys []*request.UpdateCourierCompany) int { + for _, v := range CourierCompanys { + // check CourierCompany exist + _, err := model.NewCourierCompanySearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewCourierCompanySearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (CourierCompanyService) UpdateCourierCompany(courierCompany *model.CourierCompany) int { + err := model.NewCourierCompanySearch().SetId(courierCompany.Id).Save(courierCompany) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} diff --git a/service/invoice.go b/service/invoice.go new file mode 100644 index 0000000..9bd1b91 --- /dev/null +++ b/service/invoice.go @@ -0,0 +1,87 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" + "gorm.io/gorm" +) + +type InvoiceService struct{} + +func NewInvoiceService() InvoiceService { + return InvoiceService{} +} + +func (InvoiceService) AddInvoice(invoice *model.Invoice) int { + + err := model.WithTransaction(func(db *gorm.DB) error { + err := model.NewInvoiceSearch().Create(invoice) + if err != nil { + return err + } + //if invoice.SourceType == constvar.InvoiceSourceTypeServiceContract { + // contract,err := model.NewServiceContractSearch().SetId(invoice.SourceId).First() + // if err != nil { + // return err + // } + // AmountInvoiced := contract.AmountReceived.Add() + // err := model.NewServiceContractSearch().SetId(invoice.SourceId).UpdateByMap(map[string]interface{}{ + // "amount_received" : + // }) + // if err != nil { + // return err + // } + //} + + return nil + }) + + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (InvoiceService) DeleteInvoice(id int) int { + err := model.NewInvoiceSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (InvoiceService) GetInvoiceList() ([]*model.Invoice, int64, int) { + list, total, err := model.NewInvoiceSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (InvoiceService) UpdateInvoices(Invoices []*request.UpdateInvoice) int { + for _, v := range Invoices { + // check Invoice exist + _, err := model.NewInvoiceSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewInvoiceSearch().SetId(v.Id).Updates(map[string]interface{}{}) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (InvoiceService) UpdateInvoice(invoice *model.Invoice) int { + err := model.NewInvoiceSearch().SetId(invoice.Id).Save(invoice) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} diff --git a/service/invoiceStatus.go b/service/invoiceStatus.go new file mode 100644 index 0000000..4b42bf8 --- /dev/null +++ b/service/invoiceStatus.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type InvoiceStatusService struct{} + +func NewInvoiceStatusService() InvoiceStatusService { + return InvoiceStatusService{} +} + +func (InvoiceStatusService) AddInvoiceStatus(invoiceStatus *model.InvoiceStatus) int { + err := model.NewInvoiceStatusSearch().Create(invoiceStatus) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (InvoiceStatusService) DeleteInvoiceStatus(id int) int { + err := model.NewInvoiceStatusSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (InvoiceStatusService) GetInvoiceStatusList() ([]*model.InvoiceStatus, int64, int) { + list, total, err := model.NewInvoiceStatusSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (InvoiceStatusService) UpdateInvoiceStatuss(InvoiceStatuss []*request.UpdateInvoiceStatus) int { + for _, v := range InvoiceStatuss { + // check InvoiceStatus exist + _, err := model.NewInvoiceStatusSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewInvoiceStatusSearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (InvoiceStatusService) UpdateInvoiceStatus(invoiceStatus *model.InvoiceStatus) int { + err := model.NewInvoiceStatusSearch().SetId(invoiceStatus.Id).Save(invoiceStatus) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} diff --git a/service/invoiceType.go b/service/invoiceType.go new file mode 100644 index 0000000..1c43d92 --- /dev/null +++ b/service/invoiceType.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type InvoiceTypeService struct{} + +func NewInvoiceTypeService() InvoiceTypeService { + return InvoiceTypeService{} +} + +func (InvoiceTypeService) AddInvoiceType(invoiceType *model.InvoiceType) int { + err := model.NewInvoiceTypeSearch().Create(invoiceType) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (InvoiceTypeService) DeleteInvoiceType(id int) int { + err := model.NewInvoiceTypeSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (InvoiceTypeService) GetInvoiceTypeList() ([]*model.InvoiceType, int64, int) { + list, total, err := model.NewInvoiceTypeSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (InvoiceTypeService) UpdateInvoiceTypes(InvoiceTypes []*request.UpdateInvoiceType) int { + for _, v := range InvoiceTypes { + // check InvoiceType exist + _, err := model.NewInvoiceTypeSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewInvoiceTypeSearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (InvoiceTypeService) UpdateInvoiceType(invoiceType *model.InvoiceType) int { + err := model.NewInvoiceTypeSearch().SetId(invoiceType.Id).Save(invoiceType) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} -- Gitblit v1.8.0