package com.yueqian.xingyun.settle.excel.sheet.customer;

import com.lframework.starter.web.core.components.resp.PageResult;
import com.lframework.starter.web.core.utils.ApplicationUtil;
import com.lframework.starter.web.core.utils.JsonUtil;
import com.lframework.starter.mq.core.components.export.ExportTaskWorker;
import com.yueqian.xingyun.settle.entity.CustomerSettleSheet;
import com.yueqian.xingyun.settle.service.CustomerSettleSheetService;
import com.yueqian.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo;

public class CustomerSettleSheetExportTaskWorker implements
    ExportTaskWorker<QueryCustomerSettleSheetVo, CustomerSettleSheet, CustomerSettleSheetExportModel> {

  @Override
  public QueryCustomerSettleSheetVo parseParams(String json) {
    return JsonUtil.parseObject(json, QueryCustomerSettleSheetVo.class);
  }

  @Override
  public PageResult<CustomerSettleSheet> getDataList(int pageIndex, int pageSize,
      QueryCustomerSettleSheetVo params) {

    CustomerSettleSheetService customerSettleSheetService = ApplicationUtil.getBean(
        CustomerSettleSheetService.class);

    return customerSettleSheetService.query(pageIndex, pageSize, params);
  }

  @Override
  public CustomerSettleSheetExportModel exportData(CustomerSettleSheet data) {
    return new CustomerSettleSheetExportModel(data);
  }

  @Override
  public Class<CustomerSettleSheetExportModel> getModelClass() {
    return CustomerSettleSheetExportModel.class;
  }
}
