zhangqian
2023-08-25 11af32523705ea3e550abbb7477a8f176382e6f7
Merge branch 'hotfix'
8个文件已修改
251 ■■■■ 已修改文件
api/v1/receipt.go 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/receipt.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/receipt.go 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/receipt.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/receipt.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/receipt.go
@@ -71,10 +71,10 @@
    if !ok {
        return
    }
    if params.Id == 0 {
        ctx.Fail(ecode.ParamsErr)
    }
    params.Receipt.Id = params.Id
    if params.Id == 0 {
        ctx.Fail(ecode.ParamsErr)
    }
    params.Receipt.Id = params.Id
    errCode := service.NewReceiptService().UpdateReceipt(&params.Receipt)
    if errCode != ecode.OK {
@@ -99,14 +99,14 @@
        return
    }
    receipt, total, errCode := service.NewReceiptService().GetReceiptList()
    receipt, total, errCode := service.NewReceiptService().GetReceiptList(params)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    ctx.OkWithDetailed(response.ListResponse{
        Data: receipt,
        Data:  receipt,
        Count: total,
    })
}
constvar/receipt.go
@@ -15,9 +15,9 @@
type ReceiptSourceType int //来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
const (
    ReceiptSourceTypeSalesDetails    ReceiptSourceType = 1
    ReceiptSourceTypeServiceContract ReceiptSourceType = 2
    ReceiptSourceTypeInvoice         ReceiptSourceType = 3
    ReceiptSourceTypeCollectionPlan  ReceiptSourceType = 4
    ReceiptSourceTypeChuKuDan        ReceiptSourceType = 5
    ReceiptSourceTypeSalesDetails    ReceiptSourceType = 1 //销售明细单
    ReceiptSourceTypeServiceContract ReceiptSourceType = 2 //服务合同
    ReceiptSourceTypeInvoice         ReceiptSourceType = 3 //销售发票
    ReceiptSourceTypeCollectionPlan  ReceiptSourceType = 4 //收款计划
    ReceiptSourceTypeChuKuDan        ReceiptSourceType = 5 //出库单it
)
docs/docs.go
@@ -5520,22 +5520,6 @@
                "summary": "获取收款单列表",
                "parameters": [
                    {
                        "type": "string",
                        "name": "keyword",
                        "in": "query"
                    },
                    {
                        "enum": [
                            ""
                        ],
                        "type": "string",
                        "x-enum-varnames": [
                            "ReceiptKeywordCustomerName"
                        ],
                        "name": "keywordType",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
@@ -5548,14 +5532,34 @@
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "name": "sourceId",
                        "in": "query"
                    },
                    {
                        "enum": [
                            ""
                            1,
                            2,
                            3,
                            4,
                            5
                        ],
                        "type": "string",
                        "type": "integer",
                        "x-enum-comments": {
                            "ReceiptSourceTypeChuKuDan": "出库单it",
                            "ReceiptSourceTypeCollectionPlan": "收款计划",
                            "ReceiptSourceTypeInvoice": "销售发票",
                            "ReceiptSourceTypeSalesDetails": "销售明细单",
                            "ReceiptSourceTypeServiceContract": "服务合同"
                        },
                        "x-enum-varnames": [
                            "ReceiptQueryClassExpireLessThen60Days"
                            "ReceiptSourceTypeSalesDetails",
                            "ReceiptSourceTypeServiceContract",
                            "ReceiptSourceTypeInvoice",
                            "ReceiptSourceTypeCollectionPlan",
                            "ReceiptSourceTypeChuKuDan"
                        ],
                        "name": "queryClass",
                        "name": "sourceType",
                        "in": "query"
                    }
                ],
