From aab89dff18f597d4cdd10c73b9ad8c3c14d82d28 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 20 七月 2023 20:28:59 +0800
Subject: [PATCH] add

---
 api/v1/index.go             |    2 
 model/request/timelyRate.go |   15 +
 model/timelyRate.go         |   85 +++++
 api/v1/satisfaction.go      |   14 
 service/dataServer.go       |    8 
 service/timelyRate.go       |   69 ++++
 pkg/ecode/code.go           |    7 
 docs/swagger.yaml           |  122 ++++++++
 docs/docs.go                |  192 ++++++++++++
 docs/swagger.json           |  192 ++++++++++++
 model/response/response.go  |   16 +
 model/serviceFollowup.go    |    4 
 api/v1/timelyRate.go        |  113 +++++++
 model/serviceFeeManage.go   |    2 
 service/index.go            |    1 
 model/index.go              |    1 
 router/index.go             |    2 
 api/v1/serviceFollowup.go   |   26 
 router/timelyRate.go        |   19 +
 19 files changed, 861 insertions(+), 29 deletions(-)

diff --git a/api/v1/index.go b/api/v1/index.go
index 94e421e..5866de6 100644
--- a/api/v1/index.go
+++ b/api/v1/index.go
@@ -50,6 +50,7 @@
 	DepartmentApi
 	VettingApi
 	SatisfactionApi
+	TimelyRateApi
 }
 
 var ApiGroup = new(Group)
@@ -100,4 +101,5 @@
 	departmentService           = service.ServiceGroup.DepartmentService
 	vettingService              = service.ServiceGroup.VettingService
 	satisfactionService         = service.ServiceGroup.SatisfactionService
+	timelyRateService           = service.ServiceGroup.TimelyRateService
 )
diff --git a/api/v1/satisfaction.go b/api/v1/satisfaction.go
index 5f96bfc..b6d49ec 100644
--- a/api/v1/satisfaction.go
+++ b/api/v1/satisfaction.go
@@ -68,8 +68,8 @@
 //	@Tags		Satisfaction
 //	@Summary	鏇存柊婊℃剰搴�
 //	@Produce	application/json
