| | |
| | | // @Tags 销售发票 |
| | | // @Summary 获取销售发票列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetInvoiceList true "参数" |
| | | // @Param object body request.GetInvoiceList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.Invoice} |
| | | // @Router /api/invoice/list [get] |
| | | // @Router /api/invoice/list [post] |
| | | func (s *InvoiceApi) List(c *gin.Context) { |
| | | var params request.GetInvoiceList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | |
| | | return |
| | | } |
| | | |
| | | invoice, total, errCode := service.NewInvoiceService().GetInvoiceList() |
| | | invoice, total, errCode := service.NewInvoiceService().GetInvoiceList(params) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | m := map[string]interface{}{ |
| | | "number": autoCode, |
| | | } |
| | | _ = model.NewContactSearch(nil).SetId(masterOrder.Id).UpdateByMap(m) |
| | | _ = model.NewMasterOrderSearch().SetId(masterOrder.Id).UpdateByMap(m) |
| | | } |
| | | |
| | | ctx.Ok() |
| | |
| | | return |
| | | } |
| | | |
| | | salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.KeywordType, params.Keyword) |
| | | salesDetailss, total, errCode := salesDetailsService.GetSalesDetailsList(params.Page, params.PageSize, params.KeywordType, params.Keyword, params.SaleChanceId) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | return |
| | | } |
| | | |
| | | salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword) |
| | | salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword, params.SourceId) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | return |
| | | } |
| | | |
| | | salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params.Page, params.PageSize, params.KeywordType, params.Keyword) |
| | | salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | // @Tags 收款计划管理 |
| | | // @Summary 获取收款计划列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetServiceCollectionPlanList true "参数" |
| | | // @Param object body request.GetServiceCollectionPlanList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.ServiceCollectionPlan} |
| | | // @Router /api/serviceCollectionPlan/list [get] |
| | | // @Router /api/serviceCollectionPlan/list [post] |
| | | func (s *ServiceCollectionPlanApi) List(c *gin.Context) { |
| | | var params request.GetServiceCollectionPlanList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | |
| | | return |
| | | } |
| | | |
| | | serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword) |
| | | serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | if params.CodeRule.Method == 1 { |
| | | autoCode := model.GetAutoCode(serviceOrder.Id, ¶ms.CodeRule) |
| | | m := map[string]interface{}{ |
| | | "number": autoCode, |
| | | "service_number": autoCode, |
| | | } |
| | | _ = model.NewServiceOrderSearch().SetId(serviceOrder.Id).UpdateByMap(m) |
| | | } |
| | |
| | | } |
| | | }, |
| | | "/api/invoice/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取销售发票列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "InvoiceKeywordCustomerName" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "InvoiceQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInvoiceList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "客户id", |
| | | "name": "clientId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | |
| | | "ReceiptSourceTypeCollectionPlan", |
| | | "ReceiptSourceTypeChuKuDan" |
| | | ], |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "name": "sourceType", |
| | | "in": "query" |
| | | } |
| | |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取收款计划列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "name": "sourceId", |
| | | "in": "query", |
| | | "required": true |
| | | }, |
| | | { |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "type": "integer", |
| | | "x-enum-comments": { |
| | | "CollectionSourceTypeSaleDetails": "销售明细", |
| | | "CollectionSourceTypeServiceContract": "服务合同" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionSourceTypeSaleDetails", |
| | | "CollectionSourceTypeServiceContract" |
| | | ], |
| | | "name": "sourceType", |
| | | "in": "query", |
| | | "required": true |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetServiceCollectionPlanList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "InvoiceKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "InvoiceQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceSourceType": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInvoiceList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细单2服务合同)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.InvoiceSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | "request.GetMasterOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "saleChanceId": { |
| | | "description": "销售机会id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceCollectionPlanList": { |
| | | "type": "object", |
| | | "required": [ |
| | | "sourceId", |
| | | "sourceType" |
| | | ], |
| | | "properties": { |
| | | "sourceId": { |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceContractList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "contactId": { |
| | | "description": "联系人id", |
| | | "type": "integer" |
| | | }, |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceContractQueryClass" |
| | | }, |
| | | "quotationId": { |
| | | "description": "报价单id", |
| | | "type": "integer" |
| | | }, |
| | | "saleChanceId": { |
| | | "description": "销售机会id", |
| | | "type": "integer" |
| | | }, |
| | | "salesDetailsId": { |
| | | "description": "合同订单id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | }, |
| | | "/api/invoice/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取销售发票列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "InvoiceKeywordCustomerName" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "InvoiceQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInvoiceList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "客户id", |
| | | "name": "clientId", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | |
| | | "ReceiptSourceTypeCollectionPlan", |
| | | "ReceiptSourceTypeChuKuDan" |
| | | ], |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "name": "sourceType", |
| | | "in": "query" |
| | | } |
| | |
| | | } |
| | | }, |
| | | "/api/serviceCollectionPlan/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取收款计划列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "name": "sourceId", |
| | | "in": "query", |
| | | "required": true |
| | | }, |
| | | { |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "type": "integer", |
| | | "x-enum-comments": { |
| | | "CollectionSourceTypeSaleDetails": "销售明细", |
| | | "CollectionSourceTypeServiceContract": "服务合同" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionSourceTypeSaleDetails", |
| | | "CollectionSourceTypeServiceContract" |
| | | ], |
| | | "name": "sourceType", |
| | | "in": "query", |
| | | "required": true |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetServiceCollectionPlanList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "FaqQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "InvoiceKeywordCustomerName" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceQueryClass": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "InvoiceQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.InvoiceSourceType": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInvoiceList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细单2服务合同)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.InvoiceSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | "request.GetMasterOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "saleChanceId": { |
| | | "description": "销售机会id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceCollectionPlanList": { |
| | | "type": "object", |
| | | "required": [ |
| | | "sourceId", |
| | | "sourceType" |
| | | ], |
| | | "properties": { |
| | | "sourceId": { |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceContractList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "contactId": { |
| | | "description": "联系人id", |
| | | "type": "integer" |
| | | }, |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceContractQueryClass" |
| | | }, |
| | | "quotationId": { |
| | | "description": "报价单id", |
| | | "type": "integer" |
| | | }, |
| | | "saleChanceId": { |
| | | "description": "销售机会id", |
| | | "type": "integer" |
| | | }, |
| | | "salesDetailsId": { |
| | | "description": "合同订单id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | type: string |
| | | x-enum-varnames: |
| | | - FaqQueryClassExpireLessThen60Days |
| | | constvar.InvoiceKeywordType: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - InvoiceKeywordCustomerName |
| | | constvar.InvoiceQueryClass: |
| | | enum: |
| | | - "" |
| | | type: string |
| | | x-enum-varnames: |
| | | - InvoiceQueryClassExpireLessThen60Days |
| | | constvar.InvoiceSourceType: |
| | | enum: |
| | | - 1 |
| | |
| | | "contact_name": "联系人姓名", "sales_leads_id": "销售线索id", "sale_chance_id": "销售机会id"}' |
| | | type: object |
| | | type: object |
| | | request.GetInvoiceList: |
| | | properties: |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | sourceId: |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.InvoiceSourceType' |
| | | description: 源单类型(1销售明细单2服务合同) |
| | | type: object |
| | | request.GetMasterOrderList: |
| | | properties: |
| | | page: |
| | |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | saleChanceId: |
| | | description: 销售机会id |
| | | type: integer |
| | | type: object |
| | | request.GetSalesLeadsList: |
| | | properties: |
| | |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | sourceId: |
| | | type: integer |
| | | type: object |
| | | request.GetSalesReturnList: |
| | | properties: |
| | |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.SalesReturnSourceType' |
| | | description: 源单类型(1销售明细) |
| | | type: object |
| | | request.GetServiceCollectionPlanList: |
| | | properties: |
| | | sourceId: |
| | | type: integer |
| | | sourceType: |
| | | $ref: '#/definitions/constvar.CollectionSourceType' |
| | | required: |
| | | - sourceId |
| | | - sourceType |
| | | type: object |
| | | request.GetServiceContractList: |
| | | properties: |
| | | contactId: |
| | | description: 联系人id |
| | | type: integer |
| | | keyword: |
| | | type: string |
| | | keywordType: |
| | |
| | | type: integer |
| | | queryClass: |
| | | $ref: '#/definitions/constvar.ServiceContractQueryClass' |
| | | quotationId: |
| | | description: 报价单id |
| | | type: integer |
| | | saleChanceId: |
| | | description: 销售机会id |
| | | type: integer |
| | | salesDetailsId: |
| | | description: 合同订单id |
| | | type: integer |
| | | type: object |
| | | request.GetServiceFeeManageList: |
| | | properties: |
| | |
| | | tags: |
| | | - 销售发票 |
| | | /api/invoice/list: |
| | | get: |
| | | post: |
| | | parameters: |
| | | - in: query |
| | | name: keyword |
| | | type: string |
| | | - enum: |
| | | - "" |
| | | in: query |
| | | name: keywordType |
| | | type: string |
| | | x-enum-varnames: |
| | | - InvoiceKeywordCustomerName |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | - enum: |
| | | - "" |
| | | in: query |
| | | name: queryClass |
| | | type: string |
| | | x-enum-varnames: |
| | | - InvoiceQueryClassExpireLessThen60Days |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetInvoiceList' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | /api/receipt/list: |
| | | get: |
| | | parameters: |
| | | - description: 客户id |
| | | in: query |
| | | name: clientId |
| | | type: integer |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | |
| | | - in: query |
| | | name: sourceId |
| | | type: integer |
| | | - enum: |
| | | - description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单) |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | |
| | | tags: |
| | | - 收款计划管理 |
| | | /api/serviceCollectionPlan/list: |
| | | get: |
| | | post: |
| | | parameters: |
| | | - in: query |
| | | name: sourceId |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | type: integer |
| | | - enum: |
| | | - 1 |
| | | - 2 |
| | | in: query |
| | | name: sourceType |
| | | required: true |
| | | type: integer |
| | | x-enum-comments: |
| | | CollectionSourceTypeSaleDetails: 销售明细 |
| | | CollectionSourceTypeServiceContract: 服务合同 |
| | | x-enum-varnames: |
| | | - CollectionSourceTypeSaleDetails |
| | | - CollectionSourceTypeServiceContract |
| | | schema: |
| | | $ref: '#/definitions/request.GetServiceCollectionPlanList' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | db = db.Where(key+" LIKE ?", "%"+v+"%") |
| | | } |
| | | |
| | | if key == "client_name" { |
| | | if key == "name" { |
| | | db = db.Joins("Client").Where("Client.name LIKE ?", "%"+v+"%") |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | func (slf *InvoiceSearch) SetSourceType(sourceType constvar.InvoiceSourceType) *InvoiceSearch { |
| | | slf.SourceType = sourceType |
| | | return slf |
| | | } |
| | | |
| | | func (slf *InvoiceSearch) SetSourceId(sourceId int) *InvoiceSearch { |
| | | slf.SourceId = sourceId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *InvoiceSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&Invoice{}) |
| | | if slf.Id != 0 { |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | |
| | | if slf.SourceType > 0 { |
| | | db = db.Where("source_type = ?", slf.SourceType) |
| | | } |
| | | |
| | | if slf.SourceId > 0 { |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | |
| | | slf.Orm = slf.Orm.Where("id in (?)", ids) |
| | | return slf |
| | | } |
| | | |
| | | func (slf *MasterOrderSearch) UpdateByMap(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(data).Error |
| | | } |
| | |
| | | if slf.SourceId != 0 { |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | } |
| | | if slf.ClientId != 0 { |
| | | db = db.Where("client_id = ?", slf.ClientId) |
| | | } |
| | | |
| | | return db |
| | | } |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ReceiptSearch) SetClientId(clientId int) *ReceiptSearch { |
| | | slf.ClientId = clientId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ReceiptSearch) SetOrm(tx *gorm.DB) *ReceiptSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | |
| | | |
| | | type GetInvoiceList struct { |
| | | PageInfo |
| | | QueryClass constvar.InvoiceQueryClass `json:"queryClass" form:"queryClass"` |
| | | KeywordType constvar.InvoiceKeywordType `json:"keywordType" form:"keywordType"` |
| | | Keyword string `json:"keyword" form:"keyword"` |
| | | SourceId int `json:"sourceId"` |
| | | SourceType constvar.InvoiceSourceType `json:"sourceType"` // 源单类型(1销售明细单2服务合同) |
| | | } |
| | |
| | | |
| | | type GetReceiptList struct { |
| | | PageInfo |
| | | SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` |
| | | SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` //来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单) |
| | | SourceId int `json:"sourceId" form:"sourceId"` |
| | | ClientId int `json:"clientId"` //客户id |
| | | } |
| | |
| | | |
| | | type GetSalesDetailsList struct { |
| | | PageInfo |
| | | KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | SaleChanceId int `json:"saleChanceId"` //销售机会id |
| | | } |
| | |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | KeywordType constvar.SalesRefundKeywordType |
| | | SourceId int `json:"sourceId"` |
| | | } |
| | |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | KeywordType constvar.SalesReturnKeywordType |
| | | SourceType constvar.SalesReturnSourceType `json:"sourceType"` // 源单类型(1销售明细) |
| | | SourceId int `json:"sourceId"` // 源单id |
| | | } |
| | |
| | | |
| | | type GetServiceContractList struct { |
| | | PageInfo |
| | | QueryClass constvar.ServiceContractQueryClass `json:"queryClass"` |
| | | KeywordType constvar.ServiceContractKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | QueryClass constvar.ServiceContractQueryClass `json:"queryClass"` |
| | | KeywordType constvar.ServiceContractKeywordType `json:"keywordType"` |
| | | Keyword string `json:"keyword"` |
| | | SalesDetailsId int `json:"salesDetailsId"` //合同订单id |
| | | QuotationId int `json:"quotationId"` //报价单id |
| | | SaleChanceId int `json:"saleChanceId"` //销售机会id |
| | | ContactId int `json:"contactId"` //联系人id |
| | | } |
| | | |
| | | type DeleteServiceContract struct { |
| | |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | |
| | | if slf.SaleChanceId != 0 { |
| | | db = db.Where("sale_chance_id = ?", slf.SaleChanceId) |
| | | } |
| | | |
| | | switch slf.KeywordType { |
| | | case constvar.SalesDetailsKeywordTypeCustomerName: |
| | | db = db.Joins("Client", clause.LeftJoin).Where("Client.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) SetSaleChanceId(saleChanceId int) *SalesDetailsSearch { |
| | | slf.SaleChanceId = saleChanceId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) First() (*SalesDetails, error) { |
| | | var db = slf.build() |
| | | var record = new(SalesDetails) |
| | |
| | | if len(slf.Ids) != 0 { |
| | | db = db.Where("id in ?", slf.Ids) |
| | | } |
| | | |
| | | if slf.SourceType != 0 { |
| | | db = db.Where("source_type = ?", slf.SourceType) |
| | | } |
| | | if slf.SourceId != 0 { |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | } |
| | | if slf.Preload { |
| | | db = db.Preload("Client"). |
| | | Preload("Member"). |
| | |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | func (slf *SalesReturnSearch) SetSourceType(sourceType constvar.SalesReturnSourceType) *SalesReturnSearch { |
| | | slf.SourceType = sourceType |
| | | return slf |
| | | } |
| | | func (slf *SalesReturnSearch) SetSourceId(sourceId int) *SalesReturnSearch { |
| | | slf.SourceId = sourceId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) UpdateByMap(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | |
| | | Preload("Contact") |
| | | } |
| | | |
| | | if slf.SalesDetailsId != 0 { |
| | | db = db.Where("sales_details_id = ?", slf.SalesDetailsId) |
| | | } |
| | | |
| | | if slf.QuotationId != 0 { |
| | | db = db.Where("quotation_id = ?", slf.QuotationId) |
| | | } |
| | | if slf.SaleChanceId != 0 { |
| | | db = db.Where("sale_chance_id = ?", slf.SaleChanceId) |
| | | } |
| | | if slf.ContactId != 0 { |
| | | db = db.Where("contact_id = ?", slf.ContactId) |
| | | } |
| | | return db |
| | | } |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) SetSalesDetailsId(salesDetailsId int) *ServiceContractSearch { |
| | | slf.SalesDetailsId = salesDetailsId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) SetQuotationId(quotationId int) *ServiceContractSearch { |
| | | slf.QuotationId = quotationId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) SetSaleChanceId(saleChanceId int) *ServiceContractSearch { |
| | | slf.SaleChanceId = saleChanceId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) SetContactId(contactId int) *ServiceContractSearch { |
| | | slf.ContactId = contactId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) SetPreload(preload bool) *ServiceContractSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | |
| | | ServiceFollowup |
| | | Orm *gorm.DB |
| | | KeywordType constvar.ServiceFollowupKeywordType |
| | | Keyword interface{} |
| | | Keyword string |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | |
| | | case constvar.ServiceFollowupKeywordSatisfactionDegree: |
| | | db = db.Joins("Satisfaction").Where("Satisfaction.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | |
| | | } |
| | | |
| | | if slf.ServiceOrderId > 0 { |
| | | db = db.Where("service_order_id = ?", slf.ServiceOrderId) |
| | | } |
| | | |
| | | if slf.Preload { |
| | |
| | | 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) |
| | | } |
| | | |
| | | if slf.PageNum > 0 && slf.PageSize > 0 { |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | |
| | | db = db.Where("id = ?", slf.Id) |
| | | } |
| | | if slf.ServiceContractId != 0 { |
| | | db = db.Where("service_contract_id = ?", slf.ServiceContractId) |
| | | db = db.Where("contract_id = ?", slf.ServiceContractId) |
| | | } |
| | | if slf.SalesDetailsId != 0 { |
| | | db = db.Where("sales_details_id = ?", slf.SalesDetailsId) |
| | | db = db.Where("order_id = ?", slf.SalesDetailsId) |
| | | } |
| | | if slf.Preload { |
| | | db = db. |
| | |
| | | InvoiceRouter.POST("add", InvoiceApi.Add) // 添加销售发票 |
| | | InvoiceRouter.DELETE("delete/:id", InvoiceApi.Delete) // 删除销售发票 |
| | | InvoiceRouter.PUT("update", InvoiceApi.Update) // 更新销售发票 |
| | | InvoiceRouter.GET("list", InvoiceApi.List) // 获取销售发票列表 |
| | | InvoiceRouter.POST("list", InvoiceApi.List) // 获取销售发票列表 |
| | | } |
| | | } |
| | |
| | | ServiceCollectionPlanRouter.POST("add", ServiceCollectionPlanApi.Add) // 添加服务合同收款计划 |
| | | ServiceCollectionPlanRouter.DELETE("delete/:id", ServiceCollectionPlanApi.Delete) // 删除服务合同收款计划 |
| | | ServiceCollectionPlanRouter.PUT("update", ServiceCollectionPlanApi.Update) // 更新服务合同收款计划 |
| | | ServiceCollectionPlanRouter.GET("list", ServiceCollectionPlanApi.List) // 获取服务合同收款计划列表 |
| | | ServiceCollectionPlanRouter.POST("list", ServiceCollectionPlanApi.List) // 获取服务合同收款计划列表 |
| | | } |
| | | } |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (InvoiceService) GetInvoiceList() ([]*model.Invoice, int64, int) { |
| | | list, total, err := model.NewInvoiceSearch().Find() |
| | | func (InvoiceService) GetInvoiceList(params request.GetInvoiceList) ([]*model.Invoice, int64, int) { |
| | | list, total, err := model.NewInvoiceSearch().SetSourceId(params.SourceId).SetSourceType(params.SourceType).Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | | } |
| | |
| | | SetPage(params.Page, params.PageSize). |
| | | SetSourceType(params.SourceType). |
| | | SetSourceId(params.SourceId). |
| | | SetClientId(params.ClientId). |
| | | Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keywordType constvar.SalesDetailsKeywordType, keyword string) ([]*model.SalesDetails, int64, int) { |
| | | func (SalesDetailsService) GetSalesDetailsList(page, pageSize int, keywordType constvar.SalesDetailsKeywordType, keyword string, saleChanceId int) ([]*model.SalesDetails, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewSalesDetailsSearch(). |
| | | SetPreload(true). |
| | | SetKeywordType(keywordType). |
| | | SetSaleChanceId(saleChanceId). |
| | | SetKeyword(keyword).SetPage(page, pageSize).FindAll() |
| | | if err != nil { |
| | | return nil, 0, ecode.SalesDetailsListErr |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string) ([]*model.SalesRefund, int64, int) { |
| | | func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string, sourceId int) ([]*model.SalesRefund, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewSalesRefundSearch(). |
| | | SetKeywordType(keywordType). |
| | | SetKeyword(keyword). |
| | | SetSourceId(sourceId). |
| | | SetPreload(true). |
| | | SetPage(page, pageSize).FindAll() |
| | | if err != nil { |
| | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesReturnService) GetSalesReturnList(page, pageSize int, keywordType constvar.SalesReturnKeywordType, keyword string) ([]*model.SalesReturn, int64, int) { |
| | | func (SalesReturnService) GetSalesReturnList(params request.GetSalesReturnList) ([]*model.SalesReturn, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewSalesReturnSearch(). |
| | | SetKeywordType(keywordType). |
| | | SetKeyword(keyword). |
| | | SetPage(page, pageSize). |
| | | SetKeywordType(params.KeywordType). |
| | | SetKeyword(params.Keyword). |
| | | SetPage(params.Page, params.PageSize). |
| | | SetSourceId(params.SourceId). |
| | | SetSourceType(params.SourceType). |
| | | SetPreload(true). |
| | | FindAll() |
| | | if err != nil { |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SContractService) GetServiceContractList(page, pageSize int, queryClass constvar.ServiceContractQueryClass, keywordType constvar.ServiceContractKeywordType, keyword string) ([]*model.ServiceContract, int64, int) { |
| | | func (SContractService) GetServiceContractList(params request.GetServiceContractList) ([]*model.ServiceContract, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewServiceContractSearch(). |
| | | SetKeyword(keyword). |
| | | SetKeywordType(keywordType). |
| | | SetQueryClass(queryClass). |
| | | SetPage(page, pageSize). |
| | | SetKeyword(params.Keyword). |
| | | SetKeywordType(params.KeywordType). |
| | | SetQueryClass(params.QueryClass). |
| | | SetPage(params.Page, params.PageSize). |
| | | SetSalesDetailsId(params.SalesDetailsId). |
| | | SetQuotationId(params.QuotationId). |
| | | SetSaleChanceId(params.SaleChanceId). |
| | | SetContactId(params.ContactId). |
| | | SetPreload(true). |
| | | Find() |
| | | if err != nil { |
| | |
| | | |
| | | func (SubOrderService) GetSubOrderList(page, pageSize int, data map[string]interface{}) ([]*model.SubOrder, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewSubOrderSearch(nil).SetSearchMap(data).SetPage(page, pageSize).SetSearchMap(data).FindAll() |
| | | contacts, total, err := model.NewSubOrderSearch(nil).SetPage(page, pageSize).SetSearchMap(data).FindAll() |
| | | if err != nil { |
| | | return nil, 0, ecode.SubOrderListErr |
| | | } |