增加二维码识别算法更新

物流展会算法
LAPTOP-S9HJSOEB\昊天 1 month ago
parent 0eaf361577
commit 54e4c70683

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,2 +1,2 @@
2026-05-12 00:10:00.167 [scheduling-1] INFO [com.example.lxcameraapi.service.cron.CronTab] - corn delete file
2026-05-12 00:10:00.173 [scheduling-1] INFO [com.example.lxcameraapi.service.cron.CronTab] - free space :0
2026-05-15 00:10:00.082 [scheduling-1] INFO [com.example.lxcameraapi.service.cron.CronTab] - corn delete file
2026-05-15 00:10:00.086 [scheduling-1] INFO [com.example.lxcameraapi.service.cron.CronTab] - free space :0

@ -1,15 +1,21 @@
2026-05-12 01:30:15.285 [task-2363] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
2026-05-14 10:42:46.219 [task-7] ERROR [com.example.lxcameraapi.service.HttpNotifyService] - 发送箱子计数结果失败: http://127.0.0.1:48080/admin-api/logistics/StockController/singleInventoryReturn
java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:827)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:759)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1706)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:531)
at com.example.lxcameraapi.service.HttpNotifyService.sendBoxCountResult(HttpNotifyService.java:66)
at com.example.lxcameraapi.service.AsyncProcessingService.processCategoryAsync(AsyncProcessingService.java:86)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
@ -22,18 +28,24 @@ java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 01:31:24.493 [task-2369] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
2026-05-14 10:42:48.418 [task-8] ERROR [com.example.lxcameraapi.service.HttpNotifyService] - 发送HTTP请求失败: http://127.0.0.1:48080/admin-api/logistics/StockController/singleInventoryQrCodeReturn
java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:827)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:759)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1706)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:531)
at com.example.lxcameraapi.service.HttpNotifyService.sendQrCodeResult(HttpNotifyService.java:134)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:178)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
@ -46,18 +58,24 @@ java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 01:32:31.568 [task-2375] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
2026-05-14 11:04:02.710 [task-11] ERROR [com.example.lxcameraapi.service.HttpNotifyService] - 发送HTTP请求失败: http://127.0.0.1:48080/admin-api/logistics/StockController/singleInventoryQrCodeReturn
java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:827)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:759)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1706)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:531)
at com.example.lxcameraapi.service.HttpNotifyService.sendQrCodeResult(HttpNotifyService.java:134)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:178)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
@ -70,18 +88,27 @@ java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 01:33:06.711 [task-2378] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
2026-05-14 11:08:33.483 [task-12] ERROR [com.example.lxcameraapi.service.HttpNotifyService] - 发送箱子计数结果失败: http://127.0.0.1:48080/admin-api/logistics/StockController/singleInventoryReturn
java.net.ConnectException: Connection refused: getsockopt
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:690)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
at java.base/java.net.Socket.connect(Socket.java:751)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:531)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:636)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:282)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:386)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:408)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1320)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1253)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1139)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1068)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1462)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1433)
at com.example.lxcameraapi.service.HttpNotifyService.sendBoxCountResult(HttpNotifyService.java:60)
at com.example.lxcameraapi.service.AsyncProcessingService.processBoxCountAsync(AsyncProcessingService.java:117)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
@ -94,138 +121,24 @@ java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 02:21:53.398 [task-2636] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 02:22:59.645 [task-2642] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 02:24:09.161 [task-2648] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 04:03:44.191 [task-3176] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 04:04:17.137 [task-3179] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
2026-05-12 04:04:50.974 [task-3182] ERROR [c.e.lxcameraapi.service.AsyncProcessingService] - 异步任务执行异常
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4849)
at java.base/java.lang.String.substring(String.java:2823)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:168)
2026-05-14 11:14:15.828 [task-20] ERROR [com.example.lxcameraapi.service.HttpNotifyService] - 发送HTTP请求失败: http://127.0.0.1:48080/admin-api/logistics/StockController/singleInventoryQrCodeReturn
java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:827)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:759)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1706)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:531)
at com.example.lxcameraapi.service.HttpNotifyService.sendQrCodeResult(HttpNotifyService.java:134)
at com.example.lxcameraapi.service.AsyncProcessingService.processQrCodeAsync(AsyncProcessingService.java:178)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352)

File diff suppressed because it is too large Load Diff

