Parcourir la source

百度车牌识别测试

wukai il y a 1 jour
Parent
commit
70ff51179c

+ 115 - 0
ruoyi-admin/src/main/java/com/baidu/A1.java

@@ -0,0 +1,115 @@
+package com.baidu;
+
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileOutputStream;
+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.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+/**
+ * 源文件识别第一次,用于改名
+ */
+
+
+public class A1 {
+    public static final String source = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\source";
+    public static final String target = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\one";
+    public static Map<String, String> originalMD5Map;
+
+    public static void main(String[] args) throws Exception {
+        batchV5();
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File(source);
+        List<PlateVO> successList = new ArrayList<>();
+        List<PlateVO> failList = new ArrayList<>();
+        List<PlateVO> noList = new ArrayList<>();
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String oldName = file.getName();
+                    String[] tmp = oldName.split("-");
+                    String plateCode = tmp[0].replace(".jpg", "");
+                    if (!file.isFile()) {
+                        continue;
+                    }
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&prob_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number").getJSONObject(0);
+                        String word = ooo.getStr("word");
+                        String info = ooo.getStr("cover_info");
+                        Double score = ooo.getDouble("det_score");
+                        String color = ooo.getStr("plate_color");
+                        PlateVO vo = new PlateVO();
+                        vo.setName(plateCode);
+                        if (StringUtils.isEmpty(word)) {
+                            String o = file.getPath();
+                            String n = target+"\\no\\" + file.getName();
+                            copy(o, n);
+                            noList.add(vo);
+                            continue;
+                        }
+                        vo.setPlate(word);
+                        vo.setScore(score);
+                        vo.setColor(color);
+
+                        String o = file.getPath();
+                        String n = target+"\\" + word + ".jpg";
+                        copy(o, n);
+                        successList.add(vo);
+                    }
+                }
+            }
+        }
+    }
+
+    public static void copy(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.copy(oldPath, newPath);
+        } catch (IOException e) {
+            System.out.println("文件复制失败: " + n);
+            e.printStackTrace();
+            n = n.replace(".jpg", "-" + System.currentTimeMillis() + ".jpg");
+            copy(o, n);
+        }
+    }
+}

+ 169 - 0
ruoyi-admin/src/main/java/com/baidu/A2.java

