|
|
|
|
@ -56,6 +56,7 @@ public class PdaApiController {
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> response = null;
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
String url = "http://119.45.202.115:7789/devcontrolbusiness/unlock?idStr=" + baseInfo.getOpenCode() + "&password=" + baseInfo.getOpenPassword();
|
|
|
|
|
// 根据实际情况调整参数值
|
|
|
|
|
@ -64,7 +65,16 @@ public class PdaApiController {
|
|
|
|
|
MyResult myResult = JSONObject.parseObject(response.getBody(), MyResult.class);
|
|
|
|
|
System.out.println(myResult.toString());
|
|
|
|
|
if (myResult.getCode() == 200) {
|
|
|
|
|
// 修改设备状态
|
|
|
|
|
BaseInfo updateBaseInfo = new BaseInfo();
|
|
|
|
|
updateBaseInfo.setObjId(baseInfo.getObjId());
|
|
|
|
|
updateBaseInfo.setUseState("0");
|
|
|
|
|
updateBaseInfo.setLocationName("A455C1B8500104E0");
|
|
|
|
|
baseInfoService.updateBaseInfoForApi(updateBaseInfo);
|
|
|
|
|
// service.updateRecord(code);
|
|
|
|
|
return success("关锁,打开成功");
|
|
|
|
|
}else {
|
|
|
|
|
return error(myResult.getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
@ -80,7 +90,7 @@ public class PdaApiController {
|
|
|
|
|
public AjaxResult openDeviceLock(@RequestBody BaseInfo baseInfo) {
|
|
|
|
|
String openCode = baseInfo.getOpenCode();
|
|
|
|
|
String openPassword = baseInfo.getOpenPassword();
|
|
|
|
|
System.out.println("开锁");
|
|
|
|
|
System.out.println("开锁:"+openCode+",密码:"+openPassword);
|
|
|
|
|
ResponseEntity<String> response = null;
|
|
|
|
|
try {
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
@ -91,7 +101,8 @@ public class PdaApiController {
|
|
|
|
|
if (response.getStatusCode().is2xxSuccessful()) {
|
|
|
|
|
// {"code":200/500,"isSuc":true,"msg":"开锁指令下发成功,已收到设备回复","buffer":null,"data":null}
|
|
|
|
|
MyResult myResult = JSONObject.parseObject(response.getBody(), MyResult.class);
|
|
|
|
|
System.out.println(myResult.toString());
|
|
|
|
|
|
|
|
|
|
System.out.println("返回值:"+myResult.toString());
|
|
|
|
|
if (myResult.getCode() == 200) {
|
|
|
|
|
/**
|
|
|
|
|
* 插入记录
|
|
|
|
|
|