From 6bc1206774770deb0b2df12ab24b4628e1f399eb Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期一, 22 七月 2024 10:56:36 +0800
Subject: [PATCH] 电磁锁状态查询修改及若依生成文件提交

---
 ard-work/src/main/resources/mapper/sy/ArdTankLockStateMapper.xml                           |  113 ++++
 ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockStateServiceImpl.java          |  100 +++
 ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockAutoProcessLog.java                  |  219 ++++++++
 ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockAutoProcessLogServiceImpl.java |   92 +++
 ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java                          |    2 
 ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLock.java                                |   10 
 ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml                                |   48 +
 ard-work/src/main/resources/mapper/sy/ArdTankLockAutoProcessLogMapper.xml                  |  118 ++++
 ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java                     |   44 +
 ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockState.java                           |  187 ++++++
 ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java                      |    2 
 ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java               |   18 
 ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplSerialPort.java                    |  370 +++++++++++--
 ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockAutoProcessLogMapper.java            |   61 ++
 ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockStateService.java                  |   63 ++
 ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java     |   42 +
 ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockStateMapper.java                     |   63 ++
 ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockAutoProcessLogService.java         |   61 ++
 18 files changed, 1,539 insertions(+), 74 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index 5a992eb..28f36b3 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -1,5 +1,6 @@
 package com.ruoyi.sy.controller;
 
+import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -18,6 +19,7 @@
 import com.ruoyi.sy.gps31.PushClientImplSerialPort;
 import com.ruoyi.sy.param.ArdSyCarParam;
 import com.ruoyi.sy.service.IArdTankAbnormalParkAlarmService;
+import com.ruoyi.sy.service.IArdTankLockService;
 import com.ruoyi.sy.service.impl.ArdTankLockServiceImpl;
 import com.ruoyi.sy.vo.ArdSyCarVo;
 import com.ruoyi.sy.domain.ArdSyUser;
@@ -34,6 +36,9 @@
 import com.ruoyi.utils.result.Results;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -79,6 +84,9 @@
 
     @Autowired
     private IArdTankAbnormalParkAlarmService ardTankAbnormalParkAlarmService;
+
+    @Autowired
+    private IArdTankLockService ardTankLockService;
 
     @Resource
     private SYClient sYClient;
@@ -154,7 +162,7 @@
                     public void run() {
                         SysConfig config = new SysConfig();
                         config.setConfigKey("syCarPT");
-                        List<SysConfig> sysConfigResult = ((SysConfigServiceImpl) SpringUtils.getBean("sysConfigServiceImpl")).selectConfigList(config);
+                        List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
                         String syURL = "";
 
                         if(sysConfigResult.size() == 0){
@@ -168,7 +176,7 @@
 
                         String finalSyURL = syURL;
 
-                        List<ArdTankLock> result = ((ArdTankLockServiceImpl)SpringUtils.getBean("ardTankLockServiceImpl")).getArdTankLockAll();//鏌ヨ鍏ㄩ儴鐢电閿�
+                        List<ArdTankLock> result = ardTankLockService.getArdTankLockAll();//鏌ヨ鍏ㄩ儴鐢电閿�
                         for(ArdTankLock ardTankLock : result){
                             Thread LockThread = new Thread(finalSyURL){
                                 @Override
@@ -186,7 +194,7 @@
 
                                     String paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + ardTankLock.getLockNum() + "01" + checkNum + "%22%7D";
 
-                                    sYClient.sendCmd(finalSyURL,userId,ardTankLock.getCarId(),199,"DataDownTransfer", paramsStr,sessionId);
+                                    sendCmd(finalSyURL,userId,ardTankLock.getCarId(),199,"DataDownTransfer", paramsStr,sessionId);
                                 }
                             };
                             LockThread.start();
@@ -196,7 +204,7 @@
                 thread.start();
             }
         };
