import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz;
import com.xxfc.platform.order.biz.OrderStatisticsBiz;
import com.xxfc.platform.order.jobhandler.BaseOrderStatisticsJobHandler;
import com.xxfc.platform.order.pojo.HomePageOrderData;
import org.joda.time.DateTime;
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.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author libin
 * @version 1.0
 * @description
 * @data 2019/8/6 20:05
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {OrderApplication.class})
public class ServiceTest {

    @Autowired
    private DailyOrderStatisticsBiz dailyOrderStatisticsBiz;

    @Autowired
    private OrderStatisticsBiz statisticsBiz;

    @Autowired
    private BaseOrderStatisticsJobHandler handler;

    @Test
    public void testSchedu(){

         dailyOrderStatisticsBiz.statisticalOrder(1);
    }

    @Test
    public void test() throws  ParseException {
        String d="2019-09-01";
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = dateFormat.parse(d);
        System.out.println(parse);
    }

    @Test
    public void test2()  {
        DateTime dateTime = DateTime.parse("2019-10-10");
        System.out.println(dateTime);
    }

    @Test
    public void test3()  {
        DateTime dateTime = DateTime.parse("2019-10-10");
        Date date = dateTime.toDate();
        DateTime dateTime1 = DateTime.parse("2019-12-10");
        Date date1 = dateTime1.toDate();
        System.out.println(date);
        System.out.println(date1);
        System.out.println(date.before(date1));
        System.out.println(date.after(date1));
    }

    @Test
    public void test4(){
        HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null);
        System.out.println(totalOrder);

    }


    @Test
    public void handlerTeset()  {
        handler.execute("2019-08-15");
    }


}
