tuoling805 1 年之前
父节点
当前提交
e8ea8e4450
共有 1 个文件被更改,包括 22 次插入2 次删除
  1. 22 2
      services/init_base_index.go

+ 22 - 2
services/init_base_index.go

@@ -8,6 +8,7 @@ import (
 	"hongze/hz_eta_data/utils"
 	"os"
 	"path/filepath"
+	"strings"
 )
 
 // 初始化基础指标数据
@@ -48,6 +49,9 @@ func InitBaseIndexData() {
 	}
 	fmt.Println("rows len:", len(rows))
 	for rk, row := range rows {
+		if rk > 4 {
+			return
+		}
 		if rk > 0 {
 			var classifyFirst, classifySecond, classifyThree, indexCode, indexName, frequency, unit, source string
 			for ck, colCell := range row {
@@ -168,10 +172,26 @@ func InitBaseIndexData() {
 				}
 
 				if indexResp.Ret != 200 {
-					utils.FileLog.Info("初始化指标失败:" + indexResp.Msg + ";" + indexResp.ErrMsg)
-					return
+					if strings.Contains(indexResp.Msg, "新增指标失败") {
+						continue
+					} else {
+						fmt.Println("初始化指标失败:" + indexResp.Msg + ";" + indexResp.ErrMsg)
+						utils.FileLog.Info("初始化指标失败:" + indexResp.Msg + ";" + indexResp.ErrMsg)
+						return
+					}
 				}
 				fmt.Println("add index success:" + indexCode)
+
+				////刷新指标
+				//var method string
+				//if source == "wind" {
+				//	method = "wind/refresh"
+				//}
+				//refreshMap := make(map[string]interface{})
+				//refreshMap["EdbInfoId"] = ""
+				//refreshMap["EdbCode"] = indexCode
+				//refreshMap["StartDate"] = "1990-01-01"
+
 			} else {
 				fmt.Println("data is empty")
 				fmt.Println(classifyFirst, classifySecond, classifyThree, indexCode, indexName, frequency, unit, source)