@RequestMapping("/add_goods_favorite.htm")
 @Transactional
 public void add_goods_favorite(HttpServletResponse response, String id) {
   Map params = new HashMap();
   params.put("user_id", SecurityUserHolder.getCurrentUser().getId());
   params.put("goods_id", CommUtil.null2Long(id));
   List<Favorite> list =
       this.favoriteService.query(
           "select obj from Favorite obj where obj.user.id=:user_id and obj.goods.id=:goods_id",
           params,
           -1,
           -1);
   int ret = 0;
   if (list.size() == 0) {
     Goods goods = this.goodsService.getObjById(CommUtil.null2Long(id));
     Favorite obj = new Favorite();
     obj.setAddTime(new Date());
     obj.setType(0);
     obj.setUser(SecurityUserHolder.getCurrentUser());
     obj.setGoods(goods);
     this.favoriteService.save(obj);
     goods.setGoods_collect(goods.getGoods_collect() + 1);
     this.goodsService.update(goods);
     // 更新lucene索引
     elasticsearchUtil.indexUpdate(
         IndexName.GOODS,
         IndexType.GOODS,
         goods.getId().toString(),
         IndexVoTools.goodsToIndexVo(goods));
     //			String goods_lucene_path = ConfigContants.LUCENE_DIRECTORY
     //					+ File.separator
     //					+ "luence" + File.separator + "goods";
     //			File file = new File(goods_lucene_path);
     //			if (!file.exists()) {
     //				CommUtil.createFolder(goods_lucene_path);
     //			}
     //			LuceneUtil lucene = LuceneUtil.instance();
     //			lucene.setIndex_path(goods_lucene_path);
     //			lucene.update(CommUtil.null2String(goods.getId()),
     //					luceneVoTools.updateGoodsIndex(goods));
   } else {
     ret = 1;
   }
   response.setContentType("text/plain");
   response.setHeader("Cache-Control", "no-cache");
   response.setCharacterEncoding("UTF-8");
   PrintWriter writer;
   try {
     writer = response.getWriter();
     writer.print(ret);
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
 @SecurityMapping(title = "直通车商品加载", value = "/seller/ztc_goods.htm*", rtype = "seller", rname = "竞价直通车", rcode = "ztc_seller", rgroup = "促销管理")
 @RequestMapping({ "/seller/ztc_goods.htm" })
 public void ztc_goods(HttpServletRequest request, HttpServletResponse response, String goods_name) {
     Map params = new HashMap();
     params.put("goods_name", "%" + goods_name.trim() + "%");
     params.put("goods_status", Integer.valueOf(0));
     params.put("user_id", SecurityUserHolder.getCurrentUser().getId());
     params.put("ztc_status", Integer.valueOf(0));
     List<Goods> goods_list = this.goodsService
             .query("select obj from Goods obj where obj.goods_name like :goods_name and obj.goods_store.user.id=:user_id and obj.ztc_status=:ztc_status and obj.goods_status=:goods_status  order by obj.addTime desc",
                     params, -1, -1);
     List maps = new ArrayList();
     for (Goods goods : goods_list) {
         Map map = new HashMap();
         map.put("goods_name", goods.getGoods_name());
         map.put("goods_id", goods.getId());
         maps.add(map);
     }
     response.setContentType("text/plain");
     response.setHeader("Cache-Control", "no-cache");
     response.setCharacterEncoding("UTF-8");
     try {
         PrintWriter writer = response.getWriter();
         writer.print(Json.toJson(maps, JsonFormat.compact()));
     } catch (IOException e) {
         e.printStackTrace();
     }
 }
Exemplo n.º 3
0
 @SecurityMapping(title = "直通车申请列表", value = "/seller/ztc_apply_list.htm*", rtype = "seller", rname = "竞价直通车", rcode = "ztc_seller", rgroup = "促销管理")
 @RequestMapping({ "/seller/ztc_apply_list.htm" })
 public ModelAndView ztc_apply_list(HttpServletRequest request, HttpServletResponse response, String currentPage,
         String goods_name) {
     ModelAndView mv = new JModelAndView("user/default/usercenter/ztc_apply_list.html",
             this.configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response);
     if (!(this.configService.getSysConfig().isZtc_status())) {
         mv = new JModelAndView("error.html", this.configService.getSysConfig(),
                 this.userConfigService.getUserConfig(), 1, request, response);
         mv.addObject("op_title", "系统未开启直通车");
         mv.addObject("url", CommUtil.getURL(request) + "/seller/index.htm");
     } else {
         GoodsQueryObject qo = new GoodsQueryObject(currentPage, mv, "ztc_begin_time", "desc");
         qo.addQuery("obj.goods_store.user.id", new SysMap("user_id", SecurityUserHolder.getCurrentUser().getId()),
                 "=");
         qo.addQuery("obj.ztc_status", new SysMap("ztc_status", Integer.valueOf(1)), "=");
         if (!(CommUtil.null2String(goods_name).equals(""))) {
             qo.addQuery("obj.goods_name", new SysMap("goods_name", "%" + goods_name.trim() + "%"), "like");
         }
         IPageList pList = this.goodsService.list(qo);
         CommUtil.saveIPageList2ModelAndView("", "", "", pList, mv);
         mv.addObject("goods_name", goods_name);
     }
     return mv;
 }
 @RequestMapping("/add_store_favorite.htm")
 @Transactional
 public void add_store_favorite(HttpServletResponse response, String id) {
   Map params = new HashMap();
   params.put("user_id", SecurityUserHolder.getCurrentUser().getId());
   params.put("store_id", CommUtil.null2Long(id));
   List<Favorite> list =
       this.favoriteService.query(
           "select obj from Favorite obj where obj.user.id=:user_id and obj.store.id=:store_id",
           params,
           -1,
           -1);
   int ret = 0;
   if (list.size() == 0) {
     Favorite obj = new Favorite();
     obj.setAddTime(new Date());
     obj.setType(1);
     obj.setUser(SecurityUserHolder.getCurrentUser());
     obj.setStore(this.storeService.getObjById(CommUtil.null2Long(id)));
     this.favoriteService.save(obj);
     Store store = obj.getStore();
     store.setFavorite_count(store.getFavorite_count() + 1);
     this.storeService.update(store);
   } else {
     ret = 1;
   }
   response.setContentType("text/plain");
   response.setHeader("Cache-Control", "no-cache");
   response.setCharacterEncoding("UTF-8");
   PrintWriter writer;
   try {
     writer = response.getWriter();
     writer.print(ret);
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemplo n.º 5
0
 @SecurityMapping(title = "直通车申请", value = "/seller/ztc_apply.htm*", rtype = "seller", rname = "竞价直通车", rcode = "ztc_seller", rgroup = "促销管理")
 @RequestMapping({ "/seller/ztc_apply.htm" })
 public ModelAndView ztc_apply(HttpServletRequest request, HttpServletResponse response) {
     ModelAndView mv = new JModelAndView("user/default/usercenter/ztc_apply.html",
             this.configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response);
     if (!(this.configService.getSysConfig().isZtc_status())) {
         mv = new JModelAndView("error.html", this.configService.getSysConfig(),
                 this.userConfigService.getUserConfig(), 1, request, response);
         mv.addObject("op_title", "系统未开启直通车");
         mv.addObject("url", CommUtil.getURL(request) + "/seller/index.htm");
     }
     String ztc_session = CommUtil.randomString(32);
     mv.addObject("ztc_session", ztc_session);
     request.getSession(false).setAttribute("ztc_session", ztc_session);
     User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId());
     mv.addObject("user", user);
     return mv;
 }
Exemplo n.º 6
0
    @SecurityMapping(title = "直通车申请查看", value = "/seller/ztc_apply_view.htm*", rtype = "seller", rname = "竞价直通车", rcode = "ztc_seller", rgroup = "促销管理")
    @RequestMapping({ "/seller/ztc_apply_view.htm" })
    public ModelAndView ztc_apply_view(HttpServletRequest request, HttpServletResponse response, String id) {
        ModelAndView mv = new JModelAndView("user/default/usercenter/ztc_apply_view.html",
                this.configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response);
        if (!(this.configService.getSysConfig().isZtc_status())) {
            mv = new JModelAndView("error.html", this.configService.getSysConfig(),
                    this.userConfigService.getUserConfig(), 1, request, response);
            mv.addObject("op_title", "系统未开启直通车");
            mv.addObject("url", CommUtil.getURL(request) + "/seller/index.htm");
        } else {
            Goods obj = this.goodsService.getObjById(CommUtil.null2Long(id));

            if (obj.getGoods_store().getUser().getId().equals(SecurityUserHolder.getCurrentUser().getId())) {
                mv.addObject("obj", obj);
            } else {
                mv = new JModelAndView("error.html", this.configService.getSysConfig(),
                        this.userConfigService.getUserConfig(), 1, request, response);
                mv.addObject("op_title", "参数错误,不存在该直通车信息");
                mv.addObject("url", CommUtil.getURL(request) + "/seller/ztc_list.htm");
            }
        }
        return mv;
    }
Exemplo n.º 7
0
 /**
  * 其他应用登陆设置登陆状态 请修改此方法或都在子类复盖此方法来实现你的逻辑
  *
  * @param request
  * @param response
  * @param args
  */
 protected void iskyshop_update_pws(
     HttpServletRequest request, HttpServletResponse response, Map<String, String> args) {
   User user = SecurityUserHolder.getCurrentUser();
 }