add
wangpengfei
2023-07-13 6e8718ed56b53419c946102bb4e20a978e32e27c
add

CustomerServiceSheet 客户服务单
add, Delete, update, list
4个文件已添加
13个文件已修改
855 ■■■■■ 已修改文件
api/v1/customerServiceSheet.go 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/index.go 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceFollowup.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
logs/aps-admin.err.log 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/customerServiceSheet.go 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/index.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/customerServiceSheet.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/response/response.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceFollowup.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pkg/ecode/code.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/customerServiceSheet.go 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/index.go 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/customerServiceSheet.go 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/index.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/customerServiceSheet.go
New file
@@ -0,0 +1,141 @@
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, &params)
    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, &params)
    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
}
api/v1/index.go
@@ -42,45 +42,47 @@
    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
)
api/v1/serviceFollowup.go
@@ -71,8 +71,8 @@
//    @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
docs/docs.go
@@ -1192,6 +1192,113 @@
                }
            }
        },
        "/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": [
@@ -5929,6 +6036,26 @@
                }
            }
        },
        "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": [
@@ -7247,6 +7374,29 @@
                }
            }
        },
        "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": [
docs/swagger.json
@@ -1180,6 +1180,113 @@
                }
            }
        },
        "/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": [
@@ -5917,6 +6024,26 @@
                }
            }
        },
        "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": [
@@ -7235,6 +7362,29 @@
                }
            }
        },
        "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": [
docs/swagger.yaml
@@ -984,6 +984,19 @@
        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:
@@ -1876,6 +1889,21 @@
      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:
@@ -3357,6 +3385,74 @@
      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:
logs/aps-admin.err.log
@@ -349,3 +349,4 @@
[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)"}
model/customerServiceSheet.go
@@ -1,6 +1,9 @@
package model
import "gorm.io/gorm"
import (
    "aps_crm/pkg/mysqlx"
    "gorm.io/gorm"
)
type (
    CustomerServiceSheet struct {
@@ -18,3 +21,56 @@
        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
}
model/index.go
@@ -58,6 +58,7 @@
        ServiceContract{},
        OrderManage{},
        ServiceFollowup{},
        CustomerServiceSheet{},
    )
    return err
}
model/request/customerServiceSheet.go
New file
@@ -0,0 +1,18 @@
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
}
model/response/response.go
@@ -165,4 +165,8 @@
    ServiceFollowupResponse struct {
        List []*model.ServiceFollowup `json:"list"`
    }
    CustomerServiceSheetResponse struct {
        List []*model.CustomerServiceSheet `json:"list"`
    }
)
model/serviceFollowup.go
@@ -21,7 +21,8 @@
        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 {
pkg/ecode/code.go
@@ -253,4 +253,11 @@
    ServiceFollowupSetErr    = 3500004 // 设置服务跟进失败
    ServiceFollowupUpdateErr = 3500005 // 更新服务跟进失败
    ServiceFollowupDeleteErr = 3500006 // 删除服务跟进失败
    CustomerServiceSheetExist     = 3600001 // 客服单已存在
    CustomerServiceSheetNotExist  = 3600002 // 客服单不存在
    CustomerServiceSheetListErr   = 3600003 // 获取客服单列表失败
    CustomerServiceSheetSetErr    = 3600004 // 设置客服单失败
    CustomerServiceSheetUpdateErr = 3600005 // 更新客服单失败
    CustomerServiceSheetDeleteErr = 3600006 // 删除客服单失败
)
router/customerServiceSheet.go
New file
@@ -0,0 +1,19 @@
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)            // 获取客服单列表
    }
}
router/index.go
@@ -48,6 +48,7 @@
    ServiceContractRouter
    OrderManageRouter
    ServiceFollowupRouter
    CustomerServiceSheetRouter
}
func InitRouter() *gin.Engine {
@@ -77,42 +78,43 @@
    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
}
service/customerServiceSheet.go
New file
@@ -0,0 +1,54 @@
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
}
service/index.go
@@ -37,6 +37,7 @@
    SContractService
    OrderManageService
    FollowupService
    CustomerServiceSheetService
}
var ServiceGroup = new(Group)