| | |
| | | StatusId: contract.StatusId, |
| | | File: contract.File, |
| | | CodeStandID: contract.CodeStandID, |
| | | ContractName: contract.ContractName, |
| | | } |
| | | |
| | | return ecode.OK, contractModel |
| | |
| | | quotationModel.File = quotation.File |
| | | quotationModel.Products = quotation.Products |
| | | quotationModel.CodeStandID = quotation.CodeStandID |
| | | quotationModel.QuotationName = quotation.QuotationName |
| | | |
| | | return ecode.OK, quotationModel |
| | | |
| | |
| | | // Quotation 报价单 |
| | | Quotation struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | QuotationName string `json:"quotationName" gorm:"column:quotation_name;type:varchar(255);comment:报价单名称"` |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:报价单号"` |
| | | QuotationStatusId int `json:"quotation_status_id" gorm:"column:quotation_status_id;type:int;comment:报价单状态id"` |
| | |
| | | } |
| | | |
| | | type Quotation struct { |
| | | QuotationName string `json:"quotationName"` //报价单名称 |
| | | ClientId int `json:"client_id"` |
| | | Number string `json:"number"` |
| | | QuotationStatusId int `json:"quotation_status_id"` |
| | |
| | | v1 "aps_crm/api/v1" |
| | | "aps_crm/conf" |
| | | _ "aps_crm/docs" |
| | | "aps_crm/middleware" |
| | | "fmt" |
| | | "github.com/gin-contrib/cors" |
| | | "github.com/gin-gonic/gin" |
| | |
| | | |
| | | PrivateGroup := Router.Group("api") |
| | | //PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler()) |
| | | PrivateGroup.Use(middleware.JWTAuth2()) |
| | | //PrivateGroup.Use(middleware.JWTAuth2()) |
| | | //PrivateGroup.Use(middleware.CasbinHandler()) |
| | | { |
| | | routerGroup.InitJwtRouter(PrivateGroup) // jwt相关路由 |
| | | //routerGroup.InitJwtRouter(PrivateGroup) // jwt相关路由 |
| | | //routerGroup.InitUserRouter(PrivateGroup) // 注册用户路由 |
| | | routerGroup.InitCountryRouter(PrivateGroup) // 注册country路由 |
| | | routerGroup.InitProvinceRouter(PrivateGroup) // 注册province路由 |
| | |
| | | type QuotationService struct{} |
| | | |
| | | func (QuotationService) AddQuotation(quotation *model.Quotation) int { |
| | | //根据销售机会id去查询客户id |
| | | if quotation.ClientId == 0 { |
| | | record, err := model.NewSaleChanceSearch().SetId(quotation.SaleChanceId).Find() |
| | | if err != nil { |
| | | return ecode.SaleChanceNotExist |
| | | } |
| | | quotation.ClientId = record.ClientId |
| | | quotation.ContactId = record.ContactId |
| | | } |
| | | err := model.NewQuotationSearch(nil).Create(quotation) |
| | | if err != nil { |
| | | return ecode.QuotationExist |