-//	@Param		object	body		request.UpdateSatisfactions true	"鏌ヨ鍙傛暟"
-//	@Success	200	{object}	contextx.Response{}
+//	@Param		object	body		request.UpdateSatisfactions	true	"鏌ヨ鍙傛暟"
+//	@Success	200		{object}	contextx.Response{}
 //	@Router		/api/satisfaction/update [put]
 func (s *SatisfactionApi) Update(c *gin.Context) {
 	var params request.UpdateSatisfactions
@@ -89,11 +89,11 @@
 
 // List
 //
-//		@Tags		Satisfaction
-//		@Summary	婊℃剰搴﹀垪琛�
-//		@Produce	application/json
-//	 @Success	200	{object}	contextx.Response{data=response.SatisfactionResponse}
-//		@Router		/api/satisfaction/list [get]
+//	@Tags		Satisfaction
+//	@Summary	婊℃剰搴﹀垪琛�
+//	@Produce	application/json
+//	@Success	200	{object}	contextx.Response{data=response.SatisfactionResponse}
+//	@Router		/api/satisfaction/list [get]
 func (s *SatisfactionApi) List(c *gin.Context) {
 	ctx, ok := contextx.NewContext(c, nil)
 	if !ok {
diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go
index d39f3b5..2157325 100644
--- a/api/v1/serviceFollowup.go
+++ b/api/v1/serviceFollowup.go
@@ -133,19 +133,19 @@
 	//}
 
 	serviceFollowupModel = model.ServiceFollowup{
-		ClientId:     serviceFollowup.ClientId,
-		Number:       serviceFollowup.Number,
-		ContactId:    serviceFollowup.ContactId,
-		ServiceId:    serviceFollowup.ServiceId,
-		MemberId:     serviceFollowup.MemberId,
-		PlanId:       serviceFollowup.PlanId,
-		Satisfaction: serviceFollowup.Satisfaction,
-		TimelyRate:   serviceFollowup.TimelyRate,
-		SolveRate:    serviceFollowup.SolveRate,
-		IsVisit:      serviceFollowup.IsVisit,
-		OldMemberId:  serviceFollowup.OldMemberId,
-		Remark:       serviceFollowup.Remark,
-		File:         serviceFollowup.File,
+		ClientId:       serviceFollowup.ClientId,
+		Number:         serviceFollowup.Number,
+		ContactId:      serviceFollowup.ContactId,
+		ServiceId:      serviceFollowup.ServiceId,
+		MemberId:       serviceFollowup.MemberId,
+		PlanId:         serviceFollowup.PlanId,
+		SatisfactionId: serviceFollowup.Satisfaction,
+		TimelyRateId:   serviceFollowup.TimelyRate,
+		SolveRate:      serviceFollowup.SolveRate,
+		IsVisit:        serviceFollowup.IsVisit,
+		OldMemberId:    serviceFollowup.OldMemberId,
+		Remark:         serviceFollowup.Remark,
+		File:           serviceFollowup.File,
 	}
 
 	return ecode.OK, serviceFollowupModel
diff --git a/api/v1/timelyRate.go b/api/v1/timelyRate.go
new file mode 100644
index 0000000..5206b77
--- /dev/null
+++ b/api/v1/timelyRate.go
@@ -0,0 +1,113 @@
+
+package v1
+
+import (
+	"aps_crm/model"
+	"aps_crm/model/request"
+	"aps_crm/model/response"
+	"aps_crm/pkg/contextx"
+	"aps_crm/pkg/ecode"
+	"github.com/gin-gonic/gin"
+	"strconv"
+)
+
+type TimelyRateApi struct{}
+
+// Add
+//
+//	@Tags		TimelyRate
+//	@Summary	娣诲姞閿�鍞樁娈�
+//	@Produce	application/json
+//	@Param		object	body		request.AddTimelyRate	true	"鏌ヨ鍙傛暟"
+//	@Success	200		{object}	contextx.Response{}
+//	@Router		/api/timelyRate/add [post]
+func (s *TimelyRateApi) Add(c *gin.Context) {
+	var params request.AddTimelyRate
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		return
+	}
+
+	timelyRate := new(model.TimelyRate)
+	timelyRate.Name = params.Name
+
+	errCode := timelyRateService.AddTimelyRate(timelyRate)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.Ok()
+}
+
+// Delete
+//
+//	@Tags		TimelyRate
+//	@Summary	鍒犻櫎閿�鍞樁娈�
+//	@Produce	application/json
+//	@Param		id	path		int	true	"鏌ヨ鍙傛暟"
+//	@Success	200	{object}	contextx.Response{}
+//	@Router		/api/timelyRate/delete/{id} [delete]
+func (s *TimelyRateApi) Delete(c *gin.Context) {
+	ctx, ok := contextx.NewContext(c, nil)
+	if !ok {
+		return
+	}
+
+	id, _ := strconv.Atoi(c.Param("id"))
+	errCode := timelyRateService.DeleteTimelyRate(id)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.Ok()
+}
+
+// Update
+//
+//	@Tags		TimelyRate
+//	@Summary	鏇存柊閿�鍞樁娈�
+//	@Produce	application/json
+//	@Param		object	body		request.UpdateTimelyRates	true	"鏌ヨ鍙傛暟"
+//	@Success	200		{object}	contextx.Response{}
+//	@Router		/api/timelyRate/update [put]
+func (s *TimelyRateApi) Update(c *gin.Context) {
+	var params request.UpdateTimelyRates
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		return
+	}
+
+	errCode := timelyRateService.UpdateTimelyRate(params.TimelyRates)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.Ok()
+}
+
+// List
+//
+//	@Tags		TimelyRate
+//	@Summary	鑾峰彇閿�鍞樁娈靛垪琛�
+//	@Produce	application/json
+//	@Success	200	{object}	contextx.Response{data=response.TimelyRateResponse}
+//	@Router		/api/timelyRate/list [get]
+func (s *TimelyRateApi) List(c *gin.Context) {
+	ctx, ok := contextx.NewContext(c, nil)
+	if !ok {
+		return
+	}
+
+	timelyRates, errCode := timelyRateService.GetTimelyRateList()
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.OkWithDetailed(response.TimelyRateResponse{
+		List: timelyRates,
+	})
+}
diff --git a/docs/docs.go b/docs/docs.go
index 6d6eace..eeb01be 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -4864,6 +4864,125 @@
                 }
             }
         },
