edb_refresh.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. package services
  2. import (
  3. "context"
  4. "eta_gn/eta_task/models/data_manage/edb_refresh"
  5. "eta_gn/eta_task/services/alarm_msg"
  6. "eta_gn/eta_task/services/data"
  7. "eta_gn/eta_task/utils"
  8. "fmt"
  9. "strings"
  10. "sync"
  11. "time"
  12. )
  13. // Function to merge two maps
  14. func mergeMaps(dst map[string][]*edb_refresh.EdbInfoListAndRefreshConfig, src map[string][]*edb_refresh.EdbInfoListAndRefreshConfig) (newMap map[string][]*edb_refresh.EdbInfoListAndRefreshConfig) {
  15. if dst == nil {
  16. return src
  17. }
  18. if src == nil {
  19. return dst
  20. }
  21. newMap = dst
  22. for k, v := range src {
  23. if newK, ok := newMap[k]; ok {
  24. newK = append(newK, v...)
  25. newMap[k] = newK
  26. } else {
  27. newMap[k] = v
  28. }
  29. }
  30. return newMap
  31. }
  32. // getDefaultRefreshData
  33. // @Description: 根据默认配置获取需要刷新的指标列表
  34. // @author: Roc
  35. // @datetime 2024-01-10 13:55:38
  36. // @param now time.Time
  37. // @return sourceEdbInfoListMap map[string][]*edb_refresh.EdbInfoListAndRefreshConfig
  38. // @return err error
  39. func getDefaultRefreshData(now time.Time) (sourceEdbInfoListMap map[string][]*edb_refresh.EdbInfoListAndRefreshConfig, err error) {
  40. errMsgList := make([]string, 0)
  41. defer func() {
  42. if err != nil {
  43. fmt.Println(err)
  44. }
  45. }()
  46. sourceEdbInfoListMap = make(map[string][]*edb_refresh.EdbInfoListAndRefreshConfig)
  47. currTimeStr := getPreviousHalfHour(now)
  48. fmt.Println(currTimeStr)
  49. // 所有默认配置刷新项
  50. list := make([]*edb_refresh.EdbRefreshDefaultConfig, 0)
  51. //刷新频率,枚举值:每自然日、每交易日、每周、每旬、每月、每季、每半年、每年
  52. refreshFrequencyList := []string{"每自然日", "每交易日", "每周", "每旬", "每月", "每季", "每半年", "每年"}
  53. //conf, err := models.GetBusinessConf()
  54. //if err != nil {
  55. // fmt.Println(err)
  56. // utils.FileLog.Info("获取业务配置失败,Err:" + err.Error())
  57. // return
  58. //}
  59. // 获取钢联化工的数据获取方式
  60. //mySteelChemicalDataMethod := "excel"
  61. //if v, ok := conf["MySteelDataMethod"]; ok {
  62. // if v == "api" {
  63. // mySteelChemicalDataMethod = v
  64. // }
  65. //}
  66. //utils.FileLog.Info("获取业务配置,MySteelDataMethod:" + mySteelChemicalDataMethod)
  67. // 获取各个刷新频率的配置
  68. for _, refreshFrequency := range refreshFrequencyList {
  69. // 获取刷新频率条件
  70. condition, pars, isHandler := getRefreshFrequencyCondition(now, refreshFrequency)
  71. if !isHandler {
  72. // 可能是非交易日,所以过滤不处理
  73. continue
  74. }
  75. condition += ` AND refresh_frequency = ? AND refresh_time = ?`
  76. pars = append(pars, refreshFrequency, currTimeStr)
  77. // 这两个是excel的数据源,他是从公共机更新的,需要过滤掉
  78. //if mySteelChemicalDataMethod == "api" {
  79. // // 钢联化工使用api的方式获取数据的,不需要过滤
  80. // condition += ` AND source not in (?)`
  81. // pars = append(pars, utils.DATA_SOURCE_YS)
  82. //} else {
  83. // condition += ` AND source not in (?,?)`
  84. // pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_YS)
  85. //}
  86. tmpList, tmpErr := edb_refresh.GetListByCondition(condition, pars)
  87. if tmpErr != nil {
  88. err = tmpErr
  89. return
  90. }
  91. list = append(list, tmpList...)
  92. }
  93. // 更新的单元格数
  94. refreshDataNumMap := make(map[string]*edb_refresh.EdbRefreshDefaultConfig)
  95. // 数据源刷新频度的列表数组
  96. refreshDataFrequencyListMap := make(map[int]map[int][]string)
  97. wgNum := 0
  98. // 处理待刷新的数据源,整理成数组,方便获取对应的指标
  99. for _, item := range list {
  100. // 更新的单元格数
  101. key := fmt.Sprintf("%d_%d_%s", item.Source, item.SubSource, item.Frequency)
  102. refreshDataNumMap[key] = item
  103. // 数据源刷新频度的列表数组
  104. subSourceFrequencyList, ok := refreshDataFrequencyListMap[item.Source]
  105. if !ok {
  106. subSourceFrequencyList = make(map[int][]string)
  107. }
  108. frequencyList, ok := subSourceFrequencyList[item.SubSource]
  109. if !ok {
  110. wgNum++
  111. frequencyList = make([]string, 0)
  112. }
  113. subSourceFrequencyList[item.SubSource] = append(frequencyList, item.Frequency)
  114. refreshDataFrequencyListMap[item.Source] = subSourceFrequencyList
  115. }
  116. for source, subSourceFrequencyListMap := range refreshDataFrequencyListMap {
  117. for subSource, frequencyList := range subSourceFrequencyListMap {
  118. edbList, tmpErr := edb_refresh.GetDefaultRefreshEdbInfoListBySourceAndSubSource(source, subSource, frequencyList)
  119. if tmpErr != nil {
  120. errMsgList = append(errMsgList, fmt.Sprint("source:", source, "subSource:", subSource, "frequencyList:", strings.Join(frequencyList, ","), "err:", tmpErr.Error()))
  121. }
  122. for _, v := range edbList {
  123. // 数据刷新的期数
  124. dataRefreshNum := utils.DATA_REFRESH
  125. key := fmt.Sprintf("%d_%d_%s", v.Source, v.SubSource, v.Frequency)
  126. if edbRefreshDefaultConfig, ok := refreshDataNumMap[key]; ok {
  127. if edbRefreshDefaultConfig.RefreshAllData == 1 { // 刷新所有数据期数
  128. dataRefreshNum = 0
  129. } else if edbRefreshDefaultConfig.RefreshDataNum > 0 { //
  130. dataRefreshNum = edbRefreshDefaultConfig.RefreshDataNum
  131. }
  132. }
  133. v.DataRefreshNum = dataRefreshNum
  134. }
  135. key := fmt.Sprint(source, "_", subSource)
  136. sourceEdbInfoListMap[key] = edbList
  137. }
  138. }
  139. fmt.Println("Get Refresh End")
  140. return
  141. }
  142. // getConfigRefreshData
  143. // @Description: 根据指标配置获取需要刷新的指标列表
  144. // @author: Roc
  145. // @datetime 2024-01-10 13:55:59
  146. // @param now time.Time
  147. // @return sourceEdbInfoListMap map[string][]*edb_refresh.EdbInfoListAndRefreshConfig
  148. // @return err error
  149. func getConfigRefreshData(now time.Time) (sourceEdbInfoListMap map[string][]*edb_refresh.EdbInfoListAndRefreshConfig, err error) {
  150. defer func() {
  151. if err != nil {
  152. fmt.Println(err)
  153. }
  154. }()
  155. sourceEdbInfoListMap = make(map[string][]*edb_refresh.EdbInfoListAndRefreshConfig)
  156. currTimeStr := getPreviousHalfHour(now)
  157. // 所有默认配置刷新项
  158. list := make([]*edb_refresh.EdbRefreshConfig, 0)
  159. //刷新频率,枚举值:每自然日、每交易日、每周、每旬、每月、每季、每半年、每年
  160. refreshFrequencyList := []string{"每自然日", "每交易日", "每周", "每旬", "每月", "每季", "每半年", "每年"}
  161. // 获取各个刷新频率的配置
  162. for _, refreshFrequency := range refreshFrequencyList {
  163. // 获取刷新频率条件
  164. condition, pars, isHandler := getRefreshFrequencyCondition(now, refreshFrequency)
  165. if !isHandler {
  166. // 可能是非交易日,所以过滤不处理
  167. continue
  168. }
  169. condition += ` AND refresh_frequency = ? AND refresh_time = ?`
  170. pars = append(pars, refreshFrequency, currTimeStr)
  171. tmpList, tmpErr := edb_refresh.GetEdbRefreshConfigListByCondition(condition, pars)
  172. if tmpErr != nil {
  173. err = tmpErr
  174. return
  175. }
  176. list = append(list, tmpList...)
  177. }
  178. // 配置列表
  179. configIdEdbRefreshConfigMap := make(map[int]*edb_refresh.EdbRefreshConfig)
  180. configIdList := make([]int, 0)
  181. for _, v := range list {
  182. configIdList = append(configIdList, v.EdbRefreshConfigId)
  183. configIdEdbRefreshConfigMap[v.EdbRefreshConfigId] = v
  184. }
  185. //conf, err := models.GetBusinessConf()
  186. //if err != nil {
  187. // fmt.Println(err)
  188. // return
  189. //}
  190. // 获取钢联化工的数据获取方式
  191. //mySteelChemicalDataMethod := "excel"
  192. //if v, ok := conf["MySteelDataMethod"]; ok {
  193. // if v == "api" {
  194. // mySteelChemicalDataMethod = v
  195. // }
  196. //}
  197. // 当钢联的数据获取方式是api时,不用过滤
  198. var sourceList []int
  199. //if mySteelChemicalDataMethod == "api" {
  200. // sourceList = []int{utils.DATA_SOURCE_YS}
  201. //} else {
  202. // sourceList = []int{utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_YS}
  203. //}
  204. edbInfoList, err := edb_refresh.GetConfigRefreshEdbInfoListBySourceAndSubSource(sourceList, configIdList)
  205. if err != nil {
  206. return
  207. }
  208. for _, v := range edbInfoList {
  209. key := fmt.Sprint(v.Source, "_", v.SubSource)
  210. tmpList, ok := sourceEdbInfoListMap[key]
  211. if !ok {
  212. tmpList = make([]*edb_refresh.EdbInfoListAndRefreshConfig, 0)
  213. }
  214. // 数据刷新的期数
  215. dataRefreshNum := utils.DATA_REFRESH
  216. if edbRefreshConfig, ok2 := configIdEdbRefreshConfigMap[v.EdbRefreshConfigId]; ok2 {
  217. if edbRefreshConfig.RefreshAllData == 1 { // 刷新所有数据期数
  218. dataRefreshNum = 0
  219. } else if edbRefreshConfig.RefreshDataNum > 0 { //
  220. dataRefreshNum = edbRefreshConfig.RefreshDataNum
  221. }
  222. }
  223. v.DataRefreshNum = dataRefreshNum
  224. sourceEdbInfoListMap[key] = append(tmpList, v)
  225. }
  226. fmt.Println("Get ConfigRefreshData End")
  227. return
  228. }
  229. // BaseRefreshData
  230. // @Description: 基础数据刷新
  231. // @author: Roc
  232. // @datetime 2024-01-09 16:27:45
  233. // @param wg *sync.WaitGroup
  234. // @return err error
  235. func BaseRefreshData(wg *sync.WaitGroup, source, subSource int, items []*edb_refresh.EdbInfoListAndRefreshConfig) (err error) {
  236. errMsgList := make([]string, 0)
  237. defer func() {
  238. if err != nil {
  239. fmt.Println("来源:", source, ";子来源:", subSource, ";BaseRefreshData Err:"+err.Error())
  240. go alarm_msg.SendAlarmMsg(fmt.Sprint("来源:", source, ";子来源:", subSource, ";BaseRefreshData ErrMsg:"+err.Error()), 3)
  241. }
  242. if len(errMsgList) > 0 {
  243. errMsg := fmt.Sprint("来源:", source, ";子来源:", subSource, ";BaseRefreshData Err:"+strings.Join(errMsgList, "\n"))
  244. fmt.Println(errMsg)
  245. go alarm_msg.SendAlarmMsg(errMsg, 3)
  246. }
  247. wg.Done()
  248. }()
  249. // 数据刷新的期数
  250. dataRefreshNum := utils.DATA_REFRESH
  251. // 是否从最开始的日期更新
  252. //var isRefreshByStartDate bool
  253. for _, v := range items {
  254. // 如果暂停更新,那就过滤
  255. if v.NoUpdate == 1 {
  256. continue
  257. }
  258. if v.DataRefreshNum > 0 {
  259. dataRefreshNum = v.DataRefreshNum
  260. }
  261. startDate := ""
  262. //if isRefreshByStartDate {
  263. // startDate = v.StartDate.Format(utils.FormatDate)
  264. //} else {
  265. if v.EndDate.IsZero() {
  266. startDate = utils.BaseEdbRefreshStartDate
  267. } else {
  268. if v.Frequency == "日度" {
  269. startDate = v.EndDate.AddDate(0, 0, -dataRefreshNum).Format(utils.FormatDate)
  270. } else if v.Frequency == "周度" {
  271. startDate = v.EndDate.AddDate(0, 0, -(dataRefreshNum * 7)).Format(utils.FormatDate)
  272. } else if v.Frequency == "旬度" {
  273. startDate = v.EndDate.AddDate(0, 0, -(dataRefreshNum * 10)).Format(utils.FormatDate)
  274. } else if v.Frequency == "月度" {
  275. startDate = v.EndDate.AddDate(0, -dataRefreshNum, 0).Format(utils.FormatDate)
  276. } else if v.Frequency == "季度" {
  277. startDate = v.EndDate.AddDate(0, -dataRefreshNum*3, 0).Format(utils.FormatDate)
  278. } else if v.Frequency == "半年度" {
  279. startDate = v.EndDate.AddDate(0, -dataRefreshNum*6, 0).Format(utils.FormatDate)
  280. } else if v.Frequency == "年度" {
  281. startDate = v.EndDate.AddDate(-dataRefreshNum, 0, 0).Format(utils.FormatDate)
  282. } else {
  283. startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
  284. }
  285. }
  286. //}
  287. fmt.Println(startDate)
  288. // 数据更新
  289. resp, tmpErr := data.RefreshEdbData(v.EdbInfoId, v.Source, v.SubSource, v.EdbCode, startDate)
  290. if tmpErr != nil {
  291. errMsgList = append(errMsgList, v.EdbCode+"RefreshEdbData Err:"+tmpErr.Error())
  292. continue
  293. }
  294. if resp.Ret != 200 {
  295. errMsgList = append(errMsgList, v.EdbCode+";RefreshEdbData Err:"+resp.Msg+";ErrMsg:"+resp.ErrMsg)
  296. continue
  297. }
  298. }
  299. fmt.Println("来源:", source, ";子来源:", subSource, "刷新结束")
  300. return err
  301. }
  302. // getRefreshFrequencyCondition
  303. // @Description: 根据时间和刷新频率获取条件
  304. // @author: Roc
  305. // @datetime 2024-01-09 16:27:11
  306. // @param now time.Time
  307. // @param refreshFrequency string
  308. // @return condition string
  309. // @return pars []interface{}
  310. // @return isHandler bool
  311. func getRefreshFrequencyCondition(now time.Time, refreshFrequency string) (condition string, pars []interface{}, isHandler bool) {
  312. isHandler = true
  313. var dayNum int
  314. var isLastDay bool
  315. //刷新频率,枚举值:每自然日、每交易日、每周、每旬、每月、每季、每半年、每年
  316. switch refreshFrequency {
  317. case "每自然日":
  318. // 自然日不需要额外条件
  319. return
  320. case "每交易日":
  321. // 周六日不处理
  322. if now.Weekday() == time.Saturday || now.Weekday() == time.Sunday {
  323. isHandler = false
  324. }
  325. return
  326. case "每周":
  327. currWeekDay := now.Weekday()
  328. if currWeekDay == time.Sunday {
  329. currWeekDay = 7
  330. isLastDay = true
  331. }
  332. dayNum = int(currWeekDay)
  333. case "每旬":
  334. currDay := now.Day()
  335. if currDay <= 10 {
  336. dayNum = currDay
  337. // 如果是这旬的最后一天
  338. if currDay == 10 {
  339. isLastDay = true
  340. }
  341. } else if currDay <= 20 {
  342. dayNum = currDay - 10
  343. // 如果是这旬的最后一天
  344. if currDay == 20 {
  345. isLastDay = true
  346. }
  347. } else {
  348. dayNum = currDay - 20
  349. // 当月的最后一天
  350. monthLastDay := time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  351. // 如果是这旬的最后一天
  352. if currDay == monthLastDay.Day() {
  353. isLastDay = true
  354. }
  355. }
  356. case "每月":
  357. // 当前日期
  358. currDay := now.Day()
  359. dayNum = currDay
  360. // 当期的最后一天
  361. monthLastDay := time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  362. // 如果是这期的最后一天
  363. if currDay == monthLastDay.Day() {
  364. isLastDay = true
  365. }
  366. case "每季":
  367. // 当期的第一天 ; 当期的最后一天
  368. var startDay, endDay time.Time
  369. currMonth := now.Month()
  370. currDay := now.Day()
  371. if currMonth <= 3 {
  372. // 当季的第一天
  373. startDay = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, time.Local)
  374. // 当季的最后一天
  375. endDay = time.Date(now.Year(), 4, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  376. } else if currMonth <= 6 {
  377. // 当期的第一天
  378. startDay = time.Date(now.Year(), 4, 1, 0, 0, 0, 0, time.Local)
  379. // 当期的最后一天
  380. endDay = time.Date(now.Year(), 7, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  381. } else if currMonth <= 9 {
  382. // 当期的第一天
  383. startDay = time.Date(now.Year(), 7, 1, 0, 0, 0, 0, time.Local)
  384. // 当期的最后一天
  385. endDay = time.Date(now.Year(), 10, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  386. } else {
  387. // 当期的第一天
  388. startDay = time.Date(now.Year(), 10, 1, 0, 0, 0, 0, time.Local)
  389. // 当期的最后一天
  390. endDay = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  391. }
  392. // 计算这期的第一天和当日的天数
  393. dayNum = utils.GetTimeSubDay(startDay, now) + 1
  394. // 如果是这期的最后一天
  395. if currMonth == endDay.Month() && currDay == endDay.Day() {
  396. isLastDay = true
  397. }
  398. case "每半年":
  399. // 当期的第一天 ; 当期的最后一天
  400. var startDay, endDay time.Time
  401. currMonth := now.Month()
  402. currDay := now.Day()
  403. if currMonth <= 6 {
  404. // 当期的第一天
  405. startDay = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, time.Local)
  406. // 当期的最后一天
  407. endDay = time.Date(now.Year(), 7, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  408. } else {
  409. // 当期的第一天
  410. startDay = time.Date(now.Year(), 7, 1, 0, 0, 0, 0, time.Local)
  411. // 当期的最后一天
  412. endDay = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  413. }
  414. // 计算这期的第一天和当日的天数
  415. dayNum = utils.GetTimeSubDay(startDay, now) + 1
  416. // 如果是这期的最后一天
  417. if currMonth == endDay.Month() && currDay == endDay.Day() {
  418. isLastDay = true
  419. }
  420. case "每年":
  421. currMonth := now.Month()
  422. currDay := now.Day()
  423. // 当期的第一天
  424. startDay := time.Date(now.Year(), 1, 1, 0, 0, 0, 0, time.Local)
  425. // 当期的最后一天
  426. endDay := time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, time.Local).AddDate(0, 0, -1)
  427. // 计算这期的第一天和当日的天数
  428. dayNum = utils.GetTimeSubDay(startDay, now) + 1
  429. // 如果是这期的最后一天
  430. if currMonth == endDay.Month() && currDay == endDay.Day() {
  431. isLastDay = true
  432. }
  433. }
  434. // 如果是这期的最后一天,那么就是判断refresh_frequency_day是否配置为0,或者配置的天数大于这期的最大天数
  435. if isLastDay {
  436. condition += ` AND ( refresh_frequency_day = ? OR refresh_frequency_day >= ? )`
  437. pars = append(pars, 0, dayNum)
  438. } else {
  439. // 如果不是这期的最后一天,那么就是判断refresh_frequency_day是否等于配置的天数
  440. condition += ` AND refresh_frequency_day = ? `
  441. pars = append(pars, dayNum)
  442. }
  443. return
  444. }
  445. // getPreviousHalfHour
  446. // @Description: 根据传入的时间获取该时间的前整半小时的时间字符串
  447. // @author: Roc
  448. // @datetime 2024-01-09 14:27:34
  449. // @param now time.Time
  450. // @return string
  451. func getPreviousHalfHour(now time.Time) string {
  452. minute := now.Minute()
  453. if minute >= 30 {
  454. return fmt.Sprintf("%02d:%02d", now.Hour(), 30)
  455. }
  456. return fmt.Sprintf("%02d:%02d", now.Hour(), 0)
  457. }
  458. // ConfigRefreshDataGn 根据配置刷新指标数据
  459. func ConfigRefreshDataGn(cont context.Context) (err error) {
  460. errMsgList := make([]string, 0)
  461. defer func() {
  462. if err != nil {
  463. fmt.Println(err)
  464. }
  465. }()
  466. now := time.Now()
  467. //now = time.Date(2023, 12, 31, 16, 50, 59, 0, time.Local)
  468. defaultSourceEdbInfoListMap, err := getDefaultRefreshData(now)
  469. if err != nil {
  470. errMsgList = append(errMsgList, "获取默认刷新数据失败,Err:"+err.Error())
  471. }
  472. sourceEdbInfoListMap, err := getConfigRefreshData(now)
  473. if err != nil {
  474. errMsgList = append(errMsgList, "获取指标配置刷新数据失败,Err:"+err.Error())
  475. }
  476. // 将两个合并
  477. allSourceEdbInfoListMap := mergeMaps(defaultSourceEdbInfoListMap, sourceEdbInfoListMap)
  478. wgNum := len(allSourceEdbInfoListMap)
  479. if wgNum <= 0 {
  480. return
  481. }
  482. wg := sync.WaitGroup{}
  483. wg.Add(wgNum)
  484. for _, edbList := range allSourceEdbInfoListMap {
  485. if edbList == nil {
  486. wg.Done()
  487. continue
  488. }
  489. if len(edbList) != 0 {
  490. go BaseRefreshData(&wg, edbList[0].Source, edbList[0].SubSource, edbList)
  491. }
  492. }
  493. wg.Wait()
  494. fmt.Println("Refresh End")
  495. return
  496. }