package com.engine.salary.service;

import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.util.page.PageInfo;

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

/**
 * 薪资核算结果
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public interface SalaryAcctResultService {

    /**
     * 根据薪资核算记录的id查询薪资核算结果
     *
     * @param salaryAcctRecordIds 薪资核算记录的id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);

    /**
     * 根据薪资核算人员的主键id查询薪资核算结果
     *
     * @param salaryAcctEmployeeId 薪资核算人员的主键id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctEmployeeId(Long salaryAcctEmployeeId);

    /**
     * 根据薪资核算人员的主键id查询薪资核算结果
     *
     * @param salaryAcctEmployeeIds 薪资核算人员的主键id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds);

    /**
     * 根据薪资核算id、人员id查询薪资核算结果
     *
     * @param salaryAcctRecordIds 薪资核算记录id
     * @param employeeIds         人员id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndEmployeeIds(Collection<Long> salaryAcctRecordIds, Collection<Long> employeeIds);

    /**
     * 根据薪资核算人员的主键id查询薪资核算结果
     *
     * @param salaryAcctEmployeeId 薪资核算人员的主键id
     * @return
     */
    SalaryAcctResultDetailDTO getBySalaryAcctEmployeeId(Long salaryAcctEmployeeId);

    /**
     * 根据薪资核算结果列表查询条件查询薪资核算结果（分页）
     *
     * @param queryParam 列表查询条件
     * @return
     */
    PageInfo<Map<String, Object>> listPageByParam(SalaryAcctResultQueryParam queryParam);

    /**
     * 合计行
     *
     * @param queryParam
     * @return
     */
    Map<String, Object> sumRow(SalaryAcctResultQueryParam queryParam);

    /**
     * 根据薪资核算结果列表查询条件查询薪资核算结果
     *
     * @param queryParam 列表查询条件
     * @return
     */
    List<Map<String, Object>> listByParam(SalaryAcctResultQueryParam queryParam);

    /**
     * 获取合并计税详情
     *
     * @param salaryAcctEmployeeId 薪资核算人员
     * @return
     */
    ConsolidatedTaxDetailDTO getConsolidatedTaxDetail(Long salaryAcctEmployeeId);

    /**
     * 根据薪资核算记录id获取表头数据
     *
     * @param salaryAcctRecordId
     * @return
     */
    Map<String, SalaryAcctResultListColumnDTO> getColumnBySalaryAcctRecordId(Long salaryAcctRecordId);

    /**
     * 保存
     *
     * @param saveParam 保存参数
     */
    void save(SalaryAcctResultSaveParam saveParam);

    /**
     * 批量保存
     *
     * @param salaryAcctResultPOS 薪资核算结果
     */
    void batchSave(List<SalaryAcctResultPO> salaryAcctResultPOS);

    /**
     * 根据薪资核算人员id删除薪资核算结果
     *
     * @param salaryAcctEmployeeIds 薪资核算人员id
     */
    void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds);


    /**
     * 根据薪资核算人员id、薪资项目id删除薪资核算结果
     *
     * @param salaryAcctEmployeeIds 薪资核算人员id
     * @param salaryItemIds         薪资项目id
     */
    void deleteByAcctEmployeeIdsAndSalaryItemIds(List<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds);

    /**
     * 根据薪资核算记录id删除薪资核算结果
     *
     * @param salaryAcctRecordIds 薪资核算记录id
     */
    void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);

    /**
     * 薪资核算
     *
     * @param calculateParam
     * @param simpleEmployee
     */
    void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee);

    /**
     * 根据薪资核算记录的id、个税扣缴义务人查询薪资核算结果
     *
     * @param salaryAcctRecordIds 薪资核算记录的id
     * @param taxAgentIds         个税扣缴义务人id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds);

    /**
     * 更新锁定状态
     *
     * @param updateParam
     */
    void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam);

    /**
     * 批量更新
     *
     * @param salaryAcctResultValues
     */
    void batchUpdateOriginResultValue(List<SalaryAcctResultPO> salaryAcctResultValues);

    /**
     * @description 薪资回算
     * @return void
     * @author Harryxzy
     * @date 2022/11/24 20:26
     */
    void reCalc(Long id);

    /**
     * 根据薪资核算记录的id、薪资项目id查询薪资核算结果
     *
     * @param salaryAcctRecordIds 薪资核算记录的id
     * @param salaryItemIds       薪资项目id
     * @return
     */
    List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndSalaryItemIds(Collection<Long> salaryAcctRecordIds, Collection<Long> salaryItemIds);

    /**
     * @description 根据薪资核算人员id、薪资项目id获取薪资核算结果
     * @return List<SalaryAesultPO>
     * @author Harryxzy
     * @date 2022/12/26 22:24
     */
    List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(List<Long> salaryAcctEmpIds, Collection<Long> salaryItemIds);

    List<Long> listAcctEmpIdByAcctEmpId(List<Long> salaryAcctEmployeeIds);

    /**
     * 检查当前用户是否有查看权限
     * @param salaryAcctRecordId
     * @return
     */
    Boolean checkAuth(Long salaryAcctRecordId);

    /**
     * 薪资核算结果批量更新
     * @param param
     */
    void batchUpdate(SalaryAcctResultBatchUpdateParam param);
}
