feat:完善项目信息
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller/technology"
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/api/enterprise/controller/technology"
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"errors"
|
||||
@ -13,7 +13,7 @@ import (
|
||||
type (
|
||||
// AchievementInfo 成果信息
|
||||
AchievementInfo struct {
|
||||
*model.TechnologyAchievementInfo
|
||||
*model.TechnologyAchievementsInfo
|
||||
ChargeInfo *model2.TechnologyAchievementChargeInfo `json:"charge_info"`
|
||||
}
|
||||
// ProjectInfo 项目信息
|
||||
@ -24,7 +24,7 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.PatentInfo
|
||||
*model.PatentInstance
|
||||
}
|
||||
// PaperInfo 论文信息
|
||||
PaperInfo struct {
|
||||
@ -41,9 +41,9 @@ type (
|
||||
}
|
||||
// CooperateDetailInfo 合作的企业详细信息
|
||||
CooperateDetailInfo struct {
|
||||
Title string `json:"title"`
|
||||
Patent []*technology.PatentInfo `json:"patent"`
|
||||
Paper []*technology.PaperInfo `json:"paper"`
|
||||
Title string `json:"title"`
|
||||
Patent []*technology.PatentInstance `json:"patent"`
|
||||
Paper []*technology.PaperInstance `json:"paper"`
|
||||
}
|
||||
EquipmentInfo struct {
|
||||
ID string `json:"id"`
|
||||
@ -57,7 +57,7 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
||||
|
||||
var count int64
|
||||
|
||||
out, err := mTechnologyAchievement.Achievement(page, pageSize, &count, model2.NewWhereIn("uid", uids))
|
||||
out, err := mTechnologyAchievement.Achievements(page, pageSize, &count, model2.NewWhereIn("uid", uids))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -66,8 +66,8 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &AchievementInfo{
|
||||
TechnologyAchievementInfo: v,
|
||||
ChargeInfo: v.GetChargeInfoAttribute(),
|
||||
TechnologyAchievementsInfo: v,
|
||||
ChargeInfo: v.GetChargeInfoAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -105,7 +105,7 @@ func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
mUserPatent := model.NewUserPatent()
|
||||
var count int64
|
||||
|
||||
out, err := mUserPatent.Patent(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids))
|
||||
out, err := mUserPatent.Instance(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -114,8 +114,7 @@ func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
PatentInfo: v,
|
||||
ID: v.GetEncodeID(), PatentInstance: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -190,8 +189,8 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
}
|
||||
out := &CooperateDetailInfo{
|
||||
Title: mUserCooperateEnterprise.Title,
|
||||
Patent: make([]*technology.PatentInfo, 0),
|
||||
Paper: make([]*technology.PaperInfo, 0),
|
||||
Patent: make([]*technology.PatentInstance, 0),
|
||||
Paper: make([]*technology.PaperInstance, 0),
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
@ -202,7 +201,7 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range patents {
|
||||
out.Patent = append(out.Patent, &technology.PatentInfo{
|
||||
out.Patent = append(out.Patent, &technology.PatentInstance{
|
||||
ID: v.GetEncodeID(),
|
||||
SysPatentInfo: v,
|
||||
})
|
||||
@ -220,7 +219,7 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range papers {
|
||||
out.Paper = append(out.Paper, &technology.PaperInfo{
|
||||
out.Paper = append(out.Paper, &technology.PaperInstance{
|
||||
ID: v.GetEncodeID(), Title: v.Title, Ext: v.Ext, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Laboratory struct {
|
||||
@ -12,6 +17,29 @@ type Laboratory struct {
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
|
||||
|
||||
type (
|
||||
// LaboratoryMatchInfo 实验室匹配信息
|
||||
LaboratoryMatchInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageLaboratoryInstance
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
}
|
||||
)
|
||||
|
||||
// expert 所有专家信息
|
||||
func (c *Laboratory) expert(id uint64) ([]uint64, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
uids := make([]uint64, 0)
|
||||
|
||||
err := model2.Pluck(mManageExpert.ManageExpert, "uid", &uids, model2.NewWhere("laboratory_id", id),
|
||||
model2.NewWhere("examine_status", model2.ExamineStatusForAgree))
|
||||
|
||||
return uids, err
|
||||
}
|
||||
|
||||
func (c *Laboratory) Instance() (*controller.ReturnPages, error) {
|
||||
//mManageLaboratory := model.NewManageLaboratory()
|
||||
|
||||
@ -22,6 +50,149 @@ func (c *Laboratory) Instance() (*controller.ReturnPages, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Match 匹配信息
|
||||
func (c *Laboratory) Match(title string, industrys, keywords []string) ([]*LaboratoryMatchInfo, 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{}{
|
||||
"title": params, "industry": params, "keyword": params, "research": params,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ids := make([]uint64, 0)
|
||||
|
||||
for _, v := range out.([]interface{}) {
|
||||
val := v.(*service.ESManage)
|
||||
ids = append(ids, val.ID)
|
||||
}
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
|
||||
laboratorys := make([]*model.ManageLaboratoryInstance, 0)
|
||||
|
||||
if laboratorys, err = mManageLaboratory.Instance(model2.NewWhereIn("l.id", ids)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*LaboratoryMatchInfo, 0)
|
||||
|
||||
for _, v := range laboratorys {
|
||||
list = append(list, &LaboratoryMatchInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
ManageLaboratoryInstance: v,
|
||||
Industrys: v.GetIndustryAttribute(),
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
Researchs: v.GetResearchAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Instance 实验室信息
|
||||
func (c *Laboratory) Detail(id uint64) (*LaboratoryMatchInfo, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
out, err := mManageLaboratory.Instance(model2.NewWhere("l.id", id))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(out) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
_out := out[0]
|
||||
|
||||
return &LaboratoryMatchInfo{
|
||||
ID: _out.GetEncodeID(),
|
||||
ManageLaboratoryInstance: &model.ManageLaboratoryInstance{
|
||||
ManageLaboratory: _out.ManageLaboratory,
|
||||
ResearchName: _out.ResearchName,
|
||||
ExpertCount: _out.ExpertCount,
|
||||
CollectCount: _out.CollectCount,
|
||||
VisitCount: _out.VisitCount,
|
||||
},
|
||||
Industrys: _out.GetIndustryAttribute(),
|
||||
Keywords: _out.GetKeywordAttribute(),
|
||||
Researchs: _out.GetResearchAttribute(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Achievement 成果信息
|
||||
func (c *Laboratory) Achievement(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return achievement(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Project 项目信息
|
||||
func (c *Laboratory) Project(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return project(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
func (c *Laboratory) Patent(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return paper(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Paper 论文信息
|
||||
func (c *Laboratory) Paper(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return paper(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Cooperate 企业信息
|
||||
func (c *Laboratory) Cooperate(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cooperate(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// CooperateDetail 公司企业详细信息
|
||||
func (c *Laboratory) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
return cooperateDetail(id)
|
||||
}
|
||||
|
||||
// Equipment 设备信息
|
||||
func (c *Laboratory) Equipment(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return equipment(model2.ManageEquipmentKindForExperiment, uids, page, pageSize)
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise, local string) *Laboratory {
|
||||
return &Laboratory{
|
||||
|
@ -24,6 +24,12 @@ type (
|
||||
*model2.TechnologyPaper
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
PaperInstance struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Ext string `json:"ext"`
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
PaperParams struct {
|
||||
ID uint64
|
||||
Title, Ext, Author, PublishAt, Remark string
|
||||
|
@ -37,6 +37,11 @@ type (
|
||||
Description string `json:"description"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
}
|
||||
// PatentInstance 专利信息
|
||||
PatentInstance struct {
|
||||
ID string `json:"id"`
|
||||
*model.SysPatentInfo
|
||||
}
|
||||
// PatentDetailInfo 专利详细信息
|
||||
PatentDetailInfo struct {
|
||||
ID string `json:"id"`
|
||||
|
Reference in New Issue
Block a user