|
@@ -30,39 +30,59 @@ const (
|
|
)
|
|
)
|
|
|
|
|
|
type Report struct {
|
|
type Report struct {
|
|
- Id int `orm:"column(id)" description:"报告Id"`
|
|
|
|
- AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
|
- ClassifyIdFirst int `description:"一级分类id"`
|
|
|
|
- ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
|
- ClassifyIdSecond int `description:"二级分类id"`
|
|
|
|
- ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
|
- Title string `description:"标题"`
|
|
|
|
- Abstract string `description:"摘要"`
|
|
|
|
- Author string `description:"作者"`
|
|
|
|
- Frequency string `description:"频度"`
|
|
|
|
- CreateTime string `description:"创建时间"`
|
|
|
|
- ModifyTime time.Time `description:"修改时间"`
|
|
|
|
- State int `description:"1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
|
|
|
|
- PublishTime time.Time `description:"发布时间"`
|
|
|
|
- Stage int `description:"期数"`
|
|
|
|
- MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
|
|
|
|
- ThsMsgIsSend int `description:"客户群消息是否已发送,0:否,1:是"`
|
|
|
|
- Content string `description:"内容"`
|
|
|
|
- VideoUrl string `description:"音频文件URL"`
|
|
|
|
- VideoName string `description:"音频文件名称"`
|
|
|
|
- VideoPlaySeconds string `description:"音频播放时长"`
|
|
|
|
- VideoSize string `description:"音频文件大小,单位M"`
|
|
|
|
- ContentSub string `description:"内容前两个章节"`
|
|
|
|
- ReportCode string `description:"报告唯一编码"`
|
|
|
|
- ReportVersion int `description:"1:旧版,2:新版"`
|
|
|
|
- HasChapter int `description:"是否有章节 0-否 1-是"`
|
|
|
|
- ChapterType string `description:"章节类型 day-晨报 week-周报"`
|
|
|
|
- OldReportId int `description:"research_report表ID, 大于0则表示该报告为老后台同步过来的"`
|
|
|
|
- MsgSendTime time.Time `description:"模版消息发送时间"`
|
|
|
|
- AdminId int `description:"创建者账号"`
|
|
|
|
- AdminRealName string `description:"创建者姓名"`
|
|
|
|
- ApproveTime time.Time `description:"审批时间"`
|
|
|
|
- ApproveId int `description:"审批ID"`
|
|
|
|
|
|
+ Id int `orm:"column(id)" description:"报告Id"`
|
|
|
|
+ AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
|
+ ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
|
+ Title string `description:"标题"`
|
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
|
+ Author string `description:"作者"`
|
|
|
|
+ Frequency string `description:"频度"`
|
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
|
+ ModifyTime time.Time `description:"修改时间"`
|
|
|
|
+ State int `description:"1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
|
|
|
|
+ PublishTime time.Time `description:"发布时间"`
|
|
|
|
+ Stage int `description:"期数"`
|
|
|
|
+ MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
|
|
|
|
+ ThsMsgIsSend int `description:"客户群消息是否已发送,0:否,1:是"`
|
|
|
|
+ Content string `description:"内容"`
|
|
|
|
+ VideoUrl string `description:"音频文件URL"`
|
|
|
|
+ VideoName string `description:"音频文件名称"`
|
|
|
|
+ VideoPlaySeconds string `description:"音频播放时长"`
|
|
|
|
+ VideoSize string `description:"音频文件大小,单位M"`
|
|
|
|
+ ContentSub string `description:"内容前两个章节"`
|
|
|
|
+ ReportCode string `description:"报告唯一编码"`
|
|
|
|
+ ReportVersion int `description:"1:旧版,2:新版"`
|
|
|
|
+ HasChapter int `description:"是否有章节 0-否 1-是"`
|
|
|
|
+ ChapterType string `description:"章节类型 day-晨报 week-周报"`
|
|
|
|
+ OldReportId int `description:"research_report表ID, 大于0则表示该报告为老后台同步过来的"`
|
|
|
|
+ MsgSendTime time.Time `description:"模版消息发送时间"`
|
|
|
|
+ AdminId int `description:"创建者账号"`
|
|
|
|
+ AdminRealName string `description:"创建者姓名"`
|
|
|
|
+ ApproveTime time.Time `description:"审批时间"`
|
|
|
|
+ ApproveId int `description:"审批ID"`
|
|
|
|
+ DetailImgUrl string `description:"报告详情长图地址"`
|
|
|
|
+ DetailPdfUrl string `description:"报告详情PDF地址"`
|
|
|
|
+ ContentStruct string `description:"内容组件"`
|
|
|
|
+ LastModifyAdminId int `description:"最后更新人ID"`
|
|
|
|
+ LastModifyAdminName string `description:"最后更新人姓名"`
|
|
|
|
+ ContentModifyTime time.Time `description:"内容更新时间"`
|
|
|
|
+ Pv int `description:"pv"`
|
|
|
|
+ Uv int `description:"uv"`
|
|
|
|
+ HeadImg string `description:"报告头图地址"`
|
|
|
|
+ EndImg string `description:"报告尾图地址"`
|
|
|
|
+ CanvasColor string `description:"画布颜色"`
|
|
|
|
+ NeedSplice int `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
|
|
|
|
+ HeadResourceId int `description:"版头资源ID"`
|
|
|
|
+ EndResourceId int `description:"版尾资源ID"`
|
|
|
|
+ ClassifyIdThird int `description:"三级分类id"`
|
|
|
|
+ ClassifyNameThird string `description:"三级分类名称"`
|
|
|
|
+ CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"`
|
|
|
|
+ ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
|
+ IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"`
|
|
|
|
+ ReportCreateTime time.Time `description:"报告时间创建时间"`
|
|
}
|
|
}
|
|
|
|
|
|
type ReportList struct {
|
|
type ReportList struct {
|
|
@@ -106,6 +126,8 @@ type ReportList struct {
|
|
ApproveTime string `description:"审批时间"`
|
|
ApproveTime string `description:"审批时间"`
|
|
DetailImgUrl string `description:"报告详情长图地址"`
|
|
DetailImgUrl string `description:"报告详情长图地址"`
|
|
DetailPdfUrl string `description:"报告详情PDF地址"`
|
|
DetailPdfUrl string `description:"报告详情PDF地址"`
|
|
|
|
+ ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
|
+ ReportCreateTime time.Time `description:"报告时间创建时间"`
|
|
}
|
|
}
|
|
|
|
|
|
type ReportListResp struct {
|
|
type ReportListResp struct {
|
|
@@ -113,17 +135,111 @@ type ReportListResp struct {
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
}
|
|
}
|
|
|
|
|
|
-func GetReportListCount(condition string, pars []interface{}, companyType string) (count int, err error) {
|
|
|
|
- //产品权限
|
|
|
|
- companyTypeSqlStr := ``
|
|
|
|
- if companyType == "ficc" {
|
|
|
|
- companyTypeSqlStr = " AND classify_id_first != 40 "
|
|
|
|
- } else if companyType == "权益" {
|
|
|
|
- companyTypeSqlStr = " AND classify_id_first = 40 "
|
|
|
|
|
|
+// GetReportListCountV1
|
|
|
|
+// @Description: 获取普通报告列表的报告数量
|
|
|
|
+// @author: Roc
|
|
|
|
+// @datetime 2024-05-30 15:14:43
|
|
|
|
+// @param condition string
|
|
|
|
+// @param pars []interface{}
|
|
|
|
+// @return count int
|
|
|
|
+// @return err error
|
|
|
|
+func GetReportListCountV1(condition string, pars []interface{}) (count int, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
|
+ sql := `SELECT COUNT(1) AS count FROM report as a WHERE 1=1 `
|
|
|
|
+ if condition != "" {
|
|
|
|
+ sql += condition
|
|
|
|
+ }
|
|
|
|
+ err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetReportListV1
|
|
|
|
+// @Description: 获取普通报告列表的数据
|
|
|
|
+// @author: Roc
|
|
|
|
+// @datetime 2024-05-30 15:14:25
|
|
|
|
+// @param condition string
|
|
|
|
+// @param pars []interface{}
|
|
|
|
+// @param startSize int
|
|
|
|
+// @param pageSize int
|
|
|
|
+// @return items []*ReportList
|
|
|
|
+// @return err error
|
|
|
|
+func GetReportListV1(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
|
+
|
|
|
|
+ sql := `SELECT * FROM report as a WHERE 1=1 `
|
|
|
|
+ if condition != "" {
|
|
|
|
+ sql += condition
|
|
|
|
+ }
|
|
|
|
+ // 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
|
|
|
|
+ sql += `ORDER BY FIELD(state,3,1,4,5,6,2), modify_time DESC LIMIT ?,?`
|
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+type ReportPvUv struct {
|
|
|
|
+ ReportId int
|
|
|
|
+ PvTotal int
|
|
|
|
+ UvTotal int
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func GetReportPvUvByReportIdList(reportIdList []string) (items []ReportPvUv, err error) {
|
|
|
|
+ num := len(reportIdList)
|
|
|
|
+ if num <= 0 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
|
+
|
|
|
|
+ sql := `SELECT report_id, COUNT(1) as pv_total,COUNT(DISTINCT user_id) as uv_total FROM report_view_record WHERE report_id in (` + utils.GetOrmInReplace(num) + `) GROUP BY report_id`
|
|
|
|
+ _, err = o.Raw(sql, reportIdList).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetReportListCountByGrant
|
|
|
|
+// @Description: 获取共享报告列表的报告数量
|
|
|
|
+// @author: Roc
|
|
|
|
+// @datetime 2024-05-30 15:14:01
|
|
|
|
+// @param condition string
|
|
|
|
+// @param pars []interface{}
|
|
|
|
+// @return count int
|
|
|
|
+// @return err error
|
|
|
|
+func GetReportListCountByGrant(condition string, pars []interface{}) (count int, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
|
+ sql := `SELECT COUNT(1) AS count FROM report as a
|
|
|
|
+ JOIN report_grant b on a.id=b.report_id
|
|
|
|
+ WHERE 1=1 `
|
|
|
|
+ if condition != "" {
|
|
|
|
+ sql += condition
|
|
|
|
+ }
|
|
|
|
+ err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetReportListByGrant
|
|
|
|
+// @Description: 获取共享报告列表的数据
|
|
|
|
+// @author: Roc
|
|
|
|
+// @datetime 2024-05-30 15:15:07
|
|
|
|
+// @param condition string
|
|
|
|
+// @param pars []interface{}
|
|
|
|
+// @param startSize int
|
|
|
|
+// @param pageSize int
|
|
|
|
+// @return items []*ReportList
|
|
|
|
+// @return err error
|
|
|
|
+func GetReportListByGrant(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
|
+
|
|
|
|
+ sql := `SELECT * FROM report as a JOIN report_grant b on a.id = b.report_id WHERE 1=1 `
|
|
|
|
+ if condition != "" {
|
|
|
|
+ sql += condition
|
|
}
|
|
}
|
|
|
|
+ // 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
|
|
|
|
+ sql += `ORDER BY FIELD(state,3,1,4,5,6,2), modify_time DESC LIMIT ?,?`
|
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
|
|
|
|
+func GetReportListCount(condition string, pars []interface{}) (count int, err error) {
|
|
oRddp := orm.NewOrmUsingDB("rddp")
|
|
oRddp := orm.NewOrmUsingDB("rddp")
|
|
- sql := `SELECT COUNT(1) AS count FROM report WHERE 1=1 ` + companyTypeSqlStr
|
|
|
|
|
|
+ sql := `SELECT COUNT(1) AS count FROM report WHERE 1=1 `
|
|
if condition != "" {
|
|
if condition != "" {
|
|
sql += condition
|
|
sql += condition
|
|
}
|
|
}
|
|
@@ -131,20 +247,13 @@ func GetReportListCount(condition string, pars []interface{}, companyType string
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetReportList(condition string, pars []interface{}, companyType string, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
|
|
|
+func GetReportList(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
- //产品权限
|
|
|
|
- companyTypeSqlStr := ``
|
|
|
|
- if companyType == "ficc" {
|
|
|
|
- companyTypeSqlStr = " AND classify_id_first != 40 "
|
|
|
|
- } else if companyType == "权益" {
|
|
|
|
- companyTypeSqlStr = " AND classify_id_first = 40 "
|
|
|
|
- }
|
|
|
|
|
|
|
|
sql := `SELECT *,
|
|
sql := `SELECT *,
|
|
(SELECT COUNT(1) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS pv,
|
|
(SELECT COUNT(1) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS pv,
|
|
(SELECT COUNT(DISTINCT user_id) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS uv
|
|
(SELECT COUNT(DISTINCT user_id) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS uv
|
|
- FROM report WHERE 1=1 ` + companyTypeSqlStr
|
|
|
|
|
|
+ FROM report WHERE 1=1 `
|
|
if condition != "" {
|
|
if condition != "" {
|
|
sql += condition
|
|
sql += condition
|
|
}
|
|
}
|
|
@@ -285,6 +394,8 @@ type AddReq struct {
|
|
ClassifyNameFirst string `description:"一级分类名称"`
|
|
ClassifyNameFirst string `description:"一级分类名称"`
|
|
ClassifyIdSecond int `description:"二级分类id"`
|
|
ClassifyIdSecond int `description:"二级分类id"`
|
|
ClassifyNameSecond string `description:"二级分类名称"`
|
|
ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
|
+ ClassifyIdThird int `description:"三级分类id"`
|
|
|
|
+ ClassifyNameThird string `description:"三级分类名称"`
|
|
Title string `description:"标题"`
|
|
Title string `description:"标题"`
|
|
Abstract string `description:"摘要"`
|
|
Abstract string `description:"摘要"`
|
|
Author string `description:"作者"`
|
|
Author string `description:"作者"`
|
|
@@ -293,6 +404,9 @@ type AddReq struct {
|
|
Content string `description:"内容"`
|
|
Content string `description:"内容"`
|
|
CreateTime string `description:"创建时间"`
|
|
CreateTime string `description:"创建时间"`
|
|
ReportVersion int `description:"1:旧版,2:新版"`
|
|
ReportVersion int `description:"1:旧版,2:新版"`
|
|
|
|
+ CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"`
|
|
|
|
+ ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
|
+ IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"`
|
|
}
|
|
}
|
|
|
|
|
|
type PrePublishReq struct {
|
|
type PrePublishReq struct {
|
|
@@ -319,6 +433,8 @@ type EditReq struct {
|
|
ClassifyNameFirst string `description:"一级分类名称"`
|
|
ClassifyNameFirst string `description:"一级分类名称"`
|
|
ClassifyIdSecond int `description:"二级分类id"`
|
|
ClassifyIdSecond int `description:"二级分类id"`
|
|
ClassifyNameSecond string `description:"二级分类名称"`
|
|
ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
|
+ ClassifyIdThird int `description:"三级分类id"`
|
|
|
|
+ ClassifyNameThird string `description:"三级分类名称"`
|
|
Title string `description:"标题"`
|
|
Title string `description:"标题"`
|
|
Abstract string `description:"摘要"`
|
|
Abstract string `description:"摘要"`
|
|
Author string `description:"作者"`
|
|
Author string `description:"作者"`
|
|
@@ -326,6 +442,9 @@ type EditReq struct {
|
|
State int `description:"状态:1:未发布,2:已发布"`
|
|
State int `description:"状态:1:未发布,2:已发布"`
|
|
Content string `description:"内容"`
|
|
Content string `description:"内容"`
|
|
CreateTime string `description:"创建时间"`
|
|
CreateTime string `description:"创建时间"`
|
|
|
|
+ CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"`
|
|
|
|
+ ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
|
+ IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"`
|
|
}
|
|
}
|
|
|
|
|
|
type EditResp struct {
|
|
type EditResp struct {
|
|
@@ -357,6 +476,12 @@ func EditReport(item *Report, reportId int64) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (m *Report) Update(cols []string) (err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ _, err = o.Update(m, cols...)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
type ReportDetailReq struct {
|
|
type ReportDetailReq struct {
|
|
ReportId int `description:"报告id"`
|
|
ReportId int `description:"报告id"`
|
|
}
|
|
}
|