添加设备统计接口
This commit is contained in:
parent
39dafad29c
commit
b7eec65e6d
@ -1,12 +1,14 @@
|
||||
package com.fastbee.data.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -16,10 +18,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.enums.BusinessType;
|
||||
import com.fastbee.iot.domain.DeviceReportInfo;
|
||||
import com.fastbee.iot.service.IDeviceReportInfoService;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
@ -63,11 +63,31 @@ public class DeviceReportInfoController extends BaseController
|
||||
}
|
||||
} else if ( d.getType()==2) {
|
||||
//展连流量计设备在线状态判断
|
||||
d.setType(0);
|
||||
}
|
||||
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
//统计是设备相关信息
|
||||
@GetMapping("/list/count")
|
||||
@ApiOperation("统计是设备相关信息")
|
||||
public AjaxResult listCount(DeviceReportInfo deviceReportInfo)
|
||||
{
|
||||
|
||||
List<DeviceReportInfo> list = deviceReportInfoService.selectDeviceReportInfoList(deviceReportInfo);
|
||||
AtomicInteger onLineTotal= new AtomicInteger();
|
||||
list.forEach(d->{
|
||||
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("neixiang_device_online_status:" + 147 + ":" + d.getSerialNumber())))
|
||||
{
|
||||
onLineTotal.getAndIncrement();
|
||||
}
|
||||
});
|
||||
Map<String,Object> resp=new HashMap<>();
|
||||
resp.put("allTotal",list.size());
|
||||
resp.put("onLineTotal",onLineTotal.get());
|
||||
return AjaxResult.success((resp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备上电审核前上报的基础信息列表
|
||||
|
Loading…
x
Reference in New Issue
Block a user