/** * GoodsFloor列表页 * * @param currentPage * @param orderBy * @param orderType * @param request * @return */ @SecurityMapping( title = "楼层分类列表", value = "/admin/goods_floor_list.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_list.htm") public ModelAndView goods_floor_list( HttpServletRequest request, HttpServletResponse response, String currentPage, String orderBy, String orderType) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_list.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); String url = this.configService.getSysConfig().getAddress(); if (url == null || url.equals("")) { url = CommUtil.getURL(request); } String params = ""; GoodsFloorQueryObject qo = new GoodsFloorQueryObject(currentPage, mv, "gf_sequence", "asc"); qo.addQuery("obj.gf_level", new SysMap("gf_level", 0), "="); IPageList pList = this.goodsfloorService.list(qo); CommUtil.saveIPageList2ModelAndView(url + "/admin/goods_floor_list.htm", "", params, pList, mv); return mv; }
@SecurityMapping( title = "楼层模板品牌编辑", value = "/admin/goods_floor_brand.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_brand.htm") public ModelAndView goods_floor_brand( HttpServletRequest request, HttpServletResponse response, String id) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_brand.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); GoodsBrandQueryObject qo = new GoodsBrandQueryObject("1", mv, "sequence", "asc"); qo.addQuery("obj.audit", new SysMap("audit", 1), "="); IPageList pList = this.goodsBrandService.list(qo); CommUtil.saveIPageList2ModelAndView( CommUtil.getURL(request) + "/admin/goods_floor_brand_load.htm", "", "", pList, mv); mv.addObject("obj", obj); mv.addObject("gf_tools", this.gf_tools); return mv; }
@SecurityMapping( title = "楼层模板品牌加载", value = "/admin/goods_floor_brand_load.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_brand_load.htm") public ModelAndView goods_floor_brand_load( HttpServletRequest request, HttpServletResponse response, String currentPage, String name) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_brand_load.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsBrandQueryObject qo = new GoodsBrandQueryObject(currentPage, mv, "sequence", "asc"); qo.addQuery("obj.audit", new SysMap("audit", 1), "="); if (!CommUtil.null2String(name).equals("")) { qo.addQuery("obj.name", new SysMap("name", "%" + name.trim() + "%"), "like"); } IPageList pList = this.goodsBrandService.list(qo); CommUtil.saveIPageList2ModelAndView( CommUtil.getURL(request) + "/admin/goods_floor_brand_load.htm", "", "&name=" + CommUtil.null2String(name), pList, mv); return mv; }
@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; }
@SecurityMapping( title = "楼层模板编辑", value = "/admin/goods_floor_template.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_template.htm") public ModelAndView goods_floor_template( HttpServletRequest request, HttpServletResponse response, String currentPage, String id, String tab) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_template.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); mv.addObject("obj", obj); mv.addObject("gf_tools", this.gf_tools); mv.addObject("currentPage", currentPage); mv.addObject("tab", tab); mv.addObject("url", CommUtil.getURL(request)); return mv; }
public int query_bargain_audit(Object bargain_time) { Map params = new HashMap(); params.put("bg_time", CommUtil.formatDate(CommUtil.null2String(bargain_time), "yyyy-MM-dd")); params.put("bg_status", Integer.valueOf(1)); List bargainGoods = this.bargainGoodsService.query( "select obj from BargainGoods obj where obj.bg_time =:bg_time and obj.bg_status=:bg_status", params, -1, -1); return bargainGoods.size(); }
@SecurityMapping(title = "直通车申请保存", value = "/seller/ztc_apply_save.htm*", rtype = "seller", rname = "竞价直通车", rcode = "ztc_seller", rgroup = "促销管理") @RequestMapping({ "/seller/ztc_apply_save.htm" }) public ModelAndView ztc_apply_save(HttpServletRequest request, HttpServletResponse response, String goods_id, String ztc_price, String ztc_begin_time, String ztc_gold, String ztc_session) { ModelAndView mv = new JModelAndView("user/default/usercenter/success.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 { String ztc_session1 = CommUtil.null2String(request.getSession(false).getAttribute("ztc_session")); if ((!(ztc_session1.equals(""))) && (ztc_session1.equals(CommUtil.null2String(ztc_session)))) { request.getSession(false).removeAttribute("ztc_session"); Goods goods = this.goodsService.getObjById(CommUtil.null2Long(goods_id)); goods.setZtc_status(1); goods.setZtc_pay_status(1); goods.setZtc_begin_time(CommUtil.formatDate(ztc_begin_time)); goods.setZtc_gold(CommUtil.null2Int(ztc_gold)); goods.setZtc_price(CommUtil.null2Int(ztc_price)); goods.setZtc_apply_time(new Date()); this.goodsService.update(goods); mv.addObject("op_title", "直通车申请成功,等待审核"); mv.addObject("url", CommUtil.getURL(request) + "/seller/ztc_list.htm"); } 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_apply.htm"); } } return mv; }
@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(); } }
public int query_bargain_maximum(Object bargain_time) { Map params = new HashMap(); params.put("bt", CommUtil.formatDate(CommUtil.null2String(bargain_time), "yyyy-MM-dd")); List bargain = this.bargainServicve.query("select obj from Bargain obj where obj.bargain_time =:bt", params, 0, 1); int bd = 0; if (bargain.size() > 0) bd = ((Bargain) bargain.get(0)).getMaximum(); else { bd = this.configService.getSysConfig().getBargain_maximum(); } return bd; }
@SecurityMapping( title = "楼层模板右下方广告编辑", value = "/admin/goods_floor_right_adv.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_right_adv.htm") public ModelAndView goods_floor_right_adv( HttpServletRequest request, HttpServletResponse response, String id) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_right_adv.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); Map params = new HashMap(); params.put("ap_status", 1); params.put("ap_width", 205); params.put("ap_type", "img"); List<AdvertPosition> aps = this.advertPositionService.query( "select obj from AdvertPosition obj where obj.ap_status=:ap_status and obj.ap_width=:ap_width and obj.ap_type=:ap_type order by obj.addTime desc", params, -1, -1); mv.addObject("aps", aps); mv.addObject("obj", obj); mv.addObject("gf_tools", this.gf_tools); return mv; }
@SecurityMapping( title = "楼层模板右侧商品列表编辑", value = "/admin/goods_floor_list_goods.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_list_goods.htm") public ModelAndView goods_floor_list_goods( HttpServletRequest request, HttpServletResponse response, String currentPage, String id) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_list_goods.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); List<GoodsClass> gcs = this.goodsClassService.query( "select obj from GoodsClass obj where obj.parent.id is null order by obj.sequence asc", null, -1, -1); mv.addObject("gcs", gcs); mv.addObject("obj", obj); mv.addObject("gf_tools", this.gf_tools); mv.addObject("currentPage", currentPage); return mv; }
@SecurityMapping( title = "楼层模板右侧商品列表保存", value = "/admin/goods_floor_list_goods_save.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_list_goods_save.htm") public String goods_floor_list_goods_save( HttpServletRequest request, HttpServletResponse response, String list_title, String id, String ids) { GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); String[] id_list = ids.split(","); Map map = new HashMap(); map.put("list_title", list_title); for (int i = 0; i < id_list.length; i++) { if (!id_list[i].equals("")) { map.put("goods_id" + i, id_list[i]); } } // System.out.println(Json.toJson(map, JsonFormat.compact())); obj.setGf_list_goods(Json.toJson(map, JsonFormat.compact())); this.goodsfloorService.update(obj); return "redirect:goods_floor_template.htm?id=" + obj.getId(); }
/** * goodsfloor添加管理 * * @param request * @return * @throws ParseException */ @SecurityMapping( title = "楼层分类添加", value = "/admin/goods_floor_add.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_add.htm") public ModelAndView goods_floor_add( HttpServletRequest request, HttpServletResponse response, String currentPage, String pid) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_add.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("currentPage", currentPage); Map params = new HashMap(); params.put("gf_level", 0); List<GoodsFloor> gfs = this.goodsfloorService.query( "select obj from GoodsFloor obj where obj.gf_level=:gf_level", params, -1, -1); mv.addObject("gfs", gfs); GoodsFloor obj = new GoodsFloor(); GoodsFloor parent = this.goodsfloorService.getObjById(CommUtil.null2Long(pid)); obj.setParent(parent); if (parent != null) obj.setGf_level(parent.getGf_level() + 1); obj.setGf_display(true); mv.addObject("obj", obj); return mv; }
@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; }
/** * 其他应用登陆设置登陆状态 请修改此方法或都在子类复盖此方法来实现你的逻辑 * * @param request * @param response * @param get * @throws MalformedURLException */ protected void iskyshop_logout( HttpServletRequest request, HttpServletResponse response, Map<String, String> args) { String url = CommUtil.getURL(request) + "/iskyshop_logout.htm"; try { response.sendRedirect(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@SecurityMapping( title = "楼层模板分类商品编辑", value = "/admin/goods_floor_list_goods_load.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_list_goods_load.htm") public ModelAndView goods_floor_list_goods_load( HttpServletRequest request, HttpServletResponse response, String currentPage, String gc_id, String goods_name) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_list_goods_load.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsQueryObject qo = new GoodsQueryObject(currentPage, mv, "addTime", "desc"); if (!CommUtil.null2String(gc_id).equals("")) { Set<Long> ids = this.genericIds(this.goodsClassService.getObjById(CommUtil.null2Long(gc_id))); Map paras = new HashMap(); paras.put("ids", ids); qo.addQuery("obj.gc.id in (:ids)", paras); } if (!CommUtil.null2String(goods_name).equals("")) { qo.addQuery("obj.goods_name", new SysMap("goods_name", "%" + goods_name + "%"), "like"); } qo.addQuery("obj.goods_status", new SysMap("goods_status", 0), "="); IPageList pList = this.goodsService.list(qo); CommUtil.saveIPageList2ModelAndView( CommUtil.getURL(request) + "/admin/goods_floor_list_goods_load.htm", "", "&gc_id=" + gc_id + "&goods_name=" + goods_name, pList, mv); 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(); } }
@SecurityMapping( title = "楼层分类Ajax更新", value = "/admin/goods_floor_ajax.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_ajax.htm") public void goods_floor_ajax( HttpServletRequest request, HttpServletResponse response, String id, String fieldName, String value) throws ClassNotFoundException { GoodsFloor obj = this.goodsfloorService.getObjById(Long.parseLong(id)); Field[] fields = GoodsFloor.class.getDeclaredFields(); BeanWrapper wrapper = new BeanWrapper(obj); Object val = null; for (Field field : fields) { // System.out.println(field.getName()); if (field.getName().equals(fieldName)) { Class clz = Class.forName("java.lang.String"); if (field.getType().getName().equals("int")) { clz = Class.forName("java.lang.Integer"); } if (field.getType().getName().equals("boolean")) { clz = Class.forName("java.lang.Boolean"); } if (!value.equals("")) { val = BeanUtils.convertType(value, clz); } else { val = !CommUtil.null2Boolean(wrapper.getPropertyValue(fieldName)); } wrapper.setPropertyValue(fieldName, val); } } this.goodsfloorService.update(obj); response.setContentType("text/plain"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); PrintWriter writer; try { writer = response.getWriter(); writer.print(val.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@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; }
@SecurityMapping( title = "楼层模板商品分类加载", value = "/admin/goods_floor_class_load.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_class_load.htm") public ModelAndView goods_floor_class_load( HttpServletRequest request, HttpServletResponse response, String currentPage, String gc_id) { ModelAndView mv = new JModelAndView( "admin/blue/goods_floor_class_load.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsClass gc = this.goodsClassService.getObjById(CommUtil.null2Long(gc_id)); mv.addObject("gc", gc); return mv; }
@SecurityMapping( title = "楼层模板商品分类保存", value = "/admin/goods_floor_class_save.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_class_save.htm") public String goods_floor_class_save( HttpServletRequest request, HttpServletResponse response, String id, String ids, String gf_name) { GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); obj.setGf_name(gf_name); List gf_gc_list = new ArrayList(); String[] id_list = ids.split(",pid:"); for (String t_id : id_list) { String[] c_id_list = t_id.split(","); Map map = new HashMap(); for (int i = 0; i < c_id_list.length; i++) { String c_id = c_id_list[i]; if (c_id.indexOf("cid") < 0) { map.put("pid", c_id); } else { map.put("gc_id" + i, c_id.substring(4)); } } map.put("gc_count", c_id_list.length - 1); if (!map.get("pid").toString().equals("")) gf_gc_list.add(map); } // System.out.println(Json.toJson(gf_gc_list, JsonFormat.compact())); obj.setGf_gc_list(Json.toJson(gf_gc_list, JsonFormat.compact())); this.goodsfloorService.update(obj); return "redirect:goods_floor_template.htm?id=" + id; }
/** * 其他应用登陆设置登陆状态 请修改此方法或都在子类复盖此方法来实现你的逻辑 * * @param request * @param response * @param get */ protected void iskyshop_login( HttpServletRequest request, HttpServletResponse response, Map<String, String> args) { boolean admin_login = CommUtil.null2Boolean( request.getSession(false).getAttribute("admin_login")); // 判断是否管理员登录,管理员登录不需要进行重复登录处理 if (!admin_login) { String userName = args.get("username"); String password = ""; User user = this.userService.getObjByProperty("userName", userName); if (user != null) { password = user.getPassword(); } else { user = new User(); user.setUserName(userName); user.setUserRole("BUYER"); user.setAddTime(new Date()); // user.setEmail(email); user.setPassword(Md5Encrypt.md5(password).toLowerCase()); Map params = new HashMap(); params.put("type", "BUYER"); List<Role> roles = this.roleService.query("select obj from Role obj where obj.type=:type", params, -1, -1); user.getRoles().addAll(roles); if (this.configService.getSysConfig().isIntegral()) { user.setIntegral(this.configService.getSysConfig().getMemberRegister()); this.userService.save(user); IntegralLog log = new IntegralLog(); log.setAddTime(new Date()); log.setContent("用户注册增加" + this.configService.getSysConfig().getMemberRegister() + "分"); log.setIntegral(this.configService.getSysConfig().getMemberRegister()); log.setIntegral_user(user); log.setType("reg"); this.integralLogService.save(log); } else { this.userService.save(user); } // 创建用户默认相册 Album album = new Album(); album.setAddTime(new Date()); album.setAlbum_default(true); album.setAlbum_name("默认相册"); album.setAlbum_sequence(-10000); album.setUser(user); this.albumService.save(album); } String url = CommUtil.getURL(request) + "/iskyshop_login.htm?username="******"&password="******"&encode=true"; try { response.sendRedirect(url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@SecurityMapping( title = "楼层模板右下方广告保存", value = "/admin/goods_floor_right_adv_save.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_right_adv_save.htm") public String goods_floor_right_adv_save( HttpServletRequest request, HttpServletResponse response, String type, String id, String adv_url, String adv_id) { GoodsFloor obj = this.goodsfloorService.getObjById(CommUtil.null2Long(id)); Map map = new HashMap(); if (type.equals("user")) { // 模板广告图片 String uploadFilePath = ConfigContants.UPLOAD_IMAGE_MIDDLE_NAME; String saveFilePathName = TytsmsStringUtils.generatorImagesFolderServerPath(request) + uploadFilePath + File.separator + "advert"; Map json_map = new HashMap(); try { map = CommUtil.saveFileToServer(configService, request, "img", saveFilePathName, "", null); if (map.get("fileName") != "") { Accessory acc = new Accessory(); acc.setName(CommUtil.null2String(map.get("fileName"))); acc.setExt(CommUtil.null2String(map.get("mime"))); acc.setSize(BigDecimal.valueOf(CommUtil.null2Double(map.get("fileSize")))); acc.setPath(uploadFilePath + "/advert"); acc.setWidth(CommUtil.null2Int(map.get("width"))); acc.setHeight(CommUtil.null2Int(map.get("height"))); acc.setAddTime(new Date()); this.accessoryService.save(acc); json_map.put("acc_id", acc.getId()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } json_map.put("acc_url", adv_url); json_map.put("adv_id", ""); System.out.println(Json.toJson(json_map, JsonFormat.compact())); obj.setGf_right_adv(Json.toJson(json_map, JsonFormat.compact())); } if (type.equals("adv")) { Map json_map = new HashMap(); json_map.put("acc_id", ""); json_map.put("acc_url", ""); json_map.put("adv_id", adv_id); System.out.println(Json.toJson(json_map, JsonFormat.compact())); obj.setGf_right_adv(Json.toJson(json_map, JsonFormat.compact())); } this.goodsfloorService.update(obj); return "redirect:goods_floor_template.htm?id=" + obj.getId(); }
/** * goodsfloor保存管理 * * @param id * @return */ @SecurityMapping( title = "楼层分类保存", value = "/admin/goods_floor_save.htm*", rtype = "admin", rname = "首页楼层", rcode = "goods_floor", rgroup = "商品") @RequestMapping("/admin/goods_floor_save.htm") public ModelAndView goods_floor_save( HttpServletRequest request, HttpServletResponse response, String id, String currentPage, String pid, String list_url, String add_url) { WebForm wf = new WebForm(); GoodsFloor goodsfloor = null; if (id.equals("")) { goodsfloor = wf.toPo(request, GoodsFloor.class); goodsfloor.setAddTime(new Date()); } else { GoodsFloor obj = this.goodsfloorService.getObjById(Long.parseLong(id)); goodsfloor = (GoodsFloor) wf.toPo(request, obj); } GoodsFloor parent = this.goodsfloorService.getObjById(CommUtil.null2Long(pid)); if (parent != null) { goodsfloor.setParent(parent); goodsfloor.setGf_level(parent.getGf_level() + 1); } String uploadFilePath = ConfigContants.UPLOAD_IMAGE_MIDDLE_NAME; String saveFilePathName = TytsmsStringUtils.generatorImagesFolderServerPath(request) + uploadFilePath + File.separator + "floor"; Map map = new HashMap(); try { String fileName = goodsfloor.getIcon() == null ? "" : goodsfloor.getIcon().getName(); map = CommUtil.saveFileToServer( configService, request, "icon_logo", saveFilePathName, fileName, null); if (fileName.equals("")) { if (map.get("fileName") != "" && map.get("fileName") != null) { Accessory icon = new Accessory(); icon.setName(CommUtil.null2String(map.get("fileName"))); icon.setExt((String) map.get("mime")); icon.setSize(BigDecimal.valueOf((CommUtil.null2Double(map.get("fileSize"))))); icon.setPath(uploadFilePath + "/floor"); icon.setWidth((Integer) map.get("width")); icon.setHeight((Integer) map.get("height")); icon.setAddTime(new Date()); this.accessoryService.save(icon); goodsfloor.setIcon(icon); } } else { if (map.get("fileName") != "" && map.get("fileName") != null) { Accessory icon = goodsfloor.getIcon(); icon.setName(CommUtil.null2String(map.get("fileName"))); icon.setExt(CommUtil.null2String(map.get("mime"))); icon.setSize(BigDecimal.valueOf((CommUtil.null2Double(map.get("fileSize"))))); icon.setPath(uploadFilePath + "/floor"); icon.setWidth(CommUtil.null2Int(map.get("width"))); icon.setHeight(CommUtil.null2Int(map.get("height"))); this.accessoryService.update(icon); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (id.equals("")) { this.goodsfloorService.save(goodsfloor); } else this.goodsfloorService.update(goodsfloor); ModelAndView mv = new JModelAndView( "admin/blue/success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("list_url", list_url); mv.addObject("op_title", "保存首页楼层成功"); if (add_url != null) { mv.addObject("add_url", add_url + "?currentPage=" + currentPage); } return mv; }