package com.post;

import com.alibaba.fastjson2.JSONArray;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.UtilException;
import com.ruoyi.common.utils.Arith;
import com.ruoyi.common.utils.DateUtils;
import org.apache.poi.util.IOUtils;
import org.springframework.boot.SpringBootVersion;

import java.io.*;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class Test01 {
    public static void main(String[] args) throws Exception {
//        double round = Arith.round(new BigDecimal(99.98).doubleValue(), 2);
//        System.out.println(round);
//        System.out.println(new BigDecimal(round).doubleValue());
//
//        for (int i = 100; i < 201; i++) {
//            System.out.println("insert into post_tools (id, \"type\", \"type_view\") values(" + i + ", 1, " + (2020 + (i - 100)) + ");");
//        }

// 2003949200
//        String filePath = "C:\\test\\720\\config\\application.yml";
//        File file = new File(filePath);
//        System.out.println("file.getName() = " + file.getName());
//        System.out.println("file.getPath() = " + file.getPath());
//        System.out.println("file.getParent() = " + file.getParent());
//        System.out.println("file.getParentFile() = " + file.getParentFile());

//        JSONArray filePathsValues = new JSONArray();
//        filePathsValues.add("C:\\test\\JAVAUploadTestFile.xlsx");
//        filePathsValues.add("C:\\test\\JAVAUploadTestFile.docx");
//        System.out.println("filePathsValues = " + filePathsValues);

//        Long userId = 1588420177349332993l;
//        if (userId.toString().length() > 16) {
//            System.out.println(Long.parseLong(userId.toString().substring(4)));
//        } else {
//            System.out.println(userId);
//        }
        /*
        int id = 1000;
        int year = 2025;
        for (int i = 0; i < 100; i++) {
            String sql = "INSERT INTO \"public\".\"post_team\"(\"id\", \"name\", \"parent_id\", \"status\", \"remark\", \"del_flag\", \"create_time\", \"create_by\", \"update_time\", \"update_by\", \"create_user_id\", \"type\", \"team_type\")" +
                    "VALUES(" + id++ + ", '" + year + "岗检领导小组', 0, 1, NULL, '0', '''" + year + "-01-01 01:01:01''', 'admin', '''" + year++ + "-01-01 01:01:01''', 'admin', 1, 0, 2);";
            System.out.println(sql);
        }
         */

//        String url = "http://10.152.164.68:8180/postcheck";
//        String encode = URLEncoder.encode(url,"utf-8");
//        System.out.println("编码 encode = " + encode);
//        String decode = URLDecoder.decode(encode,"utf-8");
//        System.out.println("解码 decode = " + decode);

        String version = SpringBootVersion.getVersion();
        System.out.println("version = " + version);


        String webStartPage = "http://10.152.72.5:8181/postcheck";
        System.out.println("webStartPage = " + webStartPage);
        webStartPage = webStartPage.substring(0, webStartPage.lastIndexOf("/"));
        System.out.println("webStartPage = " + webStartPage);


      /*  OutputStream out = new FileOutputStream("C:\\gnhz\\uploadPath\\download\\蓝图设计报告审核确认签字表_" + DateUtils.dateTimeNow() + ".pdf");
        InputStream in = new FileInputStream(new File("C:\\gnhz\\uploadPath\\download\\蓝图设计报告审核确认签字表.pdf"));
        byte[] buffer = new byte[1024];
        int len = 0;
        while ((len = in.read(buffer)) != -1) {
            System.out.println("==============循环读取一次=============== length = "+len);
            out.write(buffer, 0, len);
            out.flush();
        }
        out.close();
        System.out.println("==================结束=================");*/

        Long deptId = 20l;
        String ancestors = "0,17";
        System.out.println("1 = " + ancestors);
        if(ancestors.startsWith("0,")){
            ancestors = ancestors.substring(2)+","+deptId;
        }
        System.out.println("2 = " + ancestors);

    }
}

