data_stat_run.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. from model.DateUtils import DateUtils
  2. import logging
  3. from model.DingTalkUtils import DingTalkUtils
  4. from app.etl.data_stat_task import *
  5. from app.etl.sync_to_ck_task import *
  6. from app.etl.dm.dm_pitcher_daily_overview import dm_pitcher_daily_overview
  7. from app.etl.dw.dw_channel_daily import dw_channel_daily
  8. from app.etl.dw.dw_pitcher_daily import dw_pitcher_trend
  9. from app.etl.src.src_book_info import src_book_info
  10. from app.etl.dw.dw_book_trend import book_trend
  11. from app.etl.src import book_annual_expect_profit
  12. du = DateUtils()
  13. logger = logging.getLogger("")
  14. # logger.setLevel(logging.ERROR)
  15. # logging.getLogger().setLevel(logging.WARNING)
  16. def do_order(st, et):
  17. for i in du.getDateLists(st, et):
  18. print(i)
  19. order_sync_ck(i)
  20. def do_cost(st, et):
  21. for i in du.getDateLists(st, et):
  22. print(i)
  23. channel_by_account_daily(i)
  24. channel_info_daily(i)
  25. dw_daily_channel_cost(i)
  26. def main(st, et):
  27. try:
  28. do_order(st, et)
  29. do_cost(st, et)
  30. src_book_info() # 书籍卡点信息
  31. # book_annual_expect_profit.run() # 年预期收益
  32. dw_channel_daily()
  33. dw_pitcher_trend()
  34. book_trend()
  35. dm_pitcher_daily_overview()
  36. except Exception as e:
  37. print(e)
  38. DingTalkUtils.send("hourlyRun fail!! " + str(e), '15168342316')
  39. def hourly():
  40. thedate = du.getTodayOrYestoday()
  41. main(thedate, thedate)
  42. def daily():
  43. "往前跑10天"
  44. st = du.get_n_days(-10)
  45. et = du.get_n_days(-1)
  46. do_order(st, et)
  47. do_cost(st, et)
  48. if __name__ == '__main__':
  49. hourly()
  50. # daily()
  51. # daily('2021-06-30','2021-07-04')
  52. # do_order('2021-05-30', '2021-06-29')