package com.yueqian.xingyun.settle.excel.check.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.CustomerSettleCheckSheet;
import com.yueqian.xingyun.settle.service.CustomerSettleCheckSheetService;
import com.yueqian.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo;

public class CustomerSettleCheckSheetExportTaskWorker implements
    ExportTaskWorker<QueryCustomerSettleCheckSheetVo, CustomerSettleCheckSheet, CustomerSettleCheckSheetExportModel> {

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

  @Override
  public PageResult<CustomerSettleCheckSheet> getDataList(int pageIndex, int pageSize,
      QueryCustomerSettleCheckSheetVo params) {

    CustomerSettleCheckSheetService customerSettleCheckSheetService = ApplicationUtil.getBean(
        CustomerSettleCheckSheetService.class);

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

  @Override
  public CustomerSettleCheckSheetExportModel exportData(CustomerSettleCheckSheet data) {
    return new CustomerSettleCheckSheetExportModel(data);
  }

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