feat:完善项目信息
This commit is contained in:
224
app/api/website/controller/manage/common.go
Normal file
224
app/api/website/controller/manage/common.go
Normal file
@ -0,0 +1,224 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller/technology"
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// 公用参数信息
|
||||
|
||||
type (
|
||||
// AchievementInfo 成果信息
|
||||
AchievementInfo struct {
|
||||
*model.TechnologyAchievementInfo
|
||||
ChargeInfo *model2.TechnologyAchievementChargeInfo `json:"charge_info"`
|
||||
}
|
||||
// ProjectInfo 项目信息
|
||||
ProjectInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.TechnologyProject
|
||||
}
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.PatentInfo
|
||||
}
|
||||
// PaperInfo 论文信息
|
||||
PaperInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.TechnologyPaper
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
// CooperateInfo 合作的企业信息
|
||||
CooperateInfo struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
PatentCount int `json:"patent_count"`
|
||||
PaperCount int `json:"paper_count"`
|
||||
}
|
||||
// CooperateDetailInfo 合作的企业详细信息
|
||||
CooperateDetailInfo struct {
|
||||
Title string `json:"title"`
|
||||
Patent []*technology.PatentInfo `json:"patent"`
|
||||
Paper []*technology.PaperInfo `json:"paper"`
|
||||
}
|
||||
)
|
||||
|
||||
// achievement 技术成果信息
|
||||
func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||
|
||||
var count int64
|
||||
|
||||
out, err := mTechnologyAchievement.Achievement(page, pageSize, &count, model2.NewWhereIn("uid", uids))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*AchievementInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &AchievementInfo{
|
||||
TechnologyAchievementInfo: v,
|
||||
ChargeInfo: v.GetChargeInfoAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// project 项目信息
|
||||
func project(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mTechnologyProject := model.NewTechnologyProject()
|
||||
out := make([]*model2.TechnologyProject, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err := model2.Pages(mTechnologyProject.TechnologyProject, &out, page, pageSize, &count,
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ProjectInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ProjectInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyProject: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// patent 专利信息
|
||||
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))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*PatentInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
PatentInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mTechnologyPaper := model.NewTechnologyPaper()
|
||||
|
||||
out := make([]*model2.TechnologyPaper, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err := model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "keyword"},
|
||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*PaperInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PaperInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyPaper: v,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// cooperate 合作的信息
|
||||
func cooperate(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||
|
||||
out := make([]*model2.UserCooperateEnterprise, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err := model2.PagesFields(mUserCooperateEnterprise.UserCooperateEnterprise, &out, []string{"id", "title", "paper", "patent"},
|
||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("kind", model2.UserCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*CooperateInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &CooperateInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
Title: v.Title,
|
||||
PatentCount: len(v.GetPatentAttribute()),
|
||||
PaperCount: len(v.GetPaperAttribute()),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// cooperateDetail 合作企业详情
|
||||
func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||
mUserCooperateEnterprise.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mUserCooperateEnterprise.UserCooperateEnterprise, []string{"id", "title", "paper", "patent"})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, errors.New("操作错误,企业信息不存在或已被删除")
|
||||
}
|
||||
out := &CooperateDetailInfo{
|
||||
Title: mUserCooperateEnterprise.Title,
|
||||
Patent: make([]*technology.PatentInfo, 0),
|
||||
Paper: make([]*technology.PaperInfo, 0),
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
||||
patents := make([]*model.SysPatentInfo, 0)
|
||||
|
||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", mUserCooperateEnterprise.GetPatentAttribute())); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range patents {
|
||||
out.Patent = append(out.Patent, &technology.PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysPatentInfo: v,
|
||||
})
|
||||
}
|
||||
// 论文信息
|
||||
mTechnologyPaper := model.NewTechnologyPaper()
|
||||
|
||||
papers := make([]*model2.TechnologyPaper, 0)
|
||||
|
||||
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", mUserCooperateEnterprise.GetPaperAttribute()),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range papers {
|
||||
out.Paper = append(out.Paper, &technology.PaperInfo{
|
||||
ID: v.GetEncodeID(), Title: v.Title, Ext: v.Ext, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller/technology"
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -33,40 +31,6 @@ type (
|
||||
Researchs []string `json:"researchs"`
|
||||
Introduce string `json:"introduce"`
|
||||
}
|
||||
// ExpertAchievementInfo 专家成果信息
|
||||
ExpertAchievementInfo struct {
|
||||
*model.TechnologyAchievementInfo
|
||||
ChargeInfo *model2.TechnologyAchievementChargeInfo `json:"charge_info"`
|
||||
}
|
||||
// ExpertProjectInfo 专家项目信息
|
||||
ExpertProjectInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.TechnologyProject
|
||||
}
|
||||
// ExpertPatentInfo 专利信息
|
||||
ExpertPatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.PatentInfo
|
||||
}
|
||||
// ExpertPaperInfo 论文信息
|
||||
ExpertPaperInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.TechnologyPaper
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
// ExpertCompanyInfo 合作企业信息
|
||||
ExpertCompanyInfo struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
PatentCount int `json:"patent_count"`
|
||||
PaperCount int `json:"paper_count"`
|
||||
}
|
||||
// ExpertCompanyDetailInfo 合作企业详细信息
|
||||
ExpertCompanyDetailInfo struct {
|
||||
Title string `json:"title"`
|
||||
Patent []*technology.PatentInfo `json:"patent"`
|
||||
Paper []*technology.PaperInfo `json:"paper"`
|
||||
}
|
||||
)
|
||||
|
||||
func (c *Expert) user(id uint64) ([]uint64, error) {
|
||||
@ -109,24 +73,8 @@ func (c *Expert) Achievement(id uint64, page, pageSize int) (*controller.ReturnP
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||
|
||||
var count int64
|
||||
|
||||
out := make([]*model.TechnologyAchievementInfo, 0)
|
||||
|
||||
if out, err = mTechnologyAchievement.Achievement(page, pageSize, &count, model2.NewWhereIn("uid", uids)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertAchievementInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ExpertAchievementInfo{
|
||||
TechnologyAchievementInfo: v,
|
||||
ChargeInfo: v.GetChargeInfoAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return achievement(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Project 项目信息
|
||||
@ -137,29 +85,8 @@ func (c *Expert) Project(id uint64, page, pageSize int) (*controller.ReturnPages
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mTechnologyProject := model.NewTechnologyProject()
|
||||
out := make([]*model2.TechnologyProject, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err = model2.Pages(mTechnologyProject.TechnologyProject, &out, page, pageSize, &count,
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertProjectInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ExpertProjectInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyProject: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return project(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
@ -170,23 +97,8 @@ func (c *Expert) Patent(id uint64, page, pageSize int) (*controller.ReturnPages,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mUserPatent := model.NewUserPatent()
|
||||
var count int64
|
||||
|
||||
out := make([]*model.PatentInfo, 0)
|
||||
|
||||
if out, err = mUserPatent.Patent(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertPatentInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ExpertPatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
PatentInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return paper(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Paper 论文信息
|
||||
@ -197,115 +109,25 @@ func (c *Expert) Paper(id uint64, page, pageSize int) (*controller.ReturnPages,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mTechnologyPaper := model.NewTechnologyPaper()
|
||||
|
||||
out := make([]*model2.TechnologyPaper, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err = model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "keyword"},
|
||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertPaperInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ExpertPaperInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyPaper: v,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return paper(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// Company 企业信息
|
||||
func (c *Expert) Company(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// Cooperate 企业信息
|
||||
func (c *Expert) Cooperate(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
// 查询专家身份下用户信息
|
||||
uids, err := c.user(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||
|
||||
out := make([]*model2.UserCooperateEnterprise, 0)
|
||||
|
||||
var count int64
|
||||
|
||||
if err = model2.PagesFields(mUserCooperateEnterprise.UserCooperateEnterprise, &out, []string{"id", "title", "paper", "patent"},
|
||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("kind", model2.UserCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertCompanyInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &ExpertCompanyInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
Title: v.Title,
|
||||
PatentCount: len(v.GetPatentAttribute()),
|
||||
PaperCount: len(v.GetPaperAttribute()),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return cooperate(uids, page, pageSize)
|
||||
}
|
||||
|
||||
// CompanyDetail 公司企业详细信息
|
||||
func (c *Expert) CompanyDetail(id uint64) (*ExpertCompanyDetailInfo, error) {
|
||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||
mUserCooperateEnterprise.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mUserCooperateEnterprise.UserCooperateEnterprise, []string{"id", "title", "paper", "patent"})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, errors.New("操作错误,企业信息不存在或已被删除")
|
||||
}
|
||||
out := &ExpertCompanyDetailInfo{
|
||||
Title: mUserCooperateEnterprise.Title,
|
||||
Patent: make([]*technology.PatentInfo, 0),
|
||||
Paper: make([]*technology.PaperInfo, 0),
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
||||
patents := make([]*model.SysPatentInfo, 0)
|
||||
|
||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", mUserCooperateEnterprise.GetPatentAttribute())); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range patents {
|
||||
out.Patent = append(out.Patent, &technology.PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysPatentInfo: v,
|
||||
})
|
||||
}
|
||||
// 论文信息
|
||||
mTechnologyPaper := model.NewTechnologyPaper()
|
||||
|
||||
papers := make([]*model2.TechnologyPaper, 0)
|
||||
|
||||
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", mUserCooperateEnterprise.GetPaperAttribute()),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range papers {
|
||||
out.Paper = append(out.Paper, &technology.PaperInfo{
|
||||
ID: v.GetEncodeID(), Title: v.Title, Ext: v.Ext, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
// CooperateDetail 公司企业详细信息
|
||||
func (c *Expert) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
return cooperateDetail(id)
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
|
135
app/api/website/controller/manage/laboratory.go
Normal file
135
app/api/website/controller/manage/laboratory.go
Normal file
@ -0,0 +1,135 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
)
|
||||
|
||||
type Laboratory struct {
|
||||
*session.Enterprise
|
||||
}
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise) *Laboratory
|
||||
|
||||
type (
|
||||
// LaboratoryBasicInfo 基本信息
|
||||
LaboratoryBasicInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageLaboratoryInfo
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
}
|
||||
// LaboratoryInstanceInfo 实验室信息
|
||||
LaboratoryInstanceInfo struct {
|
||||
LaboratoryBasicInfo
|
||||
}
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// Instance 实验室信息
|
||||
func (c *Laboratory) Instance(id uint64) (*LaboratoryInstanceInfo, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
out, err := mManageLaboratory.Instance(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &LaboratoryInstanceInfo{
|
||||
LaboratoryBasicInfo: LaboratoryBasicInfo{
|
||||
ID: out.GetEncodeID(),
|
||||
ManageLaboratoryInfo: &model.ManageLaboratoryInfo{
|
||||
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)
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise) *Laboratory {
|
||||
return &Laboratory{session}
|
||||
}
|
||||
}
|
@ -23,10 +23,8 @@ type (
|
||||
// searchIdentityHandle 搜索信息处理
|
||||
var searchIdentityHandle = map[int]func(ids []uint64) (interface{}, error){
|
||||
config.TenantUserIdentityForCompany: company,
|
||||
config.TenantUserIdentityForExpert: company,
|
||||
config.TenantUserIdentityForResearch: company,
|
||||
config.TenantUserIdentityForLaboratory: company,
|
||||
config.TenantUserIdentityForAgent: company,
|
||||
config.TenantUserIdentityForExpert: expert,
|
||||
config.TenantUserIdentityForLaboratory: laboratory,
|
||||
}
|
||||
|
||||
// company 公司信息
|
||||
@ -67,6 +65,8 @@ func expert(ids []uint64) (interface{}, error) {
|
||||
list := make([]*ExpertBasicInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
v.Image.Image = v.Image.Analysis(config2.SettingInfo.Domain)
|
||||
|
||||
list = append(list, &ExpertBasicInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
Name: v.Name,
|
||||
@ -80,32 +80,25 @@ func expert(ids []uint64) (interface{}, error) {
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func research(ids []uint64) (interface{}, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
out := make([]*model2.ManageCompany, 0)
|
||||
// laboratory 实验室信息
|
||||
func laboratory(ids []uint64) (interface{}, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
|
||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &out, []string{}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", ids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree),
|
||||
}); err != nil {
|
||||
out, err := mManageLaboratory.Laboratory(model2.NewWhereIn("id", ids))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
list := make([]*LaboratoryBasicInfo, 0)
|
||||
|
||||
func laboratory(ids []uint64) (interface{}, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
out := make([]*model2.ManageCompany, 0)
|
||||
|
||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &out, []string{}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", ids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
for _, v := range out {
|
||||
list = append(list, &LaboratoryBasicInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
ManageLaboratoryInfo: v,
|
||||
Industrys: v.GetIndustryAttribute(),
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
Researchs: v.GetResearchAttribute(),
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user