liujiandao
2023-10-12 17aaed743ab7a3520ec8eb9e4ab7c776ca807cdd
bug修改
35个文件已修改
662 ■■■■■ 已修改文件
api/v1/invoice.go 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/masterOrder.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesDetails.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesRefund.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesReturn.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceCollectionPlan.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceContract.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceOrder.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/followRecord.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/invoice.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/masterOrder.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/receipt.go 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/invoice.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/receipt.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesDetails.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesRefund.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesReturn.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceContract.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesDetails.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesReturn.go 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceContract.go 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceFollowup.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceOrder.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/invoice.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/serviceCollectionPlan.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/invoice.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/receipt.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/salesDetails.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/salesRefund.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/salesReturn.go 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/serviceContract.go 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/subOrder.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/invoice.go
@@ -104,9 +104,9 @@
// @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, &params)
@@ -114,7 +114,7 @@
        return
    }
    invoice, total, errCode := service.NewInvoiceService().GetInvoiceList()
    invoice, total, errCode := service.NewInvoiceService().GetInvoiceList(params)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
api/v1/masterOrder.go
@@ -43,7 +43,7 @@
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewContactSearch(nil).SetId(masterOrder.Id).UpdateByMap(m)
        _ = model.NewMasterOrderSearch().SetId(masterOrder.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/salesDetails.go
@@ -166,7 +166,7 @@
        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
api/v1/salesRefund.go
@@ -170,7 +170,7 @@
        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
api/v1/salesReturn.go
@@ -165,7 +165,7 @@
        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
api/v1/serviceCollectionPlan.go
@@ -105,9 +105,9 @@
// @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, &params)
api/v1/serviceContract.go
@@ -144,7 +144,7 @@
        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
api/v1/serviceOrder.go
@@ -42,7 +42,7 @@
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(serviceOrder.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
            "service_number": autoCode,
        }
        _ = model.NewServiceOrderSearch().SetId(serviceOrder.Id).UpdateByMap(m)
    }
docs/docs.go
@@ -3360,7 +3360,7 @@
            }
        },
        "/api/invoice/list": {
            "get": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -3370,43 +3370,13 @@
                "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": {
@@ -5569,6 +5539,12 @@
                "parameters": [
                    {
                        "type": "integer",
                        "description": "客户id",
                        "name": "clientId",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
@@ -5607,6 +5583,7 @@
                            "ReceiptSourceTypeCollectionPlan",
                            "ReceiptSourceTypeChuKuDan"
                        ],
                        "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                        "name": "sourceType",
                        "in": "query"
                    }
@@ -7877,7 +7854,7 @@
            }
        },
        "/api/serviceCollectionPlan/list": {
            "get": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -7887,28 +7864,13 @@
                "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": {
@@ -10439,24 +10401,6 @@
            ],
            "x-enum-varnames": [
                "FaqQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.InvoiceKeywordType": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "InvoiceKeywordCustomerName"
            ]
        },
        "constvar.InvoiceQueryClass": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "InvoiceQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.InvoiceSourceType": {
@@ -15655,6 +15599,30 @@
                }
            }
        },
        "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": {
@@ -15757,6 +15725,10 @@
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "saleChanceId": {
                    "description": "销售机会id",
                    "type": "integer"
                }
            }
        },
@@ -15794,6 +15766,9 @@
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceId": {
                    "type": "integer"
                }
            }
        },
@@ -15813,12 +15788,43 @@
                "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"
                },
@@ -15835,6 +15841,18 @@
                },
                "queryClass": {
                    "$ref": "#/definitions/constvar.ServiceContractQueryClass"
                },
                "quotationId": {
                    "description": "报价单id",
                    "type": "integer"
                },
                "saleChanceId": {
                    "description": "销售机会id",
                    "type": "integer"
                },
                "salesDetailsId": {
                    "description": "合同订单id",
                    "type": "integer"
                }
            }
        },
docs/swagger.json
@@ -3348,7 +3348,7 @@
            }
        },
        "/api/invoice/list": {
            "get": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -3358,43 +3358,13 @@
                "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": {
@@ -5557,6 +5527,12 @@
                "parameters": [
                    {
                        "type": "integer",
                        "description": "客户id",
                        "name": "clientId",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
@@ -5595,6 +5571,7 @@
                            "ReceiptSourceTypeCollectionPlan",
                            "ReceiptSourceTypeChuKuDan"
                        ],
                        "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                        "name": "sourceType",
                        "in": "query"
                    }
@@ -7865,7 +7842,7 @@
            }
        },
        "/api/serviceCollectionPlan/list": {
            "get": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -7875,28 +7852,13 @@
                "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": {
@@ -10427,24 +10389,6 @@
            ],
            "x-enum-varnames": [
                "FaqQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.InvoiceKeywordType": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "InvoiceKeywordCustomerName"
            ]
        },
        "constvar.InvoiceQueryClass": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "InvoiceQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.InvoiceSourceType": {
@@ -15643,6 +15587,30 @@
                }
            }
        },
        "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": {
@@ -15745,6 +15713,10 @@
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "saleChanceId": {
                    "description": "销售机会id",
                    "type": "integer"
                }
            }
        },
@@ -15782,6 +15754,9 @@
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceId": {
                    "type": "integer"
                }
            }
        },
@@ -15801,12 +15776,43 @@
                "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"
                },
