add
isVisit 服务人员来访模块
add, Delete, update, list
| | |
| | | ) |
| | | |
| | | type Group struct { |
| | | IsVisitApi |
| | | SolveRateApi |
| | | TimelyRateApi |
| | | BaseApi |
| | |
| | | satisfactionService = service.ServiceGroup.SatisfactionService |
| | | timelyRateService = service.ServiceGroup.TimelyRateService |
| | | solveRateService = service.ServiceGroup.SolveRateService |
| | | isVisitService = service.ServiceGroup.IsVisitService |
| | | ) |
New file |
| | |
| | | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | | |
| | | type IsVisitApi struct{} |
| | | |
| | | // Add |
| | | // |
| | | // @Tags IsVisit |
| | | // @Summary 添加服务人员是否来过 |
| | | // @Produce application/json |
| | | // @Param object body request.AddIsVisit true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/isVisit/add [post] |
| | | func (s *IsVisitApi) Add(c *gin.Context) { |
| | | var params request.AddIsVisit |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | isVisit := new(model.IsVisit) |
| | | isVisit.Name = params.Name |
| | | |
| | | errCode := isVisitService.AddIsVisit(isVisit) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags IsVisit |
| | | // @Summary 删除服务人员是否来过 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/isVisit/delete/{id} [delete] |
| | | func (s *IsVisitApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | errCode := isVisitService.DeleteIsVisit(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags IsVisit |
| | | // @Summary 更新服务人员是否来过 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateIsVisits true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/isVisit/update [put] |
| | | func (s *IsVisitApi) Update(c *gin.Context) { |
| | | var params request.UpdateIsVisits |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := isVisitService.UpdateIsVisit(params.IsVisits) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags IsVisit |
| | | // @Summary 获取服务人员是否来过列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.IsVisitResponse} |
| | | // @Router /api/isVisit/list [get] |
| | | func (s *IsVisitApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | isVisits, errCode := isVisitService.GetIsVisitList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.IsVisitResponse{ |
| | | List: isVisits, |
| | | }) |
| | | } |
| | |
| | | SatisfactionId: serviceFollowup.Satisfaction, |
| | | TimelyRateId: serviceFollowup.TimelyRate, |
| | | SolveRateId: serviceFollowup.SolveRate, |
| | | IsVisit: serviceFollowup.IsVisit, |
| | | IsVisitId: serviceFollowup.IsVisit, |
| | | OldMemberId: serviceFollowup.OldMemberId, |
| | | Remark: serviceFollowup.Remark, |
| | | File: serviceFollowup.File, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "添加服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddIsVisit" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "删除服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "获取服务人员是否来过列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "$ref": "#/definitions/response.IsVisitResponse" |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "更新服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateIsVisits" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/masterOrder/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "model.IsVisit": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "model.MasterOrder": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "isVisit": { |
| | | "isVisitId": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | |
| | | } |
| | | }, |
| | | "request.AddIndustry": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddIsVisit": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateIsVisit": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateIsVisits": { |
| | | "type": "object", |
| | | "required": [ |
| | | "is_visit" |
| | | ], |
| | | "properties": { |
| | | "is_visit": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.UpdateIsVisit" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateMasterOrder": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "$ref": "#/definitions/model.Industry" |
| | | } |
| | | }, |
| | | "isVisit": { |
| | | "description": "服务人员是否来过", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.IsVisit" |
| | | } |
| | | }, |
| | | "member": { |
| | | "description": "Member", |
| | | "type": "array", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.IsVisitResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.IsVisit" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.LoginResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "添加服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddIsVisit" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "删除服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "获取服务人员是否来过列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "$ref": "#/definitions/response.IsVisitResponse" |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/isVisit/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "IsVisit" |
| | | ], |
| | | "summary": "更新服务人员是否来过", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateIsVisits" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/masterOrder/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "model.IsVisit": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "model.MasterOrder": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "isVisit": { |
| | | "isVisitId": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | |
| | | } |
| | | }, |
| | | "request.AddIndustry": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddIsVisit": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateIsVisit": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateIsVisits": { |
| | | "type": "object", |
| | | "required": [ |
| | | "is_visit" |
| | | ], |
| | | "properties": { |
| | | "is_visit": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.UpdateIsVisit" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateMasterOrder": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "$ref": "#/definitions/model.Industry" |
| | | } |
| | | }, |
| | | "isVisit": { |
| | | "description": "服务人员是否来过", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.IsVisit" |
| | | } |
| | | }, |
| | | "member": { |
| | | "description": "Member", |
| | | "type": "array", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.IsVisitResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.IsVisit" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.LoginResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | name: |
| | | type: string |
| | | type: object |
| | | model.IsVisit: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | type: object |
| | | model.MasterOrder: |
| | | properties: |
| | | client: |
| | |
| | | type: string |
| | | id: |
| | | type: integer |
| | | isVisit: |
| | | isVisitId: |
| | | type: integer |
| | | memberId: |
| | | type: integer |
| | |
| | | - follow_record |
| | | type: object |
| | | request.AddIndustry: |
| | | properties: |
| | | name: |
| | | type: string |
| | | required: |
| | | - name |
| | | type: object |
| | | request.AddIsVisit: |
| | | properties: |
| | | name: |
| | | type: string |
| | |
| | | - id |
| | | - name |
| | | type: object |
| | | request.UpdateIsVisit: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | required: |
| | | - id |
| | | - name |
| | | type: object |
| | | request.UpdateIsVisits: |
| | | properties: |
| | | is_visit: |
| | | items: |
| | | $ref: '#/definitions/request.UpdateIsVisit' |
| | | type: array |
| | | required: |
| | | - is_visit |
| | | type: object |
| | | request.UpdateMasterOrder: |
| | | properties: |
| | | client_id: |
| | |
| | | items: |
| | | $ref: '#/definitions/model.Industry' |
| | | type: array |
| | | isVisit: |
| | | description: 服务人员是否来过 |
| | | items: |
| | | $ref: '#/definitions/model.IsVisit' |
| | | type: array |
| | | member: |
| | | description: Member |
| | | items: |
| | |
| | | list: |
| | | items: |
| | | $ref: '#/definitions/model.Industry' |
| | | type: array |
| | | type: object |
| | | response.IsVisitResponse: |
| | | properties: |
| | | list: |
| | | items: |
| | | $ref: '#/definitions/model.IsVisit' |
| | | type: array |
| | | type: object |
| | | response.LoginResponse: |
| | |
| | | summary: 更新行业 |
| | | tags: |
| | | - Industry |
| | | /api/isVisit/add: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddIsVisit' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加服务人员是否来过 |
| | | tags: |
| | | - IsVisit |
| | | /api/isVisit/delete/{id}: |
| | | delete: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: path |
| | | name: id |
| | | required: true |
| | | type: integer |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 删除服务人员是否来过 |
| | | tags: |
| | | - IsVisit |
| | | /api/isVisit/list: |
| | | get: |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/contextx.Response' |
| | | - properties: |
| | | data: |
| | | $ref: '#/definitions/response.IsVisitResponse' |
| | | type: object |
| | | summary: 获取服务人员是否来过列表 |
| | | tags: |
| | | - IsVisit |
| | | /api/isVisit/update: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateIsVisits' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新服务人员是否来过 |
| | | tags: |
| | | - IsVisit |
| | | /api/masterOrder/add: |
| | | post: |
| | | parameters: |
| | |
| | | Satisfaction{}, |
| | | TimelyRate{}, |
| | | SolveRate{}, |
| | | IsVisit{}, |
| | | IsVisit{}, |
| | | ) |
| | | return err |
| | | } |
| | | } |
New file |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | // IsVisit 商机阶段 |
| | | IsVisit struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:商机阶段名称"` |
| | | } |
| | | |
| | | IsVisitSearch struct { |
| | | IsVisit |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (IsVisit) TableName() string { |
| | | return "is_visit" |
| | | } |
| | | |
| | | func NewIsVisitSearch() *IsVisitSearch { |
| | | return &IsVisitSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&IsVisit{}) |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) Create(record *IsVisit) error { |
| | | var db = slf.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&IsVisit{}).Error |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) Update(record *IsVisit) error { |
| | | var db = slf.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) Find() (*IsVisit, error) { |
| | | var db = slf.build() |
| | | var record = new(IsVisit) |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) FindAll() ([]*IsVisit, error) { |
| | | var db = slf.build() |
| | | var records = make([]*IsVisit, 0) |
| | | err := db.Find(&records).Error |
| | | return records, err |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) SetId(id int) *IsVisitSearch { |
| | | slf.Id = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) SetName(name string) *IsVisitSearch { |
| | | slf.Name = name |
| | | return slf |
| | | } |
| | | |
| | | func (slf *IsVisitSearch) Updates(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(data).Error |
| | | } |
New file |
| | |
| | | |
| | | package request |
| | | |
| | | type AddIsVisit struct { |
| | | Name string ` json:"name" binding:"required"` |
| | | } |
| | | |
| | | type UpdateIsVisit struct { |
| | | Id int `json:"id" binding:"required"` |
| | | Name string `json:"name" binding:"required"` |
| | | } |
| | | |
| | | type UpdateIsVisits struct { |
| | | IsVisits []*UpdateIsVisit `json:"is_visit" binding:"required"` |
| | | } |
| | |
| | | } |
| | | |
| | | DataResponse struct { |
| | | |
| | | // 服务人员是否来过 |
| | | IsVisit []*model.IsVisit `json:"isVisit"` |
| | | |
| | | // 国家数据 |
| | | Country []*model.Country `json:"country"` |
| | | // 省份数据 |
| | |
| | | SolveRateResponse struct { |
| | | List []*model.SolveRate `json:"list"` |
| | | } |
| | | |
| | | IsVisitResponse struct { |
| | | List []*model.IsVisit `json:"list"` |
| | | } |
| | | ) |
| | |
| | | SatisfactionId int `json:"satisfactionId" gorm:"column:satisfaction_id;type:int;comment:满意度id"` |
| | | TimelyRateId int `json:"timelyRateId" gorm:"column:timely_rate_id;type:int;comment:及时率id"` |
| | | SolveRateId int `json:"solveRateId" gorm:"column:solve_rate_id;type:int;comment:解决率id"` |
| | | IsVisit int `json:"isVisit" gorm:"column:is_visit;type:int;comment:服务人员是否来过"` |
| | | IsVisitId int `json:"isVisitId" gorm:"column:is_visit_id;type:int;comment:服务人员是否来过id"` |
| | | OldMemberId int `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:原服务人员"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | File string `json:"file" gorm:"column:file;type:varchar(255);comment:附件"` |
| | |
| | | SolveRateListErr = 4400003 // 获取解决率列表失败 |
| | | SolveRateSetErr = 4400004 // 设置解决率失败 |
| | | SolveRateUpdateErr = 4400005 // 更新解决率失败 |
| | | |
| | | IsVisitExist = 4500001 // 服务人员是否来过已存在 |
| | | IsVisitNotExist = 4500002 // 服务人员是否来过不存在 |
| | | IsVisitListErr = 4500003 // 获取服务人员是否来过列表失败 |
| | | IsVisitSetErr = 4500004 // 设置服务人员是否来过失败 |
| | | IsVisitUpdateErr = 4500005 // 更新服务人员是否来过失败 |
| | | |
| | | ) |
| | |
| | | ) |
| | | |
| | | type Group struct { |
| | | IsVisitRouter |
| | | SolveRateRouter |
| | | TimelyRateRouter |
| | | BaseRouter |
| | |
| | | routerGroup.InitSatisfactionRouter(PrivateGroup) // 注册satisfaction路由 |
| | | routerGroup.InitTimelyRateRouter(PrivateGroup) |
| | | routerGroup.InitSolveRateRouter(PrivateGroup) |
| | | routerGroup.InitIsVisitRouter(PrivateGroup) |
| | | } |
| | | return Router |
| | | } |
New file |
| | |
| | | |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type IsVisitRouter struct{} |
| | | |
| | | func (s *IsVisitRouter) InitIsVisitRouter(router *gin.RouterGroup) { |
| | | isVisitRouter := router.Group("isVisit") |
| | | isVisitApi := v1.ApiGroup.IsVisitApi |
| | | { |
| | | isVisitRouter.POST("add", isVisitApi.Add) // 添加$CName$ |
| | | isVisitRouter.DELETE("delete/:id", isVisitApi.Delete) // 删除$CName$ |
| | | isVisitRouter.PUT("update", isVisitApi.Update) // 更新$CName$ |
| | | isVisitRouter.GET("list", isVisitApi.List) // 获取$CName$列表 |
| | | } |
| | | } |
| | |
| | | solveRateList, _ := ServiceGroup.GetSolveRateList() |
| | | data.SolveRate = solveRateList |
| | | |
| | | // get IsVisit list |
| | | isVisitList, _ := ServiceGroup.GetIsVisitList() |
| | | data.IsVisit = isVisitList |
| | | |
| | | errCode = ecode.OK |
| | | |
| | | return |
| | | } |
| | | } |
| | |
| | | SatisfactionService |
| | | TimelyRateService |
| | | SolveRateService |
| | | IsVisitService |
| | | } |
| | | |
| | | var ServiceGroup = new(Group) |
New file |
| | |
| | | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | | |
| | | type IsVisitService struct{} |
| | | |
| | | func (IsVisitService) AddIsVisit(isVisit *model.IsVisit) int { |
| | | err := model.NewIsVisitSearch().Create(isVisit) |
| | | if err != nil { |
| | | return ecode.IsVisitExist |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (IsVisitService) DeleteIsVisit(id int) int { |
| | | _, err := model.NewIsVisitSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return ecode.IsVisitNotExist |
| | | } |
| | | |
| | | err = model.NewIsVisitSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.IsVisitNotExist |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (IsVisitService) GetIsVisitList() ([]*model.IsVisit, int) { |
| | | list, err := model.NewIsVisitSearch().FindAll() |
| | | if err != nil { |
| | | return nil, ecode.IsVisitListErr |
| | | } |
| | | |
| | | return list, ecode.OK |
| | | } |
| | | |
| | | func (IsVisitService) UpdateIsVisit(isVisits []*request.UpdateIsVisit) int { |
| | | for _, v := range isVisits { |
| | | // check isVisit exist |
| | | _, err := model.NewIsVisitSearch().SetId(v.Id).Find() |
| | | if err != nil { |
| | | return ecode.IsVisitNotExist |
| | | } |
| | | |
| | | err = model.NewIsVisitSearch().SetId(v.Id).Updates(map[string]interface{}{ |
| | | "name": v.Name, |
| | | }) |
| | | if err != nil { |
| | | return ecode.IsVisitSetErr |
| | | } |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (IsVisitService) GetIsVisitDetail(id int) (*model.IsVisit, int) { |
| | | isVisit, err := model.NewIsVisitSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return nil, ecode.IsVisitNotExist |
| | | } |
| | | |
| | | return isVisit, ecode.OK |
| | | } |