Exemplo n.º 1
0
 @RequestMapping(value = "/showUpdate", method = RequestMethod.GET)
 public String showUpdate(Model model, Long actId) {
   if (actId == null) actId = 0l;
   Act act = actService.getActById(actId);
   assembleCiteys(model);
   model.addAttribute("act", act);
   model.addAttribute("logoWebPath", JzCoreFunction.actLogo(act.getId(), act.getLogo(), 0));
   model.addAttribute("age", SuitAge.getByIndex(act.getSuitAge()));
   model.addAttribute("gender", SuitGender.getByIndex(act.getSuitGender()));
   model.addAttribute("stauts", SuitStatus.getByIndex(act.getSuitStatus()));
   return "cms/updateAct";
 }
Exemplo n.º 2
0
  @RequestMapping(value = "/searchAct", method = RequestMethod.GET)
  public String searchAct(Model model, String bDate, String eDate, String name, Integer pageId) {
    List<Act> acts = null;
    if (pageId == null) pageId = 1;
    Date startDate = null;
    Date endDate = null;
    try {
      if (!StringUtils.isEmpty(bDate)) {
        startDate = DateUtils.parseDate(bDate, new String[] {"yyyy-MM-dd"});
      }
      if (!StringUtils.isEmpty(eDate)) {
        endDate = DateUtils.parseDate(eDate, new String[] {"yyyy-MM-dd"});
      }
    } catch (ParseException e) {
      log.error("parse search date error.", e);
    }
    PagerManager pager =
        new PagerManager(pageId, 10, actService.searchActsCount(startDate, endDate, name));
    acts =
        actService.searchActs(
            startDate, endDate, name, pager.getFirstResult(), pager.getMaxResult());

    List<CmsActMagerView> viewList = new ArrayList<CmsActMagerView>(acts.size());
    for (Act act : acts) {
      String age = SuitAge.getByIndex(act.getSuitAge()).getType();
      String status = SuitStatus.getByIndex(act.getSuitStatus()).getType();
      String gender = SuitGender.getByIndex(act.getSuitGender()).getType();
      City city = com.juzhai.passport.InitData.CITY_MAP.get(act.getCity());
      Province pro = com.juzhai.passport.InitData.PROVINCE_MAP.get(act.getProvince());
      String proName = "";
      String cityName = "";
      if (pro != null) {
        proName = pro.getName();
      }
      if (city != null) {
        cityName = city.getName();
      }
      String address = "";
      if (act.getAddress() != null) {
        address = act.getAddress();
      }
      String logoWebPath = "";
      if (act.getLogo() != null) {
        logoWebPath = JzCoreFunction.actLogo(act.getId(), act.getLogo(), 0);
      }
      StringBuffer categorys = new StringBuffer();
      String cats = act.getCategoryIds();
      if (cats != null) {
        for (String cat : cats.split(",")) {
          Category c = InitData.CATEGORY_MAP.get(Long.valueOf(cat));
          if (c != null) {
            categorys.append(c.getName() + " ");
          }
        }
      }
      viewList.add(
          new CmsActMagerView(
              act,
              logoWebPath,
              proName,
              cityName,
              address,
              age,
              gender,
              status,
              categorys.toString()));
    }
    model.addAttribute("cmsActMagerViews", viewList);
    model.addAttribute("pager", pager);
    model.addAttribute("acts", acts);
    model.addAttribute("eDate", eDate);
    model.addAttribute("bDate", bDate);
    model.addAttribute("name", name);
    return "cms/ajax/actManager_list";
  }