feat:优化项目信息
This commit is contained in:
@ -248,7 +248,7 @@ func (c *Examine) Launch(id uint64, identity, status int, remark string, params
|
||||
return err
|
||||
}
|
||||
if err = model2.UpdatesWhere(mUserInstance.UserInstance, map[string]interface{}{
|
||||
"identity": mUserInstance.Identity | identity, "updated_at": now,
|
||||
"identity": v.Identity | identity, "updated_at": now,
|
||||
}, []*model2.ModelWhere{
|
||||
model2.NewWhere("id", v.ID),
|
||||
}, tx); err != nil {
|
||||
@ -264,7 +264,7 @@ func (c *Examine) Launch(id uint64, identity, status int, remark string, params
|
||||
if err := json.Unmarshal([]byte(cache), _session); err != nil {
|
||||
return err
|
||||
}
|
||||
_session.Identity = mUserInstance.Identity | identity
|
||||
_session.Identity = v.Identity | identity
|
||||
|
||||
if userIdentity.IsSelected == model2.UserIdentitySelectedForYes {
|
||||
_session.SelectIdentity = identity
|
||||
|
@ -3,6 +3,7 @@ package technology
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/sys"
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
@ -87,7 +88,27 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentID(mTechnologyPatent.ID),
|
||||
service.WithPatentTitle(mTechnologyPatent.Title),
|
||||
)
|
||||
// 查询分类信息
|
||||
mTechnologyPatentClassify := model.NewTechnologyPatentClassify()
|
||||
|
||||
isExist, err = model2.FirstField(mTechnologyPatentClassify.TechnologyPatentClassify, []string{"id", "ipc", "industry_detail"},
|
||||
model2.NewWhere("ipc", c.IPCCode))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range mTechnologyPatentClassify.GetIndustryDetailAttribute() {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "-").Value)
|
||||
}
|
||||
service.WithPatentIndustry(strings.Join(_industrys, ";"))(manage)
|
||||
}
|
||||
return manage.Create()
|
||||
})
|
||||
}
|
||||
|
||||
@ -96,7 +117,7 @@ func (c *PatentParams) edit(uid uint64) error {
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
mTechnologyPatent.ID = c.ID
|
||||
|
||||
isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "uid", "apply_code", "open_code"})
|
||||
isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "uid", "apply_code", "open_code", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -135,7 +156,17 @@ func (c *PatentParams) edit(uid uint64) error {
|
||||
mTechnologyPatent.PrincipalClaim = c.PrincipalClaim
|
||||
mTechnologyPatent.IPCCode = c.IPCCode
|
||||
mTechnologyPatent.Status = model2.TechnologyPatentStatus(c.Status)
|
||||
return model2.Updates(mTechnologyPatent.TechnologyPatent, mTechnologyPatent.TechnologyPatent)
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.Updates(mTechnologyPatent.TechnologyPatent, mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentID(mTechnologyPatent.ID),
|
||||
service.WithPatentTitle(mTechnologyPatent.Title),
|
||||
)
|
||||
return manage.Update()
|
||||
})
|
||||
}
|
||||
|
||||
// List 列表信息
|
||||
@ -273,9 +304,16 @@ func (c *Patent) Shelf(id uint64, status int) error {
|
||||
} else if mTechnologyPatent.UID != c.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
return model2.Updates(mTechnologyPatent.TechnologyPatent, map[string]interface{}{
|
||||
if err = model2.Updates(mTechnologyPatent.TechnologyPatent, map[string]interface{}{
|
||||
"shelf": status, "updated_at": time.Now(),
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentID(mTechnologyPatent.ID),
|
||||
service.WithPatentShow(status),
|
||||
)
|
||||
return manage.Update()
|
||||
}
|
||||
|
||||
// Delete 删除操作
|
||||
@ -292,7 +330,13 @@ func (c *Patent) Delete(id uint64) error {
|
||||
} else if mTechnologyPatent.UID != c.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
return model2.Delete(mTechnologyPatent.TechnologyPatent)
|
||||
if err = model2.Delete(mTechnologyPatent.TechnologyPatent); err != nil {
|
||||
return err
|
||||
}
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentID(mTechnologyPatent.ID),
|
||||
)
|
||||
return manage.Delete()
|
||||
}
|
||||
|
||||
func NewPatent() PatentHandle {
|
||||
|
11
app/api/enterprise/model/technology_patent_classify.go
Normal file
11
app/api/enterprise/model/technology_patent_classify.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import model2 "SciencesServer/app/common/model"
|
||||
|
||||
type TechnologyPatentClassify struct {
|
||||
*model2.TechnologyPatentClassify
|
||||
}
|
||||
|
||||
func NewTechnologyPatentClassify() *TechnologyPatentClassify {
|
||||
return &TechnologyPatentClassify{model2.NewTechnologyPatentClassify()}
|
||||
}
|
Reference in New Issue
Block a user