zhangqian
2023-08-02 6e9274c27ffc8fe7f41e2c3c06a239d4c3fb09e5
增加服务回访单搜索条件
9个文件已修改
281 ■■■■■ 已修改文件
api/v1/serviceContract.go 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceFollowup.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/const.go 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceFollowup.go 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceFollowup.go 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/serviceFollowup.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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, &params)
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),
    })
}
}
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 = "满意度"
)
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"
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"
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
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"`
}
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
}
}
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
    }