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(); } } } 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) 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(); } } 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; /** å¤å£³ç¶æ */ @Excel(name = "å¤å£³ç¶æ") 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(); } } 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 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("æ£å¸¸");break; case "02": ardTankLockState.setLockPositionState("å¼å¸¸");break; default: break; } switch (lockShellState) {//å¤å£³ç¶æ case "01": ardTankLockState.setLockShellState("æ£å¸¸");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);//æå¡å¨IP 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(); } } } 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; /** * ç½è½¦éèªå¨ææ§æ¥å¿Mapperæ¥å£ * * @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); } 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); } 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; /** * ç½è½¦éç¶æMapperæ¥å£ * * @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); } 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; /** * ç½è½¦éèªå¨ææ§æ¥å¿Serviceæ¥å£ * * @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); } 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; /** * ç½è½¦éç¶æServiceæ¥å£ * * @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); } 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; /** * ç½è½¦éèªå¨ææ§æ¥å¿Serviceä¸å¡å±å¤ç * * @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); } } 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(); } } } 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); 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; /** * ç½è½¦éç¶æServiceä¸å¡å±å¤ç * * @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; } } 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> 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> 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>