package eta_bridge import ( "errors" "eta/eta_data_init/models" "eta/eta_data_init/utils" "fmt" ) func getPushIndexValueItemReqList(source, subSource, edbInfoId int) (pushIndexValueList []*PushIndexValueItemReq, err error) { pushIndexValueList = make([]*PushIndexValueItemReq, 0) tableName := models.GetEdbDataTableName(source, subSource) if tableName == "" { err = errors.New("没有找到来源对应的表") return } list, err := models.GetAllEdbDataListByCondition(tableName, edbInfoId) if err != nil { return } for _, edbData := range list { // 数据信息 pushIndexValueList = append(pushIndexValueList, &PushIndexValueItemReq{ Id: utils.MD5(fmt.Sprint(source, "_", subSource, "_", edbData.EdbDataId)), IndexCode: fmt.Sprint(source, "_", edbData.EdbCode), Value: fmt.Sprint(edbData.Value), BusinessDate: edbData.DataTime, CreateTime: edbData.CreateTime, UpdateTime: edbData.ModifyTime, Status: "1", }) } return } // getSourceType // @Description: 获取指标来源类型 // @author: Roc // @datetime 2024-03-01 13:40:03 // @param source int // @return string func getSourceType(source int) string { switch source { case utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_YS, utils.DATA_SOURCE_BAIINFO, utils.DATA_SOURCE_SCI: //钢联,有色,百川盈孚,红桃3 return "RPA" case utils.DATA_SOURCE_MANUAL: return "手工" default: return "接口" } } // OrigInfo // @Description: 数据源中的指标基础信息 type OrigInfo struct { EdbName string SourceName string } // getOrigInfo // @Description: 获取数据源中的指标基础信息 // @author: Roc // @datetime 2024-03-11 16:45:34 // @param source int // @param subSource int // @param edbCode string // @param edbName string // @return origInfo OrigInfo func getOrigInfo(source, subSource int, edbCode, edbName string) (origInfo OrigInfo) { switch source { case utils.DATA_SOURCE_THS, utils.DATA_SOURCE_WIND: // 同花顺、wind origInfo.SourceName = "经济数据库" if subSource == utils.DATA_SUB_SOURCE_DATE { origInfo.SourceName = "日期序列" } case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: edbInfo, err := models.GetBaseFromMysteelChemicalIndexItemByCode(edbCode) if err != nil { return } origInfo.EdbName = edbInfo.IndexName origInfo.SourceName = edbInfo.Source // 钢联化工 case utils.DATA_SOURCE_YS: // 有色 edbInfo, err := models.GetBaseFromSmmIndexItemItemByCode(edbCode) if err != nil { return } origInfo.EdbName = edbInfo.IndexName origInfo.SourceName = edbInfo.Interface } // 如果原始名称为空,则使用ETA指标库的名称作为原始名称 if origInfo.EdbName == `` { origInfo.EdbName = edbName } return } // getMaxModifyTime // @Description: 获取eta指标明细中的指标最大修改时间 // @author: Roc // @datetime 2024-03-11 17:10:28 // @param source int // @param edbCode string // @param addUpdateTime string // @return modifyTime string //func getMaxModifyTime(source, subSource int, edbCode, addUpdateTime string) (modifyTime string) { // modifyTime, err := data_manage.GetEdbInfoMaxModifyTime(source, subSource, edbCode) // if err != nil { // modifyTime = addUpdateTime // return // } // // return //}