add
CustomerServiceSheet 客户服务单
add, Delete, update, list
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 CustomerServiceSheetApi struct{} |
| | | |
| | | // Add |
| | | // |
| | | // @Tags CustomerServiceSheet |
| | | // @Summary 添加客服单 |
| | | // @Produce application/json |
| | | // @Param object body request.AddCustomerServiceSheet true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/customerServiceSheet/add [post] |
| | | func (s *CustomerServiceSheetApi) Add(c *gin.Context) { |
| | | var params request.AddCustomerServiceSheet |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode, customerServiceSheet := checkCustomerServiceSheetParams(params.CustomerServiceSheet) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | errCode = customerServiceSheetService.AddCustomerServiceSheet(&customerServiceSheet) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags CustomerServiceSheet |
| | | // @Summary 删除客服单 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/customerServiceSheet/delete/{id} [delete] |
| | | func (s *CustomerServiceSheetApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | errCode := customerServiceSheetService.DeleteCustomerServiceSheet(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags CustomerServiceSheet |
| | | // @Summary 更新客服单 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateCustomerServiceSheet true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/customerServiceSheet/update/{id} [put] |
| | | func (s *CustomerServiceSheetApi) Update(c *gin.Context) { |
| | | var params request.UpdateCustomerServiceSheet |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode, customerServiceSheet := checkCustomerServiceSheetParams(params.CustomerServiceSheet) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | errCode = customerServiceSheetService.UpdateCustomerServiceSheet(&customerServiceSheet) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags CustomerServiceSheet |
| | | // @Summary 获取客服单列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/customerServiceSheet/list [get] |
| | | func (s *CustomerServiceSheetApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | customerServiceSheetList, errCode := customerServiceSheetService.GetCustomerServiceSheetList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.CustomerServiceSheetResponse{ |
| | | List: customerServiceSheetList, |
| | | }) |
| | | } |
| | | |
| | | // checkCustomerServiceSheetParams |
| | | func checkCustomerServiceSheetParams(customerServiceSheet request.CustomerServiceSheet) (errCode int, newCustomerServiceSheet model.CustomerServiceSheet) { |
| | | if customerServiceSheet.Number == "" { |
| | | return ecode.InvalidParams, model.CustomerServiceSheet{} |
| | | } |
| | | |
| | | if customerServiceSheet.MemberId == 0 { |
| | | return ecode.InvalidParams, model.CustomerServiceSheet{} |
| | | } |
| | | |
| | | newCustomerServiceSheet = model.CustomerServiceSheet{ |
| | | Number: customerServiceSheet.Number, |
| | | MemberId: customerServiceSheet.MemberId, |
| | | ServiceMode: customerServiceSheet.ServiceMode, |
| | | Priority: customerServiceSheet.Priority, |
| | | HandleStatus: customerServiceSheet.HandleStatus, |
| | | } |
| | | return ecode.OK, newCustomerServiceSheet |
| | | } |
| | |
| | | ServiceContractApi |
| | | OrderManageApi |
| | | ServiceFollowupApi |
| | | CustomerServiceSheetApi |
| | | } |
| | | |
| | | var ApiGroup = new(Group) |
| | | |
| | | var ( |
| | | userService = service.ServiceGroup.UserService |
| | | jwtService = service.ServiceGroup.JwtService |
| | | countryService = service.ServiceGroup.CountryService |
| | | provinceService = service.ServiceGroup.ProvinceService |
| | | cityService = service.ServiceGroup.CityService |
| | | regionService = service.ServiceGroup.RegionService |
| | | contactService = service.ServiceGroup.ContactService |
| | | clientService = service.ServiceGroup.ClientService |
| | | clientStatusService = service.ServiceGroup.ClientStatusService |
| | | clientTypeService = service.ServiceGroup.ClientTypeService |
| | | clientOriginService = service.ServiceGroup.ClientOriginService |
| | | clientLevelService = service.ServiceGroup.ClientLevelService |
| | | industryService = service.ServiceGroup.IndustryService |
| | | enterpriseNatureService = service.ServiceGroup.EnterpriseNatureService |
| | | registeredCapitalService = service.ServiceGroup.RegisteredCapitalService |
| | | enterpriseScaleService = service.ServiceGroup.EnterpriseScaleService |
| | | salesLeadsService = service.ServiceGroup.SalesLeadsService |
| | | salesSourcesService = service.ServiceGroup.SalesSourcesService |
| | | followRecordService = service.ServiceGroup.FollowRecordService |
| | | saleChanceService = service.ServiceGroup.SaleChanceService |
| | | saleStageService = service.ServiceGroup.SaleStageService |
| | | saleTypeService = service.ServiceGroup.SaleTypeService |
| | | regularCustomersService = service.ServiceGroup.RegularCustomersService |
| | | possibilityService = service.ServiceGroup.PossibilityService |
| | | statusService = service.ServiceGroup.StatusService |
| | | quotationService = service.ServiceGroup.QuotationService |
| | | masterOrderService = service.ServiceGroup.MasterOrderService |
| | | subOrderService = service.ServiceGroup.SubOrderService |
| | | salesDetailsService = service.ServiceGroup.SalesDetailsService |
| | | salesReturnService = service.ServiceGroup.SalesReturnService |
| | | salesRefundService = service.ServiceGroup.SalesRefundService |
| | | contractService = service.ServiceGroup.ContractService |
| | | planService = service.ServiceGroup.PlanService |
| | | serviceContractService = service.ServiceGroup.SContractService |
| | | orderManageService = service.ServiceGroup.OrderManageService |
| | | serviceFollowupService = service.ServiceGroup.FollowupService |
| | | userService = service.ServiceGroup.UserService |
| | | jwtService = service.ServiceGroup.JwtService |
| | | countryService = service.ServiceGroup.CountryService |
| | | provinceService = service.ServiceGroup.ProvinceService |
| | | cityService = service.ServiceGroup.CityService |
| | | regionService = service.ServiceGroup.RegionService |
| | | contactService = service.ServiceGroup.ContactService |
| | | clientService = service.ServiceGroup.ClientService |
| | | clientStatusService = service.ServiceGroup.ClientStatusService |
| | | clientTypeService = service.ServiceGroup.ClientTypeService |
| | | clientOriginService = service.ServiceGroup.ClientOriginService |
| | | clientLevelService = service.ServiceGroup.ClientLevelService |
| | | industryService = service.ServiceGroup.IndustryService |
| | | enterpriseNatureService = service.ServiceGroup.EnterpriseNatureService |
| | | registeredCapitalService = service.ServiceGroup.RegisteredCapitalService |
| | | enterpriseScaleService = service.ServiceGroup.EnterpriseScaleService |
| | | salesLeadsService = service.ServiceGroup.SalesLeadsService |
| | | salesSourcesService = service.ServiceGroup.SalesSourcesService |
| | | followRecordService = service.ServiceGroup.FollowRecordService |
| | | saleChanceService = service.ServiceGroup.SaleChanceService |
| | | saleStageService = service.ServiceGroup.SaleStageService |
| | | saleTypeService = service.ServiceGroup.SaleTypeService |
| | | regularCustomersService = service.ServiceGroup.RegularCustomersService |
| | | possibilityService = service.ServiceGroup.PossibilityService |
| | | statusService = service.ServiceGroup.StatusService |
| | | quotationService = service.ServiceGroup.QuotationService |
| | | masterOrderService = service.ServiceGroup.MasterOrderService |
| | | subOrderService = service.ServiceGroup.SubOrderService |
| | | salesDetailsService = service.ServiceGroup.SalesDetailsService |
| | | salesReturnService = service.ServiceGroup.SalesReturnService |
| | | salesRefundService = service.ServiceGroup.SalesRefundService |
| | | contractService = service.ServiceGroup.ContractService |
| | | planService = service.ServiceGroup.PlanService |
| | | serviceContractService = service.ServiceGroup.SContractService |
| | | orderManageService = service.ServiceGroup.OrderManageService |
| | | serviceFollowupService = service.ServiceGroup.FollowupService |
| | | customerServiceSheetService = service.ServiceGroup.CustomerServiceSheetService |
| | | ) |
| | |
| | | // @Tags ServiceFollowup |
| | | // @Summary 更新服务跟进 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateServiceFollowup true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Param object body request.UpdateServiceFollowup true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceFollowup/update [put] |
| | | func (s *ServiceFollowupApi) Update(c *gin.Context) { |
| | | var params request.UpdateServiceFollowup |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "添加客服单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddCustomerServiceSheet" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "删除客服单", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "获取客服单列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/update/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "更新客服单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCustomerServiceSheet" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/enterpriseNature/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddCustomerServiceSheet": { |
| | | "type": "object", |
| | | "properties": { |
| | | "handleStatus": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "priority": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceMode": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddEnterpriseNature": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCustomerServiceSheet": { |
| | | "type": "object", |
| | | "properties": { |
| | | "handleStatus": { |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "priority": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceMode": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateEnterpriseNature": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "添加客服单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddCustomerServiceSheet" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "删除客服单", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "获取客服单列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/customerServiceSheet/update/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CustomerServiceSheet" |
| | | ], |
| | | "summary": "更新客服单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCustomerServiceSheet" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/enterpriseNature/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddCustomerServiceSheet": { |
| | | "type": "object", |
| | | "properties": { |
| | | "handleStatus": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "priority": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceMode": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddEnterpriseNature": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCustomerServiceSheet": { |
| | | "type": "object", |
| | | "properties": { |
| | | "handleStatus": { |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "priority": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceMode": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateEnterpriseNature": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | description: 国家名称 |
| | | type: string |
| | | type: object |
| | | request.AddCustomerServiceSheet: |
| | | properties: |
| | | handleStatus: |
| | | type: integer |
| | | memberId: |
| | | type: integer |
| | | number: |
| | | type: string |
| | | priority: |
| | | type: integer |
| | | serviceMode: |
| | | type: integer |
| | | type: object |
| | | request.AddEnterpriseNature: |
| | | properties: |
| | | name: |
| | |
| | | name: |
| | | description: 国家名称 |
| | | type: string |
| | | type: object |
| | | request.UpdateCustomerServiceSheet: |
| | | properties: |
| | | handleStatus: |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | memberId: |
| | | type: integer |
| | | number: |
| | | type: string |
| | | priority: |
| | | type: integer |
| | | serviceMode: |
| | | type: integer |
| | | type: object |
| | | request.UpdateEnterpriseNature: |
| | | properties: |
| | |
| | | summary: 更新国家 |
| | | tags: |
| | | - Country |
| | | /api/customerServiceSheet/add: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddCustomerServiceSheet' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加客服单 |
| | | tags: |
| | | - CustomerServiceSheet |
| | | /api/customerServiceSheet/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: |
| | | - CustomerServiceSheet |
| | | /api/customerServiceSheet/list: |
| | | get: |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 获取客服单列表 |
| | | tags: |
| | | - CustomerServiceSheet |
| | | /api/customerServiceSheet/update/{id}: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateCustomerServiceSheet' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新客服单 |
| | | tags: |
| | | - CustomerServiceSheet |
| | | /api/enterpriseNature/add: |
| | | post: |
| | | parameters: |
| | |
| | | [2023-07-13 10:55:49] [error] [aps_crm/model.(*ServiceContractSearch).FindAll:80] trace {"error": ": unsupported relations for schema ServiceContract", "elapsed": 0.001442, "rows": 2, "sql": "SELECT * FROM `service_contract`"} |
| | | [2023-07-13 10:57:45] [error] [aps_crm/model.(*ServiceContractSearch).FindAll:80] trace {"error": ": unsupported relations for schema ServiceContract", "elapsed": 0.0011591, "rows": 2, "sql": "SELECT * FROM `service_contract`"} |
| | | [2023-07-13 14:11:03] [error] [aps_crm/model.(*ServiceFollowupSearch).Create:53] trace {"error": "Error 1146 (42S02): Table 'aps_crm.service_followup' doesn't exist", "elapsed": 0.0024191, "rows": 0, "sql": "INSERT INTO `service_followup` (`client_id`,`number`,`contact_id`,`service_id`,`member_id`,`plan_id`,`satisfaction`,`timely_rate`,`solve_rate`,`is_visit`,`old_member_id`,`remark`,`file`) VALUES (0,'HF21',0,0,110,0,0,0,0,0,0,'string','string')"} |
| | | [2023-07-13 15:00:16] [error] [aps_crm/model.(*CustomerServiceSheetSearch).Create:46] trace {"error": "Error 1146 (42S02): Table 'aps_crm.customer_service_sheet' doesn't exist", "elapsed": 0.0020622, "rows": 0, "sql": "INSERT INTO `customer_service_sheet` (`member_id`,`number`,`service_mode`,`priority`,`handle_status`,`created_at`,`updated_at`,`deleted_at`) VALUES (110,'HF30',0,0,0,'2023-07-13 15:00:16.507','2023-07-13 15:00:16.507',NULL)"} |
| | |
| | | package model |
| | | |
| | | import "gorm.io/gorm" |
| | | import ( |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | CustomerServiceSheet struct { |
| | |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (CustomerServiceSheet) TableName() string { |
| | | return "customer_service_sheet" |
| | | } |
| | | |
| | | func NewCustomerServiceSheetSearch() *CustomerServiceSheetSearch { |
| | | return &CustomerServiceSheetSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) build() *gorm.DB { |
| | | var db = css.Orm.Model(&CustomerServiceSheet{}) |
| | | if css.Id != 0 { |
| | | db = db.Where("id = ?", css.Id) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Create(record *CustomerServiceSheet) error { |
| | | var db = css.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Update(record *CustomerServiceSheet) error { |
| | | var db = css.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Delete() error { |
| | | var db = css.build() |
| | | return db.Delete(&CustomerServiceSheet{}).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Find() (*CustomerServiceSheet, error) { |
| | | var db = css.build() |
| | | var record = &CustomerServiceSheet{} |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) FindAll() ([]*CustomerServiceSheet, error) { |
| | | var db = css.build() |
| | | var records = make([]*CustomerServiceSheet, 0) |
| | | err := db.Find(&records).Error |
| | | return records, err |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) SetId(id int) *CustomerServiceSheetSearch { |
| | | css.Id = id |
| | | return css |
| | | } |
| | |
| | | ServiceContract{}, |
| | | OrderManage{}, |
| | | ServiceFollowup{}, |
| | | CustomerServiceSheet{}, |
| | | ) |
| | | return err |
| | | } |
New file |
| | |
| | | package request |
| | | |
| | | type AddCustomerServiceSheet struct { |
| | | CustomerServiceSheet |
| | | } |
| | | |
| | | type CustomerServiceSheet struct { |
| | | MemberId int `json:"memberId"` |
| | | Number string `json:"number"` |
| | | ServiceMode int `json:"serviceMode"` |
| | | Priority int `json:"priority"` |
| | | HandleStatus int `json:"handleStatus"` |
| | | } |
| | | |
| | | type UpdateCustomerServiceSheet struct { |
| | | Id int `json:"id"` |
| | | CustomerServiceSheet |
| | | } |
| | |
| | | ServiceFollowupResponse struct { |
| | | List []*model.ServiceFollowup `json:"list"` |
| | | } |
| | | |
| | | CustomerServiceSheetResponse struct { |
| | | List []*model.CustomerServiceSheet `json:"list"` |
| | | } |
| | | ) |
| | |
| | | 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:附件"` |
| | | gorm.Model `json:"-"` |
| | | |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
| | | ServiceFollowupSearch struct { |
| | |
| | | ServiceFollowupSetErr = 3500004 // 设置服务跟进失败 |
| | | ServiceFollowupUpdateErr = 3500005 // 更新服务跟进失败 |
| | | ServiceFollowupDeleteErr = 3500006 // 删除服务跟进失败 |
| | | |
| | | CustomerServiceSheetExist = 3600001 // 客服单已存在 |
| | | CustomerServiceSheetNotExist = 3600002 // 客服单不存在 |
| | | CustomerServiceSheetListErr = 3600003 // 获取客服单列表失败 |
| | | CustomerServiceSheetSetErr = 3600004 // 设置客服单失败 |
| | | CustomerServiceSheetUpdateErr = 3600005 // 更新客服单失败 |
| | | CustomerServiceSheetDeleteErr = 3600006 // 删除客服单失败 |
| | | ) |
New file |
| | |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type CustomerServiceSheetRouter struct{} |
| | | |
| | | func (c *CustomerServiceSheetRouter) InitCustomerServiceSheetRouter(router *gin.RouterGroup) { |
| | | customerServiceSheetRouter := router.Group("customerServiceSheet") |
| | | customerServiceSheetApi := v1.ApiGroup.CustomerServiceSheetApi |
| | | { |
| | | customerServiceSheetRouter.POST("add", customerServiceSheetApi.Add) // 添加客服单 |
| | | customerServiceSheetRouter.DELETE("delete/:id", customerServiceSheetApi.Delete) // 删除客服单 |
| | | customerServiceSheetRouter.PUT("update", customerServiceSheetApi.Update) // 更新客服单 |
| | | customerServiceSheetRouter.GET("list", customerServiceSheetApi.List) // 获取客服单列表 |
| | | } |
| | | } |
| | |
| | | ServiceContractRouter |
| | | OrderManageRouter |
| | | ServiceFollowupRouter |
| | | CustomerServiceSheetRouter |
| | | } |
| | | |
| | | func InitRouter() *gin.Engine { |
| | |
| | | PrivateGroup := Router.Group("api") |
| | | //PrivateGroup.Use(middleware.JWTAuth()) |
| | | { |
| | | routerGroup.InitJwtRouter(PrivateGroup) // jwt相关路由 |
| | | routerGroup.InitUserRouter(PrivateGroup) // 注册用户路由 |
| | | routerGroup.InitCountryRouter(PrivateGroup) // 注册country路由 |
| | | routerGroup.InitProvinceRouter(PrivateGroup) // 注册province路由 |
| | | routerGroup.InitCityRouter(PrivateGroup) // 注册city路由 |
| | | routerGroup.InitRegionRouter(PrivateGroup) // 注册region路由 |
| | | routerGroup.InitContactRouter(PrivateGroup) // 注册contact路由 |
| | | routerGroup.InitClientRouter(PrivateGroup) // 注册client路由 |
| | | routerGroup.InitClientStatusRouter(PrivateGroup) // 注册clientStatus路由 |
| | | routerGroup.InitClientTypeRouter(PrivateGroup) // 注册clientType路由 |
| | | routerGroup.InitClientOriginRouter(PrivateGroup) // 注册clientOrigin路由 |
| | | routerGroup.InitClientLevelRouter(PrivateGroup) // 注册clientLevel路由 |
| | | routerGroup.InitIndustryRouter(PrivateGroup) // 注册industry路由 |
| | | routerGroup.InitEnterpriseNatureRouter(PrivateGroup) // 注册enterpriseNature路由 |
| | | routerGroup.InitRegisteredCapitalRouter(PrivateGroup) // 注册registeredCapital路由 |
| | | routerGroup.InitEnterpriseScaleRouter(PrivateGroup) // 注册enterpriseScale路由 |
| | | routerGroup.InitSalesLeadsRouter(PrivateGroup) // 注册salesLeads路由 |
| | | routerGroup.InitSalesSourcesRouter(PrivateGroup) // 注册salesSources路由 |
| | | routerGroup.InitFollowRecordRouter(PrivateGroup) // 注册followRecord路由 |
| | | routerGroup.InitSaleChanceRouter(PrivateGroup) // 注册saleChance路由 |
| | | routerGroup.InitSaleStageRouter(PrivateGroup) // 注册saleStage路由 |
| | | routerGroup.InitSaleTypeRouter(PrivateGroup) // 注册saleType路由 |
| | | routerGroup.InitRegularCustomersRouter(PrivateGroup) // 注册regularCustomers路由 |
| | | routerGroup.InitPossibilityRouter(PrivateGroup) // 注册possibility路由 |
| | | routerGroup.InitStatusRouter(PrivateGroup) // 注册status路由 |
| | | routerGroup.InitQuotationRouter(PrivateGroup) // 注册quotation路由 |
| | | routerGroup.InitMasterOrderRouter(PrivateGroup) // 注册masterOrder路由 |
| | | routerGroup.InitSubOrderRouter(PrivateGroup) // 注册subOrder路由 |
| | | routerGroup.InitSalesDetailsRouter(PrivateGroup) // 注册salesDetails路由 |
| | | routerGroup.InitSalesReturnRouter(PrivateGroup) // 注册salesReturn路由 |
| | | routerGroup.InitSalesRefundRouter(PrivateGroup) // 注册salesRefund路由 |
| | | routerGroup.InitContractRouter(PrivateGroup) // 注册contract路由 |
| | | routerGroup.InitPlanRouter(PrivateGroup) // 注册plan路由 |
| | | routerGroup.InitServiceContractRouter(PrivateGroup) // 注册serviceContract路由 |
| | | routerGroup.InitOrderManageRouter(PrivateGroup) // 注册orderManage路由 |
| | | routerGroup.InitServiceFollowupRouter(PrivateGroup) // 注册serviceFollowup路由 |
| | | routerGroup.InitJwtRouter(PrivateGroup) // jwt相关路由 |
| | | routerGroup.InitUserRouter(PrivateGroup) // 注册用户路由 |
| | | routerGroup.InitCountryRouter(PrivateGroup) // 注册country路由 |
| | | routerGroup.InitProvinceRouter(PrivateGroup) // 注册province路由 |
| | | routerGroup.InitCityRouter(PrivateGroup) // 注册city路由 |
| | | routerGroup.InitRegionRouter(PrivateGroup) // 注册region路由 |
| | | routerGroup.InitContactRouter(PrivateGroup) // 注册contact路由 |
| | | routerGroup.InitClientRouter(PrivateGroup) // 注册client路由 |
| | | routerGroup.InitClientStatusRouter(PrivateGroup) // 注册clientStatus路由 |
| | | routerGroup.InitClientTypeRouter(PrivateGroup) // 注册clientType路由 |
| | | routerGroup.InitClientOriginRouter(PrivateGroup) // 注册clientOrigin路由 |
| | | routerGroup.InitClientLevelRouter(PrivateGroup) // 注册clientLevel路由 |
| | | routerGroup.InitIndustryRouter(PrivateGroup) // 注册industry路由 |
| | | routerGroup.InitEnterpriseNatureRouter(PrivateGroup) // 注册enterpriseNature路由 |
| | | routerGroup.InitRegisteredCapitalRouter(PrivateGroup) // 注册registeredCapital路由 |
| | | routerGroup.InitEnterpriseScaleRouter(PrivateGroup) // 注册enterpriseScale路由 |
| | | routerGroup.InitSalesLeadsRouter(PrivateGroup) // 注册salesLeads路由 |
| | | routerGroup.InitSalesSourcesRouter(PrivateGroup) // 注册salesSources路由 |
| | | routerGroup.InitFollowRecordRouter(PrivateGroup) // 注册followRecord路由 |
| | | routerGroup.InitSaleChanceRouter(PrivateGroup) // 注册saleChance路由 |
| | | routerGroup.InitSaleStageRouter(PrivateGroup) // 注册saleStage路由 |
| | | routerGroup.InitSaleTypeRouter(PrivateGroup) // 注册saleType路由 |
| | | routerGroup.InitRegularCustomersRouter(PrivateGroup) // 注册regularCustomers路由 |
| | | routerGroup.InitPossibilityRouter(PrivateGroup) // 注册possibility路由 |
| | | routerGroup.InitStatusRouter(PrivateGroup) // 注册status路由 |
| | | routerGroup.InitQuotationRouter(PrivateGroup) // 注册quotation路由 |
| | | routerGroup.InitMasterOrderRouter(PrivateGroup) // 注册masterOrder路由 |
| | | routerGroup.InitSubOrderRouter(PrivateGroup) // 注册subOrder路由 |
| | | routerGroup.InitSalesDetailsRouter(PrivateGroup) // 注册salesDetails路由 |
| | | routerGroup.InitSalesReturnRouter(PrivateGroup) // 注册salesReturn路由 |
| | | routerGroup.InitSalesRefundRouter(PrivateGroup) // 注册salesRefund路由 |
| | | routerGroup.InitContractRouter(PrivateGroup) // 注册contract路由 |
| | | routerGroup.InitPlanRouter(PrivateGroup) // 注册plan路由 |
| | | routerGroup.InitServiceContractRouter(PrivateGroup) // 注册serviceContract路由 |
| | | routerGroup.InitOrderManageRouter(PrivateGroup) // 注册orderManage路由 |
| | | routerGroup.InitServiceFollowupRouter(PrivateGroup) // 注册serviceFollowup路由 |
| | | routerGroup.InitCustomerServiceSheetRouter(PrivateGroup) // 注册customerServiceSheet路由 |
| | | } |
| | | return Router |
| | | } |
New file |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | | |
| | | type CustomerServiceSheetService struct{} |
| | | |
| | | func (CustomerServiceSheetService) AddCustomerServiceSheet(customerServiceSheet *model.CustomerServiceSheet) int { |
| | | err := model.NewCustomerServiceSheetSearch().Create(customerServiceSheet) |
| | | if err != nil { |
| | | return ecode.CustomerServiceSheetExist |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CustomerServiceSheetService) DeleteCustomerServiceSheet(id int) int { |
| | | _, err := model.NewCustomerServiceSheetSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return ecode.CustomerServiceSheetNotExist |
| | | } |
| | | |
| | | err = model.NewCustomerServiceSheetSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.CustomerServiceSheetNotExist |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CustomerServiceSheetService) GetCustomerServiceSheetList() ([]*model.CustomerServiceSheet, int) { |
| | | list, err := model.NewCustomerServiceSheetSearch().FindAll() |
| | | if err != nil { |
| | | return nil, ecode.CustomerServiceSheetListErr |
| | | } |
| | | |
| | | return list, ecode.OK |
| | | } |
| | | |
| | | func (CustomerServiceSheetService) UpdateCustomerServiceSheet(customerServiceSheet *model.CustomerServiceSheet) int { |
| | | // check customerServiceSheet exist |
| | | _, err := model.NewCustomerServiceSheetSearch().SetId(customerServiceSheet.Id).Find() |
| | | if err != nil { |
| | | return ecode.CustomerServiceSheetNotExist |
| | | } |
| | | |
| | | err = model.NewCustomerServiceSheetSearch().SetId(customerServiceSheet.Id).Update(customerServiceSheet) |
| | | if err != nil { |
| | | return ecode.CustomerServiceSheetSetErr |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | |
| | | SContractService |
| | | OrderManageService |
| | | FollowupService |
| | | CustomerServiceSheetService |
| | | } |
| | | |
| | | var ServiceGroup = new(Group) |