zhangchuanxing vor 1 Tag
Ursprung
Commit
6d77690a66
1 geänderte Dateien mit 99 neuen und 8 gelöschten Zeilen
  1. 99 8
      controllers/cygx/report_article.go

+ 99 - 8
controllers/cygx/report_article.go

@@ -1985,9 +1985,9 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
 	br.IsAddLog = true
 }
 
-func init() {
-	initart()
-}
+//func init() {
+//	initart()
+//}
 
 func initart() {
 	//行业
@@ -3760,7 +3760,7 @@ func initRsListinit() {
 }
 
 //func init() {
-//	initart22()
+//	initAct22()
 //}
 
 func initYaxuan() {
@@ -3931,14 +3931,14 @@ func initart22() {
 	//标头
 	rowTitle := sheet.AddRow()
 	cellAt := rowTitle.AddCell()
-	cellAt.Value = " 报告名称 "
+	cellAt.Value = " 发布时间  "
 
 	cellPd := rowTitle.AddCell()
 	cellPd.Value = "行业"
 	//cellA := rowTitle.AddCell()
 	//cellA.Value = "系列"
 	cellB := rowTitle.AddCell()
-	cellB.Value = "发布时间"
+	cellB.Value = "报告名称"
 
 	for _, v := range list {
 
@@ -3948,7 +3948,7 @@ func initart22() {
 		row := sheet.AddRow()
 
 		cellADatatitle := row.AddCell()
-		cellADatatitle.Value = v.Title
+		cellADatatitle.Value = v.PublishDate
 
 		cellADataPd := row.AddCell()
 
@@ -3962,7 +3962,98 @@ func initart22() {
 		//cellAData.Value = v.SubCategoryName
 
 		cellBData := row.AddCell()
-		cellBData.Value = v.PublishDate
+		cellBData.Value = v.Title
+
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+}
+
+func initAct22() {
+	//行业
+	var condition string
+	var pars []interface{}
+
+	condition += ` AND  chart_permission_id != 31 AND activity_time > '2024-10-01' 	AND activity_time < '2024-12-24'   AND  publish_status = 1   ORDER BY   activity_time  DESC   `
+	//fmt.Println(condition)
+	list, err := cygx.GetActivityListAll(condition, pars, 0, 9999)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	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()
+	cellAt := rowTitle.AddCell()
+	cellAt.Value = " 活动时间  "
+
+	cellPd := rowTitle.AddCell()
+	cellPd.Value = "行业"
+	//cellA := rowTitle.AddCell()
+	//cellA.Value = "系列"
+	cellB := rowTitle.AddCell()
+	cellB.Value = " 活动名称"
+
+	for _, v := range list {
+
+		//if v.SubCategoryName != "行业深度" {
+		//	continue
+		//}
+		row := sheet.AddRow()
+
+		cellADatatitle := row.AddCell()
+		cellADatatitle.Value = v.ActivityTime
+
+		cellADataPd := row.AddCell()
+
+		cellADataPd.Value = v.ChartPermissionName
+
+		//cellAData := row.AddCell()
+		//cellAData.Value = v.SubCategoryName
+
+		cellBData := row.AddCell()
+		cellBData.Value = v.ActivityName
 
 	}