From 6e9274c27ffc8fe7f41e2c3c06a239d4c3fb09e5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 02 八月 2023 14:38:15 +0800
Subject: [PATCH] 增加服务回访单搜索条件
---
constvar/const.go | 11 ++
api/v1/serviceContract.go | 12 +-
model/request/serviceFollowup.go | 5
docs/swagger.yaml | 58 +++++++++++
service/serviceFollowup.go | 8 +
docs/docs.go | 70 ++++++++++++++
api/v1/serviceFollowup.go | 7
docs/swagger.json | 70 ++++++++++++++
model/serviceFollowup.go | 40 +++++--
9 files changed, 256 insertions(+), 25 deletions(-)
diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go
index 52b188f..cd5e4f6 100644
--- a/api/v1/serviceContract.go
+++ b/api/v1/serviceContract.go
@@ -150,12 +150,12 @@
// List
//
-// @Tags ServiceContract
-// @Summary 鐢熸垚璁″垝鍒楄〃
-// @Produce application/json
-// @Param object body request.GetServiceContractList true "鍙傛暟"
-// @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse}
-// @Router /api/serviceContract/list [post]
+// @Tags ServiceContract
+// @Summary 鐢熸垚璁″垝鍒楄〃
+// @Produce application/json
+// @Param object body request.GetServiceContractList true "鍙傛暟"
+// @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse}
+// @Router /api/serviceContract/list [post]
func (con *ServiceContractApi) List(c *gin.Context) {
var params request.GetServiceContractList
ctx, ok := contextx.NewContext(c, ¶ms)
diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go
index dd6009b..8819528 100644
--- a/api/v1/serviceFollowup.go
+++ b/api/v1/serviceFollowup.go
@@ -98,7 +98,6 @@
ctx.Ok()
}
-
// checkServiceFollowupParams
func checkServiceFollowupParams(serviceFollowup request.ServiceFollowup) (errCode int, serviceFollowupModel model.ServiceFollowup) {
//if serviceFollowup.Number == "" {
@@ -143,14 +142,14 @@
return
}
- serviceFollowups, total, errCode := serviceFollowupService.GetServiceFollowupList(params.Page, params.PageSize, params.Keyword)
+ serviceFollowups, total, errCode := serviceFollowupService.GetServiceFollowupList(params.Page, params.PageSize, params.KeywordType, params.Keyword)
if errCode != ecode.OK {
ctx.Fail(errCode)
return
}
ctx.OkWithDetailed(response.ServiceFollowupResponse{
- List: serviceFollowups,
+ List: serviceFollowups,
Count: int(total),
})
-}
\ No newline at end of file
+}
diff --git a/constvar/const.go b/constvar/const.go
index c2d105b..a99d452 100644
--- a/constvar/const.go
+++ b/constvar/const.go
@@ -91,3 +91,14 @@
ServiceContractKeywordServiceEndDate ServiceContractKeywordType = "鏈嶅姟鍒版湡鏃�"
ServiceContractKeywordServiceTotalPrice ServiceContractKeywordType = "浠风◣鍚堣"
)
+
+type ServiceFollowupKeywordType string
+
+const (
+ ServiceFollowupKeywordFollowupNo ServiceFollowupKeywordType = "鍥炶鍗曠紪鍙�"
+ ServiceFollowupKeywordCustomerName ServiceFollowupKeywordType = "瀹㈡埛鍚嶇О"
+ ServiceFollowupKeywordContactName ServiceFollowupKeywordType = "鑱旂郴浜哄鍚�"
+ ServiceFollowupKeywordCustomerServiceNo ServiceFollowupKeywordType = "瀹㈡埛鏈嶅姟鍗�"
+ ServiceFollowupKeywordVisitor ServiceFollowupKeywordType = "鍥炶浜�"
+ ServiceFollowupKeywordSatisfactionDegree ServiceFollowupKeywordType = "婊℃剰搴�"
+)
diff --git a/docs/docs.go b/docs/docs.go
index ba26073..827d7ce 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -7102,6 +7102,67 @@
"SalesStatusLevelUptoClientAndSalesChance"
]
},
+ "constvar.ServiceContractKeywordType": {
+ "type": "string",
+ "enum": [
+ "鏈嶅姟鍚堝悓缂栧彿",
+ "瀹㈡埛鍚嶇О",
+ "绛剧害鏃ユ湡",
+ "鍚堝悓绫诲瀷",
+ "鍚堝悓鐘舵��",
+ "璐熻矗浜�",
+ "浜у搧鍚嶇О",
+ "鏈嶅姟寮�濮嬫棩",
+ "鏈嶅姟鍒版湡鏃�",
+ "浠风◣鍚堣"
+ ],
+ "x-enum-varnames": [
+ "ServiceContractKeywordContractNo",
+ "ServiceContractKeywordCustomerName",
+ "ServiceContractKeywordContractDate",
+ "ServiceContractKeywordContractType",
+ "ServiceContractKeywordContractStatus",
+ "ServiceContractKeywordPrincipal",
+ "ServiceContractKeywordProductName",
+ "ServiceContractKeywordServiceBeginDate",
+ "ServiceContractKeywordServiceEndDate",
+ "ServiceContractKeywordServiceTotalPrice"
+ ]
+ },
+ "constvar.ServiceContractQueryClass": {
+ "type": "string",
+ "enum": [
+ "30澶╁悗杩囨湡",
+ "60澶╁悗杩囨湡",
+ "宸茶繃鏈�15澶�",
+ "宸茶繃鏈�60澶�"
+ ],
+ "x-enum-varnames": [
+ "ServiceContractQueryClassExpireAfter30Day",
+ "ServiceContractQueryClassExpireAfter60Day",
+ "ServiceContractQueryClassExpiredBefore15Day",
+ "ServiceContractQueryClassExpiredBefore60Day"
+ ]
+ },
+ "constvar.ServiceFollowupKeywordType": {
+ "type": "string",
+ "enum": [
+ "鍥炶鍗曠紪鍙�",
+ "瀹㈡埛鍚嶇О",
+ "鑱旂郴浜哄鍚�",
+ "瀹㈡埛鏈嶅姟鍗�",
+ "鍥炶浜�",
+ "婊℃剰搴�"
+ ],
+ "x-enum-varnames": [
+ "ServiceFollowupKeywordFollowupNo",
+ "ServiceFollowupKeywordCustomerName",
+ "ServiceFollowupKeywordContactName",
+ "ServiceFollowupKeywordCustomerServiceNo",
+ "ServiceFollowupKeywordVisitor",
+ "ServiceFollowupKeywordSatisfactionDegree"
+ ]
+ },
"constvar.UserType": {
"type": "integer",
"enum": [
@@ -10211,6 +10272,9 @@
"keyword": {
"type": "string"
},
+ "keywordType": {
+ "$ref": "#/definitions/constvar.ServiceContractKeywordType"
+ },
"page": {
"description": "椤电爜",
"type": "integer"
@@ -10218,6 +10282,9 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
+ },
+ "queryClass": {
+ "$ref": "#/definitions/constvar.ServiceContractQueryClass"
}
}
},
@@ -10243,6 +10310,9 @@
"keyword": {
"type": "string"
},
+ "keywordType": {
+ "$ref": "#/definitions/constvar.ServiceFollowupKeywordType"
+ },
"page": {
"description": "椤电爜",
"type": "integer"
diff --git a/docs/swagger.json b/docs/swagger.json
index 2da771e..dadcc4d 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -7090,6 +7090,67 @@
"SalesStatusLevelUptoClientAndSalesChance"
]
},
+ "constvar.ServiceContractKeywordType": {
+ "type": "string",
+ "enum": [
+ "鏈嶅姟鍚堝悓缂栧彿",
+ "瀹㈡埛鍚嶇О",
+ "绛剧害鏃ユ湡",
+ "鍚堝悓绫诲瀷",
+ "鍚堝悓鐘舵��",
+ "璐熻矗浜�",
+ "浜у搧鍚嶇О",
+ "鏈嶅姟寮�濮嬫棩",
+ "鏈嶅姟鍒版湡鏃�",
+ "浠风◣鍚堣"
+ ],
+ "x-enum-varnames": [
+ "ServiceContractKeywordContractNo",
+ "ServiceContractKeywordCustomerName",
+ "ServiceContractKeywordContractDate",
+ "ServiceContractKeywordContractType",
+ "ServiceContractKeywordContractStatus",
+ "ServiceContractKeywordPrincipal",
+ "ServiceContractKeywordProductName",
+ "ServiceContractKeywordServiceBeginDate",
+ "ServiceContractKeywordServiceEndDate",
+ "ServiceContractKeywordServiceTotalPrice"
+ ]
+ },
+ "constvar.ServiceContractQueryClass": {
+ "type": "string",
+ "enum": [
+ "30澶╁悗杩囨湡",
+ "60澶╁悗杩囨湡",
+ "宸茶繃鏈�15澶�",
+ "宸茶繃鏈�60澶�"
+ ],
+ "x-enum-varnames": [
+ "ServiceContractQueryClassExpireAfter30Day",
+ "ServiceContractQueryClassExpireAfter60Day",
+ "ServiceContractQueryClassExpiredBefore15Day",
+ "ServiceContractQueryClassExpiredBefore60Day"
+ ]
+ },
+ "constvar.ServiceFollowupKeywordType": {
+ "type": "string",
+ "enum": [
+ "鍥炶鍗曠紪鍙�",
+ "瀹㈡埛鍚嶇О",
+ "鑱旂郴浜哄鍚�",
+ "瀹㈡埛鏈嶅姟鍗�",
+ "鍥炶浜�",
+ "婊℃剰搴�"
+ ],
+ "x-enum-varnames": [
+ "ServiceFollowupKeywordFollowupNo",
+ "ServiceFollowupKeywordCustomerName",
+ "ServiceFollowupKeywordContactName",
+ "ServiceFollowupKeywordCustomerServiceNo",
+ "ServiceFollowupKeywordVisitor",
+ "ServiceFollowupKeywordSatisfactionDegree"
+ ]
+ },
"constvar.UserType": {
"type": "integer",
"enum": [
@@ -10199,6 +10260,9 @@
"keyword": {
"type": "string"
},
+ "keywordType": {
+ "$ref": "#/definitions/constvar.ServiceContractKeywordType"
+ },
"page": {
"description": "椤电爜",
"type": "integer"
@@ -10206,6 +10270,9 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
+ },
+ "queryClass": {
+ "$ref": "#/definitions/constvar.ServiceContractQueryClass"
}
}
},
@@ -10231,6 +10298,9 @@
"keyword": {
"type": "string"
},
+ "keywordType": {
+ "$ref": "#/definitions/constvar.ServiceFollowupKeywordType"
+ },
"page": {
"description": "椤电爜",
"type": "integer"
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 26faa50..606e0a6 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -21,6 +21,58 @@
- SalesStatusFail
- SalesStatusLevelUptoClient
- SalesStatusLevelUptoClientAndSalesChance
+ constvar.ServiceContractKeywordType:
+ enum:
+ - 鏈嶅姟鍚堝悓缂栧彿
+ - 瀹㈡埛鍚嶇О
+ - 绛剧害鏃ユ湡
+ - 鍚堝悓绫诲瀷
+ - 鍚堝悓鐘舵��
+ - 璐熻矗浜�
+ - 浜у搧鍚嶇О
+ - 鏈嶅姟寮�濮嬫棩
+ - 鏈嶅姟鍒版湡鏃�
+ - 浠风◣鍚堣
+ type: string
+ x-enum-varnames:
+ - ServiceContractKeywordContractNo
+ - ServiceContractKeywordCustomerName
+ - ServiceContractKeywordContractDate
+ - ServiceContractKeywordContractType
+ - ServiceContractKeywordContractStatus
+ - ServiceContractKeywordPrincipal
+ - ServiceContractKeywordProductName
+ - ServiceContractKeywordServiceBeginDate
+ - ServiceContractKeywordServiceEndDate
+ - ServiceContractKeywordServiceTotalPrice
+ constvar.ServiceContractQueryClass:
+ enum:
+ - 30澶╁悗杩囨湡
+ - 60澶╁悗杩囨湡
+ - 宸茶繃鏈�15澶�
+ - 宸茶繃鏈�60澶�
+ type: string
+ x-enum-varnames:
+ - ServiceContractQueryClassExpireAfter30Day
+ - ServiceContractQueryClassExpireAfter60Day
+ - ServiceContractQueryClassExpiredBefore15Day
+ - ServiceContractQueryClassExpiredBefore60Day
+ constvar.ServiceFollowupKeywordType:
+ enum:
+ - 鍥炶鍗曠紪鍙�
+ - 瀹㈡埛鍚嶇О
+ - 鑱旂郴浜哄鍚�
+ - 瀹㈡埛鏈嶅姟鍗�
+ - 鍥炶浜�
+ - 婊℃剰搴�
+ type: string
+ x-enum-varnames:
+ - ServiceFollowupKeywordFollowupNo
+ - ServiceFollowupKeywordCustomerName
+ - ServiceFollowupKeywordContactName
+ - ServiceFollowupKeywordCustomerServiceNo
+ - ServiceFollowupKeywordVisitor
+ - ServiceFollowupKeywordSatisfactionDegree
constvar.UserType:
enum:
- 1
@@ -2095,12 +2147,16 @@
properties:
keyword:
type: string
+ keywordType:
+ $ref: '#/definitions/constvar.ServiceContractKeywordType'
page:
description: 椤电爜
type: integer
pageSize:
description: 姣忛〉澶у皬
type: integer
+ queryClass:
+ $ref: '#/definitions/constvar.ServiceContractQueryClass'
type: object
request.GetServiceFeeManageList:
properties:
@@ -2117,6 +2173,8 @@
properties:
keyword:
type: string
+ keywordType:
+ $ref: '#/definitions/constvar.ServiceFollowupKeywordType'
page:
description: 椤电爜
type: integer
diff --git a/model/request/serviceFollowup.go b/model/request/serviceFollowup.go
index a13fa6c..eb27512 100644
--- a/model/request/serviceFollowup.go
+++ b/model/request/serviceFollowup.go
@@ -1,5 +1,7 @@
package request
+import "aps_crm/constvar"
+
type AddServiceFollowup struct {
ServiceFollowup
}
@@ -27,5 +29,6 @@
type GetServiceFollowupList struct {
PageInfo
- Keyword string `json:"keyword"`
+ KeywordType constvar.ServiceFollowupKeywordType `json:"keywordType"`
+ Keyword string `json:"keyword"`
}
diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index c6baa40..23fda19 100644
--- a/model/serviceFollowup.go
+++ b/model/serviceFollowup.go
@@ -1,6 +1,7 @@
package model
import (
+ "aps_crm/constvar"
"aps_crm/pkg/mysqlx"
"gorm.io/gorm"
)
@@ -28,13 +29,12 @@
ServiceFollowupSearch struct {
ServiceFollowup
-
- Orm *gorm.DB
- Keyword string
- OrderBy string
- PageNum int
- PageSize int
-
+ Orm *gorm.DB
+ KeywordType constvar.ServiceFollowupKeywordType
+ Keyword interface{}
+ OrderBy string
+ PageNum int
+ PageSize int
}
)
@@ -50,11 +50,24 @@
func (slf *ServiceFollowupSearch) build() *gorm.DB {
var db = slf.Orm.Model(&ServiceFollowup{})
- if slf.Keyword != "" {
- db = db.Where("name LIKE ?", "%"+slf.Keyword+"%")
- }
if slf.Id != 0 {
db = db.Where("id = ?", slf.Id)
+ }
+
+ switch slf.KeywordType {
+ case constvar.ServiceFollowupKeywordFollowupNo:
+ db = db.Where("number = ?", slf.Keyword)
+ case constvar.ServiceFollowupKeywordCustomerName:
+ db = db.Where("client_id = ?", slf.Keyword)
+ case constvar.ServiceFollowupKeywordContactName:
+ db = db.Where("contact_id = ?", slf.Keyword)
+ case constvar.ServiceFollowupKeywordCustomerServiceNo:
+ db = db.Where("service_id = ?", slf.Keyword)
+ case constvar.ServiceFollowupKeywordVisitor:
+ db = db.Where("member_id = ?", slf.Keyword)
+ case constvar.ServiceFollowupKeywordSatisfactionDegree:
+ db = db.Where("satisfaction_id = ?", slf.Keyword)
+
}
return db
@@ -106,7 +119,10 @@
return slf
}
-// 鍙兘鎬� 甯佺 褰撳墠鐘舵�侊紙閿�鍞満浼氾級
+func (slf *ServiceFollowupSearch) SetKeywordType(keyword constvar.ServiceFollowupKeywordType) *ServiceFollowupSearch {
+ slf.KeywordType = keyword
+ return slf
+}
func (slf *ServiceFollowupSearch) SetKeyword(keyword string) *ServiceFollowupSearch {
slf.Keyword = keyword
@@ -121,4 +137,4 @@
func (slf *ServiceFollowupSearch) SetOrder(order string) *ServiceFollowupSearch {
slf.OrderBy = order
return slf
-}
\ No newline at end of file
+}
diff --git a/service/serviceFollowup.go b/service/serviceFollowup.go
index 8faea0b..2dd1099 100644
--- a/service/serviceFollowup.go
+++ b/service/serviceFollowup.go
@@ -1,6 +1,7 @@
package service
import (
+ "aps_crm/constvar"
"aps_crm/model"
"aps_crm/pkg/ecode"
)
@@ -44,9 +45,12 @@
return ecode.OK
}
-func (FollowupService) GetServiceFollowupList(page, pageSize int, keyword string) ([]*model.ServiceFollowup, int64, int) {
+func (FollowupService) GetServiceFollowupList(page, pageSize int, keywordType constvar.ServiceFollowupKeywordType, keyword string) ([]*model.ServiceFollowup, int64, int) {
// get contact list
- contacts, total, err := model.NewServiceFollowupSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll()
+ contacts, total, err := model.NewServiceFollowupSearch().
+ SetKeywordType(keywordType).
+ SetKeyword(keyword).
+ SetPage(page, pageSize).FindAll()
if err != nil {
return nil, 0, ecode.ServiceFollowupListErr
}
--
Gitblit v1.8.0