package com.crm.ib.task.service;

import com.alibaba.fastjson.JSON;
import com.crm.ib.task.service.report.VolumeReportService;
import com.crm.rely.backend.core.dto.base.BaseReportResultDto;
import com.crm.rely.backend.core.entity.base.PageEntity;
import com.crm.rely.backend.model.dto.report.VolumeReportListDto;
import com.crm.rely.backend.model.dto.report.VolumeReportSumDto;
import com.crm.rely.backend.model.entity.report.VolumeReportEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Repository
 *
 * @author y
 * @create 2022/5/6
 */
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class VolumeReportServiceTest {

    @Autowired
    private VolumeReportService volumeReportService;

    @Test
    public void getList() {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            VolumeReportEntity entity = new VolumeReportEntity();
            entity.setEndDate(new Date());
            entity.setStartDate(sdf.parse("2022-05-01"));
            entity.setIbNo("IB6");
            entity.setStamp("0001");
            PageEntity pageEntity = new PageEntity();
            pageEntity.setCurrent(0);
            pageEntity.setRow(10);
            entity.setPage(pageEntity);
            BaseReportResultDto<List<VolumeReportListDto>, VolumeReportSumDto> list = volumeReportService.pageList(entity);
            System.out.println(JSON.toJSONString(list));


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
