package com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.EkpInsurancesInfo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp.EkpSettleMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

/**
 * @author zhaji
 * @description TODO
 * @date 2022-08-26 09:25:51
 */
@Service
public class EkpSettleServiceImpl implements EkpSettleService {

	@Resource
	EkpSettleMapper ekpSettleMapper;
	@Override
	public SettleVo getSettle(String id) {
		return ekpSettleMapper.getSettle(id);
	}

	@Override
	public DeptSettleVo getDeptSettle(String id) {
		return ekpSettleMapper.getDeptSettle(id);
	}

	@Override
	public EkpInsuranceDeptInfoVo getInsuranceEkpDeptInfo(String deptNo) {
		return ekpSettleMapper.getInsuranceEkpDeptInfo(deptNo);
	}
	@Override
	public Map<String, EkpInsuranceDeptInfoVo> getEkpDeptInfoByDeptNo(List<String> deptNoList) {
		List<EkpInsuranceDeptInfoVo> list = ekpSettleMapper.getEkpDeptInfoByDeptNo(deptNoList);
		Map<String, EkpInsuranceDeptInfoVo> returnMap = new HashMap<>();
		if (list != null && !list.isEmpty()) {
			for (EkpInsuranceDeptInfoVo vo : list) {
				returnMap.put(vo.getDeptNo(), vo);
			}
		}
		return returnMap;
	}

	@Override
	public DeptSettleVo getDeptYgSettle(String id) {
		return ekpSettleMapper.getDeptYgSettle(id);
	}

	@Override
	public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String id) {
		return ekpSettleMapper.getSettleStatusFromEkpInsuranceDetail(id);
	}

	@Override
	public List<EkpInsuranceViewVo> selectViewBySettleNo(String settleNo,String payFlag) {
		return ekpSettleMapper.selectSettleStatusBySettleNo(settleNo,payFlag);
	}

	@Override
	public List<EkpSocialViewVo> selectSocialViewBySettleNo(String settleNo, String payFlag) {
		return ekpSettleMapper.selectSocialViewStatusBySettleNo(settleNo,payFlag);
	}

	@Override
	public List<EkpSocialViewVo> selectFundViewBySettleNo(String settleNo,String payFlag) {
		return ekpSettleMapper.selectFundViewBySettleNo(settleNo,payFlag);
	}

	@Override
	public List<EkpInsuranceViewVo> selectFIncomelViewBySettleNo(String settleNo) {
		return ekpSettleMapper.selectFIncomelViewBySettleNo(settleNo);
	}

	@Override
	public List<EkpInsuranceViewVo> selectIncomelViewBySettleNo(String settleNo) {
		return ekpSettleMapper.selectIncomeViewBySettleNo(settleNo);
	}

	@Override
	public List<EkpSocialViewVo> selectSalarylViewBySettleNo(String settleNo,String payFlag) {
		return ekpSettleMapper.selectSalarylViewBySettleNo(settleNo,payFlag);
	}

	@Override
	public boolean saveBatch(Collection<TInsuranceTypeRate> entityList, int batchSize) {
		return false;
	}

	@Override
	public boolean saveOrUpdateBatch(Collection<TInsuranceTypeRate> entityList, int batchSize) {
		return false;
	}

	@Override
	public boolean updateBatchById(Collection<TInsuranceTypeRate> entityList, int batchSize) {
		return false;
	}

	@Override
	public boolean saveOrUpdate(TInsuranceTypeRate entity) {
		return false;
	}

	@Override
	public TInsuranceTypeRate getOne(Wrapper<TInsuranceTypeRate> queryWrapper, boolean throwEx) {
		return null;
	}

	@Override
	public Map<String, Object> getMap(Wrapper<TInsuranceTypeRate> queryWrapper) {
		return null;
	}

	@Override
	public <V> V getObj(Wrapper<TInsuranceTypeRate> queryWrapper, Function<? super Object, V> mapper) {
		return null;
	}

	@Override
	public BaseMapper<TInsuranceTypeRate> getBaseMapper() {
		return null;
	}

	@Override
	public Class<TInsuranceTypeRate> getEntityClass() {
		return null;
	}

	@Override
	public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetailAsso(String id) {
		return ekpSettleMapper.getSettleStatusFromEkpAsso(id);
	}
	@Override
	public List<EkpSettleStatusVo> getSettleStatusFromEkpAssoByIds(List<String> ids) {
		return ekpSettleMapper.getSettleStatusFromEkpAssoByIds(ids);
	}

	@Override
	public void deleteEkpInsuranceDetail(String id) {
		//删除商险明细数据
		ekpSettleMapper.deleteEkpInsuranceDetail(id);
	}

	@Override
	public void deleteEkpManagerInfo(String id) {
		//删除管理费明细数据
		ekpSettleMapper.deleteEkpManagerInfo(id);
	}

	@Override
	public void deleteEkpEkpRiskInfo(String id) {
		//删除风险金明细数据
		ekpSettleMapper.deleteEkpEkpRiskInfo(id);
	}

	@Override
	public List<EkpSettleStatusVo> getBalanceByInsuranceId(String id) {
		return ekpSettleMapper.getBalanceByInsuranceId(id);
	}

	/**
	 * @Author fxj
	 * @Description 见费出单直接删除实缴及实缴与预估的差额
	 * @Date 17:28 2026/1/21
	 * @Param
	 * @return
	**/
	@Override
	public void deleteEkpInsuranceDetailAsso(String id) {
		ekpSettleMapper.deleteEkpInsuranceDetailAsso(id);
	}

	/**
	 * @Author fxj
	 * @Description 见费出单直接删除实缴与预估的差额
	 * @Date 15:45 2026/1/22
	 * @Param
	 * @return
	**/
	@Override
	public void callBackBalance(String id) {
		ekpSettleMapper.callBackBalance(id);
	}
}
