예제 #1
0
 public void isLockFlag(UserVO userVO) {
   /*
    * PAN-Z-G
    * 当active_flag为锁定状态时(0),将锁定标识修改为1为锁定
    * */
   if (userVO != null && userVO.getActiveFlag() == 0) {
     userVO.setLockFlag(1);
   } else if (userVO != null && userVO.getActiveFlag() == 1) {
     userVO.setLockFlag(0);
   }
 }
예제 #2
0
  /**
   * 查询用户信息<未完成的,分页列表>
   *
   * @return
   * @throws Exception
   */
  @Action(
      value = "query",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String query() {
    try {
      PageUtil pageUtil = new PageUtil();
      pageUtil.setStart(page);
      pageUtil.setPageSize(rows);
      pageUtil.setMerchantPin(users.getMerchantPin());
      if (portalUser != null) {
        pageUtil.setAccount(portalUser.getAccount());
        pageUtil.setMobile(portalUser.getMobile());
        pageUtil.setEmail(portalUser.getEmail());
        // Integer activeFlag =
        //		portalUser.getActiveFlag()== -99 ? null : portalUser.getActiveFlag();
        pageUtil.setActiveFlag(portalUser.getActiveFlag());
        String roleId = request.getParameter("roleId");
        if (roleId != null && !"-99".equals(roleId)) pageUtil.setRoleId(Long.parseLong(roleId));
      }
      logger.info("role query portalUser:"******"role query pageUtil:" + pageUtil);

      // REX@20130112  判断登陆用户类型
      if (users.getUserType() == ApSmsConstants.USER_TYPE_SUPER_ADMIN) {
        // 在省、地市 管理员的时候,不需要pin码
        pageUtil.setMerchantPin(null);
        String[] provArray = null;
        List<Region> regionList = regionService.findProvinces();
        if (regionList != null) {
          provArray = new String[regionList.size()];
          for (int i = 0; i < regionList.size(); i++) {
            provArray[i] = String.valueOf(regionList.get(i).getId());
          }
        }
        // 增加全省列表
        pageUtil.setAreaRange(provArray);
        // 设置用户类型为省管理员
        pageUtil.setUserType(users.getUserType());
      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_PROVINCE_ADMIN) {
        // 在省、地市 管理员的时候,不需要pin码
        pageUtil.setMerchantPin(null);
        Long provinceId = 0L;
        provinceId = Long.parseLong(users.getProvince());
        String[] cityArray = null;
        List<Region> regionList = regionService.findCityByProvinceId(provinceId);
        if (regionList != null) {
          cityArray = new String[regionList.size()];
          for (int i = 0; i < regionList.size(); i++) {
            cityArray[i] = String.valueOf(regionList.get(i).getId());
          }
        }
        // 增加地区列表
        pageUtil.setAreaRange(cityArray);
        // 设置用户类型为地市管理员
        pageUtil.setUserType(users.getUserType());
      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        pageUtil.setMerchantPin(null);
        // 增加地区列表
        pageUtil.setAreaRange(new String[] {users.getCity()});
        // 设置用户类型为企业管理员
        pageUtil.setUserType(users.getUserType());

      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_ENTERPRISE_ADMIN) {
        // 设置用户类型为企业管理员

        pageUtil.setUserType(users.getUserType());

      } else {
        pageUtil.setUserType(users.getUserType());
      }
      Page page = userService.page(pageUtil);
      if (page != null) {
        @SuppressWarnings("unchecked")
        List<UserVO> datas = (List<UserVO>) page.getData();
        entityMap = new HashMap<String, Object>();
        entityMap.put("total", page.getRecords());
        if (datas == null) {
          datas = new ArrayList<UserVO>();
        }
        entityMap.put("rows", datas);
        entityMap.put("totalrecords", page.getTotal());
        entityMap.put("currpage", page.getStart());
      }
      logger.info("query user page: " + entityMap);
    } catch (Exception e) {
      e.printStackTrace();
      return ERROR;
    }
    return SUCCESS;
  }