diff --git a/app/api/enterprise/api/identity.go b/app/api/enterprise/api/identity.go index 0be78a3..8089b74 100644 --- a/app/api/enterprise/api/identity.go +++ b/app/api/enterprise/api/identity.go @@ -9,6 +9,7 @@ import ( type Identity struct{} +// Expert 专家信息 func (*Identity) Expert(c *gin.Context) { form := &struct { Name string `json:"name" form:"name"` @@ -23,3 +24,7 @@ func (*Identity) Expert(c *gin.Context) { Expert(form.Name, form.Mobile, form.Page, form.PageSize) api.APIResponse(err, data)(c) } + +func (*Identity) Company(c *gin.Context) { + +} diff --git a/app/api/enterprise/api/menu.go b/app/api/enterprise/api/menu.go deleted file mode 100644 index 32e9bb9..0000000 --- a/app/api/enterprise/api/menu.go +++ /dev/null @@ -1,9 +0,0 @@ -package api - -import "github.com/gin-gonic/gin" - -type Menu struct{} - -func (*Menu) Menu(c *gin.Context) { - -} diff --git a/app/api/enterprise/api/technology.go b/app/api/enterprise/api/technology.go index 9cf3bda..8d409ef 100644 --- a/app/api/enterprise/api/technology.go +++ b/app/api/enterprise/api/technology.go @@ -28,9 +28,9 @@ type ( Prototype int `json:"prototype" form:"prototype"` Source int `json:"source" form:"source"` Transaction int `json:"transaction" form:"transaction"` - Status int `json:"status" form:"status"` Products []string `json:"products" form:"products"` Keywords []string `json:"keywords" form:"keywords"` + IsSubmit int `json:"is_submit" form:"is_submit"` } // paperForm 论文参数 paperForm struct { @@ -95,12 +95,35 @@ type ( Research string `json:"research" form:"research" binding:"required"` Describe string `json:"describe" form:"describe"` } + // productForm 产品参数 + productForm struct { + Title string `json:"title" form:"title" binding:"required"` + api.ImageForm + Video string `json:"video" form:"video"` + Material string `json:"material" form:"material"` + Industrys []string `json:"industrys" form:"industrys"` + Customers []string `json:"customers" form:"customers"` + Maturity int `json:"maturity" form:"maturity"` + LeadStandard int `json:"lead_standard" form:"lead_standard"` + CooperationMode int `json:"cooperation_mode" form:"cooperation_mode"` + Keywords []string `json:"keywords" form:"keywords"` + Introduce string `json:"introduce" form:"introduce"` + IsSubmit int `json:"is_submit" form:"is_submit"` + } ) func (a *instanceForm) FilterProveImages() string { return strings.Replace(a.ProveImages, config2.SettingInfo.Domain, "", -1) } +func (a *productForm) FilterVideo() string { + return (&api.ImageForm{Image: a.Video}).FilterImageURL() +} + +func (a *productForm) FilterMaterial() string { + return (&api.ImageForm{Image: a.Material}).FilterImageURL() +} + func (a *Technology) Instance(c *gin.Context) { form := &struct { Status int `json:"status" form:"status"` @@ -127,7 +150,7 @@ func (a *Technology) InstanceAdd(c *gin.Context) { PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company, Images: form.FilterImageURL(), ProveImages: form.FilterProveImages(), Introduce: form.Introduce, Purpose: form.Purpose, Remark: form.Remark, Maturity: form.Maturity, Prototype: form.Prototype, Source: form.Source, - Transaction: form.Transaction, Status: form.Status, Products: form.Products, Keywords: form.Keywords, + Transaction: form.Transaction, Products: form.Products, Keywords: form.Keywords, IsSubmit: form.IsSubmit, }) api.APIResponse(err)(c) } @@ -147,7 +170,7 @@ func (a *Technology) InstanceEdit(c *gin.Context) { PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company, Images: form.FilterImageURL(), ProveImages: form.FilterProveImages(), Introduce: form.Introduce, Purpose: form.Purpose, Remark: form.Remark, Maturity: form.Maturity, Prototype: form.Prototype, Source: form.Source, - Transaction: form.Transaction, Status: form.Status, Products: form.Products, Keywords: form.Keywords, + Transaction: form.Transaction, Products: form.Products, Keywords: form.Keywords, }) api.APIResponse(err)(c) } @@ -509,3 +532,80 @@ func (a *Technology) EquipmentDelete(c *gin.Context) { Delete(form.Convert()) api.APIResponse(err)(c) } + +func (*Technology) Product(c *gin.Context) { + form := &struct { + Title string `json:"title" form:"title"` + Status int `json:"status" form:"status"` + api.PageForm + }{} + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)). + List(form.Title, form.Status, form.Page, form.PageSize) + api.APIResponse(err, data)(c) +} + +func (*Technology) ProductAdd(c *gin.Context) { + form := new(productForm) + + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)). + Form(&technology2.ProductParams{ + Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(), + Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys, + Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode, + Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit, + }) + api.APIResponse(err)(c) +} + +func (*Technology) ProductEdit(c *gin.Context) { + form := &struct { + api.IDStringForm + productForm + }{} + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)). + Form(&technology2.ProductParams{ + ID: form.Convert(), Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(), + Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys, + Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode, + Customers: form.Customers, Keywords: form.Keywords, + }) + api.APIResponse(err)(c) +} + +func (*Technology) ProductShelf(c *gin.Context) { + form := &struct { + api.IDStringForm + Status int `json:"status" form:"status" binding:"required"` + }{} + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)). + Shelf(form.Convert(), form.Status) + api.APIResponse(err)(c) +} + +func (*Technology) ProductDelete(c *gin.Context) { + form := new(api.IDStringForm) + + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)). + Delete(form.Convert()) + api.APIResponse(err)(c) +} diff --git a/app/api/enterprise/controller/menu/instance.go b/app/api/enterprise/controller/menu/instance.go deleted file mode 100644 index 5a78e54..0000000 --- a/app/api/enterprise/controller/menu/instance.go +++ /dev/null @@ -1,19 +0,0 @@ -package menu - -import "SciencesServer/app/service" - -type Instance struct { - *service.SessionEnterprise -} - -type InstanceHandle func(enterprise *service.SessionEnterprise) *Instance - -func (c *Instance) List() { - -} - -func NewInstance() InstanceHandle { - return func(enterprise *service.SessionEnterprise) *Instance { - return &Instance{enterprise} - } -} diff --git a/app/api/enterprise/controller/technology/demand.go b/app/api/enterprise/controller/technology/demand.go index 04d69e1..eba5216 100644 --- a/app/api/enterprise/controller/technology/demand.go +++ b/app/api/enterprise/controller/technology/demand.go @@ -113,7 +113,7 @@ func (c *Demand) Form(params *DemandParams) error { if params.ID > 0 { mTechnologyDemand.ID = params.ID - isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "uid", "status"}) + isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "m_uid", "status"}) if err != nil { return err @@ -166,7 +166,7 @@ func (c *Demand) Delete(id uint64) error { mTechnologyDemand := model.NewTechnologyDemand() mTechnologyDemand.ID = id - isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "uid", "status"}) + isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "m_uid", "status"}) if err != nil { return err diff --git a/app/api/enterprise/controller/technology/equipment.go b/app/api/enterprise/controller/technology/equipment.go index 9b2fe40..d0037e4 100644 --- a/app/api/enterprise/controller/technology/equipment.go +++ b/app/api/enterprise/controller/technology/equipment.go @@ -8,6 +8,7 @@ import ( "errors" ) +// Equipment 技术设备 type Equipment struct { *session.Enterprise local string diff --git a/app/api/enterprise/controller/technology/instance.go b/app/api/enterprise/controller/technology/instance.go index 21359c3..826a952 100644 --- a/app/api/enterprise/controller/technology/instance.go +++ b/app/api/enterprise/controller/technology/instance.go @@ -3,6 +3,7 @@ package technology import ( "SciencesServer/app/api/enterprise/model" "SciencesServer/app/api/manage/controller" + "SciencesServer/app/basic/config" model2 "SciencesServer/app/common/model" "SciencesServer/app/session" "errors" @@ -29,8 +30,9 @@ type ( InstanceParams struct { ID, PatentID, Territory uint64 Title, Company, Images, ProveImages, Introduce, Purpose, Remark string - Maturity, Prototype, Source, Transaction, Status int + Maturity, Prototype, Source, Transaction int Products, Keywords []string + IsSubmit int } ) @@ -66,7 +68,7 @@ func (c *Instance) Form(params *InstanceParams) error { if params.ID > 0 { mTechnologyInstance.ID = params.ID - isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", + isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid", "status", "created_at", "updated_at"}) if err != nil { @@ -83,7 +85,7 @@ func (c *Instance) Form(params *InstanceParams) error { mTechnologyInstance.PatentID = params.PatentID mTechnologyInstance.Title = params.Title mTechnologyInstance.Company = params.Company - mTechnologyInstance.Maturity = model2.TechnologyInstanceMaturity(params.Maturity) + mTechnologyInstance.Maturity = config.TechnologyMaturity(params.Maturity) mTechnologyInstance.Prototype = params.Prototype mTechnologyInstance.SetProductAttribute(params.Products) mTechnologyInstance.Source = model2.TechnologyInstanceSource(params.Source) @@ -95,20 +97,22 @@ func (c *Instance) Form(params *InstanceParams) error { mTechnologyInstance.Introduce = params.Introduce mTechnologyInstance.Purpose = params.Purpose mTechnologyInstance.Remark = params.Remark - mTechnologyInstance.Status = model2.TechnologyInstanceStatus(params.Status) if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft && mTechnologyInstance.Status != model2.TechnologyInstanceStatusForExamining { return errors.New("操作错误,状态参数错误") } if params.ID > 0 { - mTechnologyInstance.UpdatedAt = time.Now() + mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance) } mTechnologyInstance.MUid = c.ManageUID mTechnologyInstance.Local.Local = c.local mTechnologyInstance.TenantID = c.TenantID + if params.IsSubmit > 0 { + mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining + } return model2.Create(mTechnologyInstance.TechnologyInstance) } @@ -116,7 +120,7 @@ func (c *Instance) Form(params *InstanceParams) error { func (c *Instance) Shelf(id uint64, status int) error { mTechnologyInstance := model.NewTechnologyInstance() mTechnologyInstance.ID = id - isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", "shelf_status", "status"}) + isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid", "shelf_status", "status"}) if err != nil { return err @@ -141,7 +145,7 @@ func (c *Instance) Shelf(id uint64, status int) error { func (c *Instance) Delete(id uint64) error { mTechnologyInstance := model.NewTechnologyInstance() mTechnologyInstance.ID = id - isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid"}) + isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid"}) if err != nil { return err diff --git a/app/api/enterprise/controller/technology/patent.go b/app/api/enterprise/controller/technology/patent.go index b8953fe..9edde9a 100644 --- a/app/api/enterprise/controller/technology/patent.go +++ b/app/api/enterprise/controller/technology/patent.go @@ -97,7 +97,7 @@ func (c *Patent) Form(params *PatentParams) error { if params.ID > 0 { mTechnologyPatent.ID = params.ID - isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "uid"}) + isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "m_uid"}) if err != nil { return err diff --git a/app/api/enterprise/controller/technology/product.go b/app/api/enterprise/controller/technology/product.go new file mode 100644 index 0000000..9ff2154 --- /dev/null +++ b/app/api/enterprise/controller/technology/product.go @@ -0,0 +1,193 @@ +package technology + +import ( + "SciencesServer/app/api/enterprise/model" + "SciencesServer/app/basic/config" + model2 "SciencesServer/app/common/model" + "SciencesServer/app/session" + "errors" + "time" +) + +// Product 产品信息 +type Product struct { + *session.Enterprise + local string +} + +type ProductHandle func(session *session.Enterprise, local string) *Product + +type ( + // ProductInfo 产品信息 + ProductInfo struct { + ID string `json:"id"` + *model2.TechnologyProduct + } + ProductDetailInfo struct { + ID string `json:"id"` + *model2.TechnologyProduct + Customers []string `json:"customers"` + Keywords []string `json:"keywords"` + } + // ProductParams 产品参数信息 + ProductParams struct { + ID uint64 + Title, Image, Video, Material, Introduce string + Maturity, LeadStandard, CooperationMode int // 技术成熟度 领先标准 合作模式 + Industrys, Customers, Keywords []string // 所属客户 关键词 + IsSubmit int // 是否提交审核 + } +) + +// List 列表信息 +func (c *Product) List(title string, status, page, pageSize int) ([]*ProductInfo, error) { + mTechnologyProduct := model.NewTechnologyProduct() + + where := []*model2.ModelWhereOrder{ + &model2.ModelWhereOrder{ + Where: model2.NewWhere("local", c.local), + Order: model2.NewOrder("id", model2.OrderModeToDesc), + }, + &model2.ModelWhereOrder{ + Where: model2.NewWhere("m_uid", c.ManageUID), + }, + &model2.ModelWhereOrder{ + Where: model2.NewWhere("status", status), + }, + } + if title != "" { + where = append(where, &model2.ModelWhereOrder{ + Where: model2.NewWhereLike("title", title), + }) + } + out := make([]*model2.TechnologyProduct, 0) + + var count int64 + + if err := model2.PagesFields(mTechnologyProduct.TechnologyProduct, &out, []string{}, + page, pageSize, &count, where...); err != nil { + return nil, err + } + list := make([]*ProductInfo, 0) + + for _, v := range out { + list = append(list, &ProductInfo{ + ID: v.GetEncodeID(), + TechnologyProduct: v, + }) + } + return list, nil +} + +// Detail 产品详情 +func (c *Product) Detail(id uint64) (*ProductDetailInfo, error) { + mTechnologyProduct := model.NewTechnologyProduct() + mTechnologyProduct.ID = id + + isExist, err := model2.First(mTechnologyProduct.TechnologyProduct) + + if err != nil { + return nil, err + } else if !isExist { + return nil, errors.New("操作错误,产品信息不存在或已被删除") + } + return &ProductDetailInfo{ + ID: mTechnologyProduct.GetEncodeID(), + TechnologyProduct: mTechnologyProduct.TechnologyProduct, + Customers: mTechnologyProduct.GetCustomerAttribute(), + Keywords: mTechnologyProduct.GetKeywordAttribute(), + }, nil +} + +// Form 数据操作 +func (c *Product) Form(params *ProductParams) error { + mTechnologyProduct := model.NewTechnologyProduct() + + if params.ID > 0 { + mTechnologyProduct.ID = params.ID + + isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid", "status", "created_at", "updated_at"}) + + if err != nil { + return err + } else if !isExist { + return errors.New("操作错误,产品信息不存在或已被删除") + } else if mTechnologyProduct.MUid != c.ManageUID { + return errors.New("无权限操作") + } else if mTechnologyProduct.Status != model2.TechnologyProductStatusForRefuse && + mTechnologyProduct.Status != model2.TechnologyProductStatusForDraft { + return errors.New("操作错误,当前状态不允许修改") + } + } + mTechnologyProduct.Title = params.Title + mTechnologyProduct.Image.Image = params.Image + mTechnologyProduct.Video = params.Video + mTechnologyProduct.Material = params.Material + mTechnologyProduct.SetIndustryAttribute(params.Industrys) + mTechnologyProduct.SetCustomerAttribute(params.Customers) + mTechnologyProduct.Maturity = config.TechnologyMaturity(params.Maturity) + mTechnologyProduct.LeadStandard = model2.TechnologyProductLeadStandard(params.LeadStandard) + mTechnologyProduct.CooperationMode = config.TechnologyCooperationMode(params.CooperationMode) + mTechnologyProduct.SetKeywordAttribute(params.Keywords) + mTechnologyProduct.Introduce = params.Introduce + + if mTechnologyProduct.ID > 0 { + mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining + return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct) + } + mTechnologyProduct.TenantID = c.TenantID + mTechnologyProduct.Local.Local = c.local + mTechnologyProduct.MUid = c.UID + + if params.IsSubmit > 0 { + mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining + } + return model2.Create(mTechnologyProduct.TechnologyProduct) +} + +// Shelf 上下架 +func (c *Product) Shelf(id uint64, status int) error { + mTechnologyProduct := model.NewTechnologyProduct() + mTechnologyProduct.ID = id + + isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid", "status"}) + + if err != nil { + return err + } else if !isExist { + return errors.New("操作错误,产品信息不存在或已被删除") + } else if mTechnologyProduct.MUid != c.ManageUID { + return errors.New("无权限操作") + } else if mTechnologyProduct.ShelfStatus.ShelfStatus == model2.ShelfStatusKind(status) { + return errors.New("操作错误,无需变更上下架状态") + } + return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{ + "shelf_status": status, "updated_at": time.Now(), + }) +} + +// Delete 删除操作 +func (c *Product) Delete(id uint64) error { + mTechnologyProduct := model.NewTechnologyProduct() + mTechnologyProduct.ID = id + + isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid"}) + + if err != nil { + return err + } else if !isExist { + return errors.New("操作错误,产品信息不存在或已被删除") + } else if mTechnologyProduct.MUid != c.ManageUID { + return errors.New("无权限操作") + } + return model2.Delete(mTechnologyProduct.TechnologyProduct) +} + +func NewProduct() ProductHandle { + return func(session *session.Enterprise, local string) *Product { + return &Product{ + Enterprise: session, + local: local, + } + } +} diff --git a/app/api/enterprise/controller/technology/topic.go b/app/api/enterprise/controller/technology/topic.go index b9ed93d..57d2bba 100644 --- a/app/api/enterprise/controller/technology/topic.go +++ b/app/api/enterprise/controller/technology/topic.go @@ -94,7 +94,7 @@ func (c *Topic) Form(params *TopicParams) error { if params.ID > 0 { mTechnologyTopic.ID = params.ID - isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "uid", "status"}) + isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "m_uid", "status"}) if err != nil { return err @@ -133,7 +133,7 @@ func (c *Topic) Delete(id uint64) error { mTechnologyTopic := model.NewTechnologyTopic() mTechnologyTopic.ID = id - isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "uid", "status"}) + isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "m_uid", "status"}) if err != nil { return err diff --git a/app/api/enterprise/model/technology_product.go b/app/api/enterprise/model/technology_product.go new file mode 100644 index 0000000..82d3c1b --- /dev/null +++ b/app/api/enterprise/model/technology_product.go @@ -0,0 +1,11 @@ +package model + +import "SciencesServer/app/common/model" + +type TechnologyProduct struct { + *model.TechnologyProduct +} + +func NewTechnologyProduct() *TechnologyProduct { + return &TechnologyProduct{model.NewTechnologyProduct()} +} diff --git a/app/api/manage/api/manage.go b/app/api/manage/api/manage.go index fd90fd6..c9cb08c 100644 --- a/app/api/manage/api/manage.go +++ b/app/api/manage/api/manage.go @@ -3,18 +3,41 @@ package api import ( "SciencesServer/app/api/manage/controller/manage" "SciencesServer/app/basic/api" + "SciencesServer/app/basic/config" "SciencesServer/app/service" "github.com/gin-gonic/gin" ) type Manage struct{} +type ( + // manageExamineForm 审核处理 + manageExamineForm struct { + api.IDStringForm + Identity int + Status int `json:"status" form:"status" binding:"required"` + } +) + +// handle 审核处理 +func (a *manageExamineForm) handle(session *service.Session, local string) error { + return manage.NewExamine()(session, local).Launch(a.Convert(), a.Identity, a.Status) +} + func (*Manage) Company(c *gin.Context) { } func (*Manage) CompanyExamine(c *gin.Context) { + form := new(manageExamineForm) + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + form.Identity = config.TenantUserIdentityForCompany + err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)) + api.APIResponse(err) } func (*Manage) Expert(c *gin.Context) { @@ -33,28 +56,61 @@ func (*Manage) Expert(c *gin.Context) { } func (*Manage) ExpertExamine(c *gin.Context) { + form := new(manageExamineForm) + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + form.Identity = config.TenantUserIdentityForExpert + err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)) + api.APIResponse(err) } func (*Manage) Laboratory(c *gin.Context) { } -func (*Menu) Research(c *gin.Context) { +func (*Manage) LaboratoryExamine(c *gin.Context) { + form := new(manageExamineForm) -} - -func (*Menu) Examine(c *gin.Context) { - form := &struct { - api.IDStringForm - Identity int `json:"identity" form:"identity" binding:"required"` - Status int `json:"status" form:"status" binding:"required"` - }{} if err := api.Bind(form)(c); err != nil { api.APIFailure(err.(error))(c) return } - err := manage.NewExamine()(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)). - Launch(form.Convert(), form.Identity, form.Status) + form.Identity = config.TenantUserIdentityForLaboratory + err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)) + api.APIResponse(err) +} + +func (*Manage) Research(c *gin.Context) { + +} + +func (*Manage) ResearchExamine(c *gin.Context) { + form := new(manageExamineForm) + + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + form.Identity = config.TenantUserIdentityForResearch + err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)) + api.APIResponse(err) +} + +func (*Manage) Agent(c *gin.Context) { + +} + +func (*Manage) AgentExamine(c *gin.Context) { + form := new(manageExamineForm) + + if err := api.Bind(form)(c); err != nil { + api.APIFailure(err.(error))(c) + return + } + form.Identity = config.TenantUserIdentityForAgent + err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)) api.APIResponse(err) } diff --git a/app/basic/config/public.go b/app/basic/config/public.go index c2968c8..957700a 100644 --- a/app/basic/config/public.go +++ b/app/basic/config/public.go @@ -37,3 +37,45 @@ type ( Research string `json:"research" form:"research"` // 研究领域方向 } ) + +// TechnologyMaturity 科技成熟度 +type TechnologyMaturity int + +const ( + // TechnologyMaturityForDev 正在研发 + TechnologyMaturityForDev TechnologyMaturity = iota + 1 + // TechnologyMaturityForTest 小试阶段 + TechnologyMaturityForTest + // TechnologyMaturityForTestFinish 通过小试 + TechnologyMaturityForTestFinish + // TechnologyMaturityForModerateTest 中试阶段 + TechnologyMaturityForModerateTest + // TechnologyMaturityForModerateTestFinish 通过中试 + TechnologyMaturityForModerateTestFinish + // TechnologyMaturityForProduce 可规模生产 + TechnologyMaturityForProduce +) + +// TechnologyCooperationMode 科技合作模式 +type TechnologyCooperationMode int + +const ( + // TechnologyCooperationModeForJSTransfer 技术转让 + TechnologyCooperationModeForJSTransfer TechnologyCooperationMode = iota + 101 + // TechnologyCooperationModeForJSPermit 技术许可 + TechnologyCooperationModeForJSPermit + // TechnologyCooperationModeForJSShare 技术入股 + TechnologyCooperationModeForJSShare + // TechnologyCooperationModeForCooperation 合作开发 + TechnologyCooperationModeForCooperation + // TechnologyCooperationModeForFinancing 融资 + TechnologyCooperationModeForFinancing + // TechnologyCooperationModeForCompany 公司 + TechnologyCooperationModeForCompany + // TechnologyCooperationModeForAgentJoin 代理加盟 + TechnologyCooperationModeForAgentJoin + // TechnologyCooperationModeForMarketing 市场推广 + TechnologyCooperationModeForMarketing + // TechnologyCooperationModeForOther 其他 + TechnologyCooperationModeForOther +) diff --git a/app/common/model/technology_instance.go b/app/common/model/technology_instance.go index 9fca290..218a404 100644 --- a/app/common/model/technology_instance.go +++ b/app/common/model/technology_instance.go @@ -1,23 +1,26 @@ package model -import "SciencesServer/utils" +import ( + "SciencesServer/app/basic/config" + "SciencesServer/utils" +) // TechnologyInstance 技术文档数据模型 type TechnologyInstance struct { Model ModelTenant Local - MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"` - PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"` - Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"` - Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"` - Maturity TechnologyInstanceMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:成熟度" json:"maturity"` - Prototype int `gorm:"column:prototype;type:tinyint(1);default:0;comment:样机(0:无,1:有)" json:"prototype"` - Product string `gorm:"column:product;type:varchar(255);default:null;comment:应用产品" json:"product"` - Source TechnologyInstanceSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"` - Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` - Territory uint64 `gorm:"column:territory;type:int(11);default:0;comment:技术领域" json:"territory"` - Transaction int `gorm:"column:transaction;type:tinyint(3);default:0;comment:交易方式" json:"transaction"` + MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"` + PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"` + Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"` + Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"` + Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:成熟度" json:"maturity"` + Prototype int `gorm:"column:prototype;type:tinyint(1);default:0;comment:样机(0:无,1:有)" json:"prototype"` + Product string `gorm:"column:product;type:varchar(255);default:null;comment:应用产品" json:"product"` + Source TechnologyInstanceSource `gorm:"column:source;type:tinyint(1);default:0;comment:来源" json:"source"` + Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` + Territory uint64 `gorm:"column:territory;type:int(11);default:0;comment:技术领域" json:"territory"` + Transaction int `gorm:"column:transaction;type:tinyint(3);default:0;comment:交易方式" json:"transaction"` Images ProveImages string `gorm:"column:prove_images;type:text;default:null;comment:证明材料图片" json:"prove_images"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` @@ -29,24 +32,6 @@ type TechnologyInstance struct { ModelAt } -// TechnologyInstanceMaturity 技术文档成熟度 -type TechnologyInstanceMaturity int - -const ( - // TechnologyInstanceMaturityForDev 正在研发 - TechnologyInstanceMaturityForDev TechnologyInstanceMaturity = iota + 1 - // TechnologyInstanceMaturityForTest 小试阶段 - TechnologyInstanceMaturityForTest - // TechnologyInstanceMaturityForTestFinish 通过小试 - TechnologyInstanceMaturityForTestFinish - // TechnologyInstanceMaturityForModerateTest 中试阶段 - TechnologyInstanceMaturityForModerateTest - // TechnologyInstanceMaturityForModerateTestFinish 通过中试 - TechnologyInstanceMaturityForModerateTestFinish - // TechnologyInstanceMaturityForProduce 可规模生产 - TechnologyInstanceMaturityForProduce -) - // TechnologyInstanceSource 技术来源 type TechnologyInstanceSource int diff --git a/router/address.go b/router/address.go index 1850493..58c8218 100644 --- a/router/address.go +++ b/router/address.go @@ -174,6 +174,11 @@ func registerEnterpriseAPI(app *gin.Engine) { technologyV1.POST("/equipment/add", _api.EquipmentAdd) technologyV1.POST("/equipment/edit", _api.EquipmentEdit) technologyV1.POST("/equipment/delete", _api.EquipmentDelete) + technologyV1.POST("/product", _api.Product) + technologyV1.POST("/product/add", _api.ProductAdd) + technologyV1.POST("/product/edit", _api.ProductEdit) + technologyV1.POST("/product/shelf", _api.ProductShelf) + technologyV1.POST("/product/delete", _api.ProductDelete) } // Identity 身份信息 identityV1 := v1.Group("/config")