| | |
| | | import org.springblade.jfpt.catalog.service.catalogService; |
| | | import org.springblade.jfpt.deploy.service.IDeployService; |
| | | import org.springblade.jfpt.equipment.entity.Equipment; |
| | | import org.springblade.jfpt.equipment.entity.EquipmentPlayInfo; |
| | | import org.springblade.jfpt.equipment.feign.DeptFeignApi; |
| | | import org.springblade.jfpt.equipment.feign.RegionFeignApi; |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | |
| | | page.getRecords().get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1)); |
| | | } |
| | | |
| | | 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类型的 |
| | | |
| | | if (expireTime != null) { |
| | | 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); |
| | | } |
| | | } |
| | | // 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类型的 |
| | | // |
| | | // if (expireTime != null) { |
| | | // 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); |
| | | // } |
| | | // } |
| | | // |
| | | // //判断设备是否在线 |
| | | // String Heartbeat = page.getRecords().get(j).getHeartbeat(); |
| | | // if (Heartbeat != null){ |
| | | // long st = sim.parse(Heartbeat).getTime(); |
| | | // long en = sim.parse(end).getTime(); |
| | | // if ((en - st) >= (60 * 60 * 24 * 1000)){ |
| | | // page.getRecords().get(j).setOnlineStatus("0"); |
| | | // }else{ |
| | | // page.getRecords().get(j).setOnlineStatus("1"); |
| | | // } |
| | | // }else{ |
| | | // page.getRecords().get(j).setOnlineStatus("0"); |
| | | // } |
| | | } |
| | | |
| | | |
| | | return R.data(page); |
| | | } |
| | |
| | | if (equipment.getHeartbeat() != null && equipment.getHeartbeat().equals("")) { |
| | | equipment.setHeartbeat(null); |
| | | } |
| | | |
| | | if (equipment.getDtype() == null || equipment.getDtype().equals("")) { |
| | | equipment.setDtype("0"); |
| | | } |
| | | |
| | | //判断省市区的值是否为数字或者中文字符串 |
| | | if(null!=equipment.getProvince()){ |
| | | //如果不是数字,则需调用接口匹配数据(直接取区、县参数) |
| | |
| | | // catalogService.updateCatalog(deviceName,deviceNumber,pId); |
| | | // } |
| | | |
| | | |
| | | return R.status(equipmentService.saveOrUpdate(equipment)); |
| | | } |
| | | |
| | |
| | | |
| | | if (equipment.getHeartbeat() != null && equipment.getHeartbeat().equals("")) { |
| | | equipment.setHeartbeat(null); |
| | | } |
| | | |
| | | if (equipment.getDtype() == null || equipment.getDtype().equals("")) { |
| | | equipment.setDtype("0"); |
| | | } |
| | | |
| | | // String deviceName = equipment.getDeviceName(); |
| | |
| | | return R.data(map); |
| | | } |
| | | |
| | | /** |
| | | * 监控台统计 |
| | | * @author arsn 2021-5-6 |
| | | * @return |
| | | */ |
| | | @PostMapping("/SeleCs") |
| | | public R SeleCs() { |
| | | return R.data(equipmentService.selEqTypeSum()); |
| | | } |
| | | |
| | | /** |
| | | * 获取设备视频播放的信息 |
| | | * @param equipmentPlayInfo 视频播放地址对象,只需包含设备编号,以及视频播放格式即可 |
| | | * @param response 响应域,设置跨域 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectEquimentPlayInfo") |
| | | public R selectEquimentPlayInfo(EquipmentPlayInfo equipmentPlayInfo,HttpServletResponse response){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | //返回 |
| | | return R.data(equipmentService.selectEquimentPlayInfo(equipmentPlayInfo)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增或修改设备视频播放的信息 |
| | | * @param equipmentPlayInfo 视频播放地址对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/submitEquimentPlayInfo") |
| | | public R submitEquimentPlayInfo(EquipmentPlayInfo equipmentPlayInfo){ |
| | | return R.status(equipmentService.saveOrUpdateEquipmentPlayInfo(equipmentPlayInfo)); |
| | | } |
| | | |
| | | } |