|
@@ -159,8 +159,8 @@ type EtaBridgeGnIndexListResp struct {
|
|
|
// IndexListResp
|
|
|
// @Description: 指标列表数据
|
|
|
type IndexListResp struct {
|
|
|
- Paging paging.PagingItem `description:"分页数据"`
|
|
|
- List []IndexInfo
|
|
|
+ Page paging.PagingItem `description:"分页数据"`
|
|
|
+ List []IndexInfo
|
|
|
}
|
|
|
|
|
|
// IndexInfo
|
|
@@ -175,6 +175,7 @@ type IndexInfo struct {
|
|
|
Frequency string `description:"频度"`
|
|
|
Unit string `description:"单位"`
|
|
|
SourceName string `description:"来源"`
|
|
|
+ SourceCode string `description:"来源编码"`
|
|
|
}
|
|
|
|
|
|
// BridgeGnIndexParams
|
|
@@ -232,9 +233,9 @@ func syncGnIndex(currIndex, pageSize int, baseLastUpdateTimeStr string) (err err
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fmt.Println(currIndex, "是否已结束:", result.Data.Paging.IsEnd)
|
|
|
+ fmt.Println(currIndex, "是否已结束:", result.Data.Page.IsEnd)
|
|
|
// 如果还有下一页,那么就继续请求下一页
|
|
|
- if !result.Data.Paging.IsEnd {
|
|
|
+ if !result.Data.Page.IsEnd {
|
|
|
_, tmpErrMsgList := syncGnIndex(currIndex+1, utils.SyncCrmIndexNum, baseLastUpdateTimeStr)
|
|
|
errMsgList = append(errMsgList, tmpErrMsgList...)
|
|
|
}
|
|
@@ -499,13 +500,13 @@ func handleEdbInfo(index IndexInfo, thirdClassifyId int64) (err error) {
|
|
|
edbInfo, ok := CurrEdbInfoMap[index.DataIndexCode]
|
|
|
frequency := Frequency(strings.TrimSpace(index.Frequency))
|
|
|
unit := strings.TrimSpace(index.Unit)
|
|
|
- sourceName, sourceId, err := GetSource(strings.TrimSpace(index.SourceName))
|
|
|
+ sourceName, sourceId, err := GetSource(strings.TrimSpace(index.SourceName), strings.TrimSpace(index.SourceCode))
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if !ok {
|
|
|
- endDate := time.Date(1900, 1, 1, 0, 0, 0, 0, time.Local)
|
|
|
+ endDate := time.Date(1899, 1, 1, 0, 0, 0, 0, time.Local)
|
|
|
|
|
|
timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
|
|
|
|
|
@@ -628,9 +629,10 @@ func Frequency(unit string) string {
|
|
|
// @Description: 获取来源
|
|
|
// @param sourceName
|
|
|
// @return gnSourceName
|
|
|
+// @return sourceCode
|
|
|
// @return source
|
|
|
// @return err
|
|
|
-func GetSource(sourceName string) (gnSourceName string, source int, err error) {
|
|
|
+func GetSource(sourceName, sourceCode string) (gnSourceName string, source int, err error) {
|
|
|
gnSourceName = sourceName
|
|
|
var tableNameSuffix, indexNamePrefix string
|
|
|
tableNamePrefix := "edb_data_gn_"
|
|
@@ -647,16 +649,19 @@ func GetSource(sourceName string) (gnSourceName string, source int, err error) {
|
|
|
tableNameSuffix = "cci"
|
|
|
//return
|
|
|
default:
|
|
|
- if strings.Contains(sourceName, "国能购销辅助决策系统") {
|
|
|
- gnSourceName = `国能购销辅助决策系统`
|
|
|
- tableNameSuffix = "purchase_sales"
|
|
|
- } else if strings.Contains(sourceName, "国能市场分析平台") {
|
|
|
- gnSourceName = `国能市场分析平台`
|
|
|
- tableNameSuffix = "market_analysis"
|
|
|
- } else {
|
|
|
- // TODO 自动生成表名(暂时以时间作为表名后缀,如果客户提前告知了,那么可以直接先建data表,以及edb_source表写入新的source)
|
|
|
- tableNameSuffix = fmt.Sprint(time.Now().Format(utils.FormatDateTimeUnSpace))
|
|
|
- }
|
|
|
+ // 来源编码前缀把还是
|
|
|
+ tableNameSuffix = strings.ToLower(sourceCode)
|
|
|
+
|
|
|
+ //if strings.Contains(sourceName, "国能购销辅助决策系统") {
|
|
|
+ // gnSourceName = `国能购销辅助决策系统`
|
|
|
+ // tableNameSuffix = "purchase_sales"
|
|
|
+ //} else if strings.Contains(sourceName, "国能市场分析平台") {
|
|
|
+ // gnSourceName = `国能市场分析平台`
|
|
|
+ // tableNameSuffix = "market_analysis"
|
|
|
+ //} else {
|
|
|
+ // // TODO 自动生成表名(暂时以时间作为表名后缀,如果客户提前告知了,那么可以直接先建data表,以及edb_source表写入新的source)
|
|
|
+ // tableNameSuffix = fmt.Sprint(time.Now().Format(utils.FormatDateTimeUnSpace))
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
sourceItem := data_manage.GetEdbSourceBySourceName(gnSourceName)
|
|
@@ -727,7 +732,7 @@ func syncGnIndexV2(currIndex, pageSize int, baseLastUpdateTimeStr string, indexI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fmt.Println(currIndex, "是否已结束:", result.Data.Paging.IsEnd)
|
|
|
+ fmt.Println(currIndex, "是否已结束:", result.Data.Page.IsEnd)
|
|
|
// 如果还有下一页,那么就继续请求下一页
|
|
|
//if !result.Data.Paging.IsEnd {
|
|
|
// _, tmpErrMsgList := syncGnIndex(currIndex+1, utils.SyncCrmIndexNum, baseLastUpdateTimeStr)
|