package cn.quant;

import cn.quant.andy.DataLoader;
import cn.quant.andy.ScheduleApplication;
import cn.quant.andy.jpa.mybatis.mapper.ApplicationProfileMapper;
import cn.quant.andy.jpa.mybatis.mapper.InstitutionProfileMapper;
import cn.quant.andy.service.BalanceService;
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.SpringRunner;

/**
 * Unit test for simple App.
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ScheduleApplication.class})
public class AppTest {

    @Autowired
    private InstitutionProfileMapper institutionProfileEntityMapper;

    @Autowired
    private ApplicationProfileMapper applicationProfileEntityMapper;

    @Autowired
    private DataLoader dataLoader;

    @Autowired
    private BalanceService balanceService;

    /**
     * Rigorous Test :-)
     */
    @Test
    public void load() {

        try {
            dataLoader.load(202109);
        } catch (Exception e) {
            e.printStackTrace();
        }
//        HashMap<String, Object> params = new HashMap<>();
//        params.put(AVAILABLE_FLAG, true);
//        List<InstitutionProfileEntity> all = institutionProfileEntityMapper.findAll(params);
//
//        params = new HashMap<>();
//        params.put(INSTITUTION_CODE, "WXP");
//        InstitutionProfileEntity one = institutionProfileEntityMapper.findOne(params);
//        List<ApplicationProfileEntity> all1 = applicationProfileEntityMapper.findAll();
//        try {
//            importSummaryService.importing(202107);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//
        System.currentTimeMillis();
    }

    @Test
    public void billing() {

        balanceService.billing("INST", 202109);
    }
}