-        //lockStateTimer.scheduleAtFixedRate(lockStateTask,date,1000);
+        lockStateTimer.scheduleAtFixedRate(lockStateTask,date,2500);
     }
 
     /**
@@ -570,4 +578,32 @@
         }
     }
 
+    public Map<String,Object> sendCmd(String syURL,String userId,String carId,Integer cmdId,String cmd,String paramsStr,String sessionId){
+        OkHttpClient okHttpClient = new OkHttpClient();
+
+        Request request = new Request.Builder()
+                .url(syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId)
+                .build();
+        //System.out.println("url = " + syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId);
+        Response response = null;
+        try {
+            response = okHttpClient.newCall(request).execute();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        okhttp3.ResponseBody responseBody = response.body();
+
+        try {
+            String message = responseBody.string();// 鍝嶅簲浣�
+            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+            return map;
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return new HashMap();
+        }
+    }
+
 }
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLock.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLock.java
index ca03718..9e808f3 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLock.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLock.java
@@ -50,6 +50,8 @@
     @Excel(name = "鍦ㄧ嚎鏃堕棿")
     private String onlineTime;
 
+    private ArdTankLockState ardTankLockState;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -132,6 +134,14 @@
         return onlineTime;
     }
 
+    public ArdTankLockState getArdTankLockState() {
+        return ardTankLockState;
+    }
+
+    public void setArdTankLockState(ArdTankLockState ardTankLockState) {
+        this.ardTankLockState = ardTankLockState;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockAutoProcessLog.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockAutoProcessLog.java
new file mode 100644
index 0000000..d6bee21
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockAutoProcessLog.java
@@ -0,0 +1,219 @@
+package com.ruoyi.sy.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楀璞� ard_tank_lock_auto_process_log
+ * 
+ * @author ard
+ * @date 2024-07-12
+ */
+public class ArdTankLockAutoProcessLog extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 涓婚敭 */
+    private String id;
+
+    /** 閿佷富閿� */
+    @Excel(name = "閿佷富閿�")
+    private String lockId;
+
+    /** 閿佺紪鍙� */
+    @Excel(name = "閿佺紪鍙�")
+    private String lockNum;
+
+    /** 涓変竴杞﹁締涓婚敭 */
+    @Excel(name = "涓変竴杞﹁締涓婚敭")
+    private String carId;
+
+    /** 杞︾墝鍙� */
+    @Excel(name = "杞︾墝鍙�")
+    private String carPlate;
+
+    /** 鐢靛瓙鍥存爮涓婚敭 */
+    @Excel(name = "鐢靛瓙鍥存爮涓婚敭")
+    private String wallId;
+
+    /** 鐢靛瓙鍥存爮鍚嶇О */
+    @Excel(name = "鐢靛瓙鍥存爮鍚嶇О")
+    private String wallName;
+
+    /** 鐢靛瓙鍥存爮绫诲瀷 */
+    @Excel(name = "鐢靛瓙鍥存爮绫诲瀷")
+    private String wallType;
+
+    /** 鎿嶄綔 */
+    @Excel(name = "鎿嶄綔")
+    private String process;
+
+    /** 鎿嶄綔鍘熷洜 */
+    @Excel(name = "鎿嶄綔鍘熷洜")
+    private String processReason;
+
+    /** 缁忓害 */
+    @Excel(name = "缁忓害")
+    private String longitude;
+
+    /** 绾害 */
+    @Excel(name = "绾害")
+    private String latitude;
+
+    /** 閫熷害 */
+    @Excel(name = "閫熷害")
+    private String velocity;
+
+    /** 鎿嶄綔鏃堕棿 */
+    @Excel(name = "鎿嶄綔鏃堕棿")
+    private String processTime;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setLockId(String lockId) 
+    {
+        this.lockId = lockId;
+    }
+
+    public String getLockId() 
+    {
+        return lockId;
+    }
+    public void setLockNum(String lockNum) 
+    {
+        this.lockNum = lockNum;
+    }
+
+    public String getLockNum() 
+    {
+        return lockNum;
+    }
+    public void setCarId(String carId) 
+    {
+        this.carId = carId;
+    }
+
+    public String getCarId() 
+    {
+        return carId;
+    }
+    public void setCarPlate(String carPlate) 
+    {
+        this.carPlate = carPlate;
+    }
+
+    public String getCarPlate() 
+    {
+        return carPlate;
+    }
+    public void setWallId(String wallId) 
+    {
+        this.wallId = wallId;
+    }
+
+    public String getWallId() 
+    {
+        return wallId;
+    }
+    public void setWallName(String wallName) 
+    {
+        this.wallName = wallName;
+    }
+
+    public String getWallName() 
+    {
+        return wallName;
+    }
+    public void setWallType(String wallType) 
+    {
+        this.wallType = wallType;
+    }
+
+    public String getWallType() 
+    {
+        return wallType;
+    }
+    public void setProcess(String process) 
+    {
+        this.process = process;
+    }
+
+    public String getProcess() 
+    {
+        return process;
+    }
+    public void setProcessReason(String processReason) 
+    {
+        this.processReason = processReason;
+    }
+
+    public String getProcessReason() 
+    {
+        return processReason;
+    }
+    public void setLongitude(String longitude) 
+    {
+        this.longitude = longitude;
+    }
+
+    public String getLongitude() 
+    {
+        return longitude;
+    }
+    public void setLatitude(String latitude) 
+    {
+        this.latitude = latitude;
+    }
+
+    public String getLatitude() 
+    {
+        return latitude;
+    }
+    public void setVelocity(String velocity) 
+    {
+        this.velocity = velocity;
+    }
+
+    public String getVelocity() 
+    {
+        return velocity;
+    }
+    public void setProcessTime(String processTime) 
+    {
+        this.processTime = processTime;
+    }
+
+    public String getProcessTime() 
+    {
+        return processTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("lockId", getLockId())
+            .append("lockNum", getLockNum())
+            .append("carId", getCarId())
+            .append("carPlate", getCarPlate())
+            .append("wallId", getWallId())
+            .append("wallName", getWallName())
+            .append("wallType", getWallType())
+            .append("process", getProcess())
+            .append("processReason", getProcessReason())
+            .append("longitude", getLongitude())
+            .append("latitude", getLatitude())
+            .append("velocity", getVelocity())
+            .append("processTime", getProcessTime())
+            .toString();
+    }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockState.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockState.java
new file mode 100644
index 0000000..2b69583
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdTankLockState.java
@@ -0,0 +1,187 @@
+package com.ruoyi.sy.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 缃愯溅閿佺姸鎬佸璞� ard_tank_lock_state
+ * 
+ * @author ard
+ * @date 2024-07-18
+ */
+public class ArdTankLockState extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 涓婚敭 */
+    private String id;
+
+    /** 閿佷富閿� */
+    @Excel(name = "閿佷富閿�")
+    private String lockId;
+
+    /** 閿佺紪鍙� */
+    @Excel(name = "閿佺紪鍙�")
+    private String lockNum;
+
+    /** 閿佺姸鎬� */
+    @Excel(name = "閿佺姸鎬�")
+    private String lockState;
+
+    /** 浣嶇疆鐘舵�� */
+    @Excel(name = "浣嶇疆鐘舵��")
+    private String lockPositionState;
+
+    /** 澶栧3鐘舵�� */
+    @Excel(name = "澶栧3鐘舵��")
+    private String lockShellState;
+
+    /** 閲嶅惎鐘舵�侊細寮�鎴栧叧 */
+    @Excel(name = "閲嶅惎鐘舵�侊細寮�鎴栧叧")
+    private String restartState;
+
+    /** 鐢垫睜鐢靛帇 */
+    @Excel(name = "鐢垫睜鐢靛帇")
+    private String batterVoltage;
+
+    /** 鐢垫簮鐢靛帇 */
+    @Excel(name = "鐢垫簮鐢靛帇")
+    private String powerVoltage;
+
+    /** 涓婁紶鏃堕棿 */
+    @Excel(name = "涓婁紶鏃堕棿")
+    private String uploadTime;
+
+    /** 鍞竴鏍囪 */
+    @Excel(name = "鍞竴鏍囪")
+    private String uniqueMark;
+
+    private Boolean lockStateMark;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setLockId(String lockId) 
+    {
+        this.lockId = lockId;
+    }
+
+    public String getLockId() 
+    {
+        return lockId;
+    }
+    public void setLockNum(String lockNum) 
+    {
+        this.lockNum = lockNum;
+    }
+
+    public String getLockNum() 
+    {
+        return lockNum;
+    }
+    public void setLockState(String lockState) 
+    {
+        this.lockState = lockState;
+    }
+
+    public String getLockState() 
+    {
+        return lockState;
+    }
+    public void setLockPositionState(String lockPositionState) 
+    {
+        this.lockPositionState = lockPositionState;
+    }
+
+    public String getLockPositionState() 
+    {
+        return lockPositionState;
+    }
+    public void setLockShellState(String lockShellState) 
+    {
+        this.lockShellState = lockShellState;
+    }
+
+    public String getLockShellState() 
+    {
+        return lockShellState;
+    }
+    public void setRestartState(String restartState) 
+    {
+        this.restartState = restartState;
+    }
+
+    public String getRestartState() 
+    {
+        return restartState;
+    }
+    public void setBatterVoltage(String batterVoltage) 
+    {
+        this.batterVoltage = batterVoltage;
+    }
+
+    public String getBatterVoltage() 
+    {
+        return batterVoltage;
+    }
+    public void setPowerVoltage(String powerVoltage) 
+    {
+        this.powerVoltage = powerVoltage;
+    }
+
+    public String getPowerVoltage() 
+    {
+        return powerVoltage;
+    }
+    public void setUploadTime(String uploadTime) 
+    {
+        this.uploadTime = uploadTime;
+    }
+
+    public String getUploadTime() 
+    {
+        return uploadTime;
+    }
+    public void setUniqueMark(String uniqueMark) 
+    {
+        this.uniqueMark = uniqueMark;
+    }
+
+    public String getUniqueMark() 
+    {
+        return uniqueMark;
+    }
+
+    public Boolean getLockStateMark() {
+        return lockStateMark;
+    }
+
+    public void setLockStateMark(Boolean lockStateMark) {
+        this.lockStateMark = lockStateMark;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("lockId", getLockId())
+            .append("lockNum", getLockNum())
+            .append("lockState", getLockState())
+            .append("lockPositionState", getLockPositionState())
+            .append("lockShellState", getLockShellState())
+            .append("restartState", getRestartState())
+            .append("batterVoltage", getBatterVoltage())
+            .append("powerVoltage", getPowerVoltage())
+            .append("uploadTime", getUploadTime())
+            .append("uniqueMark", getUniqueMark())
+            .toString();
+    }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
index 82412a2..4a90e08 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
@@ -383,7 +383,7 @@
                         ((ArdTankAbnormalParkAlarmServiceImpl)SpringUtils.getBean("ardTankAbnormalParkAlarmServiceImpl")).insertArdTankAbnormalParkAlarm(gpsMap);
                     }
                 };
-                tankCarParkingAlarmThread.start();
+                //tankCarParkingAlarmThread.start();
 
                 /*Thread autoProcessThread = new Thread(){//鑷姩鎿嶆帶绾跨▼
                     @Override
diff --git a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplSerialPort.java b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplSerialPort.java
index 180acbe..ce166a3 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplSerialPort.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplSerialPort.java
@@ -14,24 +14,30 @@
 import com.gps31.push.util.MapUtil;
 import com.ruoyi.common.core.domain.entity.SysConfig;
 import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.sy.domain.ArdSyCarLock;
 import com.ruoyi.sy.domain.ArdSyCarRtu;
 import com.ruoyi.sy.domain.ArdTankLock;
+import com.ruoyi.sy.domain.ArdTankLockState;
 import com.ruoyi.sy.service.ArdSyCarLockService;
 import com.ruoyi.sy.service.ArdSyCarRtuService;
-import com.ruoyi.sy.service.impl.ArdSyCarDayServiceImpl;
-import com.ruoyi.sy.service.impl.ArdSyCarServiceImpl;
-import com.ruoyi.sy.service.impl.ArdTankAbnormalParkAlarmServiceImpl;
-import com.ruoyi.sy.service.impl.ArdTankLockServiceImpl;
+import com.ruoyi.sy.service.impl.*;
 import com.ruoyi.system.service.impl.SysConfigServiceImpl;
 import com.ruoyi.utils.forest.SYClient;
 import com.ruoyi.utils.qymqtt.newM.EmqClient;
 import com.ruoyi.utils.qymqtt.newM.QosEnum;
 import lombok.extern.slf4j.Slf4j;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.eclipse.paho.client.mqttv3.MqttException;
 
+import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -41,73 +47,20 @@
  * @author chencq
  * @version 1.0
  */
