package cn.superdesk.uniorder.service.invoice.customer;

import cn.superdesk.uniorder.common.enums.common.CommonBeRelatedEnum;
import cn.superdesk.uniorder.common.enums.accounting.AccountingOrderTypeDimEnum;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.invoice.customer.InvoiceApplyXGoods;
import com.github.pagehelper.PageInfo;

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


/**
 * @Description: 客户结算 积分结算 | 开票申请 X 订单 X 商品 X 流水 | 作了兼容 dim
 * @Author: linjinyu
 * @CreateDate: 7/29/20 5:30 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/29/20 5:30 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public interface InvoiceApplyXGoodsService {

	/****************************************** extends BaseService 部分 start ******************************************/

	@Deprecated
	void addObj(InvoiceApplyXGoods entity);

	@Deprecated
	void updateObj(InvoiceApplyXGoods entity);

	@Deprecated
	void deleteObj(Long id);

	@Deprecated
	InvoiceApplyXGoods findById(Long id);

	@Deprecated
	PageInfo<InvoiceApplyXGoods> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize);

	@Deprecated
	List<InvoiceApplyXGoods> findAll(Map<String, Object> queryMap);

	/****************************************** extends BaseService 部分   end ******************************************/


	void addInvoiceApplyXGoods(InvoiceApplyXGoods entity);

	int insertBatch(List<InvoiceApplyXGoods> processList);

	void updateInvoiceApplyXGoods(InvoiceApplyXGoods entity);

	void deleteInvoiceApplyXGoods(Long id);

	int dumpXByInvoiceApplyId(Long invoiceApplyId);

	InvoiceApplyXGoods findInvoiceApplyXGoodsById(Long id);

	R<List<InvoiceApplyXGoods>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize);


	/****************************************** 工具方法 start ******************************************/

	/**
	 * 根据发票申请Id 获取 关联 积分流水 ids 集合
	 *
	 * @param invoiceApplyId
	 * @return
	 */
	List<Long> findCreditSetByInvoicApplyId(Long invoiceApplyId);

	/**
	 * 根据对账单Id 获取 关联 开票申请 ids 集合
	 *
	 * @param accountingOrderId
	 * @param accountingOrderTypeDimEnum
	 * @return
	 */
	List<Long> findInvoiceApplySetByAccountingOrderId(Long accountingOrderId, AccountingOrderTypeDimEnum accountingOrderTypeDimEnum);

	/**
	 * 根据发票申请Id 获取 关联 对账单 ids 集合
	 *
	 * @param invoiceApplyId
	 * @return
	 */
	List<Long> getAffectedAccountingOrderIdsByInvoiceApplyId(Long invoiceApplyId);

	/****************************************** 工具方法   end ******************************************/

	/****************************************** 基于对账单Id检测开票状态 start ******************************************/

	Integer checkInvoiceStatusByAccountingOrderIdFocusUnified(Long accountingOrderId);

	Integer checkInvoiceStatusByAccountingOrderIdFocusScore(Long accountingOrderId);

	/****************************************** 基于对账单Id检测开票状态   end ******************************************/

	/****************************************** 基于对账单Sn检测开票状态 并 更新 对账单 开票状态 start ******************************************/

	void checkInvoiceStatusByAccountingOrderIdAndUpdateAccountingEntityFocusUnified(Long accountingOrderId, LoginSysUser loginSysUser);

	void checkInvoiceStatusByAccountingOrderIdAndUpdateAccountingEntityFocusScore(Long accountingOrderId, CommonBeRelatedEnum beRelatedEnum, LoginSysUser loginSysUser);

    void deleteInvoiceApplyXGoodsByAccountingOrderId(Long id);

    /****************************************** 基于对账单Sn检测开票状态 并 更新 对账单 开票状态   end ******************************************/

}
