feat:完善项目信息
This commit is contained in:
@ -5,10 +5,12 @@ import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -27,6 +29,14 @@ type (
|
||||
ShelfStatus model2.ShelfStatusKind
|
||||
Status model2.SysParentStatus
|
||||
}
|
||||
// PatentMatchInfo 专利匹配信息
|
||||
PatentMatchInfo struct {
|
||||
ID string `json:"id"`
|
||||
Kind model2.SysParentKind `json:"kind"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
}
|
||||
// PatentDetailInfo 专利详细信息
|
||||
PatentDetailInfo struct {
|
||||
ID string `json:"id"`
|
||||
@ -182,6 +192,46 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// Search 搜索信息
|
||||
func (c *Patent) Match(title string, industrys, keywords []string) ([]*PatentMatchInfo, error) {
|
||||
params := strings.Join([]string{
|
||||
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
|
||||
}, ",")
|
||||
patent := service.NewESPatent(
|
||||
service.WithPatentTitle(params),
|
||||
service.WithPatentIndustry(params),
|
||||
)
|
||||
out, err := patent.Search(0, 0)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ids := make([]uint64, 0)
|
||||
|
||||
for _, v := range out.([]interface{}) {
|
||||
val := v.(*service.ESAchievement)
|
||||
ids = append(ids, val.ID)
|
||||
}
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
||||
patents := make([]*model2.SysPatent, 0)
|
||||
|
||||
if err = model2.ScanFields(mSysPatent.SysPatent, &patents, []string{"id", "kind", "title", "description", "apply_at"}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", ids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*PatentMatchInfo, 0)
|
||||
|
||||
for _, v := range patents {
|
||||
list = append(list, &PatentMatchInfo{
|
||||
ID: v.GetEncodeID(), Title: v.Title, Description: v.Description, ApplyAt: v.ApplyAt,
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
func (c *Patent) Detail(id uint64) (*PatentDetailInfo, error) {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
|
Reference in New Issue
Block a user