From 34ef7217a034599217a7fdd1e28e1ae6910e1b4b Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期三, 11 十月 2023 20:15:21 +0800 Subject: [PATCH] 菜单获取编码规则 --- model/request/masterOrder.go | 16 model/request/salesDetails.go | 37 docs/swagger.yaml | 252 +++++ api/v1/salesReturn.go | 8 model/request/serviceOrder.go | 57 model/request/contract.go | 16 api/v1/salesRefund.go | 9 api/v1/salesLeads.go | 8 model/util.go | 28 model/request/salesReturn.go | 3 model/subOrder.go | 5 model/salesReturn.go | 6 model/salesLeads.go | 1 api/v1/masterOrder.go | 9 model/request/saleChance.go | 62 api/v1/code.go | 73 + docs/docs.go | 368 ++++++++ model/followRecord.go | 5 constvar/const.go | 72 + model/serviceOrder.go | 6 model/request/code_request.go | 32 model/request/salesRefund.go | 3 main.go | 2 api/v1/serviceFollowup.go | 8 model/request/quotation.go | 27 model/request/contact.go | 34 proto/code/code.pb.go | 584 +++++++++++++ api/v1/client.go | 8 model/contract.go | 5 api/v1/contact.go | 8 model/request/subOrder.go | 17 api/v1/contract.go | 9 model/contact.go | 29 api/v1/quotation.go | 9 model/masterOrder.go | 21 model/serviceFollowup.go | 6 model/request/serviceFollowup.go | 33 api/v1/salesDetails.go | 9 model/client.go | 1 proto/code/code_grpc.pb.go | 101 ++ model/request/followRecord.go | 32 model/request/salesLeads.go | 25 proto/code.proto | 48 + api/v1/subOrder.go | 8 model/saleChance.go | 5 model/request/client.go | 34 model/quotation.go | 1 api/v1/serviceOrder.go | 7 docs/swagger.json | 368 ++++++++ model/serviceContract.go | 1 api/v1/saleChance.go | 9 model/salesDetails.go | 1 api/v1/serviceContract.go | 8 model/request/serviceContract.go | 39 model/salesRefund.go | 6 router/index.go | 6 api/v1/followRecord.go | 8 57 files changed, 2,381 insertions(+), 212 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index e2c09de..839083a 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -45,6 +45,13 @@ ctx.Fail(errCode) return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(client.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewClientSearch(nil).SetId(client.Id).UpdateByMap(m) + } ctx.Ok() } @@ -106,6 +113,7 @@ client.Business.EnterpriseNatureId = params.EnterpriseNatureId client.Business.EnterpriseScaleId = params.EnterpriseScaleId client.MemberId = params.MemberId + client.CodeStandID = params.CodeStandID //if params.Contact.Name != "" { // assign the client's member id to contact when adding diff --git a/api/v1/code.go b/api/v1/code.go new file mode 100644 index 0000000..bb8ae8b --- /dev/null +++ b/api/v1/code.go @@ -0,0 +1,73 @@ +package v1 + +import ( + "aps_crm/conf" + "aps_crm/model/request" + "aps_crm/model/response" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "aps_crm/pkg/logx" + "aps_crm/proto/code" + "github.com/gin-gonic/gin" + "github.com/spf13/cast" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type CodeApi struct{} + +var ( + codeServiceConn *grpc.ClientConn +) + +func InitCodeServiceConn() { + var err error + codeServiceConn, err = grpc.Dial(conf.Conf.GrpcServiceAddr.Aps, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } +} + +func CloseCodeServiceConn() { + if codeServiceConn != nil { + codeServiceConn.Close() + } +} + +// GetCodeList +// +// @Tags 缂栫爜 +// @Summary 鑾峰彇缂栫爜鍒楄〃 +// @Produce application/json +// @Param object query request.GetCodeList true "鍙傛暟" +// @Success 200 {object} response.ListResponse +// +// @Router /api/code/getCodeList [get] +func (ca *CodeApi) GetCodeList(c *gin.Context) { + var params request.GetCodeList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + params.CodeStandID = c.Query("codeStandID") + params.Name = c.Query("name") + params.Type = c.Query("type") + client := code.NewCodeServiceClient(codeServiceConn) + list, err := client.GetCodeList(ctx.GetCtx(), &code.GetCodeListRequest{ + Page: cast.ToInt32(params.Page), + PageSize: cast.ToInt32(params.PageSize), + CodeStandID: params.CodeStandID, + Name: params.Name, + Type: params.Type, + }) + if err != nil { + logx.Errorf("GetCodeList err: %v", err.Error()) + ctx.FailWithMsg(ecode.UnknownErr, "grpc璋冪敤閿欒") + return + } + ctx.OkWithDetailed(response.ListResponse{ + Data: list.List, + Count: list.Total, + }) +} diff --git a/api/v1/contact.go b/api/v1/contact.go index 7daace8..0766523 100644 --- a/api/v1/contact.go +++ b/api/v1/contact.go @@ -37,6 +37,13 @@ ctx.Fail(errCode) return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(contact.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewContactSearch(nil).SetId(contact.Id).UpdateByMap(m) + } ctx.Ok() } @@ -141,6 +148,7 @@ contact.Birthday = t contact.Wechat = params.Wechat contact.IsFirst = params.IsFirst + contact.CodeStandID = params.CodeStandID return ecode.OK, contact } diff --git a/api/v1/contract.go b/api/v1/contract.go index ff42186..98b4ee9 100644 --- a/api/v1/contract.go +++ b/api/v1/contract.go @@ -38,6 +38,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(contract.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewContractSearch().SetId(contract.Id).UpdateByMap(m) + } + ctx.Ok() } @@ -113,6 +121,7 @@ QuotationId: contract.QuotationId, StatusId: contract.StatusId, File: contract.File, + CodeStandID: contract.CodeStandID, } return ecode.OK, contractModel diff --git a/api/v1/followRecord.go b/api/v1/followRecord.go index 0960dcf..6a4d6f8 100644 --- a/api/v1/followRecord.go +++ b/api/v1/followRecord.go @@ -39,6 +39,13 @@ ctx.Fail(errCode) return } + if params.FollowRecord.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(followRecord.Id, ¶ms.FollowRecord.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewFollowRecordSearch().SetId(followRecord.Id).UpdateMap(m) + } ctx.Ok() } @@ -167,6 +174,7 @@ followRecordModel.Purpose = followRecord.Purpose followRecordModel.Content = followRecord.Content followRecordModel.Record = followRecord.Record + followRecordModel.CodeStandID = followRecord.CodeStandID return ecode.OK, &followRecordModel } diff --git a/api/v1/masterOrder.go b/api/v1/masterOrder.go index ec53bae..c72c089 100644 --- a/api/v1/masterOrder.go +++ b/api/v1/masterOrder.go @@ -38,6 +38,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(masterOrder.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewContactSearch(nil).SetId(masterOrder.Id).UpdateByMap(m) + } + ctx.Ok() } @@ -124,6 +132,7 @@ masterOrderModel.MemberId = masterOrder.MemberId masterOrderModel.ClientId = masterOrder.ClientId masterOrderModel.Money = masterOrder.Money + masterOrderModel.CodeStandID = masterOrder.CodeStandID return ecode.OK, masterOrderModel } diff --git a/api/v1/quotation.go b/api/v1/quotation.go index a99f69a..a26d4e9 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.go @@ -38,6 +38,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(quotation.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewQuotationSearch(nil).SetId(quotation.Id).Updates(m) + } + ctx.Ok() } @@ -140,6 +148,7 @@ quotationModel.Conditions = quotation.Conditions quotationModel.File = quotation.File quotationModel.Products = quotation.Products + quotationModel.CodeStandID = quotation.CodeStandID return ecode.OK, quotationModel diff --git a/api/v1/saleChance.go b/api/v1/saleChance.go index 6c9d8dc..b7bedb5 100644 --- a/api/v1/saleChance.go +++ b/api/v1/saleChance.go @@ -38,6 +38,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(saleChance.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSaleChanceSearch().SetId(saleChance.Id).UpdateByMap(m) + } + ctx.Ok() } @@ -179,6 +187,7 @@ sc.Address.CityId = saleChance.Address.CityId sc.Address.CountryId = saleChance.Address.CountryId sc.Address.ProvinceId = saleChance.Address.ProvinceId + sc.CodeStandID = saleChance.CodeStandID return ecode.OK, sc } diff --git a/api/v1/salesDetails.go b/api/v1/salesDetails.go index 24a27a1..218dd0e 100644 --- a/api/v1/salesDetails.go +++ b/api/v1/salesDetails.go @@ -39,6 +39,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(salesDetails.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSalesDetailsSearch().SetId(salesDetails.Id).UpdateByMap(m) + } + ctx.OkWithDetailed(salesDetails) } @@ -138,6 +146,7 @@ salesDetailsModel.LogisticCompany = salesDetails.LogisticCompany salesDetailsModel.LogisticNumber = salesDetails.LogisticNumber salesDetailsModel.LogisticCost = salesDetails.LogisticCost + salesDetailsModel.CodeStandID = salesDetails.CodeStandID return ecode.OK, salesDetailsModel } diff --git a/api/v1/salesLeads.go b/api/v1/salesLeads.go index 1e751b5..c1dc6e4 100644 --- a/api/v1/salesLeads.go +++ b/api/v1/salesLeads.go @@ -38,6 +38,13 @@ ctx.Fail(errCode) return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(salesLeads.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSalesLeadsSearch(nil).SetId(salesLeads.Id).UpdateMap(m) + } ctx.Ok() } @@ -125,6 +132,7 @@ SalesSourcesId: params.SalesSourcesId, MemberId: params.MemberId, Desc: params.Desc, + CodeStandID: params.CodeStandID, Address: model.Address{ ProvinceId: params.ProvinceId, CityId: params.CityId, diff --git a/api/v1/salesRefund.go b/api/v1/salesRefund.go index 866b9dc..39e2743 100644 --- a/api/v1/salesRefund.go +++ b/api/v1/salesRefund.go @@ -40,6 +40,14 @@ return } + if params.SalesRefund.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(salesRefund.Id, ¶ms.SalesRefund.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSalesRefundSearch().SetId(salesRefund.Id).UpdateByMap(m) + } + ctx.Ok() } @@ -142,6 +150,7 @@ salesRefundRes.Products = salesRefund.Products salesRefundRes.SourceType = salesRefund.SourceType salesRefundRes.SourceId = salesRefund.SourceId + salesRefundRes.CodeStandID = salesRefund.CodeStandID return ecode.OK, salesRefundRes } diff --git a/api/v1/salesReturn.go b/api/v1/salesReturn.go index afc1355..5d3c004 100644 --- a/api/v1/salesReturn.go +++ b/api/v1/salesReturn.go @@ -41,6 +41,14 @@ return } + if params.SalesReturn.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(salesReturn.Id, ¶ms.SalesReturn.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSalesReturnSearch().SetId(salesReturn.Id).UpdateByMap(m) + } + ctx.Ok() } diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go index 012aa4b..216d4d3 100644 --- a/api/v1/serviceContract.go +++ b/api/v1/serviceContract.go @@ -39,6 +39,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(serviceContract.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewServiceContractSearch().SetId(serviceContract.Id).UpdateByMap(m) + } + ctx.Ok() } diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go index ea4f641..410de2d 100644 --- a/api/v1/serviceFollowup.go +++ b/api/v1/serviceFollowup.go @@ -37,6 +37,13 @@ ctx.Fail(errCode) return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(serviceFollowup.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).UpdateByMap(m) + } ctx.Ok() } @@ -121,6 +128,7 @@ OldMemberId: serviceFollowup.OldMemberId, Remark: serviceFollowup.Remark, File: serviceFollowup.File, + CodeStandID: serviceFollowup.CodeStandID, } return ecode.OK, serviceFollowupModel diff --git a/api/v1/serviceOrder.go b/api/v1/serviceOrder.go index 887979d..8bdd218 100644 --- a/api/v1/serviceOrder.go +++ b/api/v1/serviceOrder.go @@ -39,6 +39,13 @@ ctx.Fail(errCode) return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(serviceOrder.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewServiceOrderSearch().SetId(serviceOrder.Id).UpdateByMap(m) + } ctx.Ok() } diff --git a/api/v1/subOrder.go b/api/v1/subOrder.go index d6bdf6c..3d6a0a1 100644 --- a/api/v1/subOrder.go +++ b/api/v1/subOrder.go @@ -38,6 +38,13 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(subOrder.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSubOrderSearch(nil).SetId(subOrder.Id).UpdateByMap(m) + } ctx.Ok() } @@ -113,6 +120,7 @@ newSubOrder.MemberId = subOrder.MemberId newSubOrder.Products = subOrder.Product + newSubOrder.CodeStandID = subOrder.CodeStandID return ecode.OK, newSubOrder } diff --git a/constvar/const.go b/constvar/const.go index b70189e..20784bc 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -132,3 +132,75 @@ ServiceFeeKeywordProductName ServiceFeeKeywordType = "浜у搧鍚嶇О" ServiceFeeKeywordServiceEndDate ServiceFeeKeywordType = "鏈嶅姟鍒版湡鏃�" ) + +// CodeStandardType 缂栫爜绫诲瀷 +type CodeStandardType string + +const ( + CodeStandardTypeSaleLead CodeStandardType = "閿�鍞嚎绱㈢紪鐮�" + CodeStandardTypeCustom CodeStandardType = "瀹㈡埛缂栫爜" + CodeStandardTypeContact CodeStandardType = "鑱旂郴浜虹紪鐮�" + CodeStandardTypeFollowRecord CodeStandardType = "璺熻繘璁板綍缂栫爜" + CodeStandardTypeSaleKey CodeStandardType = "閿�鍞満浼氱紪鐮�" + CodeStandardTypeQuotation CodeStandardType = "鎶ヤ环缂栫爜" + CodeStandardTypeSaleTotalOrder CodeStandardType = "閿�鍞�诲崟缂栫爜" + CodeStandardTypeSaleSuborder CodeStandardType = "閿�鍞瓙鍗曠紪鐮�" + CodeStandardTypeSaleRefund CodeStandardType = "閿�鍞��娆剧紪鐮�" + CodeStandardTypeContract CodeStandardType = "鍚堝悓缂栫爜" + CodeStandardTypeServerContract CodeStandardType = "鏈嶅姟鍚堝悓缂栫爜" + CodeStandardTypeServerFollow CodeStandardType = "鏈嶅姟鍥炶缂栫爜" +) + +func (t CodeStandardType) Valid() bool { + if t != CodeStandardTypeSaleLead && + t != CodeStandardTypeCustom && + t != CodeStandardTypeContact && + t != CodeStandardTypeFollowRecord && + t != CodeStandardTypeSaleKey && + t != CodeStandardTypeQuotation && + t != CodeStandardTypeSaleTotalOrder && + t != CodeStandardTypeSaleSuborder && + t != CodeStandardTypeSaleRefund && + t != CodeStandardTypeContract && + t != CodeStandardTypeServerContract && + t != CodeStandardTypeServerFollow { + return false + } + return true +} + +// CodeGenerateMethod 缂栫爜鐢熸垚鏂瑰紡 +type CodeGenerateMethod int + +const ( + CodeGenerateMethodManual CodeGenerateMethod = iota // 鎵嬪姩鐢熸垚 + CodeGenerateMethodAuto // 鑷姩鐢熸垚 +) + +func (t CodeGenerateMethod) Valid() bool { + if t < CodeGenerateMethodManual || + t > CodeGenerateMethodAuto { + return false + } + return true +} + +// CommonStatus 甯哥敤鐘舵�� +type CommonStatus string + +const ( + CommonStatusEnable CommonStatus = "鍚敤" + CommonStatusDisable CommonStatus = "鏈惎鐢�" + CommonStatusScraped CommonStatus = "宸叉姤搴�" + CommonStatusUsing CommonStatus = "浣跨敤涓�" +) + +func (s CommonStatus) Valid() bool { + if s != CommonStatusEnable && + s != CommonStatusDisable && + s != CommonStatusScraped && + s != CommonStatusUsing { + return false + } + return true +} diff --git a/docs/docs.go b/docs/docs.go index 049bf2e..ed04f35 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1272,6 +1272,54 @@ } } }, + "/api/code/getCodeList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "缂栫爜" + ], + "summary": "鑾峰彇缂栫爜鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "codeStandID", + "in": "query" + }, + { + "type": "string", + "name": "name", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "name": "type", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.ListResponse" + } + } + } + } + }, "/api/collectionProjection/add": { "post": { "produces": [ @@ -10243,6 +10291,69 @@ } }, "definitions": { + "code.CodeAuto": { + "type": "object", + "properties": { + "AutoLength": { + "type": "integer" + }, + "Desc": { + "type": "string" + }, + "PrefixMethod": { + "type": "integer" + }, + "PrefixValue": { + "type": "string" + }, + "SuffixMethod": { + "type": "integer" + } + } + }, + "code.CodeRule": { + "type": "object", + "properties": { + "Desc": { + "type": "string" + }, + "Length": { + "type": "integer" + }, + "Name": { + "type": "string" + } + } + }, + "code.CodeStandard": { + "type": "object", + "properties": { + "AutoRule": { + "$ref": "#/definitions/code.CodeAuto" + }, + "ID": { + "type": "string" + }, + "List": { + "type": "array", + "items": { + "$ref": "#/definitions/code.CodeRule" + } + }, + "Method": { + "type": "integer" + }, + "Name": { + "type": "string" + }, + "Status": { + "type": "string" + }, + "Type": { + "type": "string" + } + } + }, "constvar.BankAccountKeywordType": { "type": "string", "enum": [ @@ -10869,6 +10980,9 @@ "client_type_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contacts": { "type": "array", "items": { @@ -11064,6 +11178,9 @@ "client_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "country": { "$ref": "#/definitions/model.Country" }, @@ -11134,6 +11251,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "country": { "$ref": "#/definitions/model.Country" @@ -11213,6 +11333,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "created_at": { "description": "The date when the item was created\nexample: 2023-08-10 15:48:25", @@ -11360,6 +11483,9 @@ }, "client_status_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact": { "$ref": "#/definitions/model.Contact" @@ -11558,6 +11684,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "end_time": { "type": "string" @@ -11783,6 +11912,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "conditions": { "type": "string" @@ -12022,6 +12154,9 @@ "client_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "collection_projections": { "type": "array", "items": { @@ -12207,6 +12342,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "conditions": { "type": "string" }, @@ -12283,6 +12421,9 @@ }, "city_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact_name": { "type": "string" @@ -12375,6 +12516,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "createTime": { "type": "string" }, @@ -12459,6 +12603,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "createTime": { "type": "string" @@ -12666,6 +12813,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contact": { "$ref": "#/definitions/model.Contact" }, @@ -12806,6 +12956,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contact": { "$ref": "#/definitions/model.Contact" }, @@ -12902,6 +13055,9 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact": { "$ref": "#/definitions/model.Contact" @@ -13108,6 +13264,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "id": { "type": "integer" @@ -13348,6 +13507,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -13492,6 +13658,13 @@ "description": "鎵�灞炲叕鍙窱D", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "country_id": { "description": "鍥藉ID", "type": "integer" @@ -13547,6 +13720,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "file": { "type": "string" @@ -13807,6 +13987,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "end_time": { "type": "string" }, @@ -13922,6 +14109,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "conditions": { "type": "string" @@ -14138,6 +14332,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "competitors": { "type": "string" }, @@ -14258,6 +14459,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "conditions": { "type": "string" }, @@ -14310,6 +14518,13 @@ "properties": { "city_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact_name": { "description": "鑱旂郴浜哄鍚�", @@ -14430,6 +14645,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -14534,6 +14756,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -14624,6 +14853,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -14684,6 +14920,13 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contactId": { "description": "鑱旂郴浜篿d", @@ -14835,6 +15078,13 @@ "properties": { "clientId": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "masterOrderId": { "type": "integer" @@ -15023,6 +15273,13 @@ "client_id": { "description": "鎵�灞炲叕鍙窱D", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "country_id": { "description": "鍥藉ID", @@ -15259,6 +15516,12 @@ }, "client_status_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "type": "string" }, "contact_id": { "type": "integer" @@ -15828,6 +16091,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "conditions": { "type": "string" }, @@ -15889,6 +16159,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "isInvoice": { "type": "string" }, @@ -15933,6 +16210,13 @@ "properties": { "clientId": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "memberId": { "type": "integer" @@ -16128,6 +16412,13 @@ "client_type_id": { "description": "瀹㈡埛绫诲瀷ID", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact": { "$ref": "#/definitions/request.Contact" @@ -16355,6 +16646,13 @@ "description": "鎵�灞炲叕鍙窱D", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "country_id": { "description": "鍥藉ID", "type": "integer" @@ -16413,6 +16711,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "file": { "type": "string" @@ -16808,6 +17113,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "end_time": { "type": "string" }, @@ -16984,6 +17296,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "conditions": { "type": "string" @@ -17327,6 +17646,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "competitors": { "type": "string" }, @@ -17490,6 +17816,13 @@ "properties": { "city_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact_name": { "description": "鑱旂郴浜哄鍚�", @@ -17740,6 +18073,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -17865,6 +18205,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -17956,6 +18303,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -18019,6 +18373,13 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contactId": { "description": "鑱旂郴浜篿d", @@ -18210,6 +18571,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "id": { "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index 47c9204..52a2c3a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1260,6 +1260,54 @@ } } }, + "/api/code/getCodeList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "缂栫爜" + ], + "summary": "鑾峰彇缂栫爜鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "codeStandID", + "in": "query" + }, + { + "type": "string", + "name": "name", + "in": "query" + }, + { + "type": "integer", + "description": "椤电爜", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "姣忛〉澶у皬", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "name": "type", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.ListResponse" + } + } + } + } + }, "/api/collectionProjection/add": { "post": { "produces": [ @@ -10231,6 +10279,69 @@ } }, "definitions": { + "code.CodeAuto": { + "type": "object", + "properties": { + "AutoLength": { + "type": "integer" + }, + "Desc": { + "type": "string" + }, + "PrefixMethod": { + "type": "integer" + }, + "PrefixValue": { + "type": "string" + }, + "SuffixMethod": { + "type": "integer" + } + } + }, + "code.CodeRule": { + "type": "object", + "properties": { + "Desc": { + "type": "string" + }, + "Length": { + "type": "integer" + }, + "Name": { + "type": "string" + } + } + }, + "code.CodeStandard": { + "type": "object", + "properties": { + "AutoRule": { + "$ref": "#/definitions/code.CodeAuto" + }, + "ID": { + "type": "string" + }, + "List": { + "type": "array", + "items": { + "$ref": "#/definitions/code.CodeRule" + } + }, + "Method": { + "type": "integer" + }, + "Name": { + "type": "string" + }, + "Status": { + "type": "string" + }, + "Type": { + "type": "string" + } + } + }, "constvar.BankAccountKeywordType": { "type": "string", "enum": [ @@ -10857,6 +10968,9 @@ "client_type_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contacts": { "type": "array", "items": { @@ -11052,6 +11166,9 @@ "client_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "country": { "$ref": "#/definitions/model.Country" }, @@ -11122,6 +11239,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "country": { "$ref": "#/definitions/model.Country" @@ -11201,6 +11321,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "created_at": { "description": "The date when the item was created\nexample: 2023-08-10 15:48:25", @@ -11348,6 +11471,9 @@ }, "client_status_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact": { "$ref": "#/definitions/model.Contact" @@ -11546,6 +11672,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "end_time": { "type": "string" @@ -11771,6 +11900,9 @@ }, "client_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "conditions": { "type": "string" @@ -12010,6 +12142,9 @@ "client_id": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "collection_projections": { "type": "array", "items": { @@ -12195,6 +12330,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "conditions": { "type": "string" }, @@ -12271,6 +12409,9 @@ }, "city_id": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact_name": { "type": "string" @@ -12363,6 +12504,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "createTime": { "type": "string" }, @@ -12447,6 +12591,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "createTime": { "type": "string" @@ -12654,6 +12801,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contact": { "$ref": "#/definitions/model.Contact" }, @@ -12794,6 +12944,9 @@ "clientId": { "type": "integer" }, + "codeStandID": { + "type": "string" + }, "contact": { "$ref": "#/definitions/model.Contact" }, @@ -12890,6 +13043,9 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeStandID": { + "type": "string" }, "contact": { "$ref": "#/definitions/model.Contact" @@ -13096,6 +13252,9 @@ }, "clientId": { "type": "integer" + }, + "codeStandID": { + "type": "string" }, "id": { "type": "integer" @@ -13336,6 +13495,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -13480,6 +13646,13 @@ "description": "鎵�灞炲叕鍙窱D", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "country_id": { "description": "鍥藉ID", "type": "integer" @@ -13535,6 +13708,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "file": { "type": "string" @@ -13795,6 +13975,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "end_time": { "type": "string" }, @@ -13910,6 +14097,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "conditions": { "type": "string" @@ -14126,6 +14320,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "competitors": { "type": "string" }, @@ -14246,6 +14447,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "conditions": { "type": "string" }, @@ -14298,6 +14506,13 @@ "properties": { "city_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact_name": { "description": "鑱旂郴浜哄鍚�", @@ -14418,6 +14633,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -14522,6 +14744,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -14612,6 +14841,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -14672,6 +14908,13 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contactId": { "description": "鑱旂郴浜篿d", @@ -14823,6 +15066,13 @@ "properties": { "clientId": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "masterOrderId": { "type": "integer" @@ -15011,6 +15261,13 @@ "client_id": { "description": "鎵�灞炲叕鍙窱D", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "country_id": { "description": "鍥藉ID", @@ -15247,6 +15504,12 @@ }, "client_status_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "type": "string" }, "contact_id": { "type": "integer" @@ -15816,6 +16079,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "conditions": { "type": "string" }, @@ -15877,6 +16147,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "isInvoice": { "type": "string" }, @@ -15921,6 +16198,13 @@ "properties": { "clientId": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "memberId": { "type": "integer" @@ -16116,6 +16400,13 @@ "client_type_id": { "description": "瀹㈡埛绫诲瀷ID", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact": { "$ref": "#/definitions/request.Contact" @@ -16343,6 +16634,13 @@ "description": "鎵�灞炲叕鍙窱D", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "country_id": { "description": "鍥藉ID", "type": "integer" @@ -16401,6 +16699,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "file": { "type": "string" @@ -16796,6 +17101,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "end_time": { "type": "string" }, @@ -16972,6 +17284,13 @@ "properties": { "client_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "conditions": { "type": "string" @@ -17315,6 +17634,13 @@ "client_id": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "competitors": { "type": "string" }, @@ -17478,6 +17804,13 @@ "properties": { "city_id": { "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contact_name": { "description": "鑱旂郴浜哄鍚�", @@ -17728,6 +18061,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -17853,6 +18193,13 @@ "description": "瀹㈡埛绫诲瀷ID", "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contact": { "$ref": "#/definitions/request.Contact" }, @@ -17944,6 +18291,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "contactId": { "type": "integer" }, @@ -18007,6 +18361,13 @@ "clientId": { "description": "瀹㈡埛id", "type": "integer" + }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" }, "contactId": { "description": "鑱旂郴浜篿d", @@ -18198,6 +18559,13 @@ "clientId": { "type": "integer" }, + "codeRule": { + "$ref": "#/definitions/code.CodeStandard" + }, + "codeStandID": { + "description": "缂栫爜id", + "type": "string" + }, "id": { "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 939b48c..32cbcec 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,45 @@ definitions: + code.CodeAuto: + properties: + AutoLength: + type: integer + Desc: + type: string + PrefixMethod: + type: integer + PrefixValue: + type: string + SuffixMethod: + type: integer + type: object + code.CodeRule: + properties: + Desc: + type: string + Length: + type: integer + Name: + type: string + type: object + code.CodeStandard: + properties: + AutoRule: + $ref: '#/definitions/code.CodeAuto' + ID: + type: string + List: + items: + $ref: '#/definitions/code.CodeRule' + type: array + Method: + type: integer + Name: + type: string + Status: + type: string + Type: + type: string + type: object constvar.BankAccountKeywordType: enum: - "" @@ -467,6 +508,8 @@ $ref: '#/definitions/model.ClientType' client_type_id: type: integer + codeStandID: + type: string contacts: items: $ref: '#/definitions/model.Contact' @@ -602,6 +645,8 @@ type: integer client_id: type: integer + codeStandID: + type: string country: $ref: '#/definitions/model.Country' country_id: @@ -649,6 +694,8 @@ $ref: '#/definitions/model.Client' client_id: type: integer + codeStandID: + type: string country: $ref: '#/definitions/model.Country' country_id: @@ -701,6 +748,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string created_at: description: |- The date when the item was created @@ -803,6 +852,8 @@ $ref: '#/definitions/model.ClientStatus' client_status_id: type: integer + codeStandID: + type: string contact: $ref: '#/definitions/model.Contact' contact_id: @@ -935,6 +986,8 @@ $ref: '#/definitions/model.Client' client_id: type: integer + codeStandID: + type: string end_time: type: string id: @@ -1082,6 +1135,8 @@ $ref: '#/definitions/model.Client' client_id: type: integer + codeStandID: + type: string conditions: type: string contact: @@ -1237,6 +1292,8 @@ $ref: '#/definitions/model.Client' client_id: type: integer + codeStandID: + type: string collection_projections: items: $ref: '#/definitions/model.CollectionProjection' @@ -1361,6 +1418,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string conditions: type: string createTime: @@ -1412,6 +1471,8 @@ $ref: '#/definitions/model.City' city_id: type: integer + codeStandID: + type: string contact_name: type: string contact_phone: @@ -1473,6 +1534,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string createTime: type: string creatorName: @@ -1528,6 +1591,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string createTime: type: string creatorName: @@ -1666,6 +1731,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string contact: $ref: '#/definitions/model.Contact' contactId: @@ -1758,6 +1825,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string contact: $ref: '#/definitions/model.Contact' contactId: @@ -1826,6 +1895,8 @@ clientId: description: 瀹㈡埛id type: integer + codeStandID: + type: string contact: $ref: '#/definitions/model.Contact' contactId: @@ -1967,6 +2038,8 @@ $ref: '#/definitions/model.Client' clientId: type: integer + codeStandID: + type: string id: type: integer masterOrder: @@ -2129,6 +2202,11 @@ client_type_id: description: 瀹㈡埛绫诲瀷ID type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact: $ref: '#/definitions/request.Contact' contact_id: @@ -2231,6 +2309,11 @@ client_id: description: 鎵�灞炲叕鍙窱D type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string country_id: description: 鍥藉ID type: integer @@ -2272,6 +2355,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string file: type: string member_id: @@ -2442,6 +2530,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string end_time: type: string member_id: @@ -2517,6 +2610,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string conditions: type: string contact_id: @@ -2657,6 +2755,11 @@ type: integer client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string competitors: type: string contact_id: @@ -2736,6 +2839,11 @@ type: string clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string conditions: type: string deliveryDate: @@ -2771,6 +2879,11 @@ properties: city_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact_name: description: 鑱旂郴浜哄鍚� type: string @@ -2849,6 +2962,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: type: integer endTime: @@ -2921,6 +3039,11 @@ client_type_id: description: 瀹㈡埛绫诲瀷ID type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact: $ref: '#/definitions/request.Contact' contact_id: @@ -2986,6 +3109,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: type: integer file: @@ -3028,6 +3156,11 @@ clientId: description: 瀹㈡埛id type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: description: 鑱旂郴浜篿d type: integer @@ -3134,6 +3267,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string masterOrderId: type: integer memberId: @@ -3263,6 +3401,11 @@ client_id: description: 鎵�灞炲叕鍙窱D type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string country_id: description: 鍥藉ID type: integer @@ -3422,6 +3565,10 @@ type: integer client_status_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + type: string contact_id: type: integer contact_information_id: @@ -3835,6 +3982,11 @@ type: string clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string conditions: type: string deliveryDate: @@ -3873,6 +4025,11 @@ type: integer clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string isInvoice: type: string memberId: @@ -3905,6 +4062,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string memberId: type: integer number: @@ -4037,6 +4199,11 @@ client_type_id: description: 瀹㈡埛绫诲瀷ID type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact: $ref: '#/definitions/request.Contact' contact_id: @@ -4193,6 +4360,11 @@ client_id: description: 鎵�灞炲叕鍙窱D type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string country_id: description: 鍥藉ID type: integer @@ -4236,6 +4408,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string file: type: string id: @@ -4498,6 +4675,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string end_time: type: string id: @@ -4614,6 +4796,11 @@ properties: client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string conditions: type: string contact_id: @@ -4837,6 +5024,11 @@ type: integer client_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string competitors: type: string contact_id: @@ -4947,6 +5139,11 @@ properties: city_id: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact_name: description: 鑱旂郴浜哄鍚� type: string @@ -5112,6 +5309,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: type: integer endTime: @@ -5198,6 +5400,11 @@ client_type_id: description: 瀹㈡埛绫诲瀷ID type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contact: $ref: '#/definitions/request.Contact' contact_id: @@ -5263,6 +5470,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: type: integer file: @@ -5307,6 +5519,11 @@ clientId: description: 瀹㈡埛id type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string contactId: description: 鑱旂郴浜篿d type: integer @@ -5439,6 +5656,11 @@ properties: clientId: type: integer + codeRule: + $ref: '#/definitions/code.CodeStandard' + codeStandID: + description: 缂栫爜id + type: string id: type: integer masterOrderId: @@ -6863,6 +7085,36 @@ summary: 鏇存柊瀹㈡埛绫诲瀷 tags: - ClientType + /api/code/getCodeList: + get: + parameters: + - in: query + name: codeStandID + type: string + - in: query + name: name + type: string + - description: 椤电爜 + in: query + name: page + type: integer + - description: 姣忛〉澶у皬 + in: query + name: pageSize + type: integer + - in: query + name: type + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.ListResponse' + summary: 鑾峰彇缂栫爜鍒楄〃 + tags: + - 缂栫爜 /api/collectionProjection/add: post: parameters: diff --git a/main.go b/main.go index 4fc671d..fc4488d 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,7 @@ go v1.InitProductServiceConn() go service.InitUserConn() + go v1.InitCodeServiceConn() //c := cron.New() //c.AddFunc("@every 15s", service.SyncUserInfo) // 姣�15绉掑悓姝ヤ竴娆� @@ -63,6 +64,7 @@ v1.CloseProductServiceConn() service.CloseUserConn() + v1.CloseCodeServiceConn() logx.Infof("aps-crm exited...") os.Exit(0) diff --git a/model/client.go b/model/client.go index f425230..9e91558 100644 --- a/model/client.go +++ b/model/client.go @@ -31,6 +31,7 @@ NextVisitTime *CustomTime `json:"next_visit_time" gorm:"column:next_visit_time;type:datetime;comment:涓嬫鍥炶鏃堕棿"` LatestServiceTime *CustomTime `json:"latest_service_time" gorm:"column:latest_service_time;type:datetime;comment:鏈�鏅氭湇鍔℃椂闂�"` FollowRecord []FollowRecord `json:"follow_record" gorm:"foreignKey:ClientId"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` Address Business CrmModel diff --git a/model/contact.go b/model/contact.go index 01c2732..9961a42 100644 --- a/model/contact.go +++ b/model/contact.go @@ -7,20 +7,21 @@ type ( Contact struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鑱旂郴浜哄鍚�"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鑱旂郴浜虹紪鍙�"` - ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` - Client Client `json:"-" gorm:"foreignKey:ClientId"` - Position string `json:"position" gorm:"column:position;type:varchar(255);comment:鑱屼綅"` - Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璐熻矗浜篒D"` - Member User `json:"member" gorm:"foreignKey:MemberId"` - IsFirst bool `json:"is_first" gorm:"column:is_first;type:tinyint(1);comment:鏄惁棣栬鑱旂郴浜�"` - Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255);comment:寰俊"` - Birthday *CustomTime `json:"birthday" gorm:"column:birthday;type:datetime;comment:鐢熸棩"` - Email string `json:"email" gorm:"column:email;type:varchar(255);comment:閭"` - Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:澶囨敞"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鑱旂郴浜哄鍚�"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鑱旂郴浜虹紪鍙�"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` + Client Client `json:"-" gorm:"foreignKey:ClientId"` + Position string `json:"position" gorm:"column:position;type:varchar(255);comment:鑱屼綅"` + Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璐熻矗浜篒D"` + Member User `json:"member" gorm:"foreignKey:MemberId"` + IsFirst bool `json:"is_first" gorm:"column:is_first;type:tinyint(1);comment:鏄惁棣栬鑱旂郴浜�"` + Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255);comment:寰俊"` + Birthday *CustomTime `json:"birthday" gorm:"column:birthday;type:datetime;comment:鐢熸棩"` + Email string `json:"email" gorm:"column:email;type:varchar(255);comment:閭"` + Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:澶囨敞"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` Address gorm.Model `json:"-"` } diff --git a/model/contract.go b/model/contract.go index 2597428..35a23a7 100644 --- a/model/contract.go +++ b/model/contract.go @@ -19,6 +19,7 @@ ServiceContractStatus ServiceContractStatus `json:"serviceContractStatus" gorm:"foreignKey:StatusId;references:Id"` File string `json:"file" gorm:"column:file;type:varchar(255);comment:鍚堝悓鏂囦欢"` CreatedAt *CustomTime `json:"created_at" gorm:"column:created_at;type:datetime;comment:鍒涘缓鏃堕棿"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` gormModel } @@ -141,3 +142,7 @@ slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } +func (slf *ContractSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/followRecord.go b/model/followRecord.go index 67352b6..dc51c46 100644 --- a/model/followRecord.go +++ b/model/followRecord.go @@ -29,6 +29,7 @@ Client Client `json:"client" gorm:"foreignKey:ClientId"` Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` ContactInformation ContactInformation `json:"contact_information" gorm:"foreignKey:ContactInformationId"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` gorm.Model `json:"-"` } @@ -196,3 +197,7 @@ slf.SearchMap = data return slf } +func (slf *FollowRecordSearch) SetOrm(tx *gorm.DB) *FollowRecordSearch { + slf.Orm = tx + return slf +} diff --git a/model/masterOrder.go b/model/masterOrder.go index f33fd6c..dd7e52b 100644 --- a/model/masterOrder.go +++ b/model/masterOrder.go @@ -8,16 +8,17 @@ type ( // MasterOrder 閿�鍞�诲崟 MasterOrder struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞�诲崟鍙�"` - ClientId int `json:"client_id" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` - Client Client `json:"client" gorm:"foreignKey:ClientId"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` - Member User `json:"member" gorm:"foreignKey:MemberId"` - StartTime *CustomTime `json:"start_time" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` - EndTime *CustomTime `json:"end_time" gorm:"column:end_time;type:datetime;comment:缁撴潫鏃堕棿"` - Money float64 `json:"money" gorm:"column:money;type:decimal(10,2);comment:鎬婚噾棰�"` - gorm.Model `json:"-"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞�诲崟鍙�"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` + Client Client `json:"client" gorm:"foreignKey:ClientId"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` + Member User `json:"member" gorm:"foreignKey:MemberId"` + StartTime *CustomTime `json:"start_time" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` + EndTime *CustomTime `json:"end_time" gorm:"column:end_time;type:datetime;comment:缁撴潫鏃堕棿"` + Money float64 `json:"money" gorm:"column:money;type:decimal(10,2);comment:鎬婚噾棰�"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` + gorm.Model `json:"-"` } // MasterOrderSearch 閿�鍞�诲崟鎼滅储鏉′欢 diff --git a/model/quotation.go b/model/quotation.go index 091c34b..24257f4 100644 --- a/model/quotation.go +++ b/model/quotation.go @@ -24,6 +24,7 @@ Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` SaleChance SaleChance `json:"sale_chance" gorm:"foreignKey:SaleChanceId"` Products []Product `json:"products" gorm:"many2many:quotation_product"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` gorm.Model `json:"-"` } diff --git a/model/request/client.go b/model/request/client.go index 48caa0c..08b32ea 100644 --- a/model/request/client.go +++ b/model/request/client.go @@ -1,25 +1,29 @@ package request +import "aps_crm/proto/code" + type AddClient struct { Client } type Client struct { - Name string `json:"name"` // 鍏徃鍚嶇О - Number string `json:"number"` // 鍏徃缂栧彿 - ClientStatusId int `json:"client_status_id"` // 瀹㈡埛鐘舵�両D - ClientTypeId int `json:"client_type_id"` // 瀹㈡埛绫诲瀷ID - ClientOriginId int `json:"client_origin_id"` // 瀹㈡埛鏉ユ簮ID - ClientLevelId int `json:"client_level_id"` // 瀹㈡埛绛夌骇ID - MemberId int `json:"member_id"` // 閿�鍞礋璐d汉ID - ServiceMemberId int `json:"service_member_id"` // 鏈嶅姟璐熻矗浜篒D - DetailAddress string `json:"detail_address"` // 璇︾粏鍦板潃 - Remark string `json:"remark"` // 澶囨敞 - NextVisitTime string `json:"next_visit_time"` // 涓嬫鍥炶鏃堕棿 - LatestServiceTime string `json:"latest_service_time"` // 鏈�鏅氭湇鍔℃椂闂� - Contact Contact `json:"contact"` - SalesLeadsId int `json:"sales_leads_id"` // 閿�鍞嚎绱D - ContactId int `json:"contact_id"` // 鑱旂郴浜篒D + Name string `json:"name"` // 鍏徃鍚嶇О + Number string `json:"number"` // 鍏徃缂栧彿 + ClientStatusId int `json:"client_status_id"` // 瀹㈡埛鐘舵�両D + ClientTypeId int `json:"client_type_id"` // 瀹㈡埛绫诲瀷ID + ClientOriginId int `json:"client_origin_id"` // 瀹㈡埛鏉ユ簮ID + ClientLevelId int `json:"client_level_id"` // 瀹㈡埛绛夌骇ID + MemberId int `json:"member_id"` // 閿�鍞礋璐d汉ID + ServiceMemberId int `json:"service_member_id"` // 鏈嶅姟璐熻矗浜篒D + DetailAddress string `json:"detail_address"` // 璇︾粏鍦板潃 + Remark string `json:"remark"` // 澶囨敞 + NextVisitTime string `json:"next_visit_time"` // 涓嬫鍥炶鏃堕棿 + LatestServiceTime string `json:"latest_service_time"` // 鏈�鏅氭湇鍔℃椂闂� + Contact Contact `json:"contact"` + SalesLeadsId int `json:"sales_leads_id"` // 閿�鍞嚎绱D + ContactId int `json:"contact_id"` // 鑱旂郴浜篒D + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` Address Business } diff --git a/model/request/code_request.go b/model/request/code_request.go new file mode 100644 index 0000000..ecc73fa --- /dev/null +++ b/model/request/code_request.go @@ -0,0 +1,32 @@ +package request + +type GetCodeList struct { + PageInfo + CodeStandID string `json:"codeStandID"` + Name string `json:"name"` + Type string `json:"type"` +} + +type CodeStandard struct { + ID string `json:"id"` + Name string `json:"name"` + Type string `json:"type"` + Method int32 `json:"method"` + Status string `json:"status"` + List []*CodeRule `json:"list"` + AutoRule *CodeAuto `json:"autoRule"` +} + +type CodeRule struct { + Name string `json:"name"` + Length int32 `json:"length"` + Desc string `json:"desc"` +} + +type CodeAuto struct { + PrefixMethod int32 `json:"prefixMethod"` + PrefixValue string `json:"prefixValue"` + SuffixMethod int32 `json:"suffixMethod"` + AutoLength int32 `json:"autoLength"` + Desc string `json:"desc"` +} diff --git a/model/request/contact.go b/model/request/contact.go index de6601f..2a788d5 100644 --- a/model/request/contact.go +++ b/model/request/contact.go @@ -1,25 +1,29 @@ package request +import "aps_crm/proto/code" + type AddContact struct { Contact } type Contact struct { - Name string `json:"name"` // 鑱旂郴浜哄悕绉� - Number string `json:"number"` // 鑱旂郴浜虹紪鍙� - MemberId int `json:"member_id"` // 鎵�灞炴垚鍛業D - ClientId int `json:"client_id"` // 鎵�灞炲叕鍙窱D - Position string `json:"position"` // 鑱屼綅 - Phone string `json:"phone"` // 鎵嬫満鍙� - IsFirst bool `json:"is_first"` // 鏄惁棣栬鑱旂郴浜� - Wechat string `json:"wechat"` // 寰俊鍙� - Birthday string `json:"birthday" example:"1970-01-01 08:00:00"` // 鐢熸棩 - Email string `json:"email"` // 閭 - Desc string `json:"desc"` // 澶囨敞 - CountryId int `json:"country_id"` // 鍥藉ID - ProvinceId int `json:"province_id"` // 鐪佷唤ID - CityId int `json:"city_id"` // 鍩庡競ID - RegionId int `json:"region_id"` // 鍖哄煙ID + Name string `json:"name"` // 鑱旂郴浜哄悕绉� + Number string `json:"number"` // 鑱旂郴浜虹紪鍙� + MemberId int `json:"member_id"` // 鎵�灞炴垚鍛業D + ClientId int `json:"client_id"` // 鎵�灞炲叕鍙窱D + Position string `json:"position"` // 鑱屼綅 + Phone string `json:"phone"` // 鎵嬫満鍙� + IsFirst bool `json:"is_first"` // 鏄惁棣栬鑱旂郴浜� + Wechat string `json:"wechat"` // 寰俊鍙� + Birthday string `json:"birthday" example:"1970-01-01 08:00:00"` // 鐢熸棩 + Email string `json:"email"` // 閭 + Desc string `json:"desc"` // 澶囨敞 + CountryId int `json:"country_id"` // 鍥藉ID + ProvinceId int `json:"province_id"` // 鐪佷唤ID + CityId int `json:"city_id"` // 鍩庡競ID + RegionId int `json:"region_id"` // 鍖哄煙ID + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateContact struct { diff --git a/model/request/contract.go b/model/request/contract.go index 701f75c..e9e9c43 100644 --- a/model/request/contract.go +++ b/model/request/contract.go @@ -1,16 +1,20 @@ package request +import "aps_crm/proto/code" + type AddContract struct { Contract } type Contract struct { - ClientId int `json:"client_id"` - MemberId int `json:"member_id"` - Number string `json:"number"` - QuotationId int `json:"quotation_id"` - StatusId int `json:"status_id"` - File string `json:"file"` + ClientId int `json:"client_id"` + MemberId int `json:"member_id"` + Number string `json:"number"` + QuotationId int `json:"quotation_id"` + StatusId int `json:"status_id"` + File string `json:"file"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateContract struct { diff --git a/model/request/followRecord.go b/model/request/followRecord.go index 3c64a93..e84169d 100644 --- a/model/request/followRecord.go +++ b/model/request/followRecord.go @@ -1,24 +1,28 @@ package request +import "aps_crm/proto/code" + type AddFollowRecord struct { FollowRecord FollowRecord `json:"follow_record" binding:"required"` } type FollowRecord struct { - ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"` - ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"` - ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"` - Topic string `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"` - Record string `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"` - SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"` - SalesLeadsId int `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"` - ContactInformationId int `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:鑱旂郴鏂瑰紡id"` - FollowTime string `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:璺熻繘鏃堕棿"` - NextFollowTime string `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:涓嬫璺熻繘鏃堕棿"` - Purpose string `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:璺熻繘鐩殑"` - Content string `json:"content" gorm:"column:content;type:varchar(255);comment:璺熻繘鍐呭"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"` + ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"` + ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"` + Topic string `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"` + Record string `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"` + SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"` + SalesLeadsId int `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"` + ContactInformationId int `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:鑱旂郴鏂瑰紡id"` + FollowTime string `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:璺熻繘鏃堕棿"` + NextFollowTime string `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:涓嬫璺熻繘鏃堕棿"` + Purpose string `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:璺熻繘鐩殑"` + Content string `json:"content" gorm:"column:content;type:varchar(255);comment:璺熻繘鍐呭"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateFollowRecord struct { diff --git a/model/request/masterOrder.go b/model/request/masterOrder.go index 6cecb35..00317c8 100644 --- a/model/request/masterOrder.go +++ b/model/request/masterOrder.go @@ -1,16 +1,20 @@ package request +import "aps_crm/proto/code" + type AddMasterOrder struct { MasterOrder } type MasterOrder struct { - Number string `json:"number"` - ClientId int `json:"client_id"` - MemberId int `json:"member_id"` - StartTime string `json:"start_time"` - EndTime string `json:"end_time"` - Money float64 `json:"money"` + Number string `json:"number"` + ClientId int `json:"client_id"` + MemberId int `json:"member_id"` + StartTime string `json:"start_time"` + EndTime string `json:"end_time"` + Money float64 `json:"money"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateMasterOrder struct { diff --git a/model/request/quotation.go b/model/request/quotation.go index 468b1fb..729b825 100644 --- a/model/request/quotation.go +++ b/model/request/quotation.go @@ -1,22 +1,27 @@ package request -import "aps_crm/model" +import ( + "aps_crm/model" + "aps_crm/proto/code" +) type AddQuotation struct { Quotation } type Quotation struct { - ClientId int `json:"client_id"` - Number string `json:"number"` - QuotationStatusId int `json:"quotation_status_id"` - ValidityDate string `json:"validity_date"` - ContactId int `json:"contact_id"` - MemberId int `json:"member_id"` - SaleChanceId int `json:"sale_chance_id"` - Conditions string `json:"conditions"` - File string `json:"file"` - Products []model.Product `json:"products"` + ClientId int `json:"client_id"` + Number string `json:"number"` + QuotationStatusId int `json:"quotation_status_id"` + ValidityDate string `json:"validity_date"` + ContactId int `json:"contact_id"` + MemberId int `json:"member_id"` + SaleChanceId int `json:"sale_chance_id"` + Conditions string `json:"conditions"` + File string `json:"file"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` + Products []model.Product `json:"products"` } type UpdateQuotation struct { diff --git a/model/request/saleChance.go b/model/request/saleChance.go index 6b7fe11..20d4619 100644 --- a/model/request/saleChance.go +++ b/model/request/saleChance.go @@ -1,39 +1,43 @@ package request +import "aps_crm/proto/code" + type AddSaleChance struct { SaleChance } type SaleChance struct { - Name string `json:"name"` - ClientId int `json:"client_id"` - Number string `json:"number"` - ContactId int `json:"contact_id"` - SalesSourcesId int `json:"sales_sources_id"` - SaleTypeId int `json:"sale_type_id"` - SaleStageId int `json:"sale_stage_id"` - MemberId int `json:"member_id"` - RegularCustomersId int `json:"regular_customers_id"` - Competitors string `json:"competitors"` - Possibilities int `json:"possibilities"` - Budget float64 `json:"budget"` - ProjectedAmount float64 `json:"projected_amount"` - Currency int `json:"currency"` - ExpectedTime string `json:"expected_time"` - StatusId int `json:"status_id"` - PainPoints string `json:"pain_points"` - WhetherEstablished string `json:"whether_established"` - CapitalBudget string `json:"capital_budget"` - KeyMaker string `json:"key_maker"` - KeyFactors string `json:"key_factors"` - Process string `json:"process"` - Solutions string `json:"solutions"` - Advantages string `json:"advantages"` - Disadvantages string `json:"disadvantages"` - Opportunities string `json:"opportunities"` - Threats string `json:"threats"` - Remark string `json:"remark"` - DetailAddress string `json:"detail_address"` + Name string `json:"name"` + ClientId int `json:"client_id"` + Number string `json:"number"` + ContactId int `json:"contact_id"` + SalesSourcesId int `json:"sales_sources_id"` + SaleTypeId int `json:"sale_type_id"` + SaleStageId int `json:"sale_stage_id"` + MemberId int `json:"member_id"` + RegularCustomersId int `json:"regular_customers_id"` + Competitors string `json:"competitors"` + Possibilities int `json:"possibilities"` + Budget float64 `json:"budget"` + ProjectedAmount float64 `json:"projected_amount"` + Currency int `json:"currency"` + ExpectedTime string `json:"expected_time"` + StatusId int `json:"status_id"` + PainPoints string `json:"pain_points"` + WhetherEstablished string `json:"whether_established"` + CapitalBudget string `json:"capital_budget"` + KeyMaker string `json:"key_maker"` + KeyFactors string `json:"key_factors"` + Process string `json:"process"` + Solutions string `json:"solutions"` + Advantages string `json:"advantages"` + Disadvantages string `json:"disadvantages"` + Opportunities string `json:"opportunities"` + Threats string `json:"threats"` + Remark string `json:"remark"` + DetailAddress string `json:"detail_address"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` Address } diff --git a/model/request/salesDetails.go b/model/request/salesDetails.go index 7758bf6..c339c9a 100644 --- a/model/request/salesDetails.go +++ b/model/request/salesDetails.go @@ -3,6 +3,7 @@ import ( "aps_crm/constvar" "aps_crm/model" + "aps_crm/proto/code" ) type AddSalesDetails struct { @@ -10,23 +11,25 @@ } type SalesDetails struct { - ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞瓙鍗曞彿"` - SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` - SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:閿�鍞被鍨�"` - SignTime string `json:"signTime" gorm:"column:sign_time;type:datetime;comment:绛惧崟鏃堕棿"` - MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` - DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:浜よ揣鏃ユ湡"` - WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status_id;type:int;comment:寰俊璁㈠崟鐘舵�乮d"` - Address string `json:"address" gorm:"column:address;type:varchar(255);comment:鍦板潃"` - Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` - Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:鏀朵欢浜�"` - Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:鏉′欢"` - Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` - Products []*model.Product `json:"products" gorm:"many2many:sales_details_product;"` - LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:鐗╂祦鍏徃"` - LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:鐗╂祦鍗曞彿"` - LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:鐗╂祦璐圭敤"` + ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞瓙鍗曞彿"` + SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` + SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:閿�鍞被鍨�"` + SignTime string `json:"signTime" gorm:"column:sign_time;type:datetime;comment:绛惧崟鏃堕棿"` + MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` + DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:浜よ揣鏃ユ湡"` + WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status_id;type:int;comment:寰俊璁㈠崟鐘舵�乮d"` + Address string `json:"address" gorm:"column:address;type:varchar(255);comment:鍦板潃"` + Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` + Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:鏀朵欢浜�"` + Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:鏉′欢"` + Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` + Products []*model.Product `json:"products" gorm:"many2many:sales_details_product;"` + LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:鐗╂祦鍏徃"` + LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:鐗╂祦鍗曞彿"` + LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:鐗╂祦璐圭敤"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateSalesDetails struct { diff --git a/model/request/salesLeads.go b/model/request/salesLeads.go index b29c4fb..821be06 100644 --- a/model/request/salesLeads.go +++ b/model/request/salesLeads.go @@ -1,21 +1,26 @@ package request -import "aps_crm/constvar" +import ( + "aps_crm/constvar" + "aps_crm/proto/code" +) type AddSalesLeads struct { SalesLeads } type SalesLeads struct { - Name string `json:"name"` // 鍏徃鍚嶇О - Number string `json:"number"` // 閿�鍞嚎绱㈢紪鍙� - ContactName string `json:"contact_name"` // 鑱旂郴浜哄鍚� - ContactPhone string `json:"contact_phone"` // 鑱旂郴浜虹數璇� - ContactPosition string `json:"contact_position"` // 鑱旂郴浜鸿亴浣� - SalesSourcesId int `json:"sales_sources_id"` // 鍟嗘満鏉ユ簮ID - MemberId int `json:"member_id"` // 閿�鍞礋璐d汉ID - Desc string `json:"desc"` // 澶囨敞 - DetailAddress string `json:"detail_address"` // 璇︾粏鍦板潃 + Name string `json:"name"` // 鍏徃鍚嶇О + Number string `json:"number"` // 閿�鍞嚎绱㈢紪鍙� + ContactName string `json:"contact_name"` // 鑱旂郴浜哄鍚� + ContactPhone string `json:"contact_phone"` // 鑱旂郴浜虹數璇� + ContactPosition string `json:"contact_position"` // 鑱旂郴浜鸿亴浣� + SalesSourcesId int `json:"sales_sources_id"` // 鍟嗘満鏉ユ簮ID + MemberId int `json:"member_id"` // 閿�鍞礋璐d汉ID + Desc string `json:"desc"` // 澶囨敞 + DetailAddress string `json:"detail_address"` // 璇︾粏鍦板潃 + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` Address } diff --git a/model/request/salesRefund.go b/model/request/salesRefund.go index 0f132db..2fdb91e 100644 --- a/model/request/salesRefund.go +++ b/model/request/salesRefund.go @@ -3,6 +3,7 @@ import ( "aps_crm/constvar" "aps_crm/model" + "aps_crm/proto/code" ) type AddSalesRefundRequest struct { @@ -21,6 +22,8 @@ IsInvoice string `json:"isInvoice"` Reason string `json:"reason"` Products []*model.Product `json:"products"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateSalesRefundRequest struct { diff --git a/model/request/salesReturn.go b/model/request/salesReturn.go index b451ee1..5ec8c49 100644 --- a/model/request/salesReturn.go +++ b/model/request/salesReturn.go @@ -3,6 +3,7 @@ import ( "aps_crm/constvar" "aps_crm/model" + "aps_crm/proto/code" ) type AddSalesReturnRequest struct { @@ -22,6 +23,8 @@ Creator User `json:"-" gorm:"foreignKey:CreatorId"` //鍒涘缓浜轰俊鎭� Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�璐у師鍥�"` //閫�璐у師鍥� Products []*model.Product `json:"products" gorm:"many2many:salesReturn_product;"` //閫�璐т骇鍝� + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateSalesReturnRequest struct { diff --git a/model/request/serviceContract.go b/model/request/serviceContract.go index dddcfd5..422983d 100644 --- a/model/request/serviceContract.go +++ b/model/request/serviceContract.go @@ -3,6 +3,7 @@ import ( "aps_crm/constvar" "aps_crm/model" + "aps_crm/proto/code" ) type AddServiceContract struct { @@ -10,24 +11,26 @@ } type ServiceContract struct { - ClientId int `json:"clientId"` - Number string `json:"number"` - MemberId int `json:"memberId" binding:"required"` - ContactId int `json:"contactId"` - SaleChanceId int `json:"saleChanceId"` - SalesDetailsId int `json:"salesDetailsId"` - QuotationId int `json:"quotationId"` - TypeId int `json:"typeId"` - SignTime string `json:"signTime" binding:"datetime=2006-01-02"` - StartTime string `json:"startTime"` - EndTime string `json:"endTime"` - StatusId int `json:"statusId"` - ServiceTimes int `json:"serviceTimes"` - Terms string `json:"terms"` - Remark string `json:"remark"` - Products []*model.Product `json:"products"` - ServiceContractTypeId int `json:"serviceContractTypeId"` - ServiceContractStatusId int `json:"serviceContractStatusId"` + ClientId int `json:"clientId"` + Number string `json:"number"` + MemberId int `json:"memberId" binding:"required"` + ContactId int `json:"contactId"` + SaleChanceId int `json:"saleChanceId"` + SalesDetailsId int `json:"salesDetailsId"` + QuotationId int `json:"quotationId"` + TypeId int `json:"typeId"` + SignTime string `json:"signTime" binding:"datetime=2006-01-02"` + StartTime string `json:"startTime"` + EndTime string `json:"endTime"` + StatusId int `json:"statusId"` + ServiceTimes int `json:"serviceTimes"` + Terms string `json:"terms"` + Remark string `json:"remark"` + Products []*model.Product `json:"products"` + ServiceContractTypeId int `json:"serviceContractTypeId"` + ServiceContractStatusId int `json:"serviceContractStatusId"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateServiceContract struct { diff --git a/model/request/serviceFollowup.go b/model/request/serviceFollowup.go index cd45528..b5628e8 100644 --- a/model/request/serviceFollowup.go +++ b/model/request/serviceFollowup.go @@ -1,25 +1,30 @@ package request -import "aps_crm/constvar" +import ( + "aps_crm/constvar" + "aps_crm/proto/code" +) type AddServiceFollowup struct { ServiceFollowup } type ServiceFollowup struct { - ClientId int `json:"clientId"` - Number string `json:"number"` - ContactId int `json:"contactId"` - ServiceOrderId int `json:"serviceOrderId"` - MemberId int `json:"memberId"` - PlanId int `json:"planId"` - Satisfaction int `json:"satisfaction"` - TimelyRate int `json:"timelyRate"` - SolveRate int `json:"solveRate"` - IsVisit int `json:"isVisit"` - OldMemberId int `json:"oldMemberId"` - Remark string `json:"remark"` - File string `json:"file"` + ClientId int `json:"clientId"` + Number string `json:"number"` + ContactId int `json:"contactId"` + ServiceOrderId int `json:"serviceOrderId"` + MemberId int `json:"memberId"` + PlanId int `json:"planId"` + Satisfaction int `json:"satisfaction"` + TimelyRate int `json:"timelyRate"` + SolveRate int `json:"solveRate"` + IsVisit int `json:"isVisit"` + OldMemberId int `json:"oldMemberId"` + Remark string `json:"remark"` + File string `json:"file"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateServiceFollowup struct { diff --git a/model/request/serviceOrder.go b/model/request/serviceOrder.go index 81b6677..3b59202 100644 --- a/model/request/serviceOrder.go +++ b/model/request/serviceOrder.go @@ -2,36 +2,39 @@ import ( "aps_crm/constvar" + "aps_crm/proto/code" ) type AddServiceOrder struct { - ServiceNumber string `gorm:"service_number" json:"serviceNumber"` // 鏈嶅姟鍗曠紪鍙� - ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id - ServiceContractId int `gorm:"service_contract_id" json:"serviceContractId"` // 鍚堝悓id - SalesDetailsId int `gorm:"sales_details_id" json:"salesDetailsId"` // 閿�鍞鍗昳d - Subject string `gorm:"subject" json:"subject"` // 涓婚 - ProductTypeName string `json:"productTypeName"` // 浜у搧鍒嗙被鍚嶇О - ProductName string `json:"productName"` // 浜у搧鍚嶇О - ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡id - ServiceManId int `gorm:"service_man_id" json:"serviceManId"` // 鏈嶅姟浜哄憳 - ContactId int `gorm:"linkman_id" json:"contactId"` // 鑱旂郴浜篿d - Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 - PriorityLevelId int `gorm:"priority_level_id" json:"priorityLevelId"` // 浼樺厛绾у埆id - AppointmentTime string `gorm:"appointment_time" json:"appointmentTime"` // 棰勭害涓婇棬鏃堕棿 - SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d - FaultTypeId int `gorm:"severity_id" json:"faultTypeId"` // 鏁呴殰绫诲埆id - SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害id - ServiceOrderStatusId int `gorm:"column:service_order_status_id;type:int;not null;default:0;comment:鏈嶅姟鍗曠姸鎬乮d" json:"serviceOrderStatusId"` // 澶勭悊鐘舵�� - ExpectTime string `gorm:"expect_time" json:"expectTime"` // 甯屾湜澶勭悊鏃堕棿 - RealTime string `gorm:"real_time" json:"realTime"` // 瀹為檯澶勭悊鏃堕棿 - CarFare float64 `gorm:"car_fare" json:"carFare"` // 浜ら�氳垂 - ChargeAmount float64 `gorm:"charge_amount" json:"chargeAmount"` // 鏀惰垂閲戦 - TimeSpentId int `gorm:"time_spent_id" json:"timeSpentId"` // 鑺辫垂鏃堕棿 - FaqId int `gorm:"problem_id" json:"faqId"` // 甯歌闂id - ProblemDesc string `gorm:"problem_desc" json:"problemDesc"` // 闂鎻忚堪 - Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 - SolutionRemark string `gorm:"solution_remark" json:"solutionRemark"` // 鍐呴儴澶囨敞 - Remark string `gorm:"remark" json:"remark"` // 澶囨敞 + ServiceNumber string `gorm:"service_number" json:"serviceNumber"` // 鏈嶅姟鍗曠紪鍙� + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + ServiceContractId int `gorm:"service_contract_id" json:"serviceContractId"` // 鍚堝悓id + SalesDetailsId int `gorm:"sales_details_id" json:"salesDetailsId"` // 閿�鍞鍗昳d + Subject string `gorm:"subject" json:"subject"` // 涓婚 + ProductTypeName string `json:"productTypeName"` // 浜у搧鍒嗙被鍚嶇О + ProductName string `json:"productName"` // 浜у搧鍚嶇О + ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡id + ServiceManId int `gorm:"service_man_id" json:"serviceManId"` // 鏈嶅姟浜哄憳 + ContactId int `gorm:"linkman_id" json:"contactId"` // 鑱旂郴浜篿d + Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 + PriorityLevelId int `gorm:"priority_level_id" json:"priorityLevelId"` // 浼樺厛绾у埆id + AppointmentTime string `gorm:"appointment_time" json:"appointmentTime"` // 棰勭害涓婇棬鏃堕棿 + SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d + FaultTypeId int `gorm:"severity_id" json:"faultTypeId"` // 鏁呴殰绫诲埆id + SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害id + ServiceOrderStatusId int `gorm:"column:service_order_status_id;type:int;not null;default:0;comment:鏈嶅姟鍗曠姸鎬乮d" json:"serviceOrderStatusId"` // 澶勭悊鐘舵�� + ExpectTime string `gorm:"expect_time" json:"expectTime"` // 甯屾湜澶勭悊鏃堕棿 + RealTime string `gorm:"real_time" json:"realTime"` // 瀹為檯澶勭悊鏃堕棿 + CarFare float64 `gorm:"car_fare" json:"carFare"` // 浜ら�氳垂 + ChargeAmount float64 `gorm:"charge_amount" json:"chargeAmount"` // 鏀惰垂閲戦 + TimeSpentId int `gorm:"time_spent_id" json:"timeSpentId"` // 鑺辫垂鏃堕棿 + FaqId int `gorm:"problem_id" json:"faqId"` // 甯歌闂id + ProblemDesc string `gorm:"problem_desc" json:"problemDesc"` // 闂鎻忚堪 + Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 + SolutionRemark string `gorm:"solution_remark" json:"solutionRemark"` // 鍐呴儴澶囨敞 + Remark string `gorm:"remark" json:"remark"` // 澶囨敞 + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateServiceOrder struct { diff --git a/model/request/subOrder.go b/model/request/subOrder.go index f077528..556f4e0 100644 --- a/model/request/subOrder.go +++ b/model/request/subOrder.go @@ -1,17 +1,22 @@ package request -import "aps_crm/model" +import ( + "aps_crm/model" + "aps_crm/proto/code" +) type AddSubOrder struct { SubOrder } type SubOrder struct { - ClientId int `json:"clientId"` - MasterOrderId int `json:"masterOrderId"` - Number string `json:"number"` - MemberId int `json:"memberId"` - Product []model.Product `json:"product"` + ClientId int `json:"clientId"` + MasterOrderId int `json:"masterOrderId"` + Number string `json:"number"` + MemberId int `json:"memberId"` + Product []model.Product `json:"product"` + CodeStandID string `json:"codeStandID"` //缂栫爜id + CodeRule code.CodeStandard `json:"codeRule"` } type UpdateSubOrder struct { diff --git a/model/saleChance.go b/model/saleChance.go index 99df3df..bc5ef40 100644 --- a/model/saleChance.go +++ b/model/saleChance.go @@ -46,6 +46,7 @@ Client Client `json:"client" gorm:"foreignKey:ClientId;references:Id"` CollectionProjections []CollectionProjection `json:"collection_projections" gorm:"foreignKey:SaleChanceId"` SalesSources SalesSources `json:"sales_sources"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` Address gorm.Model `json:"-"` } @@ -189,3 +190,7 @@ slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } +func (slf *SaleChanceSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/salesDetails.go b/model/salesDetails.go index ed81fab..fe13d5e 100644 --- a/model/salesDetails.go +++ b/model/salesDetails.go @@ -39,6 +39,7 @@ AmountInvoiced decimal.Decimal `gorm:"column:amount_invoiced;type:decimal(12,2);comment:宸插紑绁ㄩ噾棰�" json:"amountInvoiced"` // 宸插紑绁ㄩ噾棰� AmountUnInvoiced decimal.Decimal `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:鏈紑绁ㄩ噾棰�" json:"amountUnInvoiced"` // 鏈紑绁ㄩ噾棰� AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣 + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } diff --git a/model/salesLeads.go b/model/salesLeads.go index 75ff864..60b9017 100644 --- a/model/salesLeads.go +++ b/model/salesLeads.go @@ -24,6 +24,7 @@ Reason string `json:"reason" gorm:"column:reason;type:text;comment:澶辫触鍘熷洜"` FollowRecord []FollowRecord `gorm:"foreignKey:SalesLeadsId"` DetailAddress string `json:"detail_address" gorm:"column:detail_address;type:varchar(255);comment:璇︾粏鍦板潃"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` Address gorm.Model `json:"-"` } diff --git a/model/salesRefund.go b/model/salesRefund.go index c68a0e9..5218841 100644 --- a/model/salesRefund.go +++ b/model/salesRefund.go @@ -29,6 +29,7 @@ Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"` Products []*Product `json:"products" gorm:"many2many:salesRefund_product;"` AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣 + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } @@ -205,3 +206,8 @@ slf.OrderBy = order return slf } + +func (slf *SalesRefundSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/salesReturn.go b/model/salesReturn.go index e82a367..e8babad 100644 --- a/model/salesReturn.go +++ b/model/salesReturn.go @@ -31,6 +31,7 @@ AmountShouldRefund decimal.Decimal `gorm:"column:amount_should_refund;type:decimal(12,2);comment:搴旈��娆鹃噾棰�" json:"amountShouldRefund"` // 搴旈��娆鹃噾棰� AmountHasRefund decimal.Decimal `gorm:"column:amount_has_refund;type:decimal(12,2);comment:宸查��娆鹃噾棰�" json:"amountHasRefund"` // 宸查��娆鹃噾棰� AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:閫�璐т骇鍝佹�婚噾棰�" json:"-"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } @@ -188,3 +189,8 @@ slf.Preload = preload return slf } + +func (slf *SalesReturnSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/serviceContract.go b/model/serviceContract.go index d4b8744..34a6251 100644 --- a/model/serviceContract.go +++ b/model/serviceContract.go @@ -42,6 +42,7 @@ AmountUnInvoiced decimal.Decimal `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:鏈紑绁ㄩ噾棰�" json:"amountUnInvoiced"` // 鏈紑绁ㄩ噾棰� AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣 Products []*Product `json:"products" gorm:"many2many:service_contract_product;"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go index fc3b09d..3f457a6 100644 --- a/model/serviceFollowup.go +++ b/model/serviceFollowup.go @@ -33,6 +33,7 @@ OldMember User `json:"oldMember" gorm:"foreignKey:OldMemberId"` Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } @@ -174,3 +175,8 @@ slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } + +func (slf *ServiceFollowupSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/serviceOrder.go b/model/serviceOrder.go index e5a5f6e..95cfbb0 100644 --- a/model/serviceOrder.go +++ b/model/serviceOrder.go @@ -54,6 +54,7 @@ Solution string `gorm:"column:solution;type:varchar(255);not null;default:'';comment:瑙e喅鏂规硶" json:"solution"` // 瑙e喅鏂规硶 SolutionRemark string `gorm:"column:solution_remark;type:varchar(255);not null;default:'';comment:鍐呴儴澶囨敞" json:"solutionRemark"` // 鍐呴儴澶囨敞 Remark string `gorm:"column:remark;type:varchar(255);not null;default:'';comment:澶囨敞" json:"remark"` // 澶囨敞 + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } @@ -235,3 +236,8 @@ err := db.Find(&records).Error return records, total, err } + +func (slf *ServiceOrderSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/subOrder.go b/model/subOrder.go index d798b86..b7d5869 100644 --- a/model/subOrder.go +++ b/model/subOrder.go @@ -16,6 +16,7 @@ MasterOrder MasterOrder `json:"masterOrder" gorm:"foreignKey:MasterOrderId"` Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞瓙鍗曞彿"` Products []Product `json:"products" gorm:"many2many:subOrder_product;"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` gorm.Model `json:"-"` } @@ -139,3 +140,7 @@ slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } +func (slf *SubOrderSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/util.go b/model/util.go index 9e738d9..8ac7156 100644 --- a/model/util.go +++ b/model/util.go @@ -2,8 +2,11 @@ import ( "aps_crm/pkg/mysqlx" + "aps_crm/proto/code" "fmt" "gorm.io/gorm" + "strconv" + "time" ) // WithTransaction 锛� var funcs []func(db *gorm.DB) error锛屾妸鐩稿叧鍑芥暟娣诲姞杩涘幓 @@ -26,3 +29,28 @@ err = tx.Commit().Error return } + +func GetAutoCode(id int, codeStandard *code.CodeStandard) string { + autoCode := "" + var prefixValue string + if codeStandard.AutoRule.PrefixMethod == 2 { // 鏉ユ簮鍗曟嵁 + prefixValue = "" + } else { // 鍥哄畾鍊� + prefixValue = codeStandard.AutoRule.PrefixValue + } + strMaxAutoIncr := strconv.Itoa(id) + count := int(codeStandard.AutoRule.AutoLength) - len(strMaxAutoIncr) + for i := 0; i < count; i++ { + strMaxAutoIncr = "0" + strMaxAutoIncr + } + + var suffixValue string + if codeStandard.AutoRule.SuffixMethod == 2 { // 骞存湀鏃�+鑷闀� + suffixValue = fmt.Sprintf("%v%v", time.Now().Format("20060102"), strMaxAutoIncr) + } else { // 鑷闀� + suffixValue = strMaxAutoIncr + } + + autoCode = prefixValue + suffixValue + return autoCode +} diff --git a/proto/code.proto b/proto/code.proto new file mode 100644 index 0000000..e394b43 --- /dev/null +++ b/proto/code.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +option go_package = "./code"; + +service codeService { + rpc GetCodeList(GetCodeListRequest) returns(GetCodeListResponse) {} +} + +message CodeStandard { + string ID = 1; + string Name = 2; + string Type = 3; + int32 Method = 4; + string Status = 5; + repeated CodeRule List = 6; + CodeAuto AutoRule = 7; +} + +message CodeRule { + string Name = 1; + int32 Length = 2; + string Desc = 3; +} + +message CodeAuto { + int32 PrefixMethod = 1; + string PrefixValue = 2; + int32 SuffixMethod = 3; + int32 AutoLength = 4; + string Desc = 5; +} + + + +message GetCodeListRequest{ + int32 page = 1; + int32 pageSize = 2; + string CodeStandID = 3; + string Name = 4; + string Type = 5; +} + +message GetCodeListResponse{ + int32 Code = 1; + string Msg = 2; + repeated CodeStandard List = 3; + int64 Total = 4; +} \ No newline at end of file diff --git a/proto/code/code.pb.go b/proto/code/code.pb.go new file mode 100644 index 0000000..adb2ca8 --- /dev/null +++ b/proto/code/code.pb.go @@ -0,0 +1,584 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v4.24.0 +// source: code.proto + +package code + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CodeStandard struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"` + Method int32 `protobuf:"varint,4,opt,name=Method,proto3" json:"Method,omitempty"` + Status string `protobuf:"bytes,5,opt,name=Status,proto3" json:"Status,omitempty"` + List []*CodeRule `protobuf:"bytes,6,rep,name=List,proto3" json:"List,omitempty"` + AutoRule *CodeAuto `protobuf:"bytes,7,opt,name=AutoRule,proto3" json:"AutoRule,omitempty"` +} + +func (x *CodeStandard) Reset() { + *x = CodeStandard{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeStandard) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeStandard) ProtoMessage() {} + +func (x *CodeStandard) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeStandard.ProtoReflect.Descriptor instead. +func (*CodeStandard) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{0} +} + +func (x *CodeStandard) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *CodeStandard) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CodeStandard) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CodeStandard) GetMethod() int32 { + if x != nil { + return x.Method + } + return 0 +} + +func (x *CodeStandard) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *CodeStandard) GetList() []*CodeRule { + if x != nil { + return x.List + } + return nil +} + +func (x *CodeStandard) GetAutoRule() *CodeAuto { + if x != nil { + return x.AutoRule + } + return nil +} + +type CodeRule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Length int32 `protobuf:"varint,2,opt,name=Length,proto3" json:"Length,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=Desc,proto3" json:"Desc,omitempty"` +} + +func (x *CodeRule) Reset() { + *x = CodeRule{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeRule) ProtoMessage() {} + +func (x *CodeRule) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeRule.ProtoReflect.Descriptor instead. +func (*CodeRule) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{1} +} + +func (x *CodeRule) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CodeRule) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *CodeRule) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +type CodeAuto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PrefixMethod int32 `protobuf:"varint,1,opt,name=PrefixMethod,proto3" json:"PrefixMethod,omitempty"` + PrefixValue string `protobuf:"bytes,2,opt,name=PrefixValue,proto3" json:"PrefixValue,omitempty"` + SuffixMethod int32 `protobuf:"varint,3,opt,name=SuffixMethod,proto3" json:"SuffixMethod,omitempty"` + AutoLength int32 `protobuf:"varint,4,opt,name=AutoLength,proto3" json:"AutoLength,omitempty"` + Desc string `protobuf:"bytes,5,opt,name=Desc,proto3" json:"Desc,omitempty"` +} + +func (x *CodeAuto) Reset() { + *x = CodeAuto{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeAuto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeAuto) ProtoMessage() {} + +func (x *CodeAuto) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeAuto.ProtoReflect.Descriptor instead. +func (*CodeAuto) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{2} +} + +func (x *CodeAuto) GetPrefixMethod() int32 { + if x != nil { + return x.PrefixMethod + } + return 0 +} + +func (x *CodeAuto) GetPrefixValue() string { + if x != nil { + return x.PrefixValue + } + return "" +} + +func (x *CodeAuto) GetSuffixMethod() int32 { + if x != nil { + return x.SuffixMethod + } + return 0 +} + +func (x *CodeAuto) GetAutoLength() int32 { + if x != nil { + return x.AutoLength + } + return 0 +} + +func (x *CodeAuto) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +type GetCodeListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + CodeStandID string `protobuf:"bytes,3,opt,name=CodeStandID,proto3" json:"CodeStandID,omitempty"` + Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` + Type string `protobuf:"bytes,5,opt,name=Type,proto3" json:"Type,omitempty"` +} + +func (x *GetCodeListRequest) Reset() { + *x = GetCodeListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCodeListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCodeListRequest) ProtoMessage() {} + +func (x *GetCodeListRequest) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCodeListRequest.ProtoReflect.Descriptor instead. +func (*GetCodeListRequest) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCodeListRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetCodeListRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetCodeListRequest) GetCodeStandID() string { + if x != nil { + return x.CodeStandID + } + return "" +} + +func (x *GetCodeListRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetCodeListRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type GetCodeListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` + List []*CodeStandard `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"` + Total int64 `protobuf:"varint,4,opt,name=Total,proto3" json:"Total,omitempty"` +} + +func (x *GetCodeListResponse) Reset() { + *x = GetCodeListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCodeListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCodeListResponse) ProtoMessage() {} + +func (x *GetCodeListResponse) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCodeListResponse.ProtoReflect.Descriptor instead. +func (*GetCodeListResponse) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{4} +} + +func (x *GetCodeListResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *GetCodeListResponse) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *GetCodeListResponse) GetList() []*CodeStandard { + if x != nil { + return x.List + } + return nil +} + +func (x *GetCodeListResponse) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +var File_code_proto protoreflect.FileDescriptor + +var file_code_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbc, 0x01, 0x0a, + 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, + 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x75, 0x6c, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x41, 0x75, 0x74, + 0x6f, 0x52, 0x08, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x75, 0x6c, 0x65, 0x22, 0x4a, 0x0a, 0x08, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x44, 0x65, 0x73, 0x63, 0x22, 0xa8, 0x01, 0x0a, 0x08, 0x43, 0x6f, 0x64, 0x65, + 0x41, 0x75, 0x74, 0x6f, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x75, + 0x66, 0x66, 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, + 0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x44, 0x65, + 0x73, 0x63, 0x22, 0x8e, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x64, + 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x22, 0x74, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x21, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x32, 0x49, 0x0a, 0x0b, 0x63, 0x6f, 0x64, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, + 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_code_proto_rawDescOnce sync.Once + file_code_proto_rawDescData = file_code_proto_rawDesc +) + +func file_code_proto_rawDescGZIP() []byte { + file_code_proto_rawDescOnce.Do(func() { + file_code_proto_rawDescData = protoimpl.X.CompressGZIP(file_code_proto_rawDescData) + }) + return file_code_proto_rawDescData +} + +var file_code_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_code_proto_goTypes = []interface{}{ + (*CodeStandard)(nil), // 0: CodeStandard + (*CodeRule)(nil), // 1: CodeRule + (*CodeAuto)(nil), // 2: CodeAuto + (*GetCodeListRequest)(nil), // 3: GetCodeListRequest + (*GetCodeListResponse)(nil), // 4: GetCodeListResponse +} +var file_code_proto_depIdxs = []int32{ + 1, // 0: CodeStandard.List:type_name -> CodeRule + 2, // 1: CodeStandard.AutoRule:type_name -> CodeAuto + 0, // 2: GetCodeListResponse.List:type_name -> CodeStandard + 3, // 3: codeService.GetCodeList:input_type -> GetCodeListRequest + 4, // 4: codeService.GetCodeList:output_type -> GetCodeListResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_code_proto_init() } +func file_code_proto_init() { + if File_code_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_code_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeStandard); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeAuto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCodeListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCodeListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_code_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_code_proto_goTypes, + DependencyIndexes: file_code_proto_depIdxs, + MessageInfos: file_code_proto_msgTypes, + }.Build() + File_code_proto = out.File + file_code_proto_rawDesc = nil + file_code_proto_goTypes = nil + file_code_proto_depIdxs = nil +} diff --git a/proto/code/code_grpc.pb.go b/proto/code/code_grpc.pb.go new file mode 100644 index 0000000..eafdff8 --- /dev/null +++ b/proto/code/code_grpc.pb.go @@ -0,0 +1,101 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package code + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// CodeServiceClient is the client API for CodeService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodeServiceClient interface { + GetCodeList(ctx context.Context, in *GetCodeListRequest, opts ...grpc.CallOption) (*GetCodeListResponse, error) +} + +type codeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodeServiceClient(cc grpc.ClientConnInterface) CodeServiceClient { + return &codeServiceClient{cc} +} + +func (c *codeServiceClient) GetCodeList(ctx context.Context, in *GetCodeListRequest, opts ...grpc.CallOption) (*GetCodeListResponse, error) { + out := new(GetCodeListResponse) + err := c.cc.Invoke(ctx, "/codeService/GetCodeList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodeServiceServer is the server API for CodeService service. +// All implementations must embed UnimplementedCodeServiceServer +// for forward compatibility +type CodeServiceServer interface { + GetCodeList(context.Context, *GetCodeListRequest) (*GetCodeListResponse, error) + mustEmbedUnimplementedCodeServiceServer() +} + +// UnimplementedCodeServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodeServiceServer struct { +} + +func (UnimplementedCodeServiceServer) GetCodeList(context.Context, *GetCodeListRequest) (*GetCodeListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCodeList not implemented") +} +func (UnimplementedCodeServiceServer) mustEmbedUnimplementedCodeServiceServer() {} + +// UnsafeCodeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodeServiceServer will +// result in compilation errors. +type UnsafeCodeServiceServer interface { + mustEmbedUnimplementedCodeServiceServer() +} + +func RegisterCodeServiceServer(s grpc.ServiceRegistrar, srv CodeServiceServer) { + s.RegisterService(&CodeService_ServiceDesc, srv) +} + +func _CodeService_GetCodeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCodeListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodeServiceServer).GetCodeList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/codeService/GetCodeList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodeServiceServer).GetCodeList(ctx, req.(*GetCodeListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodeService_ServiceDesc is the grpc.ServiceDesc for CodeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "codeService", + HandlerType: (*CodeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetCodeList", + Handler: _CodeService_GetCodeList_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "code.proto", +} diff --git a/router/index.go b/router/index.go index ea98b63..2cbe48e 100644 --- a/router/index.go +++ b/router/index.go @@ -1,6 +1,7 @@ package router import ( + v1 "aps_crm/api/v1" "aps_crm/conf" _ "aps_crm/docs" "aps_crm/middleware" @@ -183,5 +184,10 @@ routerGroup.InitCollectionProjectionRouter(PrivateGroup) routerGroup.InitContactInformationRouter(PrivateGroup) } + codeGroup := PrivateGroup.Group("code") + codeApi := v1.CodeApi{} + { + codeGroup.GET("getCodeList", codeApi.GetCodeList) //鑾峰彇缂栫爜鍒楄〃 + } return Router } -- Gitblit v1.8.0