| | |
| | | import ( |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | | |
| | | type CollectionProjectionApi struct{} |
| | |
| | | |
| | | tmp := new(model.CollectionProjection) |
| | | tmp.EstimatedCollectionAmount = params.CollectionProjection.EstimatedCollectionAmount |
| | | tmp.EstimatedCollectionDate = params.CollectionProjection.EstimatedCollectionTime |
| | | tmp.SaleChanceId = params.CollectionProjection.SaleChanceId |
| | | |
| | | if params.EstimatedCollectionTime == "" { |
| | | tmp.EstimatedCollectionDate = nil |
| | | } else { |
| | | tmp.EstimatedCollectionDate = ¶ms.CollectionProjection.EstimatedCollectionTime |
| | | } |
| | | |
| | | tmp.SaleChanceId = params.SaleChanceId |
| | | |
| | | errCode := collectionProjectionService.AddCollectionProjection(tmp) |
| | | if errCode != ecode.OK { |
| | |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags CollectionProjection |
| | | // @Summary 删除收款预测 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/collectionProjection/delete/{id} [delete] |
| | | func (cp *CollectionProjectionApi) Delete(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | id, err := strconv.Atoi(c.Param("id")) |
| | | if err != nil { |
| | | ctx.Fail(ecode.InvalidParams) |
| | | return |
| | | } |
| | | |
| | | errCode := collectionProjectionService.DeleteCollectionProjection(id) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags CollectionProjection |
| | | // @Summary 更新收款预测 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateCollectionProjection true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/collectionProjection/update [put] |
| | | func (cp *CollectionProjectionApi) Update(c *gin.Context) { |
| | | var params request.UpdateCollectionProjection |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | tmp := new(model.CollectionProjection) |
| | | tmp.EstimatedCollectionAmount = params.CollectionProjection.EstimatedCollectionAmount |
| | | tmp.Id = params.Id |
| | | |
| | | if params.EstimatedCollectionTime == "" { |
| | | tmp.EstimatedCollectionDate = nil |
| | | } else { |
| | | tmp.EstimatedCollectionDate = ¶ms.CollectionProjection.EstimatedCollectionTime |
| | | } |
| | | |
| | | errCode := collectionProjectionService.UpdateCollectionProjection(tmp) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags CollectionProjection |
| | | // @Summary 获取收款预测列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetCollectionProjectionList true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/collectionProjection/list [post] |
| | | func (cp *CollectionProjectionApi) List(c *gin.Context) { |
| | | var params request.GetCollectionProjectionList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | total, errCode, list := collectionProjectionService.GetCollectionProjectionList(params.Page, params.PageSize) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.CollectionProjectionListResponse{ |
| | | List: list, |
| | | Count: int(total), |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "删除收款预测", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/list": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "获取收款预测列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "更新收款预测", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCollectionProjection" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/contact/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCollectionProjection": { |
| | | "type": "object", |
| | | "properties": { |
| | | "estimated_collection_amount": { |
| | | "description": "预计收款金额", |
| | | "type": "number" |
| | | }, |
| | | "estimated_collection_time": { |
| | | "description": "预计收款时间", |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateContact": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "删除收款预测", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "查询参数", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/list": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "获取收款预测列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/collectionProjection/update": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "CollectionProjection" |
| | | ], |
| | | "summary": "更新收款预测", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCollectionProjection" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/contact/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCollectionProjection": { |
| | | "type": "object", |
| | | "properties": { |
| | | "estimated_collection_amount": { |
| | | "description": "预计收款金额", |
| | | "type": "number" |
| | | }, |
| | | "estimated_collection_time": { |
| | | "description": "预计收款时间", |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateContact": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | required: |
| | | - client_types |
| | | type: object |
| | | request.UpdateCollectionProjection: |
| | | properties: |
| | | estimated_collection_amount: |
| | | description: 预计收款金额 |
| | | type: number |
| | | estimated_collection_time: |
| | | description: 预计收款时间 |
| | | type: string |
| | | id: |
| | | type: integer |
| | | type: object |
| | | request.UpdateContact: |
| | | properties: |
| | | birthday: |
| | |
| | | summary: 添加收款预测 |
| | | tags: |
| | | - CollectionProjection |
| | | /api/collectionProjection/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: |
| | | - CollectionProjection |
| | | /api/collectionProjection/list: |
| | | post: |
| | | parameters: |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 获取收款预测列表 |
| | | tags: |
| | | - CollectionProjection |
| | | /api/collectionProjection/update: |
| | | put: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateCollectionProjection' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新收款预测 |
| | | tags: |
| | | - CollectionProjection |
| | | /api/contact/add: |
| | | post: |
| | | parameters: |
| | |
| | | SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"` |
| | | Creator int `json:"creator" gorm:"column:creator;type:int(11);comment:创建人"` |
| | | Modifier int `json:"modifier" gorm:"column:modifier;type:int(11);comment:修改人"` |
| | | EstimatedCollectionDate string `json:"estimated_collection_date" gorm:"column:estimated_collection_date;type:datetime;comment:预计收款日期"` |
| | | EstimatedCollectionDate *string `json:"estimated_collection_date" gorm:"column:estimated_collection_date;type:datetime;comment:预计收款日期"` |
| | | EstimatedCollectionAmount float64 `json:"estimated_collection_amount" gorm:"column:estimated_collection_amount;type:decimal(10,2);comment:预计收款金额"` |
| | | gorm.Model |
| | | } |
| | |
| | | return |
| | | } |
| | | |
| | | func (slf *CollectionProjectionSearch) Find() (record CollectionProjection, err error) { |
| | | func (slf *CollectionProjectionSearch) Find() (int64, error, []*CollectionProjection) { |
| | | var db = slf.build() |
| | | err = db.First(&record).Error |
| | | return |
| | | var records = make([]*CollectionProjection, 0) |
| | | var total int64 |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return total, err, records |
| | | } |
| | | if slf.PageNum > 0 && slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | |
| | | err := db.Find(&records).Error |
| | | return total, err, records |
| | | } |
| | | |
| | | func (slf *CollectionProjectionSearch) SetID(id int) *CollectionProjectionSearch { |
| | |
| | | Repository{}, |
| | | QuotationStatus{}, |
| | | Currency{}, |
| | | CollectionProjection{}, |
| | | ) |
| | | return err |
| | | } |
| | |
| | | |
| | | type AddCollectionProjection struct { |
| | | CollectionProjection |
| | | SaleChanceId int `json:"sale_chance_id"` // 销售机会id |
| | | } |
| | | |
| | | type CollectionProjection struct { |
| | | EstimatedCollectionAmount float64 `json:"estimated_collection_amount"` // 预计收款金额 |
| | | EstimatedCollectionTime string `json:"estimated_collection_time"` // 预计收款时间 |
| | | SaleChanceId int `json:"sale_chance_id"` // 销售机会id |
| | | } |
| | | |
| | | type UpdateCollectionProjection struct { |
| | | Id int `json:"id"` |
| | | CollectionProjection |
| | | } |
| | | |
| | | type GetCollectionProjectionList struct { |
| | | PageInfo |
| | | } |
| | |
| | | CurrencyResponse struct { |
| | | List []*model.Currency `json:"list"` |
| | | } |
| | | |
| | | CollectionProjectionListResponse struct { |
| | | List []*model.CollectionProjection `json:"list"` |
| | | Count int `json:"count"` |
| | | } |
| | | ) |
| | |
| | | |
| | | type ( |
| | | SaleChance struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:公司名称"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售线索编号"` |
| | | ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人ID"` |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户ID"` |
| | | SalesSourcesId int `json:"sales_sources_id" gorm:"column:sales_sources_id;type:int(11);comment:商机来源ID"` |
| | | SaleTypeId int `json:"sale_type_id" gorm:"column:sale_type_id;type:int(11);comment:商机类型ID"` |
| | | SaleStageId int `json:"sale_stage_id" gorm:"column:sale_stage_id;type:int(11);comment:商机阶段ID"` |
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:销售负责人ID"` |
| | | RegularCustomersId int `json:"regular_customers_id" gorm:"column:regular_customers_id;type:int(11);comment:常客ID"` |
| | | Competitors string `json:"competitors" gorm:"column:competitors;type:varchar(255);comment:竞争对手"` |
| | | PossibilitiesId int `json:"possibilities_id" gorm:"column:possibilities_id;type:int(11);comment:可能性ID"` |
| | | Budget float64 `json:"budget" gorm:"column:budget;type:decimal(10,2);comment:预算"` |
| | | ProjectedAmount float64 `json:"projected_amount" gorm:"column:projected_amount;type:decimal(10,2);comment:预计金额"` |
| | | Currency int `json:"currency" gorm:"column:currency;type:int(11);comment:币种"` |
| | | ExpectedTime time.Time `json:"expected_time" gorm:"column:expected_time;type:datetime;comment:预计成交时间"` |
| | | StatusId int `json:"status_id" gorm:"column:status_id;type:int(11);comment:状态ID"` |
| | | PainPoints string `json:"pain_points" gorm:"column:pain_points;type:text;comment:痛点"` |
| | | WhetherEstablished string `json:"whether_established" gorm:"column:whether_established;type:text;comment:是否成立"` |
| | | CapitalBudget string `json:"capital_budget" gorm:"column:capital_budget;type:text;comment:资金预算"` |
| | | KeyMaker string `json:"key_maker" gorm:"column:key_maker;type:text;comment:关键人"` |
| | | KeyFactors string `json:"key_factors" gorm:"column:key_factors;type:text;comment:关键因素"` |
| | | Process string `json:"process" gorm:"column:process;type:text;comment:决策流程"` |
| | | Solutions string `json:"solutions" gorm:"column:solutions;type:text;comment:竞争对手解决方案"` |
| | | Advantages string `json:"advantages" gorm:"column:advantages;type:text;comment:竞争优势"` |
| | | Disadvantages string `json:"disadvantages" gorm:"column:disadvantages;type:text;comment:竞争劣势"` |
| | | Opportunities string `json:"opportunities" gorm:"column:opportunities;type:text;comment:竞争机会"` |
| | | Threats string `json:"threats" gorm:"column:threats;type:text;comment:竞争威胁"` |
| | | DetailAddress string `json:"detail_address" gorm:"column:detail_address;type:text;comment:详细地址"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Contact Contact `json:"contact" gorm:"foreignKey:ContactId;references:Id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId;references:Id"` |
| | | SalesSources SalesSources |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:公司名称"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:销售线索编号"` |
| | | ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人ID"` |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户ID"` |
| | | SalesSourcesId int `json:"sales_sources_id" gorm:"column:sales_sources_id;type:int(11);comment:商机来源ID"` |
| | | SaleTypeId int `json:"sale_type_id" gorm:"column:sale_type_id;type:int(11);comment:商机类型ID"` |
| | | SaleStageId int `json:"sale_stage_id" gorm:"column:sale_stage_id;type:int(11);comment:商机阶段ID"` |
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:销售负责人ID"` |
| | | RegularCustomersId int `json:"regular_customers_id" gorm:"column:regular_customers_id;type:int(11);comment:常客ID"` |
| | | Competitors string `json:"competitors" gorm:"column:competitors;type:varchar(255);comment:竞争对手"` |
| | | PossibilitiesId int `json:"possibilities_id" gorm:"column:possibilities_id;type:int(11);comment:可能性ID"` |
| | | Budget float64 `json:"budget" gorm:"column:budget;type:decimal(10,2);comment:预算"` |
| | | ProjectedAmount float64 `json:"projected_amount" gorm:"column:projected_amount;type:decimal(10,2);comment:预计金额"` |
| | | Currency int `json:"currency" gorm:"column:currency;type:int(11);comment:币种"` |
| | | ExpectedTime time.Time `json:"expected_time" gorm:"column:expected_time;type:datetime;comment:预计成交时间"` |
| | | StatusId int `json:"status_id" gorm:"column:status_id;type:int(11);comment:状态ID"` |
| | | PainPoints string `json:"pain_points" gorm:"column:pain_points;type:text;comment:痛点"` |
| | | WhetherEstablished string `json:"whether_established" gorm:"column:whether_established;type:text;comment:是否成立"` |
| | | CapitalBudget string `json:"capital_budget" gorm:"column:capital_budget;type:text;comment:资金预算"` |
| | | KeyMaker string `json:"key_maker" gorm:"column:key_maker;type:text;comment:关键人"` |
| | | KeyFactors string `json:"key_factors" gorm:"column:key_factors;type:text;comment:关键因素"` |
| | | Process string `json:"process" gorm:"column:process;type:text;comment:决策流程"` |
| | | Solutions string `json:"solutions" gorm:"column:solutions;type:text;comment:竞争对手解决方案"` |
| | | Advantages string `json:"advantages" gorm:"column:advantages;type:text;comment:竞争优势"` |
| | | Disadvantages string `json:"disadvantages" gorm:"column:disadvantages;type:text;comment:竞争劣势"` |
| | | Opportunities string `json:"opportunities" gorm:"column:opportunities;type:text;comment:竞争机会"` |
| | | Threats string `json:"threats" gorm:"column:threats;type:text;comment:竞争威胁"` |
| | | DetailAddress string `json:"detail_address" gorm:"column:detail_address;type:text;comment:详细地址"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Contact Contact `json:"contact" gorm:"foreignKey:ContactId;references:Id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId;references:Id"` |
| | | CollectionProjections []CollectionProjection `json:"collection_projections" gorm:"foreignKey:SaleChanceId"` |
| | | SalesSources SalesSources |
| | | Address |
| | | gorm.Model `json:"-"` |
| | | } |
| | |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) |
| | | } |
| | | |
| | | err := db.Preload("Client").Preload("Contact").Find(&records).Error |
| | | err := db.Preload("CollectionProjections").Preload("Client").Preload("Contact").Find(&records).Error |
| | | return records, total, err |
| | | } |
| | | |
| | |
| | | func (slf *SaleChanceSearch) SetOrder(order string) *SaleChanceSearch { |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | } |
| | |
| | | collectionProjectionRouter := router.Group("collectionProjection") |
| | | collectionProjectionApi := v1.ApiGroup.CollectionProjectionApi |
| | | { |
| | | collectionProjectionRouter.POST("add", collectionProjectionApi.Add) // 添加收款预测 |
| | | //collectionProjectionRouter.DELETE("delete", collectionProjectionApi.Delete) // 删除收款预测 |
| | | //collectionProjectionRouter.PUT("update", collectionProjectionApi.Update) // 更新收款预测 |
| | | //collectionProjectionRouter.POST("list", collectionProjectionApi.List) // 获取收款预测列表 |
| | | collectionProjectionRouter.POST("add", collectionProjectionApi.Add) // 添加收款预测 |
| | | collectionProjectionRouter.DELETE("delete/:id", collectionProjectionApi.Delete) // 删除收款预测 |
| | | collectionProjectionRouter.PUT("update", collectionProjectionApi.Update) // 更新收款预测 |
| | | collectionProjectionRouter.POST("list", collectionProjectionApi.List) // 获取收款预测列表 |
| | | } |
| | | } |
| | |
| | | InitInvoiceTypeRouter(PrivateGroup) |
| | | InitCourierCompanyRouter(PrivateGroup) |
| | | InitProductRouter(PrivateGroup) |
| | | InitServiceCollectionPlanRouter(PrivateGroup) |
| | | routerGroup.InitCollectionProjectionRouter(PrivateGroup) |
| | | } |
| | | return Router |
| | | } |
| | |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CollectionProjectionService) UpdateCollectionProjection(collectionProjection *model.CollectionProjection) int { |
| | | err := model.NewCollectionProjectionSearch().SetID(collectionProjection.Id).Update(collectionProjection) |
| | | if err != nil { |
| | | return ecode.CollectionProjectionUpdateErr |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CollectionProjectionService) DeleteCollectionProjection(id int) int { |
| | | err := model.NewCollectionProjectionSearch().SetID(id).Delete() |
| | | if err != nil { |
| | | return ecode.CollectionProjectionNotExist |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CollectionProjectionService) GetCollectionProjectionList(page, pageSize int) (int64, int, []*model.CollectionProjection) { |
| | | |
| | | total, err, list := model.NewCollectionProjectionSearch().SetPage(page, pageSize).Find() |
| | | if err != nil { |
| | | return total, ecode.CollectionProjectionListErr, list |
| | | } |
| | | |
| | | return total, ecode.OK, list |
| | | } |