feat:优化项目信息,待测试修改
This commit is contained in:
@ -174,9 +174,9 @@ func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
return nil, err
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
if err = model2.Count(mSysPatent.SysPatent, &out.PatentCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp)); err != nil {
|
||||
if err = model2.Count(mTechnologyPatent.TechnologyPatent, &out.PatentCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//成果信息
|
||||
@ -250,8 +250,8 @@ func (c *Index) DistributionDemand(province, city string) (map[string]*InstanceD
|
||||
|
||||
// DistributionPatent 专利信息
|
||||
func (c *Index) DistributionPatent(province, city string) (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
out, err := mSysPatent.Distribution()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
out, err := mTechnologyPatent.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -281,9 +281,9 @@ func (c *Index) DistributionAchievementAndPatent(province, city string) (map[str
|
||||
|
||||
var err error
|
||||
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
// 专利信息
|
||||
if patent, err = mSysPatent.Distribution(); err != nil {
|
||||
if patent, err = mTechnologyPatent.Distribution(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||
@ -329,8 +329,6 @@ func (c *Index) Instance() (*InstanceInfo, error) {
|
||||
|
||||
func NewIndex() IndexHandle {
|
||||
return func(session *session.Enterprise) *Index {
|
||||
return &Index{
|
||||
session,
|
||||
}
|
||||
return &Index{session}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.PatentInfo
|
||||
*model.TechnologyPatentBasicInfo
|
||||
}
|
||||
// PaperInfo 论文信息
|
||||
PaperInfo struct {
|
||||
@ -122,20 +122,25 @@ func project(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
|
||||
// patent 专利信息
|
||||
func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
var count int64
|
||||
out := make([]*model.TechnologyPatentBasicInfo, 0)
|
||||
|
||||
out, err := mUserPatent.Patent(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids))
|
||||
|
||||
if err != nil {
|
||||
if err := model2.PagesFields(mTechnologyPatent.TechnologyPatent, &out, []string{
|
||||
"id", "title", "apply_at", "description",
|
||||
}, page, pageSize, &count, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("uid", uids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*PatentInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
PatentInfo: v,
|
||||
ID: v.GetEncodeID(), TechnologyPatentBasicInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -216,17 +221,17 @@ func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
Paper: make([]*technology.PaperInfo, 0),
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
patents := make([]*model.SysPatentInfo, 0)
|
||||
patents := make([]*model.TechnologyPatentInfo, 0)
|
||||
|
||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", strings.Split(mManageCooperateEnterprise.Patent, ","))); err != nil {
|
||||
if patents, err = mTechnologyPatent.Instance(model2.NewWhereIn("p.id", strings.Split(mManageCooperateEnterprise.Patent, ","))); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range patents {
|
||||
out.Patent = append(out.Patent, &technology.PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysPatentInfo: v,
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyPatentInfo: v,
|
||||
})
|
||||
}
|
||||
// 论文信息
|
||||
|
@ -58,15 +58,15 @@ func (c *Expert) Instance(id uint64) (*ExpertInstanceInfo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
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]))
|
||||
mTechnologyPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0]))
|
||||
patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mTechnologyPatent.KindTitle(), objs[1]))
|
||||
}
|
||||
}
|
||||
_industrys := make([]string, 0)
|
||||
|
@ -61,7 +61,7 @@ func searchExpert(page, pageSize int, keyword, industry string, params map[strin
|
||||
}
|
||||
list := make([]*ExpertInfo, 0)
|
||||
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
for _, v := range experts {
|
||||
_industrys := make([]string, 0)
|
||||
@ -74,8 +74,8 @@ func searchExpert(page, pageSize int, keyword, industry string, params map[strin
|
||||
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]))
|
||||
mTechnologyPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0]))
|
||||
patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mTechnologyPatent.KindTitle(), objs[1]))
|
||||
}
|
||||
}
|
||||
list = append(list, &ExpertInfo{
|
||||
|
@ -40,11 +40,11 @@ func searchPatent(page, pageSize int, keyword, industry string, params map[strin
|
||||
if len(ids) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
patents := make([]*model2.SysPatent, 0)
|
||||
|
||||
if err = model2.ScanFields(mSysPatent.SysPatent, &patents, []string{"id", "kind", "title", "apply_at", "description"},
|
||||
if err = model2.ScanFields(mTechnologyPatent.TechnologyPatent, &patents, []string{"id", "kind", "title", "apply_at", "description"},
|
||||
&model2.ModelWhereOrder{Where: model2.NewWhereIn("id", ids)}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Patent struct{}
|
||||
@ -17,12 +16,12 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.SysPatentInfo
|
||||
*model.TechnologyPatentInfo
|
||||
}
|
||||
// PatentDetailInfo 专利详细信息
|
||||
PatentDetailInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.SysPatent
|
||||
*model2.TechnologyPatent
|
||||
}
|
||||
)
|
||||
|
||||
@ -44,14 +43,12 @@ func (c *Patent) Instance(title, industry string, page, pageSize int) (*controll
|
||||
|
||||
var count int64
|
||||
|
||||
fmt.Println(out)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out == nil {
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
ids := make([]uint64, 0)
|
||||
|
||||
@ -59,15 +56,15 @@ func (c *Patent) Instance(title, industry string, page, pageSize int) (*controll
|
||||
val := v.(*service.ESPatent)
|
||||
ids = append(ids, val.ID)
|
||||
}
|
||||
ret := make([]*model.SysPatentInfo, 0)
|
||||
ret := make([]*model.TechnologyPatentInfo, 0)
|
||||
|
||||
if ret, err = mSysPatent.Patents(page, pageSize, &count, model2.NewWhereIn("p.id", ids)); err != nil {
|
||||
if ret, err = mTechnologyPatent.Patents(page, pageSize, &count, model2.NewWhereIn("p.id", ids)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range ret {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysPatentInfo: v,
|
||||
ID: v.GetEncodeID(),
|
||||
TechnologyPatentInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count1}, nil
|
||||
@ -75,17 +72,17 @@ func (c *Patent) Instance(title, industry string, page, pageSize int) (*controll
|
||||
|
||||
// Detail 详细信息
|
||||
func (c *Patent) Detail(id uint64) (*PatentDetailInfo, error) {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
mSysPatent.ID = id
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
mTechnologyPatent.ID = id
|
||||
|
||||
isExist, err := model2.First(mSysPatent.SysPatent)
|
||||
isExist, err := model2.First(mTechnologyPatent.TechnologyPatent)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, errors.New("操作错误,专利信息不存在或已被删除")
|
||||
}
|
||||
return &PatentDetailInfo{ID: mSysPatent.GetEncodeID(), SysPatent: mSysPatent.SysPatent}, nil
|
||||
return &PatentDetailInfo{ID: mTechnologyPatent.GetEncodeID(), TechnologyPatent: mTechnologyPatent.TechnologyPatent}, nil
|
||||
}
|
||||
|
||||
func NewPatent() PatentHandle {
|
||||
|
Reference in New Issue
Block a user