|
@@ -4322,10 +4322,6 @@ func initQuanyi() {
|
|
|
|
|
|
}
|
|
|
|
|
|
-func init() {
|
|
|
- initart121_1()
|
|
|
-}
|
|
|
-
|
|
|
func initBeizhu() {
|
|
|
|
|
|
productList, err := company.GetCompanyHistoryRemarkListInit()
|
|
@@ -5248,3 +5244,244 @@ func initart121_1() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// func init() {
|
|
|
+// initAct33()
|
|
|
+// }
|
|
|
+func initAct33() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ condition += ` AND chart_permission_id = 62 AND activity_time > '2025-01-01' AND activity_time < '2025-02-13' AND publish_status = 1 AND active_state = 3 ORDER BY activity_time DESC `
|
|
|
+ list, err := cygx.GetActivityListAll(condition, pars, 0, 9999)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var activityIds []int
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ activityIds = append(activityIds, v.ActivityId)
|
|
|
+ }
|
|
|
+
|
|
|
+ condition = ""
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+
|
|
|
+ condition += ` AND activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `) AND ( is_meeting = 1 OR duration != "" ) `
|
|
|
+ pars = append(pars, activityIds)
|
|
|
+
|
|
|
+ signUpDetailList, err := cygx.GetSignupDetailList(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapUserNum := make(map[int]int)
|
|
|
+ for _, v := range signUpDetailList {
|
|
|
+ mapUserNum[v.ActivityId]++
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println("list", len(list))
|
|
|
+
|
|
|
+ //创建excel
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+
|
|
|
+ redStyle := xlsx.NewStyle()
|
|
|
+ redStyle.Alignment = alignment
|
|
|
+ redStyle.ApplyAlignment = true
|
|
|
+ redStyle.Font.Color = "ff0000"
|
|
|
+ //定义底色需要标黄的 单元格颜色
|
|
|
+ redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
|
|
|
+ redStyle.Fill = redFill
|
|
|
+ //redStyle.Border = *border
|
|
|
+
|
|
|
+ var sheetName string
|
|
|
+ sheetName = "活动数据"
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "活动名称"
|
|
|
+
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
+ cellPd.Value = "活动类型"
|
|
|
+ //cellA := rowTitle.AddCell()
|
|
|
+ //cellA.Value = "系列"
|
|
|
+
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
+ cellAt.Value = "活动时间"
|
|
|
+
|
|
|
+ cellUser := rowTitle.AddCell()
|
|
|
+ cellUser.Value = "参会人数"
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+
|
|
|
+ row := sheet.AddRow()
|
|
|
+
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.ActivityName
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+
|
|
|
+ cellADataPd.Value = v.ActivityTypeName
|
|
|
+
|
|
|
+ //cellAData := row.AddCell()
|
|
|
+ //cellAData.Value = v.SubCategoryName
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = v.ActivityTime
|
|
|
+
|
|
|
+ cellUserData := row.AddCell()
|
|
|
+ cellUserData.Value = strconv.Itoa(mapUserNum[v.ActivityId])
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func initart33() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND re.chart_permission_id = 62 AND art.publish_date > '2025-01-01' AND art.publish_date < '2025-02-13' `
|
|
|
+ //报告匹配类型
|
|
|
+ //9.5 13:52
|
|
|
+ condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC `
|
|
|
+ listart, err := cygx.GetReportArticleList(condition, pars, 0, 2000, 1)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建excel
|
|
|
+ dir, err := os.Executable()
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
+ Horizontal: "center",
|
|
|
+ Vertical: "center",
|
|
|
+ WrapText: true,
|
|
|
+ }
|
|
|
+ style.Alignment = alignment
|
|
|
+ style.ApplyAlignment = true
|
|
|
+
|
|
|
+ redStyle := xlsx.NewStyle()
|
|
|
+ redStyle.Alignment = alignment
|
|
|
+ redStyle.ApplyAlignment = true
|
|
|
+ redStyle.Font.Color = "ff0000"
|
|
|
+ //定义底色需要标黄的 单元格颜色
|
|
|
+ redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
|
|
|
+ redStyle.Fill = redFill
|
|
|
+ //redStyle.Border = *border
|
|
|
+
|
|
|
+ var sheetName string
|
|
|
+ sheetName = "PV"
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
+ cellAt.Value = "报告名称 "
|
|
|
+
|
|
|
+ cellTYpet := rowTitle.AddCell()
|
|
|
+ cellTYpet.Value = "报告类型"
|
|
|
+
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
+ cellPd.Value = "发布时间"
|
|
|
+
|
|
|
+ cellTPv := rowTitle.AddCell()
|
|
|
+ cellTPv.Value = "Pv"
|
|
|
+
|
|
|
+ cellTUv := rowTitle.AddCell()
|
|
|
+ cellTUv.Value = "Uv"
|
|
|
+
|
|
|
+ var articleIds []string
|
|
|
+
|
|
|
+ for _, v := range listart {
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(articleIds) > 0 {
|
|
|
+ condition = ` AND art.article_id IN (` + strings.Join(articleIds, ",") + `) `
|
|
|
+ listPv, err := cygx.GetReportArticleListPvUv(condition)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(listPv) > 0 {
|
|
|
+ for _, pv := range listPv {
|
|
|
+ for k, v := range listart {
|
|
|
+ if v.ArticleId == pv.ArticleId {
|
|
|
+ listart[k].Pv = pv.Pv
|
|
|
+ listart[k].Uv = pv.Uv
|
|
|
+ listart[k].ClPv = pv.ClPv
|
|
|
+ listart[k].ClUv = pv.ClUv
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, item := range listart {
|
|
|
+ row := sheet.AddRow()
|
|
|
+
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = item.Title
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = item.MatchTypeName
|
|
|
+
|
|
|
+ cellPublishDate := row.AddCell()
|
|
|
+ cellPublishDate.Value = item.PublishDate
|
|
|
+
|
|
|
+ cellPvata := row.AddCell()
|
|
|
+ cellPvata.Value = strconv.Itoa(item.Pv + item.ClPv)
|
|
|
+
|
|
|
+ cellUvata := row.AddCell()
|
|
|
+ cellUvata.Value = strconv.Itoa(item.Uv + item.ClUv)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|