feat:完善项目信息
This commit is contained in:
@ -208,6 +208,76 @@ func (*Manage) Expert(c *gin.Context) {
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertAchievement(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Achievement(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertProject(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Project(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertPatent(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Patent(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertPaper(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Paper(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertCooperate(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Cooperate(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ResearchLaboratory(c *gin.Context) {
|
||||
form := &struct {
|
||||
Name string `json:"name" form:"name"`
|
||||
@ -236,6 +306,88 @@ func (*Manage) ResearchVisit(c *gin.Context) {
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryAchievement(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Achievement(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryProject(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Project(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryPatent(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Patent(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryPaper(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Paper(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryCooperate(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Cooperate(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) LaboratoryCooperateDetail(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
CooperateDetail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) AgentCompany(c *gin.Context) {
|
||||
form := &struct {
|
||||
Name string `json:"name" form:"name"`
|
||||
|
@ -2,9 +2,13 @@ package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Company 公司信息
|
||||
@ -29,6 +33,16 @@ type (
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
// CompanyMatchInfo 公司匹配信息
|
||||
CompanyMatchInfo struct {
|
||||
ID string `json:"id"`
|
||||
Kind model2.ManageCompanyKind `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Image string `json:"image"`
|
||||
Product string `json:"product"`
|
||||
Url string `json:"url"`
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
)
|
||||
|
||||
// Detail 详细信息
|
||||
@ -88,6 +102,53 @@ func (c *Company) Product(id uint64, page, pageSize int) ([]*CompanyProductInfo,
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Match 匹配信息
|
||||
func (c *Company) Match(title string, industrys, keywords []string) ([]*CompanyMatchInfo, 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{}{
|
||||
"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)
|
||||
}
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
companys := make([]*model2.ManageCompany, 0)
|
||||
|
||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &companys, []string{"id", "kind", "name", "image", "url", "keyword"},
|
||||
&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
|
||||
}
|
||||
|
||||
list := make([]*CompanyMatchInfo, 0)
|
||||
|
||||
for _, v := range companys {
|
||||
list = append(list, &CompanyMatchInfo{
|
||||
ID: v.GetEncodeID(), Kind: v.Kind, Name: v.Name,
|
||||
Image: v.Image.Analysis(config2.SettingInfo.Domain),
|
||||
Url: v.Url,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Enterprise, local string) *Company {
|
||||
return &Company{
|
||||
|
@ -91,7 +91,7 @@ func (c *Laboratory) Match(title string, industrys, keywords []string) ([]*Labor
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Instance 实验室信息
|
||||
// Detail 实验室信息
|
||||
func (c *Laboratory) Detail(id uint64) (*LaboratoryMatchInfo, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
out, err := mManageLaboratory.Instance(model2.NewWhere("l.id", id))
|
||||
|
@ -1,6 +1,7 @@
|
||||
package technology
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/manage"
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
@ -65,13 +66,13 @@ func matchPatent(title string, industrys, keywords []string) (interface{}, error
|
||||
|
||||
// matchExpect 专家匹配
|
||||
func matchExpect(title string, industrys, keywords []string) (interface{}, error) {
|
||||
return nil, nil
|
||||
return (&manage.Expert{}).Match(title, industrys, keywords)
|
||||
|
||||
}
|
||||
|
||||
// matchLaboratory 实验室匹配
|
||||
func matchLaboratory(title string, industrys, keywords []string) (interface{}, error) {
|
||||
return nil, nil
|
||||
return (&manage.Laboratory{}).Match(title, industrys, keywords)
|
||||
}
|
||||
|
||||
// matchCompany 公司匹配
|
||||
|
Reference in New Issue
Block a user