@ -10,13 +10,24 @@ import com.example.lxcameraapi.service.IndustrialCamera.camera.lx.config.Capture
import com.example.lxcameraapi.service.IndustrialCamera.opencv.OpencvService;
import com.example.lxcameraapi.service.IndustrialCamera.yolo.BoundingBox;
import com.example.lxcameraapi.service.IndustrialCamera.QrCode.WeChatDeCode;
import org.opencv.core.Mat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -135,7 +146,7 @@ public class AsyncProcessingService {
log.info("异步识别任务开始,路径: {}", path);
List<BoundingBox> detectResults = onnxServiceNew.detect26(path, "qrCode");
opencvService.drawBoundingBoxesOnImage(detectResults, path, path + ".jpg");
log.info("异步检测结果: {}", detectResults);
// 读取原始图片
@ -147,25 +158,44 @@ public class AsyncProcessingService {
// 存储解码结果
List<String> qrCodeResults = new ArrayList<>();
for (BoundingBox box : detectResults) {
List<BoundingBox> detectCVResults = new ArrayList<>();
for (int i = 0; i < detectResults.size(); i++) {
BoundingBox box = detectResults.get(i);
try {
BufferedImage croppedImage = cropBoundingBox(originalImage, box, 30);
ImageIO.write(croppedImage, "jpg", new File(path + "_" + box.getIndex() + ".jpg"));
String qrCodeContent = WeChatDeCode.deCode(croppedImage);
qrCodeResults.add(qrCodeContent);
// 最小尺寸放大
int minSize = 320;
if (croppedImage.getWidth() < minSize || croppedImage.getHeight() < minSize) {
int newWidth = Math.max(croppedImage.getWidth(), minSize);
int newHeight = Math.max(croppedImage.getHeight(), minSize);
croppedImage = resizeImage(croppedImage, newWidth, newHeight);
}
// 解码最多重试2次每次放大1.5倍)
String qrCodeContent = decodeQrCodeWithRetry(croppedImage, box.getConfidence(),2);
if (qrCodeContent != null) {
log.info("异步解码成功: {}, 置信度: {}", qrCodeContent, box.getConfidence());
} else {
log.warn("异步解码失败box: {}", box);
qrCodeResults.add(qrCodeContent);
detectCVResults.add(box);
box.setName(qrCodeContent);
}else {
ImageIO.write(croppedImage, "jpg", new File(path + "_" + i + ".jpg"));
}
} catch (Exception e) {
log.error("异步解码二维码异常box: {}", box, e);
}
}
opencvService.drawBoundingBoxesOnImage(detectCVResults, path, path+ ".jpg");
log.info("二维码识别结果: {}", qrCodeResults);
// 构建结果
String result = qrCodeResults.size() > 0 ? qrCodeResults.get(0).substring(0, 8) : "Unknown";
String result = "Unknown";
if (qrCodeResults.size() > 0 && qrCodeResults.get(0).length() >= 8) {
result = qrCodeResults.get(0).substring(0, 8);
} else if (qrCodeResults.size() > 0) {
result = qrCodeResults.get(0);
}
String imagePath = url + ".jpg";
// 发送HTTP通知到 singleInventoryQrCodeReturn
@ -180,6 +210,34 @@ public class AsyncProcessingService {
}
}
public static void main(String[] args) {
String path = "D:\\data\\media\\2026-05-15\\1\\2026-05-15-00-07-20-909.png_3.jpg";
BufferedImage croppedImage = null;
AsyncProcessingService asyncProcessingService = new AsyncProcessingService();
String qrCodeContent = null;
try {
croppedImage = ImageIO.read(new File(path));
// 如果图片小于320px放大到320px
// 最小尺寸放大
int minSize = 320;
if (croppedImage.getWidth() < minSize || croppedImage.getHeight() < minSize) {
int newWidth = Math.max(croppedImage.getWidth(), minSize);
int newHeight = Math.max(croppedImage.getHeight(), minSize);
croppedImage = asyncProcessingService.resizeImage(croppedImage, newWidth, newHeight);
}
// 解码最多重试2次每次放大1.5倍)
qrCodeContent = asyncProcessingService.decodeQrCodeWithRetry(croppedImage, 0.9f,2);
} catch (IOException e) {
throw new RuntimeException(e);
}
// ImageIO.write(croppedImage, "jpg", new File(path + "_" + i + ".jpg"));
// 先尝试 ZXing 解码
System.out.println("解码结果: " + qrCodeContent);
}
private BufferedImage cropBoundingBox(BufferedImage originalImage, BoundingBox box, int expandPixels) {
int imageWidth = originalImage.getWidth();
int imageHeight = originalImage.getHeight();
@ -203,4 +261,161 @@ public class AsyncProcessingService {
return originalImage.getSubimage(x, y, width, height);
}
/**
*
* @param image
* @param confidence
* @param maxRetries 1.5
* @return null
*/
private String decodeQrCodeWithRetry(BufferedImage image, double confidence, int maxRetries) {
String qrCodeContent = null;
BufferedImage currentImage = image;
for (int retry = 0; retry <= maxRetries; retry++) {
if (retry > 0) {
// 放大图片1.5倍
int newWidth = (int) (currentImage.getWidth() * 1.5);
int newHeight = (int) (currentImage.getHeight() * 1.5);
currentImage = resizeImage(currentImage, newWidth, newHeight);
log.debug("二维码放大重试 {},尺寸: {}x{}", retry, newWidth, newHeight);
}
// 尝试不同预处理方式
qrCodeContent = decodeWithPreprocessing(currentImage, confidence, retry);
if (qrCodeContent != null) {
return qrCodeContent;
}
}
log.warn("异步解码失败,置信度: {}", confidence);
return null;
}
/**
* 使
*/
private String decodeWithPreprocessing(BufferedImage image, double confidence, int retryIndex) {
// 1. 尝试原始图片
String result = tryDecode(image, confidence, retryIndex, "原始");
if (result != null) return result;
// 2. 尝试灰度化
try {
Mat mat = opencvService.bufferedImageToMat(image);
Mat gray = opencvService.toGrayscale(mat);
BufferedImage grayImage = opencvService.matToBufferedImage(gray);
mat.release();
gray.release();
result = tryDecode(grayImage, confidence, retryIndex, "灰度");
if (result != null) return result;
} catch (Exception e) {
log.debug("灰度预处理失败: {}", e.getMessage());
}
// 3. 尝试CLAHE增强
try {
Mat mat = opencvService.bufferedImageToMat(image);
Mat clahe = opencvService.clahe(mat);
BufferedImage claheImage = opencvService.matToBufferedImage(clahe);
mat.release();
clahe.release();
result = tryDecode(claheImage, confidence, retryIndex, "CLAHE");
if (result != null) return result;
} catch (Exception e) {
log.debug("CLAHE预处理失败: {}", e.getMessage());
}
// 4. 尝试二值化
try {
Mat mat = opencvService.bufferedImageToMat(image);
Mat binary = opencvService.adaptiveThreshold(mat);
BufferedImage binaryImage = opencvService.matToBufferedImage(binary);
mat.release();
binary.release();
result = tryDecode(binaryImage, confidence, retryIndex, "二值化");
if (result != null) return result;
} catch (Exception e) {
log.debug("二值化预处理失败: {}", e.getMessage());
}
// 5. 尝试组合预处理(去噪+灰度+CLAHE+二值化)
try {
Mat mat = opencvService.bufferedImageToMat(image);
Mat processed = opencvService.preprocessForQrCode(mat);
BufferedImage processedImage = opencvService.matToBufferedImage(processed);
mat.release();
processed.release();
result = tryDecode(processedImage, confidence, retryIndex, "组合预处理");
if (result != null) return result;
} catch (Exception e) {
log.debug("组合预处理失败: {}", e.getMessage());
}
return null;
}
/**
*
*/
private String tryDecode(BufferedImage image, double confidence, int retryIndex, String preprocessType) {
String qrCodeContent;
// 先尝试 ZXing 解码
try {
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
HybridBinarizer binarizer = new HybridBinarizer(source);
BinaryBitmap bitmap = new BinaryBitmap(binarizer);
QRCodeReader reader = new QRCodeReader();
Result result = reader.decode(bitmap);
qrCodeContent = result.getText();
if (isValidQrCode(qrCodeContent)) {
log.info("ZXing解码成功({}放大{}次): {}, 置信度: {}", preprocessType, retryIndex, qrCodeContent, confidence);
return qrCodeContent;
} else {
log.warn("ZXing解码内容无效: {}, 继续尝试", qrCodeContent);
}
} catch (Exception zxingEx) {
log.debug("ZXing解码失败({}): {}", preprocessType, zxingEx.getMessage());
}
// ZXing 失败,尝试 WeChat 解码
try {
qrCodeContent = WeChatDeCode.deCode(image);
if (isValidQrCode(qrCodeContent)) {
log.info("WeChat解码成功({}放大{}次): {}, 置信度: {}", preprocessType, retryIndex, qrCodeContent, confidence);
return qrCodeContent;
} else {
log.warn("WeChat解码内容无效: {}, 继续尝试", qrCodeContent);
}
} catch (Exception wechatEx) {
log.debug("WeChat解码失败({}): {}", preprocessType, wechatEx.getMessage());
}
return null;
}
/**
*
* @param content
* @return true
*/
private boolean isValidQrCode(String content) {
return content != null && !content.trim().isEmpty() && !content.equals("0");
}
/**
*
*/
private BufferedImage resizeImage(BufferedImage originalImage, int targetWidth, int targetHeight) {
BufferedImage resizedImage = new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = resizedImage.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.drawImage(originalImage, 0, 0, targetWidth, targetHeight, null);
g2d.dispose();
return resizedImage;
}
}

@ -3,10 +3,15 @@ package com.example.lxcameraapi.service.IndustrialCamera.opencv;
import com.example.lxcameraapi.service.IndustrialCamera.yolo.BoundingBox;
import lombok.extern.slf4j.Slf4j;
import org.opencv.core.*;
import org.opencv.core.Point;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.CLAHE;
import org.opencv.imgproc.Imgproc;
import org.springframework.stereotype.Service;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -223,5 +228,142 @@ public class OpencvService {
Imgproc.putText(image, label, textOrg, FONT_FACE, FONT_SCALE, TEXT_COLOR, THICKNESS);
}
}
/**
* BufferedImage Mat
*/
public Mat bufferedImageToMat(BufferedImage image) {
if (image.getType() == BufferedImage.TYPE_INT_RGB) {
return matify(image);
} else {
BufferedImage rgbImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g = rgbImage.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
return matify(rgbImage);
}
}
private Mat matify(BufferedImage image) {
byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3);
mat.put(0, 0, data);
return mat;
}
/**
* Mat BufferedImage
*/
public BufferedImage matToBufferedImage(Mat matrix) {
int type = BufferedImage.TYPE_BYTE_GRAY;
if (matrix.channels() > 1) {
type = BufferedImage.TYPE_3BYTE_BGR;
}
int bufferSize = matrix.channels() * matrix.cols() * matrix.rows();
byte[] buffer = new byte[bufferSize];
matrix.get(0, 0, buffer);
BufferedImage image = new BufferedImage(matrix.cols(), matrix.rows(), type);
final byte[] targetPixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
System.arraycopy(buffer, 0, targetPixels, 0, buffer.length);
return image;
}
/**
* -
*/
public Mat toGrayscale(Mat src) {
Mat gray = new Mat();
Imgproc.cvtColor(src, gray, Imgproc.COLOR_BGR2GRAY);
return gray;
}
/**
* -
*/
public Mat adaptiveThreshold(Mat src) {
Mat gray = toGrayscale(src);
Mat binary = new Mat();
Imgproc.adaptiveThreshold(gray, binary, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,
Imgproc.THRESH_BINARY, 11, 2);
gray.release();
return binary;
}
/**
* -
*/
public Mat histogramEqualization(Mat src) {
Mat gray = toGrayscale(src);
Mat equalized = new Mat();
Imgproc.equalizeHist(gray, equalized);
gray.release();
return equalized;
}
/**
* -
*/
public Mat sharpen(Mat src) {
Mat kernel = new Mat(3, 3, CvType.CV_32F);
float[] data = {
0, -1, 0,
-1, 5, -1,
0, -1, 0
};
kernel.put(0, 0, data);
Mat sharpened = new Mat();
Imgproc.filter2D(src, sharpened, -1, kernel);
kernel.release();
return sharpened;
}
/**
* -
*/
public Mat denoise(Mat src) {
Mat denoised = new Mat();
Imgproc.GaussianBlur(src, denoised, new Size(3, 3), 0);
return denoised;
}
/**
* -
*/
public Mat enhanceContrast(Mat src, double alpha, int beta) {
Mat enhanced = new Mat();
src.convertTo(enhanced, -1, alpha, beta);
return enhanced;
}
/**
* - CLAHE
*/
public Mat clahe(Mat src) {
Mat gray = toGrayscale(src);
CLAHE clahe = Imgproc.createCLAHE(2.0, new Size(8, 8));
Mat result = new Mat();
clahe.apply(gray, result);
gray.release();
return result;
}
/**
* -> -> CLAHE ->
*/
public Mat preprocessForQrCode(Mat src) {
// 1. 去噪
Mat denoised = denoise(src);
// 2. 灰度
Mat gray = toGrayscale(denoised);
denoised.release();
// 3. CLAHE增强
Mat clahe = clahe(gray);
gray.release();
// 4. 二值化
Mat binary = new Mat();
Imgproc.threshold(clahe, binary, 0, 255, Imgproc.THRESH_BINARY + Imgproc.THRESH_OTSU);
clahe.release();
return binary;
}
}

@ -76,6 +76,6 @@ yoloModelConfig:
# 图片大小
imgSize: 2048
# 置信度
confThreshold: 0.95
confThreshold: 0.90
names: ['code']

Loading…
Cancel
Save