Browse Source

修改还原设备查询

develop
王兴琳 2 months ago
parent
commit
a1f9840398
  1. 100
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

100
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -124,56 +124,56 @@ public class DcDeviceController extends BaseController {
@PostMapping("pileNumberQuery") @PostMapping("pileNumberQuery")
public AjaxResult devicePileNumberQueryDevice(@RequestBody Map<String, Object> parameter) throws HttpException, IOException, InterruptedException { public AjaxResult devicePileNumberQueryDevice(@RequestBody Map<String, Object> parameter) throws HttpException, IOException, InterruptedException {
List<DcDevice> dcDevices = dcDeviceService.devicePileNumberQueryDevice(parameter); List<DcDevice> dcDevices = dcDeviceService.devicePileNumberQueryDevice(parameter);
String deviceType = String.valueOf(parameter.get("deviceType")); // String deviceType = String.valueOf(parameter.get("deviceType"));
if (deviceType.equals("15")){ // if (deviceType.equals("15")){
AjaxResult ajaxResult = ConfluenceAreaEarlyWarningDeviceBatteryLowWarning(); // AjaxResult ajaxResult = ConfluenceAreaEarlyWarningDeviceBatteryLowWarning();
Object data = ajaxResult.get("data"); // Object data = ajaxResult.get("data");
if (data instanceof List) { // if (data instanceof List) {
List<Map<String, Object>> dataList = (List<Map<String, Object>>) data; // List<Map<String, Object>> dataList = (List<Map<String, Object>>) data;
for (Map<String, Object> entry : dataList) { // for (Map<String, Object> entry : dataList) {
String functionId = (String) entry.get("functionId"); // String functionId = (String) entry.get("functionId");
String device = (String) entry.get("device"); // String device = (String) entry.get("device");
System.out.println("device:"+device); // System.out.println("device:"+device);
System.out.println("functionId:"+functionId); // System.out.println("functionId:"+functionId);
Object result = entry.get("result"); // Object result = entry.get("result");
if (result instanceof Map) { // if (result instanceof Map) {
Map<String, Object> resultMap = (Map<String, Object>) result; // Map<String, Object> resultMap = (Map<String, Object>) result;
Integer resultCode = (Integer) resultMap.get("code"); // Integer resultCode = (Integer) resultMap.get("code");
if (resultCode==200){ // if (resultCode==200){
Object innerData = resultMap.get("data"); // Object innerData = resultMap.get("data");
if (innerData instanceof List) { // if (innerData instanceof List) {
List<Map<String, Object>> innerDataList = (List<Map<String, Object>>) innerData; // List<Map<String, Object>> innerDataList = (List<Map<String, Object>>) innerData;
for (Map<String, Object> innerEntry : innerDataList) { // for (Map<String, Object> innerEntry : innerDataList) {
Integer innerCode = (Integer) innerEntry.get("code"); // Integer innerCode = (Integer) innerEntry.get("code");
System.out.println("Inner Code: " + innerCode); // System.out.println("Inner Code: " + innerCode);
if (innerCode==200){ // if (innerCode==200){
for (DcDevice dcDevice : dcDevices) { // for (DcDevice dcDevice : dcDevices) {
if (String.valueOf(dcDevice.getId()).equals(device)){ // if (String.valueOf(dcDevice.getId()).equals(device)){
dcDevice.setDeviceState("1"); // dcDevice.setDeviceState("1");
} // }
} // }
}else { // }else {
for (DcDevice dcDevice : dcDevices) { // for (DcDevice dcDevice : dcDevices) {
if (String.valueOf(dcDevice.getId()).equals(device)){ // if (String.valueOf(dcDevice.getId()).equals(device)){
dcDevice.setDeviceState("0"); // dcDevice.setDeviceState("0");
} // }
} // }
} // }
} // }
} // }
}else { // }else {
for (DcDevice dcDevice : dcDevices) { // for (DcDevice dcDevice : dcDevices) {
if (String.valueOf(dcDevice.getId()).equals(device)){ // if (String.valueOf(dcDevice.getId()).equals(device)){
dcDevice.setDeviceState("0"); // dcDevice.setDeviceState("0");
} // }
} // }
} // }
//
} // }
} // }
} // }
//
} // }
return AjaxResult.success(dcDevices); return AjaxResult.success(dcDevices);
} }

Loading…
Cancel
Save