feat:完善项目信息

This commit is contained in:
henry
2022-01-20 11:51:02 +08:00
parent 9348c8970c
commit b87cd837be
23 changed files with 86 additions and 83 deletions

View File

@ -3,6 +3,7 @@ package manage
import (
"SciencesServer/app/api/enterprise/model"
"SciencesServer/app/basic/config"
"SciencesServer/app/basic/controller"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/service"
"SciencesServer/app/session"
@ -102,14 +103,14 @@ func (c *Company) Product(id uint64, page, pageSize int) ([]*CompanyProductInfo,
}
// Match 匹配信息
func (c *Company) Match(title string, industrys, keywords []string) ([]*CompanyMatchInfo, error) {
func (c *Company) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
params := strings.Join([]string{
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
}, ",")
manage := service.NewESManage(
service.WithManageIdentity(config.TenantUserIdentityForCompany),
)
out, err := manage.Search(0, 0, map[string]interface{}{
out, count, err := manage.Search(0, 0, map[string]interface{}{
"title": params, "industry": params, "keyword": params, "research": params,
})
if err != nil {
@ -145,7 +146,7 @@ func (c *Company) Match(title string, industrys, keywords []string) ([]*CompanyM
Keywords: v.GetKeywordAttribute(),
})
}
return list, nil
return &controller.ReturnPages{Data: list, Count: count}, nil
}
func NewCompany() CompanyHandle {

View File

@ -162,7 +162,7 @@ func (c *Expert) Instance(name, mobile string, page, pageSize int) (*controller.
}
// Match 匹配信息
func (c *Expert) Match(title string, industrys, keywords []string) ([]*ExpertMatchInfo, error) {
func (c *Expert) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
params := strings.Join([]string{
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
}, ",")
@ -170,7 +170,7 @@ func (c *Expert) Match(title string, industrys, keywords []string) ([]*ExpertMat
manage := service.NewESManage(
service.WithManageIdentity(config.TenantUserIdentityForExpert),
)
out, err := manage.Search(0, 0, map[string]interface{}{
out, count, err := manage.Search(0, 0, map[string]interface{}{
"title": params, "industry": params, "keyword": params, "research": params,
})
if err != nil {
@ -202,7 +202,7 @@ func (c *Expert) Match(title string, industrys, keywords []string) ([]*ExpertMat
PatentTitles: strings.Split(v.PatentTitle, "&&"),
})
}
return list, nil
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Detail 详细信息

View File

@ -50,14 +50,14 @@ func (c *Laboratory) Instance() (*controller.ReturnPages, error) {
}
// Match 匹配信息
func (c *Laboratory) Match(title string, industrys, keywords []string) ([]*LaboratoryMatchInfo, error) {
func (c *Laboratory) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
params := strings.Join([]string{
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
}, ",")
manage := service.NewESManage(
service.WithManageIdentity(config.TenantUserIdentityForLaboratory),
)
out, err := manage.Search(0, 0, map[string]interface{}{
out, count, err := manage.Search(0, 0, map[string]interface{}{
"title": params, "industry": params, "keyword": params, "research": params,
})
if err != nil {
@ -87,7 +87,7 @@ func (c *Laboratory) Match(title string, industrys, keywords []string) ([]*Labor
Researchs: v.GetResearchAttribute(),
})
}
return list, nil
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Detail 实验室信息

View File

@ -80,7 +80,7 @@ func (c *Achievement) Instance(status, page, pageSize int) (*controller.ReturnPa
}
// Match 匹配信息
func (c *Achievement) Match(title string, industrys, keywords []string) ([]*AchievementMatchInfo, error) {
func (c *Achievement) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
params := strings.Join([]string{
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
}, ",")
@ -89,7 +89,7 @@ func (c *Achievement) Match(title string, industrys, keywords []string) ([]*Achi
service.WithAchievementIndustry(params),
service.WithAchievementKeyword(params),
)
out, err := achievement.Search(0, 0)
out, count, err := achievement.Search(0, 0)
if err != nil {
return nil, err
@ -123,7 +123,7 @@ func (c *Achievement) Match(title string, industrys, keywords []string) ([]*Achi
Customers: mTechnologyAchievement.GetCustomerAttribute(),
})
}
return list, nil
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Detail 详情信息

View File

@ -193,7 +193,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
}
// Match 搜索信息
func (c *Patent) Match(title string, industrys, keywords []string) ([]*PatentMatchInfo, error) {
func (c *Patent) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
params := strings.Join([]string{
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
}, ",")
@ -201,7 +201,7 @@ func (c *Patent) Match(title string, industrys, keywords []string) ([]*PatentMat
service.WithPatentTitle(params),
service.WithPatentIndustry(params),
)
out, err := patent.Search(0, 0)
out, count, err := patent.Search(0, 0)
if err != nil {
return nil, err
@ -229,7 +229,7 @@ func (c *Patent) Match(title string, industrys, keywords []string) ([]*PatentMat
ID: v.GetEncodeID(), Title: v.Title, Description: v.Description, ApplyAt: v.ApplyAt,
})
}
return list, nil
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Detail 详细信息

View File

@ -50,33 +50,33 @@ type (
}
)
var matchHandle = map[int]func(title string, industrys, keywords []string) (interface{}, error){
var matchHandle = map[int]func(title string, industrys, keywords []string) (*controller.ReturnPages, error){
1: matchAchievement, 2: matchPatent, 3: matchExpect, 4: matchLaboratory, 5: matchCompany,
}
// matchAchievement 成果匹配
func matchAchievement(title string, industrys, keywords []string) (interface{}, error) {
func matchAchievement(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
return (&Achievement{}).Match(title, industrys, keywords)
}
// matchPatent 专利匹配
func matchPatent(title string, industrys, keywords []string) (interface{}, error) {
func matchPatent(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
return (&Patent{}).Match(title, industrys, keywords)
}
// matchExpect 专家匹配
func matchExpect(title string, industrys, keywords []string) (interface{}, error) {
func matchExpect(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
return (&manage.Expert{}).Match(title, industrys, keywords)
}
// matchLaboratory 实验室匹配
func matchLaboratory(title string, industrys, keywords []string) (interface{}, error) {
func matchLaboratory(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
return (&manage.Laboratory{}).Match(title, industrys, keywords)
}
// matchCompany 公司匹配
func matchCompany(title string, industrys, keywords []string) (interface{}, error) {
func matchCompany(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
return nil, nil
}