|
@@ -16,9 +16,9 @@ var yongyiSpecialUnitMap map[string]string
|
|
|
|
|
|
func init() {
|
|
|
yongyiSheetMap = map[string]*models.YongyiSheet{
|
|
|
- "出栏价": {"商品猪出栏价", "日度-商品猪出栏价", "日度", "元/公斤"},
|
|
|
- "标肥价差": {"", "日度-商品猪标肥价差", "日度", "元/公斤"},
|
|
|
- "价格+宰量": {"", "", "日度", "元/公斤"},
|
|
|
+ "出栏价": {"商品猪出栏价", "日度-商品猪出栏价", "日度", "元/公斤"},
|
|
|
+ "标肥价差": {"", "日度-商品猪标肥价差", "日度", "元/公斤"},
|
|
|
+ "价格+宰量": {"", "", "日度", "元/公斤"},
|
|
|
"屠宰企业日度屠宰量": {"商品猪日屠宰量", "日度-屠宰企业屠宰量", "日度", "头/日"},
|
|
|
}
|
|
|
yongyiNotAddMap = map[string][]string{"出栏价": {"商品猪出栏价/全国/均价"}, "屠宰企业日度屠宰量": {"商品猪日屠宰量/合计(单位:头)"}}
|
|
@@ -32,7 +32,7 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
frequency := "日度"
|
|
|
unit := "元/公斤"
|
|
|
namePrefix := "商品猪出栏价"
|
|
|
-
|
|
|
+ namePrefixPingin := "yyzxspzclj"
|
|
|
//sheet := dailyPriceSheet
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
@@ -112,13 +112,16 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
|
|
|
indexItem, okIndex := indexMap[fullIndexName]
|
|
|
|
|
|
+ provincePingyin := utils.GetFullPingYin(province)
|
|
|
+ namePingin := utils.GetFirstPingYin(name)
|
|
|
+ fullIndexNamePingyin := fmt.Sprintf("%s%s%s", namePrefixPingin, provincePingyin, namePingin)
|
|
|
+
|
|
|
if !okIndex {
|
|
|
// 新增指标
|
|
|
indexItem = new(models.YongyiExcelIndex)
|
|
|
indexItem.IndexName = fullIndexName
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
- // todo 处理indexCode
|
|
|
- indexItem.IndexCode = fullIndexName
|
|
|
+ indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
@@ -134,7 +137,6 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
for _, v := range indexMap {
|
|
|
indexList = append(indexList, v)
|
|
|
}
|
|
|
- // todo 整理请求入参,并加入,改成一个指标请求一次还是多个指标请求一次
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -143,7 +145,7 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
classifyName := "日度-商品猪标肥价差"
|
|
|
frequency := "日度"
|
|
|
unit := "元/公斤"
|
|
|
-
|
|
|
+ pingYinPrefix := "yyzx"
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
dateMap := make(map[int]string)
|
|
@@ -214,22 +216,28 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
// 只处理以上三个类型,其余过滤
|
|
|
continue
|
|
|
}
|
|
|
+ var namePrefixPingin string
|
|
|
if name == "150公斤左右较标猪" {
|
|
|
name = "150公斤较标猪价差"
|
|
|
+ namePrefixPingin = "150gjjbzjc"
|
|
|
} else if name == "175公斤左右较标猪" {
|
|
|
name = "175公斤较标猪价差"
|
|
|
+ namePrefixPingin = "175gjjbzjc"
|
|
|
+ } else if name == "市场标重猪价" {
|
|
|
+ namePrefixPingin = "scbzzj"
|
|
|
}
|
|
|
fullIndexName := fmt.Sprintf("%s/%s", name, province)
|
|
|
-
|
|
|
indexItem, okIndex := indexMap[fullIndexName]
|
|
|
|
|
|
+ provincePingyin := utils.GetFullPingYin(province)
|
|
|
+ fullIndexNamePingyin := fmt.Sprintf("%s%s%s", pingYinPrefix, namePrefixPingin, provincePingyin)
|
|
|
+
|
|
|
if !okIndex {
|
|
|
// 新增指标
|
|
|
indexItem = new(models.YongyiExcelIndex)
|
|
|
indexItem.IndexName = fullIndexName
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
- // todo 处理indexCode
|
|
|
- indexItem.IndexCode = fullIndexName
|
|
|
+ indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
@@ -245,7 +253,6 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
for _, v := range indexMap {
|
|
|
indexList = append(indexList, v)
|
|
|
}
|
|
|
- // todo 整理请求入参,并加入,改成一个指标请求一次还是多个指标请求一次
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -254,7 +261,6 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
classifyName := "日度-商品猪全国均价和宰量"
|
|
|
frequency := "日度"
|
|
|
unit := ""
|
|
|
-
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
nameMap := make(map[int]string)
|
|
@@ -297,15 +303,17 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
// 只处理以上三个类型,其余过滤
|
|
|
continue
|
|
|
}
|
|
|
+ var fullIndexNamePingyin string
|
|
|
if name == "全国均价" {
|
|
|
name = "商品猪出拦价/全国/均价"
|
|
|
+ fullIndexNamePingyin = "yyzxspzcljquanguojj"
|
|
|
unit = "元/公斤"
|
|
|
} else if name == "日屠宰量" {
|
|
|
name = "商品猪日屠宰量/全国"
|
|
|
+ fullIndexNamePingyin = "yyzxspzrtzlquanguo"
|
|
|
unit = "头/日"
|
|
|
}
|
|
|
fullIndexName := name
|
|
|
-
|
|
|
indexItem, okIndex := indexMap[fullIndexName]
|
|
|
|
|
|
if !okIndex {
|
|
@@ -313,8 +321,7 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
indexItem = new(models.YongyiExcelIndex)
|
|
|
indexItem.IndexName = fullIndexName
|
|
|
indexItem.ClassifyName = classifyName
|
|
|
- // todo 处理indexCode
|
|
|
- indexItem.IndexCode = fullIndexName
|
|
|
+ indexItem.IndexCode = fullIndexNamePingyin
|
|
|
indexItem.Frequency = frequency
|
|
|
indexItem.Unit = unit
|
|
|
indexItem.ExcelDataMap = make(map[string]string)
|
|
@@ -329,7 +336,6 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
for _, v := range indexMap {
|
|
|
indexList = append(indexList, v)
|
|
|
}
|
|
|
- // todo 整理请求入参,并加入,改成一个指标请求一次还是多个指标请求一次
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -339,7 +345,8 @@ func HandleYongyiExcelDaily4(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
frequency := "日度"
|
|
|
unit := "头/日"
|
|
|
namePrefix := "商品猪日屠宰量"
|
|
|
- namePrefixPingin := utils.GetFirstPingYin(namePrefix)
|
|
|
+ pingYinPrefix := "yyzx"
|
|
|
+ namePrefixPingin := "spzrtzl"
|
|
|
// 遍历行读取
|
|
|
indexList = make([]*models.YongyiExcelIndex, 0)
|
|
|
dateMap := make(map[int]string)
|
|
@@ -399,7 +406,8 @@ func HandleYongyiExcelDaily4(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
|
|
|
fullIndexName := fmt.Sprintf("%s/%s", namePrefix, province)
|
|
|
|
|
|
provincePingyin := utils.GetFullPingYin(province)
|
|
|
- fullIndexNamePingyin := fmt.Sprintf("%s/%s", namePrefixPingin, provincePingyin)
|
|
|
+ fullIndexNamePingyin := fmt.Sprintf("%s%s%s", pingYinPrefix, namePrefixPingin, provincePingyin)
|
|
|
+
|
|
|
indexItem, okIndex := indexMap[fullIndexName]
|
|
|
|
|
|
if !okIndex {
|