|
@@ -3760,7 +3760,7 @@ func initRsListinit() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initYaxuan()
|
|
|
+// initart22()
|
|
|
//}
|
|
|
|
|
|
func initYaxuan() {
|
|
@@ -3862,3 +3862,104 @@ func initYaxuan() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func initart22() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ condition += ` AND art.is_class = 1 `
|
|
|
+ condition += ` AND art.publish_date >= '2024-01-01' AND art.file_link != '' `
|
|
|
+
|
|
|
+ //return
|
|
|
+ condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC `
|
|
|
+ //fmt.Println(condition)
|
|
|
+ list, err := cygx.GetReportArticleList(condition, pars, 0, 999, 1)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println("list", len(list))
|
|
|
+
|
|
|
+ //return
|
|
|
+ reportMap := make(map[int]string)
|
|
|
+ listMap, err := cygx.GetReportMapping()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listMap {
|
|
|
+ reportMap[v.CategoryId] = v.MatchTypeName
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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 {
|
|
|
+ row := sheet.AddRow()
|
|
|
+
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.Title
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = v.ChartPermissionName
|
|
|
+
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = v.SubCategoryName
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = v.PublishDate
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|