@RequestMapping("/shangpubao/shopsbaoGoodsList.do") public Object showShopsBaoGoods( ModelMap model, HttpServletRequest request, HttpServletResponse response) { super.setCookieUrl(request, response); try { String merchantId = request.getParameter("merchantId"); if (StringUtils.isEmpty(merchantId)) { request.setAttribute("ERRMSG", "没有找到相关品牌!"); return new ModelAndView("redirect:../500.html"); } // 现金券原价、现金券标志 // String sourcePrice = request.getParameter("sourcePrice"); String couponCash = request.getParameter("couponCash"); String filterInfo = null; if (StringUtils.isNotEmpty(couponCash) && "1".equals(couponCash)) { filterInfo = "bg.couponcash='1'"; } MerchantForm merchantForm = null; List<GoodsForm> listGoodsForm = null; Long mid = null; mid = Long.parseLong(merchantId); merchantForm = shopsBaoService.getMerchantDetailById(mid); if (merchantForm == null) { request.setAttribute("ERRMSG", "没有找到相关品牌!"); return new ModelAndView("redirect:../500.html"); } // 查询品牌下所有分店 List<MerchantForm> listIdsForm = merchantService.getChildMerchnatById(mid); // 分店在售商品数量 int goodCount = goodsService.getShopsBaoGoodsCount(listIdsForm, filterInfo); String currentPage = request.getParameter("cpage"); if (StringUtils.isEmpty(currentPage)) { currentPage = "1"; } // 分页 Pager pager = PagerHelper.getPager(Integer.parseInt(currentPage), goodCount, listPageSize); if (pager.getCurrentPage() > pager.getTotalPages()) { pager.setCurrentPage(1); pager.setStartRow(0); } request.setAttribute("pager", pager); // 当前页商品数据 List<Long> listIds = goodsService.getShopsBaoGoodsCountIds(listIdsForm, filterInfo, pager); listGoodsForm = goodsService.getGoodsFormByChildId(listIds); request.setAttribute("merchantForm", merchantForm); request.setAttribute("listGoodsForm", listGoodsForm); request.setAttribute("couponCash", couponCash); } catch (Exception e) { e.printStackTrace(); request.setAttribute("ERRMSG", "没有找到相关品牌!"); return new ModelAndView("redirect:../404.html"); } // return "/brand/shopsbaoGoodsList"; return "/brand/shopsbaoGoodsList"; }
/** 根据域名跳转到相应的商铺 */ @RequestMapping("/domain/redirectDomainShop.do") public String redirectDomainShop( ModelMap model, HttpServletRequest request, HttpServletResponse response) { String domainName = ""; Long merchantId = null; try { domainName = request.getParameter("domainName"); if (domainName == null || "".equals(domainName)) { return "redirect:../404.html"; } // 根据域名查找品牌ID merchantId = merchantService.getMerchantIdByDomainName(domainName); if (merchantId == null) { return "redirect:../404.html"; } } catch (Exception e) { e.printStackTrace(); } return "redirect:http://www.qianpin.com/shangpubao/" + merchantId + ".html"; }