@@ -0,0 +1,169 @@
+package com.baidu;
+
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileOutputStream;
+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.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class A2 {
+    public static final String target = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\test20250606";
+    public static final String source = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\two";
+    public static final String original = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\source";
+    public static Map<String, String> originalMD5Map;
+
+    public static void main(String[] args) throws Exception {
+        batchV5();
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File(source);
+        List<PlateVO> successList = new ArrayList<>();
+        List<PlateVO> failList = new ArrayList<>();
+        List<PlateVO> noList = new ArrayList<>();
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String oldName = file.getName();
+                    String[] tmp = oldName.split("-");
+                    String plateCode = tmp[0].replace(".jpg", "");
+                    if (!file.isFile()) {
+                        continue;
+                    }
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&prob_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number").getJSONObject(0);
+                        String word = ooo.getStr("word");
+                        String info = ooo.getStr("cover_info");
+                        Double score = ooo.getDouble("det_score");
+                        String color = ooo.getStr("plate_color");
+                        PlateVO vo = new PlateVO();
+                        vo.setName(plateCode);
+                        vo.setMd5(FileMD5Matcher.calculateMD5(file.toPath()));
+                        if (StringUtils.isEmpty(word)) {
+                            String o = file.getPath();
+                            String n = target + "\\no\\" + file.getName();
+                            copy(o, n);
+                            noList.add(vo);
+                            continue;
+                        }
+                        vo.setPlate(word);
+                        vo.setScore(score);
+                        vo.setColor(color);
+
+                        if (word.equals(plateCode)) {
+                            String o = file.getPath();
+                            String n = target + "\\success\\" + file.getName();
+                            copy(o, n);
+                            successList.add(vo);
+                        } else {
+                            String o = file.getPath();
+                            String n = target + "\\fail\\" + file.getName();
+                            copy(o, n);
+                            failList.add(vo);
+                        }
+                    }
+                    System.out.println(new String(decode, StandardCharsets.UTF_8));
+                }
+            }
+        }
+        originalMD5Map = FileMD5Matcher.buildOriginalMD5Map(original);
+        toExcel(successList, failList, noList);
+    }
+
+    public static void toExcel(List<PlateVO> successList, List<PlateVO> failList, List<PlateVO> noList) {
+        try (Workbook workbook = new XSSFWorkbook(); FileOutputStream outputStream = new FileOutputStream(target + "\\车牌识别结果" + System.currentTimeMillis() + ".xlsx")) {
+            String[] names = {"图片车牌", "图片地址", "识别出的车牌", "车牌颜色", "置信度"};
+            Sheet sheet = workbook.createSheet();
+            workbook.setSheetName(0, "正确识别");
+            sheet(sheet, names, successList);
+            Sheet sheet1 = workbook.createSheet();
+            workbook.setSheetName(1, "错误识别");
+            sheet(sheet1, names, failList);
+            Sheet sheet2 = workbook.createSheet();
+            workbook.setSheetName(2, "未识别");
+            sheet(sheet2, names, noList);
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void sheet(Sheet sheet, String[] names, List<PlateVO> list) {
+        Row title = sheet.createRow(0);
+        for (int i = 0; i < names.length; i++) {
+            Cell cell = title.createCell(i);
+            cell.setCellValue(names[i]);
+        }
+
+        AtomicInteger index = new AtomicInteger(1);
+        list.forEach(vo -> {
+            Row row = sheet.createRow(index.get());
+            Cell[] cells = new Cell[names.length];
+            for (int i = 0; i < names.length; i++) {
+                cells[i] = row.createCell(i);
+            }
+            cells[0].setCellValue(vo.getName());
+            String originalName = originalMD5Map.get(vo.getMd5());
+            cells[1].setCellValue(originalName);
+            if (vo.getScore() != null) {
+                cells[2].setCellValue(vo.getPlate());
+
+                cells[3].setCellValue(vo.getColor());
+                cells[4].setCellValue(vo.getScore());
+            }
+            index.getAndIncrement();
+        });
+    }
+
+    public static void copy(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.copy(oldPath, newPath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 65 - 0
ruoyi-admin/src/main/java/com/baidu/Base64Util.java

@@ -0,0 +1,65 @@
+package com.baidu;
+
+/**
+ * Base64 工具类
+ */
+public class Base64Util {
+    private static final char last2byte = (char) Integer.parseInt("00000011", 2);
+    private static final char last4byte = (char) Integer.parseInt("00001111", 2);
+    private static final char last6byte = (char) Integer.parseInt("00111111", 2);
+    private static final char lead6byte = (char) Integer.parseInt("11111100", 2);
+    private static final char lead4byte = (char) Integer.parseInt("11110000", 2);
+    private static final char lead2byte = (char) Integer.parseInt("11000000", 2);
+    private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
+
+    public Base64Util() {
+    }
+
+    public static String encode(byte[] from) {
+        StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3);
+        int num = 0;
+        char currentByte = 0;
+
+        int i;
+        for (i = 0; i < from.length; ++i) {
+            for (num %= 8; num < 8; num += 6) {
+                switch (num) {
+                    case 0:
+                        currentByte = (char) (from[i] & lead6byte);
+                        currentByte = (char) (currentByte >>> 2);
+                    case 1:
+                    case 3:
+                    case 5:
+                    default:
+                        break;
+                    case 2:
+                        currentByte = (char) (from[i] & last6byte);
+                        break;
+                    case 4:
+                        currentByte = (char) (from[i] & last4byte);
+                        currentByte = (char) (currentByte << 2);
+                        if (i + 1 < from.length) {
+                            currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6);
+                        }
+                        break;
+                    case 6:
+                        currentByte = (char) (from[i] & last2byte);
+                        currentByte = (char) (currentByte << 4);
+                        if (i + 1 < from.length) {
+                            currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4);
+                        }
+                }
+
+                to.append(encodeTable[currentByte]);
+            }
+        }
+
+        if (to.length() % 4 != 0) {
+            for (i = 4 - to.length() % 4; i > 0; --i) {
+                to.append("=");
+            }
+        }
+
+        return to.toString();
+    }
+}

+ 77 - 0
ruoyi-admin/src/main/java/com/baidu/FileMD5Matcher.java

@@ -0,0 +1,77 @@
+package com.baidu;
+
+import java.io.*;
+import java.nio.file.*;
+import java.security.*;
+import java.util.*;
+
+public class FileMD5Matcher {
+
+    // 计算文件的 MD5 值
+    public static String calculateMD5(Path path) throws Exception {
+        MessageDigest md = MessageDigest.getInstance("MD5");
+        try (InputStream is = Files.newInputStream(path);
+             DigestInputStream dis = new DigestInputStream(is, md)) {
+            byte[] buffer = new byte[8192];
+            while (dis.read(buffer) != -1) {
+            }
+
+        }
+        byte[] digest = md.digest();
+        StringBuilder sb = new StringBuilder();
+        for (byte b : digest) {
+            sb.append(String.format("%02x", b));
+        }
+        return sb.toString();
+    }
+
+    // 构建原始目录的 MD5 -> 文件名 映射
+    public static Map<String, String> buildOriginalMD5Map(String originalDir) throws Exception {
+        Map<String, String> md5ToFilename = new HashMap<>();
+        Files.list(Paths.get(originalDir))
+                .filter(Files::isRegularFile)
+                .forEach(path -> {
+                    try {
+                        String md5 = calculateMD5(path);
+                        md5ToFilename.put(md5, path.getFileName().toString());
+                    } catch (Exception e) {
+                        System.err.println("无法处理文件: " + path + ", 错误: " + e.getMessage());
+                    }
+                });
+        return md5ToFilename;
+    }
+
+    // 匹配新目录中的文件与原始目录中的 MD5
+    public static void matchNewFilesWithOriginals(String newDir, Map<String, String> originalMD5Map) throws Exception {
+        Map<String, String> matches = new HashMap<>();
+
+        Files.list(Paths.get(newDir))
+                .filter(Files::isRegularFile)
+                .forEach(path -> {
+                    try {
+                        String md5 = calculateMD5(path);
+                        String originalName = originalMD5Map.get(md5);
+                        if (originalName != null) {
+                            matches.put(path.getFileName().toString(), originalName);
+                        }
+                    } catch (Exception e) {
+                        System.err.println("无法处理文件: " + path + ", 错误: " + e.getMessage());
+                    }
+                });
+
+        matches.forEach((newName, originalName) ->
+            System.out.println(newName + " -> " + originalName));
+    }
+
+    public static void main(String[] args) {
+        String originalDir = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\source";
+        String newDir = "D:\\Project\\2025\\02.成都停车项目POC\\20250606\\no";
+
+        try {
+            Map<String, String> originalMD5Map = buildOriginalMD5Map(originalDir);
+            matchNewFilesWithOriginals(newDir, originalMD5Map);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 72 - 0
ruoyi-admin/src/main/java/com/baidu/FileUtil.java

@@ -0,0 +1,72 @@
+package com.baidu;
+
+import java.io.*;
+
+/**
+ * 文件读取工具类
+ */
+public class FileUtil {
+
+    /**
+     * 读取文件内容,作为字符串返回
+     */
+    public static String readFileAsString(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException(filePath);
+        }
+
+        if (file.length() > 1024 * 1024 * 1024) {
+            throw new IOException("File is too large");
+        }
+
+        StringBuilder sb = new StringBuilder((int) (file.length()));
+        // 创建字节输入流
+        FileInputStream fis = new FileInputStream(filePath);
+        // 创建一个长度为10240的Buffer
+        byte[] bbuf = new byte[10240];
+        // 用于保存实际读取的字节数
+        int hasRead = 0;
+        while ( (hasRead = fis.read(bbuf)) > 0 ) {
+            sb.append(new String(bbuf, 0, hasRead));
+        }
+        fis.close();
+        return sb.toString();
+    }
+
+    /**
+     * 根据文件路径读取byte[] 数组
+     */
+    public static byte[] readFileByBytes(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException(filePath);
+        } else {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
+            BufferedInputStream in = null;
+
+            try {
+                in = new BufferedInputStream(new FileInputStream(file));
+                short bufSize = 1024;
+                byte[] buffer = new byte[bufSize];
+                int len1;
+                while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
+                    bos.write(buffer, 0, len1);
+                }
+
+                byte[] var7 = bos.toByteArray();
+                return var7;
+            } finally {
+                try {
+                    if (in != null) {
+                        in.close();
+                    }
+                } catch (IOException var14) {
+                    var14.printStackTrace();
+                }
+
+                bos.close();
+            }
+        }
+    }
+}

+ 229 - 0
ruoyi-admin/src/main/java/com/baidu/Gen.java

@@ -0,0 +1,229 @@
+package com.baidu;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+
+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.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class Gen {
+
+    /**
+     * 重要提示代码中所需工具类
+     * FileUtil,Base64Util,HttpUtil,GsonUtils请从
+     * https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72
+     * https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2
+     * https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3
+     * https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3
+     * 下载
+     */
+    public static String generalBasic() {
+
+        // 请求url
+        //ip = 内网ip地址 , port = docker中ocr容器映射的端口
+        // 端口号可参考troulbe_shooting.sh返回结果
+//            String url = "http://ip:port/GeneralClassifyService/classify";
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        try {
+            // 本地文件路径
+            String filePath = "D:\\SYSTEM\\Desktop\\temp\\aa\\ttt.jpg";
+            byte[] imgData = FileUtil.readFileByBytes(filePath);
+            String imgStr = Base64Util.encode(imgData);
+            //此处需按照接口文档中的参数填写
+            String request_st1 = "object_type=plate&complete_tag=true&version=v1";
+            String data = request_st1 + "&image=" + imgStr;
+            byte[] ddata = data.getBytes();
+            String params = Base64Util.encode(ddata);
+
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("data", params);
+            String request_str1 = GsonUtils.toJson(map1);
+            String contentType = "application/json";
+            String encoding = "UTF-8";
+            String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+            JSONObject jso = new JSONObject(result);
+            String res = jso.getStr("result");
+            byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+            String str = new String(decode, StandardCharsets.UTF_8);
+            System.err.println(str);
+            JSONObject obj = new JSONObject(str);
+            JSONArray arr = obj.getJSONArray("ret");
+            JSONObject ooo = arr.getJSONObject(0);
+            String number = ooo.getStr("plate_number");
+            String color = ooo.getStr("plate_color");
+            System.err.println(number + "\t" + color);
+//            System.out.println();
+
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static void main(String[] args) throws Exception {
+//        Gen.generalBasic();
+//        batchV1();
+        batchV5();
+    }
+
+    public static void batchV1() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\v5\\no");
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&version=v1";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str);
+                    JSONArray arr = obj.getJSONArray("ret");
+                    if (arr != null) {
+                        JSONObject ooo = arr.getJSONObject(0);
+                        String number = ooo.getStr("plate_number");
+                        if (StringUtils.isEmpty(number)) {
+                            String name = "未识别-" + System.currentTimeMillis() + ".jpg";
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\v1\\no\\" + name;
+                            move(o, n);
+                            continue;
+                        }
+//                        String color = ooo.getStr("plate_color");
+//                        switch (color) {
+//                            case "blue":
+//                                color = "蓝牌";
+//                                break;
+//                            case "yellow":
+//                                color = "黄牌";
+//                                break;
+//                            case "green":
+//                                color = "绿牌";
+//                                break;
+//                            default:
+//                                color = "无";
+//                        }
+                        String name = number + "-" + System.currentTimeMillis() + ".jpg";
+                        String o = file.getPath();
+                        String n = "D:\\Project\\2025\\02.成都停车项目POC\\v1\\" + name;
+                        move(o, n);
+                    } else {
+                        String name = "未识别-" + System.currentTimeMillis() + ".jpg";
+                        String o = file.getPath();
+                        String n = "D:\\Project\\2025\\02.成都停车项目POC\\v1\\no\\" + name;
+                        move(o, n);
+                    }
+                }
+            }
+        }
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\img");
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number_single").getJSONObject(0);
+                        String info = ooo.getStr("cover_info");
+                        String number = ooo.getStr("word");
+                        if (StringUtils.isEmpty(number)) {
+                            String name = "未识别-" + System.currentTimeMillis() + ".jpg";
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\v5\\no\\" + name;
+                            move(o, n);
+                            continue;
+                        }
+//                        String color = ooo.getStr("plate_color");
+//                        switch (color) {
+//                            case "blue":
+//                                color = "蓝牌";
+//                                break;
+//                            case "yellow":
+//                                color = "黄牌";
+//                                break;
+//                            case "green":
+//                                color = "绿牌";
+//                                break;
+//                            default:
+//                                color = "无";
+//                        }
+                        String name = number + "-" + System.currentTimeMillis() + ".jpg";
+                        String o = file.getPath();
+                        String n = "D:\\Project\\2025\\02.成都停车项目POC\\v5\\" + name;
+                        move(o, n);
+                    }
+                    System.out.println(new String(decode, StandardCharsets.UTF_8));
+                }
+            }
+        }
+    }
+
+    public static void move(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.move(oldPath, newPath);
+//            System.out.println("文件重命名成功");
+        } catch (IOException e) {
+            e.printStackTrace();
+//            System.out.println("文件重命名失败: " + e.getMessage());
+        }
+    }
+}

