|
@@ -35,7 +35,7 @@ func ReportViewTimes() (err error) {
|
|
|
cellD := rowTitle.AddCell()
|
|
|
cellD.Value = "最近一次访问日期"
|
|
|
|
|
|
- rddpItems,err:=models.GetRddpHistoryViewTimes()
|
|
|
+ rddpItems, err := models.GetRddpHistoryViewTimes()
|
|
|
|
|
|
items, err := models.GetHistoryViewTimes()
|
|
|
|
|
@@ -76,7 +76,7 @@ func ReportViewTimes() (err error) {
|
|
|
//发送邮件
|
|
|
content := "你好,上周用户访问次数见附件。"
|
|
|
fmt.Println("start send email")
|
|
|
- sendResult := utils.SendEmailByHongze(title, content, utils.EmailSendToHzUsers, savePath,title+".xlsx")
|
|
|
+ sendResult := utils.SendEmailByHongze(title, content, utils.EmailSendToHzUsers, savePath, title+".xlsx")
|
|
|
//sendResult:=utils.SendEmailByHongze(title,content,utils.EmailSendToMe,savePath)
|
|
|
if sendResult {
|
|
|
os.Remove(savePath)
|
|
@@ -105,7 +105,6 @@ func ReportViewDetail() (err error) {
|
|
|
advisory.TypeValue = "advisory"
|
|
|
typeList = append(typeList, advisory)
|
|
|
|
|
|
-
|
|
|
week := new(models.ReportType)
|
|
|
week.TypeName = "周报"
|
|
|
week.TypeValue = "week"
|
|
@@ -137,6 +136,68 @@ func ReportViewDetail() (err error) {
|
|
|
file := xlsx.NewFile()
|
|
|
for _, v := range typeList {
|
|
|
fmt.Println(v.TypeName, v.TypeValue)
|
|
|
+ if v.TypeName == `周报` {
|
|
|
+ sheet, err := file.AddSheet(v.TypeName + "研报阅读统计")
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "用户名称"
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "公司名称"
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "访问时间"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "访问标题"
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
+ cellE.Value = "访问页面"
|
|
|
+ cellF := rowTitle.AddCell()
|
|
|
+ cellF.Value = "报告类型"
|
|
|
+
|
|
|
+ items, err := models.GetResearchReportViewersDetail(startTime, endTime, v.TypeValue)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ for _, item := range items {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellA := row.AddCell()
|
|
|
+ cellA.Value = item.RealName
|
|
|
+ cellB := row.AddCell()
|
|
|
+ cellB.Value = item.CompanyName
|
|
|
+ cellC := row.AddCell()
|
|
|
+ cellC.Value = item.CreatedTime
|
|
|
+ cellD := row.AddCell()
|
|
|
+ cellD.Value = item.ResearchReportName
|
|
|
+ cellE := row.AddCell()
|
|
|
+ cellE.Value = item.ReportVariety
|
|
|
+ cellF := row.AddCell()
|
|
|
+ cellF.Value = v.TypeName
|
|
|
+ }
|
|
|
+
|
|
|
+ //新周报的数据
|
|
|
+ weekItems, err := models.GetRddpWeekReportViewersDetail(startTime, endTime)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ for _, item := range weekItems {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellA := row.AddCell()
|
|
|
+ cellA.Value = item.RealName
|
|
|
+ cellB := row.AddCell()
|
|
|
+ cellB.Value = item.CompanyName
|
|
|
+ cellC := row.AddCell()
|
|
|
+ cellC.Value = item.CreatedTime
|
|
|
+ cellD := row.AddCell()
|
|
|
+ cellD.Value = item.ResearchReportName + "(" + item.ReportCreateDate + ")"
|
|
|
+ cellE := row.AddCell()
|
|
|
+ cellE.Value = item.ReportVariety
|
|
|
+ cellF := row.AddCell()
|
|
|
+ cellF.Value = v.TypeName
|
|
|
+ }
|
|
|
+ continue
|
|
|
+ }
|
|
|
if v.TypeValue == "rddp" {
|
|
|
sheet, err := file.AddSheet(v.TypeName + "阅读统计")
|
|
|
if err != nil {
|
|
@@ -248,7 +309,7 @@ func ReportViewDetail() (err error) {
|
|
|
}
|
|
|
}
|
|
|
title := "研报阅读统计报表"
|
|
|
- savePath := "report_view_detail"+ time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ savePath := "report_view_detail" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
err = file.Save("./" + savePath)
|
|
|
fmt.Println(err)
|
|
|
if err != nil {
|
|
@@ -256,7 +317,7 @@ func ReportViewDetail() (err error) {
|
|
|
}
|
|
|
//发送邮件
|
|
|
fmt.Println("start send email")
|
|
|
- sendResult := utils.SendEmailByHongze(title, "你好,上周研报阅读统计见附件。", utils.EmailSendToHzUsers, savePath,title+".xlsx")
|
|
|
+ sendResult := utils.SendEmailByHongze(title, "你好,上周研报阅读统计见附件。", utils.EmailSendToHzUsers, savePath, title+".xlsx")
|
|
|
//sendResult:=utils.SendEmailByHongze(title,"你好,上周研报阅读统计见附件。",utils.EmailSendToMe,savePath)
|
|
|
if sendResult {
|
|
|
os.Remove(savePath)
|