@@ -10391,24 +10395,6 @@
                "PaymentTypeQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptKeywordType": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "ReceiptKeywordCustomerName"
            ]
        },
        "constvar.ReceiptQueryClass": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "ReceiptQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptSourceType": {
            "type": "integer",
            "enum": [
@@ -10418,6 +10404,13 @@
                4,
                5
            ],
            "x-enum-comments": {
                "ReceiptSourceTypeChuKuDan": "出库单it",
                "ReceiptSourceTypeCollectionPlan": "收款计划",
                "ReceiptSourceTypeInvoice": "销售发票",
                "ReceiptSourceTypeSalesDetails": "销售明细单",
                "ReceiptSourceTypeServiceContract": "服务合同"
            },
            "x-enum-varnames": [
                "ReceiptSourceTypeSalesDetails",
                "ReceiptSourceTypeServiceContract",
docs/swagger.json
@@ -5508,22 +5508,6 @@
                "summary": "获取收款单列表",
                "parameters": [
                    {
                        "type": "string",
                        "name": "keyword",
                        "in": "query"
                    },
                    {
                        "enum": [
                            ""
                        ],
                        "type": "string",
                        "x-enum-varnames": [
                            "ReceiptKeywordCustomerName"
                        ],
                        "name": "keywordType",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
@@ -5536,14 +5520,34 @@
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "name": "sourceId",
                        "in": "query"
                    },
                    {
                        "enum": [
                            ""
                            1,
                            2,
                            3,
                            4,
                            5
                        ],
                        "type": "string",
                        "type": "integer",
                        "x-enum-comments": {
                            "ReceiptSourceTypeChuKuDan": "出库单it",
                            "ReceiptSourceTypeCollectionPlan": "收款计划",
                            "ReceiptSourceTypeInvoice": "销售发票",
                            "ReceiptSourceTypeSalesDetails": "销售明细单",
                            "ReceiptSourceTypeServiceContract": "服务合同"
                        },
                        "x-enum-varnames": [
                            "ReceiptQueryClassExpireLessThen60Days"
                            "ReceiptSourceTypeSalesDetails",
                            "ReceiptSourceTypeServiceContract",
                            "ReceiptSourceTypeInvoice",
                            "ReceiptSourceTypeCollectionPlan",
                            "ReceiptSourceTypeChuKuDan"
                        ],
                        "name": "queryClass",
                        "name": "sourceType",
                        "in": "query"
                    }
                ],
@@ -10379,24 +10383,6 @@
                "PaymentTypeQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptKeywordType": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "ReceiptKeywordCustomerName"
            ]
        },
        "constvar.ReceiptQueryClass": {
            "type": "string",
            "enum": [
                ""
            ],
            "x-enum-varnames": [
                "ReceiptQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptSourceType": {
            "type": "integer",
            "enum": [
@@ -10406,6 +10392,13 @@
                4,
                5
            ],
            "x-enum-comments": {
                "ReceiptSourceTypeChuKuDan": "出库单it",
                "ReceiptSourceTypeCollectionPlan": "收款计划",
                "ReceiptSourceTypeInvoice": "销售发票",
                "ReceiptSourceTypeSalesDetails": "销售明细单",
                "ReceiptSourceTypeServiceContract": "服务合同"
            },
            "x-enum-varnames": [
                "ReceiptSourceTypeSalesDetails",
                "ReceiptSourceTypeServiceContract",
docs/swagger.yaml
@@ -116,18 +116,6 @@
    type: string
    x-enum-varnames:
    - PaymentTypeQueryClassExpireLessThen60Days
  constvar.ReceiptKeywordType:
    enum:
    - ""
    type: string
    x-enum-varnames:
    - ReceiptKeywordCustomerName
  constvar.ReceiptQueryClass:
    enum:
    - ""
    type: string
    x-enum-varnames:
    - ReceiptQueryClassExpireLessThen60Days
  constvar.ReceiptSourceType:
    enum:
    - 1
@@ -136,6 +124,12 @@
    - 4
    - 5
    type: integer
    x-enum-comments:
      ReceiptSourceTypeChuKuDan: 出库单it
      ReceiptSourceTypeCollectionPlan: 收款计划
      ReceiptSourceTypeInvoice: 销售发票
      ReceiptSourceTypeSalesDetails: 销售明细单
      ReceiptSourceTypeServiceContract: 服务合同
    x-enum-varnames:
    - ReceiptSourceTypeSalesDetails
    - ReceiptSourceTypeServiceContract
@@ -9450,16 +9444,6 @@
  /api/receipt/list:
    get:
      parameters:
      - in: query
        name: keyword
        type: string
      - enum:
        - ""
        in: query
        name: keywordType
        type: string
        x-enum-varnames:
        - ReceiptKeywordCustomerName
      - description: 页码
        in: query
        name: page
@@ -9468,13 +9452,30 @@
        in: query
        name: pageSize
        type: integer
      - in: query
        name: sourceId
        type: integer
      - enum:
        - ""
        - 1
        - 2
        - 3
        - 4
        - 5
        in: query
        name: queryClass
        type: string
        name: sourceType
        type: integer
        x-enum-comments:
          ReceiptSourceTypeChuKuDan: 出库单it
          ReceiptSourceTypeCollectionPlan: 收款计划
          ReceiptSourceTypeInvoice: 销售发票
          ReceiptSourceTypeSalesDetails: 销售明细单
          ReceiptSourceTypeServiceContract: 服务合同
        x-enum-varnames:
        - ReceiptQueryClassExpireLessThen60Days
        - ReceiptSourceTypeSalesDetails
        - ReceiptSourceTypeServiceContract
        - ReceiptSourceTypeInvoice
        - ReceiptSourceTypeCollectionPlan
        - ReceiptSourceTypeChuKuDan
      produces:
      - application/json
      responses:
model/receipt.go
@@ -53,11 +53,32 @@
    }
}
func (slf *ReceiptSearch) SetSourceType(sourceType constvar.ReceiptSourceType) *ReceiptSearch {
    slf.SourceType = sourceType
    return slf
}
func (slf *ReceiptSearch) SetSourceId(sourceId int) *ReceiptSearch {
    slf.SourceId = sourceId
    return slf
}
func (slf *ReceiptSearch) SetPage(page, size int) *ReceiptSearch {
    slf.PageNum, slf.PageSize = page, size
    return slf
}
func (slf *ReceiptSearch) build() *gorm.DB {
    var db = slf.Orm.Model(&Receipt{})
    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/request/receipt.go
@@ -1,8 +1,8 @@
package request
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/constvar"
    "aps_crm/model"
)
type AddReceipt struct {
@@ -16,7 +16,6 @@
type GetReceiptList struct {
    PageInfo
    QueryClass  constvar.ReceiptQueryClass  `json:"queryClass" form:"queryClass"`
    KeywordType constvar.ReceiptKeywordType `json:"keywordType"  form:"keywordType"`
    Keyword     string                       `json:"keyword" form:"keyword"`
    SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"`
    SourceId   int                        `json:"sourceId" form:"sourceId"`
}
service/receipt.go
@@ -130,8 +130,12 @@
    return ecode.OK
}
func (ReceiptService) GetReceiptList() ([]*model.Receipt, int64, int) {
    list, total, err := model.NewReceiptSearch().Find()
func (ReceiptService) GetReceiptList(params request.GetReceiptList) ([]*model.Receipt, int64, int) {
    list, total, err := model.NewReceiptSearch().
        SetPage(params.Page, params.PageSize).
        SetSourceType(params.SourceType).
        SetSourceId(params.SourceId).
        Find()
    if err != nil {
        return nil, 0, ecode.DBErr
    }