feat:完善信息
This commit is contained in:
@ -154,12 +154,12 @@ func cooperate(uids []uint64, page, pageSize int) (*controller.ReturnPages, erro
|
|||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
|
|
||||||
if err := model2.PagesFields(mManageCooperateEnterprise.ManageCooperateEnterprise, &out, []string{"id", "title", "paper", "patent"},
|
if err := model2.PagesFields(mManageCooperateEnterprise.ManageCooperateEnterprise, &out, []string{"id", "name", "paper", "patent"},
|
||||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhereIn("uid", uids),
|
Where: model2.NewWhereIn("uid", uids),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
}, &model2.ModelWhereOrder{
|
}, &model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("kind", model2.ManageCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
Where: model2.NewWhere("mode", model2.ManageCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,13 @@ package manage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"SciencesServer/app/api/website/model"
|
"SciencesServer/app/api/website/model"
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
"SciencesServer/app/basic/controller"
|
"SciencesServer/app/basic/controller"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/session"
|
"SciencesServer/app/session"
|
||||||
|
config2 "SciencesServer/config"
|
||||||
|
"SciencesServer/utils"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +24,7 @@ type (
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
School string `json:"school"`
|
School string `json:"school"`
|
||||||
|
Image string `json:"image"`
|
||||||
Major string `json:"major"`
|
Major string `json:"major"`
|
||||||
Industrys []string `json:"industrys"`
|
Industrys []string `json:"industrys"`
|
||||||
Keywords []string `json:"keywords"`
|
Keywords []string `json:"keywords"`
|
||||||
@ -51,15 +56,32 @@ func (c *Expert) Instance(id uint64) (*ExpertInstanceInfo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
|
||||||
|
patentTitles := make([]string, 0)
|
||||||
|
|
||||||
|
if out.PatentTitle != "" {
|
||||||
|
for _, val := range strings.Split(out.PatentTitle, "&&") {
|
||||||
|
objs := strings.Split(val, "$$")
|
||||||
|
mSysPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0]))
|
||||||
|
patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mSysPatent.KindTitle(), objs[1]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_industrys := make([]string, 0)
|
||||||
|
|
||||||
|
for _, v := range out.GetIndustryAttribute() {
|
||||||
|
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||||
|
}
|
||||||
return &ExpertInstanceInfo{
|
return &ExpertInstanceInfo{
|
||||||
ExpertBasicInfo: ExpertBasicInfo{
|
ExpertBasicInfo: ExpertBasicInfo{
|
||||||
ID: out.GetEncodeID(),
|
ID: out.GetEncodeID(),
|
||||||
Name: out.Name,
|
Name: out.Name,
|
||||||
|
Image: out.Image.Analysis(config2.SystemConfig[config2.SysImageDomain]),
|
||||||
School: out.School,
|
School: out.School,
|
||||||
Major: out.Major,
|
Major: out.Major,
|
||||||
Industrys: out.GetIndustryAttribute(),
|
Industrys: _industrys,
|
||||||
Keywords: out.GetKeywordAttribute(),
|
Keywords: out.GetKeywordAttribute(),
|
||||||
PatentTitles: strings.Split(out.PatentTitle, "&&"),
|
PatentTitles: patentTitles,
|
||||||
},
|
},
|
||||||
Researchs: out.GetResearchAttribute(),
|
Researchs: out.GetResearchAttribute(),
|
||||||
Introduce: out.Introduce,
|
Introduce: out.Introduce,
|
||||||
|
|||||||
@ -7,13 +7,21 @@ import (
|
|||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
config2 "SciencesServer/config"
|
config2 "SciencesServer/config"
|
||||||
|
"SciencesServer/utils"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// ExpertInfo 专家信息
|
// ExpertInfo 专家信息
|
||||||
ExpertInfo struct {
|
ExpertInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
*model.ManageExpertInfo
|
Name string `json:"name"`
|
||||||
|
Image string `json:"image"`
|
||||||
|
School string `json:"school"`
|
||||||
|
Major string `json:"major"`
|
||||||
|
ResearchName string `json:"research_name"`
|
||||||
|
PatentTitle []string `json:"patent_title"`
|
||||||
Industrys []string `json:"industrys"`
|
Industrys []string `json:"industrys"`
|
||||||
Keywords []string `json:"keywords"`
|
Keywords []string `json:"keywords"`
|
||||||
}
|
}
|
||||||
@ -53,17 +61,26 @@ func searchExpert(page, pageSize int, keyword, industry string, params map[strin
|
|||||||
}
|
}
|
||||||
list := make([]*ExpertInfo, 0)
|
list := make([]*ExpertInfo, 0)
|
||||||
|
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
|
||||||
for _, v := range experts {
|
for _, v := range experts {
|
||||||
_industrys := make([]string, 0)
|
_industrys := make([]string, 0)
|
||||||
|
|
||||||
for _, v := range v.GetIndustryAttribute() {
|
for _, v := range v.GetIndustryAttribute() {
|
||||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||||
}
|
}
|
||||||
|
patentTitles := make([]string, 0)
|
||||||
|
|
||||||
v.Image.Image = v.Image.Analysis(config2.SystemConfig[config2.SysImageDomain])
|
if v.PatentTitle != "" {
|
||||||
|
for _, val := range strings.Split(v.PatentTitle, "&&") {
|
||||||
|
objs := strings.Split(val, "$$")
|
||||||
|
mSysPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0]))
|
||||||
|
patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mSysPatent.KindTitle(), objs[1]))
|
||||||
|
}
|
||||||
|
}
|
||||||
list = append(list, &ExpertInfo{
|
list = append(list, &ExpertInfo{
|
||||||
ID: v.GetEncodeID(), ManageExpertInfo: v,
|
ID: v.GetEncodeID(), Name: v.Name, Image: v.Image.Analysis(config2.SystemConfig[config2.SysImageDomain]),
|
||||||
|
School: v.School, Major: v.Major, ResearchName: v.ResearchName, PatentTitle: patentTitles,
|
||||||
Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ type ManageExpert struct {
|
|||||||
type ManageExpertInfo struct {
|
type ManageExpertInfo struct {
|
||||||
*model.ManageExpert
|
*model.ManageExpert
|
||||||
PatentTitle string `json:"-"`
|
PatentTitle string `json:"-"`
|
||||||
|
ResearchName string `json:"research_name"`
|
||||||
Research string `json:"-"`
|
Research string `json:"-"`
|
||||||
Introduce string `json:"introduce"`
|
Introduce string `json:"introduce"`
|
||||||
}
|
}
|
||||||
@ -25,13 +26,14 @@ func (m *ManageExpert) Expert(limit int, where ...*model.ModelWhere) ([]*ManageE
|
|||||||
mUserPatent := model.NewUserPatent()
|
mUserPatent := model.NewUserPatent()
|
||||||
|
|
||||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||||
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword",
|
Select("e.id", "e.name", "e.industry", "e.image", "e.school", "e.major", "e.keyword",
|
||||||
"p.title AS patent_title").
|
"p.title AS patent_title", "r.name AS research_name").
|
||||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
||||||
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||||
Where("e.examine_status = ?", model.ExamineStatusForAgree).
|
Where("e.examine_status = ?", model.ExamineStatusForAgree).
|
||||||
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
||||||
|
|
||||||
@ -57,12 +59,13 @@ func (m *ManageExpert) Detail(limit int, id uint64) (*ManageExpertInfo, error) {
|
|||||||
|
|
||||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||||
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword", "e.research", "e.introduce",
|
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword", "e.research", "e.introduce",
|
||||||
"p.title AS patent_title").
|
"p.title AS patent_title", "r.name AS research_name").
|
||||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
||||||
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||||
Where("e.id = ?", id)
|
Where("e.id = ?", id)
|
||||||
|
|
||||||
out := new(ManageExpertInfo)
|
out := new(ManageExpertInfo)
|
||||||
|
|||||||
@ -20,7 +20,7 @@ type TechnologyAchievementInfo struct {
|
|||||||
// Achievements 成果信息
|
// Achievements 成果信息
|
||||||
func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyAchievementInfo, error) {
|
func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyAchievementInfo, error) {
|
||||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||||
Select("a.id", "a.title", "a.mode", "a.image", "a.charge_info", "a.industry", "a.customer", "a.maturity",
|
Select("a.id", "a.title", "a.mode", "a.image", "a.config", "a.industry", "a.customer", "a.maturity",
|
||||||
"a.cooperation_mode", "a.keyword", "v.count AS visit_count", "c.count AS collect_count").
|
"a.cooperation_mode", "a.keyword", "v.count AS visit_count", "c.count AS collect_count").
|
||||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, SUM(count) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS v ON a.id = v.object_id",
|
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, SUM(count) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS v ON a.id = v.object_id",
|
||||||
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
|
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
|
||||||
|
|||||||
@ -51,6 +51,17 @@ func (m *SysPatent) TableName() string {
|
|||||||
return "sys_patent"
|
return "sys_patent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *SysPatent) KindTitle() string {
|
||||||
|
if m.Kind == SysParentKindForInvent {
|
||||||
|
return "发明专利"
|
||||||
|
} else if m.Kind == SysParentKindForDesign {
|
||||||
|
return "外观设计"
|
||||||
|
} else if m.Kind == SysParentKindForNewPractical {
|
||||||
|
return "实用新型"
|
||||||
|
}
|
||||||
|
return "未知"
|
||||||
|
}
|
||||||
|
|
||||||
func NewSysPatent() *SysPatent {
|
func NewSysPatent() *SysPatent {
|
||||||
return &SysPatent{}
|
return &SysPatent{}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user