feat:优化项目信息
This commit is contained in:
16
README.md
16
README.md
@ -5,8 +5,6 @@
|
|||||||
中科云管理系统
|
中科云管理系统
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[comment]: <> (- 预览: https://preview.pro.antdv.com)
|
|
||||||
|
|
||||||
环境和依赖
|
环境和依赖
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -46,12 +44,16 @@ pack
|
|||||||
|
|
||||||
- 发布项目
|
- 发布项目
|
||||||
```bash
|
```bash
|
||||||
linux:一:./server.sh(请注意修改文件提示的地方);二:nohup ./项目 &;三:DockerFile
|
linux
|
||||||
|
一:./server.sh(请注意修改文件提示的地方);
|
||||||
|
二:nohup ./项目 &;
|
||||||
|
三:DockerFile
|
||||||
```
|
```
|
||||||
|
> 请注意,注意修改`server.sh`、`DockerFile`配置信息
|
||||||
|
|
||||||
- 其他说明
|
- 其他说明
|
||||||
- 项目目录
|
- 项目目录
|
||||||
- file 配置文件,不可删除
|
- cmd 项目执行入口
|
||||||
- key 密钥管理,不可删除
|
- file 配置文件,不可删除
|
||||||
- cmd 项目执行入口
|
- key 密钥管理,不可删除
|
||||||
- log 日志管理,自动生成
|
- log 日志管理,自动生成
|
||||||
|
@ -248,7 +248,7 @@ func (c *Examine) Launch(id uint64, identity, status int, remark string, params
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err = model2.UpdatesWhere(mUserInstance.UserInstance, map[string]interface{}{
|
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.ModelWhere{
|
||||||
model2.NewWhere("id", v.ID),
|
model2.NewWhere("id", v.ID),
|
||||||
}, tx); err != nil {
|
}, 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 {
|
if err := json.Unmarshal([]byte(cache), _session); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_session.Identity = mUserInstance.Identity | identity
|
_session.Identity = v.Identity | identity
|
||||||
|
|
||||||
if userIdentity.IsSelected == model2.UserIdentitySelectedForYes {
|
if userIdentity.IsSelected == model2.UserIdentitySelectedForYes {
|
||||||
_session.SelectIdentity = identity
|
_session.SelectIdentity = identity
|
||||||
|
@ -3,6 +3,7 @@ package technology
|
|||||||
import (
|
import (
|
||||||
"SciencesServer/app/api/enterprise/controller/sys"
|
"SciencesServer/app/api/enterprise/controller/sys"
|
||||||
"SciencesServer/app/api/enterprise/model"
|
"SciencesServer/app/api/enterprise/model"
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
"SciencesServer/app/basic/controller"
|
"SciencesServer/app/basic/controller"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
@ -87,7 +88,27 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
|||||||
if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||||
return err
|
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 := model.NewTechnologyPatent()
|
||||||
mTechnologyPatent.ID = c.ID
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -135,7 +156,17 @@ func (c *PatentParams) edit(uid uint64) error {
|
|||||||
mTechnologyPatent.PrincipalClaim = c.PrincipalClaim
|
mTechnologyPatent.PrincipalClaim = c.PrincipalClaim
|
||||||
mTechnologyPatent.IPCCode = c.IPCCode
|
mTechnologyPatent.IPCCode = c.IPCCode
|
||||||
mTechnologyPatent.Status = model2.TechnologyPatentStatus(c.Status)
|
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 列表信息
|
// List 列表信息
|
||||||
@ -273,9 +304,16 @@ func (c *Patent) Shelf(id uint64, status int) error {
|
|||||||
} else if mTechnologyPatent.UID != c.UID {
|
} else if mTechnologyPatent.UID != c.UID {
|
||||||
return errors.New("操作错误,无权限操作")
|
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(),
|
"shelf": status, "updated_at": time.Now(),
|
||||||
})
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
manage := service.NewESPatent(
|
||||||
|
service.WithPatentID(mTechnologyPatent.ID),
|
||||||
|
service.WithPatentShow(status),
|
||||||
|
)
|
||||||
|
return manage.Update()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete 删除操作
|
// Delete 删除操作
|
||||||
@ -292,7 +330,13 @@ func (c *Patent) Delete(id uint64) error {
|
|||||||
} else if mTechnologyPatent.UID != c.UID {
|
} else if mTechnologyPatent.UID != c.UID {
|
||||||
return errors.New("操作错误,无权限操作")
|
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 {
|
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()}
|
||||||
|
}
|
@ -10,6 +10,7 @@ type ESPatent struct {
|
|||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Industry string `json:"industry"` // 行业领域
|
Industry string `json:"industry"` // 行业领域
|
||||||
|
IsShow int `json:"is_show"` // 展示
|
||||||
}
|
}
|
||||||
|
|
||||||
type ESPatentOption func(patent *ESPatent)
|
type ESPatentOption func(patent *ESPatent)
|
||||||
@ -24,8 +25,22 @@ func (this *ESPatent) Create() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ESPatent) Update() error {
|
func (this *ESPatent) Update() error {
|
||||||
_bytes, _ := json.Marshal(this)
|
_map := make(map[string]interface{}, 0)
|
||||||
return es.Update(this.Index(), fmt.Sprintf("%d", this.ID), _bytes)
|
|
||||||
|
if this.Title != "" {
|
||||||
|
_map["title"] = this.Title
|
||||||
|
}
|
||||||
|
if this.Industry != "" {
|
||||||
|
_map["industry"] = this.Industry
|
||||||
|
}
|
||||||
|
if this.IsShow != 0 {
|
||||||
|
_map["is_show"] = this.IsShow
|
||||||
|
}
|
||||||
|
return es.Update(this.Index(), fmt.Sprintf("%d", this.ID), _map)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ESPatent) Delete() error {
|
||||||
|
return es.Delete(this.Index(), fmt.Sprintf("%d", this.ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ESPatent) Search(page, pageSize int) (interface{}, int64, error) {
|
func (this *ESPatent) Search(page, pageSize int) (interface{}, int64, error) {
|
||||||
@ -38,6 +53,8 @@ func (this *ESPatent) Search(page, pageSize int) (interface{}, int64, error) {
|
|||||||
if this.Industry != "" {
|
if this.Industry != "" {
|
||||||
termParams["industry"] = this.Industry
|
termParams["industry"] = this.Industry
|
||||||
}
|
}
|
||||||
|
termParams["is_show"] = 1
|
||||||
|
|
||||||
return es.Search(this, this.Index(), &es.SearchParams{
|
return es.Search(this, this.Index(), &es.SearchParams{
|
||||||
TermParams: termParams,
|
TermParams: termParams,
|
||||||
MustParams: mustParams,
|
MustParams: mustParams,
|
||||||
@ -62,6 +79,12 @@ func WithPatentIndustry(industry string) ESPatentOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithPatentShow(show int) ESPatentOption {
|
||||||
|
return func(patent *ESPatent) {
|
||||||
|
patent.IsShow = show
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func NewESPatent(options ...ESPatentOption) *ESPatent {
|
func NewESPatent(options ...ESPatentOption) *ESPatent {
|
||||||
out := new(ESPatent)
|
out := new(ESPatent)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
{
|
{
|
||||||
"name": "BaiscServer-Window",
|
"name": "BaiscServer-Window",
|
||||||
"format": "zip",
|
"format": "zip",
|
||||||
"pattern": "{Serve.exe,config.yaml,keys/*,file/*,start.sh,stop.sh}",
|
"pattern": "{SciencesServe.exe,default_setting.yaml,default_engine.yaml,keys/*,file/*,server.sh}",
|
||||||
"options": {
|
"options": {
|
||||||
"dot": true,
|
"dot": true,
|
||||||
"ignore": [
|
"ignore": [
|
||||||
@ -41,7 +41,7 @@
|
|||||||
{
|
{
|
||||||
"name": "BaiscServer-Linux",
|
"name": "BaiscServer-Linux",
|
||||||
"format": "tar",
|
"format": "tar",
|
||||||
"pattern": "{SciencesServer,config.yaml,keys/*,file/*,start.sh,stop.sh}",
|
"pattern": "{SciencesServer,default_setting.yaml,default_engine.yaml,keys/*,file/*,Dockerfile,server.sh}",
|
||||||
"options": {
|
"options": {
|
||||||
"dot": true,
|
"dot": true,
|
||||||
"ignore": [
|
"ignore": [
|
||||||
|
@ -27,11 +27,19 @@ func Create(index, id string, body []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update 更新操作
|
// Update 更新操作
|
||||||
func Update(index, id string, body []byte) error {
|
func Update(index, id string, params map[string]interface{}) error {
|
||||||
|
scriptStr := ""
|
||||||
|
|
||||||
|
for k := range params {
|
||||||
|
scriptStr += "ctx._source." + k + " = params." + k + ";"
|
||||||
|
}
|
||||||
|
script := elastic.NewScript(scriptStr).Params(params)
|
||||||
|
|
||||||
_, err := client.Update().
|
_, err := client.Update().
|
||||||
Index(index).
|
Index(index).
|
||||||
Id(id).
|
Id(id).
|
||||||
Doc(string(body)).
|
Script(script).
|
||||||
|
//Doc(string(body)).
|
||||||
Do(context.Background())
|
Do(context.Background())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user