+ 168 - 0
ruoyi-admin/src/main/java/com/baidu/GenSourceTest.java

@@ -0,0 +1,168 @@
+package com.baidu;
+
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileOutputStream;
+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.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class GenSourceTest {
+    public static final String target = "D:\\Project\\2025\\02.成都停车项目POC\\test20250530改";
+    public static Map<String, String> originalMD5Map;
+
+    public static void main(String[] args) throws Exception {
+        batchV5();
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\source20250530");
+        List<PlateVO> successList = new ArrayList<>();
+        List<PlateVO> failList = new ArrayList<>();
+        List<PlateVO> noList = new ArrayList<>();
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String oldName = file.getName();
+                    String[] tmp = oldName.split("-");
+                    String plateCode = tmp[0].replace(".jpg", "");
+                    if (!file.isFile()) {
+                        continue;
+                    }
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&prob_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number").getJSONObject(0);
+                        String word = ooo.getStr("word");
+                        String info = ooo.getStr("cover_info");
+                        Double score = ooo.getDouble("det_score");
+                        String color = ooo.getStr("plate_color");
+                        PlateVO vo = new PlateVO();
+                        vo.setName(plateCode);
+                        vo.setMd5(FileMD5Matcher.calculateMD5(file.toPath()));
+                        if (StringUtils.isEmpty(word)) {
+                            String o = file.getPath();
+                            String n = target + "\\no\\" + file.getName();
+                            copy(o, n);
+                            noList.add(vo);
+                            continue;
+                        }
+                        vo.setPlate(word);
+                        vo.setScore(score);
+                        vo.setColor(color);
+
+                        if (word.equals(plateCode)) {
+                            String o = file.getPath();
+                            String n = target + "\\success\\" + file.getName();
+                            copy(o, n);
+                            successList.add(vo);
+                        } else {
+                            String o = file.getPath();
+                            String n = target + "\\fail\\" + file.getName();
+                            copy(o, n);
+                            failList.add(vo);
+                        }
+                    }
+                    System.out.println(new String(decode, StandardCharsets.UTF_8));
+                }
+            }
+        }
+        String originalDir = "D:\\Project\\2025\\02.成都停车项目POC\\custom";
+        originalMD5Map = FileMD5Matcher.buildOriginalMD5Map(originalDir);
+        toExcel(successList, failList, noList);
+    }
+
+    public static void toExcel(List<PlateVO> successList, List<PlateVO> failList, List<PlateVO> noList) {
+        try (Workbook workbook = new XSSFWorkbook(); FileOutputStream outputStream = new FileOutputStream(target + "\\车牌识别结果" + System.currentTimeMillis() + ".xlsx")) {
+            String[] names = {"图片车牌", "图片地址", "识别出的车牌", "车牌颜色", "置信度"};
+            Sheet sheet = workbook.createSheet();
+            workbook.setSheetName(0, "正确识别");
+            sheet(sheet, names, successList);
+            Sheet sheet1 = workbook.createSheet();
+            workbook.setSheetName(1, "错误识别");
+            sheet(sheet1, names, failList);
+            Sheet sheet2 = workbook.createSheet();
+            workbook.setSheetName(2, "未识别");
+            sheet(sheet2, names, noList);
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void sheet(Sheet sheet, String[] names, List<PlateVO> list) {
+        Row title = sheet.createRow(0);
+        for (int i = 0; i < names.length; i++) {
+            Cell cell = title.createCell(i);
+            cell.setCellValue(names[i]);
+        }
+
+        AtomicInteger index = new AtomicInteger(1);
+        list.forEach(vo -> {
+            Row row = sheet.createRow(index.get());
+            Cell[] cells = new Cell[names.length];
+            for (int i = 0; i < names.length; i++) {
+                cells[i] = row.createCell(i);
+            }
+            cells[0].setCellValue(vo.getName());
+            String originalName = originalMD5Map.get(vo.getMd5());
+            cells[1].setCellValue(originalName);
+            if (vo.getScore() != null) {
+                cells[2].setCellValue(vo.getPlate());
+
+                cells[3].setCellValue(vo.getColor());
+                cells[4].setCellValue(vo.getScore());
+            }
+            index.getAndIncrement();
+        });
+    }
+
+    public static void copy(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.copy(oldPath, newPath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 216 - 0
ruoyi-admin/src/main/java/com/baidu/GenTest.java

@@ -0,0 +1,216 @@
+package com.baidu;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileOutputStream;
+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.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class GenTest {
+
+    /**
+     * 重要提示代码中所需工具类
+     * FileUtil,Base64Util,HttpUtil,GsonUtils请从
+     * https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72
+     * https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2
+     * https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3
+     * https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3
+     * 下载
+     */
+    public static String generalBasic() {
+
+        // 请求url
+        //ip = 内网ip地址 , port = docker中ocr容器映射的端口
+        // 端口号可参考troulbe_shooting.sh返回结果
+//            String url = "http://ip:port/GeneralClassifyService/classify";
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        try {
+            // 本地文件路径
+            String filePath = "D:\\SYSTEM\\Desktop\\temp\\aa\\ttt.jpg";
+            byte[] imgData = FileUtil.readFileByBytes(filePath);
+            String imgStr = Base64Util.encode(imgData);
+            //此处需按照接口文档中的参数填写
+            String request_st1 = "object_type=plate&complete_tag=true&version=v1";
+            String data = request_st1 + "&image=" + imgStr;
+            byte[] ddata = data.getBytes();
+            String params = Base64Util.encode(ddata);
+
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("data", params);
+            String request_str1 = GsonUtils.toJson(map1);
+            String contentType = "application/json";
+            String encoding = "UTF-8";
+            String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+            JSONObject jso = new JSONObject(result);
+            String res = jso.getStr("result");
+            byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+            String str = new String(decode, StandardCharsets.UTF_8);
+            System.err.println(str);
+            JSONObject obj = new JSONObject(str);
+            JSONArray arr = obj.getJSONArray("ret");
+            JSONObject ooo = arr.getJSONObject(0);
+            String number = ooo.getStr("plate_number");
+            String color = ooo.getStr("plate_color");
+            System.err.println(number + "\t" + color);
+//            System.out.println();
+
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static void main(String[] args) throws Exception {
+        batchV5();
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\parkimage0606\\parkimage0606");
+        List<PlateVO> successList = new ArrayList<>();
+        List<PlateVO> failList = new ArrayList<>();
+        List<PlateVO> noList = new ArrayList<>();
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String oldName = file.getName();
+                    String[] tmp = oldName.split("-");
+                    String plateCode = tmp[0].replace(".jpg", "");
+                    if (!file.isFile()) {
+                        continue;
+                    }
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&prob_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number").getJSONObject(0);
+                        String word = ooo.getStr("word");
+                        String info = ooo.getStr("cover_info");
+                        Double score = ooo.getDouble("det_score");
+                        String color = ooo.getStr("plate_color");
+                        PlateVO vo = new PlateVO();
+                        vo.setName(plateCode);
+                        if (StringUtils.isEmpty(word)) {
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\test\\no\\" + file.getName();
+                            copy(o, n);
+                            noList.add(vo);
+                            continue;
+                        }
+                        vo.setPlate(word);
+                        vo.setScore(score);
+                        vo.setColor(color);
+
+                        if (word.equals(plateCode)) {
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\test\\success\\" + file.getName();
+                            copy(o, n);
+                            successList.add(vo);
+                        } else {
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\test\\fail\\" + file.getName();
+                            copy(o, n);
+                            failList.add(vo);
+                        }
+                    }
+                    System.out.println(new String(decode, StandardCharsets.UTF_8));
+                }
+            }
+        }
+
+        toExcel(successList, failList, noList);
+    }
+
+    public static void toExcel(List<PlateVO> successList, List<PlateVO> failList, List<PlateVO> noList) {
+        try (Workbook workbook = new XSSFWorkbook(); FileOutputStream outputStream = new FileOutputStream("D:\\Project\\2025\\02.成都停车项目POC\\test\\车牌识别结果" + System.currentTimeMillis() + ".xlsx")) {
+            String[] names = {"图片车牌", "图片地址", "识别出的车牌", "车牌颜色", "置信度"};
+            Sheet sheet = workbook.createSheet();
+            workbook.setSheetName(0, "正确识别");
+            sheet(sheet, names, successList);
+            Sheet sheet1 = workbook.createSheet();
+            workbook.setSheetName(1, "错误识别");
+            sheet(sheet1, names, failList);
+            Sheet sheet2 = workbook.createSheet();
+            workbook.setSheetName(2, "未识别");
+            sheet(sheet2, names, noList);
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void sheet(Sheet sheet, String[] names, List<PlateVO> list) {
+        Row title = sheet.createRow(0);
+        for (int i = 0; i < names.length; i++) {
+            Cell cell = title.createCell(i);
+            cell.setCellValue(names[i]);
+        }
+
+        AtomicInteger index = new AtomicInteger(1);
+        list.forEach(vo -> {
+            Row row = sheet.createRow(index.get());
+            Cell[] cells = new Cell[names.length];
+            for (int i = 0; i < names.length; i++) {
+                cells[i] = row.createCell(i);
+            }
+            cells[0].setCellValue(vo.getName());
+            if (vo.getScore() != null) {
+                cells[2].setCellValue(vo.getPlate());
+                cells[3].setCellValue(vo.getColor());
+                cells[4].setCellValue(vo.getScore());
+            }
+            index.getAndIncrement();
+        });
+    }
+
+    public static void copy(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.copy(oldPath, newPath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 107 - 0
ruoyi-admin/src/main/java/com/baidu/GenTestWsb.java

@@ -0,0 +1,107 @@
+package com.baidu;
+
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.utils.StringUtils;
+
+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.util.*;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class GenTestWsb {
+
+    public static void main(String[] args) throws Exception {
+        batchV5();
+    }
+
+    public static void batchV5() throws Exception {
+        String url = "http://120.48.163.3:8278/GeneralClassifyService/classify";
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\wsb");
+        List<PlateVO> successList = new ArrayList<>();
+        List<PlateVO> failList = new ArrayList<>();
+        List<PlateVO> noList = new ArrayList<>();
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String oldName = file.getName();
+                    String[] tmp = oldName.split("-");
+                    String plateCode = tmp[0].replace(".jpg", "");
+                    if (!file.isFile()) {
+                        continue;
+                    }
+                    byte[] imgData = FileUtil.readFileByBytes(file.getPath());
+                    String imgStr = Base64Util.encode(imgData);
+                    //此处需按照接口文档中的参数填写
+                    String request_st1 = "object_type=plate&complete_tag=true&prob_tag=true&version=v5";
+                    String data = request_st1 + "&image=" + imgStr;
+                    byte[] ddata = data.getBytes();
+                    String params = Base64Util.encode(ddata);
+
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("data", params);
+                    String request_str1 = GsonUtils.toJson(map1);
+                    String contentType = "application/json";
+                    String encoding = "UTF-8";
+                    String result = HttpUtil.postGeneralUrl(url, contentType, request_str1, encoding);
+
+                    JSONObject jso = new JSONObject(result);
+                    String res = jso.getStr("result");
+
+                    byte[] decode = Base64.getDecoder().decode(res.getBytes(StandardCharsets.UTF_8));
+                    String str = new String(decode, StandardCharsets.UTF_8);
+                    JSONObject obj = new JSONObject(str).getJSONArray("ret").getJSONObject(0).getJSONObject("ret");
+                    if (obj != null) {
+                        JSONObject ooo = obj.getJSONArray("plate_number").getJSONObject(0);
+                        String word = ooo.getStr("word");
+                        String info = ooo.getStr("cover_info");
+                        Double score = ooo.getDouble("det_score");
+                        String color = ooo.getStr("plate_color");
+                        PlateVO vo = new PlateVO();
+                        vo.setName(plateCode);
+                        if (StringUtils.isEmpty(word)) {
+                            String o = file.getPath();
+                            String n = "D:\\Project\\2025\\02.成都停车项目POC\\test\\no\\" + file.getName();
+                            copy(o, n);
+                            noList.add(vo);
+                            continue;
+                        }
+                        vo.setPlate(word);
+                        vo.setScore(score);
+                        vo.setColor(color);
+
+                        String o = file.getPath();
+                        String n = "D:\\Project\\2025\\02.成都停车项目POC\\s2\\" + word + ".jpg";
+                        copy(o, n);
+                        successList.add(vo);
+                    }
+                }
+            }
+        }
+
+    }
+
+
+    public static void copy(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.copy(oldPath, newPath);
+        } catch (IOException e) {
+            System.out.println("文件复制失败: " + n);
+            e.printStackTrace();
+            n = n.replace(".jpg", "-" + System.currentTimeMillis() + ".jpg");
+            copy(o, n);
+        }
+    }
+}

+ 29 - 0
ruoyi-admin/src/main/java/com/baidu/GsonUtils.java

@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 Baidu, Inc. All Rights Reserved.
+ */
+package com.baidu;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonParseException;
+
+import java.lang.reflect.Type;
+
+/**
+ * Json工具类.
+ */
+public class GsonUtils {
+    private static Gson gson = new GsonBuilder().create();
+
+    public static String toJson(Object value) {
+        return gson.toJson(value);
+    }
+
+    public static <T> T fromJson(String json, Class<T> classOfT) throws JsonParseException {
+        return gson.fromJson(json, classOfT);
+    }
+
+    public static <T> T fromJson(String json, Type typeOfT) throws JsonParseException {
+        return (T) gson.fromJson(json, typeOfT);
+    }
+}

+ 77 - 0
ruoyi-admin/src/main/java/com/baidu/HttpUtil.java

@@ -0,0 +1,77 @@
+package com.baidu;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * http 工具类
+ */
+public class HttpUtil {
+
+    public static String post(String requestUrl, String accessToken, String params)
+            throws Exception {
+        String contentType = "application/x-www-form-urlencoded";
+        return HttpUtil.post(requestUrl, accessToken, contentType, params);
+    }
+
+    public static String post(String requestUrl, String accessToken, String contentType, String params)
+            throws Exception {
+        String encoding = "UTF-8";
+        if (requestUrl.contains("nlp")) {
+            encoding = "GBK";
+        }
+        return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding);
+    }
+
+    public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding)
+            throws Exception {
+        String url = requestUrl + "?access_token=" + accessToken;
+        return HttpUtil.postGeneralUrl(url, contentType, params, encoding);
+    }
+
+    public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding)
+            throws Exception {
+        URL url = new URL(generalUrl);
+        // 打开和URL之间的连接
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestMethod("POST");
+        // 设置通用的请求属性
+        connection.setRequestProperty("Content-Type", contentType);
+        connection.setRequestProperty("Connection", "Keep-Alive");
+        connection.setUseCaches(false);
+        connection.setDoOutput(true);
+        connection.setDoInput(true);
+
+        // 得到请求的输出流对象
+        DataOutputStream out = new DataOutputStream(connection.getOutputStream());
+        out.write(params.getBytes(encoding));
+        out.flush();
+        out.close();
+
+        // 建立实际的连接
+        connection.connect();
+        // 获取所有响应头字段
+        Map<String, List<String>> headers = connection.getHeaderFields();
+        // 遍历所有的响应头字段
+//        for (String key : headers.keySet()) {
+//            System.err.println(key + "--->" + headers.get(key));
+//        }
+        // 定义 BufferedReader输入流来读取URL的响应
+        BufferedReader in = null;
+        in = new BufferedReader(
+                new InputStreamReader(connection.getInputStream(), encoding));
+        String result = "";
+        String getLine;
+        while ((getLine = in.readLine()) != null) {
+            result += getLine;
+        }
+        in.close();
+//        System.err.println("result:" + result);
+        return result;
+    }
+}

