notice_task.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package message
  2. import (
  3. <<<<<<< Updated upstream
  4. logger "eta_mini_ht_api/common/component/log"
  5. "eta_mini_ht_api/common/contants"
  6. "eta_mini_ht_api/domian/financial_analyst"
  7. "eta_mini_ht_api/models/eta"
  8. "eta_mini_ht_api/task/base"
  9. =======
  10. <<<<<<< Updated upstream
  11. logger "eta/eta_mini_ht_api/common/component/log"
  12. "eta/eta_mini_ht_api/common/contants"
  13. "eta/eta_mini_ht_api/domian/financial_analyst"
  14. "eta/eta_mini_ht_api/models/eta"
  15. "eta/eta_mini_ht_api/task/base"
  16. >>>>>>> Stashed changes
  17. "fmt"
  18. "github.com/google/uuid"
  19. =======
  20. logger "eta_mini_ht_api/common/component/log"
  21. "eta_mini_ht_api/common/contants"
  22. "eta_mini_ht_api/domian/financial_analyst"
  23. userService "eta_mini_ht_api/domian/user"
  24. "eta_mini_ht_api/models/eta"
  25. "eta_mini_ht_api/task/base"
  26. >>>>>>> Stashed changes
  27. "sync"
  28. )
  29. var (
  30. taskName base.TaskType = "NoticeTask"
  31. cron = "0/5 * * * * *"
  32. )
  33. // Execute Task ETA取研报的数据
  34. func (au *AuthorTask) Execute(taskDetail *base.TaskDetail) error {
  35. logger.Info(contants.TaskFormat, "监听更新通知开始")
  36. metaInfoList := userService.getInitMetaInfos()
  37. //报告和媒体
  38. var wg sync.WaitGroup
  39. wg.Add(2)
  40. <<<<<<< Updated upstream
  41. UUID := uuid.New()
  42. uuidStr := UUID.String()
  43. timeBefore := time.Now().Add(-duration)
  44. fmt.Printf("监听更新通知开始:%v", timeBefore)
  45. //监听报告
  46. go func(uuid string) {
  47. defer wg.Done()
  48. //list := reportService.GetNewReportByPublishTime(timeBefore)
  49. // users := userService.GetNoticeUsersByReports(list)
  50. }(uuidStr)
  51. //监听媒体
  52. go func(uuid string) {
  53. defer wg.Done()
  54. }(uuidStr)
  55. wg.Wait()
  56. <<<<<<< Updated upstream
  57. =======
  58. =======
  59. >>>>>>> Stashed changes
  60. >>>>>>> Stashed changes
  61. return nil
  62. }
  63. type AuthorTask struct {
  64. }
  65. func convert(author eta.ReportAuthor) financial_analyst.FinancialAnalystDTO {
  66. return financial_analyst.FinancialAnalystDTO{
  67. Deleted: author.IsDelete,
  68. ETAId: author.Id,
  69. Name: author.ReportAuthor,
  70. Status: author.Enable,
  71. }
  72. }
  73. func init() {
  74. authorTask := base.NewTask(taskName, cron, new(AuthorTask), base.PROD)
  75. base.RegisterTask(&authorTask)
  76. }