|
@@ -692,6 +692,13 @@ func (this *UserController) TableDetail() {
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListArticle(this, list, 1, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} else if source == 2 {
|
|
@@ -765,6 +772,11 @@ func (this *UserController) TableDetail() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListActivity(this, list, 1, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 3 {
|
|
|
if classType == 1 {
|
|
|
condition += " AND art.article_type_id = 0 "
|
|
@@ -990,6 +1002,11 @@ func (this *UserController) TableDetail() {
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListYanxuanSpecial(this, list, 1, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 12 { //收藏的专栏文章
|
|
|
if startDate != "" {
|
|
|
startDate += " 00:00:00"
|
|
@@ -1107,138 +1124,6 @@ func (this *UserController) TableDetail() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
-// EnterScoreScoreListExport 导出Excel
|
|
|
-func exportListRsCalendar(this *UserController, list []*cygx.UserInteraction, excelType int, br *models.BaseResponse) {
|
|
|
-
|
|
|
- dir, err := os.Executable()
|
|
|
- exPath := filepath.Dir(dir)
|
|
|
- downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
- xlsxFile := xlsx.NewFile()
|
|
|
- if err != nil {
|
|
|
- br.Msg = "生成文件失败"
|
|
|
- br.ErrMsg = "生成文件失败"
|
|
|
- return
|
|
|
- }
|
|
|
- style := xlsx.NewStyle()
|
|
|
- border := xlsx.NewBorder("thin", "thin", "thin", "thin")
|
|
|
- alignment := xlsx.Alignment{
|
|
|
- Horizontal: "center",
|
|
|
- Vertical: "center",
|
|
|
- WrapText: true,
|
|
|
- }
|
|
|
-
|
|
|
- redStyle := xlsx.NewStyle()
|
|
|
- redStyle.Alignment = alignment
|
|
|
- redStyle.ApplyAlignment = true
|
|
|
- redStyle.Font.Color = "ff0000"
|
|
|
- redStyle.Border = *border
|
|
|
-
|
|
|
- style.Alignment = alignment
|
|
|
- style.ApplyAlignment = true
|
|
|
-
|
|
|
- sheel, err := xlsxFile.AddSheet("1V1路演")
|
|
|
- if err != nil {
|
|
|
- br.Msg = "新增Sheet失败"
|
|
|
- br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- sheel.SetColWidth(0, 0, 30)
|
|
|
- sheel.SetColWidth(1, 1, 15)
|
|
|
- sheel.SetColWidth(2, 2, 15)
|
|
|
- sheel.SetColWidth(3, 3, 18)
|
|
|
-
|
|
|
- titleRow := sheel.AddRow()
|
|
|
-
|
|
|
- if excelType > 2 {
|
|
|
- cellA := titleRow.AddCell()
|
|
|
- cellA.SetStyle(style)
|
|
|
- cellA.SetValue("客户名称")
|
|
|
- }
|
|
|
-
|
|
|
- if excelType > 1 {
|
|
|
- cellB := titleRow.AddCell()
|
|
|
- cellB.SetStyle(style)
|
|
|
- cellB.SetValue("姓名")
|
|
|
-
|
|
|
- cellC := titleRow.AddCell()
|
|
|
- cellC.SetStyle(style)
|
|
|
- cellC.SetValue("手机号")
|
|
|
- }
|
|
|
-
|
|
|
- cellD := titleRow.AddCell()
|
|
|
- cellD.SetStyle(style)
|
|
|
- cellD.SetValue("路演时间")
|
|
|
-
|
|
|
- cellE := titleRow.AddCell()
|
|
|
- cellE.SetStyle(style)
|
|
|
- cellE.SetValue("研究员")
|
|
|
-
|
|
|
- cellF := titleRow.AddCell()
|
|
|
- cellF.SetStyle(style)
|
|
|
- cellF.SetValue("路演形式")
|
|
|
-
|
|
|
- cellG := titleRow.AddCell()
|
|
|
- cellG.SetStyle(style)
|
|
|
- cellG.SetValue("主题标签")
|
|
|
-
|
|
|
- for _, v := range list {
|
|
|
- dataRow := sheel.AddRow()
|
|
|
- dataRow.SetHeight(20)
|
|
|
-
|
|
|
- if excelType > 2 {
|
|
|
- cellAData := dataRow.AddCell()
|
|
|
- cellAData.SetStyle(style)
|
|
|
- cellAData.Value = v.CompanyName
|
|
|
- }
|
|
|
-
|
|
|
- if excelType > 1 {
|
|
|
- cellBData := dataRow.AddCell()
|
|
|
- cellBData.SetStyle(style)
|
|
|
- cellBData.Value = v.RealName
|
|
|
-
|
|
|
- cellCData := dataRow.AddCell()
|
|
|
- cellCData.SetStyle(style)
|
|
|
- cellCData.Value = v.Mobile
|
|
|
- }
|
|
|
-
|
|
|
- cellDData := dataRow.AddCell()
|
|
|
- cellDData.SetStyle(style)
|
|
|
- cellDData.Value = v.ActivityTimeText
|
|
|
-
|
|
|
- cellEData := dataRow.AddCell()
|
|
|
- cellEData.SetStyle(style)
|
|
|
- cellEData.Value = v.ResearcherName
|
|
|
-
|
|
|
- cellFData := dataRow.AddCell()
|
|
|
- cellFData.SetStyle(style)
|
|
|
- if v.ActivityType == 1 {
|
|
|
- cellFData.Value = "线上"
|
|
|
- } else {
|
|
|
- cellFData.Value = "线下"
|
|
|
- }
|
|
|
-
|
|
|
- cellGData := dataRow.AddCell()
|
|
|
- cellGData.SetStyle(style)
|
|
|
- cellGData.Value = v.LabelKeyWord
|
|
|
-
|
|
|
- }
|
|
|
- err = xlsxFile.Save(downLoadnFilePath)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "保存文件失败"
|
|
|
- br.ErrMsg = "保存文件失败"
|
|
|
- return
|
|
|
- }
|
|
|
- randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
- downloadFileName := "1V1路演导出数据_" + randStr + ".xlsx"
|
|
|
- this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
- defer func() {
|
|
|
- os.Remove(downLoadnFilePath)
|
|
|
- }()
|
|
|
- br.Ret = 200
|
|
|
- br.Success = true
|
|
|
- br.Msg = "导出成功"
|
|
|
-}
|
|
|
-
|
|
|
// @Title 获取用户标签详情
|
|
|
// @Description 获取用户标签详情接口
|
|
|
// @Param UserId query int true "用户id"
|
|
@@ -2644,6 +2529,11 @@ func (this *UserController) CompanyTableDetail() {
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListArticle(this, list, 2, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 2 {
|
|
|
|
|
|
if isMeeting == "1" {
|
|
@@ -2727,6 +2617,11 @@ func (this *UserController) CompanyTableDetail() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListActivity(this, list, 2, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 3 {
|
|
|
if classType == 1 {
|
|
|
condition += " AND art.article_type_id = 0 "
|
|
@@ -3046,6 +2941,11 @@ func (this *UserController) CompanyTableDetail() {
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListYanxuanSpecial(this, list, 2, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 12 { //收藏的专栏文章
|
|
|
if isAdminRole {
|
|
|
total, list, err = cygx.GetCygxYanxuanSpecialCollectByUser(condition, startSize, pageSize)
|
|
@@ -3931,6 +3831,11 @@ func (this *UserController) CompanyList() {
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListArticle(this, list, 3, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 2 {
|
|
|
|
|
|
if isMeeting == "1" {
|
|
@@ -4016,6 +3921,11 @@ func (this *UserController) CompanyList() {
|
|
|
v.SellerName = sellNameMap[v.CompanyId]
|
|
|
}
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListActivity(this, list, 3, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if source == 3 {
|
|
|
if classType == 1 {
|
|
|
condition += " AND art.article_type_id = 0 "
|
|
@@ -4385,6 +4295,16 @@ func (this *UserController) CompanyList() {
|
|
|
list[k].RegisterPlatformText = cygxService.GetArticleSourcePlatformText(v.RegisterPlatform)
|
|
|
list[k].HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.ArticleId)
|
|
|
}
|
|
|
+ for k, v := range list {
|
|
|
+ list[k].RegisterPlatform = cygxService.GetArticleSourcePlatform(v.SourcePlatform)
|
|
|
+ list[k].RegisterPlatformText = cygxService.GetArticleSourcePlatformText(v.RegisterPlatform)
|
|
|
+ list[k].HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.ArticleId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListYanxuanSpecial(this, list, 3, br)
|
|
|
+ return
|
|
|
}
|
|
|
} else if source == 12 { //收藏的专栏文章
|
|
|
if isAdminRole {
|
|
@@ -5813,3 +5733,481 @@ func (this *UserController) UserRemind() {
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// exportListRsCalendar 1v1路演导出Excel
|
|
|
+func exportListRsCalendar(this *UserController, list []*cygx.UserInteraction, excelType int, br *models.BaseResponse) {
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "生成文件失败"
|
|
|
+ br.ErrMsg = "生成文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ border := xlsx.NewBorder("thin", "thin", "thin", "thin")
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+
|
|
|
+ redStyle := xlsx.NewStyle()
|
|
|
+ redStyle.Alignment = alignment
|
|
|
+ redStyle.ApplyAlignment = true
|
|
|
+ redStyle.Font.Color = "ff0000"
|
|
|
+ redStyle.Border = *border
|
|
|
+
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+
|
|
|
+ sheel, err := xlsxFile.AddSheet("1V1路演")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增Sheet失败"
|
|
|
+ br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sheel.SetColWidth(0, 0, 30)
|
|
|
+ sheel.SetColWidth(1, 1, 15)
|
|
|
+ sheel.SetColWidth(2, 2, 15)
|
|
|
+ sheel.SetColWidth(3, 3, 18)
|
|
|
+
|
|
|
+ titleRow := sheel.AddRow()
|
|
|
+
|
|
|
+ if excelType > 2 {
|
|
|
+ cellA := titleRow.AddCell()
|
|
|
+ cellA.SetStyle(style)
|
|
|
+ cellA.SetValue("客户名称")
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellB := titleRow.AddCell()
|
|
|
+ cellB.SetStyle(style)
|
|
|
+ cellB.SetValue("姓名")
|
|
|
+
|
|
|
+ cellC := titleRow.AddCell()
|
|
|
+ cellC.SetStyle(style)
|
|
|
+ cellC.SetValue("手机号")
|
|
|
+ }
|
|
|
+
|
|
|
+ cellD := titleRow.AddCell()
|
|
|
+ cellD.SetStyle(style)
|
|
|
+ cellD.SetValue("路演时间")
|
|
|
+
|
|
|
+ cellE := titleRow.AddCell()
|
|
|
+ cellE.SetStyle(style)
|
|
|
+ cellE.SetValue("研究员")
|
|
|
+
|
|
|
+ cellF := titleRow.AddCell()
|
|
|
+ cellF.SetStyle(style)
|
|
|
+ cellF.SetValue("路演形式")
|
|
|
+
|
|
|
+ cellG := titleRow.AddCell()
|
|
|
+ cellG.SetStyle(style)
|
|
|
+ cellG.SetValue("主题标签")
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ dataRow := sheel.AddRow()
|
|
|
+ dataRow.SetHeight(20)
|
|
|
+
|
|
|
+ if excelType > 2 {
|
|
|
+ cellAData := dataRow.AddCell()
|
|
|
+ cellAData.SetStyle(style)
|
|
|
+ cellAData.Value = v.CompanyName
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellBData := dataRow.AddCell()
|
|
|
+ cellBData.SetStyle(style)
|
|
|
+ cellBData.Value = v.RealName
|
|
|
+
|
|
|
+ cellCData := dataRow.AddCell()
|
|
|
+ cellCData.SetStyle(style)
|
|
|
+ cellCData.Value = v.Mobile
|
|
|
+ }
|
|
|
+
|
|
|
+ cellDData := dataRow.AddCell()
|
|
|
+ cellDData.SetStyle(style)
|
|
|
+ cellDData.Value = v.ActivityTimeText
|
|
|
+
|
|
|
+ cellEData := dataRow.AddCell()
|
|
|
+ cellEData.SetStyle(style)
|
|
|
+ cellEData.Value = v.ResearcherName
|
|
|
+
|
|
|
+ cellFData := dataRow.AddCell()
|
|
|
+ cellFData.SetStyle(style)
|
|
|
+ if v.ActivityType == 1 {
|
|
|
+ cellFData.Value = "线上"
|
|
|
+ } else {
|
|
|
+ cellFData.Value = "线下"
|
|
|
+ }
|
|
|
+
|
|
|
+ cellGData := dataRow.AddCell()
|
|
|
+ cellGData.SetStyle(style)
|
|
|
+ cellGData.Value = v.LabelKeyWord
|
|
|
+
|
|
|
+ }
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存文件失败"
|
|
|
+ br.ErrMsg = "保存文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
+ downloadFileName := "1V1路演导出数据_" + randStr + ".xlsx"
|
|
|
+ this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
+ defer func() {
|
|
|
+ os.Remove(downLoadnFilePath)
|
|
|
+ }()
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "导出成功"
|
|
|
+}
|
|
|
+
|
|
|
+// exportListArticle 文章阅读数据导出
|
|
|
+func exportListArticle(this *UserController, list []*cygx.UserInteraction, excelType int, br *models.BaseResponse) {
|
|
|
+ //创建excel
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "生成文件失败"
|
|
|
+ br.ErrMsg = "生成文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+ sheet, err := xlsxFile.AddSheet("报告阅读列表")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增Sheet失败"
|
|
|
+ br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+ if excelType > 2 {
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "客户名称"
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "所属销售"
|
|
|
+ }
|
|
|
+ if excelType > 1 {
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "姓名"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "手机号"
|
|
|
+ }
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
+ cellE.Value = "报告标题"
|
|
|
+ cellF := rowTitle.AddCell()
|
|
|
+ cellF.Value = "所属行业"
|
|
|
+ cellG := rowTitle.AddCell()
|
|
|
+ cellG.Value = "所属产业"
|
|
|
+ cellH := rowTitle.AddCell()
|
|
|
+ cellH.Value = "关联标的"
|
|
|
+ cellI := rowTitle.AddCell()
|
|
|
+ cellI.Value = "发布时间"
|
|
|
+ cellJ := rowTitle.AddCell()
|
|
|
+ cellJ.Value = "阅读时间"
|
|
|
+ cellK := rowTitle.AddCell()
|
|
|
+ cellK.Value = "阅读时长"
|
|
|
+
|
|
|
+ for _, item := range list {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ if excelType > 2 {
|
|
|
+ cellA := row.AddCell()
|
|
|
+ cellA.Value = item.CompanyName
|
|
|
+ cellB := row.AddCell()
|
|
|
+ cellB.Value = item.SellerName
|
|
|
+ }
|
|
|
+ if excelType > 1 {
|
|
|
+ cellC := row.AddCell()
|
|
|
+ cellC.Value = item.RealName
|
|
|
+ cellD := row.AddCell()
|
|
|
+ cellD.Value = item.Mobile
|
|
|
+ }
|
|
|
+ cellEData := row.AddCell()
|
|
|
+ cellEData.Value = item.Title
|
|
|
+ cellFData := row.AddCell()
|
|
|
+ cellFData.Value = item.PermissionName
|
|
|
+ cellGData := row.AddCell()
|
|
|
+ cellGData.Value = item.IndustryName
|
|
|
+ cellHData := row.AddCell()
|
|
|
+ cellHData.Value = item.SubjectNameStr
|
|
|
+ cellIData := row.AddCell()
|
|
|
+ cellIData.Value = item.PublishDate
|
|
|
+ cellJData := row.AddCell()
|
|
|
+ cellJData.Value = item.CreateTime
|
|
|
+ cellKData := row.AddCell()
|
|
|
+ cellKData.Value = item.StopTime
|
|
|
+ }
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存文件失败"
|
|
|
+ br.ErrMsg = "保存文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
+ downloadFileName := "报告阅读列表导出数据_" + randStr + ".xlsx"
|
|
|
+ this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
+ defer func() {
|
|
|
+ os.Remove(downLoadnFilePath)
|
|
|
+ }()
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "导出成功"
|
|
|
+}
|
|
|
+
|
|
|
+// exportListArticle 文章阅读数据导出
|
|
|
+func exportListActivity(this *UserController, list []*cygx.UserInteraction, excelType int, br *models.BaseResponse) {
|
|
|
+ //创建excel
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "生成文件失败"
|
|
|
+ br.ErrMsg = "生成文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+ sheet, err := xlsxFile.AddSheet("客户参会记录")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增Sheet失败"
|
|
|
+ br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+
|
|
|
+ if excelType > 2 {
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "客户名称"
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "所属销售"
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "姓名"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "手机号"
|
|
|
+ }
|
|
|
+
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
+ cellE.Value = "活动名称"
|
|
|
+ cellF := rowTitle.AddCell()
|
|
|
+ cellF.Value = "所属行业"
|
|
|
+ cellG := rowTitle.AddCell()
|
|
|
+ cellG.Value = "活动类型"
|
|
|
+ cellH := rowTitle.AddCell()
|
|
|
+ cellH.Value = "活动主题"
|
|
|
+ cellI := rowTitle.AddCell()
|
|
|
+ cellI.Value = "活动时间"
|
|
|
+ cellJ := rowTitle.AddCell()
|
|
|
+ cellJ.Value = "是否到会"
|
|
|
+ cellK := rowTitle.AddCell()
|
|
|
+ cellK.Value = "首次入会时间"
|
|
|
+ cellL := rowTitle.AddCell()
|
|
|
+ cellL.Value = "最后退出时间"
|
|
|
+ cellM := rowTitle.AddCell()
|
|
|
+ cellM.Value = "参与总时长"
|
|
|
+ cellN := rowTitle.AddCell()
|
|
|
+ cellN.Value = "参会方式"
|
|
|
+ cellO := rowTitle.AddCell()
|
|
|
+ cellO.Value = "参会权鉴"
|
|
|
+ cellP := rowTitle.AddCell()
|
|
|
+ cellP.Value = "参会状态"
|
|
|
+
|
|
|
+ for _, item := range list {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ if excelType > 2 {
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = item.CompanyName
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = item.SellerName
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ cellCData.Value = item.RealName
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = item.Mobile
|
|
|
+ }
|
|
|
+
|
|
|
+ cellEData := row.AddCell()
|
|
|
+ cellEData.Value = item.ActivityName
|
|
|
+ cellFData := row.AddCell()
|
|
|
+ cellFData.Value = item.PermissionName
|
|
|
+ cellGData := row.AddCell()
|
|
|
+ cellGData.Value = item.ActivityTypeName
|
|
|
+ cellHData := row.AddCell()
|
|
|
+ cellHData.Value = item.Label
|
|
|
+ cellIData := row.AddCell()
|
|
|
+ cellIData.Value = item.ActivityTime
|
|
|
+ cellJData := row.AddCell()
|
|
|
+ if item.IsMeeting == 1 {
|
|
|
+ cellJData.Value = "到会"
|
|
|
+ } else {
|
|
|
+ cellJData.Value = "未到会"
|
|
|
+ }
|
|
|
+ cellKData := row.AddCell()
|
|
|
+ cellKData.Value = item.FirstMeetingTime
|
|
|
+ cellLData := row.AddCell()
|
|
|
+ cellLData.Value = item.LastMeetingTime
|
|
|
+ cellMData := row.AddCell()
|
|
|
+ cellMData.Value = item.Duration
|
|
|
+ cellNData := row.AddCell()
|
|
|
+ cellNData.Value = item.LastMeetingTime
|
|
|
+ cellOData := row.AddCell()
|
|
|
+ cellOData.Value = item.MeetingTypeStr
|
|
|
+ cellPData := row.AddCell()
|
|
|
+ cellPData.Value = item.MeetingStatusStr
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存文件失败"
|
|
|
+ br.ErrMsg = "保存文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
+ downloadFileName := "客户参会记录导出数据_" + randStr + ".xlsx"
|
|
|
+ this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
+ defer func() {
|
|
|
+ os.Remove(downLoadnFilePath)
|
|
|
+ }()
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "导出成功"
|
|
|
+}
|
|
|
+
|
|
|
+// exportListYanxuanSpecial 研选专栏阅读记录
|
|
|
+func exportListYanxuanSpecial(this *UserController, list []*cygx.UserInteraction, excelType int, br *models.BaseResponse) {
|
|
|
+ //创建excel
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "生成文件失败"
|
|
|
+ br.ErrMsg = "生成文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+ sheet, err := xlsxFile.AddSheet("客户参会记录")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增Sheet失败"
|
|
|
+ br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+
|
|
|
+ if excelType > 2 {
|
|
|
+ cellAy := rowTitle.AddCell()
|
|
|
+ cellAy.Value = "客户名称"
|
|
|
+ cellBy := rowTitle.AddCell()
|
|
|
+ cellBy.Value = "所属销售"
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "姓名"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "手机号"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 = "阅读时长"
|
|
|
+ cellG := rowTitle.AddCell()
|
|
|
+ cellG.Value = "阅读来源"
|
|
|
+
|
|
|
+ for _, item := range list {
|
|
|
+ row := sheet.AddRow()
|
|
|
+
|
|
|
+ if excelType > 2 {
|
|
|
+ cellADatay := row.AddCell()
|
|
|
+ cellADatay.Value = item.CompanyName
|
|
|
+ cellBDatay := row.AddCell()
|
|
|
+ cellBDatay.Value = item.SellerName
|
|
|
+ }
|
|
|
+
|
|
|
+ if excelType > 1 {
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ cellCData.Value = item.RealName
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = item.Mobile
|
|
|
+ }
|
|
|
+
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = item.Title
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ if item.SpecialType == 1 {
|
|
|
+ cellBData.Value = "笔记"
|
|
|
+ } else {
|
|
|
+ cellBData.Value = "观点"
|
|
|
+ }
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ cellCData.Value = item.IndustryName
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = item.PublishDate
|
|
|
+ cellEData := row.AddCell()
|
|
|
+ cellEData.Value = item.CreateTime
|
|
|
+ cellFData := row.AddCell()
|
|
|
+ cellFData.Value = item.StopTime
|
|
|
+ cellGData := row.AddCell()
|
|
|
+ cellGData.Value = cygxService.GetArticleSourcePlatformText(item.RegisterPlatform)
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存文件失败"
|
|
|
+ br.ErrMsg = "保存文件失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
+ downloadFileName := "客户参会记录导出数据_" + randStr + ".xlsx"
|
|
|
+ this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
+ defer func() {
|
|
|
+ os.Remove(downLoadnFilePath)
|
|
|
+ }()
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "导出成功"
|
|
|
+}
|