add
timelyRate 及时率模块
add, Delete, update, list
| | |
| | | DepartmentApi |
| | | VettingApi |
| | | SatisfactionApi |
| | | TimelyRateApi |
| | | } |
| | | |
| | | var ApiGroup = new(Group) |
| | |
| | | departmentService = service.ServiceGroup.DepartmentService |
| | | vettingService = service.ServiceGroup.VettingService |
| | | satisfactionService = service.ServiceGroup.SatisfactionService |
| | | timelyRateService = service.ServiceGroup.TimelyRateService |
| | | ) |
| | |
| | | // @Tags Satisfaction |
| | | // @Summary 更新满意度 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateSatisfactions true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Param object body request.UpdateSatisfactions true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/satisfaction/update [put] |
| | | func (s *SatisfactionApi) Update(c *gin.Context) { |
| | | var params request.UpdateSatisfactions |
| | |
| | | |
| | | // List |
| | | // |
| | | // @Tags Satisfaction |
| | | // @Summary 满意度列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.SatisfactionResponse} |
| | | // @Router /api/satisfaction/list [get] |
| | | // @Tags Satisfaction |
| | | // @Summary 满意度列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.SatisfactionResponse} |
| | | // @Router /api/satisfaction/list [get] |
| | | func (s *SatisfactionApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | |
| | | //} |
| | | |
| | | serviceFollowupModel = model.ServiceFollowup{ |
| | | ClientId: serviceFollowup.ClientId, |
| | | Number: serviceFollowup.Number, |
| | | ContactId: serviceFollowup.ContactId, |
| | | ServiceId: serviceFollowup.ServiceId, |
| | | MemberId: serviceFollowup.MemberId, |
| | | PlanId: serviceFollowup.PlanId, |
| | | Satisfaction: serviceFollowup.Satisfaction, |
| | | TimelyRate: serviceFollowup.TimelyRate, |
| | | SolveRate: serviceFollowup.SolveRate, |
| | | IsVisit: serviceFollowup.IsVisit, |
| | | OldMemberId: serviceFollowup.OldMemberId, |
| | | Remark: serviceFollowup.Remark, |
| | | File: serviceFollowup.File, |
| | | ClientId: serviceFollowup.ClientId, |
| | | Number: serviceFollowup.Number, |
| | | ContactId: serviceFollowup.ContactId, |
| | | ServiceId: serviceFollowup.ServiceId, |
| | | MemberId: serviceFollowup.MemberId, |
| | | PlanId: serviceFollowup.PlanId, |
| | | SatisfactionId: serviceFollowup.Satisfaction, |
| | | TimelyRateId: serviceFollowup.TimelyRate, |
| | | SolveRate: serviceFollowup.SolveRate, |
| | | IsVisit: serviceFollowup.IsVisit, |
| | | OldMemberId: serviceFollowup.OldMemberId, |
| | | Remark: serviceFollowup.Remark, |
| | | File: serviceFollowup.File, |
| | | } |
| | | |
| | | return ecode.OK, serviceFollowupModel |
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 TimelyRateApi struct{} |
| | | |
| | | // Add |
| | | // |
| | | // @Tags TimelyRate |
| | | // @Summary 添加销售阶段 |
| | | // @Produce application/json |
| | | // @Param object body request.AddTimelyRate true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/timelyRate/add [post] |
| | | func (s *TimelyRateApi) Add(c *gin.Context) { |
| | | var params request.AddTimelyRate |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | timelyRate := new(model.TimelyRate) |
| | | timelyRate.Name = params.Name |
| | | |
| | | errCode := timelyRateService.AddTimelyRate(timelyRate) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags TimelyRate |
| | | // @Summary 删除销售阶段 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/timelyRate/delete/{id} [delete] |
| | | func (s *TimelyRateApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | errCode := timelyRateService.DeleteTimelyRate(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags TimelyRate |
| | | // @Summary 更新销售阶段 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateTimelyRates true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/timelyRate/update [put] |
| | | func (s *TimelyRateApi) Update(c *gin.Context) { |
| | | var params request.UpdateTimelyRates |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := timelyRateService.UpdateTimelyRate(params.TimelyRates) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags TimelyRate |
| | | // @Summary 获取销售阶段列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.TimelyRateResponse} |
| | | // @Router /api/timelyRate/list [get] |
| | | func (s *TimelyRateApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | timelyRates, errCode := timelyRateService.GetTimelyRateList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.TimelyRateResponse{ |
| | | List: timelyRates, |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "添加销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddTimelyRate" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "删除销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "获取销售阶段列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "$ref": "#/definitions/response.TimelyRateResponse" |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "更新销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateTimelyRates" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/user/changePassword": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "satisfaction": { |
| | | "satisfactionId": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceId": { |
| | |
| | | "solveRate": { |
| | | "type": "integer" |
| | | }, |
| | | "timelyRate": { |
| | | "timelyRateId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "model.TimelyRate": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.AddTimelyRate": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateTimelyRate": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateTimelyRates": { |
| | | "type": "object", |
| | | "required": [ |
| | | "timely_rate" |
| | | ], |
| | | "properties": { |
| | | "timely_rate": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.UpdateTimelyRate" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.CityResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.SalesSources" |
| | | } |
| | | }, |
| | | "satisfaction": { |
| | | "description": "满意度", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Satisfaction" |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.TimelyRateResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.TimelyRate" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.UserResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "添加销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddTimelyRate" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "删除销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "获取销售阶段列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "$ref": "#/definitions/response.TimelyRateResponse" |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timelyRate/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "TimelyRate" |
| | | ], |
| | | "summary": "更新销售阶段", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateTimelyRates" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/user/changePassword": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "satisfaction": { |
| | | "satisfactionId": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceId": { |
| | |
| | | "solveRate": { |
| | | "type": "integer" |
| | | }, |
| | | "timelyRate": { |
| | | "timelyRateId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "model.TimelyRate": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.AddTimelyRate": { |
| | | "type": "object", |
| | | "required": [ |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateTimelyRate": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "name" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateTimelyRates": { |
| | | "type": "object", |
| | | "required": [ |
| | | "timely_rate" |
| | | ], |
| | | "properties": { |
| | | "timely_rate": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/request.UpdateTimelyRate" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.CityResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.SalesSources" |
| | | } |
| | | }, |
| | | "satisfaction": { |
| | | "description": "满意度", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Satisfaction" |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.TimelyRateResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.TimelyRate" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "response.UserResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | type: integer |
| | | remark: |
| | | type: string |
| | | satisfaction: |
| | | satisfactionId: |
| | | type: integer |
| | | serviceId: |
| | | type: integer |
| | | solveRate: |
| | | type: integer |
| | | timelyRate: |
| | | timelyRateId: |
| | | type: integer |
| | | type: object |
| | | model.SubOrder: |
| | |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | type: object |
| | | model.TimelyRate: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | type: object |
| | | model.User: |
| | | properties: |
| | |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | type: object |
| | | request.AddTimelyRate: |
| | | properties: |
| | | name: |
| | | type: string |
| | | required: |
| | | - name |
| | | type: object |
| | | request.AddVetting: |
| | | properties: |
| | |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | type: object |
| | | request.UpdateTimelyRate: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | required: |
| | | - id |
| | | - name |
| | | type: object |
| | | request.UpdateTimelyRates: |
| | | properties: |
| | | timely_rate: |
| | | items: |
| | | $ref: '#/definitions/request.UpdateTimelyRate' |
| | | type: array |
| | | required: |
| | | - timely_rate |
| | | type: object |
| | | response.CityResponse: |
| | | properties: |
| | | list: |
| | |
| | | description: 商机来源 |
| | | items: |
| | | $ref: '#/definitions/model.SalesSources' |
| | | type: array |
| | | satisfaction: |
| | | description: 满意度 |
| | | items: |
| | | $ref: '#/definitions/model.Satisfaction' |
| | | type: array |
| | | type: object |
| | | response.DepartmentResponse: |
| | |
| | | list: |
| | | items: |
| | | $ref: '#/definitions/model.SubOrder' |
| | | type: array |
| | | type: object |
| | | response.TimelyRateResponse: |
| | | properties: |
| | | list: |
| | | items: |
| | | $ref: '#/definitions/model.TimelyRate' |
| | | type: array |
| | | type: object |
| | | response.UserResponse: |
| | |
| | | summary: 更新子订单 |
| | | tags: |
| | | - SubOrder |
| | | /api/timelyRate/add: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddTimelyRate' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加销售阶段 |
| | | tags: |
| | | - TimelyRate |
| | | /api/timelyRate/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: |
| | | - TimelyRate |
| | | /api/timelyRate/list: |
| | | get: |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/contextx.Response' |
| | | - properties: |
| | | data: |
| | | $ref: '#/definitions/response.TimelyRateResponse' |
| | | type: object |
| | | summary: 获取销售阶段列表 |
| | | tags: |
| | | - TimelyRate |
| | | /api/timelyRate/update: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateTimelyRates' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新销售阶段 |
| | | tags: |
| | | - TimelyRate |
| | | /api/user/changePassword: |
| | | post: |
| | | parameters: |
| | |
| | | Api{}, |
| | | Department{}, |
| | | Satisfaction{}, |
| | | TimelyRate{}, |
| | | ) |
| | | return err |
| | | } |
New file |
| | |
| | | |
| | | package request |
| | | |
| | | type AddTimelyRate struct { |
| | | Name string ` json:"name" binding:"required"` |
| | | } |
| | | |
| | | type UpdateTimelyRate struct { |
| | | Id int `json:"id" binding:"required"` |
| | | Name string `json:"name" binding:"required"` |
| | | } |
| | | |
| | | type UpdateTimelyRates struct { |
| | | TimelyRates []*UpdateTimelyRate `json:"timely_rate" binding:"required"` |
| | | } |
| | |
| | | Member []*model.User `json:"member"` |
| | | // 部门 |
| | | Department []*model.Department `json:"department"` |
| | | // 满意度 |
| | | Satisfaction []*model.Satisfaction `json:"satisfaction"` |
| | | // 及时率 |
| | | TimelyRate []*model.TimelyRate `json:"timely_rate"` |
| | | } |
| | | |
| | | DepartmentResponse struct { |
| | |
| | | SatisfactionResponse struct { |
| | | List []*model.Satisfaction `json:"list"` |
| | | } |
| | | |
| | | TimelyRateResponse struct { |
| | | List []*model.TimelyRate `json:"list"` |
| | | } |
| | | ) |
| | | |
| | | // 及时率 解决率 满意度 服务人员是否来过 (服务回访单) |
| | | // 工单类型 报修来源(工单管理) |
| | | // 合同类型 合同状态(服务合同) |
| | | // 付款方式 是否开票 账户(销售退款单) |
| | | // 退入仓库 状态(销售退货单) |
| | | // 报价单状态 (报价单) |
| | | // 可能性 币种 当前状态(销售机会) |
| | |
| | | func (slf *ServiceFeeManageSearch) FindAll() ([]*ServiceFeeManage, error) { |
| | | var db = slf.build() |
| | | var records = make([]*ServiceFeeManage, 0) |
| | | err := db.Find(&records).Error |
| | | err := db.Preload("Client").Find(&records).Error |
| | | return records, err |
| | | } |
| | |
| | | CustomerServiceSheet CustomerServiceSheet `json:"customerServiceSheet" gorm:"foreignKey:ServiceId"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:服务人员id"` |
| | | PlanId int `json:"planId" gorm:"column:plan_id;type:int;comment:服务计划id"` |
| | | Satisfaction int `json:"satisfaction" gorm:"column:satisfaction;type:int;comment:满意度"` |
| | | TimelyRate int `json:"timelyRate" gorm:"column:timely_rate;type:int;comment:及时率"` |
| | | 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"` |
| | | SolveRate int `json:"solveRate" gorm:"column:solve_rate;type:int;comment:解决率"` |
| | | IsVisit int `json:"isVisit" gorm:"column:is_visit;type:int;comment:服务人员是否来过"` |
| | | OldMemberId int `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:原服务人员"` |
New file |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | // TimelyRate 商机阶段 |
| | | TimelyRate struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:商机阶段名称"` |
| | | } |
| | | |
| | | TimelyRateSearch struct { |
| | | TimelyRate |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (TimelyRate) TableName() string { |
| | | return "timely_rate" |
| | | } |
| | | |
| | | func NewTimelyRateSearch() *TimelyRateSearch { |
| | | return &TimelyRateSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&TimelyRate{}) |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) Create(record *TimelyRate) error { |
| | | var db = slf.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&TimelyRate{}).Error |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) Update(record *TimelyRate) error { |
| | | var db = slf.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) Find() (*TimelyRate, error) { |
| | | var db = slf.build() |
| | | var record = new(TimelyRate) |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) FindAll() ([]*TimelyRate, error) { |
| | | var db = slf.build() |
| | | var records = make([]*TimelyRate, 0) |
| | | err := db.Find(&records).Error |
| | | return records, err |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) SetId(id int) *TimelyRateSearch { |
| | | slf.Id = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) SetName(name string) *TimelyRateSearch { |
| | | slf.Name = name |
| | | return slf |
| | | } |
| | | |
| | | func (slf *TimelyRateSearch) Updates(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(data).Error |
| | | } |
| | |
| | | SatisfactionListErr = 4200003 // 获取满意度列表失败 |
| | | SatisfactionSetErr = 4200004 // 设置满意度失败 |
| | | SatisfactionUpdateErr = 4200005 // 更新满意度失败 |
| | | |
| | | TimelyRateExist = 4300001 // 及时率已存在 |
| | | TimelyRateNotExist = 4300002 // 及时率不存在 |
| | | TimelyRateListErr = 4300003 // 获取及时率列表失败 |
| | | TimelyRateSetErr = 4300004 // 设置及时率失败 |
| | | TimelyRateUpdateErr = 4300005 // 更新及时率失败 |
| | | |
| | | ) |
| | |
| | | DataRouter |
| | | DepartmentRouter |
| | | SatisfactionRouter |
| | | TimelyRateRouter |
| | | } |
| | | |
| | | func InitRouter() *gin.Engine { |
| | |
| | | routerGroup.InitDataRouter(PrivateGroup) // 注册data路由 |
| | | routerGroup.InitDepartmentRouter(PrivateGroup) // 注册department路由 |
| | | routerGroup.InitSatisfactionRouter(PrivateGroup) // 注册satisfaction路由 |
| | | routerGroup.InitTimelyRateRouter(PrivateGroup) // 注册timelyRate路由 |
| | | } |
| | | return Router |
| | | } |
New file |
| | |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type TimelyRateRouter struct{} |
| | | |
| | | func (s *TimelyRateRouter) InitTimelyRateRouter(router *gin.RouterGroup) { |
| | | timelyRateRouter := router.Group("timelyRate") |
| | | timelyRateApi := v1.ApiGroup.TimelyRateApi |
| | | { |
| | | timelyRateRouter.POST("add", timelyRateApi.Add) // 添加销售阶段 |
| | | timelyRateRouter.DELETE("delete/:id", timelyRateApi.Delete) // 删除销售阶段 |
| | | timelyRateRouter.PUT("update", timelyRateApi.Update) // 更新销售阶段 |
| | | timelyRateRouter.GET("list", timelyRateApi.List) // 获取销售阶段列表 |
| | | } |
| | | } |
| | |
| | | departmentList, _ := ServiceGroup.GetDepartmentList() |
| | | data.Department = departmentList |
| | | |
| | | // get Satisfaction list |
| | | satisfactionList, _ := ServiceGroup.GetSatisfactionList() |
| | | data.Satisfaction = satisfactionList |
| | | |
| | | // get TimelyRate list |
| | | timelyRateList, _ := ServiceGroup.GetTimelyRateList() |
| | | data.TimelyRate = timelyRateList |
| | | |
| | | errCode = ecode.OK |
| | | |
| | | return |
| | |
| | | DepartmentService |
| | | VettingService |
| | | SatisfactionService |
| | | TimelyRateService |
| | | } |
| | | |
| | | var ServiceGroup = new(Group) |
New file |
| | |
| | | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | | |
| | | type TimelyRateService struct{} |
| | | |
| | | func (TimelyRateService) AddTimelyRate(timelyRate *model.TimelyRate) int { |
| | | err := model.NewTimelyRateSearch().Create(timelyRate) |
| | | if err != nil { |
| | | return ecode.TimelyRateExist |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (TimelyRateService) DeleteTimelyRate(id int) int { |
| | | _, err := model.NewTimelyRateSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return ecode.TimelyRateNotExist |
| | | } |
| | | |
| | | err = model.NewTimelyRateSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.TimelyRateNotExist |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (TimelyRateService) GetTimelyRateList() ([]*model.TimelyRate, int) { |
| | | list, err := model.NewTimelyRateSearch().FindAll() |
| | | if err != nil { |
| | | return nil, ecode.TimelyRateListErr |
| | | } |
| | | |
| | | return list, ecode.OK |
| | | } |
| | | |
| | | func (TimelyRateService) UpdateTimelyRate(timelyRates []*request.UpdateTimelyRate) int { |
| | | for _, v := range timelyRates { |
| | | // check timelyRate exist |
| | | _, err := model.NewTimelyRateSearch().SetId(v.Id).Find() |
| | | if err != nil { |
| | | return ecode.TimelyRateNotExist |
| | | } |
| | | |
| | | err = model.NewTimelyRateSearch().SetId(v.Id).Updates(map[string]interface{}{ |
| | | "name": v.Name, |
| | | }) |
| | | if err != nil { |
| | | return ecode.TimelyRateSetErr |
| | | } |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (TimelyRateService) GetTimelyRateDetail(id int) (*model.TimelyRate, int) { |
| | | timelyRate, err := model.NewTimelyRateSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return nil, ecode.TimelyRateNotExist |
| | | } |
| | | |
| | | return timelyRate, ecode.OK |
| | | } |