package com.engine.salary.service;

import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @Author weaver_cl
 * 
 * @Date 2022/4/11
 * @Version V1.0
 **/
public interface SIAccountService {

    /**
     * 查询台账列表
     * @param insuranceAccountBatchParam
     * @return
     */
    Map<String,Object> listPage(InsuranceAccountBatchParam insuranceAccountBatchParam);

    /**
     * 获取正常缴纳列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object> listCommonPage(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 根据姓名名获取正常缴纳列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object>  listCommonPageByName(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 获取补缴缴纳列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object> listSupplementaryPage(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 获取退差列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object> listRecessionPage(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 获取补差列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object> listBalancePage(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 根据姓名获取补缴缴纳列表
     * @param insuranceAccountDetailParam
     * @return
     */
    Map<String,Object> supplementaryByNameList(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 获取核算月份备注填写表单
     * @param params
     * @return
     */
    Map<String, Object> getForm(Map<String, Object> params);

    /**
     * 保存并进入核算
     * @param param
     */
    String save(AccountParam param);

    /**
     * 新建核算并归档
     * @param param
     * @return
     */
    String saveAndFile(AccountParam param);

    /**
     * 正常缴纳页核算
     * @param saveCommonAccountParam
     */
    void commonAccount(SaveCommonAccountParam saveCommonAccountParam);

    /**
     * 删除月份表单
     * @param accountParam
     */
    void delete(AccountParam accountParam);

    /**
     * 添加正常缴纳人员
     * @param accountParam
     */
    void saveCommonAccount(SaveCommonAccountParam accountParam);

    /**
     * 添加补缴人员
     * @param saveSupplementaryAccountParam
     */
    void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam);

    /**
     * 删除正常缴纳人员
     * @param accountParam
     */
    void deleteCommonAccount(SaveCommonAccountParam accountParam);

    /**
     * 删除补缴人员
     * @param param
     */
    void deleteSupplementaryAccount(SaveCommonAccountParam param);

    /**
     * 台账归档
     * @param accountParam
     */
    void file(AccountParam accountParam);

    /**
     * 重置核算异常
     * @param ids
     */
    void unconfirmed(Collection<Long> ids);


    /**
     * 获取核算异常列表页是否导出档案开关
     * @param billMonth
     */
    Map<String, Boolean> buttonCheck(String billMonth);


    /**
     * 忽略核算异常
     * @param longs
     */
    void ignore(Collection<Long> longs);

    /**
     * tab信息
     */
    InsuranceAccountTabDTO tabList(AccountParam build);

    /**
     * 人员异动
     * @param insuranceAccountDetailParam
     */
    Map<String,Object> changeList(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 核算核算异常，重新核算
     * @param inspectAccountParam
     */
    void accountInspect(InspectAccountParam inspectAccountParam);

    /**
     * 核算失败列表
     * @param param
     */
    Map<String,Object> getInspectTable(InsuranceAccountDetailParam param);



    /**
     * 正常缴纳添加缴纳人员表单
     * @param params
     * @return
     */
    Map<String,Object> getCommonForm(Map<String, Object> params);


    /**
     * 补缴添加缴纳人员表单
     * @param params
     * @return
     */
    Map<String,Object> getSupplementaryForm(Map<String, Object> params);

    /**
     * 总览
     * @param param
     * @return
     */
    PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam param);

    /**
     * 根据字段名提供对应的数据，给账套使用
     *
     * @param billMonth
     * @param employeeIds
     * @return
     */
    List<Map<String, Object>> welfareData(String billMonth, List<Long> employeeIds,Long taxAgentId);

    /**
     * 给套账提供字段名对应字段释义
     *
     * @return
     */
    Map<String, String> welfareColumns();

    /**
     * 根据条件获取所有的核算异常明细
     *
     * @param ids
     * @return
     */
    List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth);

    Collection<TaxAgentPO> getAdminTaxAgentList();

    void socialSecurityBenefitsRecalculate(InsuranceAccountBatchPO param);


    /**
     * 导出“福利核算导入模板”
     */
    XSSFWorkbook exportImportTemplate(InsuranceAcctDetailImportTemplateParam param);

    /**
     * 将福利核算模板导入的数据更新到数据库
     */
    Map<String, Object> importInsuranceAcctDetail(InsuranceAcctImportParam insuranceAcctImportParam);

    /**
     * 预览“福利核算导入”模板导入的数据
     */
    Map<String, Object> preview(InsuranceAcctImportParam insuranceAcctImportParam);

    /**
     * 导出“福利核算-补缴导入模板”
     */
    XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param);

    /**
     * 导出“福利核算-线下对比导入模板”
     */
    XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param);

    /**
     * 将通过“福利核算-线下对比导入”模板导入的数据更新到hrsa_excel_bill_detail表中
     */
    Map<String, Object> importExcelInsuranceDetail(ExcelInsuranceImportParam excelInsuranceImportParam);

    /**
     * 刷新_bill_batch表中的统计信息
     */
    void refreshBillBatch(Long paymentOrganization, String billMonth);

    /**
     * 将通过id获取InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据
     */
    Map<String, Object> getPaymentById(Long id);

    /**
     * 编辑InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据
     */
    void editAccount(EditAccountDetailParam param);

    /**
     * 导出“福利核算-补差导入模板”
     */
    XSSFWorkbook exportBalanceImportTemplate(InsuranceAcctDetailImportTemplateParam param);

    /**
     * 将福利台账-补差模板导入的数据更新到数据库
     */
    Map<String, Object> importBalanceInsuranceDetail(InsuranceAcctImportParam importParam);


    /**
     * 正常缴纳合计行
     *
     * @param queryParam
     * @return
     */
    Map<String, Object> listCommonSum(InsuranceAccountDetailParam queryParam);

    /**
     * 补缴合计行
     * @param insuranceAccountDetailParam
     */
    Map<String, Object> listSupplementarySum(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 退差合计列
     * @param insuranceAccountDetailParam
     */
    Map<String, Object> listRecessionSum(InsuranceAccountDetailParam insuranceAccountDetailParam);

    /**
     * 补差合计列
     * @param insuranceAccountDetailParam
     */
    Map<String, Object> listBalanceSum(InsuranceAccountDetailParam insuranceAccountDetailParam);

    boolean checkBalance(InsuranceAccountDetailPO po);

    boolean checkBalancePayInsurance(InsuranceAccountDetailPO po);

    List<InsuranceAccountViewListDTO> buildRecords(List<InsuranceAccountDetailPO> list, Map<Long, TaxAgentPO> paymentMap);

    void cacheWelfareField(List<String> welfareNames);

    void cacheBalanceWelfareField(List<String> welfareNames);
}

