From 2799314298467be9ed68d9e19891e35cb3c3edad Mon Sep 17 00:00:00 2001 From: zhangnaisong <2434969829@qq.com> Date: 星期四, 01 八月 2024 08:14:18 +0800 Subject: [PATCH] 电磁锁动作状态改为操控中...提交 --- ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockProcessLogServiceImpl.java | 46 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 32 insertions(+), 14 deletions(-) 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 1072653..0038f30 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 @@ -6,6 +6,7 @@ import java.util.*; import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysConfig; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.sy.domain.ArdSyUser; @@ -59,6 +60,8 @@ private SYClient sYClient; private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + private Map<String,Timer> timerMap = new HashMap(); /** * 鏌ヨ缃愯溅閿佹搷鎺ф棩蹇� @@ -129,7 +132,7 @@ } @Override - public String processArdTankLockByLockId(String userId, String username, Map<String,String> para) { + public AjaxResult processArdTankLockByLockId(String userId, String username, Map<String,String> para) { String lockId = para.get("lockId"); String lockNum = para.get("lockNum"); String carId = para.get("carId"); @@ -139,19 +142,19 @@ //鍒ゆ柇浣胯兘 ArdTankLock ardTankLock = ardTankLockMapper.selectArdTankLockById(lockId); if(ardTankLock.getEnable().equals("false")){ - return "璇ラ攣浣胯兘鍏抽棴锛屾棤娉曟搷鎺�"; + return AjaxResult.error("璇ラ攣浣胯兘鍏抽棴锛屾棤娉曟搷鎺�"); } ArdSyUser ardSyUser = ardSyUserMapper.userById(userId); if(ardSyUser == null){ - return "鏈寕鎺ヤ笁涓�璐﹀彿"; + return AjaxResult.error("鏈寕鎺ヤ笁涓�璐﹀彿"); } List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT"); String syURL = ""; if(syURLResult.size() != 0){ syURL = syURLResult.get(0).getConfigValue(); }else{ - return "涓変竴骞冲彴鏈綍鍏�"; + return AjaxResult.error("涓変竴骞冲彴鏈綍鍏�"); } String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword()); Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, ardSyUser.getUserId()); @@ -164,13 +167,13 @@ if(((String)syResult.get("rspCode")).equals("1")){ Map<String,Object> carMap = ((List<Map<String,Object>>)syResult.get("list")).get(0); if(Integer.parseInt((String)carMap.get("speed")) != 0){ - return "杞﹁締姝e湪琛岄┒涓�"; + return AjaxResult.error("杞﹁締姝e湪琛岄┒涓�"); } lng = (String) carMap.get("lng"); lat = (String) carMap.get("lat"); carPlate = (String) carMap.get("carName"); }else{ - return "涓変竴骞冲彴鎶ラ敊"; + return AjaxResult.error("涓変竴骞冲彴鎶ラ敊"); } List<ArdTankWall> ardTankWallList = ardTankWallMapper.getArdTankWallProcessByLockId(lockId);//鏌ヨ閿佹寕鎺ョ殑鍏ㄩ儴闇�瑕佸姩浣滅殑鐢靛瓙鍥存爮 @@ -184,10 +187,10 @@ pts.add(new Point2D.Double(Double.parseDouble(wallpoiArro[j]), Double.parseDouble(wallpoiArro[j+1]))); } if(GeoTools.IsPtInPoly(point, pts)){//鍦ㄤ换鎰忕數瀛愬洿鏍忓唴锛屼笉鎶ヨ - return "褰撳墠杞﹁締姝e鍦�" + ardTankWall.getWallName() + "涓�"; + return AjaxResult.error("褰撳墠杞﹁締姝e鍦�" + ardTankWall.getWallName() + "涓�"); } } - return "褰撳墠杞﹁締姝e鍦ㄧ數瀛愬洿鏍忓"; + return AjaxResult.error("褰撳墠杞﹁締姝e鍦ㄧ數瀛愬洿鏍忓"); }else{ try{ String lockNumHead = lockNum.substring(0,2); @@ -205,10 +208,7 @@ String paramsStr = lockNum + "02" + process + checkNum; paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + paramsStr + "%22%7D"; - System.out.println(paramsStr); 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.setId(IdUtils.simpleUUID()); @@ -228,13 +228,31 @@ ardTankLockProcessLog.setLatitude(lat); ardTankLockProcessLog.setProcessTime(this.sdf.format(new Date())); ardTankLockProcessLogMapper.insertArdTankLockProcessLog(ardTankLockProcessLog); - return "鍙戦�佹垚鍔�"; + return AjaxResult.success("鍙戦�佹垚鍔�"); + }else if(((String)result.get("rspCode")).equals("-6")){ + return AjaxResult.error("鎵句笉鍒拌溅杈�"); + }else if(((String)result.get("rspCode")).equals("-5")){ + return AjaxResult.error("鎵句笉鍒扮敤鎴�"); + }else if(((String)result.get("rspCode")).equals("-4")){ + return AjaxResult.error("鎵句笉鍒版寚浠�"); + }else if(((String)result.get("rspCode")).equals("-3")){ + return AjaxResult.error("鎸囦护鍙戦�佽秴鏃�"); + }else if(((String)result.get("rspCode")).equals("-2")){ + return AjaxResult.error("绂荤嚎寰呭彂"); + }else if(((String)result.get("rspCode")).equals("-1")){ + return AjaxResult.error("杞﹁締绂荤嚎"); + }else if(((String)result.get("rspCode")).equals("1")){ + return AjaxResult.error("鍙戦�佸け璐�"); + }else if(((String)result.get("rspCode")).equals("2")){ + return AjaxResult.error("娑堟伅鏈夎"); + }else if(((String)result.get("rspCode")).equals("3")){ + return AjaxResult.error("涓嶆敮鎸�"); }else{ - return "鍙戦�佸け璐�"; + return AjaxResult.error("鍏朵粬鍘熷洜鍙戦�佸け璐�"); } }catch(Exception e){ e.printStackTrace(); - return "鍙戦�佸け璐�"; + return AjaxResult.error("鍙戦�佸け璐�" + e.toString()); } } } -- Gitblit v1.9.3