Exemplo n.º 1
0
 @Transactional(readOnly = false)
 public int deleteDevice(Map<String, Object> map) {
   if (map == null || map.get("id") == null) {
     return 0;
   }
   map.put("modifyuser", ShiroDbRealm.getCurrentLoginName());
   return deviceMapper.delete(map);
 }
Exemplo n.º 2
0
 @Transactional(readOnly = false)
 public int updateDevice(DeviceView deviceView) {
   if (deviceView == null || deviceView.getId() == null) {
     return 0;
   }
   String mac = deviceView.getMac();
   if (mac != null) {
     mac = mac.toUpperCase();
     deviceView.setMac(mac);
   }
   deviceView.setModifyuser(ShiroDbRealm.getCurrentLoginName());
   return deviceMapper.update(deviceView);
 }
Exemplo n.º 3
0
 /**
  * 返回轮询结果
  *
  * @param req
  * @param page页面
  * @return
  */
 public String polling(HttpServletRequest req, int page) {
   Map<String, Object> datas = new HashMap<String, Object>();
   // 机位
   List<String> seats = null;
   // 教室编号
   List<String> innerids = null;
   // 名字服务需要的数据
   Map<String, Object> data = new HashMap<String, Object>();
   String loginname = ShiroDbRealm.getCurrentLoginName();
   if (loginname == null) {
     return "unauthc";
   }
   DevicePoling devicePoling = devicePolingMapper.findDevicePolingSetByAreaid(loginname);
   seats = Arrays.asList(devicePoling.getDeviceinfo().split(","));
   innerids = Arrays.asList(devicePoling.getAreainfo().split(","));
   List<Map<String, String>> macList =
       deviceMapper.getMacByInnerId(innerids, AppConstants.TYPE_DEVICETYPE_RECORD);
   data.put("seats", seats); // car0,car1,car4
   // 轮询方式
   String roundType = devicePoling.getRoundType();
   String ipPort = serverService.getWebServer();
   String url = "http://" + ipPort + "/deviceService/polling/" + roundType;
   // 视频轮询
   List<List<Map<String, Object>>> pollingData =
       (List<List<Map<String, Object>>>) req.getSession().getAttribute(roundType);
   if (roundType.equals("flowType")) {
     if (page == 0 && (pollingData == null || pollingData.size() == 0)) {
       pollingData = new ArrayList<List<Map<String, Object>>>();
       req.getSession().setAttribute(roundType, pollingData);
       sendToDeviceService(devicePoling, url, pollingData, data, macList);
     }
     if (pollingData != null && pollingData.size() > page) {
       datas.put("data", pollingData.get(page));
     }
   } else {
     data.put("macList", macList);
     String result = HttpSend.post(url, data);
     List<Map<String, Object>> files = cutPic(result, macList, seats);
     String path = "http://" + req.getLocalAddr() + "/images";
     datas.put("url", path);
     datas.put("data", files);
   }
   datas.put("polingtime", devicePoling.getPolingtime());
   datas.put("polingset", devicePoling.getPolingset());
   return JsonUtil.toJson(datas);
 }
Exemplo n.º 4
0
 @Transactional(readOnly = false)
 public int saveDevice(DeviceView deviceView) {
   if (deviceView == null
       || deviceView.getAreaid() == null
       || deviceView.getName() == null
       || deviceView.getTypeid() == null
       || deviceView.getIp() == null) {
     return 0;
   }
   String mac = deviceView.getMac();
   if (mac != null) {
     mac = mac.toUpperCase();
     deviceView.setMac(mac);
   }
   deviceView.setId(IdUtils.uuid2());
   deviceView.setCreateuser(ShiroDbRealm.getCurrentLoginName());
   return deviceMapper.insert(deviceView);
 }
Exemplo n.º 5
0
 /**
  * @param map
  * @return
  */
 public List<Map<String, Object>> findDevice(Map<String, Object> map) {
   List<Map<String, Object>> list = deviceMapper.findDevice(map);
   return list;
 }
Exemplo n.º 6
0
 public Page<DeviceView> findPageBy(PageBean pageBean, HttpServletRequest req) {
   long total = deviceMapper.count(pageBean);
   List<DeviceView> list = deviceMapper.findByPage(pageBean);
   Page<DeviceView> page = new PageImpl<DeviceView>(list, null, total);
   return page;
 }
Exemplo n.º 7
0
 /**
  * 通过areaid或innerid获取教室下录播机mac
  *
  * @return
  */
 public String getMacById(Map<String, Object> map) {
   // 设置录播机
   // map.put("typeid", AppConstants.TYPE_DEVICETYPE_RECORD);
   return deviceMapper.getMacById(map);
 }
Exemplo n.º 8
0
 /**
  * 取出中控设备(不在zonekey_device_server中的中控设备)
  *
  * @param map
  * @return
  */
 public List<DeviceView> findDeviceControl(Map<String, Object> map) {
   return deviceMapper.findDeviceControl(map);
 }
Exemplo n.º 9
0
 public DeviceView getDevice(String id) {
   return deviceMapper.findOne(id);
 }
Exemplo n.º 10
0
 /**
  * @Description: 根据mac查教室id
  *
  * @author niuxl
  * @date 2014年11月26日 下午3:11:49
  * @param mac
  */
 public DeviceView findDeviceByMac(String mac) {
   return deviceMapper.findDeviceByMac(mac);
 }
Exemplo n.º 11
0
 public int checkType(DeviceView deviceView) {
   deviceView.setTypeid("1");
   return deviceMapper.checkType(deviceView);
 }
Exemplo n.º 12
0
 public int checkMac(DeviceView deviceView) {
   return deviceMapper.checkMac(deviceView);
 }