package cn.superdesk.uniorder.service.order.base;

import cn.superdesk.uniorder.common.enums.common.CommonAccountingStateEnum;
import cn.superdesk.uniorder.common.enums.order.UnifiedOrderCreditBackAccountStatusEnum;
import cn.superdesk.uniorder.common.enums.order.UnifiedOrderCreditInvoiceApplyStatusEnum;
import cn.superdesk.uniorder.common.enums.order.UnifiedOrderCreditInvoiceMakeStatusEnum;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.base.UnifiedOrderCredit;
import cn.superdesk.uniorder.dao.entity.invoice.customer.InvoiceApplyXGoods;
import cn.superdesk.uniorder.service.base.BaseService;
import com.github.pagehelper.PageInfo;

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


/**
 * @Description: 流水
 * @Author: linjinyu
 * @Email linjinyu@avic-s.com
 * @CreateDate: 2020-09-23 15:16:04
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020-09-23 15:16:04
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public interface UnifiedOrderCreditService extends BaseService<UnifiedOrderCredit> {


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

    int insertSelective(UnifiedOrderCredit entity);

    int updateByPrimaryKeySelective(UnifiedOrderCredit entity);

    @Deprecated
    void deleteObj(Long id);

    @Deprecated
    UnifiedOrderCredit findById(Long id);

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

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

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


    void addUnifiedOrderCredit(UnifiedOrderCredit entity);

    void updateUnifiedOrderCredit(UnifiedOrderCredit entity);

    void deleteUnifiedOrderCredit(Long id);

    UnifiedOrderCredit findUnifiedOrderCreditById(Long id);

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


    Map<String, Integer> checkStatement(Map<String, Object> conditions);

    /****************************************** 关于 供应商结算 对账单 设置 对账状态 或 恢复 对账状态 start ******************************************/

    /**
     * 订单维度
     *  @param processOrderSn
     * @param state
     * @return
     */
    int updateFieldAccountingStateSupplierByOrderSn(List<String> processOrderSn, CommonAccountingStateEnum state);

    /**
     * 商品维度
     *  @param processOrderSn
     * @param processOutGoodsIds
     * @param state
     * @return
     */
    int updateFieldAccountingStateSupplierByOrderSnAndOutGoodsIds(List<String> processOrderSn, List<Long> processOutGoodsIds, CommonAccountingStateEnum state);

    /****************************************** 关于 供应商结算 对账单 设置 对账状态 或 恢复 对账状态   end ******************************************/


    /****************************************** 关于 客户结算 对账单 设置 对账状态 或 恢复 对账状态 start ******************************************/

    /**
     * 订单维度
     *  @param processOrderSn
     * @param state
     * @return
     */
    int updateFieldAccountingStateCustomerByOrderSn(List<String> processOrderSn, CommonAccountingStateEnum state);

    /**
     * 商品维度
     *  @param processOrderSn
     * @param processOutGoodsIds
     * @param state
     * @return
     */
    int updateFieldAccountingStateCustomerByOrderSnAndOutGoodsIds(List<String> processOrderSn, List<Long> processOutGoodsIds, CommonAccountingStateEnum state);

    /**
     * 更新 流水's 客户对账状态
     *  @param processUnifiedOrderCreditIds
     * @param state
     * @return
     */
    int updateFieldAccountingStateCustomerByUnifiedOrderCreditIds(List<Long> processUnifiedOrderCreditIds, CommonAccountingStateEnum state);

    /**
     * 更新 流水's 发票申请状态
     * 发票申请状态 是否已申请 0-未申请;1-已申请;
     * uoc.invoice_apply_status,
     * UnifiedOrderCreditInvoiceApplyStatusEnum
     * InvoiceApplyCustomerInvoiceProgressingStatusEnum
     *  @param processUnifiedOrderCreditIds
     * @param state
     * @return
     */
    int updateFieldInvoiceApplyStatusByUnifiedOrderCreditIds(List<Long> processUnifiedOrderCreditIds, UnifiedOrderCreditInvoiceApplyStatusEnum state);

    /**
     * 开票状态 是否已登记开票 0-未登记;1-已登记;uoc.invoice_make_status,
     * UnifiedOrderCreditInvoiceMakeStatusEnum
     * InvoiceApplyCustomerMakeInvoiceStatusEnum
     *  @param processUnifiedOrderCreditIds
     * @param state
     * @return
     */
    int updateFieldInvoiceMakeStatusByUnifiedOrderCreditIds(List<Long> processUnifiedOrderCreditIds, UnifiedOrderCreditInvoiceMakeStatusEnum state);


    /**
     * 回款状态 是否回款 0-未回款;1-已回款;uoc.back_status
     * UnifiedOrderCreditBackAccountStatusEnum
     * InvoiceApplyCustomerBackAccountStatusEnum
     *  @param processUnifiedOrderCreditIds
     * @param state
     * @return*/
    int updateFieldBackAccountStatusByUnifiedOrderCreditIds(List<Long> processUnifiedOrderCreditIds, UnifiedOrderCreditBackAccountStatusEnum state);

    /****************************************** 关于 客户结算 对账单 设置 对账状态 或 恢复 对账状态   end ******************************************/


    /****************************************** 流水 状态 回款状态 start ******************************************/

    /**
     * 未实现
     *  @param invoiceX
     * @param state
     * @return
     */
    int updateFieldBackAccountStatusByInvoiceX(List<InvoiceApplyXGoods> invoiceX, UnifiedOrderCreditBackAccountStatusEnum state);

    /****************************************** 流水 状态 回款状态   end ******************************************/


    /****************************************** 补丁程序 start ******************************************/

    String checkAndFixAccountingStateCustomer(/*积分批次号*/String batchs);

    /****************************************** 补丁程序   end ******************************************/

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

    List<String> queryOrderSnsBySelectCreditIds(List<Long> selectCreditIds);

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


}
