package com.chinaweal.test;

import com.chinaweal.aiccs.AiccsApplication;
import com.chinaweal.aiccs.aiccs.abnormal.entity.TREntBaseInfo;
import com.chinaweal.aiccs.aiccs.abnormal.mapper.TREntBaseInfoMapper;
import com.chinaweal.aiccs.aiccs.punishment.entity.EntLock;
import com.chinaweal.aiccs.aiccs.punishment.entity.Personlock;
import com.chinaweal.aiccs.aiccs.punishment.entity.Tolockentlist;
import com.chinaweal.aiccs.aiccs.punishment.job.Task;
import com.chinaweal.aiccs.aiccs.punishment.mapper.EntlockMapper;
import com.chinaweal.aiccs.aiccs.punishment.mapper.PersonlockMapper;
import com.chinaweal.aiccs.aiccs.punishment.mapper.TaskMapper;
import com.chinaweal.aiccs.aiccs.punishment.service.EntlockService;
import com.chinaweal.aiccs.aiccs.punishment.service.PersonlockService;
import com.chinaweal.aiccs.crgs.transfor.service.OtNcaseDownloadLogService;
import com.chinaweal.aiccs.crgs.transfor.service.OtNpermitDownloadLogService;
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;

import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 异地流转，信息下载文件excel读取数据单元测试
 * @author <a href="https://blog.lroyia.top">lroyia</a>
 * @since 2021/11/8 10:55
 **/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = AiccsApplication.class)
public class NCaseDownloadTest {

    @Autowired
    private OtNcaseDownloadLogService otNcaseDownloadLogService;

    @Autowired
    private OtNpermitDownloadLogService otNpermitDownloadLogService;

    @Autowired
    private EntlockService entlockService;

    @Autowired
    private PersonlockService personlockService;

    @Autowired
    private TREntBaseInfoMapper trEntBaseInfoMapper;

    @Resource
    private TaskMapper taskMapper;

    @Resource
    private EntlockMapper entLockMapper;

    @Resource
    private PersonlockMapper personlockMapper;

    /**
     * 异地流转，行政检查信息下载文件excel读取数据单元测试
     */
    @Test
    public void test(){
        try {
            otNcaseDownloadLogService.saveDownloadData(new File("F:/行政处罚信息 .xls"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 异地流转，行政许可信息下载文件excel读取数据单元测试
     */
    @Test
    public void test2(){
        try {
            otNpermitDownloadLogService.saveDownloadData(new File("F:/行政许可信息.xls"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void test3(){
        TREntBaseInfo trEntBaseInfo=new TREntBaseInfo();
        trEntBaseInfo.setEntname("广东西维文化发展有限公司飞扬影城");
        trEntBaseInfo.setReportyear("2020");
        trEntBaseInfoMapper.insert(trEntBaseInfo);
    }

    @Test
    public void test4(){
        List<Tolockentlist> list = taskMapper.queryAll();
        //System.out.println(list);
        //for(Tolockentlist tolockentlist : list){
            //String entName = tolockentlist.getEntName();
            List<EntLock> entLocks = entlockService.selectLockEntity("广州市皓睿电子有限公司");
            EntLock e=new EntLock();
            if(entLocks!=null&&entLocks.size()!=0){
                e=entLocks.get(0);
            }
            System.out.println(e.getState());
       // }

    }
}

