src/main/java/com/whyc/controller/InterfaceFireRobotController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/WmsPalletDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/FireRobotService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/WmsService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/InterfaceFireRobotController.java
New file @@ -0,0 +1,46 @@ package com.whyc.controller; import com.whyc.dto.Response; import com.whyc.dto.WmsPalletDto; import com.whyc.service.FireRobotService; import com.whyc.service.WmsService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @Api(tags = "消防机器人接口") @RequestMapping("fireRobot") public class InterfaceFireRobotController { @Autowired private FireRobotService service; /** * opendoor 打开卷帘门、closedoor 关闭卷帘门;openfire 打开七氟丙烷灭火器、closefire 关闭七氟丙烷灭火器; * API:http://192.168.10.45:8085/ControlInterfaceHandler?command=opendoor * @return */ @PostMapping("control") public Response control(@RequestParam String command){ return service.control(command); } /** * 指定任务点巡检接口示例 * API:http://192.168.10.45:8085/SpecifyTask?interval=0-1&progress=88&direction=0 * 请求参数 参数1 interval(string):巡检房间区间 是 ON * 参数2 progress(int):巡检位置百分比 是 * 参数3 direction(int):巡检方向 是 * 参数示例 * * ["interval 格式示例:0-1 ; progress 必须是 0-100 的整数; direction 必须是 0 或 1] */ @PostMapping("specifyTask") public Response specifyTask(@RequestParam String interval,@RequestParam Integer progress,@RequestParam Integer direction){ return service.specifyTask(interval,progress,direction); } } src/main/java/com/whyc/dto/WmsPalletDto.java
@@ -8,7 +8,7 @@ public class WmsPalletDto { private Integer des; private List<String> pallets; private List<Integer> activateParameter; private List<String> activateParameter; public Integer getDes() { return des; @@ -26,11 +26,11 @@ this.pallets = pallets; } public List<Integer> getActivateParameter() { public List<String> getActivateParameter() { return activateParameter; } public void setActivateParameter(List<Integer> activateParameter) { public void setActivateParameter(List<String> activateParameter) { this.activateParameter = activateParameter; } } src/main/java/com/whyc/service/FireRobotService.java
New file @@ -0,0 +1,55 @@ package com.whyc.service; import com.google.gson.reflect.TypeToken; import com.whyc.dto.Response; import com.whyc.dto.WmsMaterialDto; import com.whyc.util.HttpUtil; import com.whyc.util.JsonUtil; import org.springframework.stereotype.Service; import java.util.List; @Service public class FireRobotService { /** * * @param command * @return */ public Response control(String command) { String httpUrl = "http://192.168.10.45:8085"+"/ControlInterfaceHandler?command="+command; Response response = HttpUtil.doPost(httpUrl, (String) null); //对结果进行处理 if(response.getCode() == 1){ //请求成功,data有正常数据 String dataStr = (String) response.getData(); //参数示例 //执行成功返回: //开门成功! //关门成功! //七氟丙烷打开成功! //七氟丙烷关闭成功成功! //指令执行失败,请重新发送! if(dataStr.contains("成功")){ response.set(1,true,dataStr); }else{ response.set(1,false,dataStr); } } return response; } public Response specifyTask(String interval, Integer progress, Integer direction) { String httpUrl = "http://192.168.10.45:8085"+"/SpecifyTask?interval="+interval+"&progress="+progress+"&direction="+direction; Response response = HttpUtil.doPost(httpUrl, (String) null); //对结果进行处理 if(response.getCode() == 1){ //请求成功,data有正常数据 String dataStr = (String) response.getData(); //任务已设置: interval=0-1, progress=88%, direction=左 response.setMsg(dataStr); response.setData(null); } return response; } } src/main/java/com/whyc/service/WmsService.java
@@ -11,10 +11,6 @@ @Service public class WmsService { /** * TODO ip和端口待确定调整 * @return */ public Response getMaterialList() { String httpUrl = "http://192.168.10.133:8051"+"/api/Wms_material/get_all"; Response response = HttpUtil.doGet(httpUrl, (String) null);