Example #1
0
 @Transactional(readOnly = false)
 public void updatePower(SysRoleView sysrole) {
   sysrole.setCreateuser(ShiroDbRealm.getCurrentLoginName());
   for (SysFunctionView sysFunction : sysrole.getFunctions()) {
     sysFunction.setRole_function_id(IdUtils.uuid2());
   }
   SysRole sys = sysroleMapper.findOne(sysrole.getId());
   if (sys != null && !sys.getRoleName().equals(sysrole.getRoleName())) {
     sys.setRoleName(sysrole.getRoleName());
     sys.setModifyuser(ShiroDbRealm.getCurrentLoginName());
     sysroleMapper.update(sys);
   }
   sysroleMapper.deleteRoleFunction(sysrole);
   sysroleMapper.insertRoleFunction(sysrole);
 }
Example #2
0
 @Transactional(readOnly = false)
 public void saveSysRole(SysRole sysrole) {
   sysrole.setId(IdUtils.uuid2());
   sysrole.setCreateuser(ShiroDbRealm.getCurrentLoginName());
   sysrole.setDeleteflag(AppConstants.IS_STATUS_DEFAULT);
   sysroleMapper.insert(sysrole);
 }
Example #3
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);
 }
Example #4
0
  @Transactional(readOnly = false)
  public int deleteSysRole(SysRoleView sysrole) {
    // 判断是否有用户使用该角色
    int count = sysroleMapper.findUserCount(sysrole);
    if (count > 0) return -1; // 有用户使用该角色,代表不能删除该角色

    sysrole.setModifyuser(ShiroDbRealm.getCurrentLoginName());
    sysroleMapper.deleteRoleFunction(sysrole);
    sysroleMapper.delete(sysrole);
    return 1;
  }
Example #5
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);
 }
Example #6
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);
 }
Example #7
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);
 }
Example #8
0
 @Transactional(readOnly = false)
 public void updateSysRole(SysRole sysrole) {
   sysrole.setModifyuser(ShiroDbRealm.getCurrentLoginName());
   sysroleMapper.update(sysrole);
 }