|
@@ -24,12 +24,12 @@ func init() {
|
|
|
}
|
|
|
YongyiWeeklySheetMap6 = map[string]*models.YongyiSheet{
|
|
|
"周度-冻品库存多样本": {"冻品库存多样本", "周度-冻品库存多样本", "周度", "%"},
|
|
|
- "月度出栏完成率": {"", "月度出栏完成率", "旬度", "%"},
|
|
|
+ "月度出栏完成率": {"出栏完成率", "月度出栏完成率", "旬度", "%"},
|
|
|
}
|
|
|
YongyiWeeklySheetMap9 = map[string]*models.YongyiSheet{
|
|
|
- "月度-小猪存栏(2020年5月新增)": {"商品猪出栏价", "月度-小猪存栏(2020年5月新增)", "月度", "元/公斤"},
|
|
|
- "月度-中猪存栏(2020年5月新增)": {"", "月度-中猪存栏(2020年5月新增)", "月度", "元/公斤"},
|
|
|
- "月度-大猪存栏(2020年5月新增)": {"", "月度-大猪存栏(2020年5月新增)", "月度", "元/公斤"},
|
|
|
+ "月度-小猪存栏(2020年5月新增)": {"50kg以下小猪存栏量", "月度-小猪存栏(2020年5月新增)", "月度", "头"},
|
|
|
+ "月度-中猪存栏(2020年5月新增)": {"中猪存栏量", "月度-中猪存栏(2020年5月新增)", "月度", "头"},
|
|
|
+ "月度-大猪存栏(2020年5月新增)": {"大猪存栏量", "月度-大猪存栏(2020年5月新增)", "月度", "头"},
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -47,13 +47,14 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
frequency := "周度"
|
|
|
unit := "元/公斤"
|
|
|
namePrefix := "商品猪出栏价"
|
|
|
- namePrefixPingin := "yyzxspzclj"
|
|
|
+ namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -101,16 +102,22 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
|
fmt.Println(date)
|
|
|
continue
|
|
|
} else {
|
|
|
- // 判断出不是字符的,则过滤
|
|
|
+ if text == "" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if strings.Contains(text, "%") {
|
|
|
+ text = strings.Replace(text, "%", "", 1)
|
|
|
+ }
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -146,9 +153,10 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("indexItem%s", indexItem.IndexCode)
|
|
|
|
|
@@ -170,13 +178,14 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
frequency := "周度"
|
|
|
unit := "公斤"
|
|
|
namePrefix := "商品猪出栏体重"
|
|
|
- namePrefixPingin := "yyzxspzcltz"
|
|
|
+ namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -225,8 +234,8 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
|
fmt.Println(date)
|
|
@@ -244,6 +253,7 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -282,10 +292,10 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- // todo 排序
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("indexItem%s", indexItem.IndexCode)
|
|
|
|
|
@@ -307,12 +317,13 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
frequency := "周度"
|
|
|
unit := "公斤"
|
|
|
namePrefix := "商品猪宰前活猪重"
|
|
|
- namePrefixPingin := "yyzxspzzqhzz"
|
|
|
+ namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -357,6 +368,7 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
@@ -374,6 +386,7 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -402,9 +415,10 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("indexItem%s", indexItem.IndexCode)
|
|
|
|
|
@@ -431,6 +445,7 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -463,8 +478,8 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
|
fmt.Println(date)
|
|
@@ -482,8 +497,12 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
if text == "" {
|
|
|
continue
|
|
|
}
|
|
|
+ if strings.Contains(text, "%") {
|
|
|
+ text = strings.Replace(text, "%", "", 1)
|
|
|
+ }
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -512,10 +531,10 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- // todo 排序
|
|
|
- //indexItem.Sort = i*1000 + k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s", indexItem.IndexCode)
|
|
|
|
|
@@ -558,6 +577,7 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -599,8 +619,8 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
|
fmt.Println(date)
|
|
@@ -610,8 +630,12 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
if text == "" {
|
|
|
continue
|
|
|
}
|
|
|
+ if strings.Contains(text, "%") {
|
|
|
+ text = strings.Replace(text, "%", "", 1)
|
|
|
+ }
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -638,9 +662,10 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s", indexItem.IndexCode)
|
|
|
|
|
@@ -677,6 +702,7 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -706,8 +732,8 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecord{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
date = r.Date.Format(utils.FormatDate)
|
|
|
fmt.Println(date)
|
|
@@ -717,8 +743,12 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
if text == "" {
|
|
|
continue
|
|
|
}
|
|
|
+ if strings.Contains(text, "%") {
|
|
|
+ text = strings.Replace(text, "%", "", 1)
|
|
|
+ }
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -732,6 +762,9 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
// 处理指标名称
|
|
|
fullIndexName := fmt.Sprintf("%s/%s", namePrefix, area)
|
|
|
areaPingyin := utils.GetFirstPingYin(area)
|
|
|
+ if sheet.Name == "月度出栏完成率" {
|
|
|
+ areaPingyin = utils.GetFullPingYin(area)
|
|
|
+ }
|
|
|
fullIndexNamePingyin := namePrefixPingin + areaPingyin
|
|
|
|
|
|
indexItem, okIndex := indexMap[fullIndexName]
|
|
@@ -742,9 +775,10 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s", indexItem.IndexCode)
|
|
|
|
|
@@ -766,13 +800,14 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
frequency := "月度"
|
|
|
unit := "%"
|
|
|
namePrefix := "月度计划出栏量环比"
|
|
|
- namePrefixPingin := "yyzxydjhcllhb"
|
|
|
+ namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
provinceMap := make(map[int]string)
|
|
|
firstMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -811,8 +846,8 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecordFirst{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
// 查询当月的最后一天
|
|
|
monthDate := r.Date.Format(utils.FormatYearMonthDate)
|
|
@@ -831,6 +866,7 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -868,9 +904,10 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s\n", indexItem.IndexCode)
|
|
|
|
|
@@ -892,12 +929,13 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
frequency := "月度"
|
|
|
unit := "头"
|
|
|
namePrefix := "能繁母猪存栏量"
|
|
|
- namePrefixPingin := "yyzxnfmzcll"
|
|
|
+ namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -927,8 +965,8 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecordFirst{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("读取行,时间列失败 Err:%s", e))
|
|
|
- break
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
// 查询当月的最后一天
|
|
|
monthDate := r.Date.Format(utils.FormatYearMonthDate)
|
|
@@ -947,6 +985,7 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -973,9 +1012,10 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s\n", indexItem.IndexCode)
|
|
|
|
|
@@ -1003,16 +1043,11 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
namePrefix := info.NamePrefix
|
|
|
namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)
|
|
|
|
|
|
- /*classifyName := "月度-小猪存栏(2020年5月新增)"
|
|
|
- frequency := "月度"
|
|
|
- unit := "头"
|
|
|
- namePrefix := "50kg以下小猪存栏量"
|
|
|
- namePrefixPingin := "yyzx" + utils.GetFirstPingYin(namePrefix)*/
|
|
|
-
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -1042,8 +1077,8 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecordFirst{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
// 查询当月的最后一天
|
|
|
monthDate := r.Date.Format(utils.FormatYearMonthDate)
|
|
@@ -1062,6 +1097,7 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -1088,9 +1124,10 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s\n", indexItem.IndexCode)
|
|
|
|
|
@@ -1118,6 +1155,7 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
areaMap := make(map[int]string)
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ sort := 0
|
|
|
fmt.Println("最大行")
|
|
|
fmt.Println(maxRow)
|
|
|
// 指标名称
|
|
@@ -1147,8 +1185,8 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
tmpRow := row
|
|
|
r := &ExcelDateRecordFirst{}
|
|
|
if e := tmpRow.ReadStruct(r); e != nil {
|
|
|
- err = fmt.Errorf("读取行,时间列失败 Err:%s", e)
|
|
|
- return
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheet.Name, i, k, e))
|
|
|
+ continue
|
|
|
}
|
|
|
// 查询当月的最后一天
|
|
|
monthDate := r.Date.Format(utils.FormatYearMonthDate)
|
|
@@ -1167,6 +1205,7 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
}
|
|
|
_, e := strconv.ParseFloat(text, 64)
|
|
|
if e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheet.Name, i, k, e))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -1193,9 +1232,10 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
- indexItem.Sort = k
|
|
|
+ indexItem.Sort = sort
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
|
+ sort++
|
|
|
}
|
|
|
fmt.Printf("IndexCode: %s\n", indexItem.IndexCode)
|
|
|
|