| | |
| | | |
| | | // 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) |
| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | |
| | | // checkServiceFollowupParams |
| | | func checkServiceFollowupParams(serviceFollowup request.ServiceFollowup) (errCode int, serviceFollowupModel model.ServiceFollowup) { |
| | | //if serviceFollowup.Number == "" { |
| | |
| | | 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), |
| | | }) |
| | | } |
| | | } |
| | |
| | | ServiceContractKeywordServiceEndDate ServiceContractKeywordType = "服务到期日" |
| | | ServiceContractKeywordServiceTotalPrice ServiceContractKeywordType = "价税合计" |
| | | ) |
| | | |
| | | type ServiceFollowupKeywordType string |
| | | |
| | | const ( |
| | | ServiceFollowupKeywordFollowupNo ServiceFollowupKeywordType = "回访单编号" |
| | | ServiceFollowupKeywordCustomerName ServiceFollowupKeywordType = "客户名称" |
| | | ServiceFollowupKeywordContactName ServiceFollowupKeywordType = "联系人姓名" |
| | | ServiceFollowupKeywordCustomerServiceNo ServiceFollowupKeywordType = "客户服务单" |
| | | ServiceFollowupKeywordVisitor ServiceFollowupKeywordType = "回访人" |
| | | ServiceFollowupKeywordSatisfactionDegree ServiceFollowupKeywordType = "满意度" |
| | | ) |
| | |
| | | "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": [ |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceContractKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceContractQueryClass" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceFollowupKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | "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": [ |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceContractKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceContractQueryClass" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceFollowupKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | - 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 |
| | |
| | | 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: |
| | |
| | | properties: |
| | | keyword: |
| | | type: string |
| | | keywordType: |
| | | $ref: '#/definitions/constvar.ServiceFollowupKeywordType' |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | |
| | | package request |
| | | |
| | | import "aps_crm/constvar" |
| | | |
| | | type AddServiceFollowup struct { |
| | | ServiceFollowup |
| | | } |
| | |
| | | |
| | | type GetServiceFollowupList struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | KeywordType constvar.ServiceFollowupKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | } |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | ) |
| | |
| | | |
| | | 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 |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | func (slf *ServiceFollowupSearch) SetOrder(order string) *ServiceFollowupSearch { |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | } |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | |
| | | 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 |
| | | } |