From 41cd6c8db40bceb08290828ae0d4fc5caeea7147 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期六, 18 十一月 2023 15:58:25 +0800
Subject: [PATCH] 调整车牌识别配置

---
 src/main/java/com/fzzy/gateway/controller/GatewayDeviceController.java |   61 ++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/fzzy/gateway/controller/GatewayDeviceTestController.java b/src/main/java/com/fzzy/gateway/controller/GatewayDeviceController.java
similarity index 83%
rename from src/main/java/com/fzzy/gateway/controller/GatewayDeviceTestController.java
rename to src/main/java/com/fzzy/gateway/controller/GatewayDeviceController.java
index 605ee3a..0d6b52a 100644
--- a/src/main/java/com/fzzy/gateway/controller/GatewayDeviceTestController.java
+++ b/src/main/java/com/fzzy/gateway/controller/GatewayDeviceController.java
@@ -1,25 +1,15 @@
 package com.fzzy.gateway.controller;
 
-import com.alibaba.fastjson2.JSONObject;
-import com.bstek.dorado.annotation.Expose;
 import com.fzzy.api.data.GatewayDeviceType;
-import com.fzzy.api.utils.DateUtil;
-import com.fzzy.async.fzzy40.Fzzy40CommonService;
-import com.fzzy.async.fzzy40.entity.Fz40Grain;
 import com.fzzy.gateway.GatewayUtils;
-import com.fzzy.gateway.api.GatewayDeviceReportService;
 import com.fzzy.gateway.api.GatewayRemoteManager;
 import com.fzzy.gateway.data.BaseResp;
 import com.fzzy.gateway.data.BaseReqData;
-import com.fzzy.gateway.entity.GateWayTestParam;
+import com.fzzy.gateway.entity.GateWayParam;
 import com.fzzy.gateway.entity.GatewayDevice;
-import com.fzzy.gateway.hx2023.ScConstant;
-import com.fzzy.gateway.hx2023.data.*;
 import com.fzzy.gateway.service.GatewayDeviceService;
-import com.fzzy.mqtt.MqttGatewayService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateFormatUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -36,8 +26,8 @@
  */
 @Slf4j
 @Controller
-@RequestMapping("/gateway/test")
-public class GatewayDeviceTestController {
+@RequestMapping("/gateway")
+public class GatewayDeviceController {
 
     @Resource
     private GatewayDeviceService gatewayDeviceService;
@@ -52,9 +42,9 @@
      * @param param
      * @return
      */
-    @PostMapping("/deviceTest")
+    @PostMapping("/test/deviceTest")
     public @ResponseBody
-    String deviceTest(@RequestBody GateWayTestParam param) throws Exception {
+    String deviceTest(@RequestBody GateWayParam param) throws Exception {
 
         if (StringUtils.isEmpty(param.getBizType())) {
             return "ERROR:娌℃湁鑾峰彇鍒颁笟鍔$被鍨嬶紝鎵ц澶辫触";
@@ -79,7 +69,39 @@
         return "SUCCESS";
     }
 
-    private String testGrain(GateWayTestParam param) {
+    /**
+     * 鍒濆鍖栬溅鐗岃瘑鍒�
+     *
+     * @param param
+     * @return
+     */
+    @PostMapping("/control/init-lpr")
+    public @ResponseBody
+    String initLpr(@RequestBody GateWayParam param) throws Exception {
+
+        List<GatewayDevice> list = gatewayDeviceService.listAll();
+
+        if (null == list || list.isEmpty()) {
+            return "ERROR:娌℃湁鑾峰彇鍒拌澶囦俊鎭�";
+        }
+
+        BaseReqData reqData;
+        int i = 1;
+        for (GatewayDevice device : list) {
+
+            if (!GatewayDeviceType.TYPE_02.getCode().equals(device.getType())) {
+                continue;
+            }
+            reqData = new BaseReqData(device);
+            reqData.setIndex(i);
+            gatewayRemoteManager.getSyncLprService(device.getSyncProtocol()).initLpr(reqData);
+            i++;
+        }
+
+        return "SUCCESS";
+    }
+
+    private String testGrain(GateWayParam param) {
         String deviceId = param.getDeviceId();
 
         GatewayDevice device = GatewayUtils.getCacheByDeviceId(deviceId);
@@ -116,7 +138,7 @@
      * @param param
      * @return
      */
-    public String ajaxTestKafkaGrain(GateWayTestParam param) throws Exception {
+    public String ajaxTestKafkaGrain(GateWayParam param) throws Exception {
         List<GatewayDevice> list = gatewayDeviceService.listAll();
         if (null == list || list.isEmpty()) {
             return "ERROR锛氫负鑾峰彇鍒扮郴缁熶腑璁惧閰嶇疆锛屽彇娑堟墽琛�";
@@ -148,10 +170,9 @@
      * @param param
      * @return
      */
-    public String ajaxTestWeight(GateWayTestParam param) throws Exception {
+    public String ajaxTestWeight(GateWayParam param) throws Exception {
 
         double weight = param.getWeight();
-        String deviceId = param.getDeviceId();
 
         List<GatewayDevice> list = gatewayDeviceService.listAll();
         if (list == null || list.size() <= 0) {
@@ -189,7 +210,7 @@
      *
      * @return
      */
-    public String ajaxTestLpr(GateWayTestParam param) throws Exception {
+    public String ajaxTestLpr(GateWayParam param) throws Exception {
 
         String carNumber = param.getCarNumber();
 

--
Gitblit v1.9.3