package com.sckw.payment.service;

import com.github.pagehelper.PageInfo;
import com.sckw.core.model.page.PageRes;
import com.sckw.payment.dao.KwpSettlementTradeMapper;
import com.sckw.payment.model.KwpSettlementTrade;
import com.sckw.payment.model.constant.SettlementEnum;
import com.sckw.payment.model.dto.SettlementLogisticsDto;
import com.sckw.payment.model.dto.SettlementTradeDto;
import com.sckw.payment.model.dto.SettlementWalletDto;
import com.sckw.payment.model.vo.req.SettlementReq;
import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xucaiqin
 * @date 2023-07-10 16:38:36
 */
@Service
@AllArgsConstructor
public class KwpSettlementTradeService {
    private final KwpSettlementTradeMapper settlementTradeMapper;

    public void save(KwpSettlementTrade kwpSettlementTrade) {
        settlementTradeMapper.insert(kwpSettlementTrade);
    }

    public PageRes<SettlementTradeDto> pageListCollection(SettlementReq settlementReq) {
//        //todo 查询缓存，获取客户企业id
//        String keywords = settlementReq.getKeywords();
//        if (StringUtils.isNotBlank(keywords)) {
//            System.out.println("关键之：" + keywords);
//        }
//        PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
//
//        List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementOfflineMapper.pageSelect(settlementReq);
//
//        return new PageRes<>(new PageInfo<>(kwpLedgerLogisticsList));
        return new PageRes<>(new PageInfo<>());
    }

    public SettlementLogisticsStatusCountVo getCountListCollection(SettlementReq settlementReq) {
        SettlementLogisticsStatusCountVo settlementLogisticsStatusCountVos = new SettlementLogisticsStatusCountVo();
        //总
//        settlementReq.setStatus(null);
//        settlementLogisticsStatusCountVos.setAllCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
//
//        //待结算
//        settlementReq.setStatus(SettlementEnum.WAITING_PAYMENT.getStatus());
//        settlementLogisticsStatusCountVos.setWaitingPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
//
//        //部分结算
//        settlementReq.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
//        settlementLogisticsStatusCountVos.setPartialPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
//
//        //全部结算
//        settlementReq.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
//        settlementLogisticsStatusCountVos.setAllPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));

        return settlementLogisticsStatusCountVos;
    }


    public List<SettlementTradeDto> selectList(List<Long> ids) {
        return null;
    }

    /**
     * 结算-物流订单详情
     *
     * @param id 结算物流订单id
     * @author Aick Spt
     * @date 2023-07-19 09:11
     */
    public SettlementTradeDto detailCollection(Long id) {
        return null;
    }

    public PageRes<SettlementTradeDto> pageListPayment(SettlementReq settlementReq) {
//        //todo 查询缓存，获取客户企业id
//        String keywords = settlementReq.getKeywords();
//        if (StringUtils.isNotBlank(keywords)) {
//            System.out.println("关键之：" + keywords);
//        }
//        PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
//
//        List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementOfflineMapper.pageSelect(settlementReq);
//
//        return new PageRes<>(new PageInfo<>(kwpLedgerLogisticsList));
        return new PageRes<>(new PageInfo<>());
    }

    public SettlementLogisticsStatusCountVo getCountListPayment(SettlementReq settlementReq) {
        return null;
    }

    public SettlementTradeDto detailPayment(Long id) {
        return null;
    }
}
