Commit 2190561d by YANGYANG

用户新增修改 提交

parent 97b651db
...@@ -97,6 +97,7 @@ public class UsersController { ...@@ -97,6 +97,7 @@ public class UsersController {
@RequestBody UsersAndDevice usersAndDevice) { @RequestBody UsersAndDevice usersAndDevice) {
// 调用开关接口 // 调用开关接口
String result = serverZdryApi.updateDevice(usersAndDevice.getDevice()); String result = serverZdryApi.updateDevice(usersAndDevice.getDevice());
if(result.equals("success")){ if(result.equals("success")){
boolean flag = usersService.save(usersAndDevice.getUsers()); boolean flag = usersService.save(usersAndDevice.getUsers());
if(flag){ if(flag){
...@@ -107,7 +108,7 @@ public class UsersController { ...@@ -107,7 +108,7 @@ public class UsersController {
} }
}else{ }else{
return MapRestResult.build(ResultCode.ERROR,"保存用户开关信息失败","1"); return MapRestResult.build(ResultCode.ERROR,"保存用户开关信息失败",result);
} }
} }
...@@ -127,7 +128,7 @@ public class UsersController { ...@@ -127,7 +128,7 @@ public class UsersController {
} }
}else{ }else{
return MapRestResult.build(ResultCode.ERROR,"修改用户信息失败","1"); return MapRestResult.build(ResultCode.ERROR,"修改用户信息失败",result);
} }
} }
......
...@@ -124,16 +124,25 @@ public class ZdryApiServiceImpl implements ZdryApiService { ...@@ -124,16 +124,25 @@ public class ZdryApiServiceImpl implements ZdryApiService {
JSONObject result = JSONObject.parseObject(resultString); JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录 // 查看是否登录
if (result.containsKey("error_code")) { if (result.getString("error_code").equals("101")) {
if(getToken().equals("success")){ if(getToken().equals("success")){
updateDevice(deviceParam); String resultStringAll = restTemplate.postForEntity(zdryUrl+updateSbxxUrl+deviceParam.getSbImei()+"/4g/edit/", params, String.class).getBody();
JSONObject resultAll = JSONObject.parseObject(resultStringAll);
if (resultAll.getString("error_code").equals("1")) {
return "无效设备!";
}else if(resultAll.getString("success").equals("true")){
return "success";
}
}else{ }else{
return "error"; return "登录错误!";
}; };
} }else{
if (result.containsKey("success")) { if (result.getString("error_code").equals("1")) {
return "无效设备!";
}else if(result.getString("success").equals("true")){
return "success"; return "success";
} }
}
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment