From 252182f089fcb019880edadd160b07a95592b4b3 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 8 Feb 2022 08:56:28 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/admin/controller/technology/patent.go | 4 +- app/api/admin/model/sys_patent_classify.go | 11 --- .../admin/model/technology_patent_classify.go | 11 +++ app/api/enterprise/controller/sys/patent.go | 18 ++--- .../controller/technology/patent.go | 22 +++--- app/api/enterprise/model/technology_patent.go | 8 +-- app/api/website/controller/manage/expert.go | 2 +- app/api/website/controller/search/expert.go | 2 +- app/api/website/controller/search/patent.go | 12 ++-- app/api/website/model/technology_patent.go | 8 +-- app/common/migrate/instance.go | 3 - app/common/model/sys_patent.go | 68 ------------------- app/common/model/technology_patent.go | 36 +++++----- 13 files changed, 67 insertions(+), 138 deletions(-) delete mode 100644 app/api/admin/model/sys_patent_classify.go create mode 100644 app/api/admin/model/technology_patent_classify.go delete mode 100644 app/common/model/sys_patent.go diff --git a/app/api/admin/controller/technology/patent.go b/app/api/admin/controller/technology/patent.go index 12473a0..08d732c 100644 --- a/app/api/admin/controller/technology/patent.go +++ b/app/api/admin/controller/technology/patent.go @@ -175,7 +175,7 @@ func (c *Patent) Form(params *PatentParams) error { } } } - mTechnologyPatent.Kind = model2.SysParentKind(params.Kind) + mTechnologyPatent.Kind = model2.TechnologyPatentKind(params.Kind) mTechnologyPatent.Title = params.Title mTechnologyPatent.FileUrl = params.FileUrl mTechnologyPatent.ApplyCode = params.ApplyCode @@ -189,7 +189,7 @@ func (c *Patent) Form(params *PatentParams) error { mTechnologyPatent.PrincipalClaim = params.PrincipalClaim mTechnologyPatent.IPCCode = params.IPCCode mTechnologyPatent.ShelfStatus = model2.ShelfStatusKind(params.ShelfStatus) - mTechnologyPatent.Status = model2.SysParentStatus(params.Status) + mTechnologyPatent.Status = model2.TechnologyPatentStatus(params.Status) if mTechnologyPatent.ID > 0 { return model2.Updates(mTechnologyPatent.TechnologyPatent, mTechnologyPatent.TechnologyPatent) diff --git a/app/api/admin/model/sys_patent_classify.go b/app/api/admin/model/sys_patent_classify.go deleted file mode 100644 index e8d5caa..0000000 --- a/app/api/admin/model/sys_patent_classify.go +++ /dev/null @@ -1,11 +0,0 @@ -package model - -import "SciencesServer/app/common/model" - -type SysPatentClassify struct { - *model.SysPatentClassify -} - -func NewSysPatentClassify() *SysPatentClassify { - return &SysPatentClassify{model.NewSysPatentClassify()} -} diff --git a/app/api/admin/model/technology_patent_classify.go b/app/api/admin/model/technology_patent_classify.go new file mode 100644 index 0000000..85a628d --- /dev/null +++ b/app/api/admin/model/technology_patent_classify.go @@ -0,0 +1,11 @@ +package model + +import "SciencesServer/app/common/model" + +type TechnologyPatentClassify struct { + *model.TechnologyPatentClassify +} + +func NewTechnologyPatentClassify() *TechnologyPatentClassify { + return &TechnologyPatentClassify{model.NewTechnologyPatentClassify()} +} diff --git a/app/api/enterprise/controller/sys/patent.go b/app/api/enterprise/controller/sys/patent.go index ae8094a..cb444ee 100644 --- a/app/api/enterprise/controller/sys/patent.go +++ b/app/api/enterprise/controller/sys/patent.go @@ -20,14 +20,14 @@ type PatentHandle func(session *session.Enterprise) *Patent type ( // PatentInfo 专利信息 PatentInfo struct { - ID string `json:"id"` - Kind model2.SysParentKind `json:"kind"` - Title string `json:"title"` - ApplyName string `json:"apply_name"` - ApplyCode string `json:"apply_code"` - ApplyAt string `json:"apply_at"` - Inventor string `json:"inventor"` - CreatedAt time.Time `json:"created_at"` + ID string `json:"id"` + Kind model2.TechnologyPatentKind `json:"kind"` + Title string `json:"title"` + ApplyName string `json:"apply_name"` + ApplyCode string `json:"apply_code"` + ApplyAt string `json:"apply_at"` + Inventor string `json:"inventor"` + CreatedAt time.Time `json:"created_at"` } ) @@ -72,7 +72,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page Where: model2.NewWhereLike("ipc_code", ipcCode), }) } - out := make([]*model2.SysPatent, 0) + out := make([]*model2.TechnologyPatent, 0) var count int64 diff --git a/app/api/enterprise/controller/technology/patent.go b/app/api/enterprise/controller/technology/patent.go index de87b49..dae8433 100644 --- a/app/api/enterprise/controller/technology/patent.go +++ b/app/api/enterprise/controller/technology/patent.go @@ -27,15 +27,15 @@ type ( PatentInfo struct { *sys.PatentInfo ShelfStatus model2.ShelfStatusKind - Status model2.SysParentStatus + Status model2.TechnologyPatentStatus } // PatentMatchInfo 专利匹配信息 PatentMatchInfo struct { - ID string `json:"id"` - Kind model2.SysParentKind `json:"kind"` - Title string `json:"title"` - Description string `json:"description"` - ApplyAt string `json:"apply_at"` + ID string `json:"id"` + Kind model2.TechnologyPatentKind `json:"kind"` + Title string `json:"title"` + Description string `json:"description"` + ApplyAt string `json:"apply_at"` } // PatentDetailInfo 专利详细信息 PatentDetailInfo struct { @@ -67,7 +67,7 @@ func (c *PatentParams) add(tenantID, uid uint64) error { return errors.New("操作错误,申请号或公开(公告)号已存在") } return orm.GetDB().Transaction(func(tx *gorm.DB) error { - mTechnologyPatent.Kind = model2.SysParentKind(c.Kind) + mTechnologyPatent.Kind = model2.TechnologyPatentKind(c.Kind) mTechnologyPatent.TenantID = tenantID mTechnologyPatent.UID = uid mTechnologyPatent.Title = c.Title @@ -82,7 +82,7 @@ func (c *PatentParams) add(tenantID, uid uint64) error { mTechnologyPatent.Description = c.Description mTechnologyPatent.PrincipalClaim = c.PrincipalClaim mTechnologyPatent.IPCCode = c.IPCCode - mTechnologyPatent.Status = model2.SysParentStatus(c.Status) + mTechnologyPatent.Status = model2.TechnologyPatentStatus(c.Status) if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil { return err @@ -121,7 +121,7 @@ func (c *PatentParams) edit(uid uint64) error { return errors.New("操作错误,申请号或公开(公告)号已存在") } } - mTechnologyPatent.Kind = model2.SysParentKind(c.Kind) + mTechnologyPatent.Kind = model2.TechnologyPatentKind(c.Kind) mTechnologyPatent.Title = c.Title mTechnologyPatent.FileUrl = c.FileUrl mTechnologyPatent.ApplyCode = c.ApplyCode @@ -134,7 +134,7 @@ func (c *PatentParams) edit(uid uint64) error { mTechnologyPatent.Description = c.Description mTechnologyPatent.PrincipalClaim = c.PrincipalClaim mTechnologyPatent.IPCCode = c.IPCCode - mTechnologyPatent.Status = model2.SysParentStatus(c.Status) + mTechnologyPatent.Status = model2.TechnologyPatentStatus(c.Status) return model2.Updates(mTechnologyPatent.TechnologyPatent, mTechnologyPatent.TechnologyPatent) } @@ -218,7 +218,7 @@ func (c *Patent) Match(title string, industrys, keywords []string) (*controller. } mTechnologyPatent := model.NewTechnologyPatent() - patents := make([]*model2.SysPatent, 0) + patents := make([]*model2.TechnologyPatent, 0) if err = model2.ScanFields(mTechnologyPatent.TechnologyPatent, &patents, []string{"id", "kind", "title", "description", "apply_at"}, &model2.ModelWhereOrder{ Where: model2.NewWhereIn("id", ids), diff --git a/app/api/enterprise/model/technology_patent.go b/app/api/enterprise/model/technology_patent.go index 6d06a2a..93ae928 100644 --- a/app/api/enterprise/model/technology_patent.go +++ b/app/api/enterprise/model/technology_patent.go @@ -13,10 +13,10 @@ type TechnologyPatent struct { type TechnologyPatentInfo struct { model.Model - Kind model.SysParentKind `json:"kind"` - Title string `json:"title"` - Description string `json:"description"` - ApplyAt string `json:"apply_at"` + Kind model.TechnologyPatentKind `json:"kind"` + Title string `json:"title"` + Description string `json:"description"` + ApplyAt string `json:"apply_at"` } type TechnologyPatentBasicInfo struct { diff --git a/app/api/website/controller/manage/expert.go b/app/api/website/controller/manage/expert.go index a614b77..701d2e7 100644 --- a/app/api/website/controller/manage/expert.go +++ b/app/api/website/controller/manage/expert.go @@ -65,7 +65,7 @@ func (c *Expert) Instance(id uint64) (*ExpertInstanceInfo, error) { if out.PatentTitle != "" { for _, val := range strings.Split(out.PatentTitle, "&&") { objs := strings.Split(val, "$$") - mTechnologyPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0])) + mTechnologyPatent.Kind = model2.TechnologyPatentKind(utils.StringToInt(objs[0])) patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mTechnologyPatent.KindTitle(), objs[1])) } } diff --git a/app/api/website/controller/search/expert.go b/app/api/website/controller/search/expert.go index 0a2a056..e1a0e8f 100644 --- a/app/api/website/controller/search/expert.go +++ b/app/api/website/controller/search/expert.go @@ -74,7 +74,7 @@ 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, "$$") - mTechnologyPatent.Kind = model2.SysParentKind(utils.StringToInt(objs[0])) + mTechnologyPatent.Kind = model2.TechnologyPatentKind(utils.StringToInt(objs[0])) patentTitles = append(patentTitles, fmt.Sprintf("【%s】%s", mTechnologyPatent.KindTitle(), objs[1])) } } diff --git a/app/api/website/controller/search/patent.go b/app/api/website/controller/search/patent.go index 9493928..c502b49 100644 --- a/app/api/website/controller/search/patent.go +++ b/app/api/website/controller/search/patent.go @@ -10,11 +10,11 @@ import ( type ( // PatentInfo 专利信息 PatentInfo struct { - ID string `json:"id"` - Kind model2.SysParentKind `json:"kind"` - Title string `json:"title"` - ApplyAt string `json:"apply_at"` - Description string `json:"description"` + ID string `json:"id"` + Kind model2.TechnologyPatentKind `json:"kind"` + Title string `json:"title"` + ApplyAt string `json:"apply_at"` + Description string `json:"description"` } ) @@ -42,7 +42,7 @@ func searchPatent(page, pageSize int, keyword, industry string, params map[strin } mTechnologyPatent := model.NewTechnologyPatent() - patents := make([]*model2.SysPatent, 0) + patents := make([]*model2.TechnologyPatent, 0) if err = model2.ScanFields(mTechnologyPatent.TechnologyPatent, &patents, []string{"id", "kind", "title", "apply_at", "description"}, &model2.ModelWhereOrder{Where: model2.NewWhereIn("id", ids)}); err != nil { diff --git a/app/api/website/model/technology_patent.go b/app/api/website/model/technology_patent.go index b9abc82..b319ec1 100644 --- a/app/api/website/model/technology_patent.go +++ b/app/api/website/model/technology_patent.go @@ -12,10 +12,10 @@ type TechnologyPatent struct { type TechnologyPatentInfo struct { model.Model - Kind model.SysParentKind `json:"kind"` - Title string `json:"title"` - Description string `json:"description"` - ApplyAt string `json:"apply_at"` + Kind model.TechnologyPatentKind `json:"kind"` + Title string `json:"title"` + Description string `json:"description"` + ApplyAt string `json:"apply_at"` } type ( diff --git a/app/common/migrate/instance.go b/app/common/migrate/instance.go index c82c8e7..c5928d6 100644 --- a/app/common/migrate/instance.go +++ b/app/common/migrate/instance.go @@ -61,9 +61,6 @@ func (this *Instance) Handle() { &synchronized{iModel: model.NewSysConfig(), iValues: func() interface{} { return nil }}, - &synchronized{iModel: model.NewSysPatent(), iValues: func() interface{} { - return nil - }}, &synchronized{iModel: model.NewSysIdentity(), iValues: func() interface{} { out := make([]*model.SysIdentity, 0) diff --git a/app/common/model/sys_patent.go b/app/common/model/sys_patent.go deleted file mode 100644 index 98b797c..0000000 --- a/app/common/model/sys_patent.go +++ /dev/null @@ -1,68 +0,0 @@ -package model - -// SysPatent 专利信息数据模型 -type SysPatent struct { - Model - ModelTenant - UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Kind SysParentKind `gorm:"column:kind;index:idx_sys_patent_kind;type:tinyint(1);default:0;comment:专利类型" json:"kind"` - Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称标题" json:"title"` - FileUrl string `gorm:"column:file_url;type:varchar(255);default:'';comment:文件地址" json:"file_url"` - ApplyCode string `gorm:"column:apply_code;type:varchar(30);default:'';comment:申请号" json:"apply_code"` - ApplyAt string `gorm:"column:apply_at;type:varchar(10);default:'';comment:申请日" json:"apply_at"` - OpenCode string `gorm:"column:open_code;type:varchar(30);default:'';comment:公开(公告)号" json:"open_code"` - OpenAt string `gorm:"column:open_at;type:varchar(10);default:'';comment:公开(公告)日" json:"open_at"` - ApplyName string `gorm:"column:apply_name;type:varchar(255);default:'';comment:申请(专利权)人" json:"apply_name"` - ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:'';comment:申请人地址" json:"apply_address"` - Inventor string `gorm:"column:inventor;type:varchar(255);default:'';comment:发明人" json:"inventor"` - Description string `gorm:"column:description;type:text;comment:摘要" json:"description"` - PrincipalClaim string `gorm:"column:principal_claim;type:text;comment:主权项" json:"principal_claim"` - IPCCode string `gorm:"column:ipc_code;index:idx_sys_patent_ipc_code;type:varchar(30);default:'';comment:IPC主分类号" json:"ipc_code"` - Shelf - Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"` - ModelDeleted - ModelAt -} - -// SysParentKind 专利类型 -type SysParentKind int - -const ( - // SysParentKindForInvent 发明专利 - SysParentKindForInvent SysParentKind = iota + 1 - // SysParentKindForDesign 外观设计 - SysParentKindForDesign - // SysParentKindForNewPractical 实用新型 - SysParentKindForNewPractical -) - -// SysParentStatus 专利状态 -type SysParentStatus int - -const ( - // SysParentStatusForAuthorize 授权 - SysParentStatusForAuthorize SysParentStatus = iota + 1 - // SysParentStatusForActualTrial 实审 - SysParentStatusForActualTrial - // SysParentStatusForPublic 公开 - SysParentStatusForPublic -) - -func (m *SysPatent) TableName() string { - 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 { - return &SysPatent{} -} diff --git a/app/common/model/technology_patent.go b/app/common/model/technology_patent.go index 7b5fb8e..c1f5ddf 100644 --- a/app/common/model/technology_patent.go +++ b/app/common/model/technology_patent.go @@ -4,22 +4,22 @@ package model type TechnologyPatent struct { Model ModelTenant - UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` - Kind SysParentKind `gorm:"column:kind;index:idx_sys_patent_kind;type:tinyint(1);default:0;comment:专利类型" json:"kind"` - Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称标题" json:"title"` - FileUrl string `gorm:"column:file_url;type:varchar(255);default:'';comment:文件地址" json:"file_url"` - ApplyCode string `gorm:"column:apply_code;type:varchar(30);default:'';comment:申请号" json:"apply_code"` - ApplyAt string `gorm:"column:apply_at;type:varchar(10);default:'';comment:申请日" json:"apply_at"` - OpenCode string `gorm:"column:open_code;type:varchar(30);default:'';comment:公开(公告)号" json:"open_code"` - OpenAt string `gorm:"column:open_at;type:varchar(10);default:'';comment:公开(公告)日" json:"open_at"` - ApplyName string `gorm:"column:apply_name;type:varchar(255);default:'';comment:申请(专利权)人" json:"apply_name"` - ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:'';comment:申请人地址" json:"apply_address"` - Inventor string `gorm:"column:inventor;type:varchar(255);default:'';comment:发明人" json:"inventor"` - Description string `gorm:"column:description;type:text;comment:摘要" json:"description"` - PrincipalClaim string `gorm:"column:principal_claim;type:text;comment:主权项" json:"principal_claim"` - IPCCode string `gorm:"column:ipc_code;index:idx_sys_patent_ipc_code;type:varchar(30);default:'';comment:IPC主分类号" json:"ipc_code"` + UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"` + Kind TechnologyPatentKind `gorm:"column:kind;index:idx_sys_patent_kind;type:tinyint(1);default:0;comment:专利类型" json:"kind"` + Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称标题" json:"title"` + FileUrl string `gorm:"column:file_url;type:varchar(255);default:'';comment:文件地址" json:"file_url"` + ApplyCode string `gorm:"column:apply_code;type:varchar(30);default:'';comment:申请号" json:"apply_code"` + ApplyAt string `gorm:"column:apply_at;type:varchar(10);default:'';comment:申请日" json:"apply_at"` + OpenCode string `gorm:"column:open_code;type:varchar(30);default:'';comment:公开(公告)号" json:"open_code"` + OpenAt string `gorm:"column:open_at;type:varchar(10);default:'';comment:公开(公告)日" json:"open_at"` + ApplyName string `gorm:"column:apply_name;type:varchar(255);default:'';comment:申请(专利权)人" json:"apply_name"` + ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:'';comment:申请人地址" json:"apply_address"` + Inventor string `gorm:"column:inventor;type:varchar(255);default:'';comment:发明人" json:"inventor"` + Description string `gorm:"column:description;type:text;comment:摘要" json:"description"` + PrincipalClaim string `gorm:"column:principal_claim;type:text;comment:主权项" json:"principal_claim"` + IPCCode string `gorm:"column:ipc_code;index:idx_sys_patent_ipc_code;type:varchar(30);default:'';comment:IPC主分类号" json:"ipc_code"` Shelf - Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"` + Status TechnologyPatentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"` ModelDeleted ModelAt } @@ -53,11 +53,11 @@ func (m *TechnologyPatent) TableName() string { } func (m *TechnologyPatent) KindTitle() string { - if m.Kind == SysParentKindForInvent { + if m.Kind == TechnologyPatentKindForInvent { return "发明专利" - } else if m.Kind == SysParentKindForDesign { + } else if m.Kind == TechnologyPatentKindForDesign { return "外观设计" - } else if m.Kind == SysParentKindForNewPractical { + } else if m.Kind == TechnologyPatentKindForNewPractical { return "实用新型" } return "未知"