+        "/api/timelyRate/add": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "娣诲姞閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.AddTimelyRate"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/delete/{id}": {
+            "delete": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鍒犻櫎閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/list": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鑾峰彇閿�鍞樁娈靛垪琛�",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/contextx.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/response.TimelyRateResponse"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/update": {
+            "put": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鏇存柊閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.UpdateTimelyRates"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api/user/changePassword": {
             "post": {
                 "produces": [
@@ -6461,7 +6580,7 @@
                 "remark": {
                     "type": "string"
                 },
-                "satisfaction": {
+                "satisfactionId": {
                     "type": "integer"
                 },
                 "serviceId": {
@@ -6470,7 +6589,7 @@
                 "solveRate": {
                     "type": "integer"
                 },
-                "timelyRate": {
+                "timelyRateId": {
                     "type": "integer"
                 }
             }
@@ -6501,6 +6620,17 @@
                     "items": {
                         "$ref": "#/definitions/model.Product"
                     }
+                }
+            }
+        },
+        "model.TimelyRate": {
+            "type": "object",
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
                 }
             }
         },
@@ -7484,6 +7614,17 @@
                     "items": {
                         "$ref": "#/definitions/model.Product"
                     }
+                }
+            }
+        },
+        "request.AddTimelyRate": {
+            "type": "object",
+            "required": [
+                "name"
+            ],
+            "properties": {
+                "name": {
+                    "type": "string"
                 }
             }
         },
@@ -9300,6 +9441,35 @@
                 }
             }
         },
+        "request.UpdateTimelyRate": {
+            "type": "object",
+            "required": [
+                "id",
+                "name"
+            ],
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
+                }
+            }
+        },
+        "request.UpdateTimelyRates": {
+            "type": "object",
+            "required": [
+                "timely_rate"
+            ],
+            "properties": {
+                "timely_rate": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/request.UpdateTimelyRate"
+                    }
+                }
+            }
+        },
         "response.CityResponse": {
             "type": "object",
             "properties": {
@@ -9526,6 +9696,13 @@
                     "type": "array",
                     "items": {
                         "$ref": "#/definitions/model.SalesSources"
+                    }
+                },
+                "satisfaction": {
+                    "description": "婊℃剰搴�",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.Satisfaction"
                     }
                 }
             }
@@ -9845,6 +10022,17 @@
                 }
             }
         },
+        "response.TimelyRateResponse": {
+            "type": "object",
+            "properties": {
+                "list": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.TimelyRate"
+                    }
+                }
+            }
+        },
         "response.UserResponse": {
             "type": "object",
             "properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 4fb2c34..fc1e881 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -4852,6 +4852,125 @@
                 }
             }
         },
