|
@@ -2,8 +2,10 @@
|
|
|
package document_manage_model
|
|
|
|
|
|
import (
|
|
|
+ "eta/eta_api/utils"
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
type OutsideReport struct {
|
|
@@ -23,6 +25,53 @@ type OutsideReport struct {
|
|
|
ReportCode string `orm:"column(report_code)" description:"报告唯一编码"`
|
|
|
}
|
|
|
|
|
|
+// [2025-zsh-时间类型修复-chenhan]
|
|
|
+type OutsideReportORM struct {
|
|
|
+ OutsideReportId int `orm:"column(outside_report_id);pk" description:"外部报告ID"`
|
|
|
+ Source int `orm:"column(source)" description:"来源,1:ETA系统录入;2:API接口录入;3:邮件监听录入"`
|
|
|
+ Title string `orm:"column(title)" description:"报告标题"`
|
|
|
+ Abstract string `orm:"column(abstract)" description:"摘要"`
|
|
|
+ ClassifyId int `orm:"column(classify_id)" description:"所属分类id"`
|
|
|
+ ClassifyName string `orm:"column(classify_name)" description:"所属分类名称(整个分类链条)"`
|
|
|
+ Content string `orm:"column(content)" description:"报告富文本内容"`
|
|
|
+ SysUserId int `orm:"column(sys_user_id)" description:"创建人id"`
|
|
|
+ SysUserName string `orm:"column(sys_user_name)" description:"创建人姓名"`
|
|
|
+ EmailMessageUid int `orm:"column(email_message_uid)" description:"该邮件在邮箱中的唯一id"`
|
|
|
+ ReportUpdateTime time.Time `orm:"column(report_update_time)" description:"报告更新时间,如果来源于邮件,那么取邮件的收件时间"`
|
|
|
+ ModifyTime time.Time `orm:"column(modify_time)" description:"最近一次修改时间"`
|
|
|
+ CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
|
|
|
+ ReportCode string `orm:"column(report_code)" description:"报告唯一编码"`
|
|
|
+}
|
|
|
+
|
|
|
+func (outsideReportOrm *OutsideReportORM) ToOutsideReport() (outsideReport OutsideReport) {
|
|
|
+ outsideReport = OutsideReport{
|
|
|
+ OutsideReportId: outsideReport.OutsideReportId,
|
|
|
+ Source: outsideReport.Source,
|
|
|
+ Title: outsideReport.Title,
|
|
|
+ Abstract: outsideReport.Abstract,
|
|
|
+ ClassifyId: outsideReport.ClassifyId,
|
|
|
+ ClassifyName: outsideReport.ClassifyName,
|
|
|
+ Content: outsideReport.Content,
|
|
|
+ SysUserId: outsideReport.SysUserId,
|
|
|
+ SysUserName: outsideReport.SysUserName,
|
|
|
+ EmailMessageUid: outsideReport.EmailMessageUid,
|
|
|
+ ReportUpdateTime: outsideReport.ReportUpdateTime,
|
|
|
+ //ModifyTime: outsideReport.ModifyTime,
|
|
|
+ CreateTime: outsideReport.CreateTime,
|
|
|
+ ReportCode: outsideReport.ReportCode,
|
|
|
+ }
|
|
|
+ if !outsideReportOrm.ModifyTime.IsZero() {
|
|
|
+ outsideReport.ModifyTime = outsideReportOrm.ModifyTime.Format(utils.FormatDateTime)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+func toOutsideReportList(outsideReportORMList []OutsideReportORM) (outsideReportList []OutsideReport) {
|
|
|
+ for _, outsideReport := range outsideReportORMList {
|
|
|
+ outsideReportList = append(outsideReportList, outsideReport.ToOutsideReport())
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
type OutsideReportPage struct {
|
|
|
List []OutsideReport `description:"报告列表"`
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
@@ -81,11 +130,12 @@ t1.classify_name, t1.sys_user_id, t1.sys_user_name, t1.email_message_uid, t1.rep
|
|
|
t1.modify_time, t1.create_time, t1.report_code from outside_report t1
|
|
|
left join chart_permission_search_key_word_mapping t2 on t1.classify_id = t2.classify_id where 1 = 1 `
|
|
|
sql += condition
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&list)
|
|
|
+ var ormList []OutsideReportORM
|
|
|
+ _, err = o.Raw(sql, pars).QueryRows(&ormList)
|
|
|
if err != nil && err != orm.ErrNoRows {
|
|
|
return nil, err
|
|
|
}
|
|
|
-
|
|
|
+ list = toOutsideReportList(ormList)
|
|
|
return list, nil
|
|
|
}
|
|
|
|
|
@@ -124,10 +174,11 @@ func DeleteOutsideReport(id int) (err error) {
|
|
|
func GetOutsideReportListByClassifyId(classifyId int) (list []OutsideReport, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `select * from outside_report where classify_id = ?`
|
|
|
- _, err = o.Raw(sql, classifyId).QueryRows(&list)
|
|
|
+ var ormList []OutsideReportORM
|
|
|
+ _, err = o.Raw(sql, classifyId).QueryRows(&ormList)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
-
|
|
|
+ list = toOutsideReportList(ormList)
|
|
|
return list, err
|
|
|
}
|