Commit ae12f015 authored by 廖旭伟's avatar 廖旭伟

设备列表接口增加统计字段

parent ca17eaa4
......@@ -364,9 +364,36 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
int code;
try {
Rest<RespData<List<DevicePdu>>> rest = deviceFeign.list(query);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
model.put("data", rest.getData());
int onlineTotal = 0;
int offlineTotal = 0;
int not_active = 0;
int stop_using = 0;
for (DevicePdu deviceEntity : rest.getData().getData()) {
if (deviceEntity.getDeviceStatus() == 0) {
not_active++;
}
if (deviceEntity.getDeviceStatus() == 1) {
offlineTotal++;
}
if (deviceEntity.getDeviceStatus() == 2) {
onlineTotal++;
}
if (deviceEntity.getEnabled() == 0) {
stop_using++;
}
}
model.put("online", onlineTotal);
model.put("offline", offlineTotal);
model.put("notActive", not_active);
model.put("stopUsing", stop_using);
model.put("pageInfo", rest.getData().getPageInfo());
//model.put("dict", rest.getData().getDict());
}
ret.setCode(rest.getCode());
ret.setMsg(rest.getMsg());
ret.setData(rest.getData());
ret.setData(model);
ret.setDict(rest.getDict());
} catch (Exception var9) {
......
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