+        "/api/timelyRate/add": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "娣诲姞閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.AddTimelyRate"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/delete/{id}": {
+            "delete": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鍒犻櫎閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/list": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鑾峰彇閿�鍞樁娈靛垪琛�",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/contextx.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/response.TimelyRateResponse"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api/timelyRate/update": {
+            "put": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "TimelyRate"
+                ],
+                "summary": "鏇存柊閿�鍞樁娈�",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.UpdateTimelyRates"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api/user/changePassword": {
             "post": {
                 "produces": [
@@ -6449,7 +6568,7 @@
                 "remark": {
                     "type": "string"
                 },
-                "satisfaction": {
+                "satisfactionId": {
                     "type": "integer"
                 },
                 "serviceId": {
@@ -6458,7 +6577,7 @@
                 "solveRate": {
                     "type": "integer"
                 },
-                "timelyRate": {
+                "timelyRateId": {
                     "type": "integer"
                 }
             }
@@ -6489,6 +6608,17 @@
                     "items": {
                         "$ref": "#/definitions/model.Product"
                     }
+                }
+            }
+        },
+        "model.TimelyRate": {
+            "type": "object",
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
                 }
             }
         },
@@ -7472,6 +7602,17 @@
                     "items": {
                         "$ref": "#/definitions/model.Product"
                     }
+                }
+            }
+        },
+        "request.AddTimelyRate": {
+            "type": "object",
+            "required": [
+                "name"
+            ],
+            "properties": {
+                "name": {
+                    "type": "string"
                 }
             }
         },
@@ -9288,6 +9429,35 @@
                 }
             }
         },
+        "request.UpdateTimelyRate": {
+            "type": "object",
+            "required": [
+                "id",
+                "name"
+            ],
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
+                }
+            }
+        },
+        "request.UpdateTimelyRates": {
+            "type": "object",
+            "required": [
+                "timely_rate"
+            ],
+            "properties": {
+                "timely_rate": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/request.UpdateTimelyRate"
+                    }
+                }
+            }
+        },
         "response.CityResponse": {
             "type": "object",
             "properties": {
@@ -9514,6 +9684,13 @@
                     "type": "array",
                     "items": {
                         "$ref": "#/definitions/model.SalesSources"
+                    }
+                },
+                "satisfaction": {
+                    "description": "婊℃剰搴�",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.Satisfaction"
                     }
                 }
             }
@@ -9833,6 +10010,17 @@
                 }
             }
         },
+        "response.TimelyRateResponse": {
+            "type": "object",
+            "properties": {
+                "list": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.TimelyRate"
+                    }
+                }
+            }
+        },
         "response.UserResponse": {
             "type": "object",
             "properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 9eb98ef..9b02d7a 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -872,13 +872,13 @@
         type: integer
       remark:
         type: string
-      satisfaction:
+      satisfactionId:
         type: integer
       serviceId:
         type: integer
       solveRate:
         type: integer
-      timelyRate:
+      timelyRateId:
         type: integer
     type: object
   model.SubOrder:
@@ -899,6 +899,13 @@
         items:
           $ref: '#/definitions/model.Product'
         type: array
+    type: object
+  model.TimelyRate:
+    properties:
+      id:
+        type: integer
+      name:
+        type: string
     type: object
   model.User:
     properties:
@@ -1564,6 +1571,13 @@
         items:
           $ref: '#/definitions/model.Product'
         type: array
+    type: object
+  request.AddTimelyRate:
+    properties:
+      name:
+        type: string
+    required:
+    - name
     type: object
   request.AddVetting:
     properties:
@@ -2793,6 +2807,25 @@
           $ref: '#/definitions/model.Product'
         type: array
     type: object
+  request.UpdateTimelyRate:
+    properties:
+      id:
+        type: integer
+      name:
+        type: string
+    required:
+    - id
+    - name
+    type: object
+  request.UpdateTimelyRates:
+    properties:
+      timely_rate:
+        items:
+          $ref: '#/definitions/request.UpdateTimelyRate'
+        type: array
+    required:
+    - timely_rate
+    type: object
   response.CityResponse:
     properties:
       list:
@@ -2947,6 +2980,11 @@
         description: 鍟嗘満鏉ユ簮
         items:
           $ref: '#/definitions/model.SalesSources'
+        type: array
+      satisfaction:
+        description: 婊℃剰搴�
+        items:
+          $ref: '#/definitions/model.Satisfaction'
         type: array
     type: object
   response.DepartmentResponse:
@@ -3148,6 +3186,13 @@
       list:
         items:
           $ref: '#/definitions/model.SubOrder'
+        type: array
+    type: object
+  response.TimelyRateResponse:
+    properties:
+      list:
+        items:
+          $ref: '#/definitions/model.TimelyRate'
         type: array
     type: object
   response.UserResponse:
@@ -6133,6 +6178,79 @@
       summary: 鏇存柊瀛愯鍗�
       tags:
       - SubOrder
+  /api/timelyRate/add:
+    post:
+      parameters:
+      - description: 鏌ヨ鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/request.AddTimelyRate'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/contextx.Response'
+      summary: 娣诲姞閿�鍞樁娈�
+      tags:
+      - TimelyRate
+  /api/timelyRate/delete/{id}:
+    delete:
+      parameters:
+      - description: 鏌ヨ鍙傛暟
+        in: path
+        name: id
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/contextx.Response'
+      summary: 鍒犻櫎閿�鍞樁娈�
+      tags:
+      - TimelyRate
+  /api/timelyRate/list:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            allOf:
+            - $ref: '#/definitions/contextx.Response'
+            - properties:
+                data:
+                  $ref: '#/definitions/response.TimelyRateResponse'
+              type: object
+      summary: 鑾峰彇閿�鍞樁娈靛垪琛�
+      tags:
+      - TimelyRate
+  /api/timelyRate/update:
+    put:
+      parameters:
+      - description: 鏌ヨ鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/request.UpdateTimelyRates'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/contextx.Response'
+      summary: 鏇存柊閿�鍞樁娈�
+      tags:
+      - TimelyRate
   /api/user/changePassword:
     post:
       parameters:
diff --git a/model/index.go b/model/index.go
index 722dfce..efcc71c 100644
--- a/model/index.go
+++ b/model/index.go
@@ -64,6 +64,7 @@
 		Api{},
 		Department{},
 		Satisfaction{},
+		TimelyRate{},
 	)
 	return err
 }
