From 17aaed743ab7a3520ec8eb9e4ab7c776ca807cdd Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期四, 12 十月 2023 20:43:16 +0800 Subject: [PATCH] bug修改 --- service/salesDetails.go | 3 model/request/salesDetails.go | 5 docs/swagger.yaml | 124 +++++---- api/v1/salesReturn.go | 2 model/masterOrder.go | 5 model/serviceFollowup.go | 10 api/v1/salesRefund.go | 2 api/v1/invoice.go | 6 model/request/salesReturn.go | 2 api/v1/salesDetails.go | 2 router/serviceCollectionPlan.go | 2 model/invoice.go | 18 + service/salesReturn.go | 11 model/salesReturn.go | 15 + api/v1/masterOrder.go | 2 router/invoice.go | 2 api/v1/serviceOrder.go | 2 docs/docs.go | 176 ++++++++------ service/invoice.go | 4 docs/swagger.json | 176 ++++++++------ model/followRecord.go | 2 model/request/invoice.go | 5 model/receipt.go | 8 model/serviceContract.go | 33 ++ model/serviceOrder.go | 4 model/salesDetails.go | 9 model/request/receipt.go | 3 api/v1/serviceContract.go | 2 model/request/serviceContract.go | 10 api/v1/serviceCollectionPlan.go | 4 service/salesRefund.go | 3 service/subOrder.go | 2 model/request/salesRefund.go | 1 service/serviceContract.go | 16 service/receipt.go | 1 35 files changed, 412 insertions(+), 260 deletions(-) diff --git a/api/v1/invoice.go b/api/v1/invoice.go index 68f5ecc..c451f3c 100644 --- a/api/v1/invoice.go +++ b/api/v1/invoice.go @@ -104,9 +104,9 @@ // @Tags 閿�鍞彂绁� // @Summary 鑾峰彇閿�鍞彂绁ㄥ垪琛� // @Produce application/json -// @Param object query request.GetInvoiceList true "鍙傛暟" +// @Param object body request.GetInvoiceList true "鍙傛暟" // @Success 200 {object} response.ListResponse{data=[]model.Invoice} -// @Router /api/invoice/list [get] +// @Router /api/invoice/list [post] func (s *InvoiceApi) List(c *gin.Context) { var params request.GetInvoiceList ctx, ok := contextx.NewContext(c, ¶ms) @@ -114,7 +114,7 @@ return } - invoice, total, errCode := service.NewInvoiceService().GetInvoiceList() + invoice, total, errCode := service.NewInvoiceService().GetInvoiceList(params) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/masterOrder.go b/api/v1/masterOrder.go index c72c089..1e7b005 100644 --- a/api/v1/masterOrder.go +++ b/api/v1/masterOrder.go @@ -43,7 +43,7 @@ m := map[string]interface{}{ "number": autoCode, } - _ = model.NewContactSearch(nil).SetId(masterOrder.Id).UpdateByMap(m) + _ = model.NewMasterOrderSearch().SetId(masterOrder.Id).UpdateByMap(m) } ctx.Ok() diff --git a/api/v1/salesDetails.go b/api/v1/salesDetails.go index 218dd0e..22a0744 100644 --- a/api/v1/salesDetails.go +++ b/api/v1/salesDetails.go @@ -166,7 +166,7 @@ return } - salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.KeywordType, params.Keyword) + salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.KeywordType, params.Keyword, params.SaleChanceId) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/salesRefund.go b/api/v1/salesRefund.go index 39e2743..494f3b1 100644 --- a/api/v1/salesRefund.go +++ b/api/v1/salesRefund.go @@ -170,7 +170,7 @@ return } - salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword) + salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword, params.SourceId) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/salesReturn.go b/api/v1/salesReturn.go index 5d3c004..ab99f0c 100644 --- a/api/v1/salesReturn.go +++ b/api/v1/salesReturn.go @@ -165,7 +165,7 @@ return } - salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params.Page, params.PageSize, params.KeywordType, params.Keyword) + salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/serviceCollectionPlan.go b/api/v1/serviceCollectionPlan.go index 134a633..3a32ccf 100644 --- a/api/v1/serviceCollectionPlan.go +++ b/api/v1/serviceCollectionPlan.go @@ -105,9 +105,9 @@ // @Tags 鏀舵璁″垝绠$悊 // @Summary 鑾峰彇鏀舵璁″垝鍒楄〃 // @Produce application/json -// @Param object query request.GetServiceCollectionPlanList true "鍙傛暟" +// @Param object body request.GetServiceCollectionPlanList true "鍙傛暟" // @Success 200 {object} response.ListResponse{data=[]model.ServiceCollectionPlan} -// @Router /api/serviceCollectionPlan/list [get] +// @Router /api/serviceCollectionPlan/list [post] func (s *ServiceCollectionPlanApi) List(c *gin.Context) { var params request.GetServiceCollectionPlanList ctx, ok := contextx.NewContext(c, ¶ms) diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go index 216d4d3..c50b29a 100644 --- a/api/v1/serviceContract.go +++ b/api/v1/serviceContract.go @@ -144,7 +144,7 @@ return } - serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword) + serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/serviceOrder.go b/api/v1/serviceOrder.go index 8bdd218..2db3520 100644 --- a/api/v1/serviceOrder.go +++ b/api/v1/serviceOrder.go @@ -42,7 +42,7 @@ if params.CodeRule.Method == 1 { autoCode := model.GetAutoCode(serviceOrder.Id, ¶ms.CodeRule) m := map[string]interface{}{ - "number": autoCode, + "service_number": autoCode, } _ = model.NewServiceOrderSearch().SetId(serviceOrder.Id).UpdateByMap(m) } diff --git a/docs/docs.go b/docs/docs.go index ed04f35..c8d39d3 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3360,7 +3360,7 @@ } }, "/api/invoice/list": { - "get": { + "post": { "produces": [ "application/json" ], @@ -3370,43 +3370,13 @@ "summary": "鑾峰彇閿�鍞彂绁ㄥ垪琛�", "parameters": [ { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "enum": [ - "" - ], - "type": "string", - "x-enum-varnames": [ - "InvoiceKeywordCustomerName" - ], - "name": "keywordType", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - }, - { - "enum": [ - "" - ], - "type": "string", - "x-enum-varnames": [ - "InvoiceQueryClassExpireLessThen60Days" - ], - "name": "queryClass", - "in": "query" + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetInvoiceList" + } } ], "responses": { @@ -5569,6 +5539,12 @@ "parameters": [ { "type": "integer", + "description": "瀹㈡埛id", + "name": "clientId", + "in": "query" + }, + { + "type": "integer", "description": "椤电爜", "name": "page", "in": "query" @@ -5607,6 +5583,7 @@ "ReceiptSourceTypeCollectionPlan", "ReceiptSourceTypeChuKuDan" ], + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", "name": "sourceType", "in": "query" } @@ -7877,7 +7854,7 @@ } }, "/api/serviceCollectionPlan/list": { - "get": { + "post": { "produces": [ "application/json" ], @@ -7887,28 +7864,13 @@ "summary": "鑾峰彇鏀舵璁″垝鍒楄〃", "parameters": [ { - "type": "integer", - "name": "sourceId", - "in": "query", - "required": true - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "x-enum-comments": { - "CollectionSourceTypeSaleDetails": "閿�鍞槑缁�", - "CollectionSourceTypeServiceContract": "鏈嶅姟鍚堝悓" - }, - "x-enum-varnames": [ - "CollectionSourceTypeSaleDetails", - "CollectionSourceTypeServiceContract" - ], - "name": "sourceType", - "in": "query", - "required": true + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetServiceCollectionPlanList" + } } ], "responses": { @@ -10439,24 +10401,6 @@ ], "x-enum-varnames": [ "FaqQueryClassExpireLessThen60Days" - ] - }, - "constvar.InvoiceKeywordType": { - "type": "string", - "enum": [ - "" - ], - "x-enum-varnames": [ - "InvoiceKeywordCustomerName" - ] - }, - "constvar.InvoiceQueryClass": { - "type": "string", - "enum": [ - "" - ], - "x-enum-varnames": [ - "InvoiceQueryClassExpireLessThen60Days" ] }, "constvar.InvoiceSourceType": { @@ -15655,6 +15599,30 @@ } } }, + "request.GetInvoiceList": { + "type": "object", + "properties": { + "page": { + "description": "椤电爜", + "type": "integer" + }, + "pageSize": { + "description": "姣忛〉澶у皬", + "type": "integer" + }, + "sourceId": { + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "allOf": [ + { + "$ref": "#/definitions/constvar.InvoiceSourceType" + } + ] + } + } + }, "request.GetMasterOrderList": { "type": "object", "properties": { @@ -15757,6 +15725,10 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "saleChanceId": { + "description": "閿�鍞満浼歩d", + "type": "integer" } } }, @@ -15794,6 +15766,9 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "sourceId": { + "type": "integer" } } }, @@ -15813,12 +15788,43 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級", + "allOf": [ + { + "$ref": "#/definitions/constvar.SalesReturnSourceType" + } + ] + } + } + }, + "request.GetServiceCollectionPlanList": { + "type": "object", + "required": [ + "sourceId", + "sourceType" + ], + "properties": { + "sourceId": { + "type": "integer" + }, + "sourceType": { + "$ref": "#/definitions/constvar.CollectionSourceType" } } }, "request.GetServiceContractList": { "type": "object", "properties": { + "contactId": { + "description": "鑱旂郴浜篿d", + "type": "integer" + }, "keyword": { "type": "string" }, @@ -15835,6 +15841,18 @@ }, "queryClass": { "$ref": "#/definitions/constvar.ServiceContractQueryClass" + }, + "quotationId": { + "description": "鎶ヤ环鍗昳d", + "type": "integer" + }, + "saleChanceId": { + "description": "閿�鍞満浼歩d", + "type": "integer" + }, + "salesDetailsId": { + "description": "鍚堝悓璁㈠崟id", + "type": "integer" } } }, diff --git a/docs/swagger.json b/docs/swagger.json index 52a2c3a..17934c8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3348,7 +3348,7 @@ } }, "/api/invoice/list": { - "get": { + "post": { "produces": [ "application/json" ], @@ -3358,43 +3358,13 @@ "summary": "鑾峰彇閿�鍞彂绁ㄥ垪琛�", "parameters": [ { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "enum": [ - "" - ], - "type": "string", - "x-enum-varnames": [ - "InvoiceKeywordCustomerName" - ], - "name": "keywordType", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - }, - { - "enum": [ - "" - ], - "type": "string", - "x-enum-varnames": [ - "InvoiceQueryClassExpireLessThen60Days" - ], - "name": "queryClass", - "in": "query" + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetInvoiceList" + } } ], "responses": { @@ -5557,6 +5527,12 @@ "parameters": [ { "type": "integer", + "description": "瀹㈡埛id", + "name": "clientId", + "in": "query" + }, + { + "type": "integer", "description": "椤电爜", "name": "page", "in": "query" @@ -5595,6 +5571,7 @@ "ReceiptSourceTypeCollectionPlan", "ReceiptSourceTypeChuKuDan" ], + "description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級", "name": "sourceType", "in": "query" } @@ -7865,7 +7842,7 @@ } }, "/api/serviceCollectionPlan/list": { - "get": { + "post": { "produces": [ "application/json" ], @@ -7875,28 +7852,13 @@ "summary": "鑾峰彇鏀舵璁″垝鍒楄〃", "parameters": [ { - "type": "integer", - "name": "sourceId", - "in": "query", - "required": true - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "x-enum-comments": { - "CollectionSourceTypeSaleDetails": "閿�鍞槑缁�", - "CollectionSourceTypeServiceContract": "鏈嶅姟鍚堝悓" - }, - "x-enum-varnames": [ - "CollectionSourceTypeSaleDetails", - "CollectionSourceTypeServiceContract" - ], - "name": "sourceType", - "in": "query", - "required": true + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetServiceCollectionPlanList" + } } ], "responses": { @@ -10427,24 +10389,6 @@ ], "x-enum-varnames": [ "FaqQueryClassExpireLessThen60Days" - ] - }, - "constvar.InvoiceKeywordType": { - "type": "string", - "enum": [ - "" - ], - "x-enum-varnames": [ - "InvoiceKeywordCustomerName" - ] - }, - "constvar.InvoiceQueryClass": { - "type": "string", - "enum": [ - "" - ], - "x-enum-varnames": [ - "InvoiceQueryClassExpireLessThen60Days" ] }, "constvar.InvoiceSourceType": { @@ -15643,6 +15587,30 @@ } } }, + "request.GetInvoiceList": { + "type": "object", + "properties": { + "page": { + "description": "椤电爜", + "type": "integer" + }, + "pageSize": { + "description": "姣忛〉澶у皬", + "type": "integer" + }, + "sourceId": { + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓)", + "allOf": [ + { + "$ref": "#/definitions/constvar.InvoiceSourceType" + } + ] + } + } + }, "request.GetMasterOrderList": { "type": "object", "properties": { @@ -15745,6 +15713,10 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "saleChanceId": { + "description": "閿�鍞満浼歩d", + "type": "integer" } } }, @@ -15782,6 +15754,9 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "sourceId": { + "type": "integer" } } }, @@ -15801,12 +15776,43 @@ "pageSize": { "description": "姣忛〉澶у皬", "type": "integer" + }, + "sourceId": { + "description": "婧愬崟id", + "type": "integer" + }, + "sourceType": { + "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級", + "allOf": [ + { + "$ref": "#/definitions/constvar.SalesReturnSourceType" + } + ] + } + } + }, + "request.GetServiceCollectionPlanList": { + "type": "object", + "required": [ + "sourceId", + "sourceType" + ], + "properties": { + "sourceId": { + "type": "integer" + }, + "sourceType": { + "$ref": "#/definitions/constvar.CollectionSourceType" } } }, "request.GetServiceContractList": { "type": "object", "properties": { + "contactId": { + "description": "鑱旂郴浜篿d", + "type": "integer" + }, "keyword": { "type": "string" }, @@ -15823,6 +15829,18 @@ }, "queryClass": { "$ref": "#/definitions/constvar.ServiceContractQueryClass" + }, + "quotationId": { + "description": "鎶ヤ环鍗昳d", + "type": "integer" + }, + "saleChanceId": { + "description": "閿�鍞満浼歩d", + "type": "integer" + }, + "salesDetailsId": { + "description": "鍚堝悓璁㈠崟id", + "type": "integer" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 32cbcec..ad410bd 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -101,18 +101,6 @@ type: string x-enum-varnames: - FaqQueryClassExpireLessThen60Days - constvar.InvoiceKeywordType: - enum: - - "" - type: string - x-enum-varnames: - - InvoiceKeywordCustomerName - constvar.InvoiceQueryClass: - enum: - - "" - type: string - x-enum-varnames: - - InvoiceQueryClassExpireLessThen60Days constvar.InvoiceSourceType: enum: - 1 @@ -3672,6 +3660,21 @@ "contact_name": "鑱旂郴浜哄鍚�", "sales_leads_id": "閿�鍞嚎绱d", "sale_chance_id": "閿�鍞満浼歩d"}' type: object type: object + request.GetInvoiceList: + properties: + page: + description: 椤电爜 + type: integer + pageSize: + description: 姣忛〉澶у皬 + type: integer + sourceId: + type: integer + sourceType: + allOf: + - $ref: '#/definitions/constvar.InvoiceSourceType' + description: 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) + type: object request.GetMasterOrderList: properties: page: @@ -3752,6 +3755,9 @@ pageSize: description: 姣忛〉澶у皬 type: integer + saleChanceId: + description: 閿�鍞満浼歩d + type: integer type: object request.GetSalesLeadsList: properties: @@ -3780,6 +3786,8 @@ pageSize: description: 姣忛〉澶у皬 type: integer + sourceId: + type: integer type: object request.GetSalesReturnList: properties: @@ -3793,9 +3801,29 @@ pageSize: description: 姣忛〉澶у皬 type: integer + sourceId: + description: 婧愬崟id + type: integer + sourceType: + allOf: + - $ref: '#/definitions/constvar.SalesReturnSourceType' + description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級 + type: object + request.GetServiceCollectionPlanList: + properties: + sourceId: + type: integer + sourceType: + $ref: '#/definitions/constvar.CollectionSourceType' + required: + - sourceId + - sourceType type: object request.GetServiceContractList: properties: + contactId: + description: 鑱旂郴浜篿d + type: integer keyword: type: string keywordType: @@ -3808,6 +3836,15 @@ type: integer queryClass: $ref: '#/definitions/constvar.ServiceContractQueryClass' + quotationId: + description: 鎶ヤ环鍗昳d + type: integer + saleChanceId: + description: 閿�鍞満浼歩d + type: integer + salesDetailsId: + description: 鍚堝悓璁㈠崟id + type: integer type: object request.GetServiceFeeManageList: properties: @@ -8373,33 +8410,14 @@ tags: - 閿�鍞彂绁� /api/invoice/list: - get: + post: parameters: - - in: query - name: keyword - type: string - - enum: - - "" - in: query - name: keywordType - type: string - x-enum-varnames: - - InvoiceKeywordCustomerName - - description: 椤电爜 - in: query - name: page - type: integer - - description: 姣忛〉澶у皬 - in: query - name: pageSize - type: integer - - enum: - - "" - in: query - name: queryClass - type: string - x-enum-varnames: - - InvoiceQueryClassExpireLessThen60Days + - description: 鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.GetInvoiceList' produces: - application/json responses: @@ -9724,6 +9742,10 @@ /api/receipt/list: get: parameters: + - description: 瀹㈡埛id + in: query + name: clientId + type: integer - description: 椤电爜 in: query name: page @@ -9735,7 +9757,8 @@ - in: query name: sourceId type: integer - - enum: + - description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 + enum: - 1 - 2 - 3 @@ -11155,25 +11178,14 @@ tags: - 鏀舵璁″垝绠$悊 /api/serviceCollectionPlan/list: - get: + post: parameters: - - in: query - name: sourceId + - description: 鍙傛暟 + in: body + name: object required: true - type: integer - - enum: - - 1 - - 2 - in: query - name: sourceType - required: true - type: integer - x-enum-comments: - CollectionSourceTypeSaleDetails: 閿�鍞槑缁� - CollectionSourceTypeServiceContract: 鏈嶅姟鍚堝悓 - x-enum-varnames: - - CollectionSourceTypeSaleDetails - - CollectionSourceTypeServiceContract + schema: + $ref: '#/definitions/request.GetServiceCollectionPlanList' produces: - application/json responses: diff --git a/model/followRecord.go b/model/followRecord.go index dc51c46..6188d70 100644 --- a/model/followRecord.go +++ b/model/followRecord.go @@ -71,7 +71,7 @@ db = db.Where(key+" LIKE ?", "%"+v+"%") } - if key == "client_name" { + if key == "name" { db = db.Joins("Client").Where("Client.name LIKE ?", "%"+v+"%") } diff --git a/model/invoice.go b/model/invoice.go index 9145a6a..48ddcd2 100644 --- a/model/invoice.go +++ b/model/invoice.go @@ -53,12 +53,30 @@ } } +func (slf *InvoiceSearch) SetSourceType(sourceType constvar.InvoiceSourceType) *InvoiceSearch { + slf.SourceType = sourceType + return slf +} + +func (slf *InvoiceSearch) SetSourceId(sourceId int) *InvoiceSearch { + slf.SourceId = sourceId + return slf +} + func (slf *InvoiceSearch) build() *gorm.DB { var db = slf.Orm.Model(&Invoice{}) if slf.Id != 0 { db = db.Where("id = ?", slf.Id) } + if slf.SourceType > 0 { + db = db.Where("source_type = ?", slf.SourceType) + } + + if slf.SourceId > 0 { + db = db.Where("source_id = ?", slf.SourceId) + } + return db } diff --git a/model/masterOrder.go b/model/masterOrder.go index dd7e52b..256b492 100644 --- a/model/masterOrder.go +++ b/model/masterOrder.go @@ -136,3 +136,8 @@ slf.Orm = slf.Orm.Where("id in (?)", ids) return slf } + +func (slf *MasterOrderSearch) UpdateByMap(data map[string]interface{}) error { + var db = slf.build() + return db.Updates(data).Error +} diff --git a/model/receipt.go b/model/receipt.go index 5c335a9..64c90cd 100644 --- a/model/receipt.go +++ b/model/receipt.go @@ -88,6 +88,9 @@ if slf.SourceId != 0 { db = db.Where("source_id = ?", slf.SourceId) } + if slf.ClientId != 0 { + db = db.Where("client_id = ?", slf.ClientId) + } return db } @@ -124,6 +127,11 @@ return slf } +func (slf *ReceiptSearch) SetClientId(clientId int) *ReceiptSearch { + slf.ClientId = clientId + return slf +} + func (slf *ReceiptSearch) SetOrm(tx *gorm.DB) *ReceiptSearch { slf.Orm = tx return slf diff --git a/model/request/invoice.go b/model/request/invoice.go index 526af5f..4e7c7e6 100644 --- a/model/request/invoice.go +++ b/model/request/invoice.go @@ -40,7 +40,6 @@ type GetInvoiceList struct { PageInfo - QueryClass constvar.InvoiceQueryClass `json:"queryClass" form:"queryClass"` - KeywordType constvar.InvoiceKeywordType `json:"keywordType" form:"keywordType"` - Keyword string `json:"keyword" form:"keyword"` + SourceId int `json:"sourceId"` + SourceType constvar.InvoiceSourceType `json:"sourceType"` // 婧愬崟绫诲瀷(1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓) } diff --git a/model/request/receipt.go b/model/request/receipt.go index 10225b2..52acffc 100644 --- a/model/request/receipt.go +++ b/model/request/receipt.go @@ -16,6 +16,7 @@ type GetReceiptList struct { PageInfo - SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` + SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` //鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級 SourceId int `json:"sourceId" form:"sourceId"` + ClientId int `json:"clientId"` //瀹㈡埛id } diff --git a/model/request/salesDetails.go b/model/request/salesDetails.go index c339c9a..4f43d65 100644 --- a/model/request/salesDetails.go +++ b/model/request/salesDetails.go @@ -39,6 +39,7 @@ type GetSalesDetailsList struct { PageInfo - KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"` - Keyword string `json:"keyword"` + KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"` + Keyword string `json:"keyword"` + SaleChanceId int `json:"saleChanceId"` //閿�鍞満浼歩d } diff --git a/model/request/salesRefund.go b/model/request/salesRefund.go index 2fdb91e..4cfb4ee 100644 --- a/model/request/salesRefund.go +++ b/model/request/salesRefund.go @@ -35,4 +35,5 @@ PageInfo Keyword string `json:"keyword"` KeywordType constvar.SalesRefundKeywordType + SourceId int `json:"sourceId"` } diff --git a/model/request/salesReturn.go b/model/request/salesReturn.go index 5ec8c49..eac712d 100644 --- a/model/request/salesReturn.go +++ b/model/request/salesReturn.go @@ -36,4 +36,6 @@ PageInfo Keyword string `json:"keyword"` KeywordType constvar.SalesReturnKeywordType + SourceType constvar.SalesReturnSourceType `json:"sourceType"` // 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級 + SourceId int `json:"sourceId"` // 婧愬崟id } diff --git a/model/request/serviceContract.go b/model/request/serviceContract.go index 422983d..a8ea3b5 100644 --- a/model/request/serviceContract.go +++ b/model/request/serviceContract.go @@ -40,9 +40,13 @@ type GetServiceContractList struct { PageInfo - QueryClass constvar.ServiceContractQueryClass `json:"queryClass"` - KeywordType constvar.ServiceContractKeywordType `json:"keywordType"` - Keyword string `json:"keyword"` + QueryClass constvar.ServiceContractQueryClass `json:"queryClass"` + KeywordType constvar.ServiceContractKeywordType `json:"keywordType"` + Keyword string `json:"keyword"` + SalesDetailsId int `json:"salesDetailsId"` //鍚堝悓璁㈠崟id + QuotationId int `json:"quotationId"` //鎶ヤ环鍗昳d + SaleChanceId int `json:"saleChanceId"` //閿�鍞満浼歩d + ContactId int `json:"contactId"` //鑱旂郴浜篿d } type DeleteServiceContract struct { diff --git a/model/salesDetails.go b/model/salesDetails.go index fe13d5e..b0e58b3 100644 --- a/model/salesDetails.go +++ b/model/salesDetails.go @@ -71,6 +71,10 @@ db = db.Where("id = ?", slf.Id) } + if slf.SaleChanceId != 0 { + db = db.Where("sale_chance_id = ?", slf.SaleChanceId) + } + switch slf.KeywordType { case constvar.SalesDetailsKeywordTypeCustomerName: db = db.Joins("Client", clause.LeftJoin).Where("Client.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) @@ -121,6 +125,11 @@ return slf } +func (slf *SalesDetailsSearch) SetSaleChanceId(saleChanceId int) *SalesDetailsSearch { + slf.SaleChanceId = saleChanceId + return slf +} + func (slf *SalesDetailsSearch) First() (*SalesDetails, error) { var db = slf.build() var record = new(SalesDetails) diff --git a/model/salesReturn.go b/model/salesReturn.go index e8babad..3f1d335 100644 --- a/model/salesReturn.go +++ b/model/salesReturn.go @@ -71,7 +71,12 @@ if len(slf.Ids) != 0 { db = db.Where("id in ?", slf.Ids) } - + if slf.SourceType != 0 { + db = db.Where("source_type = ?", slf.SourceType) + } + if slf.SourceId != 0 { + db = db.Where("source_id = ?", slf.SourceId) + } if slf.Preload { db = db.Preload("Client"). Preload("Member"). @@ -189,6 +194,14 @@ slf.Preload = preload return slf } +func (slf *SalesReturnSearch) SetSourceType(sourceType constvar.SalesReturnSourceType) *SalesReturnSearch { + slf.SourceType = sourceType + return slf +} +func (slf *SalesReturnSearch) SetSourceId(sourceId int) *SalesReturnSearch { + slf.SourceId = sourceId + return slf +} func (slf *SalesReturnSearch) UpdateByMap(data map[string]interface{}) error { var db = slf.build() diff --git a/model/serviceContract.go b/model/serviceContract.go index 34a6251..9939134 100644 --- a/model/serviceContract.go +++ b/model/serviceContract.go @@ -126,6 +126,19 @@ Preload("Contact") } + if slf.SalesDetailsId != 0 { + db = db.Where("sales_details_id = ?", slf.SalesDetailsId) + } + + if slf.QuotationId != 0 { + db = db.Where("quotation_id = ?", slf.QuotationId) + } + if slf.SaleChanceId != 0 { + db = db.Where("sale_chance_id = ?", slf.SaleChanceId) + } + if slf.ContactId != 0 { + db = db.Where("contact_id = ?", slf.ContactId) + } return db } @@ -199,6 +212,26 @@ return slf } +func (slf *ServiceContractSearch) SetSalesDetailsId(salesDetailsId int) *ServiceContractSearch { + slf.SalesDetailsId = salesDetailsId + return slf +} + +func (slf *ServiceContractSearch) SetQuotationId(quotationId int) *ServiceContractSearch { + slf.QuotationId = quotationId + return slf +} + +func (slf *ServiceContractSearch) SetSaleChanceId(saleChanceId int) *ServiceContractSearch { + slf.SaleChanceId = saleChanceId + return slf +} + +func (slf *ServiceContractSearch) SetContactId(contactId int) *ServiceContractSearch { + slf.ContactId = contactId + return slf +} + func (slf *ServiceContractSearch) SetPreload(preload bool) *ServiceContractSearch { slf.Preload = preload return slf diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go index 3f457a6..c69cd23 100644 --- a/model/serviceFollowup.go +++ b/model/serviceFollowup.go @@ -41,7 +41,7 @@ ServiceFollowup Orm *gorm.DB KeywordType constvar.ServiceFollowupKeywordType - Keyword interface{} + Keyword string OrderBy string PageNum int PageSize int @@ -79,6 +79,10 @@ case constvar.ServiceFollowupKeywordSatisfactionDegree: db = db.Joins("Satisfaction").Where("Satisfaction.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) + } + + if slf.ServiceOrderId > 0 { + db = db.Where("service_order_id = ?", slf.ServiceOrderId) } if slf.Preload { @@ -125,10 +129,6 @@ if err := db.Count(&total).Error; err != nil { return records, total, err } - if slf.PageNum > 0 && slf.PageSize > 0 { - db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) - } - if slf.PageNum > 0 && slf.PageSize > 0 { db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) } diff --git a/model/serviceOrder.go b/model/serviceOrder.go index 95cfbb0..0b012b5 100644 --- a/model/serviceOrder.go +++ b/model/serviceOrder.go @@ -87,10 +87,10 @@ db = db.Where("id = ?", slf.Id) } if slf.ServiceContractId != 0 { - db = db.Where("service_contract_id = ?", slf.ServiceContractId) + db = db.Where("contract_id = ?", slf.ServiceContractId) } if slf.SalesDetailsId != 0 { - db = db.Where("sales_details_id = ?", slf.SalesDetailsId) + db = db.Where("order_id = ?", slf.SalesDetailsId) } if slf.Preload { db = db. diff --git a/router/invoice.go b/router/invoice.go index d60183b..f879a03 100644 --- a/router/invoice.go +++ b/router/invoice.go @@ -12,6 +12,6 @@ InvoiceRouter.POST("add", InvoiceApi.Add) // 娣诲姞閿�鍞彂绁� InvoiceRouter.DELETE("delete/:id", InvoiceApi.Delete) // 鍒犻櫎閿�鍞彂绁� InvoiceRouter.PUT("update", InvoiceApi.Update) // 鏇存柊閿�鍞彂绁� - InvoiceRouter.GET("list", InvoiceApi.List) // 鑾峰彇閿�鍞彂绁ㄥ垪琛� + InvoiceRouter.POST("list", InvoiceApi.List) // 鑾峰彇閿�鍞彂绁ㄥ垪琛� } } diff --git a/router/serviceCollectionPlan.go b/router/serviceCollectionPlan.go index 68c20f7..d0f7166 100644 --- a/router/serviceCollectionPlan.go +++ b/router/serviceCollectionPlan.go @@ -12,6 +12,6 @@ ServiceCollectionPlanRouter.POST("add", ServiceCollectionPlanApi.Add) // 娣诲姞鏈嶅姟鍚堝悓鏀舵璁″垝 ServiceCollectionPlanRouter.DELETE("delete/:id", ServiceCollectionPlanApi.Delete) // 鍒犻櫎鏈嶅姟鍚堝悓鏀舵璁″垝 ServiceCollectionPlanRouter.PUT("update", ServiceCollectionPlanApi.Update) // 鏇存柊鏈嶅姟鍚堝悓鏀舵璁″垝 - ServiceCollectionPlanRouter.GET("list", ServiceCollectionPlanApi.List) // 鑾峰彇鏈嶅姟鍚堝悓鏀舵璁″垝鍒楄〃 + ServiceCollectionPlanRouter.POST("list", ServiceCollectionPlanApi.List) // 鑾峰彇鏈嶅姟鍚堝悓鏀舵璁″垝鍒楄〃 } } diff --git a/service/invoice.go b/service/invoice.go index 895c415..edb207e 100644 --- a/service/invoice.go +++ b/service/invoice.go @@ -139,8 +139,8 @@ return ecode.OK } -func (InvoiceService) GetInvoiceList() ([]*model.Invoice, int64, int) { - list, total, err := model.NewInvoiceSearch().Find() +func (InvoiceService) GetInvoiceList(params request.GetInvoiceList) ([]*model.Invoice, int64, int) { + list, total, err := model.NewInvoiceSearch().SetSourceId(params.SourceId).SetSourceType(params.SourceType).Find() if err != nil { return nil, 0, ecode.DBErr } diff --git a/service/receipt.go b/service/receipt.go index 054c552..9ec0ba3 100644 --- a/service/receipt.go +++ b/service/receipt.go @@ -135,6 +135,7 @@ SetPage(params.Page, params.PageSize). SetSourceType(params.SourceType). SetSourceId(params.SourceId). + SetClientId(params.ClientId). Find() if err != nil { return nil, 0, ecode.DBErr diff --git a/service/salesDetails.go b/service/salesDetails.go index fa497bf..1e15798 100644 --- a/service/salesDetails.go +++ b/service/salesDetails.go @@ -114,11 +114,12 @@ return ecode.OK } -func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keywordType constvar.SalesDetailsKeywordType, keyword string) ([]*model.SalesDetails, int64, int) { +func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keywordType constvar.SalesDetailsKeywordType, keyword string, saleChanceId int) ([]*model.SalesDetails, int64, int) { // get contact list contacts, total, err := model.NewSalesDetailsSearch(). SetPreload(true). SetKeywordType(keywordType). + SetSaleChanceId(saleChanceId). SetKeyword(keyword).SetPage(page, pageSize).FindAll() if err != nil { return nil, 0, ecode.SalesDetailsListErr diff --git a/service/salesRefund.go b/service/salesRefund.go index d3fe5f8..2632314 100644 --- a/service/salesRefund.go +++ b/service/salesRefund.go @@ -168,11 +168,12 @@ return ecode.OK } -func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string) ([]*model.SalesRefund, int64, int) { +func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string, sourceId int) ([]*model.SalesRefund, int64, int) { // get contact list contacts, total, err := model.NewSalesRefundSearch(). SetKeywordType(keywordType). SetKeyword(keyword). + SetSourceId(sourceId). SetPreload(true). SetPage(page, pageSize).FindAll() if err != nil { diff --git a/service/salesReturn.go b/service/salesReturn.go index b7362f4..4363b78 100644 --- a/service/salesReturn.go +++ b/service/salesReturn.go @@ -3,6 +3,7 @@ import ( "aps_crm/constvar" "aps_crm/model" + "aps_crm/model/request" "aps_crm/pkg/ecode" "github.com/shopspring/decimal" "gorm.io/gorm" @@ -123,12 +124,14 @@ return ecode.OK } -func (SalesReturnService) GetSalesReturnList(page, pageSize int, keywordType constvar.SalesReturnKeywordType, keyword string) ([]*model.SalesReturn, int64, int) { +func (SalesReturnService) GetSalesReturnList(params request.GetSalesReturnList) ([]*model.SalesReturn, int64, int) { // get contact list contacts, total, err := model.NewSalesReturnSearch(). - SetKeywordType(keywordType). - SetKeyword(keyword). - SetPage(page, pageSize). + SetKeywordType(params.KeywordType). + SetKeyword(params.Keyword). + SetPage(params.Page, params.PageSize). + SetSourceId(params.SourceId). + SetSourceType(params.SourceType). SetPreload(true). FindAll() if err != nil { diff --git a/service/serviceContract.go b/service/serviceContract.go index 9ca7751..1ef53c8 100644 --- a/service/serviceContract.go +++ b/service/serviceContract.go @@ -1,8 +1,8 @@ package service import ( - "aps_crm/constvar" "aps_crm/model" + "aps_crm/model/request" "aps_crm/pkg/ecode" "github.com/shopspring/decimal" "gorm.io/gorm" @@ -117,13 +117,17 @@ return ecode.OK } -func (SContractService) GetServiceContractList(page, pageSize int, queryClass constvar.ServiceContractQueryClass, keywordType constvar.ServiceContractKeywordType, keyword string) ([]*model.ServiceContract, int64, int) { +func (SContractService) GetServiceContractList(params request.GetServiceContractList) ([]*model.ServiceContract, int64, int) { // get contact list contacts, total, err := model.NewServiceContractSearch(). - SetKeyword(keyword). - SetKeywordType(keywordType). - SetQueryClass(queryClass). - SetPage(page, pageSize). + SetKeyword(params.Keyword). + SetKeywordType(params.KeywordType). + SetQueryClass(params.QueryClass). + SetPage(params.Page, params.PageSize). + SetSalesDetailsId(params.SalesDetailsId). + SetQuotationId(params.QuotationId). + SetSaleChanceId(params.SaleChanceId). + SetContactId(params.ContactId). SetPreload(true). Find() if err != nil { diff --git a/service/subOrder.go b/service/subOrder.go index ce0a337..2a59fd9 100644 --- a/service/subOrder.go +++ b/service/subOrder.go @@ -71,7 +71,7 @@ func (SubOrderService) GetSubOrderList(page, pageSize int, data map[string]interface{}) ([]*model.SubOrder, int64, int) { // get contact list - contacts, total, err := model.NewSubOrderSearch(nil).SetSearchMap(data).SetPage(page, pageSize).SetSearchMap(data).FindAll() + contacts, total, err := model.NewSubOrderSearch(nil).SetPage(page, pageSize).SetSearchMap(data).FindAll() if err != nil { return nil, 0, ecode.SubOrderListErr } -- Gitblit v1.8.0