|
@@ -4,7 +4,7 @@ import (
|
|
|
"eta/eta_data_analysis/models"
|
|
|
"eta/eta_data_analysis/utils"
|
|
|
"fmt"
|
|
|
- "github.com/tealeg/xlsx"
|
|
|
+ "github.com/tealeg/xlsx/v3"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -56,6 +56,7 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
areaMap := make(map[int]string)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -63,10 +64,15 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 { // 首行,表示时间
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if k > 1 && text != "" {
|
|
|
// 检查单元格是否为合并单元格
|
|
@@ -83,19 +89,19 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -190,6 +196,7 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
areaMap := make(map[int]string)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -197,10 +204,15 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 { // 首行,表示时间
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if k > 2 && text != "" {
|
|
|
// 检查单元格是否为合并单元格
|
|
@@ -217,20 +229,20 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
name := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -331,6 +343,7 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -338,13 +351,18 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i < 2 {
|
|
|
continue
|
|
|
}
|
|
|
if i == 2 { // 首行,表示时间
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if k > 2 && text != "" {
|
|
|
// 检查单元格是否为合并单元格
|
|
@@ -355,19 +373,19 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
} else if i == 3 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -456,6 +474,7 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -463,24 +482,29 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 {
|
|
|
continue
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
name := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -591,6 +615,7 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -598,10 +623,15 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 {
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if k > 1 && text != "" {
|
|
|
if cell.VMerge > 0 {
|
|
@@ -612,19 +642,19 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
continue
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -719,6 +749,7 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -726,23 +757,28 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 {
|
|
|
continue
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
areaMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -827,6 +863,7 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
provinceMap := make(map[int]string)
|
|
|
firstMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -834,11 +871,16 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 {
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
firstMap[k] = text
|
|
@@ -847,19 +889,19 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
continue
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
provinceMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -958,6 +1000,7 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -965,23 +1008,28 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i <= 2 {
|
|
|
continue
|
|
|
} else if i == 3 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
areaMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -1073,6 +1121,7 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -1080,23 +1129,28 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i <= 1 {
|
|
|
continue
|
|
|
} else if i == 2 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
areaMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|
|
@@ -1184,6 +1238,7 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ maxCell := sheet.MaxCol
|
|
|
sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
@@ -1191,23 +1246,28 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
indexMap := make(map[string]*models.YongyiExcelIndex)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
fmt.Printf("当前第%d行 \n", i)
|
|
|
+ row, e := sheet.Row(i)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("读取行失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if i == 0 {
|
|
|
continue
|
|
|
} else if i == 1 { //表示表头
|
|
|
// 处理 index指标表
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- for k, cell := range cells {
|
|
|
+
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
text := cell.String()
|
|
|
if text != "" {
|
|
|
areaMap[k] = text
|
|
|
}
|
|
|
}
|
|
|
} else { //数据列
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
+
|
|
|
date := ""
|
|
|
- for k, cell := range cells {
|
|
|
+ for k := 0; k < maxCell; k++ {
|
|
|
+ cell := row.GetCell(k)
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
text := cell.String()
|
|
|
if k == 0 {
|