diff --git a/model/request/timelyRate.go b/model/request/timelyRate.go
new file mode 100644
index 0000000..0dd1208
--- /dev/null
+++ b/model/request/timelyRate.go
@@ -0,0 +1,15 @@
+
+package request
+
+type AddTimelyRate struct {
+	Name string `  json:"name" binding:"required"`
+}
+
+type UpdateTimelyRate struct {
+	Id   int    `json:"id" binding:"required"`
+	Name string `json:"name" binding:"required"`
+}
+
+type UpdateTimelyRates struct {
+	TimelyRates []*UpdateTimelyRate `json:"timely_rate" binding:"required"`
+}
diff --git a/model/response/response.go b/model/response/response.go
index 364428d..3846070 100644
--- a/model/response/response.go
+++ b/model/response/response.go
@@ -215,6 +215,10 @@
 		Member []*model.User `json:"member"`
 		// 閮ㄩ棬
 		Department []*model.Department `json:"department"`
+		// 婊℃剰搴�
+		Satisfaction []*model.Satisfaction `json:"satisfaction"`
+		// 鍙婃椂鐜�
+		TimelyRate []*model.TimelyRate `json:"timely_rate"`
 	}
 
 	DepartmentResponse struct {
@@ -224,4 +228,16 @@
 	SatisfactionResponse struct {
 		List []*model.Satisfaction `json:"list"`
 	}
+
+	TimelyRateResponse struct {
+		List []*model.TimelyRate `json:"list"`
+	}
 )