-@Slf4j(topic = "mqttCar")
 public class PushClientImplSerialPort extends PushClient implements Runnable {
 
-//    private static final Log log = LogFactory.getLog(PushClientImplPosition.class);
+    private static final Log log = LogFactory.getLog(PushClientImplSerialPort.class);
 
-    private String ip;
+    private static String ip;
 
-    private String userId;
+    private static String userId;
 
-    private String password;
-
-    private Timer lockStateTimer;
+    private static String password;
 
     public PushClientImplSerialPort(String ip, String userId, String password) {
         this.ip = ip;
         this.userId = userId;
         this.password = password;
-
-        /*Date date = new Date();
-        this.lockStateTimer = new Timer();//瀹氭椂鑾峰彇鍚勪釜閿佺殑鐘舵��
-        TimerTask lockStateTask =new TimerTask(){
-            @Override
-            public void run(){
-                SysConfig config = new SysConfig();
-                config.setConfigKey("syCarPT");
-                List<SysConfig> sysConfigResult = ((SysConfigServiceImpl)SpringUtils.getBean("sysConfigServiceImpl")).selectConfigList(config);
-                String syURL = "";
-
-                if(sysConfigResult.size() == 0){//涓変竴杞﹁締鍔犲叆寮�鍏�
-                    return;
-                }else{
-                    syURL = sysConfigResult.get(0).getConfigValue();
-                }
-                String passwordMd5 = DigestUtils.md5Hex(password);
-                Map<String, Object> LogInResult = ((SYClient)SpringUtils.getBean("sYClient")).logIn(syURL, passwordMd5, userId);
-                String sessionId = (String) LogInResult.get("sessionId");
-
-                String finalSyURL = syURL;
-                Thread thread = new Thread(finalSyURL){
-                    @Override
-                    public void run() {
-                        List<ArdTankLock> result = ((ArdTankLockServiceImpl)SpringUtils.getBean("ardTankLockServiceImpl")).getArdTankLockAll();//鏌ヨ鍏ㄩ儴鐢电閿�
-                        for(ArdTankLock ardTankLock : result){
-                            //Thread LockThread = new Thread(finalSyURL){
-                                String lockNumHead = ardTankLock.getLockNum().substring(0,2);
-                                String lockNumTail = ardTankLock.getLockNum().substring(2,4);
-                                //璁$畻鏍¢獙
-                                String checkNum = Integer.toHexString(Integer.parseInt(lockNumHead, 16) + Integer.parseInt(lockNumTail, 16) + Integer.parseInt("01", 16));
-
-                                if(checkNum.length() == 1){
-                                    checkNum = "0" + checkNum;
-                                }else if(checkNum.length() > 2){
-                                    checkNum = checkNum.substring(checkNum.length() - 2,checkNum.length());
-                                }
-
-                                String paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + ardTankLock.getLockNum() + "01" + checkNum + "%22%7D";
-
-                               //Map<String,Object> result = ((SYClient)SpringUtils.getBean("sYClient")).sendCmd(finalSyURL,userId,ardTankLock.getCarId(),199,"DataDownTransfer", paramsStr,sessionId);
-                            //};
-                            //LockThread.start();
-                        }
-                    }
-                };
-                thread.start();
-            }
-        };
-        lockStateTimer.scheduleAtFixedRate(lockStateTask,date,1000);*/
     }
 
     public PushClientImplSerialPort() {
@@ -151,8 +104,238 @@
              */
         }else if("0401".equals(pushMsg.getCmd())) {//閫忎紶娑堟伅
             Map<String,Object> dataMap = pushMsg.getJsonMap();
-            String carName = MapUtil.getStrVal(dataMap, "carName","");//鑾峰彇杞︾墝鍙�
+            //String carName = MapUtil.getStrVal(dataMap, "carName","");//鑾峰彇杞︾墝鍙�
             //log.error(String.format("   ---->鏀跺埌閫忎紶鏁版嵁:%s",JSON.toJSONString(dataMap)));
+            Thread thread = new Thread(){
+                @Override
+                public void run() {
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    Date now = new Date();
+                    try {
+                        String data = (String) dataMap.get("data");
+                        String lockNum = data.substring(0, 4);
+                        String code = data.substring(4, 6);
+                        if(code.equals("01")){//鍔熻兘鐮�01涓洪攣瀹炴椂鐘舵��
+                            String lockState = data.substring(6, 8);
+                            String lockPositionState = data.substring(8, 10);
+                            String lockShellState = data.substring(10, 12);
+                            String restartState = data.substring(12, 14);
+                            String batterVoltage = data.substring(14, 18);
+                            String powerVoltage = data.substring(18, 22);
+                            String time = data.substring(22, 34);
+                            //璁$畻鏃堕棿
+                            String year = time.substring(0, 2);
+                            String month = time.substring(2, 4);
+                            String day = time.substring(4, 6);
+                            String hour = time.substring(6, 8);
+                            String minute = time.substring(8, 10);
+                            String second = time.substring(10, 12);
+
+                            Integer yearNum = Integer.parseInt(year, 16);
+                            if(yearNum <= 9){
+                                time = "200" + yearNum + "-";
+                            }else{
+                                time = "20" + yearNum + "-";
+                            }
+
+                            Integer monthNum = Integer.parseInt(month, 16);
+                            if(monthNum <= 9){
+                                time = time + "0" + monthNum + "-";
+                            }else{
+                                time = time + monthNum + "-";
+                            }
+
+                            Integer dayNum = Integer.parseInt(day, 16);
+                            if(dayNum <= 9){
+                                time = time + "0" + dayNum + " ";
+                            }else{
+                                time = time + dayNum + " ";
+                            }
+
+                            Integer hourNum = Integer.parseInt(hour, 16);
+                            if(hourNum <= 9){
+                                time = time + "0" + hourNum + ":";
+                            }else{
+                                time = time + hourNum + ":";
+                            }
+
+                            Integer minuteNum = Integer.parseInt(minute, 16);
+                            if(minuteNum <= 9){
+                                time = time + "0" + minuteNum + ":";
+                            }else{
+                                time = time + minuteNum + ":";
+                            }
+
+                            Integer secondNum = Integer.parseInt(second, 16);
+                            if(secondNum <= 9){
+                                time = time + "0" + secondNum;
+                            }else{
+                                time = time + secondNum;
+                            }
+
+                            ArdTankLock ardTankLock = new ArdTankLock();
+                            ardTankLock.setLockNum(lockNum);
+                            List<ArdTankLock> ardTankLockResult = ((ArdTankLockServiceImpl)SpringUtils.getBean("ardTankLockServiceImpl")).selectArdTankLockList(ardTankLock);
+
+                            if(ardTankLockResult.isEmpty()){//閿佹病鏈夊綍鍏ュ垯杩斿洖
+                                return;
+                            }
+
+                            long cha = now.getTime() - sdf.parse(time).getTime();
+                            System.out.println("////////////////");
+                            System.out.println(time);
+                            System.out.println(cha);
+                            /*if(Math.abs(cha) >= 5 * 1000){
+                                //鏃堕棿鏍″噯
+                                String url = "http://" + ip + ":9999";
+                                String passwordMd5 = DigestUtils.md5Hex(password);
+                                Map<String, Object> LogInResult = loginIn(url, userId, passwordMd5);
+                                String sessionId = (String) LogInResult.get("sessionId");
+                                //鑾峰彇鏃堕棿骞舵媶鍒嗗勾鏈堟棩鏃跺垎绉�
+                                String nowTime = sdf.format(now);
+                                String nowYear = nowTime.substring(2,4);
+                                System.out.println(nowYear);
+                                String nowMonth = nowTime.substring(5,7);
+                                System.out.println(nowMonth);
+                                String nowDay = nowTime.substring(8,10);
+                                System.out.println(nowDay);
+                                String nowHour = nowTime.substring(11,13);
+                                System.out.println(nowHour);
+                                String nowMinute = nowTime.substring(14,16);
+                                System.out.println(nowMinute);
+                                String nowSecond = nowTime.substring(17,19);
+                                System.out.println(nowSecond);
+
+                                String nowYearHex = Integer.toHexString(Integer.parseInt(nowYear));
+                                if(nowYearHex.length() == 1){
+                                    nowYearHex = "0" + nowYearHex;
+                                }
+                                System.out.println(nowYearHex);
+                                String nowMonthHex = Integer.toHexString(Integer.parseInt(nowMonth));
+                                if(nowMonthHex.length() == 1){
+                                    nowMonthHex = "0" + nowMonthHex;
+                                }
+                                System.out.println(nowMonthHex);
+                                String nowDayHex = Integer.toHexString(Integer.parseInt(nowDay));
+                                if(nowDayHex.length() == 1){
+                                    nowDayHex = "0" + nowDayHex;
+                                }
+                                System.out.println(nowDayHex);
+                                String nowHourHex = Integer.toHexString(Integer.parseInt(nowHour));
+                                if(nowHourHex.length() == 1){
+                                    nowHourHex = "0" + nowHourHex;
+                                }
+                                System.out.println(nowHourHex);
+                                String nowMinuteHex = Integer.toHexString(Integer.parseInt(nowMinute));
+                                if(nowMinuteHex.length() == 1){
+                                    nowMinuteHex = "0" + nowMinuteHex;
+                                }
+                                System.out.println(nowMinuteHex);
+                                String nowSecondHex = Integer.toHexString(Integer.parseInt(nowSecond));
+                                if(nowSecondHex.length() == 1){
+                                    nowSecondHex = "0" + nowSecondHex;
+                                }
+                                System.out.println(nowSecondHex);
+                                //16杩涘埗鏃堕棿
+                                String timeHex = nowYearHex + nowMonthHex + nowDayHex + nowHourHex + nowMinuteHex + nowSecondHex;
+                                System.out.println(timeHex);
+                                String lockNumHead = ardTankLockResult.get(0).getLockNum().substring(0,2);
+                                String lockNumTail = ardTankLockResult.get(0).getLockNum().substring(2,4);
+                                //璁$畻鏍¢獙
+                                String checkNum = Integer.toHexString(Integer.parseInt(lockNumHead, 16) + Integer.parseInt(lockNumTail, 16) + Integer.parseInt("08", 16) +
+                                        Integer.parseInt(nowYearHex, 16) + Integer.parseInt(nowMonthHex, 16) + Integer.parseInt(nowDayHex, 16) +
+                                        Integer.parseInt(nowHourHex, 16) + Integer.parseInt(nowMinuteHex, 16) + Integer.parseInt(nowSecondHex, 16));
+                                System.out.println(checkNum);
+                                if(checkNum.length() == 1){
+                                    checkNum = "0" + checkNum;
+                                }else if(checkNum.length() > 2){
+                                    checkNum = checkNum.substring(checkNum.length() - 2,checkNum.length());
+                                }
+                                System.out.println(checkNum);
+                                String paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + ardTankLock.getLockNum() + "08" + timeHex + checkNum + "%22%7D";
+                                System.out.println(ardTankLock.getLockNum() + "08" + timeHex + checkNum);
+                                sendCmd(url,userId,ardTankLockResult.get(0).getCarId(),199,"DataDownTransfer", paramsStr,sessionId);
+                            }else{*/
+                                ArdTankLockState ardTankLockState = new ArdTankLockState();
+                                ardTankLockState.setId(IdUtils.simpleUUID());
+                                ardTankLockState.setLockId(ardTankLockResult.get(0).getId());
+                                ardTankLockState.setLockNum(lockNum);
+                                switch (lockState) {//閿佽姱鐘舵��
+                                    case "01": ardTankLockState.setLockState("寮�閿佺姸鎬�");break;
+                                    case "02": ardTankLockState.setLockState("鍏抽攣鐘舵��");break;
+                                    case "03": ardTankLockState.setLockState("寮傚父鐘舵��");break;
+                                    default:
+                                        break;
+                                }
+                                switch (lockPositionState) {//浣嶇疆鐘舵��
+                                    case "01": ardTankLockState.setLockPositionState("姝e父");break;
+                                    case "02": ardTankLockState.setLockPositionState("寮傚父");break;
+                                    default:
+                                        break;
+                                }
+                                switch (lockShellState) {//澶栧3鐘舵��
+                                    case "01": ardTankLockState.setLockShellState("姝e父");break;
+                                    case "02": ardTankLockState.setLockShellState("寮傚父");break;
+                                    default:
+                                        break;
+                                }
+                                switch (restartState) {//澶嶄綅鐘舵��
+                                    case "01": ardTankLockState.setRestartState("寮�閿佺姸鎬�");break;
+                                    case "02": ardTankLockState.setRestartState("鍏抽攣鐘舵��");break;
+                                    default:
+                                        break;
+                                }
+                                Number batterVoltageNum = Integer.parseInt(batterVoltage,16) * 0.1;
+                                String batterVoltageStr = String.valueOf(batterVoltageNum);
+                                if(batterVoltageStr.length() > 4){
+                                    batterVoltageStr = batterVoltageStr.substring(0,4);
+                                }
+                                if(batterVoltageStr.contains(".")){//鍥涜垗浜斿叆
+                                    String decimalPart = batterVoltageStr.split("\\.")[1];
+                                    if(Integer.parseInt(decimalPart) > 5){
+                                        batterVoltageStr = batterVoltageStr.split("\\.")[0] + ".5";
+                                    }else if(Integer.parseInt(decimalPart) <= 5){
+                                        batterVoltageStr = batterVoltageStr.split("\\.")[0] + ".0";
+                                    }
+                                }else{
+                                    batterVoltageStr = batterVoltageStr + ".0";
+                                }
+                                ardTankLockState.setBatterVoltage(batterVoltageStr);
+
+
+                                Number powerVoltageNum = Integer.parseInt(powerVoltage,16) * 0.1;
+                                String powerVoltageStr = String.valueOf(powerVoltageNum);
+                                if(powerVoltageStr.length() > 4){
+                                    powerVoltageStr = powerVoltageStr.substring(0,4);
+                                }
+                                if(powerVoltageStr.contains(".")){//鍥涜垗浜斿叆
+                                    String decimalPart = powerVoltageStr.split("\\.")[1];
+                                    if(Integer.parseInt(decimalPart) > 5){
+                                        powerVoltageStr = powerVoltageStr.split("\\.")[0] + ".5";
+                                    }else if(Integer.parseInt(decimalPart) <= 5){
+                                        powerVoltageStr = powerVoltageStr.split("\\.")[0] + ".0";
+                                    }
+                                }else{
+                                    powerVoltageStr = powerVoltageStr + ".0";
+                                }
+                                ardTankLockState.setPowerVoltage(powerVoltageStr);
+
+                                String uniqueMark = lockNum + "," + lockState + "," + lockPositionState + "," + lockShellState
+                                        + "," + restartState + "," + batterVoltageStr + "," + powerVoltageStr;
+
+                                ardTankLockState.setUploadTime(time);
+                                ardTankLockState.setUniqueMark(uniqueMark);
+                                ((ArdTankLockStateServiceImpl)SpringUtils.getBean("ardTankLockStateServiceImpl")).insertOrUpdateArdTankLockState(ardTankLockState);
+
+                            //}
+                        }
+                    }catch (Exception e){
+                        e.printStackTrace();
+                        return;//寮鸿浆澶辫触杩斿洖
+                    }
+                }
+            };
+            thread.start();
             /**
              *
              * 璇峰姞鍏ヤ笁鏂归泦鎴愭柟鐨勪笟鍔¢�昏緫
@@ -164,7 +347,7 @@
     public void sendMassage() {
         try {
             PushClientImplSerialPort client = new PushClientImplSerialPort();
-            client.setLog(true);//鏄惁鎵撳嵃鏄庢枃
+            client.setLog(false);//鏄惁鎵撳嵃鏄庢枃
             client.setHost(this.ip);//鏈嶅姟鍣↖P
             client.setPort(10100);//鏈嶅姟鍣ㄧ鍙�
             client.setUserName(this.userId);//绯荤粺鐢ㄦ埛鍚�
@@ -185,4 +368,65 @@
         sendMassage();
     }
 
+    public static Map<String,Object> loginIn(String syURL,String userId,String password){//鐧诲綍
+        OkHttpClient okHttpClient = new OkHttpClient();
+
+        String passwordMd5 = DigestUtils.md5Hex(password);
+
+        Request request = new Request.Builder()
+                .url(syURL + "/gps-web/api/login.jsp?"+"password="+passwordMd5+"&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN")
+                .build();
+        Response response = null;
+        try {
+            response = okHttpClient.newCall(request).execute();
+        } catch (IOException e1) {
+            // TODO Auto-generated catch block
+            e1.printStackTrace();
+        }
+
+        response.headers(); //鍝嶅簲澶�
+
+        okhttp3.ResponseBody responseBody = response.body();
+
+        try {
+            String message = responseBody.string();// 鍝嶅簲浣�
+            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+            map.put("passwordMd5", passwordMd5);
+            //System.out.println(message);
+            return map;
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return new HashMap();
+        }
+    }
+
+    public Map<String,Object> sendCmd(String syURL,String userId,String carId,Integer cmdId,String cmd,String paramsStr,String sessionId){
+        OkHttpClient okHttpClient = new OkHttpClient();
+
+        Request request = new Request.Builder()
+                .url(syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId)
+                .build();
+        //System.out.println("url = " + syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId);
+        Response response = null;
+        try {
+            response = okHttpClient.newCall(request).execute();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        okhttp3.ResponseBody responseBody = response.body();
+
+        try {
+            String message = responseBody.string();// 鍝嶅簲浣�
+            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+            return map;
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return new HashMap();
+        }
+    }
+
 }
diff --git a/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockAutoProcessLogMapper.java b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockAutoProcessLogMapper.java
new file mode 100644
index 0000000..0e8ad68
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockAutoProcessLogMapper.java
@@ -0,0 +1,61 @@
+package com.ruoyi.sy.mapper;
+
+import java.util.List;
+import com.ruoyi.sy.domain.ArdTankLockAutoProcessLog;
+
+/**
+ * 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇桵apper鎺ュ彛
+ * 
+ * @author ard
+ * @date 2024-07-12
+ */
+public interface ArdTankLockAutoProcessLogMapper 
+{
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     */
+    public ArdTankLockAutoProcessLog selectArdTankLockAutoProcessLogById(String id);
+
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楀垪琛�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楅泦鍚�
+     */
+    public List<ArdTankLockAutoProcessLog> selectArdTankLockAutoProcessLogList(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 鏂板缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    public int insertArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 淇敼缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    public int updateArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockAutoProcessLogById(String id);
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockAutoProcessLogByIds(String[] ids);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java
index 52df18d..50b2c27 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java
@@ -81,4 +81,6 @@
     public Long selectArdTankLockTotalByCarIdList(@Param("carIdList") List<String> carIdList);
 
     public int deleteArdTankLockAndWallByCarIds(@Param("carIds") List<String> carIds);
+
+    public String getIdByLockNum(String lockNum);
 }
diff --git a/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockStateMapper.java b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockStateMapper.java
new file mode 100644
index 0000000..f84c4a9
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockStateMapper.java
@@ -0,0 +1,63 @@
+package com.ruoyi.sy.mapper;
+
+import java.util.List;
+import com.ruoyi.sy.domain.ArdTankLockState;
+
+/**
+ * 缃愯溅閿佺姸鎬丮apper鎺ュ彛
+ * 
+ * @author ard
+ * @date 2024-07-18
+ */
+public interface ArdTankLockStateMapper 
+{
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬�
+     * 
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缃愯溅閿佺姸鎬�
+     */
+    public ArdTankLockState selectArdTankLockStateById(String id);
+
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬佸垪琛�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缃愯溅閿佺姸鎬侀泦鍚�
+     */
+    public List<ArdTankLockState> selectArdTankLockStateList(ArdTankLockState ardTankLockState);
+
+    /**
+     * 鏂板缃愯溅閿佺姸鎬�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    public int insertArdTankLockState(ArdTankLockState ardTankLockState);
+
+    /**
+     * 淇敼缃愯溅閿佺姸鎬�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    public int updateArdTankLockState(ArdTankLockState ardTankLockState);
+
+    /**
+     * 鍒犻櫎缃愯溅閿佺姸鎬�
+     * 
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockStateById(String id);
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佺姸鎬�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockStateByIds(String[] ids);
+
+    public int insertOrUpdateArdTankLockState(ArdTankLockState ardTankLockState);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockAutoProcessLogService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockAutoProcessLogService.java
new file mode 100644
index 0000000..0256faa
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockAutoProcessLogService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.sy.service;
+
+import java.util.List;
+import com.ruoyi.sy.domain.ArdTankLockAutoProcessLog;
+
+/**
+ * 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇桽ervice鎺ュ彛
+ * 
+ * @author ard
+ * @date 2024-07-12
+ */
+public interface IArdTankLockAutoProcessLogService 
+{
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     */
+    public ArdTankLockAutoProcessLog selectArdTankLockAutoProcessLogById(String id);
+
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楀垪琛�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楅泦鍚�
+     */
+    public List<ArdTankLockAutoProcessLog> selectArdTankLockAutoProcessLogList(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 鏂板缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    public int insertArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 淇敼缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    public int updateArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog);
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿泦鍚�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockAutoProcessLogByIds(String[] ids);
+
+    /**
+     * 鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾俊鎭�
+     * 
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockAutoProcessLogById(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockStateService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockStateService.java
new file mode 100644
index 0000000..036b643
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockStateService.java
@@ -0,0 +1,63 @@
+package com.ruoyi.sy.service;
+
+import java.util.List;
+import com.ruoyi.sy.domain.ArdTankLockState;
+
+/**
+ * 缃愯溅閿佺姸鎬丼ervice鎺ュ彛
+ * 
+ * @author ard
+ * @date 2024-07-18
+ */
+public interface IArdTankLockStateService 
+{
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬�
+     * 
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缃愯溅閿佺姸鎬�
+     */
+    public ArdTankLockState selectArdTankLockStateById(String id);
+
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬佸垪琛�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缃愯溅閿佺姸鎬侀泦鍚�
+     */
+    public List<ArdTankLockState> selectArdTankLockStateList(ArdTankLockState ardTankLockState);
+
+    /**
+     * 鏂板缃愯溅閿佺姸鎬�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    public int insertArdTankLockState(ArdTankLockState ardTankLockState);
+
+    /**
+     * 淇敼缃愯溅閿佺姸鎬�
+     * 
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    public int updateArdTankLockState(ArdTankLockState ardTankLockState);
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佺姸鎬�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑缃愯溅閿佺姸鎬佷富閿泦鍚�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockStateByIds(String[] ids);
+
+    /**
+     * 鍒犻櫎缃愯溅閿佺姸鎬佷俊鎭�
+     * 
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缁撴灉
+     */
+    public int deleteArdTankLockStateById(String id);
+
+    public int insertOrUpdateArdTankLockState(ArdTankLockState ardTankLockState);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockAutoProcessLogServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockAutoProcessLogServiceImpl.java
new file mode 100644
index 0000000..12a03f6
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockAutoProcessLogServiceImpl.java
@@ -0,0 +1,92 @@
+package com.ruoyi.sy.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.sy.mapper.ArdTankLockAutoProcessLogMapper;
+import com.ruoyi.sy.domain.ArdTankLockAutoProcessLog;
+import com.ruoyi.sy.service.IArdTankLockAutoProcessLogService;
+
+/**
+ * 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇桽ervice涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2024-07-12
+ */
+@Service
+public class ArdTankLockAutoProcessLogServiceImpl implements IArdTankLockAutoProcessLogService {
+    @Autowired
+    private ArdTankLockAutoProcessLogMapper ardTankLockAutoProcessLogMapper;
+
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     *
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     */
+    @Override
+    public ArdTankLockAutoProcessLog selectArdTankLockAutoProcessLogById(String id) {
+        return ardTankLockAutoProcessLogMapper.selectArdTankLockAutoProcessLogById(id);
+    }
+
+    /**
+     * 鏌ヨ缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇楀垪琛�
+     *
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     */
+    @Override
+    public List<ArdTankLockAutoProcessLog> selectArdTankLockAutoProcessLogList(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog) {
+        return ardTankLockAutoProcessLogMapper.selectArdTankLockAutoProcessLogList(ardTankLockAutoProcessLog);
+    }
+
+    /**
+     * 鏂板缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     *
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog) {
+                ardTankLockAutoProcessLog.setId(IdUtils.simpleUUID());
+            return ardTankLockAutoProcessLogMapper.insertArdTankLockAutoProcessLog(ardTankLockAutoProcessLog);
+    }
+
+    /**
+     * 淇敼缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     *
+     * @param ardTankLockAutoProcessLog 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateArdTankLockAutoProcessLog(ArdTankLockAutoProcessLog ardTankLockAutoProcessLog) {
+        return ardTankLockAutoProcessLogMapper.updateArdTankLockAutoProcessLog(ardTankLockAutoProcessLog);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇�
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteArdTankLockAutoProcessLogByIds(String[] ids) {
+        return ardTankLockAutoProcessLogMapper.deleteArdTankLockAutoProcessLogByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾俊鎭�
+     *
+     * @param id 缃愯溅閿佽嚜鍔ㄦ搷鎺ф棩蹇椾富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteArdTankLockAutoProcessLogById(String id) {
+        return ardTankLockAutoProcessLogMapper.deleteArdTankLockAutoProcessLogById(id);
+    }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java
index 99aacaa..396fc26 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java
@@ -1,9 +1,11 @@
 package com.ruoyi.sy.service.impl;
 
 import java.awt.geom.Point2D;
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import com.alibaba.fastjson2.JSON;
 import com.ruoyi.common.core.domain.entity.SysConfig;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.sy.domain.ArdSyUser;
@@ -15,6 +17,9 @@
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.utils.forest.SYClient;
 import com.ruoyi.utils.gps.GeoTools;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -200,10 +205,11 @@
 
                 String paramsStr = lockNum + "02" + process + checkNum;
                 paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + paramsStr + "%22%7D";
-                Map<String,Object> result = sYClient.sendCmd(syURL, ardSyUser.getUserId(), carId, 199, "DataDownTransfer", paramsStr, sessionId);
-
+                Map<String,Object> result = sendCmd(syURL, ardSyUser.getUserId(), carId, 199, "DataDownTransfer", paramsStr, sessionId);
+                System.out.println("111111111111");
+                System.out.println(result);
                 if(((String)result.get("rspCode")).equals("0")){
-                    ArdTankLockProcessLog ardTankLockProcessLog = new ArdTankLockProcessLog();
+                    /*ArdTankLockProcessLog ardTankLockProcessLog = new ArdTankLockProcessLog();
                     ardTankLockProcessLog.setId(IdUtils.simpleUUID());
                     ardTankLockProcessLog.setLockId(lockId);
                     ardTankLockProcessLog.setLockNum(lockNum);
@@ -220,7 +226,7 @@
                     ardTankLockProcessLog.setLongitude(lng);
                     ardTankLockProcessLog.setLatitude(lat);
                     ardTankLockProcessLog.setProcessTime(this.sdf.format(new Date()));
-                    ardTankLockProcessLogMapper.insertArdTankLockProcessLog(ardTankLockProcessLog);
+                    ardTankLockProcessLogMapper.insertArdTankLockProcessLog(ardTankLockProcessLog);*/
                     return "鍙戦�佹垚鍔�";
                 }else{
                     return "鍙戦�佸け璐�";
@@ -231,4 +237,32 @@
             }
         }
     }
+
+    public Map<String,Object> sendCmd(String syURL,String userId,String carId,Integer cmdId,String cmd,String paramsStr,String sessionId){
+        OkHttpClient okHttpClient = new OkHttpClient();
+
+        Request request = new Request.Builder()
+                .url(syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId)
+                .build();
+        //System.out.println("url = " + syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId);
+        Response response = null;
+        try {
+            response = okHttpClient.newCall(request).execute();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        okhttp3.ResponseBody responseBody = response.body();
+
+        try {
+            String message = responseBody.string();// 鍝嶅簲浣�
+            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+            return map;
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return new HashMap();
+        }
+    }
 }
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java
index b84a53c..d7728e8 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java
@@ -6,6 +6,7 @@
 import com.ruoyi.common.core.domain.entity.SysConfig;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.sy.domain.ArdSyUser;
+import com.ruoyi.sy.domain.ArdTankLockState;
 import com.ruoyi.sy.mapper.ArdSyUserMapper;
 import com.ruoyi.sy.mapper.ArdTankWallLockMapper;
 import com.ruoyi.sy.mapper.ArdTankWallLockTemporaryMapper;
@@ -264,6 +265,23 @@
             }else{
                 map.put("onlineTime",ardTankLock.getOnlineTime());
             }
+            if(ardTankLock.getArdTankLockState() != null){//鐢电閿佺姸鎬�
+                map.put("ardTankLockState",ardTankLock.getArdTankLockState());
+            }else{
+                ArdTankLockState ardTankLockState = new ArdTankLockState();
+                ardTankLockState.setId("");
+                ardTankLockState.setLockId("");
+                ardTankLockState.setLockNum("");
+                ardTankLockState.setLockState("");
+                ardTankLockState.setLockPositionState("");
+                ardTankLockState.setLockShellState("");
+                ardTankLockState.setRestartState("");
+                ardTankLockState.setBatterVoltage("");
+                ardTankLockState.setPowerVoltage("");
+                ardTankLockState.setUploadTime("");
+                ardTankLockState.setUniqueMark("");
+                map.put("ardTankLockState",ardTankLockState);
+            }
             Map<String,Object> carMap = ((List<Map<String,Object>>)syResult.get("list")).get(0);
             map.put("carPlate",carMap.get("carPlate"));
             result.add(map);
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockStateServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockStateServiceImpl.java
new file mode 100644
index 0000000..2d0d907
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockStateServiceImpl.java
@@ -0,0 +1,100 @@
+package com.ruoyi.sy.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.sy.mapper.ArdTankLockStateMapper;
+import com.ruoyi.sy.domain.ArdTankLockState;
+import com.ruoyi.sy.service.IArdTankLockStateService;
+
+import javax.annotation.Resource;
+
+/**
+ * 缃愯溅閿佺姸鎬丼ervice涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2024-07-18
+ */
+@Service
+public class ArdTankLockStateServiceImpl implements IArdTankLockStateService {
+    @Resource
+    private ArdTankLockStateMapper ardTankLockStateMapper;
+
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬�
+     *
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缃愯溅閿佺姸鎬�
+     */
+    @Override
+    public ArdTankLockState selectArdTankLockStateById(String id) {
+        return ardTankLockStateMapper.selectArdTankLockStateById(id);
+    }
+
+    /**
+     * 鏌ヨ缃愯溅閿佺姸鎬佸垪琛�
+     *
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缃愯溅閿佺姸鎬�
+     */
+    @Override
+    public List<ArdTankLockState> selectArdTankLockStateList(ArdTankLockState ardTankLockState) {
+        return ardTankLockStateMapper.selectArdTankLockStateList(ardTankLockState);
+    }
+
+    /**
+     * 鏂板缃愯溅閿佺姸鎬�
+     *
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertArdTankLockState(ArdTankLockState ardTankLockState) {
+                ardTankLockState.setId(IdUtils.simpleUUID());
+            return ardTankLockStateMapper.insertArdTankLockState(ardTankLockState);
+    }
+
+    /**
+     * 淇敼缃愯溅閿佺姸鎬�
+     *
+     * @param ardTankLockState 缃愯溅閿佺姸鎬�
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateArdTankLockState(ArdTankLockState ardTankLockState) {
+        return ardTankLockStateMapper.updateArdTankLockState(ardTankLockState);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎缃愯溅閿佺姸鎬�
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑缃愯溅閿佺姸鎬佷富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteArdTankLockStateByIds(String[] ids) {
+        return ardTankLockStateMapper.deleteArdTankLockStateByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎缃愯溅閿佺姸鎬佷俊鎭�
+     *
+     * @param id 缃愯溅閿佺姸鎬佷富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteArdTankLockStateById(String id) {
+        return ardTankLockStateMapper.deleteArdTankLockStateById(id);
+    }
+
+    @Override
+    public int insertOrUpdateArdTankLockState(ArdTankLockState ardTankLockState) {
+        int result = ardTankLockStateMapper.insertOrUpdateArdTankLockState(ardTankLockState);
+        return result;
+    }
+}
diff --git a/ard-work/src/main/resources/mapper/sy/ArdTankLockAutoProcessLogMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdTankLockAutoProcessLogMapper.xml
new file mode 100644
index 0000000..0aef00f
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/sy/ArdTankLockAutoProcessLogMapper.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.sy.mapper.ArdTankLockAutoProcessLogMapper">
+    
+    <resultMap type="ArdTankLockAutoProcessLog" id="ArdTankLockAutoProcessLogResult">
+        <result property="id"    column="id"    />
+        <result property="lockId"    column="lock_id"    />
+        <result property="lockNum"    column="lock_num"    />
+        <result property="carId"    column="car_id"    />
+        <result property="carPlate"    column="car_plate"    />
+        <result property="wallId"    column="wall_id"    />
+        <result property="wallName"    column="wall_name"    />
+        <result property="wallType"    column="wall_type"    />
+        <result property="process"    column="process"    />
+        <result property="processReason"    column="process_reason"    />
+        <result property="longitude"    column="longitude"    />
+        <result property="latitude"    column="latitude"    />
+        <result property="velocity"    column="velocity"    />
+        <result property="processTime"    column="process_time"    />
+    </resultMap>
+
+    <sql id="selectArdTankLockAutoProcessLogVo">
+        select id, lock_id, lock_num, car_id, car_plate, wall_id, wall_name, wall_type, process, process_reason, longitude, latitude, velocity, process_time from ard_tank_lock_auto_process_log
+    </sql>
+
+    <select id="selectArdTankLockAutoProcessLogList" parameterType="ArdTankLockAutoProcessLog" resultMap="ArdTankLockAutoProcessLogResult">
+        <include refid="selectArdTankLockAutoProcessLogVo"/>
+        <where>  
+            <if test="lockId != null  and lockId != ''"> and lock_id = #{lockId}</if>
+            <if test="lockNum != null  and lockNum != ''"> and lock_num = #{lockNum}</if>
+            <if test="carId != null  and carId != ''"> and car_id = #{carId}</if>
+            <if test="carPlate != null  and carPlate != ''"> and car_plate = #{carPlate}</if>
+            <if test="wallId != null  and wallId != ''"> and wall_id = #{wallId}</if>
+            <if test="wallName != null  and wallName != ''"> and wall_name like '%'||#{wallName}||'%'</if>
+            <if test="wallType != null  and wallType != ''"> and wall_type = #{wallType}</if>
+            <if test="process != null  and process != ''"> and process = #{process}</if>
+            <if test="processReason != null  and processReason != ''"> and process_reason = #{processReason}</if>
+            <if test="longitude != null  and longitude != ''"> and longitude = #{longitude}</if>
+            <if test="latitude != null  and latitude != ''"> and latitude = #{latitude}</if>
+            <if test="velocity != null  and velocity != ''"> and velocity = #{velocity}</if>
+            <if test="processTime != null  and processTime != ''"> and process_time = #{processTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectArdTankLockAutoProcessLogById" parameterType="String" resultMap="ArdTankLockAutoProcessLogResult">
+        <include refid="selectArdTankLockAutoProcessLogVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertArdTankLockAutoProcessLog" parameterType="ArdTankLockAutoProcessLog">
+        insert into ard_tank_lock_auto_process_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="lockId != null">lock_id,</if>
+            <if test="lockNum != null">lock_num,</if>
+            <if test="carId != null">car_id,</if>
+            <if test="carPlate != null">car_plate,</if>
+            <if test="wallId != null">wall_id,</if>
+            <if test="wallName != null">wall_name,</if>
+            <if test="wallType != null">wall_type,</if>
+            <if test="process != null">process,</if>
+            <if test="processReason != null">process_reason,</if>
+            <if test="longitude != null">longitude,</if>
+            <if test="latitude != null">latitude,</if>
+            <if test="velocity != null">velocity,</if>
+            <if test="processTime != null">process_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="lockId != null">#{lockId},</if>
+            <if test="lockNum != null">#{lockNum},</if>
+            <if test="carId != null">#{carId},</if>
+            <if test="carPlate != null">#{carPlate},</if>
+            <if test="wallId != null">#{wallId},</if>
+            <if test="wallName != null">#{wallName},</if>
+            <if test="wallType != null">#{wallType},</if>
+            <if test="process != null">#{process},</if>
+            <if test="processReason != null">#{processReason},</if>
+            <if test="longitude != null">#{longitude},</if>
+            <if test="latitude != null">#{latitude},</if>
+            <if test="velocity != null">#{velocity},</if>
+            <if test="processTime != null">#{processTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateArdTankLockAutoProcessLog" parameterType="ArdTankLockAutoProcessLog">
+        update ard_tank_lock_auto_process_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="lockId != null">lock_id = #{lockId},</if>
+            <if test="lockNum != null">lock_num = #{lockNum},</if>
+            <if test="carId != null">car_id = #{carId},</if>
+            <if test="carPlate != null">car_plate = #{carPlate},</if>
+            <if test="wallId != null">wall_id = #{wallId},</if>
+            <if test="wallName != null">wall_name = #{wallName},</if>
+            <if test="wallType != null">wall_type = #{wallType},</if>
+            <if test="process != null">process = #{process},</if>
+            <if test="processReason != null">process_reason = #{processReason},</if>
+            <if test="longitude != null">longitude = #{longitude},</if>
+            <if test="latitude != null">latitude = #{latitude},</if>
+            <if test="velocity != null">velocity = #{velocity},</if>
+            <if test="processTime != null">process_time = #{processTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteArdTankLockAutoProcessLogById" parameterType="String">
+        delete from ard_tank_lock_auto_process_log where id = #{id}
+    </delete>
+
+    <delete id="deleteArdTankLockAutoProcessLogByIds" parameterType="String">
+        delete from ard_tank_lock_auto_process_log where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>
\ No newline at end of file
diff --git a/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
index 88139de..6608f8d 100644
--- a/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
+++ b/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
@@ -16,6 +16,32 @@
         <result property="onlineTime"    column="online_time"    />
     </resultMap>
 
+    <resultMap type="ArdTankLock" id="ArdTankLockWithStateResult">
+        <result property="id"    column="id"    />
+        <result property="lockNum"    column="lock_num"    />
+        <result property="lockName"    column="lock_name"    />
+        <result property="imgPositionTop"    column="img_position_top"    />
+        <result property="imgPositionLeft"    column="img_position_left"    />
+        <result property="carId"    column="car_id"    />
+        <result property="enable"    column="enable"    />
+        <result property="restartState"    column="restart_state"    />
+        <result property="onlineTime"    column="online_time"    />
+        <association property="ardTankLockState" javaType="com.ruoyi.sy.domain.ArdTankLockState">
+            <result property="id"    column="sid"    />
+            <result property="lockId"    column="lock_id"    />
+            <result property="lockNum"    column="slock_num"    />
+            <result property="lockState"    column="lock_state"    />
+            <result property="lockPositionState"    column="lock_position_state"    />
+            <result property="lockShellState"    column="lock_shell_state"    />
+            <result property="restartState"    column="srestart_state"    />
+            <result property="batterVoltage"    column="batter_voltage"    />
+            <result property="powerVoltage"    column="power_voltage"    />
+            <result property="uploadTime"    column="upload_time"    />
+            <result property="uniqueMark"    column="unique_mark"    />
+            <result property="lockStateMark"    column="lock_state_mark"    />
+        </association>
+    </resultMap>
+
     <sql id="selectArdTankLockVo">
         select id, lock_num, lock_name, img_position_top, img_position_left, car_id, enable, restart_state, online_time from ard_tank_lock
     </sql>
@@ -108,8 +134,22 @@
         </foreach >
     </insert>
 
-    <select id="getLockByCarId" resultMap="ArdTankLockResult" parameterType="java.lang.String">
-        select * from ard_tank_lock atl where car_id = #{carId} order by atl.lock_num
+    <select id="getLockByCarId" resultMap="ArdTankLockWithStateResult" parameterType="java.lang.String">
+        select atl.id,atl.lock_num,atl.lock_name,atl.img_position_top,
+        atl.img_position_left,atl.car_id,atl.enable,atl.restart_state,
+        atl.online_time,atls.id as sid,atls.lock_id,atls.lock_num as slock_num,
+        atls.lock_state,atls.lock_position_state,atls.lock_shell_state,
+        atls.restart_state as srestart_state,atls.batter_voltage,
+        atls.power_voltage,atls.upload_time,atls.unique_mark,
+        case atls.lock_state
+        when '鍏抽攣鐘舵��' then false
+        when '寮傚父鐘舵��' then false
+        when '寮�閿佺姸鎬�' then true
+        end as lock_state_mark
+        from ard_tank_lock atl
+        left join ard_tank_lock_state atls on atl."id" = atls.lock_id
+        where car_id = #{carId} order by atls.upload_time desc,atl.lock_num
+        limit 1
     </select>
 
     <delete id="deleteLockByCarId" parameterType="java.lang.String">
@@ -160,4 +200,8 @@
             #{carId}
         </foreach>
     </delete>
+
+    <select id="getIdByLockNum" resultType="java.lang.String" parameterType="java.lang.String">
+        select id from ard_tank_lock atl where atl.lock_num = #{lockNum}
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/ard-work/src/main/resources/mapper/sy/ArdTankLockStateMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdTankLockStateMapper.xml
new file mode 100644
index 0000000..180db6b
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/sy/ArdTankLockStateMapper.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.sy.mapper.ArdTankLockStateMapper">
+    
+    <resultMap type="ArdTankLockState" id="ArdTankLockStateResult">
+        <result property="id"    column="id"    />
+        <result property="lockId"    column="lock_id"    />
+        <result property="lockNum"    column="lock_num"    />
+        <result property="lockState"    column="lock_state"    />
+        <result property="lockPositionState"    column="lock_position_state"    />
+        <result property="lockShellState"    column="lock_shell_state"    />
+        <result property="restartState"    column="restart_state"    />
+        <result property="batterVoltage"    column="batter_voltage"    />
+        <result property="powerVoltage"    column="power_voltage"    />
+        <result property="uploadTime"    column="upload_time"    />
+        <result property="uniqueMark"    column="unique_mark"    />
+    </resultMap>
+
+    <sql id="selectArdTankLockStateVo">
+        select id, lock_id, lock_num, lock_state, lock_position_state, lock_shell_state, restart_state, batter_voltage, power_voltage, upload_time, unique_mark from ard_tank_lock_state
+    </sql>
+
+    <select id="selectArdTankLockStateList" parameterType="ArdTankLockState" resultMap="ArdTankLockStateResult">
+        <include refid="selectArdTankLockStateVo"/>
+        <where>  
+            <if test="lockId != null  and lockId != ''"> and lock_id = #{lockId}</if>
+            <if test="lockNum != null  and lockNum != ''"> and lock_num = #{lockNum}</if>
+            <if test="lockState != null  and lockState != ''"> and lock_state = #{lockState}</if>
+            <if test="lockPositionState != null  and lockPositionState != ''"> and lock_position_state = #{lockPositionState}</if>
+            <if test="lockShellState != null  and lockShellState != ''"> and lock_shell_state = #{lockShellState}</if>
+            <if test="restartState != null  and restartState != ''"> and restart_state = #{restartState}</if>
+            <if test="batterVoltage != null  and batterVoltage != ''"> and batter_voltage = #{batterVoltage}</if>
+            <if test="powerVoltage != null  and powerVoltage != ''"> and power_voltage = #{powerVoltage}</if>
+            <if test="uploadTime != null  and uploadTime != ''"> and upload_time = #{uploadTime}</if>
+            <if test="uniqueMark != null  and uniqueMark != ''"> and unique_mark = #{uniqueMark}</if>
+        </where>
+    </select>
+    
+    <select id="selectArdTankLockStateById" parameterType="String" resultMap="ArdTankLockStateResult">
+        <include refid="selectArdTankLockStateVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertArdTankLockState" parameterType="ArdTankLockState">
+        insert into ard_tank_lock_state
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="lockId != null">lock_id,</if>
+            <if test="lockNum != null">lock_num,</if>
+            <if test="lockState != null">lock_state,</if>
+            <if test="lockPositionState != null">lock_position_state,</if>
+            <if test="lockShellState != null">lock_shell_state,</if>
+            <if test="restartState != null">restart_state,</if>
+            <if test="batterVoltage != null">batter_voltage,</if>
+            <if test="powerVoltage != null">power_voltage,</if>
+            <if test="uploadTime != null">upload_time,</if>
+            <if test="uniqueMark != null">unique_mark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="lockId != null">#{lockId},</if>
+            <if test="lockNum != null">#{lockNum},</if>
+            <if test="lockState != null">#{lockState},</if>
+            <if test="lockPositionState != null">#{lockPositionState},</if>
+            <if test="lockShellState != null">#{lockShellState},</if>
+            <if test="restartState != null">#{restartState},</if>
+            <if test="batterVoltage != null">#{batterVoltage},</if>
+            <if test="powerVoltage != null">#{powerVoltage},</if>
+            <if test="uploadTime != null">#{uploadTime},</if>
+            <if test="uniqueMark != null">#{uniqueMark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateArdTankLockState" parameterType="ArdTankLockState">
+        update ard_tank_lock_state
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="lockId != null">lock_id = #{lockId},</if>
+            <if test="lockNum != null">lock_num = #{lockNum},</if>
+            <if test="lockState != null">lock_state = #{lockState},</if>
+            <if test="lockPositionState != null">lock_position_state = #{lockPositionState},</if>
+            <if test="lockShellState != null">lock_shell_state = #{lockShellState},</if>
+            <if test="restartState != null">restart_state = #{restartState},</if>
+            <if test="batterVoltage != null">batter_voltage = #{batterVoltage},</if>
+            <if test="powerVoltage != null">power_voltage = #{powerVoltage},</if>
+            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
+            <if test="uniqueMark != null">unique_mark = #{uniqueMark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteArdTankLockStateById" parameterType="String">
+        delete from ard_tank_lock_state where id = #{id}
+    </delete>
+
+    <delete id="deleteArdTankLockStateByIds" parameterType="String">
+        delete from ard_tank_lock_state where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <insert id="insertOrUpdateArdTankLockState" parameterType="ArdTankLockState" >
+        insert into ard_tank_lock_state (id, lock_id, lock_num, lock_state, lock_position_state, lock_shell_state,
+                                         restart_state, batter_voltage, power_voltage, upload_time, unique_mark)
+        values (#{id,jdbcType=VARCHAR},#{lockId,jdbcType=VARCHAR},#{lockNum,jdbcType=VARCHAR},#{lockState,jdbcType=VARCHAR},
+                #{lockPositionState,jdbcType=VARCHAR},#{lockShellState,jdbcType=VARCHAR},#{restartState,jdbcType=VARCHAR},
+                #{batterVoltage,jdbcType=VARCHAR},#{powerVoltage,jdbcType=VARCHAR},#{uploadTime,jdbcType=VARCHAR},
+                #{uniqueMark,jdbcType=VARCHAR})
+            on conflict(unique_mark) do update set upload_time=#{uploadTime,jdbcType=VARCHAR}
+    </insert>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3