| | |
| | | //根据传入的id递归出该节点下所有的设备 |
| | | List<Map<String, Object>> childList = treeIdList(treedatas, pid); |
| | | |
| | | //根据查询条件得到所有设备 |
| | | page = equipmentService.selectEquipmentPage(Condition.getPage(query), equipment, childList); |
| | | if (childList.size() > 0) { |
| | | //根据查询条件得到所有设备 |
| | | page = equipmentService.selectEquipmentPage(Condition.getPage(query), equipment, childList); |
| | | } else { |
| | | page = null; |
| | | } |
| | | } |
| | | |
| | | if (page != null){ |
| | | for (int j = 0; j < page.getRecords().size(); j++) { |
| | | String expireTime = page.getRecords().get(j).getExpireTime(); |
| | | //1.获取当前时间 |
| | | Date dd = new Date(); |
| | | SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | | int day = (int) ((st - en) / 86400000); |
| | | if (day <= 30) { |
| | | page.getRecords().get(j).setType(1); |
| | | } else { |
| | | page.getRecords().get(j).setType(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.data(page); |