package cn.superdesk.uniorder.service.accounting.score.customer;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.accounting.score.customer.AccountingScoreCustomer;
import cn.superdesk.uniorder.dao.entity.accounting.score.customer.AccountingScoreCustomerXCredit;
import cn.superdesk.uniorder.dto.param.accounting.score.customer.AccountingOrderScoreCustomerOpDetailQueryCriteria;
import cn.superdesk.uniorder.dto.param.accounting.score.customer.AccountingOrderScoreCustomerQueryCriteria;
import cn.superdesk.uniorder.dto.vo.accounting.score.customer.AccountingOrderScoreCustomerDetailVo;
import cn.superdesk.uniorder.dto.vo.accounting.score.customer.AccountingOrderScoreCustomerHeadVo;
import cn.superdesk.uniorder.dto.vo.accounting.score.customer.AccountingOrderScoreCustomerListItemVo;
import cn.superdesk.uniorder.dto.vo.invoice.customer.InvoiceApplyDetailDimCreditItemVo;
import cn.superdesk.uniorder.service.base.BaseService;

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


/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/4/15 下午3:21
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/4/15 下午3:21
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public interface AccountingScoreCustomerService extends BaseService<AccountingScoreCustomer> {

    /****************************************** 积分结算 对账单 列表 start ******************************************/

    List<Long> getAccountingXCreditIdsByQueryCriteria(AccountingOrderScoreCustomerOpDetailQueryCriteria queryCriteria);

    R<List<AccountingOrderScoreCustomerListItemVo>> pageQueryAccountingOrderList(AccountingOrderScoreCustomerQueryCriteria queryCriteria, LoginSysUser loginSysUser);

    List<AccountingOrderScoreCustomerListItemVo> getAccountingOrderList(AccountingOrderScoreCustomerQueryCriteria queryCriteria, LoginSysUser loginSysUser);

    AccountingOrderScoreCustomerHeadVo getAccountingOrderListHeadSum(AccountingOrderScoreCustomerQueryCriteria queryCriteria);


    /****************************************** 积分结算 对账单 列表  end ******************************************/


    /****************************************** 积分结算 对账单 详情 start ******************************************/

    AccountingOrderScoreCustomerListItemVo getAccountingOrderScoreCustomerVoByAccountingOrderId(AccountingOrderScoreCustomerOpDetailQueryCriteria queryCriteria, LoginSysUser loginSysUser);

    AccountingOrderScoreCustomerDetailVo commonStatementOfAccountDetailDimCredit(AccountingOrderScoreCustomerOpDetailQueryCriteria queryCriteria, LoginSysUser loginSysUser);

    /****************************************** 积分结算 对账单 详情   end ******************************************/


    /****************************************** 积分结算 对账单 操作 start ******************************************/

    /**
     * 积分结算 客户对账 创建对账单
     * 效率优化 mark by linjinyu at 20211203
     *
     * @param scoreAccountingCustomer            实体类
     * @param scoreAccountingCustomerXCreditList 关系 对账单 X 流水 行数 accountingOrderId accountingOrderSn unifiedOrderId unifiedOrderGoodsId unifiedOrderCreditId accountingState
     * @return
     */
    AccountingScoreCustomer createScoreAccountingCustomer(AccountingScoreCustomer scoreAccountingCustomer, List<AccountingScoreCustomerXCredit> scoreAccountingCustomerXCreditList);

    void statisticsScoreAccountingCustomerByCredit(AccountingScoreCustomer accountingScoreCustomer, List<InvoiceApplyDetailDimCreditItemVo> invoiceApplyDetailDimCreditItemVoList);


    /**
     * 已取消(-1, "已取消"), V
     * 未确认(0, "未确认"),
     * 已确认(1, "已确认"),
     * 已拒绝(2, "已拒绝"), V
     * 待提交(3, "待提交"),
     *
     * @param accountingOrderId
     * @param accountingStatus
     * @param loginSysUser
     * @return
     */
    int opCancelAccounting(Long accountingOrderId, Integer accountingStatus, LoginSysUser loginSysUser);

    int opDeleteAccounting(Long accountingOrderId, LoginSysUser loginSysUser);

    int opUpdateByPrimaryKeySelective(AccountingScoreCustomer scoreAccountingCustomer, LoginSysUser loginSysUser);

    int opResetNeedReviseMark(Long accountingOrderId);

    /****************************************** 积分结算 对账单 操作   end ******************************************/


    AccountingScoreCustomer findByAccountingOrderSn(String accountingOrderSn);

    AccountingScoreCustomer findById(Long id);

    List<AccountingScoreCustomer> findByIds(List<Long> accountingOrderIds);

    Map<Long, AccountingScoreCustomer> convertAccountingScoreCustomerList2MapAccountingOrderIdEntity(List<Long> accountingOrderIds);


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

    void patchNeedReviseMarkStatistics(List<AccountingOrderScoreCustomerListItemVo> resultList, LoginSysUser loginSysUser);

    void patchNeedReviseMarkInvoiceStatus(List<AccountingOrderScoreCustomerListItemVo> resultList, LoginSysUser loginSysUser);

    void patchNeedReviseMarkMailTickStatus(List<AccountingOrderScoreCustomerListItemVo> resultList, LoginSysUser loginSysUser);

    void patchNeedReviseMarkServiceNoSourceFrom(List<AccountingOrderScoreCustomerListItemVo> resultList, LoginSysUser loginSysUser);


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

}
