| | |
| | | Map<String, Object> detail = deviceService.detail(mac, startTime, endTime, type); |
| | | return ResultMessage.ok(detail); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("state") |
| | | @ApiOperation("当前在线率") |
| | | public ResultMessage state(Integer organizationId){ |
| | | Map<String, Object> start = deviceService.getStart(organizationId); |
| | | return ResultMessage.ok(start); |
| | | } |
| | | } |
| | |
| | | Map<String,Object> detail(String mac,String startTime,String endTime, String type); |
| | | |
| | | |
| | | |
| | | Map<String,Object> getStart(Integer organizationId); |
| | | |
| | | |
| | | Map<String,Object> detailV1(String mac,String startTime,String endTime, String type); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String,Object> getStart(Integer organizationId) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<OnlineRateVo> lists = deviceMapper.getLists(organizationId, null); |
| | | if (!ObjectUtils.isEmpty(lists)){ |
| | | Map<String, List<OnlineRateVo>> collect = lists.stream().collect(Collectors.groupingBy(OnlineRateVo::getState)); |
| | | int size1 = lists.size(); |
| | | int size = collect.get("0").size(); |
| | | int i = size1 - size; |
| | | //总数 |
| | | map.put("sum",lists.size()); |
| | | //在线 |
| | | map.put("online",i); |
| | | double number = (double) i / size1 * 100; |
| | | String result = String.format("%.2f", number); |
| | | map.put("onlineRate",result); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> detailV1(String mac, String startTime, String endTime, String type) { |
| | | HashMap<String, Object> rsMap = new HashMap<>(); |
| | | Map<String, Object> map = new TreeMap<>( |