Пример #1
0
 @RequestMapping(value = "/selectCity", method = RequestMethod.GET)
 public String selectCity(Model model, String proId) {
   List<City> citys = new ArrayList<City>();
   for (Entry<Long, City> entry : com.juzhai.passport.InitData.CITY_MAP.entrySet()) {
     if (proId.equals(String.valueOf(entry.getValue().getProvinceId()))) {
       citys.add(entry.getValue());
     }
   }
   model.addAttribute("citys", citys);
   return "cms/ajax/citys_list";
 }
Пример #2
0
  private void assembleCiteys(Model model) {
    List<City> citys = new ArrayList<City>();
    List<Province> provinces = new ArrayList<Province>();
    for (Entry<Long, City> entry : com.juzhai.passport.InitData.CITY_MAP.entrySet()) {
      citys.add(entry.getValue());
    }
    for (Entry<Long, Province> entry : com.juzhai.passport.InitData.PROVINCE_MAP.entrySet()) {
      provinces.add(entry.getValue());
    }
    List<Category> categoryList = new ArrayList<Category>();
    Set<Long> keys = InitData.CATEGORY_MAP.keySet();
    for (Long key : keys) {
      categoryList.add(InitData.CATEGORY_MAP.get(key));
    }

    model.addAttribute("categoryList", categoryList);
    model.addAttribute("citys", citys);
    model.addAttribute("suitAges", SuitAge.values());
    model.addAttribute("suitGenders", SuitGender.values());
    model.addAttribute("suitStatus", SuitStatus.values());
    model.addAttribute("provinces", provinces);
  }
Пример #3
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";
  }