Пример #1
0
 /** 删除用户,如果尝试删除超级管理员将抛出异常. */
 public void deleteUser(String id) {
   if (isSupervisor(id)) {
     logger.warn("操作员{}尝试删除超级管理员用户", SpringSecurityUtils.getCurrentUserName());
     throw new ServiceException("不能删除超级管理员用户");
   }
   userDao.delete(id);
 }
Пример #2
0
 @Override
 public void onSaveOrUpdate(SaveOrUpdateEvent event) {
   Object object = event.getObject();
   if (object instanceof AuditSaveEntity || object instanceof AuditUpdateEntity) {
     Serializable id = ((AuditSaveEntity) object).getId();
     String loginName = SpringSecurityUtils.getCurrentUserName();
     if (id == null) {
       if (object instanceof AuditSaveEntity) {
         AuditSaveEntity auditObject = (AuditableEntity) object;
         auditObject.setCreateBy(loginName);
         auditObject.setCreateTime(new Date());
       }
     } else {
       if (object instanceof AuditUpdateEntity) {
         AuditUpdateEntity auditObject = (AuditableEntity) object;
         auditObject.setUpdateBy(loginName);
         auditObject.setUpdateTime(new Date());
       }
     }
   }
   super.onSaveOrUpdate(event);
 }
Пример #3
0
  private String showExtLoadTree(
      final HttpServletRequest pRequest, final HttpServletResponse pResponse) {
    Long parentID = 0L;

    user = SpringSecurityUtils.getCurrentUser();

    userInfo = userInfoManager.findUserByLoginName(user.getUsername());

    OrgInfo orginfo = userInfo.getOrgInfo();

    if (userInfo.getEmpNo() != 0L) {
      if (orginfo != null) {
        parentID = orginfo.getOrgId();
      }
    } else {

    }

    WebTreeDynamicNode rootNode =
        new WebTreeDynamicNode(
            orginfo.getOrgName(),
            SystemConst.TREE_ORG + "_" + parentID,
            new UserDataUncoder() {

              public Object getParentID(Object arg0) throws UncodeException {
                // TODO Auto-generated method stub
                return null;
              }

              public Object getID(Object arg0) throws UncodeException {
                // TODO Auto-generated method stub
                return ((OrgInfo) arg0).getOrgId();
              }
            });
    rootNode.setSubTreeURL(
        RequestUtil.getUrl(
            "/tree/"
                + parentID
                + "?"
                + PARENT_ID
                + "="
                + parentID
                + "&"
                + PARENT_TYPE
                + "="
                + SystemConst.TREE_ORG,
            pRequest));

    rootNode.setIcon(RequestUtil.getUrl(ROOT_IMG, pRequest));

    rootNode.setOpenIcon(RequestUtil.getUrl(ROOT_IMG, pRequest));

    DefaultTreeModel treeModel = new DefaultTreeModel();
    treeModel.addRootNode(rootNode);
    TreeDirector director = new DefaultTreeDirector();
    director.setComparator(new DefaultNodeComparator());
    ExtTreeBuilder treeBuilder = new ExtLoadTreeBuilder();
    treeBuilder.init(pRequest);
    director.build(treeModel, treeBuilder);
    String treeScript = treeBuilder.getTreeScript();
    return treeScript;
  }