From 1d8f07d32634854a07379479a760ba387a53314c Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 05 八月 2023 17:31:29 +0800 Subject: [PATCH] 收款单管理及账户,支付方式 --- model/request/paymentType.go | 22 router/bankAccount.go | 17 model/bankAccount.go | 140 ++ docs/swagger.yaml | 490 +++++++++ api/v1/receipt.go | 112 ++ docs/docs.go | 757 ++++++++++++++ docs/swagger.json | 757 ++++++++++++++ router/paymentType.go | 17 api/v1/paymentType.go | 112 ++ model/receipt.go | 149 ++ constvar/paymentType.go | 12 api/v1/bankAccount.go | 112 ++ constvar/receipt.go | 12 model/request/receipt.go | 22 model/paymentType.go | 140 ++ service/bankAccount.go | 66 + router/index.go | 3 constvar/bankAccount.go | 12 router/receipt.go | 17 model/request/bankAccount.go | 22 service/receipt.go | 66 + service/paymentType.go | 66 + 22 files changed, 3,117 insertions(+), 6 deletions(-) diff --git a/api/v1/bankAccount.go b/api/v1/bankAccount.go new file mode 100644 index 0000000..bf81a94 --- /dev/null +++ b/api/v1/bankAccount.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 BankAccountApi struct{} + +// Add +// @Tags 閾惰璐︽埛绠$悊 +// @Summary 娣诲姞閾惰璐︽埛 +// @Produce application/json +// @Param object body request.AddBankAccount true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/bankAccount/add [post] +func (s *BankAccountApi) Add(c *gin.Context) { + var params request.AddBankAccount + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewBankAccountService().AddBankAccount(¶ms.BankAccount) + 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/bankAccount/delete/{id} [delete] +func (s *BankAccountApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewBankAccountService().DeleteBankAccount(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 閾惰璐︽埛绠$悊 +// @Summary 鏇存柊閾惰璐︽埛 +// @Produce application/json +// @Param object body request.UpdateBankAccount true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/bankAccount/update [put] +func (s *BankAccountApi) Update(c *gin.Context) { + var params request.UpdateBankAccount + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.BankAccount.Id = params.Id + + errCode := service.NewBankAccountService().UpdateBankAccount(¶ms.BankAccount) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 閾惰璐︽埛绠$悊 +// @Summary 鑾峰彇閾惰璐︽埛鍒楄〃 +// @Produce application/json +// @Param object query request.GetBankAccountList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.BankAccount} +// @Router /api/bankAccount/list [get] +func (s *BankAccountApi) List(c *gin.Context) { + var params request.GetBankAccountList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + bankAccount, total, errCode := service.NewBankAccountService().GetBankAccountList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: bankAccount, + Count: total, + }) +} diff --git a/api/v1/paymentType.go b/api/v1/paymentType.go new file mode 100644 index 0000000..28d0dc1 --- /dev/null +++ b/api/v1/paymentType.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 PaymentTypeApi struct{} + +// Add +// @Tags 鏀粯鏂瑰紡绠$悊 +// @Summary 娣诲姞鏀粯鏂瑰紡 +// @Produce application/json +// @Param object body request.AddPaymentType true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/paymentType/add [post] +func (s *PaymentTypeApi) Add(c *gin.Context) { + var params request.AddPaymentType + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewPaymentTypeService().AddPaymentType(¶ms.PaymentType) + 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/paymentType/delete/{id} [delete] +func (s *PaymentTypeApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewPaymentTypeService().DeletePaymentType(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 鏀粯鏂瑰紡绠$悊 +// @Summary 鏇存柊鏀粯鏂瑰紡 +// @Produce application/json +// @Param object body request.UpdatePaymentType true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/paymentType/update [put] +func (s *PaymentTypeApi) Update(c *gin.Context) { + var params request.UpdatePaymentType + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.PaymentType.Id = params.Id + + errCode := service.NewPaymentTypeService().UpdatePaymentType(¶ms.PaymentType) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 鏀粯鏂瑰紡绠$悊 +// @Summary 鑾峰彇鏀粯鏂瑰紡鍒楄〃 +// @Produce application/json +// @Param object query request.GetPaymentTypeList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.PaymentType} +// @Router /api/paymentType/list [get] +func (s *PaymentTypeApi) List(c *gin.Context) { + var params request.GetPaymentTypeList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + paymentType, total, errCode := service.NewPaymentTypeService().GetPaymentTypeList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: paymentType, + Count: total, + }) +} diff --git a/api/v1/receipt.go b/api/v1/receipt.go new file mode 100644 index 0000000..e507d08 --- /dev/null +++ b/api/v1/receipt.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 ReceiptApi struct{} + +// Add +// @Tags 鏀舵鍗曠鐞� +// @Summary 娣诲姞鏀舵鍗� +// @Produce application/json +// @Param object body request.AddReceipt true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/receipt/add [post] +func (s *ReceiptApi) Add(c *gin.Context) { + var params request.AddReceipt + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := service.NewReceiptService().AddReceipt(¶ms.Receipt) + 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/receipt/delete/{id} [delete] +func (s *ReceiptApi) Delete(c *gin.Context) { + ctx, ok := contextx.NewContext(c, nil) + if !ok { + return + } + + id, _ := strconv.Atoi(c.Param("id")) + errCode := service.NewReceiptService().DeleteReceipt(id) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// Update +// @Tags 鏀舵鍗曠鐞� +// @Summary 鏇存柊鏀舵鍗� +// @Produce application/json +// @Param object body request.UpdateReceipt true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/receipt/update [put] +func (s *ReceiptApi) Update(c *gin.Context) { + var params request.UpdateReceipt + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.Receipt.Id = params.Id + + errCode := service.NewReceiptService().UpdateReceipt(¶ms.Receipt) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} + +// List +// @Tags 鏀舵鍗曠鐞� +// @Summary 鑾峰彇鏀舵鍗曞垪琛� +// @Produce application/json +// @Param object query request.GetReceiptList true "鍙傛暟" +// @Success 200 {object} response.ListResponse{data=[]model.Receipt} +// @Router /api/receipt/list [get] +func (s *ReceiptApi) List(c *gin.Context) { + var params request.GetReceiptList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + receipt, total, errCode := service.NewReceiptService().GetReceiptList() + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ListResponse{ + Data: receipt, + Count: total, + }) +} diff --git a/constvar/bankAccount.go b/constvar/bankAccount.go new file mode 100644 index 0000000..4e59333 --- /dev/null +++ b/constvar/bankAccount.go @@ -0,0 +1,12 @@ +package constvar +type BankAccountQueryClass string + +const ( + BankAccountQueryClassExpireLessThen60Days BankAccountQueryClass = "" +) + +type BankAccountKeywordType string + +const ( + BankAccountKeywordCustomerName BankAccountKeywordType = "" +) diff --git a/constvar/paymentType.go b/constvar/paymentType.go new file mode 100644 index 0000000..f44593a --- /dev/null +++ b/constvar/paymentType.go @@ -0,0 +1,12 @@ +package constvar +type PaymentTypeQueryClass string + +const ( + PaymentTypeQueryClassExpireLessThen60Days PaymentTypeQueryClass = "" +) + +type PaymentTypeKeywordType string + +const ( + PaymentTypeKeywordCustomerName PaymentTypeKeywordType = "" +) diff --git a/constvar/receipt.go b/constvar/receipt.go new file mode 100644 index 0000000..df8e86e --- /dev/null +++ b/constvar/receipt.go @@ -0,0 +1,12 @@ +package constvar +type ReceiptQueryClass string + +const ( + ReceiptQueryClassExpireLessThen60Days ReceiptQueryClass = "" +) + +type ReceiptKeywordType string + +const ( + ReceiptKeywordCustomerName ReceiptKeywordType = "" +) diff --git a/docs/docs.go b/docs/docs.go index 1c6480c..4b55d3a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -241,6 +241,169 @@ } } }, + "/api/bankAccount/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "娣诲姞閾惰璐︽埛", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddBankAccount" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/bankAccount/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/bankAccount/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "鑾峰彇閾惰璐︽埛鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "BankAccountKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "BankAccountQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.BankAccount" + } + } + } + } + ] + } + } + } + } + }, + "/api/bankAccount/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "鏇存柊閾惰璐︽埛", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateBankAccount" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/base/captcha": { "post": { "produces": [ @@ -3271,6 +3434,169 @@ } } }, + "/api/paymentType/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "娣诲姞鏀粯鏂瑰紡", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddPaymentType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/paymentType/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/paymentType/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "鑾峰彇鏀粯鏂瑰紡鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "PaymentTypeKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "PaymentTypeQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.PaymentType" + } + } + } + } + ] + } + } + } + } + }, + "/api/paymentType/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "鏇存柊鏀粯鏂瑰紡", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdatePaymentType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/plan/add": { "post": { "produces": [ @@ -4036,6 +4362,169 @@ "required": true, "schema": { "$ref": "#/definitions/request.UpdateQuotationStatuss" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/receipt/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "娣诲姞鏀舵鍗�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddReceipt" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/receipt/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/receipt/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "鑾峰彇鏀舵鍗曞垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "ReceiptKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "ReceiptQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Receipt" + } + } + } + } + ] + } + } + } + } + }, + "/api/receipt/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "鏇存柊鏀舵鍗�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateReceipt" } } ], @@ -8071,6 +8560,24 @@ } }, "definitions": { + "constvar.BankAccountKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "BankAccountKeywordCustomerName" + ] + }, + "constvar.BankAccountQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "BankAccountQueryClassExpireLessThen60Days" + ] + }, "constvar.FaqKeywordType": { "type": "string", "enum": [ @@ -8087,6 +8594,42 @@ ], "x-enum-varnames": [ "FaqQueryClassExpireLessThen60Days" + ] + }, + "constvar.PaymentTypeKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "PaymentTypeKeywordCustomerName" + ] + }, + "constvar.PaymentTypeQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "PaymentTypeQueryClassExpireLessThen60Days" + ] + }, + "constvar.ReceiptKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "ReceiptKeywordCustomerName" + ] + }, + "constvar.ReceiptQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "ReceiptQueryClassExpireLessThen60Days" ] }, "constvar.SalesStatus": { @@ -8281,6 +8824,17 @@ "items": { "$ref": "#/definitions/model.Menu" } + } + } + }, + "model.BankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" } } }, @@ -8941,6 +9495,17 @@ } } }, + "model.PaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "model.Plan": { "type": "object", "properties": { @@ -9099,6 +9664,54 @@ }, "name": { "type": "string" + } + } + }, + "model.Receipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -9584,7 +10197,7 @@ "description": "姣斾緥", "type": "number" }, - "principal": { + "principalId": { "description": "鏀舵璐熻矗浜篒D", "type": "integer" }, @@ -10082,6 +10695,17 @@ } } }, + "request.AddBankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddCity": { "type": "object", "properties": { @@ -10517,6 +11141,17 @@ } } }, + "request.AddPaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddPlan": { "type": "object", "properties": { @@ -10596,6 +11231,54 @@ "properties": { "name": { "type": "string" + } + } + }, + "request.AddReceipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -12208,6 +12891,17 @@ } } }, + "request.UpdateBankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateCities": { "type": "object", "properties": { @@ -12899,6 +13593,17 @@ } } }, + "request.UpdatePaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdatePlan": { "type": "object", "properties": { @@ -13036,6 +13741,54 @@ "items": { "$ref": "#/definitions/request.UpdateQuotationStatus" } + } + } + }, + "request.UpdateReceipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -13573,7 +14326,7 @@ "description": "姣斾緥", "type": "number" }, - "principal": { + "principalId": { "description": "鏀舵璐熻矗浜篒D", "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index 7aa19d5..67562ee 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -229,6 +229,169 @@ } } }, + "/api/bankAccount/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "娣诲姞閾惰璐︽埛", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddBankAccount" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/bankAccount/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/bankAccount/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "鑾峰彇閾惰璐︽埛鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "BankAccountKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "BankAccountQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.BankAccount" + } + } + } + } + ] + } + } + } + } + }, + "/api/bankAccount/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "閾惰璐︽埛绠$悊" + ], + "summary": "鏇存柊閾惰璐︽埛", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateBankAccount" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/base/captcha": { "post": { "produces": [ @@ -3259,6 +3422,169 @@ } } }, + "/api/paymentType/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "娣诲姞鏀粯鏂瑰紡", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddPaymentType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/paymentType/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/paymentType/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "鑾峰彇鏀粯鏂瑰紡鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "PaymentTypeKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "PaymentTypeQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.PaymentType" + } + } + } + } + ] + } + } + } + } + }, + "/api/paymentType/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀粯鏂瑰紡绠$悊" + ], + "summary": "鏇存柊鏀粯鏂瑰紡", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdatePaymentType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, "/api/plan/add": { "post": { "produces": [ @@ -4024,6 +4350,169 @@ "required": true, "schema": { "$ref": "#/definitions/request.UpdateQuotationStatuss" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/receipt/add": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "娣诲姞鏀舵鍗�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddReceipt" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/contextx.Response" + } + } + } + } + }, + "/api/receipt/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/receipt/list": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "鑾峰彇鏀舵鍗曞垪琛�", + "parameters": [ + { + "type": "string", + "name": "keyword", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "ReceiptKeywordCustomerName" + ], + "name": "keywordType", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "enum": [ + "" + ], + "type": "string", + "x-enum-varnames": [ + "ReceiptQueryClassExpireLessThen60Days" + ], + "name": "queryClass", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.ListResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Receipt" + } + } + } + } + ] + } + } + } + } + }, + "/api/receipt/update": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "鏀舵鍗曠鐞�" + ], + "summary": "鏇存柊鏀舵鍗�", + "parameters": [ + { + "description": "鏌ヨ鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.UpdateReceipt" } } ], @@ -8059,6 +8548,24 @@ } }, "definitions": { + "constvar.BankAccountKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "BankAccountKeywordCustomerName" + ] + }, + "constvar.BankAccountQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "BankAccountQueryClassExpireLessThen60Days" + ] + }, "constvar.FaqKeywordType": { "type": "string", "enum": [ @@ -8075,6 +8582,42 @@ ], "x-enum-varnames": [ "FaqQueryClassExpireLessThen60Days" + ] + }, + "constvar.PaymentTypeKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "PaymentTypeKeywordCustomerName" + ] + }, + "constvar.PaymentTypeQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "PaymentTypeQueryClassExpireLessThen60Days" + ] + }, + "constvar.ReceiptKeywordType": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "ReceiptKeywordCustomerName" + ] + }, + "constvar.ReceiptQueryClass": { + "type": "string", + "enum": [ + "" + ], + "x-enum-varnames": [ + "ReceiptQueryClassExpireLessThen60Days" ] }, "constvar.SalesStatus": { @@ -8269,6 +8812,17 @@ "items": { "$ref": "#/definitions/model.Menu" } + } + } + }, + "model.BankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" } } }, @@ -8929,6 +9483,17 @@ } } }, + "model.PaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "model.Plan": { "type": "object", "properties": { @@ -9087,6 +9652,54 @@ }, "name": { "type": "string" + } + } + }, + "model.Receipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -9572,7 +10185,7 @@ "description": "姣斾緥", "type": "number" }, - "principal": { + "principalId": { "description": "鏀舵璐熻矗浜篒D", "type": "integer" }, @@ -10070,6 +10683,17 @@ } } }, + "request.AddBankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddCity": { "type": "object", "properties": { @@ -10505,6 +11129,17 @@ } } }, + "request.AddPaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.AddPlan": { "type": "object", "properties": { @@ -10584,6 +11219,54 @@ "properties": { "name": { "type": "string" + } + } + }, + "request.AddReceipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -12196,6 +12879,17 @@ } } }, + "request.UpdateBankAccount": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdateCities": { "type": "object", "properties": { @@ -12887,6 +13581,17 @@ } } }, + "request.UpdatePaymentType": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, "request.UpdatePlan": { "type": "object", "properties": { @@ -13024,6 +13729,54 @@ "items": { "$ref": "#/definitions/request.UpdateQuotationStatus" } + } + } + }, + "request.UpdateReceipt": { + "type": "object", + "properties": { + "bankAccountId": { + "description": "璐︽埛id", + "type": "integer" + }, + "clientId": { + "description": "瀹㈡埛id", + "type": "integer" + }, + "fileId": { + "description": "闄勪欢id", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "moneyType": { + "description": "甯佺", + "type": "string" + }, + "paymentTypeId": { + "description": "鏀舵鏂瑰紡ID", + "type": "integer" + }, + "principalId": { + "description": "璐熻矗浜篿d", + "type": "integer" + }, + "receiptDate": { + "description": "鏀舵鏃ユ湡", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", + "type": "integer" } } }, @@ -13561,7 +14314,7 @@ "description": "姣斾緥", "type": "number" }, - "principal": { + "principalId": { "description": "鏀舵璐熻矗浜篒D", "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 6fb9f7b..c8dcd43 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,16 @@ definitions: + constvar.BankAccountKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - BankAccountKeywordCustomerName + constvar.BankAccountQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - BankAccountQueryClassExpireLessThen60Days constvar.FaqKeywordType: enum: - "" @@ -11,6 +23,30 @@ type: string x-enum-varnames: - FaqQueryClassExpireLessThen60Days + constvar.PaymentTypeKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - PaymentTypeKeywordCustomerName + constvar.PaymentTypeQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - PaymentTypeQueryClassExpireLessThen60Days + constvar.ReceiptKeywordType: + enum: + - "" + type: string + x-enum-varnames: + - ReceiptKeywordCustomerName + constvar.ReceiptQueryClass: + enum: + - "" + type: string + x-enum-varnames: + - ReceiptQueryClassExpireLessThen60Days constvar.SalesStatus: enum: - 1 @@ -167,6 +203,13 @@ items: $ref: '#/definitions/model.Menu' type: array + type: object + model.BankAccount: + properties: + id: + type: integer + name: + type: string type: object model.City: properties: @@ -598,6 +641,13 @@ name: type: string type: object + model.PaymentType: + properties: + id: + type: integer + name: + type: string + type: object model.Plan: properties: clientId: @@ -702,6 +752,41 @@ type: integer name: type: string + type: object + model.Receipt: + properties: + bankAccountId: + description: 璐︽埛id + type: integer + clientId: + description: 瀹㈡埛id + type: integer + fileId: + description: 闄勪欢id + type: integer + id: + type: integer + moneyType: + description: 甯佺 + type: string + paymentTypeId: + description: 鏀舵鏂瑰紡ID + type: integer + principalId: + description: 璐熻矗浜篿d + type: integer + receiptDate: + description: 鏀舵鏃ユ湡 + type: string + remark: + description: 澶囨敞 + type: string + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 + type: integer type: object model.RefundMethod: properties: @@ -1021,7 +1106,7 @@ percent: description: 姣斾緥 type: number - principal: + principalId: description: 鏀舵璐熻矗浜篒D type: integer remark: @@ -1358,6 +1443,13 @@ $ref: '#/definitions/request.CasbinInfo' type: array type: object + request.AddBankAccount: + properties: + id: + type: integer + name: + type: string + type: object request.AddCity: properties: name: @@ -1653,6 +1745,13 @@ required: - name type: object + request.AddPaymentType: + properties: + id: + type: integer + name: + type: string + type: object request.AddPlan: properties: plan: @@ -1705,6 +1804,41 @@ type: string required: - name + type: object + request.AddReceipt: + properties: + bankAccountId: + description: 璐︽埛id + type: integer + clientId: + description: 瀹㈡埛id + type: integer + fileId: + description: 闄勪欢id + type: integer + id: + type: integer + moneyType: + description: 甯佺 + type: string + paymentTypeId: + description: 鏀舵鏂瑰紡ID + type: integer + principalId: + description: 璐熻矗浜篿d + type: integer + receiptDate: + description: 鏀舵鏃ユ湡 + type: string + remark: + description: 澶囨敞 + type: string + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 + type: integer type: object request.AddRefundMethod: properties: @@ -2801,6 +2935,13 @@ required: - account_id type: object + request.UpdateBankAccount: + properties: + id: + type: integer + name: + type: string + type: object request.UpdateCities: properties: cities: @@ -3267,6 +3408,13 @@ required: - order_type type: object + request.UpdatePaymentType: + properties: + id: + type: integer + name: + type: string + type: object request.UpdatePlan: properties: id: @@ -3358,6 +3506,41 @@ type: array required: - quotation_status + type: object + request.UpdateReceipt: + properties: + bankAccountId: + description: 璐︽埛id + type: integer + clientId: + description: 瀹㈡埛id + type: integer + fileId: + description: 闄勪欢id + type: integer + id: + type: integer + moneyType: + description: 甯佺 + type: string + paymentTypeId: + description: 鏀舵鏂瑰紡ID + type: integer + principalId: + description: 璐熻矗浜篿d + type: integer + receiptDate: + description: 鏀舵鏃ユ湡 + type: string + remark: + description: 澶囨敞 + type: string + sourceId: + description: 婧愬崟id + type: integer + sourceType: + description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 + type: integer type: object request.UpdateRefundMethod: properties: @@ -3715,7 +3898,7 @@ percent: description: 姣斾緥 type: number - principal: + principalId: description: 鏀舵璐熻矗浜篒D type: integer remark: @@ -4838,6 +5021,107 @@ summary: 璁剧疆瑙掕壊鑿滃崟 tags: - Authority + /api/bankAccount/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddBankAccount' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞閾惰璐︽埛 + tags: + - 閾惰璐︽埛绠$悊 + /api/bankAccount/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/bankAccount/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - BankAccountKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - BankAccountQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.BankAccount' + type: array + type: object + summary: 鑾峰彇閾惰璐︽埛鍒楄〃 + tags: + - 閾惰璐︽埛绠$悊 + /api/bankAccount/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateBankAccount' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊閾惰璐︽埛 + tags: + - 閾惰璐︽埛绠$悊 /api/base/captcha: post: produces: @@ -6691,6 +6975,107 @@ summary: 鏇存柊宸ュ崟绫诲瀷 tags: - OrderType + /api/paymentType/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddPaymentType' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞鏀粯鏂瑰紡 + tags: + - 鏀粯鏂瑰紡绠$悊 + /api/paymentType/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/paymentType/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - PaymentTypeKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - PaymentTypeQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.PaymentType' + type: array + type: object + summary: 鑾峰彇鏀粯鏂瑰紡鍒楄〃 + tags: + - 鏀粯鏂瑰紡绠$悊 + /api/paymentType/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdatePaymentType' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊鏀粯鏂瑰紡 + tags: + - 鏀粯鏂瑰紡绠$悊 /api/plan/add: post: parameters: @@ -7170,6 +7555,107 @@ summary: 鏇存柊鎶ヤ环鍗曠姸鎬� tags: - QuotationStatus + /api/receipt/add: + post: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddReceipt' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 娣诲姞鏀舵鍗� + tags: + - 鏀舵鍗曠鐞� + /api/receipt/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/receipt/list: + get: + parameters: + - in: query + name: keyword + type: string + - enum: + - "" + in: query + name: keywordType + type: string + x-enum-varnames: + - ReceiptKeywordCustomerName + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - enum: + - "" + in: query + name: queryClass + type: string + x-enum-varnames: + - ReceiptQueryClassExpireLessThen60Days + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.ListResponse' + - properties: + data: + items: + $ref: '#/definitions/model.Receipt' + type: array + type: object + summary: 鑾峰彇鏀舵鍗曞垪琛� + tags: + - 鏀舵鍗曠鐞� + /api/receipt/update: + put: + parameters: + - description: 鏌ヨ鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.UpdateReceipt' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/contextx.Response' + summary: 鏇存柊鏀舵鍗� + tags: + - 鏀舵鍗曠鐞� /api/refundMethod/add: post: parameters: diff --git a/model/bankAccount.go b/model/bankAccount.go new file mode 100644 index 0000000..006e9b8 --- /dev/null +++ b/model/bankAccount.go @@ -0,0 +1,140 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // BankAccount 閾惰璐︽埛 + BankAccount struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name"` + } + + // BankAccountSearch 閾惰璐︽埛鎼滅储鏉′欢 + BankAccountSearch struct { + BankAccount + Orm *gorm.DB + QueryClass constvar.BankAccountQueryClass + KeywordType constvar.BankAccountKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (BankAccount) TableName() string { + return "bank_account" +} + +func NewBankAccountSearch() *BankAccountSearch { + return &BankAccountSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *BankAccountSearch) build() *gorm.DB { + var db = slf.Orm.Model(&BankAccount{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *BankAccountSearch) Create(record *BankAccount) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *BankAccountSearch) CreateBatch(records []*BankAccount) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *BankAccountSearch) Delete() error { + var db = slf.build() + return db.Delete(&BankAccount{}).Error +} + +func (slf *BankAccountSearch) Update(record *BankAccount) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *BankAccountSearch) FindAll() ([]*BankAccount, error) { + var db = slf.build() + var record = make([]*BankAccount, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *BankAccountSearch) SetId(id int) *BankAccountSearch { + slf.Id = id + return slf +} + +func (slf *BankAccountSearch) SetOrm(tx *gorm.DB) *BankAccountSearch { + slf.Orm = tx + return slf +} + +func (slf *BankAccountSearch) First() (*BankAccount, error) { + var db = slf.build() + var record = new(BankAccount) + err := db.First(record).Error + return record, err +} + +func (slf *BankAccountSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *BankAccountSearch) Save(record *BankAccount) 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 *BankAccountSearch) Find() ([]*BankAccount, int64, error) { + var db = slf.build() + var records = make([]*BankAccount, 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 *BankAccountSearch) 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 := []*BankAccount{} + return slf.CreateBatch(records) +} diff --git a/model/paymentType.go b/model/paymentType.go new file mode 100644 index 0000000..e16a84a --- /dev/null +++ b/model/paymentType.go @@ -0,0 +1,140 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // PaymentType 鏀粯鏂瑰紡 + PaymentType struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name"` + } + + // PaymentTypeSearch 鏀粯鏂瑰紡鎼滅储鏉′欢 + PaymentTypeSearch struct { + PaymentType + Orm *gorm.DB + QueryClass constvar.PaymentTypeQueryClass + KeywordType constvar.PaymentTypeKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (PaymentType) TableName() string { + return "payment_type" +} + +func NewPaymentTypeSearch() *PaymentTypeSearch { + return &PaymentTypeSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *PaymentTypeSearch) build() *gorm.DB { + var db = slf.Orm.Model(&PaymentType{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *PaymentTypeSearch) Create(record *PaymentType) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *PaymentTypeSearch) CreateBatch(records []*PaymentType) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *PaymentTypeSearch) Delete() error { + var db = slf.build() + return db.Delete(&PaymentType{}).Error +} + +func (slf *PaymentTypeSearch) Update(record *PaymentType) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *PaymentTypeSearch) FindAll() ([]*PaymentType, error) { + var db = slf.build() + var record = make([]*PaymentType, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *PaymentTypeSearch) SetId(id int) *PaymentTypeSearch { + slf.Id = id + return slf +} + +func (slf *PaymentTypeSearch) SetOrm(tx *gorm.DB) *PaymentTypeSearch { + slf.Orm = tx + return slf +} + +func (slf *PaymentTypeSearch) First() (*PaymentType, error) { + var db = slf.build() + var record = new(PaymentType) + err := db.First(record).Error + return record, err +} + +func (slf *PaymentTypeSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *PaymentTypeSearch) Save(record *PaymentType) 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 *PaymentTypeSearch) Find() ([]*PaymentType, int64, error) { + var db = slf.build() + var records = make([]*PaymentType, 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 *PaymentTypeSearch) 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 := []*PaymentType{} + return slf.CreateBatch(records) +} diff --git a/model/receipt.go b/model/receipt.go new file mode 100644 index 0000000..60d1d2a --- /dev/null +++ b/model/receipt.go @@ -0,0 +1,149 @@ +package model + +import ( + "aps_crm/constvar" + "aps_crm/pkg/mysqlx" + "errors" + "fmt" + "gorm.io/gorm" +) + +type ( + // Receipt 鏀舵鍗� + Receipt struct { + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + SourceType int `gorm:"source_type" json:"sourceType"` // 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 + SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id + PrincipalId int `gorm:"principal_id" json:"principalId"` // 璐熻矗浜篿d + ReceiptDate string `gorm:"receipt_date" json:"receiptDate"` // 鏀舵鏃ユ湡 + MoneyType string `gorm:"money_type" json:"moneyType"` // 甯佺 + PaymentTypeId int `gorm:"payment_type_id" json:"paymentTypeId"` // 鏀舵鏂瑰紡ID + BankAccountId int `gorm:"bank_account_id" json:"bankAccountId"` // 璐︽埛id + Remark string `gorm:"remark" json:"remark"` // 澶囨敞 + FileId int `gorm:"file_id" json:"fileId"` // 闄勪欢id + } + + // ReceiptSearch 鏀舵鍗曟悳绱㈡潯浠� + ReceiptSearch struct { + Receipt + Orm *gorm.DB + QueryClass constvar.ReceiptQueryClass + KeywordType constvar.ReceiptKeywordType + Keyword string + PageNum int + PageSize int + } +) + +func (Receipt) TableName() string { + return "receipt" +} + +func NewReceiptSearch() *ReceiptSearch { + return &ReceiptSearch{ + Orm: mysqlx.GetDB(), + } +} + +func (slf *ReceiptSearch) build() *gorm.DB { + var db = slf.Orm.Model(&Receipt{}) + if slf.Id != 0 { + db = db.Where("id = ?", slf.Id) + } + + return db +} + +func (slf *ReceiptSearch) Create(record *Receipt) error { + var db = slf.build() + return db.Create(record).Error +} + +func (slf *ReceiptSearch) CreateBatch(records []*Receipt) error { + var db = slf.build() + return db.Create(records).Error +} + +func (slf *ReceiptSearch) Delete() error { + var db = slf.build() + return db.Delete(&Receipt{}).Error +} + +func (slf *ReceiptSearch) Update(record *Receipt) error { + var db = slf.build() + return db.Updates(record).Error +} + +func (slf *ReceiptSearch) FindAll() ([]*Receipt, error) { + var db = slf.build() + var record = make([]*Receipt, 0) + err := db.Find(&record).Error + return record, err +} + +func (slf *ReceiptSearch) SetId(id int) *ReceiptSearch { + slf.Id = id + return slf +} + +func (slf *ReceiptSearch) SetOrm(tx *gorm.DB) *ReceiptSearch { + slf.Orm = tx + return slf +} + +func (slf *ReceiptSearch) First() (*Receipt, error) { + var db = slf.build() + var record = new(Receipt) + err := db.First(record).Error + return record, err +} + +func (slf *ReceiptSearch) Updates(values interface{}) error { + var db = slf.build() + return db.Updates(values).Error +} + +func (slf *ReceiptSearch) Save(record *Receipt) 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 *ReceiptSearch) Find() ([]*Receipt, int64, error) { + var db = slf.build() + var records = make([]*Receipt, 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 *ReceiptSearch) 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 := []*Receipt{} + return slf.CreateBatch(records) +} diff --git a/model/request/bankAccount.go b/model/request/bankAccount.go new file mode 100644 index 0000000..3eed94e --- /dev/null +++ b/model/request/bankAccount.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddBankAccount struct { + model.BankAccount +} + +type UpdateBankAccount struct { + Id int `json:"id"` + model.BankAccount +} + +type GetBankAccountList struct { + PageInfo + QueryClass constvar.BankAccountQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.BankAccountKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/request/paymentType.go b/model/request/paymentType.go new file mode 100644 index 0000000..3c9e8ae --- /dev/null +++ b/model/request/paymentType.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddPaymentType struct { + model.PaymentType +} + +type UpdatePaymentType struct { + Id int `json:"id"` + model.PaymentType +} + +type GetPaymentTypeList struct { + PageInfo + QueryClass constvar.PaymentTypeQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.PaymentTypeKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/model/request/receipt.go b/model/request/receipt.go new file mode 100644 index 0000000..677d508 --- /dev/null +++ b/model/request/receipt.go @@ -0,0 +1,22 @@ +package request + +import ( + "aps_crm/constvar" + "aps_crm/model" +) + +type AddReceipt struct { + model.Receipt +} + +type UpdateReceipt struct { + Id int `json:"id"` + model.Receipt +} + +type GetReceiptList struct { + PageInfo + QueryClass constvar.ReceiptQueryClass `json:"queryClass" form:"queryClass"` + KeywordType constvar.ReceiptKeywordType `json:"keywordType" form:"keywordType"` + Keyword string `json:"keyword" form:"keyword"` +} diff --git a/router/bankAccount.go b/router/bankAccount.go new file mode 100644 index 0000000..d5adf98 --- /dev/null +++ b/router/bankAccount.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitBankAccountRouter(router *gin.RouterGroup) { + BankAccountRouter := router.Group("bankAccount") + BankAccountApi := v1.BankAccountApi{} + { + BankAccountRouter.POST("add", BankAccountApi.Add) // 娣诲姞閾惰璐︽埛 + BankAccountRouter.DELETE("delete/:id", BankAccountApi.Delete) // 鍒犻櫎閾惰璐︽埛 + BankAccountRouter.PUT("update", BankAccountApi.Update) // 鏇存柊閾惰璐︽埛 + BankAccountRouter.GET("list", BankAccountApi.List) // 鑾峰彇閾惰璐︽埛鍒楄〃 + } +} diff --git a/router/index.go b/router/index.go index 635352f..386f3c8 100644 --- a/router/index.go +++ b/router/index.go @@ -167,6 +167,9 @@ InitTimeSpentRouter(PrivateGroup) InitFaultTypeRouter(PrivateGroup) InitServiceCollectionPlanRouter(PrivateGroup) + InitReceiptRouter(PrivateGroup) + InitBankAccountRouter(PrivateGroup) + InitPaymentTypeRouter(PrivateGroup) } return Router } diff --git a/router/paymentType.go b/router/paymentType.go new file mode 100644 index 0000000..a320b69 --- /dev/null +++ b/router/paymentType.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitPaymentTypeRouter(router *gin.RouterGroup) { + PaymentTypeRouter := router.Group("paymentType") + PaymentTypeApi := v1.PaymentTypeApi{} + { + PaymentTypeRouter.POST("add", PaymentTypeApi.Add) // 娣诲姞鏀粯鏂瑰紡 + PaymentTypeRouter.DELETE("delete/:id", PaymentTypeApi.Delete) // 鍒犻櫎鏀粯鏂瑰紡 + PaymentTypeRouter.PUT("update", PaymentTypeApi.Update) // 鏇存柊鏀粯鏂瑰紡 + PaymentTypeRouter.GET("list", PaymentTypeApi.List) // 鑾峰彇鏀粯鏂瑰紡鍒楄〃 + } +} diff --git a/router/receipt.go b/router/receipt.go new file mode 100644 index 0000000..eea9a00 --- /dev/null +++ b/router/receipt.go @@ -0,0 +1,17 @@ +package router + +import ( + v1 "aps_crm/api/v1" + "github.com/gin-gonic/gin" +) + +func InitReceiptRouter(router *gin.RouterGroup) { + ReceiptRouter := router.Group("receipt") + ReceiptApi := v1.ReceiptApi{} + { + ReceiptRouter.POST("add", ReceiptApi.Add) // 娣诲姞鏀舵鍗� + ReceiptRouter.DELETE("delete/:id", ReceiptApi.Delete) // 鍒犻櫎鏀舵鍗� + ReceiptRouter.PUT("update", ReceiptApi.Update) // 鏇存柊鏀舵鍗� + ReceiptRouter.GET("list", ReceiptApi.List) // 鑾峰彇鏀舵鍗曞垪琛� + } +} diff --git a/service/bankAccount.go b/service/bankAccount.go new file mode 100644 index 0000000..4516672 --- /dev/null +++ b/service/bankAccount.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type BankAccountService struct{} + +func NewBankAccountService() BankAccountService { + return BankAccountService{} +} + +func (BankAccountService) AddBankAccount(bankAccount *model.BankAccount) int { + err := model.NewBankAccountSearch().Create(bankAccount) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (BankAccountService) DeleteBankAccount(id int) int { + err := model.NewBankAccountSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (BankAccountService) GetBankAccountList() ([]*model.BankAccount, int64, int) { + list, total, err := model.NewBankAccountSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (BankAccountService) UpdateBankAccounts(BankAccounts []*request.UpdateBankAccount) int { + for _, v := range BankAccounts { + // check BankAccount exist + _, err := model.NewBankAccountSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewBankAccountSearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (BankAccountService) UpdateBankAccount(bankAccount *model.BankAccount) int { + err := model.NewBankAccountSearch().SetId(bankAccount.Id).Save(bankAccount) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} diff --git a/service/paymentType.go b/service/paymentType.go new file mode 100644 index 0000000..83ec447 --- /dev/null +++ b/service/paymentType.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type PaymentTypeService struct{} + +func NewPaymentTypeService() PaymentTypeService { + return PaymentTypeService{} +} + +func (PaymentTypeService) AddPaymentType(paymentType *model.PaymentType) int { + err := model.NewPaymentTypeSearch().Create(paymentType) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (PaymentTypeService) DeletePaymentType(id int) int { + err := model.NewPaymentTypeSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (PaymentTypeService) GetPaymentTypeList() ([]*model.PaymentType, int64, int) { + list, total, err := model.NewPaymentTypeSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (PaymentTypeService) UpdatePaymentTypes(PaymentTypes []*request.UpdatePaymentType) int { + for _, v := range PaymentTypes { + // check PaymentType exist + _, err := model.NewPaymentTypeSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewPaymentTypeSearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (PaymentTypeService) UpdatePaymentType(paymentType *model.PaymentType) int { + err := model.NewPaymentTypeSearch().SetId(paymentType.Id).Save(paymentType) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} diff --git a/service/receipt.go b/service/receipt.go new file mode 100644 index 0000000..834c6df --- /dev/null +++ b/service/receipt.go @@ -0,0 +1,66 @@ +package service + +import ( + "aps_crm/model" + "aps_crm/model/request" + "aps_crm/pkg/ecode" +) + +type ReceiptService struct{} + +func NewReceiptService() ReceiptService { + return ReceiptService{} +} + +func (ReceiptService) AddReceipt(receipt *model.Receipt) int { + err := model.NewReceiptSearch().Create(receipt) + if err != nil { + return ecode.DBErr + } + + return ecode.OK +} + +func (ReceiptService) DeleteReceipt(id int) int { + err := model.NewReceiptSearch().SetId(id).Delete() + if err != nil { + return ecode.DBErr + } + return ecode.OK +} + +func (ReceiptService) GetReceiptList() ([]*model.Receipt, int64, int) { + list, total, err := model.NewReceiptSearch().Find() + if err != nil { + return nil, 0, ecode.DBErr + } + + return list, total, ecode.OK +} + +func (ReceiptService) UpdateReceipts(Receipts []*request.UpdateReceipt) int { + for _, v := range Receipts { + // check Receipt exist + _, err := model.NewReceiptSearch().SetId(v.Id).First() + if err != nil { + return ecode.DBErr + } + + err = model.NewReceiptSearch().SetId(v.Id).Updates(map[string]interface{}{ + + }) + if err != nil { + return ecode.DBErr + } + } + + return ecode.OK +} + +func (ReceiptService) UpdateReceipt(receipt *model.Receipt) int { + err := model.NewReceiptSearch().SetId(receipt.Id).Save(receipt) + if err != nil { + return ecode.DBErr + } + return ecode.OK +} -- Gitblit v1.8.0