@@ -15823,6 +15829,18 @@
                },
                "queryClass": {
                    "$ref": "#/definitions/constvar.ServiceContractQueryClass"
                },
                "quotationId": {
                    "description": "报价单id",
                    "type": "integer"
                },
                "saleChanceId": {
                    "description": "销售机会id",
                    "type": "integer"
                },
                "salesDetailsId": {
                    "description": "合同订单id",
                    "type": "integer"
                }
            }
        },
docs/swagger.yaml
@@ -101,18 +101,6 @@
    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
@@ -3672,6 +3660,21 @@
          "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:
@@ -3752,6 +3755,9 @@
      pageSize:
        description: 每页大小
        type: integer
      saleChanceId:
        description: 销售机会id
        type: integer
    type: object
  request.GetSalesLeadsList:
    properties:
@@ -3780,6 +3786,8 @@
      pageSize:
        description: 每页大小
        type: integer
      sourceId:
        type: integer
    type: object
  request.GetSalesReturnList:
    properties:
@@ -3793,9 +3801,29 @@
      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:
@@ -3808,6 +3836,15 @@
        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:
@@ -8373,33 +8410,14 @@
      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:
@@ -9724,6 +9742,10 @@
  /api/receipt/list:
    get:
      parameters:
      - description: 客户id
        in: query
        name: clientId
        type: integer
      - description: 页码
        in: query
        name: page
@@ -9735,7 +9757,8 @@
      - in: query
        name: sourceId
        type: integer
      - enum:
      - description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
        enum:
        - 1
        - 2
        - 3
@@ -11155,25 +11178,14 @@
      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:
model/followRecord.go
@@ -71,7 +71,7 @@
                    db = db.Where(key+" LIKE ?", "%"+v+"%")
                }
                if key == "client_name" {
                if key == "name" {
                    db = db.Joins("Client").Where("Client.name LIKE ?", "%"+v+"%")
                }
model/invoice.go
@@ -53,12 +53,30 @@
    }
}
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
}
model/masterOrder.go
@@ -136,3 +136,8 @@
    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
}
model/receipt.go
@@ -88,6 +88,9 @@
    if slf.SourceId != 0 {
        db = db.Where("source_id = ?", slf.SourceId)
    }
    if slf.ClientId != 0 {
        db = db.Where("client_id = ?", slf.ClientId)
    }
    return db
}
@@ -124,6 +127,11 @@
    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
model/request/invoice.go
@@ -40,7 +40,6 @@
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服务合同)
}
model/request/receipt.go
@@ -16,6 +16,7 @@
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
}
model/request/salesDetails.go
@@ -41,4 +41,5 @@
    PageInfo
    KeywordType constvar.SalesDetailsKeywordType `json:"keywordType"`
    Keyword     string                           `json:"keyword"`
    SaleChanceId int                              `json:"saleChanceId"` //销售机会id
}
model/request/salesRefund.go
@@ -35,4 +35,5 @@
    PageInfo
    Keyword     string `json:"keyword"`
    KeywordType constvar.SalesRefundKeywordType
    SourceId    int `json:"sourceId"`
}
model/request/salesReturn.go
@@ -36,4 +36,6 @@
    PageInfo
    Keyword     string `json:"keyword"`
    KeywordType constvar.SalesReturnKeywordType
    SourceType  constvar.SalesReturnSourceType `json:"sourceType"` // 源单类型(1销售明细)
    SourceId    int                            `json:"sourceId"`   // 源单id
}
model/request/serviceContract.go
@@ -43,6 +43,10 @@
    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 {
model/salesDetails.go
@@ -71,6 +71,10 @@
        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))
@@ -121,6 +125,11 @@
    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)
model/salesReturn.go
@@ -71,7 +71,12 @@
    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").
@@ -189,6 +194,14 @@
    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()
model/serviceContract.go
@@ -126,6 +126,19 @@
            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
}
@@ -199,6 +212,26 @@
    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
model/serviceFollowup.go
@@ -41,7 +41,7 @@
        ServiceFollowup
        Orm         *gorm.DB
        KeywordType constvar.ServiceFollowupKeywordType
        Keyword     interface{}
        Keyword     string
        OrderBy     string
        PageNum     int
        PageSize    int
@@ -79,6 +79,10 @@
    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 {
@@ -125,10 +129,6 @@
    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)
    }
model/serviceOrder.go
@@ -87,10 +87,10 @@
        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.
router/invoice.go
@@ -12,6 +12,6 @@
        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)           // 获取销售发票列表
    }
}
router/serviceCollectionPlan.go
@@ -12,6 +12,6 @@
        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)           // 获取服务合同收款计划列表
    }
}
service/invoice.go
@@ -139,8 +139,8 @@
    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
    }
service/receipt.go
@@ -135,6 +135,7 @@
        SetPage(params.Page, params.PageSize).
        SetSourceType(params.SourceType).
        SetSourceId(params.SourceId).
        SetClientId(params.ClientId).
        Find()
    if err != nil {
        return nil, 0, ecode.DBErr
service/salesDetails.go
@@ -114,11 +114,12 @@
    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
service/salesRefund.go
@@ -168,11 +168,12 @@
    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 {
service/salesReturn.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/model/request"
    "aps_crm/pkg/ecode"
    "github.com/shopspring/decimal"
    "gorm.io/gorm"
@@ -123,12 +124,14 @@
    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 {
service/serviceContract.go
@@ -1,8 +1,8 @@
package service
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/model/request"
    "aps_crm/pkg/ecode"
    "github.com/shopspring/decimal"
    "gorm.io/gorm"
@@ -117,13 +117,17 @@
    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 {
service/subOrder.go
@@ -71,7 +71,7 @@
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
    }