feat:完善信息
This commit is contained in:
@ -184,7 +184,9 @@ func (c *Examine) Launch(id uint64, identity, status int, remark string, params
|
||||
return err
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
values := map[string]interface{}{"examine_status": status, "examine_remark": remark, "updated_at": time.Now()}
|
||||
values := map[string]interface{}{
|
||||
//"examine_status": status,
|
||||
"examine_remark": remark, "updated_at": time.Now()}
|
||||
|
||||
if identity == config.TenantUserIdentityForCompany {
|
||||
for k, v := range params {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
config2 "SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -35,8 +36,10 @@ type (
|
||||
}
|
||||
// ExpertDetail 专家详细信息
|
||||
ExpertDetail struct {
|
||||
ID string `json:"id"`
|
||||
TenantID string `json:"tenant_id"`
|
||||
ID string `json:"id"`
|
||||
TenantID string `json:"tenant_id"`
|
||||
ResearchID string `json:"research_id"`
|
||||
LaboratoryID string `json:"laboratory_id"`
|
||||
*model2.ManageExpert
|
||||
Industrys []*config.Industry `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
@ -112,6 +115,8 @@ func (c *Expert) Detail(id uint64) (*ExpertDetail, error) {
|
||||
return &ExpertDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
TenantID: out.GetEncodeTenantID(),
|
||||
ResearchID: (&model2.Model{ID: out.ResearchID}).GetEncodeID(),
|
||||
LaboratoryID: (&model2.Model{ID: out.LaboratoryID}).GetEncodeID(),
|
||||
ManageExpert: out.ManageExpert,
|
||||
Industrys: _industrys,
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
@ -148,6 +153,7 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println(utils.AnyToJSON(other))
|
||||
mManageExpert.TenantID = c.TenantID
|
||||
mManageExpert.ResearchID = other.ConvertResearch()
|
||||
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
||||
|
@ -91,15 +91,13 @@ func (c *Laboratory) Select(tenantID, researchID uint64) ([]*LaboratorySelect, e
|
||||
out := make([]*model2.ManageResearch, 0)
|
||||
|
||||
where := []*model2.ModelWhereOrder{
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("tenant_id", tenantID)},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree)},
|
||||
}
|
||||
|
||||
if researchID > 0 {
|
||||
where = append(where, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("research_id", tenantID)})
|
||||
Where: model2.NewWhere("research_id", researchID)})
|
||||
}
|
||||
if err := model2.ScanFields(mManageResearch.ManageResearch, &out, []string{"id", "name"}, where...); err != nil {
|
||||
return nil, err
|
||||
|
@ -3,9 +3,11 @@ package manage
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller/technology"
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 公用参数信息
|
||||
@ -13,8 +15,15 @@ import (
|
||||
type (
|
||||
// AchievementInfo 成果信息
|
||||
AchievementInfo struct {
|
||||
*model.TechnologyAchievementInfo
|
||||
Config *model2.TechnologyAchievementConfig `json:"config"`
|
||||
//*model.TechnologyAchievementInfo
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
CooperationModeTitle string `json:"cooperation_mode_title"`
|
||||
ResearchName string `json:"research_name"`
|
||||
VisitCount int `json:"visit_count"`
|
||||
CollectCount int `json:"collect_count"`
|
||||
}
|
||||
// ProjectInfo 项目信息
|
||||
ProjectInfo struct {
|
||||
@ -57,7 +66,7 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
||||
|
||||
var count int64
|
||||
|
||||
out, err := mTechnologyAchievement.Achievements(page, pageSize, &count, model2.NewWhereIn("uid", uids))
|
||||
out, err := mTechnologyAchievement.Achievements(page, pageSize, &count, model2.NewWhereIn("a.uid", uids))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -65,9 +74,20 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
||||
list := make([]*AchievementInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range v.GetIndustryAttribute() {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||
}
|
||||
list = append(list, &AchievementInfo{
|
||||
TechnologyAchievementInfo: v,
|
||||
Config: v.GetConfigAttribute(),
|
||||
ID: v.GetEncodeID(),
|
||||
Title: v.Title,
|
||||
Industrys: _industrys,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
CooperationModeTitle: config.GetTechnologyCooperationModeTitle(v.CooperationMode),
|
||||
ResearchName: v.ResearchName,
|
||||
VisitCount: v.VisitCount,
|
||||
CollectCount: v.CollectCount,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -120,6 +140,7 @@ func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mTechnologyPaper := model.NewTechnologyPaper()
|
||||
|
||||
@ -127,7 +148,7 @@ func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
|
||||
var count int64
|
||||
|
||||
if err := model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "keyword"},
|
||||
if err := model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "author", "keyword"},
|
||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
@ -181,7 +202,8 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
mManageCooperateEnterprise := model.NewManageCooperateEnterprise()
|
||||
mManageCooperateEnterprise.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mManageCooperateEnterprise.ManageCooperateEnterprise, []string{"id", "title", "paper", "patent"})
|
||||
isExist, err := model2.FirstField(mManageCooperateEnterprise.ManageCooperateEnterprise,
|
||||
[]string{"id", "paper", "patent", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -198,7 +220,7 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
|
||||
patents := make([]*model.SysPatentInfo, 0)
|
||||
|
||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", mManageCooperateEnterprise.GetPatentAttribute())); err != nil {
|
||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", strings.Split(mManageCooperateEnterprise.Patent, ","))); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range patents {
|
||||
@ -214,7 +236,7 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
|
||||
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", mManageCooperateEnterprise.GetPaperAttribute()),
|
||||
Where: model2.NewWhereIn("id", strings.Split(mManageCooperateEnterprise.Paper, ",")),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
|
@ -74,6 +74,8 @@ func (c *Expert) Instance(id uint64) (*ExpertInstanceInfo, error) {
|
||||
for _, v := range out.GetIndustryAttribute() {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||
}
|
||||
// 查询成果信息
|
||||
|
||||
return &ExpertInstanceInfo{
|
||||
ExpertBasicInfo: ExpertBasicInfo{
|
||||
ID: out.GetEncodeID(),
|
||||
|
@ -13,19 +13,24 @@ type TechnologyAchievement struct {
|
||||
// TechnologyAchievementInfo 技术成果信息
|
||||
type TechnologyAchievementInfo struct {
|
||||
*model.TechnologyAchievement
|
||||
VisitCount int `json:"visit_count"`
|
||||
CollectCount int `json:"collect_count"`
|
||||
ResearchName string `json:"research_name"`
|
||||
VisitCount int `json:"visit_count"`
|
||||
CollectCount int `json:"collect_count"`
|
||||
}
|
||||
|
||||
// Achievements 成果信息
|
||||
func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyAchievementInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
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", "r.name AS research_name", "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",
|
||||
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON a.id = c.object_id",
|
||||
model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON a.uid = u_e.uid AND u_e.is_deleted = %d AND u_e.invalid_status = %d",
|
||||
model.NewUserExpert().TableName(), model.DeleteStatusForNot, model.InvalidStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Where("a.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
@ -14,8 +14,9 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
model.Model
|
||||
Title string `json:"title"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
}
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user