+
+// 鍙婃椂鐜� 瑙e喅鐜� 婊℃剰搴� 鏈嶅姟浜哄憳鏄惁鏉ヨ繃 锛堟湇鍔″洖璁垮崟锛�
+// 宸ュ崟绫诲瀷 鎶ヤ慨鏉ユ簮锛堝伐鍗曠鐞嗭級
+// 鍚堝悓绫诲瀷 鍚堝悓鐘舵�侊紙鏈嶅姟鍚堝悓锛�
+// 浠樻鏂瑰紡 鏄惁寮�绁� 璐︽埛锛堥攢鍞��娆惧崟锛�
+// 閫�鍏ヤ粨搴� 鐘舵�侊紙閿�鍞��璐у崟锛�
+// 鎶ヤ环鍗曠姸鎬� 锛堟姤浠峰崟锛�
+// 鍙兘鎬� 甯佺 褰撳墠鐘舵�侊紙閿�鍞満浼氾級
diff --git a/model/serviceFeeManage.go b/model/serviceFeeManage.go
index 5905d04..6db6e76 100644
--- a/model/serviceFeeManage.go
+++ b/model/serviceFeeManage.go
@@ -80,6 +80,6 @@
 func (slf *ServiceFeeManageSearch) FindAll() ([]*ServiceFeeManage, error) {
 	var db = slf.build()
 	var records = make([]*ServiceFeeManage, 0)
-	err := db.Find(&records).Error
+	err := db.Preload("Client").Find(&records).Error
 	return records, err
 }
diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index d05e848..3d44828 100644
--- a/model/serviceFollowup.go
+++ b/model/serviceFollowup.go
@@ -15,8 +15,8 @@
 		CustomerServiceSheet CustomerServiceSheet `json:"customerServiceSheet" gorm:"foreignKey:ServiceId"`
 		MemberId             int                  `json:"memberId" gorm:"column:member_id;type:int;comment:鏈嶅姟浜哄憳id"`
 		PlanId               int                  `json:"planId" gorm:"column:plan_id;type:int;comment:鏈嶅姟璁″垝id"`
-		Satisfaction         int                  `json:"satisfaction" gorm:"column:satisfaction;type:int;comment:婊℃剰搴�"`
-		TimelyRate           int                  `json:"timelyRate" gorm:"column:timely_rate;type:int;comment:鍙婃椂鐜�"`
+		SatisfactionId       int                  `json:"satisfactionId" gorm:"column:satisfaction_id;type:int;comment:婊℃剰搴d"`
+		TimelyRateId         int                  `json:"timelyRateId" gorm:"column:timely_rate_id;type:int;comment:鍙婃椂鐜噄d"`
 		SolveRate            int                  `json:"solveRate" gorm:"column:solve_rate;type:int;comment:瑙e喅鐜�"`
 		IsVisit              int                  `json:"isVisit" gorm:"column:is_visit;type:int;comment:鏈嶅姟浜哄憳鏄惁鏉ヨ繃"`
 		OldMemberId          int                  `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:鍘熸湇鍔′汉鍛�"`
