@SecurityMapping( title = "图片水印", value = "/seller/watermark.htm*", rtype = "seller", rname = "图片管理", rcode = "album_seller", rgroup = "其他设置") @RequestMapping("/seller/watermark.htm") public ModelAndView watermark(HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new JModelAndView( "user/default/usercenter/watermark.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); Store store = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId()).getStore(); if (store != null) { Map params = new HashMap(); params.put("store_id", store.getId()); List<WaterMark> wms = this.watermarkService.query( "select obj from WaterMark obj where obj.store.id=:store_id", params, -1, -1); if (wms.size() > 0) { mv.addObject("obj", wms.get(0)); } } return mv; }
@SecurityMapping( title = "支付方式编辑", value = "/seller/payment_edit.htm*", rtype = "seller", rname = "支付方式", rcode = "payment_seller", rgroup = "交易管理") @RequestMapping("/seller/payment_edit.htm") public ModelAndView payment_edit( HttpServletRequest request, HttpServletResponse response, String mark) { ModelAndView mv = mv = new JModelAndView( "user/default/usercenter/payment/" + mark + ".html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); Map params = new HashMap(); User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId()); params.put("mark", mark); params.put("store_id", user.getStore().getId()); List<Payment> objs = this.paymentService.query( "select obj from Payment obj where obj.mark=:mark and obj.store.id=:store_id", params, -1, -1); if (objs.size() > 0) mv.addObject("obj", objs.get(0)); mv.addObject("bankBeanList", ConstantUtils._getBankIDList()); return mv; }
@SecurityMapping( title = "支付方式卸载", value = "/seller/payment_uninstall.htm*", rtype = "seller", rname = "支付方式", rcode = "payment_seller", rgroup = "交易管理") @RequestMapping("/seller/payment_uninstall.htm") public ModelAndView payment_uninstall( HttpServletRequest request, HttpServletResponse response, String mark) { ModelAndView mv = mv = new JModelAndView( "user/default/usercenter/success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); Map params = new HashMap(); User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId()); params.put("mark", mark); params.put("store_id", user.getStore().getId()); List<Payment> objs = this.paymentService.query( "select obj from Payment obj where obj.mark=:mark and obj.store.id=:store_id", params, -1, -1); if (objs.size() > 0) { for (OrderForm of : objs.get(0).getOfs()) { of.setPayment(null); this.orderFormService.update(of); } this.paymentService.delete(objs.get(0).getId()); } mv.addObject("op_title", "支付方式卸载成功"); mv.addObject("url", CommUtil.getURL(request) + "/seller/payment.htm"); return mv; }
@SecurityMapping( title = "支付方式保存", value = "/seller/payment_save.htm*", rtype = "seller", rname = "支付方式", rcode = "payment_seller", rgroup = "交易管理") @RequestMapping("/seller/payment_save.htm") public ModelAndView payment_save( HttpServletRequest request, HttpServletResponse response, String id) { ModelAndView mv = new JModelAndView( "user/default/usercenter/success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); WebForm wf = new WebForm(); if (!id.equals("")) { Payment obj = this.paymentService.getObjById(CommUtil.null2Long(id)); Payment payment = (Payment) wf.toPo(request, obj); String province = request.getParameter("province").split("_")[1]; payment.setProvince(province); this.paymentService.update(payment); } else { Payment payment = wf.toPo(request, Payment.class); payment.setAddTime(new Date()); payment.setType("user"); User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId()); payment.setStore(user.getStore()); String province = request.getParameter("province").split("_")[1]; payment.setProvince(province); this.paymentService.save(payment); } mv.addObject("op_title", "支付方式保存成功"); mv.addObject("url", CommUtil.getURL(request) + "/seller/payment.htm"); return mv; }
/** * watermark保存管理 * * @param id * @return */ @SecurityMapping( title = "图片水印保存", value = "/seller/watermark_save.htm*", rtype = "seller", rname = "图片管理", rcode = "album_seller", rgroup = "其他设置") @RequestMapping("/seller/watermark_save.htm") public ModelAndView watermark_save( HttpServletRequest request, HttpServletResponse response, String id, String currentPage, String cmd) { ModelAndView mv = null; if (SecurityUserHolder.getCurrentUser().getStore() != null) { WebForm wf = new WebForm(); WaterMark watermark = null; if (id.equals("")) { watermark = wf.toPo(request, WaterMark.class); watermark.setAddTime(new Date()); } else { WaterMark obj = this.watermarkService.getObjById(Long.parseLong(id)); watermark = (WaterMark) wf.toPo(request, obj); } watermark.setStore(SecurityUserHolder.getCurrentUser().getStore()); String path = request.getSession().getServletContext().getRealPath("/") + "upload/wm"; try { Map map = CommUtil.saveFileToServer(request, "wm_img", path, null, null); if (!map.get("fileName").equals("")) { Accessory wm_image = new Accessory(); wm_image.setAddTime(new Date()); wm_image.setHeight(CommUtil.null2Int(map.get("height"))); wm_image.setName(CommUtil.null2String(map.get("fileName"))); wm_image.setPath("upload/wm"); wm_image.setSize(CommUtil.null2Float(map.get("fileSize"))); wm_image.setUser(SecurityUserHolder.getCurrentUser()); wm_image.setWidth(CommUtil.null2Int("width")); this.accessoryService.save(wm_image); watermark.setWm_image(wm_image); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (id.equals("")) { this.watermarkService.save(watermark); } else this.watermarkService.update(watermark); mv = new JModelAndView( "success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 1, request, response); mv.addObject("op_title", "水印设置成功"); } else { mv = new JModelAndView( "error.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 1, request, response); mv.addObject("op_title", "您尚未开店"); } mv.addObject("url", CommUtil.getURL(request) + "/seller/watermark.htm"); return mv; }