| | |
| | | // @Tags 常见问题管理 |
| | | // @Summary 获取常见问题列表 |
| | | // @Produce application/json |
| | | // @Param object body request.GetFaqList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.Faq} |
| | | // @Router /api/faq/list [get] |
| | | func (s *FaqApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | var params request.GetFaqList |
| | | ctx, ok := contextx.NewContext(c, params) |
| | | if !ok { |
| | | return |
| | | } |
New file |
| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/service" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | | |
| | | type ServiceCollectionPlanApi struct{} |
| | | |
| | | // Add |
| | | // @Tags 服务合同收款计划管理 |
| | | // @Summary 添加服务合同收款计划 |
| | | // @Produce application/json |
| | | // @Param object body request.AddServiceCollectionPlan true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceCollectionPlan/add [post] |
| | | func (s *ServiceCollectionPlanApi) Add(c *gin.Context) { |
| | | var params request.AddServiceCollectionPlan |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := service.NewServiceCollectionPlanService().AddServiceCollectionPlan(params.List) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | // @Tags 服务合同收款计划管理 |
| | | // @Summary 删除服务合同收款计划 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceCollectionPlan/delete/{id} [delete] |
| | | func (s *ServiceCollectionPlanApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | errCode := service.NewServiceCollectionPlanService().DeleteServiceCollectionPlan(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // @Tags 服务合同收款计划管理 |
| | | // @Summary 更新服务合同收款计划 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateServiceCollectionPlan true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceCollectionPlan/update [put] |
| | | func (s *ServiceCollectionPlanApi) Update(c *gin.Context) { |
| | | var params request.UpdateServiceCollectionPlan |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | if params.Id == 0 { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | } |
| | | params.ServiceCollectionPlan.Id = params.Id |
| | | |
| | | errCode := service.NewServiceCollectionPlanService().UpdateServiceCollectionPlan(¶ms.ServiceCollectionPlan) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // @Tags 服务合同收款计划管理 |
| | | // @Summary 获取服务合同收款计划列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetServiceCollectionPlanList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.ServiceCollectionPlan} |
| | | // @Router /api/serviceCollectionPlan/list [get] |
| | | func (s *ServiceCollectionPlanApi) List(c *gin.Context) { |
| | | var params request.GetServiceCollectionPlanList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | serviceCollectionPlan, total, errCode := service.NewServiceCollectionPlanService().GetServiceCollectionPlanList(params.ServiceContractId) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ListResponse{ |
| | | Data: serviceCollectionPlan, |
| | | Count: total, |
| | | }) |
| | | } |
New file |
| | |
| | | package constvar |
| | | type ServiceCollectionPlanQueryClass string |
| | | |
| | | const ( |
| | | ServiceCollectionPlanQueryClassExpireLessThen60Days ServiceCollectionPlanQueryClass = "" |
| | | ) |
| | | |
| | | type ServiceCollectionPlanKeywordType string |
| | | |
| | | const ( |
| | | ServiceCollectionPlanKeywordCustomerName ServiceCollectionPlanKeywordType = "" |
| | | ) |
| | |
| | | "常见问题管理" |
| | | ], |
| | | "summary": "获取常见问题列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetFaqList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "添加服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddServiceCollectionPlan" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "删除服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "获取服务合同收款计划列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "服务合同id", |
| | | "name": "serviceContractId", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.ServiceCollectionPlan" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "更新服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateServiceCollectionPlan" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceContract/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | }, |
| | | "definitions": { |
| | | "constvar.FaqKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.FaqQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "model.ServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | | }, |
| | | "collectionType": { |
| | | "description": "类型(1 计划收款日期 2 项目状态)", |
| | | "type": "integer" |
| | | }, |
| | | "fileId": { |
| | | "description": "附件id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "moneyType": { |
| | | "description": "币种", |
| | | "type": "string" |
| | | }, |
| | | "percent": { |
| | | "description": "比例", |
| | | "type": "number" |
| | | }, |
| | | "principal": { |
| | | "description": "收款负责人ID", |
| | | "type": "integer" |
| | | }, |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | }, |
| | | "serviceContractId": { |
| | | "description": "服务合同id", |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "type": "integer" |
| | | }, |
| | | "term": { |
| | | "description": "期次", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "model.ServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | }, |
| | | "serviceId": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceOrder": { |
| | | "$ref": "#/definitions/model.ServiceOrder" |
| | | }, |
| | | "solveRateId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.ServiceCollectionPlan" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.AddServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetFaqList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.FaqKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.FaqQueryClass" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | | }, |
| | | "collectionType": { |
| | | "description": "类型(1 计划收款日期 2 项目状态)", |
| | | "type": "integer" |
| | | }, |
| | | "fileId": { |
| | | "description": "附件id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "moneyType": { |
| | | "description": "币种", |
| | | "type": "string" |
| | | }, |
| | | "percent": { |
| | | "description": "比例", |
| | | "type": "number" |
| | | }, |
| | | "principal": { |
| | | "description": "收款负责人ID", |
| | | "type": "integer" |
| | | }, |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | }, |
| | | "serviceContractId": { |
| | | "description": "服务合同id", |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "type": "integer" |
| | | }, |
| | | "term": { |
| | | "description": "期次", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "常见问题管理" |
| | | ], |
| | | "summary": "获取常见问题列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetFaqList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "添加服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddServiceCollectionPlan" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "删除服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "获取服务合同收款计划列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "服务合同id", |
| | | "name": "serviceContractId", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.ServiceCollectionPlan" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务合同收款计划管理" |
| | | ], |
| | | "summary": "更新服务合同收款计划", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateServiceCollectionPlan" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/serviceContract/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | }, |
| | | "definitions": { |
| | | "constvar.FaqKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.FaqQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "model.ServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | | }, |
| | | "collectionType": { |
| | | "description": "类型(1 计划收款日期 2 项目状态)", |
| | | "type": "integer" |
| | | }, |
| | | "fileId": { |
| | | "description": "附件id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "moneyType": { |
| | | "description": "币种", |
| | | "type": "string" |
| | | }, |
| | | "percent": { |
| | | "description": "比例", |
| | | "type": "number" |
| | | }, |
| | | "principal": { |
| | | "description": "收款负责人ID", |
| | | "type": "integer" |
| | | }, |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | }, |
| | | "serviceContractId": { |
| | | "description": "服务合同id", |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "type": "integer" |
| | | }, |
| | | "term": { |
| | | "description": "期次", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "model.ServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | }, |
| | | "serviceId": { |
| | | "type": "integer" |
| | | }, |
| | | "serviceOrder": { |
| | | "$ref": "#/definitions/model.ServiceOrder" |
| | | }, |
| | | "solveRateId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "list": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.ServiceCollectionPlan" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.AddServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetFaqList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.FaqKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.FaqQueryClass" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateServiceCollectionPlan": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | | }, |
| | | "collectionType": { |
| | | "description": "类型(1 计划收款日期 2 项目状态)", |
| | | "type": "integer" |
| | | }, |
| | | "fileId": { |
| | | "description": "附件id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "moneyType": { |
| | | "description": "币种", |
| | | "type": "string" |
| | | }, |
| | | "percent": { |
| | | "description": "比例", |
| | | "type": "number" |
| | | }, |
| | | "principal": { |
| | | "description": "收款负责人ID", |
| | | "type": "integer" |
| | | }, |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | }, |
| | | "serviceContractId": { |
| | | "description": "服务合同id", |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "type": "integer" |
| | | }, |
| | | "term": { |
| | | "description": "期次", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | definitions: |
| | | constvar.FaqKeywordType: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - FaqKeywordCustomerName |
| | | constvar.FaqQueryClass: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - FaqQueryClassExpireLessThen60Days |
| | | constvar.SalesStatus: |
| | | enum: |
| | | - 1 |
| | |
| | | name: |
| | | type: string |
| | | type: object |
| | | model.ServiceCollectionPlan: |
| | | properties: |
| | | amount: |
| | | description: 金额 |
| | | type: number |
| | | collectionDate: |
| | | description: 计划收款日期 |
| | | type: string |
| | | collectionType: |
| | | description: 类型(1 计划收款日期 2 项目状态) |
| | | type: integer |
| | | fileId: |
| | | description: 附件id |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | moneyType: |
| | | description: 币种 |
| | | type: string |
| | | percent: |
| | | description: 比例 |
| | | type: number |
| | | principal: |
| | | description: 收款负责人ID |
| | | type: integer |
| | | remark: |
| | | description: 备注 |
| | | type: string |
| | | serviceContractId: |
| | | description: 服务合同id |
| | | type: integer |
| | | status: |
| | | description: 状态(1未收2已收) |
| | | type: integer |
| | | term: |
| | | description: 期次 |
| | | type: integer |
| | | type: object |
| | | model.ServiceContract: |
| | | properties: |
| | | clientId: |
| | |
| | | type: integer |
| | | serviceId: |
| | | type: integer |
| | | serviceOrder: |
| | | $ref: '#/definitions/model.ServiceOrder' |
| | | solveRateId: |
| | | type: integer |
| | | timelyRateId: |
| | |
| | | required: |
| | | - name |
| | | type: object |
| | | request.AddServiceCollectionPlan: |
| | | properties: |
| | | list: |
| | | items: |
| | | $ref: '#/definitions/model.ServiceCollectionPlan' |
| | | type: array |
| | | type: object |
| | | request.AddServiceContract: |
| | | properties: |
| | | clientId: |
| | |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | type: object |
| | | request.GetFaqList: |
| | | properties: |
| | | keyword: |
| | | type: string |
| | | keywordType: |
| | | $ref: '#/definitions/constvar.FaqKeywordType' |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | queryClass: |
| | | $ref: '#/definitions/constvar.FaqQueryClass' |
| | | type: object |
| | | request.GetFollowRecordList: |
| | | properties: |
| | |
| | | type: array |
| | | required: |
| | | - satisfactions |
| | | type: object |
| | | request.UpdateServiceCollectionPlan: |
| | | properties: |
| | | amount: |
| | | description: 金额 |
| | | type: number |
| | | collectionDate: |
| | | description: 计划收款日期 |
| | | type: string |
| | | collectionType: |
| | | description: 类型(1 计划收款日期 2 项目状态) |
| | | type: integer |
| | | fileId: |
| | | description: 附件id |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | moneyType: |
| | | description: 币种 |
| | | type: string |
| | | percent: |
| | | description: 比例 |
| | | type: number |
| | | principal: |
| | | description: 收款负责人ID |
| | | type: integer |
| | | remark: |
| | | description: 备注 |
| | | type: string |
| | | serviceContractId: |
| | | description: 服务合同id |
| | | type: integer |
| | | status: |
| | | description: 状态(1未收2已收) |
| | | type: integer |
| | | term: |
| | | description: 期次 |
| | | type: integer |
| | | type: object |
| | | request.UpdateServiceContract: |
| | | properties: |
| | |
| | | - 常见问题管理 |
| | | /api/faq/list: |
| | | get: |
| | | parameters: |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetFaqList' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | summary: 更新满意度 |
| | | tags: |
| | | - Satisfaction |
| | | /api/serviceCollectionPlan/add: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddServiceCollectionPlan' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加服务合同收款计划 |
| | | tags: |
| | | - 服务合同收款计划管理 |
| | | /api/serviceCollectionPlan/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: |
| | | - 服务合同收款计划管理 |
| | | /api/serviceCollectionPlan/list: |
| | | get: |
| | | parameters: |
| | | - description: 服务合同id |
| | | in: query |
| | | name: serviceContractId |
| | | type: integer |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/response.ListResponse' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/model.ServiceCollectionPlan' |
| | | type: array |
| | | type: object |
| | | summary: 获取服务合同收款计划列表 |
| | | tags: |
| | | - 服务合同收款计划管理 |
| | | /api/serviceCollectionPlan/update: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateServiceCollectionPlan' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新服务合同收款计划 |
| | | tags: |
| | | - 服务合同收款计划管理 |
| | | /api/serviceContract/add: |
| | | post: |
| | | parameters: |
New file |
| | |
| | | package request |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | ) |
| | | |
| | | type AddServiceCollectionPlan struct { |
| | | List []*model.ServiceCollectionPlan |
| | | } |
| | | |
| | | type UpdateServiceCollectionPlan struct { |
| | | Id int `json:"id"` |
| | | model.ServiceCollectionPlan |
| | | } |
| | | |
| | | type GetServiceCollectionPlanList struct { |
| | | ServiceContractId int `gorm:"service_contract_id" form:"serviceContractId"` // 服务合同id |
| | | } |
New file |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "errors" |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | // ServiceCollectionPlan 服务合同收款计划 |
| | | ServiceCollectionPlan struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | CollectionType int `gorm:"collection_type" json:"collectionType"` // 类型(1 计划收款日期 2 项目状态) |
| | | ServiceContractId int `gorm:"service_contract_id" json:"serviceContractId"` // 服务合同id |
| | | PrincipalId int `gorm:"principal_id" json:"principalId"` // 收款负责人ID |
| | | Term int `gorm:"term" json:"term"` // 期次 |
| | | Percent float64 `gorm:"percent" json:"percent"` // 比例 |
| | | Amount float64 `gorm:"amount" json:"amount"` // 金额 |
| | | MoneyType string `gorm:"money_type" json:"moneyType"` // 币种 |
| | | CollectionDate string `gorm:"collection_date" json:"collectionDate"` // 计划收款日期 |
| | | Remark string `gorm:"remark" json:"remark"` // 备注 |
| | | Status int `gorm:"status" json:"status"` // 状态(1未收2已收) |
| | | FileId int `gorm:"file_id" json:"fileId"` // 附件id |
| | | } |
| | | |
| | | // ServiceCollectionPlanSearch 服务合同收款计划搜索条件 |
| | | ServiceCollectionPlanSearch struct { |
| | | ServiceCollectionPlan |
| | | Orm *gorm.DB |
| | | QueryClass constvar.ServiceCollectionPlanQueryClass |
| | | KeywordType constvar.ServiceCollectionPlanKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | } |
| | | ) |
| | | |
| | | func (ServiceCollectionPlan) TableName() string { |
| | | return "service_collection_plan" |
| | | } |
| | | |
| | | func NewServiceCollectionPlanSearch() *ServiceCollectionPlanSearch { |
| | | return &ServiceCollectionPlanSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&ServiceCollectionPlan{}) |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | |
| | | if slf.ServiceContractId != 0 { |
| | | db = db.Where("service_contract_id = ?", slf.ServiceContractId) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Create(record *ServiceCollectionPlan) error { |
| | | var db = slf.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) CreateBatch(records []*ServiceCollectionPlan) error { |
| | | var db = slf.build() |
| | | return db.Create(records).Error |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&ServiceCollectionPlan{}).Error |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Update(record *ServiceCollectionPlan) error { |
| | | var db = slf.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) FindAll() ([]*ServiceCollectionPlan, error) { |
| | | var db = slf.build() |
| | | var record = make([]*ServiceCollectionPlan, 0) |
| | | err := db.Find(&record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) SetId(id int) *ServiceCollectionPlanSearch { |
| | | slf.Id = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) SetOrm(tx *gorm.DB) *ServiceCollectionPlanSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) SetServiceContractId(id int) *ServiceCollectionPlanSearch { |
| | | slf.ServiceContractId = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) First() (*ServiceCollectionPlan, error) { |
| | | var db = slf.build() |
| | | var record = new(ServiceCollectionPlan) |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Updates(values interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(values).Error |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Save(record *ServiceCollectionPlan) error { |
| | | if record.Id == 0 { |
| | | return errors.New("id为空") |
| | | } |
| | | var db = slf.build() |
| | | |
| | | if err := db.Save(record).Error; err != nil { |
| | | return fmt.Errorf("save err: %v, record: %+v", err, record) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) Find() ([]*ServiceCollectionPlan, int64, error) { |
| | | var db = slf.build() |
| | | var records = make([]*ServiceCollectionPlan, 0) |
| | | var total int64 |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, err |
| | | } |
| | | if slf.PageNum > 0 && slf.PageSize > 0 { |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | | |
| | | err := db.Find(&records).Error |
| | | return records, total, err |
| | | } |
| | | |
| | | // InitDefaultData 初始化数据 |
| | | func (slf *ServiceCollectionPlanSearch) InitDefaultData() error { |
| | | var ( |
| | | db = slf.Orm.Table(slf.TableName()) |
| | | total int64 = 0 |
| | | ) |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return err |
| | | } |
| | | if total != 0 { |
| | | return nil |
| | | } |
| | | records := []*ServiceCollectionPlan{} |
| | | return slf.CreateBatch(records) |
| | | } |
| | |
| | | InitPriorityLevelRouter(PrivateGroup) |
| | | InitServiceTypeRouter(PrivateGroup) |
| | | InitSeverityRouter(PrivateGroup) |
| | | InitTimeSpentRouter(PrivateGroup) |
| | | InitFaultTypeRouter(PrivateGroup) |
| | | InitServiceCollectionPlanRouter(PrivateGroup) |
| | | } |
| | | return Router |
| | | } |
New file |
| | |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | func InitServiceCollectionPlanRouter(router *gin.RouterGroup) { |
| | | ServiceCollectionPlanRouter := router.Group("serviceCollectionPlan") |
| | | ServiceCollectionPlanApi := v1.ServiceCollectionPlanApi{} |
| | | { |
| | | ServiceCollectionPlanRouter.POST("add", ServiceCollectionPlanApi.Add) // 添加服务合同收款计划 |
| | | ServiceCollectionPlanRouter.DELETE("delete/:id", ServiceCollectionPlanApi.Delete) // 删除服务合同收款计划 |
| | | ServiceCollectionPlanRouter.PUT("update", ServiceCollectionPlanApi.Update) // 更新服务合同收款计划 |
| | | ServiceCollectionPlanRouter.GET("list", ServiceCollectionPlanApi.List) // 获取服务合同收款计划列表 |
| | | } |
| | | } |
| | |
| | | return FaqService{} |
| | | } |
| | | |
| | | func (FaqService) AddFaq(Faq *model.Faq) int { |
| | | err := model.NewFaqSearch().Create(Faq) |
| | | func (FaqService) AddFaq(faq *model.Faq) int { |
| | | err := model.NewFaqSearch().Create(faq) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
New file |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ServiceCollectionPlanService struct{} |
| | | |
| | | func NewServiceCollectionPlanService() ServiceCollectionPlanService { |
| | | return ServiceCollectionPlanService{} |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) AddServiceCollectionPlan(serviceCollectionPlan []*model.ServiceCollectionPlan) int { |
| | | if len(serviceCollectionPlan) == 0 { |
| | | return ecode.ParamsErr |
| | | } |
| | | contractId := serviceCollectionPlan[0].ServiceContractId |
| | | err := model.WithTransaction(func(db *gorm.DB) error { |
| | | err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetServiceContractId(contractId).Delete() |
| | | if err != nil { |
| | | return err |
| | | } |
| | | err = model.NewServiceCollectionPlanSearch().SetOrm(db).CreateBatch(serviceCollectionPlan) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return nil |
| | | }) |
| | | |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) DeleteServiceCollectionPlan(id int) int { |
| | | err := model.NewServiceCollectionPlanSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) GetServiceCollectionPlanList(contractId int) ([]*model.ServiceCollectionPlan, int64, int) { |
| | | list, total, err := model.NewServiceCollectionPlanSearch().SetServiceContractId(contractId).Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | | } |
| | | |
| | | return list, total, ecode.OK |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) UpdateServiceCollectionPlans(ServiceCollectionPlans []*request.UpdateServiceCollectionPlan) int { |
| | | for _, v := range ServiceCollectionPlans { |
| | | // check ServiceCollectionPlan exist |
| | | _, err := model.NewServiceCollectionPlanSearch().SetId(v.Id).First() |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | |
| | | err = model.NewServiceCollectionPlanSearch().SetId(v.Id).Updates(map[string]interface{}{}) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) UpdateServiceCollectionPlan(serviceCollectionPlan *model.ServiceCollectionPlan) int { |
| | | err := model.NewServiceCollectionPlanSearch().SetId(serviceCollectionPlan.Id).Save(serviceCollectionPlan) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |