|
@@ -158,7 +158,7 @@ func HandleYongyiExcelWeekly12(f *excelize.File, sheetName string) (indexList []
|
|
|
} else if i == 1 {
|
|
|
for k, text := range row {
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
- if k > 1 && text != "" {
|
|
|
+ if text != "" {
|
|
|
text = strings.TrimSpace(text)
|
|
|
yearMap[k] = text
|
|
|
}
|
|
@@ -280,10 +280,18 @@ func HandleYongyiExcelWeekly13(f *excelize.File, sheetName string) (indexList []
|
|
|
|
|
|
text = strings.TrimSpace(text)
|
|
|
var dateT time.Time
|
|
|
- dateT, e = time.ParseInLocation("2006年1月2日", text, time.Local)
|
|
|
- if e != nil {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
|
|
|
- continue
|
|
|
+ if dateFloat, e := strconv.ParseFloat(text, 64); e == nil {
|
|
|
+ dateT, e = excelize.ExcelDateToTime(dateFloat, false)
|
|
|
+ if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dateT, e = time.ParseInLocation("2006年1月2日", text, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
date = dateT.Format(utils.FormatDate)
|
|
|
dateMap[i] = date
|
|
@@ -566,7 +574,7 @@ func HandleYongyiExcelWeekly15(f *excelize.File, sheetName string) (indexList []
|
|
|
province := ""
|
|
|
for k, text := range row {
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
- if k == 0 {
|
|
|
+ if k == 0 || k == 2 || k == 3 {
|
|
|
continue
|
|
|
} else if k == 1 {
|
|
|
province = strings.TrimSpace(text)
|
|
@@ -682,7 +690,7 @@ func HandleYongyiExcelWeekly16(f *excelize.File, sheetName string) (indexList []
|
|
|
date := ""
|
|
|
for k, text := range row {
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
- if k == 0 {
|
|
|
+ if k == 0 || k == 2 {
|
|
|
continue
|
|
|
} else if k == 1 {
|
|
|
text = strings.TrimSpace(text)
|
|
@@ -795,7 +803,7 @@ func HandleYongyiExcelWeekly17(f *excelize.File, sheetName string) (indexList []
|
|
|
namePrefix = "断奶仔猪对应育肥至标猪出栏成本"
|
|
|
namePrefixPingin = "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
continue
|
|
|
- } else if i == 1 {
|
|
|
+ } else if i == 1 || i == 12 {
|
|
|
|
|
|
for k, text := range row {
|
|
|
if text != "" {
|
|
@@ -1039,9 +1047,12 @@ func HandleYongyiExcelWeekly19(f *excelize.File, sheetName string) (indexList []
|
|
|
text = strings.TrimSpace(text)
|
|
|
if mergeOk {
|
|
|
for j, v := range currentMergeCells {
|
|
|
+ if v == "" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
dateSlice := strings.Split(v, "-")
|
|
|
if len(dateSlice) <= 1 {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败", sheetName, i, k))
|
|
|
continue
|
|
|
}
|
|
|
|
|
@@ -1092,7 +1103,7 @@ func HandleYongyiExcelWeekly19(f *excelize.File, sheetName string) (indexList []
|
|
|
subName := ""
|
|
|
for k, text := range row {
|
|
|
fmt.Printf("当前第%d列 \n", k)
|
|
|
- if k == 0 {
|
|
|
+ if k == 0 || (k >= 5 && k <= 11) {
|
|
|
continue
|
|
|
} else if k == 1 || k == 2 {
|
|
|
text = strings.TrimSpace(text)
|
|
@@ -1129,7 +1140,7 @@ func HandleYongyiExcelWeekly19(f *excelize.File, sheetName string) (indexList []
|
|
|
|
|
|
area, ok2 := areaMap[k]
|
|
|
if !ok2 {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("找不到对应的时间,第%d行,第%d列", i, k))
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("找不到对应的地区,第%d行,第%d列", i, k))
|
|
|
continue
|
|
|
}
|
|
|
area = strings.Replace(area, "本周", "", 1)
|