From 6e8718ed56b53419c946102bb4e20a978e32e27c Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 13 七月 2023 15:13:10 +0800
Subject: [PATCH] add
---
api/v1/index.go | 74 ++--
pkg/ecode/code.go | 7
model/customerServiceSheet.go | 58 +++
docs/swagger.yaml | 96 ++++++
docs/docs.go | 150 ++++++++++
docs/swagger.json | 150 ++++++++++
model/response/response.go | 4
model/serviceFollowup.go | 3
api/v1/customerServiceSheet.go | 141 +++++++++
service/index.go | 1
model/index.go | 1
router/customerServiceSheet.go | 19 +
logs/aps-admin.err.log | 1
router/index.go | 74 ++--
api/v1/serviceFollowup.go | 4
model/request/customerServiceSheet.go | 18 +
service/customerServiceSheet.go | 54 +++
17 files changed, 779 insertions(+), 76 deletions(-)
diff --git a/api/v1/customerServiceSheet.go b/api/v1/customerServiceSheet.go
new file mode 100644
index 0000000..730f157
--- /dev/null
+++ b/api/v1/customerServiceSheet.go
@@ -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, ¶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
+}
diff --git a/api/v1/index.go b/api/v1/index.go
index 213ccca..a79e9fd 100644
--- a/api/v1/index.go
+++ b/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
)
diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go
index 65f8f53..c1a50fe 100644
--- a/api/v1/serviceFollowup.go
+++ b/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
diff --git a/docs/docs.go b/docs/docs.go
index 3a20450..efd3896 100644
--- a/docs/docs.go
+++ b/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": [
diff --git a/docs/swagger.json b/docs/swagger.json
index 2f66cb6..9ec5ed2 100644
--- a/docs/swagger.json
+++ b/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": [
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 4a14862..3f09b42 100644
--- a/docs/swagger.yaml
+++ b/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:
diff --git a/logs/aps-admin.err.log b/logs/aps-admin.err.log
index f595613..aba294a 100644
--- a/logs/aps-admin.err.log
+++ b/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)"}
diff --git a/model/customerServiceSheet.go b/model/customerServiceSheet.go
index 1fb8026..0a91f29 100644
--- a/model/customerServiceSheet.go
+++ b/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
+}
diff --git a/model/index.go b/model/index.go
index 15c1827..bedc358 100644
--- a/model/index.go
+++ b/model/index.go
@@ -58,6 +58,7 @@
ServiceContract{},
OrderManage{},
ServiceFollowup{},
+ CustomerServiceSheet{},
)
return err
}
diff --git a/model/request/customerServiceSheet.go b/model/request/customerServiceSheet.go
new file mode 100644
index 0000000..435fb06
--- /dev/null
+++ b/model/request/customerServiceSheet.go
@@ -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
+}
diff --git a/model/response/response.go b/model/response/response.go
index 9f09dab..0665063 100644
--- a/model/response/response.go
+++ b/model/response/response.go
@@ -165,4 +165,8 @@
ServiceFollowupResponse struct {
List []*model.ServiceFollowup `json:"list"`
}
+
+ CustomerServiceSheetResponse struct {
+ List []*model.CustomerServiceSheet `json:"list"`
+ }
)
diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index c44beea..86818d4 100644
--- a/model/serviceFollowup.go
+++ b/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 {
diff --git a/pkg/ecode/code.go b/pkg/ecode/code.go
index bb7640a..a62d3a9 100644
--- a/pkg/ecode/code.go
+++ b/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 // 鍒犻櫎瀹㈡湇鍗曞け璐�
)
diff --git a/router/customerServiceSheet.go b/router/customerServiceSheet.go
new file mode 100644
index 0000000..b1c369b
--- /dev/null
+++ b/router/customerServiceSheet.go
@@ -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) // 鑾峰彇瀹㈡湇鍗曞垪琛�
+ }
+}
diff --git a/router/index.go b/router/index.go
index 3fba11a..f0fe7b7 100644
--- a/router/index.go
+++ b/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
}
diff --git a/service/customerServiceSheet.go b/service/customerServiceSheet.go
new file mode 100644
index 0000000..000f345
--- /dev/null
+++ b/service/customerServiceSheet.go
@@ -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
+}
diff --git a/service/index.go b/service/index.go
index ccfcca8..4c2e03e 100644
--- a/service/index.go
+++ b/service/index.go
@@ -37,6 +37,7 @@
SContractService
OrderManageService
FollowupService
+ CustomerServiceSheetService
}
var ServiceGroup = new(Group)
--
Gitblit v1.8.0