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
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -245,6 +64,85 @@ func EdbInfoRefreshAllFromBaseV3(edbInfoIdList []int, refreshAll, isSync bool) (
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func EdbInfoRefreshAllFromTrace(edbInfoId int, refreshAll bool) (err error, isAsync bool) {
|
|
|
+ traceEdbInfo, err := TraceEdbInfoByEdbInfoId(edbInfoId)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ existEdbInfoIdMap := make(map[int]int)
|
|
|
+
|
|
|
+
|
|
|
+ newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr := getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo, existEdbInfoIdMap)
|
|
|
+
|
|
|
+
|
|
|
+ sort.Ints(calculateArr)
|
|
|
+
|
|
|
+ sort.Ints(predictCalculateArr)
|
|
|
+
|
|
|
+ err = edbInfoRefreshAll(refreshAll, newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo data_manage.TraceEdbInfoResp, existEdbInfoIdMap map[int]int) (newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int) {
|
|
|
+ newBaseEdbInfoArr = make([]*data_manage.EdbInfo, 0)
|
|
|
+ newBasePredictEdbInfoArr = make([]*data_manage.EdbInfo, 0)
|
|
|
+ newCalculateMap = make(map[int]*data_manage.EdbInfo)
|
|
|
+ newPredictCalculateMap = make(map[int]*data_manage.EdbInfo)
|
|
|
+ calculateArr = make([]int, 0)
|
|
|
+ predictCalculateArr = make([]int, 0)
|
|
|
+
|
|
|
+ _, ok := existEdbInfoIdMap[traceEdbInfo.EdbInfoId]
|
|
|
+ if ok {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ existEdbInfoIdMap[traceEdbInfo.EdbInfoId] = traceEdbInfo.EdbInfoId
|
|
|
+
|
|
|
+ switch traceEdbInfo.EdbInfoType {
|
|
|
+
|
|
|
+ case 0:
|
|
|
+ if traceEdbInfo.EdbType == 1 {
|
|
|
+ newBaseEdbInfoArr = append(newBaseEdbInfoArr, traceEdbInfo.EdbInfo)
|
|
|
+ } else if traceEdbInfo.EdbType == 2 {
|
|
|
+ newCalculateMap[traceEdbInfo.EdbInfoId] = traceEdbInfo.EdbInfo
|
|
|
+ calculateArr = append(calculateArr, traceEdbInfo.EdbInfoId)
|
|
|
+ }
|
|
|
+ case 1:
|
|
|
+ if traceEdbInfo.EdbType == 1 {
|
|
|
+ newBasePredictEdbInfoArr = append(newBasePredictEdbInfoArr, traceEdbInfo.EdbInfo)
|
|
|
+ } else if traceEdbInfo.EdbType == 2 {
|
|
|
+ newPredictCalculateMap[traceEdbInfo.EdbInfoId] = traceEdbInfo.EdbInfo
|
|
|
+ predictCalculateArr = append(predictCalculateArr, traceEdbInfo.EdbInfoId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if traceEdbInfo.Child != nil && len(traceEdbInfo.Child) > 0 {
|
|
|
+ for _, v := range traceEdbInfo.Child {
|
|
|
+ tmpBaseEdbInfoArr, tmpPredictEdbInfoArr, tmpCalculateMap, tmpPredictCalculateMap, tmpCalculateArr, tmpPredictCalculateArr := getRefreshEdbInfoListByTraceEdbInfo(v, existEdbInfoIdMap)
|
|
|
+
|
|
|
+ newBaseEdbInfoArr = append(newBaseEdbInfoArr, tmpBaseEdbInfoArr...)
|
|
|
+ newBasePredictEdbInfoArr = append(newBasePredictEdbInfoArr, tmpPredictEdbInfoArr...)
|
|
|
+
|
|
|
+ for k, tmpEdbInfo := range tmpCalculateMap {
|
|
|
+ newCalculateMap[k] = tmpEdbInfo
|
|
|
+ }
|
|
|
+
|
|
|
+ for k, tmpEdbInfo := range tmpPredictCalculateMap {
|
|
|
+ newPredictCalculateMap[k] = tmpEdbInfo
|
|
|
+ }
|
|
|
+
|
|
|
+ calculateArr = append(calculateArr, tmpCalculateArr...)
|
|
|
+ predictCalculateArr = append(predictCalculateArr, tmpPredictCalculateArr...)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int) (err error) {
|
|
|
var errmsg string
|
|
|
defer func() {
|
|
@@ -2690,6 +2588,7 @@ func TraceEdbInfoByEdbInfoId(edbInfoId int) (traceEdbInfo data_manage.TraceEdbIn
|
|
|
|
|
|
UniqueCode: edbInfo.UniqueCode,
|
|
|
ClassifyId: edbInfo.ClassifyId,
|
|
|
+ EdbInfo: edbInfo,
|
|
|
}
|
|
|
findIdMap := make(map[int]int)
|
|
|
findIdMap[edbInfoId] = edbInfoId
|
|
@@ -2725,8 +2624,26 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
|
|
|
err = fmt.Errorf("GetEdbInfoCalculateMappingListByEdbInfoId err: %s", e.Error())
|
|
|
return
|
|
|
}
|
|
|
- edbMappingMap[edbInfoId] = edbInfoMappingList
|
|
|
|
|
|
+
|
|
|
+ edbInfoMap := make(map[int]*data_manage.EdbInfo)
|
|
|
+ if len(edbInfoMappingList) > 0 {
|
|
|
+ fromEdbInfoIdList := make([]int, 0)
|
|
|
+ for _, v := range edbInfoMappingList {
|
|
|
+ fromEdbInfoIdList = append(fromEdbInfoIdList, v.FromEdbInfoId)
|
|
|
+ }
|
|
|
+ edbInfoList, tmpErr := data_manage.GetEdbInfoByIdList(fromEdbInfoIdList)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = fmt.Errorf("traceEdbInfoByEdbInfoId GetEdbInfoByIdList err: %s", tmpErr.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range edbInfoList {
|
|
|
+ edbInfoMap[v.EdbInfoId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ edbMappingMap[edbInfoId] = edbInfoMappingList
|
|
|
for _, v := range edbInfoMappingList {
|
|
|
tmpEdbInfoId := v.FromEdbInfoId
|
|
|
tmpTraceEdbInfo := data_manage.TraceEdbInfoResp{
|
|
@@ -2735,6 +2652,7 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
|
|
|
EdbType: v.FromEdbType,
|
|
|
UniqueCode: v.FromUniqueCode,
|
|
|
ClassifyId: v.FromClassifyId,
|
|
|
+ EdbInfo: edbInfoMap[v.FromEdbInfoId],
|
|
|
}
|
|
|
|
|
|
|