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 err
|
||||||
}
|
}
|
||||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
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 {
|
if identity == config.TenantUserIdentityForCompany {
|
||||||
for k, v := range params {
|
for k, v := range params {
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
config2 "SciencesServer/config"
|
config2 "SciencesServer/config"
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,6 +38,8 @@ type (
|
|||||||
ExpertDetail struct {
|
ExpertDetail struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
TenantID string `json:"tenant_id"`
|
TenantID string `json:"tenant_id"`
|
||||||
|
ResearchID string `json:"research_id"`
|
||||||
|
LaboratoryID string `json:"laboratory_id"`
|
||||||
*model2.ManageExpert
|
*model2.ManageExpert
|
||||||
Industrys []*config.Industry `json:"industrys"`
|
Industrys []*config.Industry `json:"industrys"`
|
||||||
Keywords []string `json:"keywords"`
|
Keywords []string `json:"keywords"`
|
||||||
@ -112,6 +115,8 @@ func (c *Expert) Detail(id uint64) (*ExpertDetail, error) {
|
|||||||
return &ExpertDetail{
|
return &ExpertDetail{
|
||||||
ID: out.GetEncodeID(),
|
ID: out.GetEncodeID(),
|
||||||
TenantID: out.GetEncodeTenantID(),
|
TenantID: out.GetEncodeTenantID(),
|
||||||
|
ResearchID: (&model2.Model{ID: out.ResearchID}).GetEncodeID(),
|
||||||
|
LaboratoryID: (&model2.Model{ID: out.LaboratoryID}).GetEncodeID(),
|
||||||
ManageExpert: out.ManageExpert,
|
ManageExpert: out.ManageExpert,
|
||||||
Industrys: _industrys,
|
Industrys: _industrys,
|
||||||
Keywords: out.GetKeywordAttribute(),
|
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.TenantID = c.TenantID
|
||||||
mManageExpert.ResearchID = other.ConvertResearch()
|
mManageExpert.ResearchID = other.ConvertResearch()
|
||||||
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
||||||
|
@ -91,15 +91,13 @@ func (c *Laboratory) Select(tenantID, researchID uint64) ([]*LaboratorySelect, e
|
|||||||
out := make([]*model2.ManageResearch, 0)
|
out := make([]*model2.ManageResearch, 0)
|
||||||
|
|
||||||
where := []*model2.ModelWhereOrder{
|
where := []*model2.ModelWhereOrder{
|
||||||
&model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("tenant_id", tenantID)},
|
|
||||||
&model2.ModelWhereOrder{
|
&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree)},
|
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree)},
|
||||||
}
|
}
|
||||||
|
|
||||||
if researchID > 0 {
|
if researchID > 0 {
|
||||||
where = append(where, &model2.ModelWhereOrder{
|
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 {
|
if err := model2.ScanFields(mManageResearch.ManageResearch, &out, []string{"id", "name"}, where...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -3,9 +3,11 @@ package manage
|
|||||||
import (
|
import (
|
||||||
"SciencesServer/app/api/website/controller/technology"
|
"SciencesServer/app/api/website/controller/technology"
|
||||||
"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"
|
||||||
"errors"
|
"errors"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 公用参数信息
|
// 公用参数信息
|
||||||
@ -13,8 +15,15 @@ import (
|
|||||||
type (
|
type (
|
||||||
// AchievementInfo 成果信息
|
// AchievementInfo 成果信息
|
||||||
AchievementInfo struct {
|
AchievementInfo struct {
|
||||||
*model.TechnologyAchievementInfo
|
//*model.TechnologyAchievementInfo
|
||||||
Config *model2.TechnologyAchievementConfig `json:"config"`
|
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 项目信息
|
||||||
ProjectInfo struct {
|
ProjectInfo struct {
|
||||||
@ -57,7 +66,7 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
|||||||
|
|
||||||
var count int64
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -65,9 +74,20 @@ func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, er
|
|||||||
list := make([]*AchievementInfo, 0)
|
list := make([]*AchievementInfo, 0)
|
||||||
|
|
||||||
for _, v := range out {
|
for _, v := range out {
|
||||||
|
_industrys := make([]string, 0)
|
||||||
|
|
||||||
|
for _, v := range v.GetIndustryAttribute() {
|
||||||
|
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||||
|
}
|
||||||
list = append(list, &AchievementInfo{
|
list = append(list, &AchievementInfo{
|
||||||
TechnologyAchievementInfo: v,
|
ID: v.GetEncodeID(),
|
||||||
Config: v.GetConfigAttribute(),
|
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
|
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
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
mTechnologyPaper := model.NewTechnologyPaper()
|
mTechnologyPaper := model.NewTechnologyPaper()
|
||||||
|
|
||||||
@ -127,7 +148,7 @@ func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
|||||||
|
|
||||||
var count int64
|
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{
|
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),
|
||||||
@ -181,7 +202,8 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
|||||||
mManageCooperateEnterprise := model.NewManageCooperateEnterprise()
|
mManageCooperateEnterprise := model.NewManageCooperateEnterprise()
|
||||||
mManageCooperateEnterprise.ID = id
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -198,7 +220,7 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
|||||||
|
|
||||||
patents := make([]*model.SysPatentInfo, 0)
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, v := range patents {
|
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"},
|
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
||||||
&model2.ModelWhereOrder{
|
&model2.ModelWhereOrder{
|
||||||
Where: model2.NewWhereIn("id", mManageCooperateEnterprise.GetPaperAttribute()),
|
Where: model2.NewWhereIn("id", strings.Split(mManageCooperateEnterprise.Paper, ",")),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -74,6 +74,8 @@ func (c *Expert) Instance(id uint64) (*ExpertInstanceInfo, error) {
|
|||||||
for _, v := range out.GetIndustryAttribute() {
|
for _, v := range out.GetIndustryAttribute() {
|
||||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/").Value)
|
||||||
}
|
}
|
||||||
|
// 查询成果信息
|
||||||
|
|
||||||
return &ExpertInstanceInfo{
|
return &ExpertInstanceInfo{
|
||||||
ExpertBasicInfo: ExpertBasicInfo{
|
ExpertBasicInfo: ExpertBasicInfo{
|
||||||
ID: out.GetEncodeID(),
|
ID: out.GetEncodeID(),
|
||||||
|
@ -13,6 +13,7 @@ type TechnologyAchievement struct {
|
|||||||
// TechnologyAchievementInfo 技术成果信息
|
// TechnologyAchievementInfo 技术成果信息
|
||||||
type TechnologyAchievementInfo struct {
|
type TechnologyAchievementInfo struct {
|
||||||
*model.TechnologyAchievement
|
*model.TechnologyAchievement
|
||||||
|
ResearchName string `json:"research_name"`
|
||||||
VisitCount int `json:"visit_count"`
|
VisitCount int `json:"visit_count"`
|
||||||
CollectCount int `json:"collect_count"`
|
CollectCount int `json:"collect_count"`
|
||||||
}
|
}
|
||||||
@ -21,11 +22,15 @@ type TechnologyAchievementInfo struct {
|
|||||||
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.config", "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", "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",
|
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)).
|
||||||
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",
|
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)).
|
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.status = ?", model.TechnologyStatusKindForAgree).
|
||||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ type (
|
|||||||
PatentInfo struct {
|
PatentInfo struct {
|
||||||
model.Model
|
model.Model
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
ApplyAt string `json:"apply_at"`
|
ApplyAt string `json:"apply_at"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -408,7 +408,7 @@ func registerAdminAPI(app *gin.Engine) {
|
|||||||
|
|
||||||
// registerEnterpriseAPI 注册企业/管家后台API
|
// registerEnterpriseAPI 注册企业/管家后台API
|
||||||
func registerEnterpriseAPI(app *gin.Engine) {
|
func registerEnterpriseAPI(app *gin.Engine) {
|
||||||
apiPrefix := "/enterprise"
|
apiPrefix := "/api/enterprise"
|
||||||
g := app.Group(apiPrefix)
|
g := app.Group(apiPrefix)
|
||||||
|
|
||||||
v1 := g.Group("/v1")
|
v1 := g.Group("/v1")
|
||||||
|
Reference in New Issue
Block a user