package com.tax.file.test;


import com.alibaba.fastjson.JSONObject;
import com.tax.file.constants.FileConstants;
import com.tax.file.model.DownFileInfoModel;
import com.tax.file.model.TkFile;
import com.tax.file.service.async.down.AbstractFileDownService;
import com.tax.file.utils.NationUtil;
import com.tax.file.utils.TokenGetUtil;
import com.yxcheng.token.utils.DateUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.BeanUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Date;

/*@RunWith(SpringRunner.class)
@SpringBootTest(classes = FileStartupApplication.class)*/
public class TestDownFile {

    String taxno = "91130000677356885K";
    String zoneCode = "1300";
    String token = "2~2~0~~1~0~0~0~0~0~1~ffa20972-a56d-470e-b53a-1d6033c88f7a@@91130000677356885K@@00";

    @Before
    public void init(){
        FileConstants.nationFilePath = "/Users/wenhao/tmp/nation";
        FileConstants.isDebug="1";
        NationUtil.setUrl("http://39.105.162.231:8880/fpcxService/QxrzServlet.do");
    }

    @Test
    public void apply() {
        TkFile tkFile = new TkFile();
        try {
            token = "1~3~2~~1~0~0~1~0~0~1~c4cbef97-d6f2-42e4-bc03-57dbf7711b8f@@12344@@03";
            tkFile.setToken(token);
            tkFile.setTaxno(taxno);
            tkFile.setZoneCode(zoneCode);
            tkFile.setInvSpec("1,2");
            tkFile.setInvType("14");
            tkFile.setDecPwd("123456");
            Date invDateStart = DateUtils.parseDate("2020-04-01","yyyy-MM-dd");
            Date invDateEnd = DateUtils.parseDate("2020-04-30","yyyy-MM-dd");
            tkFile.setInvDateStart(invDateStart);
            tkFile.setInvDateEnd(invDateEnd);
//            JSONObject jsonObject = NationUtil.fileDownApply("111111",tkFile);
//            System.out.println(jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    @Test
    public void down(){
        try {

//            String taxno = "12344";
//            String zoneCode = "9999";
            TkFile tkFile = new TkFile();
            tkFile.setTaxno(taxno);
            tkFile.setZoneCode(zoneCode);

          // tkFile.setToken(TokenGetUtil.getBWToken(taxno,zoneCode));
          //  tkFile.setToken("1~3~2~~1~0~0~1~0~0~1~ac8b12c2-24a1-40d1-ab97-188b97e9a8c7@@12344@@03");
            tkFile.setToken(token);
            tkFile.setDecPwd("123456");
            tkFile.setInvSpec("2");
            tkFile.setInvType("11");
            Date invDateStart = DateUtils.parseDate("2020-10-01","yyyy-MM-dd");
            Date invDateEnd = DateUtils.parseDate("2019-08-31","yyyy-MM-dd");
            tkFile.setInvDateStart(invDateStart);
            tkFile.setInvDateEnd(new Date());
            JSONObject jsonObject = NationUtil.fileDownQuery("aaa",tkFile,null);
            System.out.println(jsonObject);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    @Test
    public void downfile(){
        try {
            String path = "D:\\tmp";
            String taxno = "91310000060900705N";
            String zoneCode = "3100";
            TkFile tkFile = new TkFile();
            tkFile.setTaxno(taxno);
            tkFile.setZoneCode(zoneCode);
            tkFile.setDecPwd("123456");

            tkFile.setToken(TokenGetUtil.getBWToken(taxno,zoneCode));
            tkFile.setFileName("replace/91310000060900705N/20200401010003621/202003/2/01/91310000060900705N-20200401010003621-202003-销项票-增值税专用发票.z01=39250b3e2d278345023fe776aba64e70, replace/91310000060900705N/20200401010003621/202003/2/01/91310000060900705N-20200401010003621-202003-销项票-增值税专用发票.z02=dd5786c516605bb038171fdd0793a54e, replace/91310000060900705N/20200401010003621/202003/2/01/91310000060900705N-20200401010003621-202003-销项票-增值税专用发票.z03=65ef744c9419fa10ae78d59caf5b52ae, replace/91310000060900705N/20200401010003621/202003/2/01/91310000060900705N-20200401010003621-202003-销项票-增值税专用发票.z04=02f797d8eade98c993d363bb4f71bf01, replace/91310000060900705N/20200401010003621/202003/2/01/91310000060900705N-20200401010003621-202003-销项票-增值税专用发票.zip=45e750582a85eb4d3dcd25c56507a554");
        //    tkFile.setFileName("replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z01, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z02, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z03, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z04, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z05, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z06, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z07, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z08, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z09, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z10, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z11, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z12, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z13, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.z14, replace/91110108558521630L/20200313/201808/2/01/91110108558521630L-20200313-201808-销项票-增值税专用发票.zip");
            String[] fileNames = tkFile.getFileName().split(", ");
           // String fileDPath = FileUtils.filePath(path, tkFile.getZoneCode()) + System.nanoTime();
            String fileDPath = "D:\\tmp";
            for(int i=1;i<= fileNames.length;i++){
                String[]fileNameMd5 = fileNames[i-1].split("=");
                String fileName = fileNameMd5[0];
                String Md5 = fileNameMd5[1];

                TkFile query = new TkFile();
                BeanUtils.copyProperties(tkFile,query);
                query.setFileName(fileName);
                JSONObject jsonObject = NationUtil.fileDown("aaa", query);
                if(jsonObject == null) return;
                NationUtil.downToNative2(jsonObject,fileDPath,getFullName(fileName));
            }
            DownFileInfoModel downFileInfoModel = NationUtil.unZipVolumeFile("aaa", fileDPath, tkFile);
            System.out.println(downFileInfoModel);
        }catch (Exception e) {
            e.printStackTrace();
        }
    }


    @Test
    public void downSinglefile(){
        try {
            AbstractFileDownService service = new AbstractFileDownService();
            String path = "D:\\tmp";
            String taxno = "91130100070816945Q";
            String zoneCode = "1300";
            TkFile tkFile = new TkFile();
            tkFile.setTaxno(taxno);
            tkFile.setZoneCode(zoneCode);
            tkFile.setDecPwd("123456");
            tkFile.setToken(TokenGetUtil.getBWToken(taxno,zoneCode));
            tkFile.setFileName("replace/91130100070816945Q/20200401005803495/202003/2/04/91130100070816945Q-20200401005803495-202003-销项票-增值税普通发票.zip=e1b6be2b5f42ef9b7926d6d17355a647");

            String fileNames = tkFile.getFileName();
            String[]fileNameMd5 = fileNames.split("=");
            String fileName = fileNameMd5[0];
            String Md5 = fileNameMd5[1];

            TkFile query = new TkFile();
            BeanUtils.copyProperties(tkFile,query);
            query.setFileName(fileName);
            // JSONObject jsonObject = NationUtil.fileDown(tkFile);
            FileConstants.nationFilePath = "D:\\";
            JSONObject jsonObject = new JSONObject();
            String str = "UEsHCFBLAwQUAAkICABxAIZQwzvIrgAAAAAApAAAXQAAADkxMzcwMjAwNzI3ODA1ODQ2VC0yMDIw\nMDQwMTAxMDAwMzYxNy0yMDIwMDMt6L+b6aG556WoLeWinuWAvOeojuaZrumAmuWPkeelqO+8iOeU\nteWtkO+8iS0xLnhsc+RMR55yMg6Vh4BKDO+5fh3Iz2BOTM8H93KkEdqbKQI48hmz7pmdlRariFBo\n56zrBBa6U0aAmtAuzmT6qX4DAm+LDeG4ZtXVZsW6eLjTwigvQ3woGWs19Rz0vJKlaIp5aS9Kr9ED\nXFltes63Ydi9aThO0Y7nHGmGS6+7acLnarOKkDmWwrPtvU7QyUl5t/4I4X8On908D1jJOmA1fqpO\n/6xzYAIQefRYMkdC2q2SJhxXu+zfKWdh0hYYTYnFxeWYcyU3B4NVtdytH+9CG4xVbcok8mwIT1zK\nYGSYB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iiUV3KaGfNYhF1nicgolz44jD8WaQkCdIzPE8mWLeqv3O8V4jVXgf3EJSpFeaAo9aw\nuY/i8OUyKFT1A37v9LprTaw8FQqeHEH5WVr3jqy3/nNN8WQpSwtqUyRk3w7UlgbdjY4udmfVDbi/\nfSHVP+rJYnqTGxjxdV4s/cOGuN4iIJzza1dinUOOXslNlEeLY3xCwL0VeIvr01c2PnaYO7o4jNxn\n7Ck7m9K62rl6Te2x/atWPCUVR/XQoTS/hfFaAqG+VizkGETYf7kUOUlB9axQNvXSg3mjpRfq4UEM\nfOmAdI1WhCQjQO94Thfswq2zjHDpvgr6PpCQ7NogaBL4WOFswG4TSAJxmR5VnlEMwmEBcseJT1/W\nLQY5ohLB7JOpoE+dQubiOaztiW547gg+BGHtaao5UEsHCMM7yK7wLwAAAKQAAFBLAQIUABQACQgI\nAHEAhlDDO8iu8C8AAACkAABdAAAAAAAAAAAAAAAAAAQAAAA5MTM3MDIwMDcyNzgwNTg0NlQtMjAy\nMDA0MDEwMTAwMDM2MTctMjAyMDAzLei/m+mhueelqC3lop7lgLznqI7mma7pgJrlj5HnpajvvIjn\nlLXlrZDvvIktMS54bHNQSwUGAAAAAAEAAQCLAAAAfzAAAAAA";
            jsonObject.put("file",str);
            if(jsonObject!=null) {

                DownFileInfoModel fileStatus = NationUtil.downFile("aaa", jsonObject, query);
                String targetUrl = fileStatus.getPath();
                System.out.println(targetUrl);
                File file = new File(targetUrl);
//                if(file.exists() && service.isFileComplete(file,Md5)){
//                    System.out.println("complete");
//                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    private String getFullName(String fileName) {
        int index = fileName.lastIndexOf("/");
        return fileName.substring(index + 1);
    }

    private static byte[] ZIP_HEADER_1 = new byte[] { 80, 75, 3, 4 };
    private static byte[] ZIP_HEADER_2 = new byte[] { 80, 75, 5, 6 };

    public static boolean isArchiveFile(File file) {
        if(file == null){
            return false;
        }

        if (file.isDirectory()) {
            return false;
        }

        boolean isArchive = false;
        InputStream input = null;
        try {
            input = new FileInputStream(file);
            byte[] buffer = new byte[4];
            int length = input.read(buffer, 0, 4);
            if (length == 4) {
                isArchive = (Arrays.equals(ZIP_HEADER_1, buffer)) || (Arrays.equals(ZIP_HEADER_2, buffer));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                }
            }
        }

        return isArchive;
    }

    @Test
    public void testZip(){
       // File file = new File("D:\\tmp\\20200319\\1100\\16\\1\\337829083995899\\91110108558521630L-20200313-201808-销项票-增值税专用发票.z02");
        File file = new File("D:\\tmp\\20200319\\1100\\15\\1\\334477107721556\\91110108558521630L-20200313-201908-销项票-增值税普通发票（卷票）.zip");
        System.out.println(isArchiveFile(file));
    }






    @Test
    public void testUnzip(){
        String fileDPath ="D:\\tmp\\20200319\\1100\\15\\1\\334477107721556";
        TkFile tkFile = new TkFile();
        tkFile.setDecPwd("12345646");
        try {
            NationUtil.unZipVolumeFile("aaa", fileDPath, tkFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testSingDown(){
        try {
           // FileConstants.nationFilePath = "D:\\tmp";
//            String taxno = "91110108558521630L";
//            String zoneCode = "1100";
            TkFile tkFile = new TkFile();
            tkFile.setTaxno(taxno);
            tkFile.setZoneCode(zoneCode);
            tkFile.setDecPwd("123456");

           // tkFile.setToken(TokenGetUtil.getBWToken(taxno,zoneCode));
            token  = "1~3~2~~1~0~0~1~0~0~1~9c3ade9b-7e6e-44f1-a094-23a1318e46cf@@12344@@03";
            tkFile.setToken(token);
           // tkFile.setFileName("replace/12344/20201222111240377/202011/1/01/12344-20201222111240377-202011-进项票-增值税专用发票.zip=2f5170140ac3a2b84d47dede30aa8adf");
            tkFile.setFileName("replace/12344/20201217103137887/202011/1/14/12344-20201217103137887-202011-进项票-道路通行费电子普通发票.zip");

            JSONObject jsonObject = NationUtil.fileDown("aaa", tkFile);
       /*     JSONObject jsonObject = new JSONObject();
            jsonObject.put("file","UEsHCFBLAwQUAAkICAA1aHJQK6WjKQAAAAAAUAAAVAAAADkxMTEwMTA4NTU4NTIxNjMwTC0yMDIwMDMxMy0yMDIwMDIt6L+b6aG556WoLeWinuWAvOeojuaZrumAmuWPkeelqO+8iOWNt+elqO+8iS0xLnhsc6LzDN0uu0hPcNmbnpI9/OrER6A5n3i8sDKsWreHAUU5ipmEvWD8tX6cLdXh2UXgER4nNDACoyQbFJ7+0HDpxcsfoOmNGqSfJuIZfb7mY0KBxYzRwGnn2Q3Z9QKEr2qAGmtSC1WYkoCRiW5hXKSkL++xZUaAuadZqj+jUccsOwJC3HhmGKsvVWYB6F7OYiB01pcB34s0EWF/+LstEqy5h2akruP/jnsebQVUz2YqwH8VBrOsQT31wXGAZ/zPdTkIm2F2seg1MSfrMngPc5EpiuSIHH1Tl1hnef/iMhsRFlVflaGaVjpq3lcK5BBsjm9T76Q3N+O7c+xMWvHW2pSSvY38yFt85VTmmVC8vFV2jVmgmfLifjw6bvcRqKm5WDXaL4Xu5bgAsDZ7Mk6AE7n9a+aUGnIoOHCTxQEzhFlBLVpMVj3dB8ZiF4aZ3coAbcedRO02adWntqAhsr7QvLS/NWChHbItYVwGxH7EefR/43zqvCf5ulY7cJ6rodW4ljhzvTt3K6eIXy7ulO8NWGeLOjnGyO7QyvlG+x0ElCeT3WX5+cpsMLloOiuwdZyTAzB2+m8KmnsT5C1//W/QOL8krsys+oZZ3Jfl3kl6BSq4dzauS2EWzoE48vKyx6kQsw57CAxoMsc8qj2rj4OgAbHULhDvg7H75tuQmc6K/B6htqz8Rv9dQ9bcN9ksRs1BrFkDa7Js7Sg5GHev9uriAxjKqQY+pupPmRE+zLJLydr4SF5jP0Tmd5pDfBdFut1pHIpZ7DMJmQ+mR2UIZf/XRiCG4X1uYZFlkXTgkbJdZ1Lr14QwuGKnDA4HG6V90gwr+4lAwvf1");
          */
       if(jsonObject!=null) {
                DownFileInfoModel fileStatus = NationUtil.downFile("aaa", jsonObject, tkFile);
                System.out.println(fileStatus);
            }
        }catch (Exception e){
            e.printStackTrace();
        }



    }

    @Test
    public void testName(){
            String str = "replace/91110108558521630L/20200313/202002/2/04/91110108558521630L-20200313-202002-销项票-增值税普通发票.zip";
        System.out.println(File.separator);
        System.out.println(str.replaceAll("/","\\\\"));
    }

}