+ 13 - 0
ruoyi-admin/src/main/java/com/baidu/Md5Test.java

@@ -0,0 +1,13 @@
+package com.baidu;
+
+/**
+ * Md5Test$
+ *
+ * @author wukai
+ * @date 2025/5/29 21:34
+ */
+public class Md5Test {
+    public static void main(String[] args) {
+
+    }
+}

+ 19 - 0
ruoyi-admin/src/main/java/com/baidu/PlateVO.java

@@ -0,0 +1,19 @@
+package com.baidu;
+
+import lombok.Data;
+
+/**
+ * PlateVO$
+ *
+ * @author wukai
+ * @date 2025/5/23 16:58
+ */
+@Data
+public class PlateVO {
+    private String name;
+    private String plate;
+    private Double score;
+    private String color;
+    private String oldName;
+    private String md5;
+}

+ 56 - 0
ruoyi-admin/src/main/java/com/baidu/Test.java

@@ -0,0 +1,56 @@
+package com.baidu;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+
+/**
+ * 通用文字识别
+ */
+
+
+public class Test {
+
+    /**
+     * 重要提示代码中所需工具类
+     * FileUtil,Base64Util,HttpUtil,GsonUtils请从
+     * https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72
+     * https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2
+     * https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3
+     * https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3
+     * 下载
+     */
+    public static void main(String[] args) throws Exception {
+        File directory = new File("D:\\Project\\2025\\02.成都停车项目POC\\s1");
+        if (directory.isDirectory()) {
+            File[] files = directory.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    String name = file.getName();
+                    if (name.indexOf("jpg") == -1) {
+                        String o = file.getPath();
+                        String n = "D:\\Project\\2025\\02.成都停车项目POC\\s1\\" + name + ".jpg";
+                        move(o, n);
+
+                    }
+                }
+            }
+        }
+    }
+
+    public static void move(String o, String n) {
+        Path oldPath = Paths.get(o);
+        Path newPath = Paths.get(n);
+
+        try {
+            Files.move(oldPath, newPath);
+//            System.out.println("文件重命名成功");
+        } catch (IOException e) {
+            e.printStackTrace();
+//            System.out.println("文件重命名失败: " + e.getMessage());
+        }
+    }
+}

+ 6 - 6
ruoyi-admin/src/test/java/com/jjt/DataProcess.java

@@ -62,10 +62,10 @@ public class DataProcess {
 
     @Test
     void test() {
-        String code = "3";
+        String code = "135";
         String table = "root.tl.suxi.knittings" + code + "_plc1";
         Workbook workbook = new XSSFWorkbook();
-        String date = "2024-06-25";
+        String date = "2025-02-24";
         System.err.println(date);
         List<String[]> list = new ArrayList<>();
         for (int j = 7; j < 19; j++) {
@@ -73,10 +73,10 @@ public class DataProcess {
             list.addAll(pList);
         }
 //        String date="2024-06-25";
-        for (int j = 0; j < 7; j++) {
-            List<String[]> pList = getNew(table, date, j);
-            list.addAll(pList);
-        }
+//        for (int j = 0; j < 7; j++) {
+//            List<String[]> pList = getNew(table, date, j);
+//            list.addAll(pList);
+//        }
         Sheet sheet = workbook.createSheet("A班");
         toExcelNew(list, sheet);
         try (FileOutputStream outputStream = new FileOutputStream("D:\\SYSTEM\\Desktop\\temp\\excel\\小经编机" + code + "号+" + date + "-明细.xlsx")) {