Roc 1 éve
szülő
commit
e7753559ad

+ 5 - 2
models/data_manage/edb_data_base.go

@@ -8,14 +8,16 @@ import (
 )
 
 var (
-	EdbDataTableNameMap     map[int]string // 指标来源对应数据表名
-	EdbDataRefreshMethodMap map[int]string // 指标来源对应的刷新指标方法
+	EdbDataTableNameMap     map[int]string        // 指标来源对应数据表名
+	EdbDataRefreshMethodMap map[int]string        // 指标来源对应的刷新指标方法
+	EdbTableNameSourceMap   map[string]*EdbSource // 数据表名对应的指标来源
 )
 
 // InitEdbSourceVar 初始化时加载指标来源对应信息, 避免循环中查库, 注意edb_source表修改table_name的话需要重启服务
 func InitEdbSourceVar() {
 	EdbDataTableNameMap = make(map[int]string)
 	EdbDataRefreshMethodMap = make(map[int]string)
+	EdbTableNameSourceMap = make(map[string]*EdbSource)
 	sources, e := GetEdbSourceItemsByCondition(``, make([]interface{}, 0), []string{}, "")
 	if e != nil {
 		utils.FileLog.Info("init source table err: %s", e.Error())
@@ -24,6 +26,7 @@ func InitEdbSourceVar() {
 	for _, v := range sources {
 		EdbDataTableNameMap[v.EdbSourceId] = v.TableName
 		EdbDataRefreshMethodMap[v.EdbSourceId] = v.EdbRefreshMethod
+		EdbTableNameSourceMap[v.TableName] = v
 	}
 }
 

+ 39 - 0
models/data_manage/edb_update_log.go

@@ -0,0 +1,39 @@
+package data_manage
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type EdbUpdateLog struct {
+	Id          int64     `json:"id" orm:"column(id);pk"`
+	OpDbName    string    `json:"op_db_name"`    // 库名
+	OpTableName string    `json:"op_table_name"` // 表名
+	OpType      string    `json:"op_type"`       // 变更类型
+	OldData     string    `json:"old_data"`      // 历史数据
+	NewData     string    `json:"new_data"`      // 新数据
+	CreateTime  time.Time `json:"create_time"`
+}
+
+func GetEdbUpdateLogByCondition(condition string, pars []interface{}) (item []*EdbUpdateLog, err error) {
+	o := orm.NewOrmUsingDB("data")
+	sql := ` SELECT * FROM edb_update_log WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += `ORDER BY id ASC limit 500 `
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+
+	return
+}
+
+type EdbData struct {
+	EdbDataId     int32     `orm:"column(edb_data_id);pk" json:"edb_data_id"`
+	EdbInfoId     int32     `json:"edb_info_id"`    // 指标id
+	EdbCode       string    `json:"edb_code"`       // 指标编码
+	DataTime      time.Time `json:"data_time"`      // 数据日期
+	Value         float64   `json:"value"`          // 数据值
+	CreateTime    time.Time `json:"create_time"`    // 创建时间
+	ModifyTime    time.Time `json:"modify_time"`    // 修改时间
+	DataTimestamp int64     `json:"data_timestamp"` // 数据日期时间戳
+}

+ 489 - 26
services/eta_bridge/xy.go

@@ -2,13 +2,15 @@ package eta_bridge
 
 import (
 	"context"
+	"encoding/json"
 	"eta/eta_task/models/data_manage"
 	"eta/eta_task/services/alarm_msg"
 	"eta/eta_task/utils"
 	"fmt"
+	"strings"
 )
 
-// PushIndexValueParamReq
+// PushBaseParamReq
 // @Description: 业务报文
 type PushBaseParamReq struct {
 	SerialID    string      `json:"serialID" description:"流水号"`
@@ -18,19 +20,9 @@ type PushBaseParamReq struct {
 	Data        interface{} `json:"data" description:"报文体"`
 }
 
-// PushDataParamReq
-// @Description: 业务报文
-type PushDataParamReq struct {
-	SerialID    string      `json:"serialID" description:"流水号"`
-	TableCode   string      `json:"tableCode" description:"数据表编码"`
-	Total       int         `json:"total" description:"本次落表数据总数"`
-	IsEmailWarn int         `json:"isEmailWarn" description:"是否发送预警邮件,(1-是 0-否)"`
-	Data        interface{} `json:"data" description:"报文体,指标数据列表"`
-}
-
-// PushDataParamDataReq
+// PushIndexParamDataReq
 // @Description: 指标数据结构
-type PushDataParamDataReq struct {
+type PushIndexParamDataReq struct {
 	SourceIndexCode string `json:"source_index_code" description:"上游来源指标ID"`
 	IndexCode       string `json:"index_code" description:""`
 	IndexName       string `json:"index_name" description:""`
@@ -95,9 +87,9 @@ func SyncIndexList(cont context.Context) (err error) {
 		return
 	}
 
-	dataList := make([]PushDataParamDataReq, 0)
+	dataList := make([]PushIndexParamDataReq, 0)
 	for _, v := range list {
-		dataList = append(dataList, PushDataParamDataReq{
+		dataList = append(dataList, PushIndexParamDataReq{
 			SourceIndexCode:  v.EdbCode,
 			IndexCode:        fmt.Sprint(v.Source, "_", v.EdbCode),
 			IndexName:        v.EdbName,
@@ -114,7 +106,7 @@ func SyncIndexList(cont context.Context) (err error) {
 			OrginSource:      v.SourceName,                              // todo
 			OrginSysSource:   v.SourceName,
 			SysSource:        "产研平台", //todo
-			SourceType:       "RPA",  //TODO
+			SourceType:       "RPA",      //TODO
 			Status:           1,
 		})
 	}
@@ -147,16 +139,6 @@ func SyncIndexList(cont context.Context) (err error) {
 	return
 }
 
-// PushIndexValueParamReq
-// @Description: 业务报文
-type PushIndexValueParamReq struct {
-	SerialID    string                  `json:"serialID" description:"流水号"`
-	TableCode   string                  `json:"tableCode" description:"数据表编码"`
-	Total       int                     `json:"total" description:"本次落表数据总数"`
-	IsEmailWarn int                     `json:"isEmailWarn" description:"是否发送预警邮件,(1-是 0-否)"`
-	Data        []PushIndexValueItemReq `json:"data" description:"报文体,指标日期值数据列表"`
-}
-
 // PushIndexValueItemReq
 // @Description: 指标日期值数据结构
 type PushIndexValueItemReq struct {
@@ -417,3 +399,484 @@ func SyncEdbClassifyList(cont context.Context) (err error) {
 
 	return
 }
+
+func SyncIndex(cont context.Context) (err error) {
+	defer func() {
+		if err != nil {
+			tips := "SyncIndex-定时同步ETA指标信息变更数据至第三方失败, ErrMsg:\n" + err.Error()
+			utils.FileLog.Info(tips)
+			go alarm_msg.SendAlarmMsg(tips, 3)
+		}
+	}()
+
+	var condition string
+	var pars []interface{}
+	//condition += " AND update_type in (?,?) "
+	//pars = append(pars, 1, 2)
+	condition += " AND id > ?"
+	pars = append(pars, 50)
+
+	list, err := data_manage.GetEdbUpdateLogByCondition(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	//pushIndexData *PushIndexParamDataReq, pushEdbClassify *PushEdbClassifyItemReq, pushIndexValue *PushIndexValueItemReq
+
+	pushIndexList := make([]*PushIndexParamDataReq, 0)
+	pushEdbClassifyList := make([]*PushEdbClassifyItemReq, 0)
+	pushIndexValueList := make([]*PushIndexValueItemReq, 0)
+
+	for _, v := range list {
+		pushIndexData, pushEdbClassify, pushIndexValue, err := handleData(v)
+		if err != nil {
+			continue
+		}
+
+		if pushIndexData != nil {
+			pushIndexList = append(pushIndexList, pushIndexData)
+		}
+
+		if pushEdbClassify != nil {
+			pushEdbClassifyList = append(pushEdbClassifyList, pushEdbClassify)
+		}
+
+		if pushIndexValue != nil {
+			pushIndexValueList = append(pushIndexValueList, pushIndexValue)
+		}
+	}
+
+	return
+}
+
+func handleData(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIndexParamDataReq, pushEdbClassify *PushEdbClassifyItemReq, pushIndexValue *PushIndexValueItemReq, err error) {
+	switch edbUpdateLog.OpType {
+	case "insert":
+		return handleInsert(edbUpdateLog)
+	case "update":
+		return handleUpdate(edbUpdateLog)
+	case "delete":
+		return handleDelete(edbUpdateLog)
+	}
+
+	return
+}
+
+func handleInsert(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIndexParamDataReq, pushEdbClassify *PushEdbClassifyItemReq, pushIndexValue *PushIndexValueItemReq, err error) {
+	data := edbUpdateLog.NewData
+
+	//指标信息
+	if edbUpdateLog.OpTableName == "edb_info" {
+		var edbInfo *data_manage.EdbInfo
+		err = json.Unmarshal([]byte(data), &edbInfo)
+		if err != nil {
+			return
+		}
+
+		// 指标信息
+		pushIndexData = &PushIndexParamDataReq{
+			SourceIndexCode:  edbInfo.EdbCode,
+			IndexCode:        fmt.Sprint(edbInfo.Source, "_", edbInfo.EdbCode),
+			IndexName:        edbInfo.EdbName,
+			IndexShortName:   edbInfo.EdbName, //todo
+			FrequenceName:    edbInfo.Frequency,
+			UnitName:         edbInfo.Unit,
+			AssetBeginDate:   edbInfo.StartDate,
+			AssetEndDate:     edbInfo.EndDate,
+			CreateUser:       edbInfo.SysUserRealName,
+			IndexCreateTime:  edbInfo.CreateTime.Format(utils.FormatDateTime),
+			UpdateUser:       edbInfo.SysUserRealName,                         // todo
+			DetailUpdateTime: edbInfo.CreateTime.Format(utils.FormatDateTime), //todo
+			IndexUpdateTime:  edbInfo.ModifyTime.Format(utils.FormatDateTime), //todo
+			OrginSource:      edbInfo.SourceName,                              // todo
+			OrginSysSource:   edbInfo.SourceName,
+			SysSource:        "产研平台",
+			SourceType:       getSourceType(edbInfo.Source),
+			Status:           1,
+		}
+
+		// 指标与分类的关系信息
+		pushEdbClassify = &PushEdbClassifyItemReq{
+			Id:         fmt.Sprint(edbInfo.EdbInfoId),
+			ClassifyId: edbInfo.ClassifyId,
+			IndexCode:  fmt.Sprint(edbInfo.Source, "_", edbInfo.EdbCode),
+			CreateTime: edbInfo.CreateTime.Format(utils.FormatDateTime),
+			CreateUser: edbInfo.SysUserRealName,
+			UpdateTime: edbInfo.ModifyTime.Format(utils.FormatDateTime),
+			UpdateUser: edbInfo.SysUserRealName,
+		}
+
+		return
+	}
+
+	// 分类信息
+	//if edbUpdateLog.OpTableName == "edb_classify" {
+	//	var edbClassify *data_manage.EdbClassify
+	//	err = json.Unmarshal([]byte(data), &edbClassify)
+	//	if err != nil {
+	//		return
+	//	}
+	//
+	//	// 指标信息
+	//	pushClassify = PushClassifyItemReq{
+	//		ClassifyId:      int(edbClassify.ClassifyID),
+	//		ClassifyType:    int(edbClassify.ClassifyType),
+	//		ClassifyName:    edbClassify.ClassifyName,
+	//		ParentId:        int(edbClassify.ParentID),
+	//		HasData:         int(edbClassify.HasData),
+	//		CreateTime:      edbClassify.CreateTime.Format(utils.FormatDateTime),
+	//		UpdateTime:      edbClassify.ModifyTime.Format(utils.FormatDateTime),
+	//		SysUserId:       int(edbClassify.SysUserID),
+	//		SysUserRealName: edbClassify.SysUserRealName,
+	//		Level:           int(edbClassify.Level),
+	//		UniqueCode:      edbClassify.UniqueCode,
+	//		SortColumn:      int(edbClassify.Sort),
+	//	}
+	//
+	//	return
+	//}
+
+	// 数据信息
+	if strings.HasPrefix(edbUpdateLog.OpTableName, "edb_data_") {
+		var edbData *data_manage.EdbData
+		err = json.Unmarshal([]byte(data), &edbData)
+		if err != nil {
+			return
+		}
+
+		edbSource, ok := data_manage.EdbTableNameSourceMap[edbUpdateLog.OpTableName]
+		if !ok {
+			// 没有找到来源,那就过滤
+			return
+		}
+		// 数据信息
+		pushIndexValue = &PushIndexValueItemReq{
+			Id:           utils.MD5(fmt.Sprint(edbSource.EdbSourceId, "_", edbSource.SourceName, "_", edbData.EdbDataId)),
+			IndexCode:    fmt.Sprint(edbSource, "_", edbData.EdbCode),
+			Value:        fmt.Sprint(edbData.Value),
+			BusinessDate: edbData.DataTime.Format(utils.FormatDate),
+			CreateTime:   edbData.CreateTime.Format(utils.FormatDateTime),
+			UpdateTime:   edbData.ModifyTime.Format(utils.FormatDateTime),
+			Status:       "1",
+		}
+
+		return
+	}
+
+	return
+}
+
+func handleDelete(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIndexParamDataReq, pushEdbClassify *PushEdbClassifyItemReq, pushIndexValue *PushIndexValueItemReq, err error) {
+	data := edbUpdateLog.OldData
+
+	//指标信息
+	if edbUpdateLog.OpTableName == "edb_info" {
+		var edbInfo *data_manage.EdbInfo
+		err = json.Unmarshal([]byte(data), &edbInfo)
+		if err != nil {
+			return
+		}
+
+		// 指标信息
+		pushIndexData = &PushIndexParamDataReq{
+			SourceIndexCode:  edbInfo.EdbCode,
+			IndexCode:        fmt.Sprint(edbInfo.Source, "_", edbInfo.EdbCode),
+			IndexName:        edbInfo.EdbName,
+			IndexShortName:   edbInfo.EdbName, //todo
+			FrequenceName:    edbInfo.Frequency,
+			UnitName:         edbInfo.Unit,
+			AssetBeginDate:   edbInfo.StartDate,
+			AssetEndDate:     edbInfo.EndDate,
+			CreateUser:       edbInfo.SysUserRealName,
+			IndexCreateTime:  edbInfo.CreateTime.Format(utils.FormatDateTime),
+			UpdateUser:       edbInfo.SysUserRealName,                         // todo
+			DetailUpdateTime: edbInfo.CreateTime.Format(utils.FormatDateTime), //todo
+			IndexUpdateTime:  edbInfo.ModifyTime.Format(utils.FormatDateTime), //todo
+			OrginSource:      edbInfo.SourceName,                              // todo
+			OrginSysSource:   edbInfo.SourceName,
+			SysSource:        "产研平台",
+			SourceType:       getSourceType(edbInfo.Source),
+			Status:           0,
+		}
+
+		// 指标与分类的关系信息
+		pushEdbClassify = &PushEdbClassifyItemReq{
+			Id:         fmt.Sprint(edbInfo.EdbInfoId),
+			ClassifyId: edbInfo.ClassifyId,
+			IndexCode:  fmt.Sprint(edbInfo.Source, "_", edbInfo.EdbCode),
+			CreateTime: edbInfo.CreateTime.Format(utils.FormatDateTime),
+			CreateUser: edbInfo.SysUserRealName,
+			UpdateTime: edbInfo.ModifyTime.Format(utils.FormatDateTime),
+			UpdateUser: edbInfo.SysUserRealName,
+		}
+
+		return
+	}
+
+	// 分类信息
+	//if edbUpdateLog.OpTableName == "edb_classify" {
+	//	var edbClassify *data_manage.EdbClassify
+	//	err = json.Unmarshal([]byte(data), &edbClassify)
+	//	if err != nil {
+	//		return
+	//	}
+	//
+	//	// 指标信息
+	//	pushClassify = PushClassifyItemReq{
+	//		ClassifyId:      int(edbClassify.ClassifyID),
+	//		ClassifyType:    int(edbClassify.ClassifyType),
+	//		ClassifyName:    edbClassify.ClassifyName,
+	//		ParentId:        int(edbClassify.ParentID),
+	//		HasData:         int(edbClassify.HasData),
+	//		CreateTime:      edbClassify.CreateTime.Format(utils.FormatDateTime),
+	//		UpdateTime:      edbClassify.ModifyTime.Format(utils.FormatDateTime),
+	//		SysUserId:       int(edbClassify.SysUserID),
+	//		SysUserRealName: edbClassify.SysUserRealName,
+	//		Level:           int(edbClassify.Level),
+	//		UniqueCode:      edbClassify.UniqueCode,
+	//		SortColumn:      int(edbClassify.Sort),
+	//	}
+	//
+	//	return
+	//}
+
+	// 数据信息
+	if strings.HasPrefix(edbUpdateLog.OpTableName, "edb_data_") {
+		var edbData *data_manage.EdbData
+		err = json.Unmarshal([]byte(data), &edbData)
+		if err != nil {
+			return
+		}
+
+		edbSource, ok := data_manage.EdbTableNameSourceMap[edbUpdateLog.OpTableName]
+		if !ok {
+			// 没有找到来源,那就过滤
+			return
+		}
+		// 数据信息
+		pushIndexValue = &PushIndexValueItemReq{
+			Id:           utils.MD5(fmt.Sprint(edbSource.EdbSourceId, "_", edbSource.SourceName, "_", edbData.EdbDataId)),
+			IndexCode:    fmt.Sprint(edbSource, "_", edbData.EdbCode),
+			Value:        fmt.Sprint(edbData.Value),
+			BusinessDate: edbData.DataTime.Format(utils.FormatDate),
+			CreateTime:   edbData.CreateTime.Format(utils.FormatDateTime),
+			UpdateTime:   edbData.ModifyTime.Format(utils.FormatDateTime),
+			Status:       "0",
+		}
+
+		return
+	}
+
+	return
+}
+
+func handleUpdate(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIndexParamDataReq, pushEdbClassify *PushEdbClassifyItemReq, pushIndexValue *PushIndexValueItemReq, err error) {
+	oldData := edbUpdateLog.OldData
+	newData := edbUpdateLog.NewData
+
+	//指标信息
+	if edbUpdateLog.OpTableName == "edb_info" {
+		var oldEdbInfo *data_manage.EdbInfo
+		err = json.Unmarshal([]byte(oldData), &oldEdbInfo)
+		if err != nil {
+			return
+		}
+
+		var newEdbInfo *data_manage.EdbInfo
+		err = json.Unmarshal([]byte(newData), &newEdbInfo)
+		if err != nil {
+			return
+		}
+
+		isUpdateEdbInfo := checkUpdateType(oldEdbInfo, newEdbInfo)
+		// 指标信息
+		if isUpdateEdbInfo {
+			pushIndexData = &PushIndexParamDataReq{
+				SourceIndexCode:  newEdbInfo.EdbCode,
+				IndexCode:        fmt.Sprint(newEdbInfo.Source, "_", newEdbInfo.EdbCode),
+				IndexName:        newEdbInfo.EdbName,
+				IndexShortName:   newEdbInfo.EdbName, //todo
+				FrequenceName:    newEdbInfo.Frequency,
+				UnitName:         newEdbInfo.Unit,
+				AssetBeginDate:   newEdbInfo.StartDate,
+				AssetEndDate:     newEdbInfo.EndDate,
+				CreateUser:       newEdbInfo.SysUserRealName,
+				IndexCreateTime:  newEdbInfo.CreateTime.Format(utils.FormatDateTime),
+				UpdateUser:       newEdbInfo.SysUserRealName,                         // todo
+				DetailUpdateTime: newEdbInfo.CreateTime.Format(utils.FormatDateTime), //todo
+				IndexUpdateTime:  newEdbInfo.ModifyTime.Format(utils.FormatDateTime), //todo
+				OrginSource:      newEdbInfo.SourceName,                              // todo
+				OrginSysSource:   newEdbInfo.SourceName,
+				SysSource:        "产研平台",
+				SourceType:       getSourceType(newEdbInfo.Source),
+				Status:           1,
+			}
+		}
+
+		// 指标与分类的关系信息
+		if oldEdbInfo.ClassifyId != newEdbInfo.ClassifyId {
+			pushEdbClassify = &PushEdbClassifyItemReq{
+				Id:         fmt.Sprint(newEdbInfo.EdbInfoId),
+				ClassifyId: newEdbInfo.ClassifyId,
+				IndexCode:  fmt.Sprint(newEdbInfo.Source, "_", newEdbInfo.EdbCode),
+				CreateTime: newEdbInfo.CreateTime.Format(utils.FormatDateTime),
+				CreateUser: newEdbInfo.SysUserRealName,
+				UpdateTime: newEdbInfo.ModifyTime.Format(utils.FormatDateTime),
+				UpdateUser: newEdbInfo.SysUserRealName,
+			}
+		}
+
+		return
+	}
+
+	// 分类信息
+	//if edbUpdateLog.OpTableName == "edb_classify" {
+	//	var edbClassify *data_manage.EdbClassify
+	//	err = json.Unmarshal([]byte(newData), &edbClassify)
+	//	if err != nil {
+	//		return
+	//	}
+	//
+	//	// 指标信息
+	//	pushClassify = PushClassifyItemReq{
+	//		ClassifyId:      int(edbClassify.ClassifyID),
+	//		ClassifyType:    int(edbClassify.ClassifyType),
+	//		ClassifyName:    edbClassify.ClassifyName,
+	//		ParentId:        int(edbClassify.ParentID),
+	//		HasData:         int(edbClassify.HasData),
+	//		CreateTime:      edbClassify.CreateTime.Format(utils.FormatDateTime),
+	//		UpdateTime:      edbClassify.ModifyTime.Format(utils.FormatDateTime),
+	//		SysUserId:       int(edbClassify.SysUserID),
+	//		SysUserRealName: edbClassify.SysUserRealName,
+	//		Level:           int(edbClassify.Level),
+	//		UniqueCode:      edbClassify.UniqueCode,
+	//		SortColumn:      int(edbClassify.Sort),
+	//	}
+	//
+	//	return
+	//}
+
+	// 数据信息
+	if strings.HasPrefix(edbUpdateLog.OpTableName, "edb_data_") {
+		var edbData *data_manage.EdbData
+		err = json.Unmarshal([]byte(newData), &edbData)
+		if err != nil {
+			return
+		}
+
+		edbSource, ok := data_manage.EdbTableNameSourceMap[edbUpdateLog.OpTableName]
+		if !ok {
+			// 没有找到来源,那就过滤
+			return
+		}
+		// 数据信息
+		pushIndexValue = &PushIndexValueItemReq{
+			Id:           utils.MD5(fmt.Sprint(edbSource.EdbSourceId, "_", edbSource.SourceName, "_", edbData.EdbDataId)),
+			IndexCode:    fmt.Sprint(edbSource, "_", edbData.EdbCode),
+			Value:        fmt.Sprint(edbData.Value),
+			BusinessDate: edbData.DataTime.Format(utils.FormatDate),
+			CreateTime:   edbData.CreateTime.Format(utils.FormatDateTime),
+			UpdateTime:   edbData.ModifyTime.Format(utils.FormatDateTime),
+			Status:       "1",
+		}
+
+		return
+	}
+
+	return
+}
+
+//PushIndexParamDataReq{
+//SourceIndexCode:  edbInfo.EdbCode,
+//IndexCode:        fmt.Sprint(edbInfo.Source, "_", edbInfo.EdbCode),
+//IndexName:        edbInfo.EdbName,
+//IndexShortName:   edbInfo.EdbName, //todo
+//FrequenceName:    edbInfo.Frequency,
+//UnitName:         edbInfo.Unit,
+//AssetBeginDate:   edbInfo.StartDate,
+//AssetEndDate:     edbInfo.EndDate,
+//CreateUser:       edbInfo.SysUserRealName,
+//IndexCreateTime:  edbInfo.CreateTime.Format(utils.FormatDateTime),
+//UpdateUser:       edbInfo.SysUserRealName,                         // todo
+//DetailUpdateTime: edbInfo.CreateTime.Format(utils.FormatDateTime), //todo
+//IndexUpdateTime:  edbInfo.ModifyTime.Format(utils.FormatDateTime), //todo
+//OrginSource:      edbInfo.SourceName,                              // todo
+//OrginSysSource:   edbInfo.SourceName,
+//SysSource:        "产研平台",
+//SourceType:       getSourceType(edbInfo.Source),
+//Status:           1,
+//}
+
+// 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 "接口"
+	}
+}
+
+func checkUpdateType(oldEdbInfo, newEdbInfo *data_manage.EdbInfo) (isUpdateEdbInfo bool) {
+	//todo 外部来源名称需要处理;更新人姓名,指标更新时间
+
+	// eta内部名称
+	if oldEdbInfo.EdbName != newEdbInfo.EdbName {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.Frequency != newEdbInfo.Frequency {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.Unit != newEdbInfo.Unit {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.StartDate != newEdbInfo.StartDate {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.EndDate != newEdbInfo.EndDate {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.SysUserId != newEdbInfo.SysUserId {
+		isUpdateEdbInfo = true
+		return
+	}
+	if oldEdbInfo.SysUserRealName != newEdbInfo.SysUserRealName {
+		isUpdateEdbInfo = true
+		return
+	}
+
+	return
+}
+
+func pushIndex(pushIndexList []*PushIndexParamDataReq) {
+	if len(pushIndexList) <= 0 {
+		return
+	}
+
+	uri := "/xy/index/pushIndexData"
+	req := PushBaseParamReq{
+		SerialID:    utils.GetRandString(32), //todo
+		TableCode:   "",
+		Total:       lenData,
+		IsEmailWarn: 0,
+		Data:        dataList,
+	}
+
+	var pushIndexList []*PushIndexParamDataReq
+	dataLimitList := make([][]PushBaseParamReq, 0)
+
+	_, e, errMsg := HttpEtaBridgePost(uri, req)
+}

+ 2 - 1
services/task_xy.go

@@ -1,6 +1,7 @@
 package services
 
 import (
+	"eta/eta_task/services/eta_bridge"
 	"eta/eta_task/utils"
 )
 
@@ -9,7 +10,7 @@ func XyTask() {
 		return
 	}
 
-	//eta_bridge.SyncIndexList(nil)
+	eta_bridge.SyncIndexList(nil)
 	//eta_bridge.SyncIndexValueList(nil)
 	//eta_bridge.SyncClassifyList(nil)
 	//eta_bridge.SyncEdbClassifyList(nil)