From 3657b60d3dc71aead5e09f33637aa454a02385b3 Mon Sep 17 00:00:00 2001 From: Hy Date: Mon, 7 Jun 2021 10:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E9=94=AE=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../toolbox/rest/ToolboxRestController.java | 39 ++++++++++++++----- .../src/test/java/org/jeecg/Test.java | 3 +- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/toolbox/rest/ToolboxRestController.java b/jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/toolbox/rest/ToolboxRestController.java index bf4704c..e33e28e 100644 --- a/jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/toolbox/rest/ToolboxRestController.java +++ b/jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/toolbox/rest/ToolboxRestController.java @@ -17,7 +17,9 @@ import org.springframework.web.bind.annotation.RestController; import toolkit.KitReader; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @RequestMapping("toolboxrest") @@ -82,13 +84,14 @@ public class ToolboxRestController { * @date: 2021/6/4 16:39 */ @RequestMapping("automaticInspection") - public String automaticInspection(){ + public Map automaticInspection(){ KitReader kitReader = new KitReader(new NewKitReader()); //List allList = cabinetManageService.getAllList(); Boolean aBoolean = kitReader.StartCheckAuto("0000", 6); //String str = NewKitReader.toolKitSdkMsg; String str = "01;82,01,01,00,FC550001,01,1,4205,00,00100000,15,15,0,0,0,0,0"; String res = ""; + Map map = new HashMap(); if (aBoolean){ System.out.println("str = " + str); String msg = str.substring(0,str.indexOf(";")); @@ -98,26 +101,42 @@ public class ToolboxRestController { case "D1": if (!encodingD(newMsg).equalsIgnoreCase("1")){ res = "箱子不在位的柜门编号为:" + encodingD(newMsg); - }else - res = "所有设备处于正常状态";break; + map.put("D1",res); + }else{ + res = "所有设备处于正常状态"; + map.put("ok",res); + } + break; case "D2": if (!encodingD(newMsg).equalsIgnoreCase("1")){ res = "手环不在位的柜门编号为:" + encodingD(newMsg); - }else - res = "所有设备处于正常状态";break; + map.put("D2",res); + }else{ + res = "所有设备处于正常状态"; + map.put("ok",res); + } + break; case "D3": if (!encodingD(newMsg).equalsIgnoreCase("1")){ res = encodingD(newMsg); - } else - res = "所有设备处于正常状态";break; + map.put("D3",res); + } else{ + res = "所有设备处于正常状态"; + map.put("ok",res); + } + break; case "01": - res = Parsing.parsingCode(newMsg.split(","));break; + res = Parsing.parsingCode(newMsg.split(",")); + map.put("01",res); + break; case "06": - res = Parsing.parsingCode(newMsg.split(","));break; + res = Parsing.parsingCode(newMsg.split(",")); + map.put("D6",res); + break; } System.out.println("res = " + res); } - return res; + return map; } /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/test/java/org/jeecg/Test.java b/jeecg-boot/jeecg-boot-module-system/src/test/java/org/jeecg/Test.java index f4eddd2..5a57f7f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/test/java/org/jeecg/Test.java +++ b/jeecg-boot/jeecg-boot-module-system/src/test/java/org/jeecg/Test.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import toolkit.KitReader; import java.util.List; +import java.util.Map; public class Test { @@ -43,7 +44,7 @@ public class Test { // } String str = ";1,2,3,4,5,6"; ToolboxRestController toolboxRestController = new ToolboxRestController(); - String s = toolboxRestController.automaticInspection(); + Map s = toolboxRestController.automaticInspection(); System.out.println("s = " + s); } } -- Gitee