diff --git a/model/timelyRate.go b/model/timelyRate.go
new file mode 100644
index 0000000..b98e414
--- /dev/null
+++ b/model/timelyRate.go
@@ -0,0 +1,85 @@
+package model
+
+import (
+	"aps_crm/pkg/mysqlx"
+	"gorm.io/gorm"
+)
+
+type (
+	// TimelyRate 鍟嗘満闃舵
+	TimelyRate struct {
+		Id   int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
+	}
+   
+	TimelyRateSearch struct {
+		TimelyRate
+		Orm *gorm.DB
+	}
+)
+
+func (TimelyRate) TableName() string {
+	return "timely_rate"
+}
+
+func NewTimelyRateSearch() *TimelyRateSearch {
+	return &TimelyRateSearch{
+		Orm: mysqlx.GetDB(),
+	}
+}
+
+func (slf *TimelyRateSearch) build() *gorm.DB {
+	var db = slf.Orm.Model(&TimelyRate{})
+	if slf.Id != 0 {
+		db = db.Where("id = ?", slf.Id)
+	}
+	if slf.Name != "" {
+		db = db.Where("name = ?", slf.Name)
+	}
+
+	return db
+}
+
+func (slf *TimelyRateSearch) Create(record *TimelyRate) error {
+	var db = slf.build()
+	return db.Create(record).Error
+}
+
+func (slf *TimelyRateSearch) Delete() error {
+	var db = slf.build()
+	return db.Delete(&TimelyRate{}).Error
+}
+
+func (slf *TimelyRateSearch) Update(record *TimelyRate) error {
+	var db = slf.build()
+	return db.Updates(record).Error
+}
+
+func (slf *TimelyRateSearch) Find() (*TimelyRate, error) {
+	var db = slf.build()
+	var record = new(TimelyRate)
+	err := db.First(record).Error
+	return record, err
+}
+
+func (slf *TimelyRateSearch) FindAll() ([]*TimelyRate, error) {
+	var db = slf.build()
+	var records = make([]*TimelyRate, 0)
+	err := db.Find(&records).Error
+	return records, err
+}
+
+func (slf *TimelyRateSearch) SetId(id int) *TimelyRateSearch {
+	slf.Id = id
+	return slf
+}
+
+func (slf *TimelyRateSearch) SetName(name string) *TimelyRateSearch {
+	slf.Name = name
+	return slf
+}
+
+func (slf *TimelyRateSearch) Updates(data map[string]interface{}) error {
+	var db = slf.build()
+	return db.Updates(data).Error
+}
diff --git a/pkg/ecode/code.go b/pkg/ecode/code.go
index 310ef8b..bab5c87 100644
--- a/pkg/ecode/code.go
+++ b/pkg/ecode/code.go
@@ -297,4 +297,11 @@
 	SatisfactionListErr   = 4200003 // 鑾峰彇婊℃剰搴﹀垪琛ㄥけ璐�
 	SatisfactionSetErr    = 4200004 // 璁剧疆婊℃剰搴﹀け璐�
 	SatisfactionUpdateErr = 4200005 // 鏇存柊婊℃剰搴﹀け璐�
+
+	TimelyRateExist     = 4300001 // 鍙婃椂鐜囧凡瀛樺湪
+	TimelyRateNotExist  = 4300002 // 鍙婃椂鐜囦笉瀛樺湪
+	TimelyRateListErr   = 4300003 // 鑾峰彇鍙婃椂鐜囧垪琛ㄥけ璐�
+	TimelyRateSetErr    = 4300004 // 璁剧疆鍙婃椂鐜囧け璐�
+	TimelyRateUpdateErr = 4300005 // 鏇存柊鍙婃椂鐜囧け璐�
+
 )
diff --git a/router/index.go b/router/index.go
index 19ce012..cd7916b 100644
--- a/router/index.go
+++ b/router/index.go
@@ -55,6 +55,7 @@
 	DataRouter
 	DepartmentRouter
 	SatisfactionRouter
+	TimelyRateRouter
 }
 
 func InitRouter() *gin.Engine {
@@ -129,6 +130,7 @@
 		routerGroup.InitDataRouter(PrivateGroup)                 // 娉ㄥ唽data璺敱
 		routerGroup.InitDepartmentRouter(PrivateGroup)           // 娉ㄥ唽department璺敱
 		routerGroup.InitSatisfactionRouter(PrivateGroup)         // 娉ㄥ唽satisfaction璺敱
+		routerGroup.InitTimelyRateRouter(PrivateGroup)           // 娉ㄥ唽timelyRate璺敱
 	}
 	return Router
 }
