package com.engine.salary.service;

import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam;
import com.engine.salary.entity.siarchives.param.SIArchiveBaseHistoryListParam;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.util.*;

/**
 * @Author weaver_cl
 * 
 * @Date 2022/3/11
 * @Version V1.0
 **/
public interface SIArchivesService {

    Map<String, Object> getTips(Map<String, Object> params);

    Map<String, Object> getBaseForm(Map<String, Object> params);

    Map<String, Object> getPaymentForm(Map<String, Object> params);

    String insert(InsuranceArchivesSaveParam param);

    Map<String, Object> listPage(InsuranceArchivesListParam insuranceArchivesListParam);

    Map<String,Object> getSearchCondition(Map<String, Object> stringObjectMap);

    /**
     * 根据高级搜索框或者员工id集合导出档案
     *
     * @param param      请求报文
     * @return map
     */
    XSSFWorkbook export(InsuranceArchivesListParam param);


    /**
     * 获取员工的基本信息
     * <p>
     * 此处主要是一个公共接口，有多处引用。我们薪资系统只保存员工id（employeeId），
     * 但是页面上需要展示员工的更多信息（姓名，部门，状态。。。），
     * 所以这里主要是用于接收联表数据的一个接口
     *
     * @param param      高级搜索条件，用于过滤数据
     * @return list
     */
    List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param);

    /**
     * 获取福利档案各tab总人数
     */
    Map<String, Long> queryInsuranceTabTotal();

    /**
     * 批量变更档案列表的runStatus
     */
    void updateRunStatus(InsuranceArchivesBaseInfoPO po);

    /**
     * 批量取消停缴
     */
    void cancelStopPayment(Collection<Long> ids);

    /**
     * 批量减员
     */
    Map<String, Object> stayDelToStop(Collection<Long> ids);

    /**
     * 批量减员，直接减员，并给予最后缴纳月
     */
    Map<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth);

    /**
     * 全量减员
     */
    Map<String, Object> allStayDelToStop();

    /**
     * 全量增员
     */
    Map<String, Object> allStayAddToPay();

    /**
     * 批量增员
     */
    Map<String, Object> stayAddToPay(Collection<Long> ids);

    /**
     * 拷贝福利档案到新的个税扣缴义务人并置为在缴
     * @param toCopyTaxAgentId 被拷贝的福利档案所属个税扣缴义务人id
     * @param toUpdateTaxAgentId 被更新的福利档案所属个税扣缴义务人id
     * @param employeeId 福利档案所属人员id
     * @return
     */
    Map<String, Object> copyToPay(Long toCopyTaxAgentId, Long toUpdateTaxAgentId, Long employeeId, String payStartYearMonth);

    /**
     * 待减员页面的删除待办
     */
    void cancelStayDel(InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO);

    /**
     * 处理福利档案增量数据
     */
    void handleChangeData(long currentEmployeeId);

    /**
     * 删除档案
     * @param longs
     */
    void deleteArchive(Collection<Long> longs);

    void handleStayDelData(long currentEmployeeId);

    PageInfo<InsuranceArchivesBaseHistoryDTO> getAdjustHistoryList(SIArchiveBaseHistoryListParam param);

    PageInfo<InsuranceArchivesBaseHistoryDTO> historyListByEmployeeIdAndOperator(SIArchiveBaseHistoryListParam param);

    List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS);

    List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS);

    boolean isDiffWelBase();

    List<Long> payInsuranceIds(Long socialSchemeId, Integer paymentScope);

    List<Long> payInsuranceIds(Long socialSchemeId);

    List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeIds(List<Long> employeeIds);
    List<InsuranceArchivesFundSchemePO> getFundByEmployeeIds(List<Long> employeeIds);
    List<InsuranceArchivesOtherSchemePO> getOtherByEmployeeIds(List<Long> employeeIds);

    Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids, Long paymentOrganization);

    Boolean checkWelBaseLimit(Long primaryId, String paymentBaseString, Integer paymentScope);

    String checkAndBuildWelBaseWithLimit(Long primaryId, String paymentBaseString, Integer paymentScope);

    List<InsuranceArchivesBaseHistoryPO> dealSocialBaseAdjustInfoList(List<InsuranceArchivesSocialSchemePO> adjustList, Long creator);
    List<InsuranceArchivesBaseHistoryPO> dealFundBaseAdjustInfoList(List<InsuranceArchivesFundSchemePO> adjustList, Long creator);
    List<InsuranceArchivesBaseHistoryPO> dealOtherBaseAdjustInfoList(List<InsuranceArchivesOtherSchemePO> adjustList, Long creator);

    void batchInsertAdjustHistory(List<InsuranceArchivesBaseHistoryPO> adjustHistoryList);

    List<InsuranceArchivesBaseInfoPO> listEndDateIsNull(List<Long> employeeIds);

    List<InsuranceArchivesBaseInfoPO> listStartDateIsNull(List<Long> employeeIds);

    List<InsuranceArchivesSocialSchemePO> listInsuranceArchivesSocialSchemeByIds(List<Long> ids);

    List<InsuranceArchivesFundSchemePO> listInsuranceArchivesFundSchemeByIds(List<Long> ids);

    List<InsuranceArchivesOtherSchemePO> listInsuranceArchivesOtherSchemeByIds(List<Long> ids);
}
