package cn.com.ctop.kuaishou.modules.report.service.impl;

import cn.com.ctop.kuaishou.modules.report.mapper.DuanJUReportMapper;
import cn.com.ctop.kuaishou.modules.report.service.IDuanJUReportService;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class DuanJUReportServiceImpl implements IDuanJUReportService {
    @Autowired
    private DuanJUReportMapper duanJUReportMapper;

    @Override
    public JSONObject getTotalCharge(Map<String, Object> requestMap) {
        return duanJUReportMapper.getTotalCharge(requestMap);
    }

    @Override
    public Result<Object> getAccountList(Integer pageNo, Integer pageSize, Map<String, Object> requestMap) {
        PageHelper.startPage(pageNo, pageSize);
        List<JSONObject> accountList = duanJUReportMapper.getAccountList(requestMap);
        return Result.ok(new PageInfo<>(accountList));

    }

    @Override
    public Result<Object> getDuanJuList(Integer pageNo, Integer pageSize, Map<String, Object> requestMap) {
        PageHelper.startPage(pageNo, pageSize);
        List<JSONObject> duanJuList = duanJUReportMapper.getDuanJuList(requestMap);
        return Result.ok(new PageInfo<>(duanJuList));
    }

    @Override
    public List<JSONObject> getViodeoList(Map<String, Object> requestMap) {
        return duanJUReportMapper.getViodeoList(requestMap);
    }

    @Override
    public String getAgentToken(Long appId) {
        return duanJUReportMapper.getAgentToken(appId);
    }

    @Override
    public void replaceDatas(List<JSONObject> adds) {
        duanJUReportMapper.replaceDatas(adds);
    }

    @Override
    public List<JSONObject> stopList(Map<String, Object> requestMap) {
        return duanJUReportMapper.stopList(requestMap);
    }

    @Override
    public Result<Object> getViodeoListByPage(Map<String, Object> requestMap, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<JSONObject> data = duanJUReportMapper.getViodeoList(requestMap);
        return Result.ok(new PageInfo<>(data));
    }
}