diff --git a/router/timelyRate.go b/router/timelyRate.go
new file mode 100644
index 0000000..bc1c063
--- /dev/null
+++ b/router/timelyRate.go
@@ -0,0 +1,19 @@
+package router
+
+import (
+	v1 "aps_crm/api/v1"
+	"github.com/gin-gonic/gin"
+)
+
+type TimelyRateRouter struct{}
+
+func (s *TimelyRateRouter) InitTimelyRateRouter(router *gin.RouterGroup) {
+	timelyRateRouter := router.Group("timelyRate")
+	timelyRateApi := v1.ApiGroup.TimelyRateApi
+	{
+		timelyRateRouter.POST("add", timelyRateApi.Add)             // 娣诲姞閿�鍞樁娈�
+		timelyRateRouter.DELETE("delete/:id", timelyRateApi.Delete) // 鍒犻櫎閿�鍞樁娈�
+		timelyRateRouter.PUT("update", timelyRateApi.Update)        // 鏇存柊閿�鍞樁娈�
+		timelyRateRouter.GET("list", timelyRateApi.List)            // 鑾峰彇閿�鍞樁娈靛垪琛�
+	}
+}
diff --git a/service/dataServer.go b/service/dataServer.go
index c29d5f8..15d2d04 100644
--- a/service/dataServer.go
+++ b/service/dataServer.go
@@ -80,6 +80,14 @@
 	departmentList, _ := ServiceGroup.GetDepartmentList()
 	data.Department = departmentList
 
+	// get Satisfaction list
+	satisfactionList, _ := ServiceGroup.GetSatisfactionList()
+	data.Satisfaction = satisfactionList
+
+	// get TimelyRate list
+	timelyRateList, _ := ServiceGroup.GetTimelyRateList()
+	data.TimelyRate = timelyRateList
+
 	errCode = ecode.OK
 
 	return
diff --git a/service/index.go b/service/index.go
index ef84553..6655a5f 100644
--- a/service/index.go
+++ b/service/index.go
@@ -46,6 +46,7 @@
 	DepartmentService
 	VettingService
 	SatisfactionService
+	TimelyRateService
 }
 
 var ServiceGroup = new(Group)
diff --git a/service/timelyRate.go b/service/timelyRate.go
new file mode 100644
index 0000000..f22c918
--- /dev/null
+++ b/service/timelyRate.go
@@ -0,0 +1,69 @@
+
+package service
+
+import (
+	"aps_crm/model"
+	"aps_crm/model/request"
+	"aps_crm/pkg/ecode"
+)
+
+type TimelyRateService struct{}
+
+func (TimelyRateService) AddTimelyRate(timelyRate *model.TimelyRate) int {
+	err := model.NewTimelyRateSearch().Create(timelyRate)
+	if err != nil {
+		return ecode.TimelyRateExist
+	}
+
+	return ecode.OK
+}
+
+func (TimelyRateService) DeleteTimelyRate(id int) int {
+	_, err := model.NewTimelyRateSearch().SetId(id).Find()
+	if err != nil {
+		return ecode.TimelyRateNotExist
+	}
+
+	err = model.NewTimelyRateSearch().SetId(id).Delete()
+	if err != nil {
+		return ecode.TimelyRateNotExist
+	}
+	return ecode.OK
+}
+
+func (TimelyRateService) GetTimelyRateList() ([]*model.TimelyRate, int) {
+	list, err := model.NewTimelyRateSearch().FindAll()
+	if err != nil {
+		return nil, ecode.TimelyRateListErr
+	}
+
+	return list, ecode.OK
+}
+
+func (TimelyRateService) UpdateTimelyRate(timelyRates []*request.UpdateTimelyRate) int {
+	for _, v := range timelyRates {
+		// check timelyRate exist
+		_, err := model.NewTimelyRateSearch().SetId(v.Id).Find()
+		if err != nil {
+			return ecode.TimelyRateNotExist
+		}
+
+		err = model.NewTimelyRateSearch().SetId(v.Id).Updates(map[string]interface{}{
+			"name": v.Name,
+		})
+		if err != nil {
+			return ecode.TimelyRateSetErr
+		}
+	}
+
+	return ecode.OK
+}
+
+func (TimelyRateService) GetTimelyRateDetail(id int) (*model.TimelyRate, int) {
+	timelyRate, err := model.NewTimelyRateSearch().SetId(id).Find()
+	if err != nil {
+		return nil, ecode.TimelyRateNotExist
+	}
+
+	return timelyRate, ecode.OK
+}

--
Gitblit v1.8.0