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

Loading…
Cancel
Save