/**
  * 检查合作渠道单位名称是否重复
  *
  * @return
  */
 public String checkRepeat() {
   try {
     boolean existArea = manager.existArea(newId, parentAreaId, areaName);
     Struts2Utils.renderText(String.valueOf(!existArea));
   } catch (ServiceException e) {
     Struts2Utils.renderText("false");
   } catch (Exception e) {
     logger.error("检查地区信息是否重复:", e);
   }
   return null;
 }
 /**
  * 重载地区信息
  *
  * @return
  */
 public String reload() {
   try {
     service.reload();
     logger.info("重载地区信息成功!");
     Struts2Utils.renderText(SUCCESS);
   } catch (Exception e) {
     logger.error("重载地区信息出错!", e);
     Struts2Utils.renderText("重载失败!");
   }
   return null;
 }
Пример #3
0
 @Override
 protected void prepareModel() throws Exception {
   if (id != null) {
     entity = userManager.get(id);
   } else {
     entity = userManager.get((Long) Struts2Utils.getSession().getAttribute("userid"));
   }
 }
 @Override
 public String delete() {
   try {
     manager.deleteAreaInfo(id);
     Struts2Utils.renderText(SUCCESS);
   } catch (Exception e) {
     logger.error("删除单个地区信息", e);
   }
   return null;
 }
Пример #5
0
  public String savePass() throws Exception {
    try {
      String oldpass = Struts2Utils.getParameter("oldpass");
      String password = Struts2Utils.getParameter("password");
      entity = userManager.get(id);
      if (!entity.getPassword().equals(oldpass)) {
        this.addActionMessage(Global.CURRENT_PASSWORD);
      } else {
        entity.setPassword(password);
        userManager.save(entity);
        this.addActionMessage(Global.MODIFY_SUCCESS);
      }

    } catch (Exception e) {
      this.addActionMessage(Global.MODIFY_LOSE);
      e.printStackTrace();
    }
    return "view";
  }
  @Override
  public String list() {
    try {
      List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(Struts2Utils.getRequest());
      PropertyFilterUtils.handleFilter(page, AreaInfo.class, filters);

      page = manager.searchProperty(page, filters);
    } catch (Exception e) {
      logger.error("获取地区信息列表: ", e);
    }
    return JSON;
  }
Пример #7
0
  public static Page RiaToPage(Page page) {

    // 获取dwz排序
    String orderField = Struts2Utils.getRequest().getParameter("orderField");
    String orderDirection = Struts2Utils.getRequest().getParameter("orderDirection");
    if ((orderField != null) && (orderDirection != null)) {
      page.setOrderBy(orderField);
      page.setOrder(orderDirection);
      // System.out.println("数年:"+ orderField + ":" + orderDirection);
    }

    // 分页数
    String numPerPage = Struts2Utils.getRequest().getParameter("numPerPage");
    if (numPerPage != null) {
      page.setPageSize(Integer.valueOf(numPerPage));
    }

    // 第几页
    String pageNum = Struts2Utils.getRequest().getParameter("pageNum");
    if (pageNum != null) {
      page.setPageNo(Integer.valueOf(pageNum));
    }
    return page;
  }
 // -- CRUD Action 函数 --//
 @Override
 public String save() {
   try {
     if (EntityUtils.isNew(entity.getId())) {
       entity.setCountryCode("0086");
       entity.setEnabled(true);
       String areaLevelZhName = "";
       if (entity.getAreaLevel() == 1) {
         areaLevelZhName = "省级";
       } else if (entity.getAreaLevel() == 2) {
         areaLevelZhName = "市级";
       } else if (entity.getAreaLevel() == 3) {
         areaLevelZhName = "区县级";
       }
       entity.setRemark(areaLevelZhName);
     }
     manager.saveAreaInfo(entity);
     Struts2Utils.renderText(SUCCESS);
   } catch (Exception e) {
     logger.error("保存单个地区信息", e);
   }
   return null;
 }
Пример #9
0
 @Override
 public String execute() throws Exception {
   HttpServletRequest request = Struts2Utils.getRequest();
   entity = userManager.get((Long) request.getSession().getAttribute("userid"));
   return SUCCESS;
 }