Explorar el Código

Merge branch 'hotfix/custom_balance_table' of eta_server/eta_mobile into custom

xyxie hace 8 meses
padre
commit
f98900d420
Se han modificado 1 ficheros con 19 adiciones y 14 borrados
  1. 19 14
      services/data/excel/balance_table.go

+ 19 - 14
services/data/excel/balance_table.go

@@ -48,7 +48,7 @@ func GetBalanceExcelData(excelDetail *excelModel.ExcelInfo, lang string) (newDat
 	return
 }
 
-// 将表格信息转化成指标数据
+// GetBalanceExcelEdbData 将表格信息转化成指标数据
 func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMixedTableCellDataListMap map[int]map[int]request.MixedTableCellDataReq, dataListMap map[int][]*data_manage.EdbDataList, allRows, allCols int) (err error, errMsg string) {
 	var dateList, dataList []string
 	// 日期序列
@@ -96,8 +96,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 			}
 
 			// 长度固定,避免一直申请内存空间
-			dateList = make([]string, endColumn-startColumn+1)
-
+			//dateList = make([]string, endColumn-startColumn+1)
+			dateList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
 				currCell, ok := newMixedTableCellDataListMap[startNum][currColumn]
@@ -106,7 +106,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				dateList[i] = currCell.ShowValue
+				dateList = append(dateList, currCell.ShowValue)
+				//dateList[i] = currCell.ShowValue
 				i++
 			}
 
@@ -130,7 +131,9 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 				endNum = maxRow - 1
 			}
 			// 长度固定,避免一直申请内存空间
-			dateList = make([]string, endNum-startNum+1)
+			//dateList = make([]string, endNum-startNum+1)
+			fmt.Println("startNum:", startNum, "endNum:", endNum)
+			dateList = make([]string, 0)
 			i := 0
 			for currRow := startNum; currRow <= endNum; currRow++ {
 				currCell, ok := newMixedTableCellDataListMap[currRow][startColumn]
@@ -139,8 +142,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				//dateList = append(dateList, currCell.Value)
-				dateList[i] = currCell.ShowValue
+				dateList = append(dateList, currCell.Value)
+				//dateList[i] = currCell.ShowValue
 				i++
 			}
 		}
@@ -189,7 +192,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 				endColumn = maxCol - 1
 			}
 			// 长度固定,避免一直申请内存空间
-			dataList = make([]string, endColumn-startColumn+1)
+			//dataList = make([]string, endColumn-startColumn+1)
+			dataList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
 				currCell, ok := newMixedTableCellDataListMap[startNum][currColumn]
@@ -198,8 +202,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				//dataList = append(dataList, currCell.Value)
-				dataList[i] = currCell.ShowValue
+				dataList = append(dataList, currCell.Value)
+				//dataList[i] = currCell.ShowValue
 				i++
 			}
 
@@ -224,7 +228,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 			}
 
 			// 长度固定,避免一直申请内存空间
-			dataList = make([]string, endNum-startNum+1)
+			//dataList = make([]string, endNum-startNum+1)
+			dataList = make([]string, 0)
 			i := 0
 			for currRow := startNum; currRow <= endNum; currRow++ {
 				currCell, ok := newMixedTableCellDataListMap[currRow][startColumn]
@@ -233,8 +238,8 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				//dataList = append(dataList, currCell.Value)
-				dataList[i] = currCell.ShowValue
+				dataList = append(dataList, currCell.Value)
+				//dataList[i] = currCell.ShowValue
 				i++
 			}
 		}
@@ -272,7 +277,7 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 		// todo 处理DataTimestamp
 		dataTime, e := time.ParseInLocation(utils.FormatDate, v, time.Local)
 		if e != nil {
-			err = errors.New("time.Parse Err:" + err.Error())
+			err = errors.New("time.Parse Err:" + e.Error())
 			return
 		}
 		timestamp := dataTime.UnixNano() / 1e6