| | |
| | | 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; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.jfpt.equipment.wrapper.EqWrapper; |
| | | import org.springblade.system.entity.Region; |
| | | import org.springblade.system.user.entity.User; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | |
| | | |
| | | private final DeptFeignApi deptFeignApi; |
| | | |
| | | private final RegionFeignApi regionFeignApi; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | /*Equipment detail = equipmentService.getOne(Condition.getQueryWrapper(equipment));*/ |
| | | |
| | | return R.data(equipmentService.selectInfo(equipment)); |
| | | EquipmentVOS equipmentVOS = equipmentService.selectInfo(equipment); |
| | | //获取部门数据 |
| | | List<DeptVo> deptVos = deptFeignApi.selDeptList(); |
| | | if (null!=equipmentVOS.getDeptId()){ |
| | | String[] split =equipmentVOS.getDeptId().split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | StringBuffer deptNameBuiffer = new StringBuffer(); |
| | | //数据匹配封装 |
| | | for (String deptId:list) { |
| | | for (DeptVo deptVo:deptVos) { |
| | | if (deptId.equals(deptVo.getId().toString())){ |
| | | deptNameBuiffer.append(deptVo.getDeptName()).append("/"); |
| | | } |
| | | } |
| | | } |
| | | //封装部门名称数据 |
| | | equipmentVOS.setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1)); |
| | | } |
| | | return R.data(equipmentVOS); |
| | | } |
| | | |
| | | /** |
| | |
| | | }else{ |
| | | pages.get(j).setOnlineStatus("0"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return R.data(pages); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | equipment.setHeartbeat(null); |
| | | } |
| | | |
| | | if (equipment.getDtype() == null || equipment.getDtype().equals("")) { |
| | | equipment.setDtype("0"); |
| | | } |
| | | |
| | | //判断省市区的值是否为数字或者中文字符串 |
| | | if(null!=equipment.getProvince()){ |
| | | //如果不是数字,则需调用接口匹配数据(直接取区、县参数) |
| | | if (!equipment.getDistrict().matches("^[0-9]*$") && !equipment.getCity().matches("^[0-9]*$")){ |
| | | Region region = regionFeignApi.selRegionDetail(equipment.getDistrict(),equipment.getCity()); |
| | | if (null!=region){ |
| | | //封装数据 |
| | | equipment.setProvince(region.getProvinceCode()); |
| | | equipment.setCity(region.getCityCode()); |
| | | equipment.setDistrict(region.getDistrictCode()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // String deviceName = equipment.getDeviceName(); |
| | | // String deviceNumber = equipment.getDeviceNumber(); |
| | | // String pId = equipment.getPid(); |
| | |
| | | // }else{ |
| | | // 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)); |
| | | } |
| | | |
| | | } |