package com.bohuikeji.delivery.backstage.controller.views;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bohuikeji.delivery.backstage.entity.*;
import com.bohuikeji.delivery.backstage.entity.bytedance.PayRecord;
import com.bohuikeji.frame.module.admin.base.PageTemplateControllerBase;
import com.bohuikeji.frame.module.admin.entity.back.PageEntity;
import com.bohuikeji.frame.module.admin.entity.web.block.ButtonBlock;
import com.bohuikeji.frame.module.admin.entity.web.template.TableTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 抖音分账模块
 * @author 10552
 */
@Slf4j
@Controller
@RequestMapping("/views")
public class SettlePage extends PageTemplateControllerBase {

    /**
     * 抖音分账记录
     *
     * @return
     */
    @GetMapping("/table/douyin/settle/record")
    public PageEntity douyinRecord() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TSettle> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper.eq("pay_way","抖音"));
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/douyinSettle/settle");
    }
    /**
     * 抖音分账记录
     *
     * @return
     */
    @GetMapping("/table/kuaishou/settle/record")
    public PageEntity kuaishouRecord() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TSettle> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper.eq("pay_way","快手"));
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/kuaishouSettle/settle");
    }

    /**
     * 抖音交易记录查询
     *
     * @return
     */
    @GetMapping("/table/get/pay")
    public PageEntity payRecord() {
        TableTemplate pageTemplate = (TableTemplate) byteCreatePage(TableTemplate.class);
        QueryWrapper<PayRecord> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/seller/bill");
    }

}
