wuww
2025-04-25 b50aa418312034cfebf121f416e197d68aa5d0de
src/main/java/com/se/nsl/controller/TestController.java
@@ -20,7 +20,10 @@
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
@@ -59,7 +62,7 @@
    @ApiOperation(value = "当前时间 *")
    @GetMapping("/getTime")
    public Object getTime() {
        return System.currentTimeMillis();
        return (Object) System.currentTimeMillis();
    }
    @ApiOperation(value = "testCallExe *")
@@ -89,7 +92,7 @@
    public R<Object> testResuslt(String path, String time) {
        try {
            DataPo data = new DataPo();
            data.setEpsg(4548);
            data.setEpsg(Integer.valueOf(4548));
            data.setInPath(path);
            data.setStartTime(StringHelper.YMDHMS_FORMAT.parse(time));
@@ -106,7 +109,7 @@
    public R<Object> testSww2Tif() {
        try {
            DataPo data = new DataPo();
            data.setEpsg(4548);
            data.setEpsg(Integer.valueOf(4548));
            data.setInPath("20241010095328");
            data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00"));
@@ -123,9 +126,9 @@
    public R<Object> testRainfall() {
        try {
            DataPo data = new DataPo();
            data.setEpsg(4548);
            data.setTotal(60.0);
            data.setDuration(60);
            data.setEpsg(Integer.valueOf(4548));
            data.setTotal(Double.valueOf(60.0));
            data.setDuration(Integer.valueOf(60));
            data.setInPath("20241010095328");
            data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-07-01 00:00:00"));
@@ -166,7 +169,7 @@
    public R<Object> testH5() {
        try {
            DataPo data = new DataPo();
            data.setEpsg(4548);
            data.setEpsg(Integer.valueOf(4548));
            data.setInPath("20241010095328");
            data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00"));
@@ -232,8 +235,8 @@
                    continue; // g.GetGeometryType() == ogr.wkbPolygon || g.GetGeometryType() == ogr.wkbMultiPolygon
                if (!wkt.contains("MULTIPOLYGON")) wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")";
                list.add(new Region(f.GetFieldAsString("name"), type.shortValue(), wkt));
                if (path.contains("孙胡沟")) list.add(new Region(f.GetFieldAsString("name"), (short) 3, wkt));
                list.add(new Region(f.GetFieldAsString("name"), type, wkt)); // type.shortValue()
                if (path.contains("孙胡沟")) list.add(new Region(f.GetFieldAsString("name"), 3, wkt));
            }
        }
        ds.delete();
@@ -310,4 +313,37 @@
            return fail(ex, null);
        }
    }
    @ApiOperation(value = "testPngList <")
    @GetMapping("/testPngList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\out\\chicago\\waters"),
            @ApiImplicitParam(name = "size", value = "尺寸", dataType = "Integer", paramType = "query", example = "1024")
    })
    public R<Object> testPngList(String path, Integer size) {
        try {
            if (null == size) size = (Integer) 1024;
            List<String> list = new ArrayList<>();
            for (File file : new File(path).listFiles()) {
                if (!file.exists() || file.isFile()) continue;
                File pngFile = new File(file.getPath() + File.separator + size + "_" + size + ".png");
                if (!pngFile.exists() || pngFile.isDirectory()) continue;
                list.add("file '" + pngFile.getPath().replace("\\", "/") + "'");
                System.out.println(list.get(list.size() - 1));
            }
            Path outPath = Paths.get(path + File.separator + "list.txt");
            try {
                Files.write(outPath, list, StandardCharsets.UTF_8);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return success("ok");
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}