|
@@ -541,7 +541,8 @@ func (this *UserController) TableList() {
|
|
|
// @Param StartDate query string true "开始时间"
|
|
|
// @Param EndDate query string true "结束时间"
|
|
|
// @Param KeyWord query string true "搜索关键词"
|
|
|
-// @Param ClassType query int true "列表类型,1:权益,2:研选,默认1"
|
|
|
+// @Param ClassType query int true "列表类型,1:权益,2:研选,默认1"
|
|
|
+// @Param IsExport query bool false "是否导出excel,默认是false"
|
|
|
// @Success 200 {object} cygx.UserInteractionListResp
|
|
|
// @router /user/interaction/detail [get]
|
|
|
func (this *UserController) TableDetail() {
|
|
@@ -576,6 +577,12 @@ func (this *UserController) TableDetail() {
|
|
|
source, _ := this.GetInt("Source")
|
|
|
identityType, _ := this.GetInt("IdentityType")
|
|
|
classType, _ := this.GetInt("ClassType", 1)
|
|
|
+ //是否导出报表
|
|
|
+ isExport, _ := this.GetBool("IsExport")
|
|
|
+ if isExport {
|
|
|
+ pageSize = 10000
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
if userId < 1 {
|
|
|
br.Msg = "用户不存在"
|
|
|
return
|
|
@@ -1080,6 +1087,12 @@ func (this *UserController) TableDetail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListRsCalendar(this, list, 1, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp := new(cygx.UserInteractionListResp)
|
|
@@ -1096,6 +1109,138 @@ 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"
|
|
@@ -2377,6 +2522,7 @@ func (this *UserController) CompanyTableList() {
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
|
// @Param ActivityName query string false "活动名称"
|
|
|
// @Param ClassType query int true "列表类型,1:权益,2:研选,默认1"
|
|
|
+// @Param IsExport query bool false "是否导出excel,默认是false"
|
|
|
// @Success 200 {object} cygx.UserInteractionListResp
|
|
|
// @router /user/company/interaction/detail [get]
|
|
|
func (this *UserController) CompanyTableDetail() {
|
|
@@ -2415,6 +2561,11 @@ func (this *UserController) CompanyTableDetail() {
|
|
|
br.Msg = "用户不存在"
|
|
|
return
|
|
|
}
|
|
|
+ isExport, _ := this.GetBool("IsExport")
|
|
|
+ if isExport {
|
|
|
+ pageSize = 10000
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
|
|
|
// 1.标记用户表
|
|
|
//操作权限校验
|
|
@@ -2984,6 +3135,11 @@ func (this *UserController) CompanyTableDetail() {
|
|
|
br.ErrMsg = "HandleListRsCalendar,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListRsCalendar(this, list, 2, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
@@ -3418,6 +3574,7 @@ func (this *UserController) CompanyExportInteraction() {
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
|
// @Param ActivityName query string false "活动名称"
|
|
|
// @Param ClassType query int true "列表类型,1:权益,2:研选,默认1"
|
|
|
+// @Param IsExport query bool false "是否导出excel,默认是false"
|
|
|
// @Success 200 {object} cygx.UserInteractionListResp
|
|
|
// @router /user/company/list [get]
|
|
|
func (this *UserController) CompanyList() {
|
|
@@ -3450,6 +3607,11 @@ func (this *UserController) CompanyList() {
|
|
|
//packageType, _ := this.GetInt("PackageType")
|
|
|
keyWord = strings.Trim(keyWord, " ")
|
|
|
keyWord = strings.Replace(keyWord, "'", "", -1)
|
|
|
+ isExport, _ := this.GetBool("IsExport")
|
|
|
+ if isExport {
|
|
|
+ pageSize = 10000
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
|
|
|
var total int
|
|
|
|
|
@@ -4307,6 +4469,11 @@ func (this *UserController) CompanyList() {
|
|
|
br.ErrMsg = "HandleListRsCalendar,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ //导出excel
|
|
|
+ if isExport {
|
|
|
+ exportListRsCalendar(this, list, 3, br)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|