|
@@ -6,10 +6,11 @@ import (
|
|
|
"eta_gn/eta_api/global"
|
|
|
"eta_gn/eta_api/utils"
|
|
|
"fmt"
|
|
|
- "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
- "gorm.io/gorm"
|
|
|
"strings"
|
|
|
"time"
|
|
|
+
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "gorm.io/gorm"
|
|
|
)
|
|
|
|
|
|
// 报告状态
|
|
@@ -69,26 +70,31 @@ type Report struct {
|
|
|
DetailImgUrl string `gorm:"column:detail_img_url" description:"报告详情长图地址"`
|
|
|
DetailPdfUrl string `gorm:"column:detail_pdf_url" description:"报告详情PDF地址"`
|
|
|
|
|
|
- ContentStruct string `gorm:"column:content_struct" description:"内容组件"`
|
|
|
- LastModifyAdminId int `gorm:"column:last_modify_admin_id" description:"最后更新人ID"`
|
|
|
- LastModifyAdminName string `gorm:"column:last_modify_admin_name" description:"最后更新人姓名"`
|
|
|
- ContentModifyTime time.Time `gorm:"column:content_modify_time" description:"内容更新时间"`
|
|
|
- Pv int `gorm:"column:pv" description:"pv"`
|
|
|
- Uv int `gorm:"column:uv" description:"uv"`
|
|
|
- HeadImg string `gorm:"column:head_img" description:"报告头图地址"`
|
|
|
- EndImg string `gorm:"column:end_img" description:"报告尾图地址"`
|
|
|
- CanvasColor string `gorm:"column:canvas_color" description:"画布颜色"`
|
|
|
- NeedSplice int `gorm:"column:need_splice" description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
|
|
|
- HeadResourceId int `gorm:"column:head_resource_id" description:"版头资源ID"`
|
|
|
- EndResourceId int `gorm:"column:end_resource_id" description:"版尾资源ID"`
|
|
|
- ClassifyIdThird int `gorm:"column:classify_id_third" description:"三级分类id"`
|
|
|
- ClassifyNameThird string `gorm:"column:classify_name_third" description:"三级分类名称"`
|
|
|
- CollaborateType int8 `gorm:"column:collaborate_type" description:"协作方式,1:个人,2:多人协作。默认:1"`
|
|
|
- ReportLayout int8 `gorm:"column:report_layout" description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
- IsPublicPublish int8 `gorm:"column:is_public_publish" description:"是否公开发布,1:是,2:否"`
|
|
|
- ReportCreateTime time.Time `gorm:"column:report_create_time" description:"报告时间创建时间"`
|
|
|
- InheritReportId int `gorm:"column:inherit_report_id" description:"待继承的报告ID"`
|
|
|
- VoiceGenerateType int `gorm:"column:voice_generate_type" description:"音频生成方式,0:系统生成,1:人工上传"`
|
|
|
+ ContentStruct string `gorm:"column:content_struct" description:"内容组件"`
|
|
|
+ LastModifyAdminId int `gorm:"column:last_modify_admin_id" description:"最后更新人ID"`
|
|
|
+ LastModifyAdminName string `gorm:"column:last_modify_admin_name" description:"最后更新人姓名"`
|
|
|
+ ContentModifyTime time.Time `gorm:"column:content_modify_time" description:"内容更新时间"`
|
|
|
+ Pv int `gorm:"column:pv" description:"pv"`
|
|
|
+ Uv int `gorm:"column:uv" description:"uv"`
|
|
|
+ HeadImg string `gorm:"column:head_img" description:"报告头图地址"`
|
|
|
+ EndImg string `gorm:"column:end_img" description:"报告尾图地址"`
|
|
|
+ CanvasColor string `gorm:"column:canvas_color" description:"画布颜色"`
|
|
|
+ NeedSplice int `gorm:"column:need_splice" description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
|
|
|
+ HeadResourceId int `gorm:"column:head_resource_id" description:"版头资源ID"`
|
|
|
+ EndResourceId int `gorm:"column:end_resource_id" description:"版尾资源ID"`
|
|
|
+ ClassifyIdThird int `gorm:"column:classify_id_third" description:"三级分类id"`
|
|
|
+ ClassifyNameThird string `gorm:"column:classify_name_third" description:"三级分类名称"`
|
|
|
+ CollaborateType int8 `gorm:"column:collaborate_type" description:"协作方式,1:个人,2:多人协作。默认:1"`
|
|
|
+ ReportLayout int8 `gorm:"column:report_layout" description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
+ IsPublicPublish int8 `gorm:"column:is_public_publish" description:"是否公开发布,1:是,2:否"`
|
|
|
+ ReportCreateTime time.Time `gorm:"column:report_create_time" description:"报告时间创建时间"`
|
|
|
+ InheritReportId int `gorm:"column:inherit_report_id" description:"待继承的报告ID"`
|
|
|
+ VoiceGenerateType int `gorm:"column:voice_generate_type" description:"音频生成方式,0:系统生成,1:人工上传"`
|
|
|
+ ReportSource int `gorm:"column:report_source" description:"报告来源:1-系统内;2-智力共享"`
|
|
|
+ OutReportId string `gorm:"column:out_report_id" description:"外部报告ID(或编码)"`
|
|
|
+ PrePublishTime *time.Time `gorm:"column:pre_publish_time" description:"预发布时间"`
|
|
|
+ PreMsgSend int `gorm:"column:pre_msg_send" description:"定时发布成功后是否立即推送模版消息,0:未发送,1:已发送"`
|
|
|
+ TopicEndTime time.Time `gorm:"column:topic_end_time" description:"课题结束时间"`
|
|
|
}
|
|
|
|
|
|
type ReportList struct {
|
|
@@ -151,6 +157,7 @@ type ReportList struct {
|
|
|
ClassifyIdThird int `gorm:"column:classify_id_third" description:"三级分类id"`
|
|
|
ClassifyNameThird string `gorm:"column:classify_name_third" description:"三级分类名称"`
|
|
|
InheritReportId int `gorm:"column:inherit_report_id" description:"待继承的报告ID"`
|
|
|
+ ReportSource int `gorm:"column:report_source" description:"报告来源:1-系统内;2-智力共享"`
|
|
|
}
|
|
|
|
|
|
type ReportListResp struct {
|
|
@@ -175,6 +182,34 @@ func GetReportListCountV1(condition string, pars []interface{}) (count int, err
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// func GetReportListCountV1(condition string, pars []interface{}) (count int, err error) {
|
|
|
+// sql := `SELECT COUNT(1) AS count FROM report as a
|
|
|
+// LEFT JOIN classify_visible c ON (
|
|
|
+// CASE
|
|
|
+// WHEN a.classify_id_third > 0 THEN a.classify_id_third
|
|
|
+// WHEN a.classify_id_second > 0 THEN a.classify_id_second
|
|
|
+// ELSE a.classify_id_first
|
|
|
+// END
|
|
|
+// ) = c.classify_id AND c.admin_id =?
|
|
|
+// WHERE 1=1 AND (c.admin_id IS NULL OR c.admin_id =?) AND a.id NOT IN (
|
|
|
+// SELECT id FROM report ta
|
|
|
+// JOIN classify_visible tb ON (
|
|
|
+// CASE
|
|
|
+// WHEN ta.classify_id_third > 0 THEN ta.classify_id_third
|
|
|
+// WHEN ta.classify_id_second > 0 THEN ta.classify_id_second
|
|
|
+// ELSE ta.classify_id_first
|
|
|
+// END
|
|
|
+// ) = tb.classify_id
|
|
|
+// GROUP BY ta."id"
|
|
|
+// HAVING SUM(CASE WHEN tb.admin_id = ? THEN 1 ELSE 0 END) = 0
|
|
|
+// ) `
|
|
|
+// if condition != "" {
|
|
|
+// sql += condition
|
|
|
+// }
|
|
|
+// err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
// GetReportListV1
|
|
|
// @Description: 获取普通报告列表的数据
|
|
|
// @author: Roc
|
|
@@ -198,6 +233,38 @@ func GetReportListV1(condition string, pars []interface{}, startSize, pageSize i
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// func GetReportListV1(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
+// sql := `SELECT * FROM report as a
|
|
|
+// LEFT JOIN classify_visible c ON (
|
|
|
+// CASE
|
|
|
+// WHEN a.classify_id_third > 0 THEN a.classify_id_third
|
|
|
+// WHEN a.classify_id_second > 0 THEN a.classify_id_second
|
|
|
+// ELSE a.classify_id_first
|
|
|
+// END
|
|
|
+// ) = c.classify_id AND c.admin_id =?
|
|
|
+// WHERE 1=1 AND (c.admin_id IS NULL OR c.admin_id =?) AND a.id NOT IN (
|
|
|
+// SELECT id FROM report ta
|
|
|
+// JOIN classify_visible tb ON (
|
|
|
+// CASE
|
|
|
+// WHEN ta.classify_id_third > 0 THEN ta.classify_id_third
|
|
|
+// WHEN ta.classify_id_second > 0 THEN ta.classify_id_second
|
|
|
+// ELSE ta.classify_id_first
|
|
|
+// END
|
|
|
+// ) = tb.classify_id
|
|
|
+// GROUP BY ta."id"
|
|
|
+// HAVING SUM(CASE WHEN tb.admin_id = ? THEN 1 ELSE 0 END) = 0
|
|
|
+// ) `
|
|
|
+// 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 ?,?`
|
|
|
+// pars = append(pars, startSize)
|
|
|
+// pars = append(pars, pageSize)
|
|
|
+// err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
type ReportPvUv struct {
|
|
|
ReportId int
|
|
|
PvTotal int
|
|
@@ -225,7 +292,7 @@ func GetReportPvUvByReportIdList(reportIdList []int) (items []ReportPvUv, err er
|
|
|
func GetReportListCountByGrant(condition string, pars []interface{}) (count int, err error) {
|
|
|
sql := `SELECT a.id FROM report as a
|
|
|
JOIN report_grant b on a.id=b.report_id
|
|
|
- WHERE 1=1 `
|
|
|
+ WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
@@ -236,6 +303,39 @@ func GetReportListCountByGrant(condition string, pars []interface{}) (count int,
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// func GetReportListCountByGrant(condition string, pars []interface{}) (count int, err error) {
|
|
|
+// sql := `SELECT a.id FROM report as a
|
|
|
+// JOIN report_grant b on a.id=b.report_id
|
|
|
+// LEFT JOIN classify_visible c ON (
|
|
|
+// CASE
|
|
|
+// WHEN a.classify_id_third > 0 THEN a.classify_id_third
|
|
|
+// WHEN a.classify_id_second > 0 THEN a.classify_id_second
|
|
|
+// ELSE a.classify_id_first
|
|
|
+// END
|
|
|
+// ) = c.classify_id AND c.admin_id =?
|
|
|
+// WHERE 1=1 AND (c.admin_id IS NULL OR c.admin_id =?) AND a.id NOT IN (
|
|
|
+// SELECT id FROM report ta
|
|
|
+// JOIN classify_visible tb ON (
|
|
|
+// CASE
|
|
|
+// WHEN ta.classify_id_third > 0 THEN ta.classify_id_third
|
|
|
+// WHEN ta.classify_id_second > 0 THEN ta.classify_id_second
|
|
|
+// ELSE ta.classify_id_first
|
|
|
+// END
|
|
|
+// ) = tb.classify_id
|
|
|
+// GROUP BY ta."id"
|
|
|
+// HAVING SUM(CASE WHEN tb.admin_id = ? THEN 1 ELSE 0 END) = 0
|
|
|
+// ) `
|
|
|
+// if condition != "" {
|
|
|
+// sql += condition
|
|
|
+// }
|
|
|
+// sql += " GROUP BY a.id "
|
|
|
+
|
|
|
+// sql = `SELECT COUNT(1) AS count FROM (` + sql + `) d`
|
|
|
+
|
|
|
+// err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
// GetReportListByGrant
|
|
|
// @Description: 获取共享报告列表的数据
|
|
|
// @author: Roc
|
|
@@ -247,12 +347,12 @@ func GetReportListCountByGrant(condition string, pars []interface{}) (count int,
|
|
|
// @return items []*ReportList
|
|
|
// @return err error
|
|
|
func GetReportListByGrant(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
- sql := `SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type FROM report as a JOIN report_grant b on a.id = b.report_id WHERE 1=1 `
|
|
|
+ sql := `SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type,a.report_source 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 += ` GROUP BY a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type
|
|
|
+ sql += ` GROUP BY a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type,a.report_source
|
|
|
|
|
|
ORDER BY CASE a."state"
|
|
|
WHEN 3 THEN 1
|
|
@@ -268,6 +368,47 @@ func GetReportListByGrant(condition string, pars []interface{}, startSize, pageS
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// func GetReportListByGrant(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
+// sql := `SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type,a.report_source FROM report as a JOIN report_grant b on a.id = b.report_id
|
|
|
+// LEFT JOIN classify_visible c ON (
|
|
|
+// CASE
|
|
|
+// WHEN a.classify_id_third > 0 THEN a.classify_id_third
|
|
|
+// WHEN a.classify_id_second > 0 THEN a.classify_id_second
|
|
|
+// ELSE a.classify_id_first
|
|
|
+// END
|
|
|
+// ) = c.classify_id AND c.admin_id =?
|
|
|
+// WHERE 1=1 AND (c.admin_id IS NULL OR c.admin_id =?) AND a.id NOT IN (
|
|
|
+// SELECT id FROM report ta
|
|
|
+// JOIN classify_visible tb ON (
|
|
|
+// CASE
|
|
|
+// WHEN ta.classify_id_third > 0 THEN ta.classify_id_third
|
|
|
+// WHEN ta.classify_id_second > 0 THEN ta.classify_id_second
|
|
|
+// ELSE ta.classify_id_first
|
|
|
+// END
|
|
|
+// ) = tb.classify_id
|
|
|
+// GROUP BY ta."id"
|
|
|
+// HAVING SUM(CASE WHEN tb.admin_id = ? THEN 1 ELSE 0 END) = 0
|
|
|
+// ) `
|
|
|
+// if condition != "" {
|
|
|
+// sql += condition
|
|
|
+// }
|
|
|
+// // 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
|
|
|
+// sql += ` GROUP BY a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,a.create_time,a.modify_time,a.state,a.publish_time,a.pre_publish_time,a.stage,a.msg_is_send,a.pre_msg_send,a.video_url,a.video_name,a.video_play_seconds,a.report_code,a.video_size,a.report_version,a.ths_msg_is_send,a.has_chapter,a.chapter_type,a.old_report_id,a.msg_send_time,a.admin_id,a.admin_real_name,a.approve_time,a.approve_id,a.detail_img_url,a.detail_pdf_url,a.last_modify_admin_id,a.last_modify_admin_name,a.content_modify_time,a.pv,a.uv,a.canvas_color,a.need_splice,a.head_resource_id,a.end_resource_id,a.classify_id_third,a.classify_name_third,a.collaborate_type,a.report_layout,a.is_public_publish,a.report_create_time,a.inherit_report_id,a.voice_generate_type,a.report_source
|
|
|
+
|
|
|
+// ORDER BY CASE a."state"
|
|
|
+// WHEN 3 THEN 1
|
|
|
+// WHEN 1 THEN 2
|
|
|
+// WHEN 4 THEN 3
|
|
|
+// WHEN 5 THEN 4
|
|
|
+// WHEN 6 THEN 5
|
|
|
+// ELSE 6
|
|
|
+// END, a.modify_time DESC LIMIT ?,?`
|
|
|
+// pars = append(pars, startSize)
|
|
|
+// pars = append(pars, pageSize)
|
|
|
+// err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
func GetReportListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
sql := `SELECT COUNT(1) AS count FROM report WHERE 1=1 `
|
|
|
if condition != "" {
|
|
@@ -297,37 +438,35 @@ func DeleteReport(reportIds int) (err error) {
|
|
|
}
|
|
|
|
|
|
type ReportDetail struct {
|
|
|
- Id int `gorm:"column:id;primary_key;autoIncrement" description:"报告Id"`
|
|
|
- AddType int `gorm:"column:add_type" description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
- ClassifyIdFirst int `gorm:"column:classify_id_first" description:"一级分类id"`
|
|
|
- ClassifyNameFirst string `gorm:"column:classify_name_first" description:"一级分类名称"`
|
|
|
- ClassifyIdSecond int `gorm:"column:classify_id_second" description:"二级分类id"`
|
|
|
- ClassifyNameSecond string `gorm:"column:classify_name_second" description:"二级分类名称"`
|
|
|
- Title string `gorm:"column:title" description:"标题"`
|
|
|
- Abstract string `gorm:"column:abstract" description:"摘要"`
|
|
|
- Author string `gorm:"column:author" description:"作者"`
|
|
|
- Frequency string `gorm:"column:frequency" description:"频度"`
|
|
|
- CreateTime string `gorm:"column:create_time" description:"创建时间"`
|
|
|
- ModifyTime string `gorm:"column:modify_time" description:"修改时间"`
|
|
|
- State int `gorm:"column:state" description:"1:未发布,2:已发布"`
|
|
|
- PublishTime string `gorm:"column:publish_time" description:"发布时间"`
|
|
|
- PrePublishTime string `gorm:"column:pre_publish_time" description:"预发布时间"`
|
|
|
- Stage int `gorm:"column:stage" description:"期数"`
|
|
|
- MsgIsSend int `gorm:"column:msg_is_send" description:"消息是否已发送,0:否,1:是"`
|
|
|
- PreMsgSend int `gorm:"column:pre_msg_send" description:"定时发布成功后是否立即推送模版消息:0否,1是"`
|
|
|
- Content string `gorm:"column:content" description:"内容"`
|
|
|
- VideoUrl string `gorm:"column:video_url" description:"音频文件URL"`
|
|
|
- VideoName string `gorm:"column:video_name" description:"音频文件名称"`
|
|
|
- VideoPlaySeconds string `gorm:"column:video_play_seconds" description:"音频播放时长"`
|
|
|
- ContentSub string `gorm:"column:content_sub" description:"内容前两个章节"`
|
|
|
- ThsMsgIsSend int `gorm:"column:ths_msg_is_send" description:"客户群消息是否已发送,0:否,1:是"`
|
|
|
- HasChapter int `gorm:"column:has_chapter" description:"是否有章节 0-否 1-是"`
|
|
|
- ChapterType string `gorm:"column:chapter_type" description:"章节类型 day-晨报 week-周报"`
|
|
|
- AdminId int `gorm:"column:admin_id" description:"创建者账号"`
|
|
|
- AdminRealName string `gorm:"column:admin_real_name" description:"创建者姓名"`
|
|
|
- ReportCode string `gorm:"column:report_code" description:"报告唯一编码"`
|
|
|
-
|
|
|
- // eta1.8.3(研报改版)相关内容
|
|
|
+ Id int `gorm:"column:id;primary_key;autoIncrement" description:"报告Id"`
|
|
|
+ AddType int `gorm:"column:add_type" description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
+ ClassifyIdFirst int `gorm:"column:classify_id_first" description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `gorm:"column:classify_name_first" description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `gorm:"column:classify_id_second" description:"二级分类id"`
|
|
|
+ ClassifyNameSecond string `gorm:"column:classify_name_second" description:"二级分类名称"`
|
|
|
+ Title string `gorm:"column:title" description:"标题"`
|
|
|
+ Abstract string `gorm:"column:abstract" description:"摘要"`
|
|
|
+ Author string `gorm:"column:author" description:"作者"`
|
|
|
+ Frequency string `gorm:"column:frequency" description:"频度"`
|
|
|
+ CreateTime string `gorm:"column:create_time" description:"创建时间"`
|
|
|
+ ModifyTime string `gorm:"column:modify_time" description:"修改时间"`
|
|
|
+ State int `gorm:"column:state" description:"1:未发布,2:已发布"`
|
|
|
+ PublishTime string `gorm:"column:publish_time" description:"发布时间"`
|
|
|
+ PrePublishTime string `gorm:"column:pre_publish_time" description:"预发布时间"`
|
|
|
+ Stage int `gorm:"column:stage" description:"期数"`
|
|
|
+ MsgIsSend int `gorm:"column:msg_is_send" description:"消息是否已发送,0:否,1:是"`
|
|
|
+ PreMsgSend int `gorm:"column:pre_msg_send" description:"定时发布成功后是否立即推送模版消息:0否,1是"`
|
|
|
+ Content string `gorm:"column:content" description:"内容"`
|
|
|
+ VideoUrl string `gorm:"column:video_url" description:"音频文件URL"`
|
|
|
+ VideoName string `gorm:"column:video_name" description:"音频文件名称"`
|
|
|
+ VideoPlaySeconds string `gorm:"column:video_play_seconds" description:"音频播放时长"`
|
|
|
+ ContentSub string `gorm:"column:content_sub" description:"内容前两个章节"`
|
|
|
+ ThsMsgIsSend int `gorm:"column:ths_msg_is_send" description:"客户群消息是否已发送,0:否,1:是"`
|
|
|
+ HasChapter int `gorm:"column:has_chapter" description:"是否有章节 0-否 1-是"`
|
|
|
+ ChapterType string `gorm:"column:chapter_type" description:"章节类型 day-晨报 week-周报"`
|
|
|
+ AdminId int `gorm:"column:admin_id" description:"创建者账号"`
|
|
|
+ AdminRealName string `gorm:"column:admin_real_name" description:"创建者姓名"`
|
|
|
+ ReportCode string `gorm:"column:report_code" description:"报告唯一编码"`
|
|
|
ContentStruct string `gorm:"column:content_struct" description:"内容组件"`
|
|
|
LastModifyAdminId int `gorm:"column:last_modify_admin_id" description:"最后更新人ID"`
|
|
|
LastModifyAdminName string `gorm:"column:last_modify_admin_name" description:"最后更新人姓名"`
|
|
@@ -348,6 +487,8 @@ type ReportDetail struct {
|
|
|
ReportLayout int8 `gorm:"column:report_layout" description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
|
IsPublicPublish int8 `gorm:"column:is_public_publish" description:"是否公开发布,1:是,2:否"`
|
|
|
ReportCreateTime string `gorm:"column:report_create_time" description:"报告时间创建时间"`
|
|
|
+ ReportSource int `gorm:"column:report_source" description:"报告来源:1-系统内;2-智力共享"`
|
|
|
+ OutReportId string `gorm:"column:out_report_id" description:"外部报告ID(或编码)"`
|
|
|
}
|
|
|
|
|
|
func GetReportById(reportId int) (item *ReportDetail, err error) {
|
|
@@ -443,7 +584,7 @@ func GetReportStage(classifyIdFirst, classifyIdSecond, classifyIdThird int) (cou
|
|
|
|
|
|
type PublishReq struct {
|
|
|
ReportIds string `description:"报告id,多个用英文逗号隔开"`
|
|
|
- ReportUrl string `description:"报告Url"`
|
|
|
+ //ReportUrl string `description:"报告Url"`
|
|
|
}
|
|
|
|
|
|
type PublishCancelReq struct {
|
|
@@ -661,6 +802,8 @@ type SaveReportContent struct {
|
|
|
NeedSplice int `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
|
|
|
HeadResourceId int `description:"版头资源ID"`
|
|
|
EndResourceId int `description:"版尾资源ID"`
|
|
|
+
|
|
|
+ IsManualSave bool `description:"是否手动保存:true:手动 false:自动"`
|
|
|
}
|
|
|
|
|
|
func AddReportSaveLog(reportId, adminId int, content, contentSub, contentStruct, canvasColor, adminName string, headResourceId, endResourceId int) (err error) {
|
|
@@ -1121,3 +1264,23 @@ func GetReportFieldsByIds(ids []int, fields []string) (items []*Report, err erro
|
|
|
err = global.DmSQL["rddp"].Raw(sql, ids).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func (m *Report) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
|
+ sql := fmt.Sprintf(`SELECT COUNT(1) FROM report WHERE 1=1 %s`, condition)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Report) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*Report, err error) {
|
|
|
+ fields := strings.Join(fieldArr, ",")
|
|
|
+ if len(fieldArr) == 0 {
|
|
|
+ fields = `*`
|
|
|
+ }
|
|
|
+ order := `ORDER BY create_time DESC`
|
|
|
+ if orderRule != "" {
|
|
|
+ order = ` ORDER BY ` + orderRule
|
|
|
+ }
|
|
|
+ sql := fmt.Sprintf(`SELECT %s FROM report WHERE 1=1 %s %s`, fields, condition, order)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
|
+ return
|
|
|
+}
|