| | |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springblade.system.cache.SysCache; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | return page.setRecords(baseMapper.selectEquipmentPage(page,equipment,null)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<EquipmentVO> selectDeptPages(IPage<EquipmentVO> page, EquipmentVO equipment,String pid,String dxdype) { |
| | | |
| | | List deptIdList; |
| | | if (pid != null && !pid.equals("")){ |
| | | deptIdList = SysCache.getDeptChildIds(Long.valueOf(pid)); |
| | | }else{ |
| | | deptIdList = SysCache.getDeptChildIds(null); |
| | | } |
| | | return page.setRecords(baseMapper.selectDeptPages(page,equipment,deptIdList,dxdype)); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<EquipmentVOS> tree() { |
| | | return ForestNodeMerger.merge(baseMapper.tree()); |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentVO> listAll() { |
| | | return baseMapper.listAll(); |
| | | public List<EquipmentVO> listAll(EquipmentVO equipment) { |
| | | return baseMapper.listAll(equipment); |
| | | } |
| | | |
| | | @Override |
| | | public void updateOne(Equipment equipment) { |
| | | baseMapper.updateOne(equipment); |
| | | } |
| | | |
| | | @Override |
| | | public void saveImg(EquipmentVO equipment) { |
| | | baseMapper.saveImg(equipment); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 查询在线设备总数 |
| | | * @param status 状态码 0:本日 1:本周 2:本月 |
| | | * @param conditionVo status 状态码 0:本日 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selectEquipmentCount(Integer status) { |
| | | public Integer selectEquipmentCount(ConditionVo conditionVo) { |
| | | //先查询所有的设备 |
| | | List<EquipmentVO> equipmentVOS = baseMapper.listAll(); |
| | | List<EquipmentVO> equipmentVOS = baseMapper.listAlls(); |
| | | long time = new Date().getTime(); |
| | | int equipmentCount = 0; |
| | | long hearbeat = 0; |
| | | //遍历集合数据,对比心跳时间,得出在线的设备数量 |
| | | if (status==0){ |
| | | int status =0; |
| | | if (status==0 && equipmentVOS.size()>0){ |
| | | for (EquipmentVO e:equipmentVOS) { |
| | | try { |
| | | hearbeat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(e.getHeartbeat()).getTime(); |
| | | if(null!=e.getHeartbeat()) { |
| | | hearbeat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(e.getHeartbeat()).getTime(); |
| | | } |
| | | } catch (ParseException parseException) { |
| | | parseException.printStackTrace(); |
| | | } |
| | |
| | | //返回数据 |
| | | return equipmentCount; |
| | | } |
| | | |
| | | @Override |
| | | public void updateexpireTime(String expireTime, String deviceNumber) { |
| | | baseMapper.updateexpireTime(expireTime,deviceNumber); |
| | | } |
| | | |
| | | @Override |
| | | public void updateExstate(String state, String reason, String deviceNumber) { |
| | | baseMapper.updateExstate(state, reason, deviceNumber); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectEqCz() { |
| | | return baseMapper.selectEqCz(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectEqCd() { |
| | | return baseMapper.selectEqCd(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectEqCy(String time) { |
| | | return baseMapper.selectEqCy(time); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectEqCg() { |
| | | return baseMapper.selectEqCg(); |
| | | } |
| | | } |