feat:完善项目信息
This commit is contained in:
@ -85,6 +85,10 @@ func (*Technology) PatentBind(c *gin.Context) {
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentExamine(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (*Technology) PatentDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
@ -239,13 +243,39 @@ func (*Technology) AchievementDelete(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (*Technology) Demand(c *gin.Context) {
|
||||
|
||||
form := &struct {
|
||||
api.TenantIDStringForm
|
||||
Title string `json:"title" form:"title"`
|
||||
Kind int `json:"kind" form:"kind"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title, form.Kind,
|
||||
form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) DemandDetail(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) DemandDelete() {
|
||||
func (*Technology) DemandDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
7
app/api/admin/controller/technology/basic.go
Normal file
7
app/api/admin/controller/technology/basic.go
Normal file
@ -0,0 +1,7 @@
|
||||
package technology
|
||||
|
||||
import model2 "SciencesServer/app/common/model"
|
||||
|
||||
func handleExamine(iModel model2.IModel, status int) {
|
||||
|
||||
}
|
@ -230,6 +230,11 @@ func (c *Patent) Bind(id, uid uint64) error {
|
||||
})
|
||||
}
|
||||
|
||||
// Examine 审核操作
|
||||
func (c *Patent) Examine() {
|
||||
|
||||
}
|
||||
|
||||
// Delete 删除操作
|
||||
func (c *Patent) Delete(id uint64) error {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
@ -83,6 +83,29 @@ func (c *Product) Form() {
|
||||
|
||||
}
|
||||
|
||||
// Examine 审核操作
|
||||
func (c *Product) Examine(id uint64, status int, remark string) error {
|
||||
mTechnologyProduct := model.NewTechnologyProduct()
|
||||
mTechnologyProduct.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "tenant_id", "status"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||
}
|
||||
if c.TenantID > 0 && mTechnologyProduct.TenantID != c.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
if mTechnologyProduct.Status != model2.TechnologyStatusKindForExamining {
|
||||
return errors.New("操作错误,当前产品状态不允许审核")
|
||||
}
|
||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
|
||||
"status": status,
|
||||
})
|
||||
}
|
||||
|
||||
// Delete 删除操作
|
||||
func (c *Product) Delete(id uint64) error {
|
||||
mTechnologyProduct := model.NewTechnologyProduct()
|
||||
|
@ -58,7 +58,7 @@ func (m *ManageExpert) Experts(page, pageSize int, count *int64, where ...*model
|
||||
"LEFT JOIN (SELECT uid, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY uid) AS u_p ON u.uid = u_p.uid "+
|
||||
" WHERE u.is_deleted = %d AND u.invalid_status = %d GROUP BY u.expert_id) AS u ON e.id = u.expert_id",
|
||||
model.NewUserExpert().TableName(),
|
||||
model.NewTechnologyAchievement().TableName(), model.DeleteStatusForNot, model.TechnologyAchievementStatusForAgree,
|
||||
model.NewTechnologyAchievement().TableName(), model.DeleteStatusForNot, model.TechnologyStatusKindForAgree,
|
||||
model.NewUserPatent().TableName(), model.DeleteStatusForNot,
|
||||
model.DeleteStatusForNot, model.InvalidStatusForNot)).
|
||||
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
@ -161,8 +161,8 @@ func (c *Achievement) Form(params *AchievementParams) error {
|
||||
return errors.New("操作错误,成果信息不存在或已被删除")
|
||||
} else if mTechnologyAchievement.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForRefuse &&
|
||||
mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForDraft {
|
||||
} else if mTechnologyAchievement.Status != model2.TechnologyStatusKindForRefuse &&
|
||||
mTechnologyAchievement.Status != model2.TechnologyStatusKindForDraft {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
@ -180,14 +180,14 @@ func (c *Achievement) Form(params *AchievementParams) error {
|
||||
mTechnologyAchievement.Source = params.Source
|
||||
|
||||
if mTechnologyAchievement.ID > 0 {
|
||||
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||
mTechnologyAchievement.Status = model2.TechnologyStatusKindForExamining
|
||||
return model2.Updates(mTechnologyAchievement.TechnologyAchievement, mTechnologyAchievement.TechnologyAchievement)
|
||||
}
|
||||
mTechnologyAchievement.TenantID = c.tenantID
|
||||
mTechnologyAchievement.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||
mTechnologyAchievement.Status = model2.TechnologyStatusKindForExamining
|
||||
}
|
||||
return model2.Create(mTechnologyAchievement.TechnologyAchievement)
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
return errors.New("操作错误,需求信息不存在或已被删除")
|
||||
} else if mTechnologyDemand.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyDemand.Status != model2.TechnologyDemandStatusForRefuse &&
|
||||
mTechnologyDemand.Status != model2.TechnologyDemandStatusForDraft {
|
||||
} else if mTechnologyDemand.Status != model2.TechnologyStatusKindForRefuse &&
|
||||
mTechnologyDemand.Status != model2.TechnologyStatusKindForDraft {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
@ -145,14 +145,14 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
},
|
||||
})
|
||||
if mTechnologyDemand.ID > 0 {
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
mTechnologyDemand.Status = model2.TechnologyStatusKindForExamining
|
||||
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
mTechnologyDemand.UID = c.UID
|
||||
mTechnologyDemand.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
mTechnologyDemand.Status = model2.TechnologyStatusKindForExamining
|
||||
}
|
||||
return model2.Create(mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
return errors.New("操作错误,技术信息不存在或已被删除")
|
||||
} else if c.UID != mTechnologyInstance.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
||||
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyStatusKindForDraft &&
|
||||
mTechnologyInstance.Status != model2.TechnologyStatusKindForRefuse {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
@ -99,19 +99,19 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
mTechnologyInstance.Purpose = params.Purpose
|
||||
mTechnologyInstance.Remark = params.Remark
|
||||
|
||||
if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
||||
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForExamining {
|
||||
if mTechnologyInstance.Status != model2.TechnologyStatusKindForDraft &&
|
||||
mTechnologyInstance.Status != model2.TechnologyStatusKindForExamining {
|
||||
return errors.New("操作错误,状态参数错误")
|
||||
}
|
||||
if params.ID > 0 {
|
||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||
mTechnologyInstance.Status = model2.TechnologyStatusKindForExamining
|
||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||
}
|
||||
mTechnologyInstance.UID = c.UID
|
||||
mTechnologyInstance.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||
mTechnologyInstance.Status = model2.TechnologyStatusKindForExamining
|
||||
}
|
||||
return model2.Create(mTechnologyInstance.TechnologyInstance)
|
||||
}
|
||||
@ -128,7 +128,7 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
||||
return errors.New("信息不存在")
|
||||
} else if c.UID != mTechnologyInstance.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyStatusKindForAgree {
|
||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||
} else if mTechnologyInstance.Shelf.ShelfStatus == model2.ShelfStatusKind(status) {
|
||||
return errors.New("操作错误,状态异常")
|
||||
|
@ -184,8 +184,8 @@ func (c *Product) Form(params *ProductParams) error {
|
||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||
} else if mTechnologyProduct.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyProduct.Status != model2.TechnologyProductStatusForRefuse &&
|
||||
mTechnologyProduct.Status != model2.TechnologyProductStatusForDraft {
|
||||
} else if mTechnologyProduct.Status != model2.TechnologyStatusKindForRefuse &&
|
||||
mTechnologyProduct.Status != model2.TechnologyStatusKindForDraft {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
@ -202,14 +202,14 @@ func (c *Product) Form(params *ProductParams) error {
|
||||
mTechnologyProduct.Introduce = params.Introduce
|
||||
|
||||
if mTechnologyProduct.ID > 0 {
|
||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||
mTechnologyProduct.Status = model2.TechnologyStatusKindForExamining
|
||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct)
|
||||
}
|
||||
mTechnologyProduct.TenantID = c.tenantID
|
||||
mTechnologyProduct.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||
mTechnologyProduct.Status = model2.TechnologyStatusKindForExamining
|
||||
}
|
||||
return model2.Create(mTechnologyProduct.TechnologyProduct)
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ func (c *Topic) Form(params *TopicParams) error {
|
||||
return errors.New("操作错误,课题信息不存在")
|
||||
} else if mTechnologyTopic.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
||||
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
||||
} else if mTechnologyTopic.Status != model2.TechnologyStatusKindForDraft &&
|
||||
mTechnologyTopic.Status != model2.TechnologyStatusKindForRefuse {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, w
|
||||
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)).
|
||||
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
|
@ -183,7 +183,7 @@ func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||
|
||||
if err = model2.Count(mTechnologyAchievement.TechnologyAchievement, &out.AchievementCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
model2.NewWhere("status", model2.TechnologyAchievementStatusForAgree)); err != nil {
|
||||
model2.NewWhere("status", model2.TechnologyStatusKindForAgree)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
mTechnologyDemand := model.NewTechnologyDemand()
|
||||
|
||||
if err = model2.Count(mTechnologyDemand.TechnologyDemand, &out.DemandCount,
|
||||
model2.NewWhere("status", model2.TechnologyDemandStatusForAgree)); err != nil {
|
||||
model2.NewWhere("status", model2.TechnologyStatusKindForAgree)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 对接信息
|
||||
|
@ -43,7 +43,7 @@ func (c *Demand) Instance(title, industry, kind string, page, pageSize int) (*co
|
||||
|
||||
where := []*model2.ModelWhereOrder{
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("status", model2.TechnologyDemandStatusForAgree),
|
||||
Where: model2.NewWhere("status", model2.TechnologyStatusKindForAgree),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
},
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func (m *ManageCompany) Products(id, uid uint64, page, pageSize int, count *int6
|
||||
Select("p.id", "p.title", "p.image", "p.industry", "p.maturity", "p.lead_standard", "p.cooperation_mode",
|
||||
"p.keyword", "v.count AS visit_count", "c_u.id AS collect_id", "c.count AS collect_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS p ON u_c.uid = p.uid AND p.shelf_status = %d AND p.status = %d AND p.is_deleted = %d",
|
||||
model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyProductStatusForAgree, model.DeleteStatusForNot)).
|
||||
model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyStatusKindForAgree, model.DeleteStatusForNot)).
|
||||
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 p.id = v.object_id",
|
||||
model.NewUserVisit().TableName(), model.UserVisitKindForTechnologyProduct, 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 p.id = c.object_id",
|
||||
|
@ -26,7 +26,7 @@ func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, w
|
||||
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)).
|
||||
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
@ -54,7 +54,7 @@ func (m *TechnologyAchievement) Achievement(where ...*model.ModelWhere) ([]*Tech
|
||||
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)).
|
||||
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
out := make([]*TechnologyAchievementInfo, 0)
|
||||
@ -99,7 +99,7 @@ func (m *TechnologyAchievement) Distribution() ([]*DataAreaDistributionInfo, err
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Group("e.province").Group("e.city").Group("e.district").
|
||||
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc).
|
||||
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Where("a.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Scan(&out).Error
|
||||
|
||||
|
@ -24,7 +24,7 @@ func (m *TechnologyDemand) Demand(page, pageSize int, count *int64, where ...*mo
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_c ON d.uid = u_c.uid AND u_c.is_deleted = %d",
|
||||
model.NewUserCompany().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u_c.company_id = c.id", model.NewManageCompany().TableName())).
|
||||
Where("d.status = ?", model.TechnologyDemandStatusForAgree)
|
||||
Where("d.status = ?", model.TechnologyStatusKindForAgree)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
@ -50,7 +50,7 @@ func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Group("e.province").Group("e.city").Group("e.district").
|
||||
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc).
|
||||
Where("d.status = ?", model.TechnologyDemandStatusForAgree).
|
||||
Where("d.status = ?", model.TechnologyStatusKindForAgree).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
|
Reference in New Issue
Block a user