|
@@ -163,7 +163,7 @@ func SyncClassifyList(cont context.Context) (err error) {
|
|
|
|
|
|
list, err := data_manage.GetAllEdbClassifyListByCondition(condition, pars)
|
|
|
if err != nil {
|
|
|
- fmt.Println(err)
|
|
|
+ utils.FileLog.Error("获取分类列表数据失败:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -197,10 +197,21 @@ func SyncClassifyList(cont context.Context) (err error) {
|
|
|
}
|
|
|
|
|
|
if len(dataLimitList) < 0 {
|
|
|
- fmt.Println("无分类数据推送")
|
|
|
+ //fmt.Println("无分类数据推送")
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ errDataList := make([]PushClassifyItemReq, 0)
|
|
|
+ errList := make([]string, 0)
|
|
|
+ defer func() {
|
|
|
+ if len(errList) > 0 {
|
|
|
+ dataByte, err := json.Marshal(errDataList)
|
|
|
+ if err != nil {
|
|
|
+ dataByte = []byte("序列化分类列表数据失败" + err.Error())
|
|
|
+ }
|
|
|
+ utils.FileLog.Info("pushIndexClassify errList:%s;推送失败的分类列表数据列表:%s", strings.Join(errList, "\n"), string(dataByte))
|
|
|
+ }
|
|
|
+ }()
|
|
|
for k, tmpDataList := range dataLimitList {
|
|
|
req := PushBaseParamReq{
|
|
|
SerialID: uuid.NewUUID().Hex32(),
|
|
@@ -213,8 +224,8 @@ func SyncClassifyList(cont context.Context) (err error) {
|
|
|
uri := "/xy/index/pushClassify"
|
|
|
_, e, _ := HttpEtaBridgePost(uri, req)
|
|
|
if e != nil {
|
|
|
- err = fmt.Errorf("第%d组分类数据推送失败,postRefreshEdbData err: %s", k+1, e.Error())
|
|
|
- fmt.Println(err)
|
|
|
+ errList = append(errList, fmt.Sprintf("第%d组分类列表数据推送失败,postRefreshEdbData err: %s", k+1, e.Error()))
|
|
|
+ errDataList = append(errDataList, dataList...)
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -232,9 +243,7 @@ var lockSyncIndex sync.Mutex
|
|
|
// @param cont context.Context
|
|
|
// @return err error
|
|
|
func SyncIndex(cont context.Context) (err error) {
|
|
|
- fmt.Println(time.Now(), "准备同步")
|
|
|
lockSyncIndex.Lock()
|
|
|
- fmt.Println(time.Now(), "开始同步")
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
tips := "SyncIndex-定时同步ETA指标信息变更数据至第三方失败, ErrMsg:\n" + err.Error()
|
|
@@ -242,7 +251,6 @@ func SyncIndex(cont context.Context) (err error) {
|
|
|
go alarm_msg.SendAlarmMsg(tips, 3)
|
|
|
}
|
|
|
lockSyncIndex.Unlock()
|
|
|
- fmt.Println(time.Now(), "同步结束")
|
|
|
}()
|
|
|
|
|
|
// 获取当前最大ID
|
|
@@ -273,10 +281,8 @@ func SyncIndex(cont context.Context) (err error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fmt.Println("logMaxId:", logMaxId)
|
|
|
// 遍历获取下一页的数据
|
|
|
for currId := currLogId; currId < logMaxId; {
|
|
|
- fmt.Println("currId:", currId)
|
|
|
currId = handlePush(currId, logMaxId)
|
|
|
}
|
|
|
|
|
@@ -302,7 +308,7 @@ func handlePush(currLogIdStr, logMaxId int64) (lastId int64) {
|
|
|
|
|
|
list, err := data_manage.GetEdbUpdateLogByCondition(condition, pars)
|
|
|
if err != nil {
|
|
|
- fmt.Println(err)
|
|
|
+ utils.FileLog.Error("获取变更日志失败:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -313,13 +319,11 @@ func handlePush(currLogIdStr, logMaxId int64) (lastId int64) {
|
|
|
idList := make([]int64, 0)
|
|
|
for _, v := range list {
|
|
|
lastId = v.Id
|
|
|
- fmt.Println("lastId", lastId)
|
|
|
idList = append(idList, v.Id)
|
|
|
pushIndexData, pushEdbClassifyData, pushIndexValueData, tmpErr := handleData(v)
|
|
|
if tmpErr != nil {
|
|
|
err = tmpErr
|
|
|
utils.FileLog.Error("获取待处理的数据失败:" + err.Error())
|
|
|
- fmt.Println(err)
|
|
|
continue
|
|
|
}
|
|
|
|