# 导出数据异步任务执行
ExportService::Service.get_entity_exporter(org, member_or_id, entity_name, options).export
class ExportService::Service
class << self
def get_entity_exporter(org, member_or_id, entity_name, options)
case entity_name
when 'SaleOrderReport'
ExportService::SaleOrderReportExporter.new(member_or_id, options)
when ''
#...
end
end
end
end
module ExportService
class SaleOrderReportExporter < BaseExporter
#...
end
end
class BaseExporter
include ExportService::Base
#...
end
module ExportService
module Base
def export
#...
send_complete_message
end
def send_complete_message
send_message(handle: 'exported', remark: '导出成功', row_index: @current_page, href: "/exporter/download?path=#{@completed_filename}&entity_name=#{entity_klass}" )
end
def send_message(message)
ActionCable.server.broadcast @broadcast, message if message.present?
end
end
end