jpy
2023-05-27 48cde94624bec615f9df9a481339d5b71be311e5
screen-api/src/main/java/com/moral/api/controller/ChartController.java
@@ -259,9 +259,9 @@
        String path = applicationHome.getSource().getParentFile().toString() + "/static/tsv";
        //File file = File.createTempFile("test",".tsv");
        if (!new File(path).exists()){
        /*if (!new File(path).exists()){
            new File(path).mkdir();
        }
        }*/
        File file = null;
        File dir = new File(path);
        file = File.createTempFile("honeycombDiagram",".tsv",dir);
@@ -270,11 +270,11 @@
        OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file),"UTF-8");
        //tsv文件是空格分隔,除第一个外,每次写入一个单元格数据后需要输入空格
        ow.write("lon");
        ow.write("lng");
        ow.write("  ");
        ow.write("lat");
        ow.write("  ");
        ow.write("value");
        ow.write("count");
        //写完文件头换行
        ow.write("\r\n");
        //写内容
@@ -290,8 +290,11 @@
        ow.flush();
        ow.close();
        /*String localAddr = httpServletRequest.getLocalAddr();
        int serverPort = httpServletRequest.getServerPort();*/
        Map<String,Object> res = new HashMap<>();
        res.put("path",file.getPath());
        res.put("path","http://47.99.64.149:8081"+"/static/tsv/"+file.getName());
        return ResultMessage.ok(res);
    }