| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | |
| | | func checkSalesDetailsParams(salesDetails request.SalesDetails) (errCode int, salesDetailsModel model.SalesDetails) { |
| | | //if salesDetails.ClientId == 0 { |
| | | // return ecode.InvalidParams, salesDetailsModel |
| | | //} |
| | | // |
| | | //if salesDetails.Number == "" { |
| | | // return ecode.InvalidParams, salesDetailsModel |
| | | //} |
| | | // |
| | | //if salesDetails.MemberId == 0 { |
| | | // return ecode.InvalidParams, salesDetailsModel |
| | | //} |
| | | // |
| | | //if salesDetails.SignTime == "" { |
| | | // return ecode.InvalidParams, salesDetailsModel |
| | | //} |
| | | |
| | | t, err := checkTimeFormat(salesDetails.SignTime) |
| | | if err != nil { |
| | | return ecode.InvalidParams, salesDetailsModel |
| | | } |
| | | |
| | | t, err = checkTimeFormat(salesDetails.DeliveryDate) |
| | | if err != nil { |
| | | return ecode.InvalidParams, salesDetailsModel |
| | | } |
| | | |
| | | salesDetailsModel.ClientId = salesDetails.ClientId |
| | | salesDetailsModel.Number = salesDetails.Number |
| | | salesDetailsModel.SaleChanceId = salesDetails.SaleChanceId |
| | | salesDetailsModel.SaleType = salesDetails.SaleType |
| | | salesDetailsModel.SignTime = t |
| | | salesDetailsModel.SignTime = salesDetails.SignTime |
| | | salesDetailsModel.MemberId = salesDetails.MemberId |
| | | salesDetailsModel.DeliveryDate = t |
| | | salesDetailsModel.WechatOrderStatus = salesDetails.WechatOrderStatus |
| | | salesDetailsModel.DeliveryDate = salesDetails.DeliveryDate |
| | | salesDetailsModel.WechatOrderStatusId = salesDetails.WechatOrderStatusId |
| | | salesDetailsModel.Address = salesDetails.Address |
| | | salesDetailsModel.Phone = salesDetails.Phone |
| | | salesDetailsModel.Remark = salesDetails.Remark |
| | |
| | | return |
| | | } |
| | | |
| | | salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.Keyword) |
| | | salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.KeywordType, params.Keyword) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.SalesDetailsResponse{ |
| | | List: salesDetailss, |
| | | List: salesDetailss, |
| | | Count: int(total), |
| | | }) |
| | | } |
| | | } |
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 WechatOrderStatusApi struct{} |
| | | |
| | | // Add |
| | | // @Tags 微信订单状态 |
| | | // @Summary 添加微信订单状态 |
| | | // @Produce application/json |
| | | // @Param object body request.AddWechatOrderStatus true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/wechatOrderStatus/add [post] |
| | | func (s *WechatOrderStatusApi) Add(c *gin.Context) { |
| | | var params request.AddWechatOrderStatus |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := service.NewWechatOrderStatusService().AddWechatOrderStatus(¶ms.WechatOrderStatus) |
| | | 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/wechatOrderStatus/delete/{id} [delete] |
| | | func (s *WechatOrderStatusApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | errCode := service.NewWechatOrderStatusService().DeleteWechatOrderStatus(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // @Tags 微信订单状态 |
| | | // @Summary 更新微信订单状态 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateWechatOrderStatus true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/wechatOrderStatus/update [put] |
| | | func (s *WechatOrderStatusApi) Update(c *gin.Context) { |
| | | var params request.UpdateWechatOrderStatus |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | if params.Id == 0 { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | } |
| | | params.WechatOrderStatus.Id = params.Id |
| | | |
| | | errCode := service.NewWechatOrderStatusService().UpdateWechatOrderStatus(¶ms.WechatOrderStatus) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // @Tags 微信订单状态 |
| | | // @Summary 获取微信订单状态列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetWechatOrderStatusList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.WechatOrderStatus} |
| | | // @Router /api/wechatOrderStatus/list [get] |
| | | func (s *WechatOrderStatusApi) List(c *gin.Context) { |
| | | var params request.GetWechatOrderStatusList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | wechatOrderStatus, total, errCode := service.NewWechatOrderStatusService().GetWechatOrderStatusList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ListResponse{ |
| | | Data: wechatOrderStatus, |
| | | Count: total, |
| | | }) |
| | | } |
New file |
| | |
| | | package constvar |
| | | |
| | | type SalesDetailsKeywordType string |
| | | |
| | | const ( |
| | | SalesDetailsKeywordTypeCustomerName SalesDetailsKeywordType = "客户名称" |
| | | SalesDetailsKeywordTypeOrderNumber SalesDetailsKeywordType = "订单编号" |
| | | SalesDetailsKeywordTypeSignTime SalesDetailsKeywordType = "签约日期" |
| | | SalesDetailsKeywordTypePrincipal SalesDetailsKeywordType = "销售负责人" |
| | | SalesDetailsKeywordTypeProductName SalesDetailsKeywordType = "产品名称" |
| | | ) |
New file |
| | |
| | | package constvar |
| | | type WechatOrderStatusQueryClass string |
| | | |
| | | const ( |
| | | WechatOrderStatusQueryClassExpireLessThen60Days WechatOrderStatusQueryClass = "" |
| | | ) |
| | | |
| | | type WechatOrderStatusKeywordType string |
| | | |
| | | const ( |
| | | WechatOrderStatusKeywordCustomerName WechatOrderStatusKeywordType = "" |
| | | ) |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "添加微信订单状态", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddWechatOrderStatus" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/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/wechatOrderStatus/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "获取微信订单状态列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusKeywordCustomerName" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.WechatOrderStatus" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "更新微信订单状态", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateWechatOrderStatus" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "definitions": { |
| | |
| | | "ReceiptQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.SalesDetailsKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "客户名称", |
| | | "订单编号", |
| | | "签约日期", |
| | | "销售负责人", |
| | | "产品名称" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "SalesDetailsKeywordTypeCustomerName", |
| | | "SalesDetailsKeywordTypeOrderNumber", |
| | | "SalesDetailsKeywordTypeSignTime", |
| | | "SalesDetailsKeywordTypePrincipal", |
| | | "SalesDetailsKeywordTypeProductName" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | "UserTypeSuper", |
| | | "UserTypePrimary", |
| | | "UserTypeSub" |
| | | ] |
| | | }, |
| | | "constvar.WechatOrderStatusKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.WechatOrderStatusQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "contextx.Response": { |
| | |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "type": "integer" |
| | | "type": "number" |
| | | }, |
| | | "desc": { |
| | | "type": "string" |
| | |
| | | "addressee": { |
| | | "type": "string" |
| | | }, |
| | | "amountInvoiced": { |
| | | "description": "已开票金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "saleChance": { |
| | | "$ref": "#/definitions/model.SaleChance" |
| | | }, |
| | | "saleChanceId": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatus": { |
| | | "$ref": "#/definitions/model.WechatOrderStatus" |
| | | }, |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | "type": "string" |
| | | }, |
| | | "uuid": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "model.WechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "description": "发票对应产品,从相应源单里获取", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | |
| | | "request.AddSalesDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | | "salesDetails": { |
| | | "$ref": "#/definitions/request.SalesDetails" |
| | | "address": { |
| | | "type": "string" |
| | | }, |
| | | "addressee": { |
| | | "type": "string" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "conditions": { |
| | | "type": "string" |
| | | }, |
| | | "deliveryDate": { |
| | | "type": "string" |
| | | }, |
| | | "logisticCompany": { |
| | | "type": "string" |
| | | }, |
| | | "logisticCost": { |
| | | "type": "number" |
| | | }, |
| | | "logisticNumber": { |
| | | "type": "string" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "phone": { |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "saleChanceId": { |
| | | "type": "integer" |
| | | }, |
| | | "saleType": { |
| | | "type": "integer" |
| | | }, |
| | | "signTime": { |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | }, |
| | | "request.AddServiceContract": { |
| | | "type": "object", |
| | | "required": [ |
| | | "memberId" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | }, |
| | | "vettingType": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddWechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.SalesDetailsKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | "signTime": { |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatus": { |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | }, |
| | | "request.UpdateInvoice": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "description": "客户id", |
| | |
| | | "principalId": { |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "description": "发票对应产品,从相应源单里获取", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | |
| | | }, |
| | | "request.UpdateServiceContract": { |
| | | "type": "object", |
| | | "required": [ |
| | | "memberId" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateWechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "response.AccountIdResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "添加微信订单状态", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddWechatOrderStatus" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/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/wechatOrderStatus/list": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "获取微信订单状态列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusKeywordCustomerName" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.WechatOrderStatus" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/wechatOrderStatus/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "微信订单状态" |
| | | ], |
| | | "summary": "更新微信订单状态", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateWechatOrderStatus" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "definitions": { |
| | |
| | | "ReceiptQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.SalesDetailsKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "客户名称", |
| | | "订单编号", |
| | | "签约日期", |
| | | "销售负责人", |
| | | "产品名称" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "SalesDetailsKeywordTypeCustomerName", |
| | | "SalesDetailsKeywordTypeOrderNumber", |
| | | "SalesDetailsKeywordTypeSignTime", |
| | | "SalesDetailsKeywordTypePrincipal", |
| | | "SalesDetailsKeywordTypeProductName" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | "UserTypeSuper", |
| | | "UserTypePrimary", |
| | | "UserTypeSub" |
| | | ] |
| | | }, |
| | | "constvar.WechatOrderStatusKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.WechatOrderStatusQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "WechatOrderStatusQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "contextx.Response": { |
| | |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "type": "integer" |
| | | "type": "number" |
| | | }, |
| | | "desc": { |
| | | "type": "string" |
| | |
| | | "addressee": { |
| | | "type": "string" |
| | | }, |
| | | "amountInvoiced": { |
| | | "description": "已开票金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "saleChance": { |
| | | "$ref": "#/definitions/model.SaleChance" |
| | | }, |
| | | "saleChanceId": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatus": { |
| | | "$ref": "#/definitions/model.WechatOrderStatus" |
| | | }, |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | "type": "string" |
| | | }, |
| | | "uuid": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "model.WechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "description": "发票对应产品,从相应源单里获取", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | |
| | | "request.AddSalesDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | | "salesDetails": { |
| | | "$ref": "#/definitions/request.SalesDetails" |
| | | "address": { |
| | | "type": "string" |
| | | }, |
| | | "addressee": { |
| | | "type": "string" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "conditions": { |
| | | "type": "string" |
| | | }, |
| | | "deliveryDate": { |
| | | "type": "string" |
| | | }, |
| | | "logisticCompany": { |
| | | "type": "string" |
| | | }, |
| | | "logisticCost": { |
| | | "type": "number" |
| | | }, |
| | | "logisticNumber": { |
| | | "type": "string" |
| | | }, |
| | | "memberId": { |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | | "phone": { |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "remark": { |
| | | "type": "string" |
| | | }, |
| | | "saleChanceId": { |
| | | "type": "integer" |
| | | }, |
| | | "saleType": { |
| | | "type": "integer" |
| | | }, |
| | | "signTime": { |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | }, |
| | | "request.AddServiceContract": { |
| | | "type": "object", |
| | | "required": [ |
| | | "memberId" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | }, |
| | | "vettingType": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddWechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.SalesDetailsKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | |
| | | "signTime": { |
| | | "type": "string" |
| | | }, |
| | | "wechatOrderStatus": { |
| | | "wechatOrderStatusId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | |
| | | }, |
| | | "request.UpdateInvoice": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "description": "客户id", |
| | |
| | | "principalId": { |
| | | "description": "销售负责人id", |
| | | "type": "integer" |
| | | }, |
| | | "products": { |
| | | "description": "发票对应产品,从相应源单里获取", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | |
| | | }, |
| | | "request.UpdateServiceContract": { |
| | | "type": "object", |
| | | "required": [ |
| | | "memberId" |
| | | ], |
| | | "properties": { |
| | | "clientId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateWechatOrderStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "response.AccountIdResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | type: string |
| | | x-enum-varnames: |
| | | - ReceiptQueryClassExpireLessThen60Days |
| | | constvar.SalesDetailsKeywordType: |
| | | enum: |
| | | - 客户名称 |
| | | - 订单编号 |
| | | - 签约日期 |
| | | - 销售负责人 |
| | | - 产品名称 |
| | | type: string |
| | | x-enum-varnames: |
| | | - SalesDetailsKeywordTypeCustomerName |
| | | - SalesDetailsKeywordTypeOrderNumber |
| | | - SalesDetailsKeywordTypeSignTime |
| | | - SalesDetailsKeywordTypePrincipal |
| | | - SalesDetailsKeywordTypeProductName |
| | | constvar.SalesStatus: |
| | | enum: |
| | | - 0 |
| | |
| | | - UserTypeSuper |
| | | - UserTypePrimary |
| | | - UserTypeSub |
| | | constvar.WechatOrderStatusKeywordType: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - WechatOrderStatusKeywordCustomerName |
| | | constvar.WechatOrderStatusQueryClass: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - WechatOrderStatusQueryClassExpireLessThen60Days |
| | | contextx.Response: |
| | | properties: |
| | | code: |
| | |
| | | principalId: |
| | | description: 销售负责人id |
| | | type: integer |
| | | products: |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | |
| | | model.Product: |
| | | properties: |
| | | amount: |
| | | type: integer |
| | | type: number |
| | | desc: |
| | | type: string |
| | | id: |
| | |
| | | type: string |
| | | addressee: |
| | | type: string |
| | | amountInvoiced: |
| | | description: 已开票金额 |
| | | type: number |
| | | amountReceivable: |
| | | description: 应收金额 |
| | | type: number |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountUnInvoiced: |
| | | description: 未开票金额 |
| | | type: number |
| | | client: |
| | | $ref: '#/definitions/model.Client' |
| | | clientId: |
| | |
| | | type: array |
| | | remark: |
| | | type: string |
| | | saleChance: |
| | | $ref: '#/definitions/model.SaleChance' |
| | | saleChanceId: |
| | | type: integer |
| | | saleType: |
| | |
| | | signTime: |
| | | type: string |
| | | wechatOrderStatus: |
| | | $ref: '#/definitions/model.WechatOrderStatus' |
| | | wechatOrderStatusId: |
| | | type: integer |
| | | type: object |
| | | model.SalesLeads: |
| | |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountUnInvoiced: |
| | | description: 未开票金额 |
| | | type: number |
| | | client: |
| | | $ref: '#/definitions/model.Client' |
| | | clientId: |
| | | type: integer |
| | | contactId: |
| | |
| | | username: |
| | | type: string |
| | | uuid: |
| | | type: string |
| | | type: object |
| | | model.WechatOrderStatus: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | type: object |
| | | product.Product: |
| | |
| | | principalId: |
| | | description: 销售负责人id |
| | | type: integer |
| | | products: |
| | | description: 发票对应产品,从相应源单里获取 |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | |
| | | type: object |
| | | request.AddSalesDetails: |
| | | properties: |
| | | salesDetails: |
| | | $ref: '#/definitions/request.SalesDetails' |
| | | address: |
| | | type: string |
| | | addressee: |
| | | type: string |
| | | clientId: |
| | | type: integer |
| | | conditions: |
| | | type: string |
| | | deliveryDate: |
| | | type: string |
| | | logisticCompany: |
| | | type: string |
| | | logisticCost: |
| | | type: number |
| | | logisticNumber: |
| | | type: string |
| | | memberId: |
| | | type: integer |
| | | number: |
| | | type: string |
| | | phone: |
| | | type: string |
| | | products: |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | remark: |
| | | type: string |
| | | saleChanceId: |
| | | type: integer |
| | | saleType: |
| | | type: integer |
| | | signTime: |
| | | type: string |
| | | wechatOrderStatusId: |
| | | type: integer |
| | | type: object |
| | | request.AddSalesLeads: |
| | | properties: |
| | |
| | | type: string |
| | | typeId: |
| | | type: integer |
| | | required: |
| | | - memberId |
| | | type: object |
| | | request.AddServiceContractStatus: |
| | | properties: |
| | |
| | | - userId |
| | | - vettingId |
| | | - vettingType |
| | | type: object |
| | | request.AddWechatOrderStatus: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | type: object |
| | | request.Assign: |
| | | properties: |
| | |
| | | properties: |
| | | keyword: |
| | | type: string |
| | | keywordType: |
| | | $ref: '#/definitions/constvar.SalesDetailsKeywordType' |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | |
| | | type: integer |
| | | signTime: |
| | | type: string |
| | | wechatOrderStatus: |
| | | wechatOrderStatusId: |
| | | type: integer |
| | | type: object |
| | | request.SalesRefund: |
| | |
| | | principalId: |
| | | description: 销售负责人id |
| | | type: integer |
| | | products: |
| | | description: 发票对应产品,从相应源单里获取 |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | |
| | | taxpayerIdNumber: |
| | | description: 纳税识别号 |
| | | type: string |
| | | required: |
| | | - id |
| | | type: object |
| | | request.UpdateInvoiceStatus: |
| | | properties: |
| | |
| | | type: string |
| | | typeId: |
| | | type: integer |
| | | required: |
| | | - memberId |
| | | type: object |
| | | request.UpdateServiceContractStatus: |
| | | properties: |
| | |
| | | required: |
| | | - id |
| | | - status |
| | | type: object |
| | | request.UpdateWechatOrderStatus: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | type: string |
| | | type: object |
| | | response.AccountIdResponse: |
| | | properties: |
| | |
| | | summary: 更新审批 |
| | | tags: |
| | | - Vetting |
| | | /api/wechatOrderStatus/add: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddWechatOrderStatus' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加微信订单状态 |
| | | tags: |
| | | - 微信订单状态 |
| | | /api/wechatOrderStatus/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/wechatOrderStatus/list: |
| | | get: |
| | | parameters: |
| | | - in: query |
| | | name: keyword |
| | | type: string |
| | | - enum: |
| | | - "" |
| | | in: query |
| | | name: keywordType |
| | | type: string |
| | | x-enum-varnames: |
| | | - WechatOrderStatusKeywordCustomerName |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | - enum: |
| | | - "" |
| | | in: query |
| | | name: queryClass |
| | | type: string |
| | | x-enum-varnames: |
| | | - WechatOrderStatusQueryClassExpireLessThen60Days |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/response.ListResponse' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/model.WechatOrderStatus' |
| | | type: array |
| | | type: object |
| | | summary: 获取微信订单状态列表 |
| | | tags: |
| | | - 微信订单状态 |
| | | /api/wechatOrderStatus/update: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateWechatOrderStatus' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新微信订单状态 |
| | | tags: |
| | | - 微信订单状态 |
| | | swagger: "2.0" |
| | |
| | | package request |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | ) |
| | | |
| | | type AddSalesDetails struct { |
| | | SalesDetails SalesDetails `json:"salesDetails"` |
| | | SalesDetails |
| | | } |
| | | |
| | | type SalesDetails struct { |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"` |
| | | SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"` |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | | SignTime string `json:"signTime" gorm:"column:sign_time;type:datetime;comment:签单时间"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:交货日期"` |
| | | WechatOrderStatus int `json:"wechatOrderStatus" gorm:"column:wechat_order_status;type:int;comment:微信订单状态"` |
| | | Address string `json:"address" gorm:"column:address;type:varchar(255);comment:地址"` |
| | | Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"` |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []model.Product `json:"products" gorm:"many2many:salesDetails_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | | LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"` |
| | | LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"` |
| | | SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"` |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | | SignTime string `json:"signTime" gorm:"column:sign_time;type:datetime;comment:签单时间"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:交货日期"` |
| | | WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status_id;type:int;comment:微信订单状态id"` |
| | | Address string `json:"address" gorm:"column:address;type:varchar(255);comment:地址"` |
| | | Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"` |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []model.Product `json:"products" gorm:"many2many:sales_details_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | | LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"` |
| | | LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"` |
| | | } |
| | | |
| | | type UpdateSalesDetails struct { |
| | |
| | | |
| | | type GetSalesDetailsList struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | } |
| | |
| | | type ServiceContract struct { |
| | | ClientId int `json:"clientId"` |
| | | Number string `json:"number"` |
| | | MemberId int `json:"memberId"` |
| | | MemberId int `json:"memberId" binding:"required"` |
| | | ContactId int `json:"contactId"` |
| | | SaleChanceId int `json:"saleChanceId"` |
| | | SalesDetailsId int `json:"salesDetailsId"` |
| | | QuotationId int `json:"quotationId"` |
| | | TypeId int `json:"typeId"` |
| | | SignTime string `json:"signTime" binding:"datetime=2006-01-02"` |
| | | StartTime string `json:"startTime" binding:"datetime=2006-01-02"` |
| | | EndTime string `json:"endTime" binding:"datetime=2006-01-02"` |
| | | StartTime string `json:"startTime"` |
| | | EndTime string `json:"endTime"` |
| | | StatusId int `json:"statusId"` |
| | | ServiceTimes int `json:"serviceTimes"` |
| | | Terms string `json:"terms"` |
New file |
| | |
| | | package request |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | ) |
| | | |
| | | type AddWechatOrderStatus struct { |
| | | model.WechatOrderStatus |
| | | } |
| | | |
| | | type UpdateWechatOrderStatus struct { |
| | | Id int `json:"id"` |
| | | model.WechatOrderStatus |
| | | } |
| | | |
| | | type GetWechatOrderStatusList struct { |
| | | PageInfo |
| | | QueryClass constvar.WechatOrderStatusQueryClass `json:"queryClass" form:"queryClass"` |
| | | KeywordType constvar.WechatOrderStatusKeywordType `json:"keywordType" form:"keywordType"` |
| | | Keyword string `json:"keyword" form:"keyword"` |
| | | } |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "fmt" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | | "time" |
| | | "gorm.io/gorm/clause" |
| | | ) |
| | | |
| | | type ( |
| | | SalesDetails struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"` |
| | | SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"` |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | | SignTime time.Time `json:"signTime" gorm:"column:sign_time;type:datetime;comment:签单时间"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | DeliveryDate time.Time `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:交货日期"` |
| | | WechatOrderStatus int `json:"wechatOrderStatus" gorm:"column:wechat_order_status;type:int;comment:微信订单状态"` |
| | | Address string `json:"address" gorm:"column:address;type:varchar(255);comment:地址"` |
| | | Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"` |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []Product `json:"products" gorm:"many2many:salesDetails_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | | LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"` |
| | | LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"` |
| | | gorm.Model `json:"-"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"` |
| | | SaleChanceId int `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"` |
| | | SaleChance SaleChance `json:"saleChance" gorm:"foreignKey:SaleChanceId"` |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | | SignTime string `json:"signTime" gorm:"column:sign_time;type:varchar(255);comment:签单时间"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:varchar(255);comment:交货日期"` |
| | | WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status;type:int;comment:微信订单状态"` |
| | | WechatOrderStatus WechatOrderStatus `json:"wechatOrderStatus" gorm:"foreignKey:WechatOrderStatusId"` |
| | | Address string `json:"address" gorm:"column:address;type:varchar(255);comment:地址"` |
| | | Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"` |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []Product `json:"products" gorm:"many2many:sales_details_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | | LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"` |
| | | LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"` |
| | | AmountReceivable decimal.Decimal `gorm:"amount_receivable" json:"amountReceivable"` // 应收金额 |
| | | AmountReceived decimal.Decimal `gorm:"amount_received" json:"amountReceived"` // 已收金额 |
| | | AmountInvoiced decimal.Decimal `gorm:"amount_invoiced" json:"amountInvoiced"` // 已开票金额 |
| | | AmountUnInvoiced decimal.Decimal `gorm:"-" json:"amountUnInvoiced"` // 未开票金额 |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
| | | SalesDetailsSearch struct { |
| | | SalesDetails |
| | | |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | |
| | | KeywordType constvar.SalesDetailsKeywordType |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | Preload bool |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | func (slf *SalesDetailsSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&SalesDetails{}) |
| | | if slf.Keyword != "" { |
| | | db = db.Where("name LIKE ?", "%"+slf.Keyword+"%") |
| | | } |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | |
| | | switch slf.KeywordType { |
| | | case constvar.SalesDetailsKeywordTypeCustomerName: |
| | | db = db.Joins("Client", clause.LeftJoin).Where("Client.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.SalesDetailsKeywordTypeOrderNumber: |
| | | db = db.Where("number like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.SalesDetailsKeywordTypeSignTime: |
| | | db = db.Where("sign_time like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.SalesDetailsKeywordTypePrincipal: |
| | | db = db.Joins("left join user on user.id = sales_details.member_id").Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.SalesDetailsKeywordTypeProductName: |
| | | //db = db.Joins("left join sales_details_product sdp on sdp.sales_details_id = sales_details.id left join product").Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | |
| | | } |
| | | if slf.Preload { |
| | | db = db.Preload("Products"). |
| | | Preload("Client"). |
| | | Preload("SaleChance"). |
| | | Preload("WechatOrderStatus"). |
| | | Preload("Client") |
| | | } |
| | | |
| | | return db |
| | |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | | |
| | | err := db.Preload("Products").Preload("Client").Find(&records).Error |
| | | err := db.Find(&records).Error |
| | | return records, total, err |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) SetKeyword(keyword string) *SalesDetailsSearch { |
| | | slf.Keyword = keyword |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) SetKeywordType(keywordType constvar.SalesDetailsKeywordType) *SalesDetailsSearch { |
| | | slf.KeywordType = keywordType |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) SetPreload(preload bool) *SalesDetailsSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | |
| | | func (slf *SalesDetailsSearch) SetOrder(order string) *SalesDetailsSearch { |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | } |
| | |
| | | |
| | | ServiceContractSearch struct { |
| | | ServiceContract |
| | | |
| | | Orm *gorm.DB |
| | | QueryClass constvar.ServiceContractQueryClass |
| | | KeywordType constvar.ServiceContractKeywordType |
| | |
| | | db = db.Joins("left join service_contract_status on service_contract_status.id = service_contract.service_contract_status_id") |
| | | db = db.Where("service_contract_status.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordPrincipal: |
| | | db = db.Joins("left join user on user.id = service_contract.member_id") |
| | | db = db.Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | db = db.Joins("left join user on user.id = service_contract.member_id").Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordProductName: |
| | | //db = db.Joins("ServiceContractProduct", clause.LeftJoin).Joins("Product", clause.LeftJoin).Where("Product.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) todo |
| | | db = db.Joins("Products", clause.LeftJoin).Where("Products.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordServiceBeginDate: |
| | | db = db.Where("start_time = ?", slf.Keyword) |
| | | case constvar.ServiceContractKeywordServiceEndDate: |
New file |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "errors" |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | // WechatOrderStatus 微信订单状态 |
| | | WechatOrderStatus struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name"` |
| | | } |
| | | |
| | | // WechatOrderStatusSearch 微信订单状态搜索条件 |
| | | WechatOrderStatusSearch struct { |
| | | WechatOrderStatus |
| | | Orm *gorm.DB |
| | | QueryClass constvar.WechatOrderStatusQueryClass |
| | | KeywordType constvar.WechatOrderStatusKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | } |
| | | ) |
| | | |
| | | func (WechatOrderStatus) TableName() string { |
| | | return "wechat_order_status" |
| | | } |
| | | |
| | | func NewWechatOrderStatusSearch() *WechatOrderStatusSearch { |
| | | return &WechatOrderStatusSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&WechatOrderStatus{}) |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) Create(record *WechatOrderStatus) error { |
| | | var db = slf.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) CreateBatch(records []*WechatOrderStatus) error { |
| | | var db = slf.build() |
| | | return db.Create(records).Error |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&WechatOrderStatus{}).Error |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) Update(record *WechatOrderStatus) error { |
| | | var db = slf.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) FindAll() ([]*WechatOrderStatus, error) { |
| | | var db = slf.build() |
| | | var record = make([]*WechatOrderStatus, 0) |
| | | err := db.Find(&record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) SetId(id int) *WechatOrderStatusSearch { |
| | | slf.Id = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) SetOrm(tx *gorm.DB) *WechatOrderStatusSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) First() (*WechatOrderStatus, error) { |
| | | var db = slf.build() |
| | | var record = new(WechatOrderStatus) |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) Updates(values interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(values).Error |
| | | } |
| | | |
| | | func (slf *WechatOrderStatusSearch) Save(record *WechatOrderStatus) 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 *WechatOrderStatusSearch) Find() ([]*WechatOrderStatus, int64, error) { |
| | | var db = slf.build() |
| | | var records = make([]*WechatOrderStatus, 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 *WechatOrderStatusSearch) 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 := []*WechatOrderStatus{} |
| | | return slf.CreateBatch(records) |
| | | } |
| | |
| | | if params != nil { |
| | | if err := r.ctx.ShouldBind(params); err != nil { |
| | | logx.Errorf("bind param error: %v", err.Error()) |
| | | r.Fail(ecode.ParamsErr) |
| | | r.FailWithMsg(ecode.ParamsErr, err.Error()) |
| | | return |
| | | } |
| | | } |
New file |
| | |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | func InitWechatOrderStatusRouter(router *gin.RouterGroup) { |
| | | WechatOrderStatusRouter := router.Group("wechatOrderStatus") |
| | | WechatOrderStatusApi := v1.WechatOrderStatusApi{} |
| | | { |
| | | WechatOrderStatusRouter.POST("add", WechatOrderStatusApi.Add) // 添加微信订单状态 |
| | | WechatOrderStatusRouter.DELETE("delete/:id", WechatOrderStatusApi.Delete) // 删除微信订单状态 |
| | | WechatOrderStatusRouter.PUT("update", WechatOrderStatusApi.Update) // 更新微信订单状态 |
| | | WechatOrderStatusRouter.GET("list", WechatOrderStatusApi.List) // 获取微信订单状态列表 |
| | | } |
| | | } |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keyword string) ([]*model.SalesDetails, int64, int) { |
| | | func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keywordType constvar.SalesDetailsKeywordType, keyword string) ([]*model.SalesDetails, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewSalesDetailsSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll() |
| | | contacts, total, err := model.NewSalesDetailsSearch(). |
| | | SetPreload(true). |
| | | SetKeywordType(keywordType). |
| | | SetKeyword(keyword).SetPage(page, pageSize).FindAll() |
| | | if err != nil { |
| | | return nil, 0, ecode.SalesDetailsListErr |
| | | } |
New file |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/pkg/ecode" |
| | | ) |
| | | |
| | | type WechatOrderStatusService struct{} |
| | | |
| | | func NewWechatOrderStatusService() WechatOrderStatusService { |
| | | return WechatOrderStatusService{} |
| | | } |
| | | |
| | | func (WechatOrderStatusService) AddWechatOrderStatus(wechatOrderStatus *model.WechatOrderStatus) int { |
| | | err := model.NewWechatOrderStatusSearch().Create(wechatOrderStatus) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (WechatOrderStatusService) GetWechatOrderStatus(id int) (*model.WechatOrderStatus, int) { |
| | | wechatOrderStatus, err := model.NewWechatOrderStatusSearch().SetId(id).First() |
| | | if err != nil { |
| | | return nil, ecode.DBErr |
| | | } |
| | | |
| | | return wechatOrderStatus, ecode.OK |
| | | } |
| | | |
| | | func (WechatOrderStatusService) DeleteWechatOrderStatus(id int) int { |
| | | err := model.NewWechatOrderStatusSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (WechatOrderStatusService) GetWechatOrderStatusList() ([]*model.WechatOrderStatus, int64, int) { |
| | | list, total, err := model.NewWechatOrderStatusSearch().Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | | } |
| | | |
| | | return list, total, ecode.OK |
| | | } |
| | | |
| | | func (WechatOrderStatusService) UpdateWechatOrderStatus(wechatOrderStatus *model.WechatOrderStatus) int { |
| | | err := model.NewWechatOrderStatusSearch().SetId(wechatOrderStatus.Id).Save(wechatOrderStatus) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |