基于javaweb+mysql的ssm旅游景点门票管理系统(java+ssm+jsp+mysql)

基于javaweb+mysql的ssm旅游景点门票管理系统(java+ssm+jsp+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM旅游景点门票管理系统(java+ssm+jsp+mysql)

jsp+ssm(spring+springMVC+mybatis)+MySQL实现的在线旅游景点信息管理系统,系统主要实现的功能有:用户浏览搜索景点游玩路线、用户注册登录、下单预定旅游产品等。后台管理员可对旅游产品进行管理、包括旅游的主题、产品、用户、定制、订单等。

       EntityWrapper entityWrapper=new EntityWrapper();
       if (map.get("activeDays")!=null){
           String activeDays= (String) map.get("activeDays");
           int day;
           if (activeDays.equals("1-2天")){
               entityWrapper.le("active_days",2);
           }else if (activeDays.equals("3-5天")){
               entityWrapper.between("active_days",3,5);
           }else{
               entityWrapper.gt("active_days",5);
           }

       }
       if (map.get("type")!=null){
           String type= (String) map.get("type");

           List<ThemeProduct> tplist=themeProductService.selectList(new EntityWrapper<ThemeProduct>().eq("theme_name",type));
           List idlist=new ArrayList();
           for (ThemeProduct themeProduct:tplist){
               idlist.add(themeProduct.getProductId());
           }
           entityWrapper.in("pid",idlist);
       }
       entityWrapper.eq("status",1);
       String limt="limit "+size;
        entityWrapper.last(limt);
       return productService.selectList(entityWrapper);

   }

}

     * 批量删除
     * @param ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/delete")
    public ServerResponse delete(String[] ids){
        return ServerResponse.createByResult(productSellService.deleteBatchIds(Arrays.asList(ids)));
    }

    /**
     * 批量新增
     * @param productSells
     * @return
     */
    @RequestMapping("/insertBatch")
    @ResponseBody
    public ServerResponse insertBatch(ProductSell productSells, int days){
        if (days>30){
            return ServerResponse.createByErrorMessage("不能连续设置超过30天的产品销售");
        }
        ArrayList<ProductSell> productSellArrayList=new ArrayList<>();
        for (int i=1;i<=days;i++){
            ProductSell productSell=new ProductSell(productSells);
            Calendar c = Calendar.getInstance();
            c.setTime(productSell.getStartDate());
            c.add(Calendar.DAY_OF_MONTH, i);// +i天
            productSell.setStartDate(c.getTime());
            productSell.setCreateTime(new Date());
            productSellArrayList.add(productSell);
        }

        return ServerResponse.createByResult(productSellService.insertBatch(productSellArrayList));
    }

    @RequestMapping("/addView")
    public String addView(String pid, String title,Double price, Model model) throws UnsupportedEncodingException {
        String param = new String(title.getBytes("UTF-8"), "UTF-8");//解决get乱码
        model.addAttribute("pid",pid);
        model.addAttribute("title",param);
        model.addAttribute("price",price);
    /**
     * 批量删除
     * @param pids
     * @return
     */

    @ResponseBody
    @RequestMapping("/deleteBatchIds")
    public ServerResponse deleteBatchIds(String[] pids){
        if (pids.length>60){
            return ServerResponse.createByErrorMessage("超出一次删除的记录");
        }
        productService.deleteBatchIds(pids);
        return ServerResponse.createBySuccess();
    }

    private boolean setThemeProduct(String[] themeName, ThemeProduct[] themeProducts){
        themeProducts=new ThemeProduct[themeName.length];
        for (int i=0;i<themeName.length;i++){
            String themeId=themeService.selectIdByName(themeName[i]);
            if (null==themeId){
                return false;
            }
            themeProducts[i]=new ThemeProduct();
            themeProducts[i].setThemeId(themeId);
            themeProducts[i].setThemeName(themeName[i]);
        }
        return true;
    }

    @RequestMapping("/addView")
    public String addView(Model model){

        model.addAttribute("theme",themeService.selectList(null));
        return "backend/product_add";
    }

    @RequestMapping("/listView")
    public String listView(){
        return "backend/product_list";
    }

    @RequestMapping("/updateView/{pid}")
    public String updateView(@PathVariable String pid, Model model){
        Product product=productService.selectById(pid);
        ProductDesc productDesc=productDescService.selectById(pid);

        model.addAttribute("product",product);
    public String navigation(){
        return "index/navigation";
    }

    @RequestMapping("/productlistView")
    public String plView(Model model){
        List<Theme> themes=themeService.selectList(null);
        model.addAttribute("themes",themes);
        return "index/product_list";
    }

    @RequestMapping("/indexView")
    public String indexView(Model model){
        List<Product> productList=productService.getIndexproduct(6);
        List<Product> hotPList=productService.hotProduct(6);
        model.addAttribute("hotPList",hotPList);
        model.addAttribute("productList",productList);
        List<Theme> selectList = themeService.selectList(null);
        List<Theme> subList;
        if(selectList.size()>=7) {
            subList = selectList.subList(0, 7);
            model.addAttribute("themeList", subList);
        }else {
        	 model.addAttribute("themeList", selectList);
        }
        return "index/index";
    }

    @RequestMapping("/userinfoView")
    public String userinfoView(){
        return "index/user_info";
    }

    @RequestMapping("/myorder")
    public String myorder(){

        return "index/my_order";
    }
    @RequestMapping("/plistView")
    public String plistView(){

        return "index/plist";
    }

    @RequestMapping("/adminLoginView")
    public String adloginView(){
        return "backend/admin_login";
    }
    
    @RequestMapping("/Searchtheme/{id}")
    public String SearchTheme(@PathVariable("id") String id,Model model) {
    	//根据主题id找到主题列表
		List<ThemeProduct> themeList = ithemeProductService.findBytid(id);
		String pids="";

    @RequestMapping("/userlist")
    public String userlist(){
        return "backend/user_list";
    }

    @RequestMapping("/nav")
    public String navigation(){
        return "backend/nav";
    }

    @RequestMapping("userupdate")
    public String userupdate(){
        return "backend/user_update";
    }

    @RequestMapping("cuslist")
    public String cuslist(){
        return "backend/customization_list";
    }

    @RequestMapping("/themelist")
    public String thememlist(){
        return "backend/theme_list";
    }

    @RequestMapping("/fileupload")
    public String fileupload(){
        return "backend/fileupload";
    }

}

     * @return
     */
    @RequestMapping("/login")
    @ResponseBody
    public ServerResponse<User> login(String username, String password, HttpSession session){

        ServerResponse<User> response= userService.logion(username,password);
        if (response.isSuccess()){
            session.setAttribute(Const.CURRENT_USER,response.getData());
        }
        return  response;
    }

    /**
     * 更新
     * @param user
     * @param
     * @return
     */
    @ResponseBody
    @RequestMapping("/update")
    public ServerResponse update(User user){
        user.setUpdateTime(new Date());
        return ServerResponse.createByResult(user.updateById());
    }

    /**
     * 个人信息修改
     * @param id
     * @param model
     * @return
     */
    @RequestMapping("/updateView/{id}")
    public String updateView(@PathVariable String id, Model model){
        User user=userService.selectById(id);
        model.addAttribute(user);
        return "backend/user_update";
    }
    
    /**
     * 添加新会员页面
     * @param user
     * @return
     */
    @RequestMapping(value="/userAdd",method=RequestMethod.GET)
    @RequestMapping("/detailView")
    public String detailView(HttpSession session,Model model,String pid,String oid){
        User user = (User)session.getAttribute(Const.CURRENT_USER);
        if(user == null){
            return "index/index";
        }
        if (null==pid||null==oid){
            return "index/index";
        }
        ProductOrder productOrder=productOrderService.selectById(oid);
        Product product=productService.selectById(pid);
        ProductSell productSell=productSellService.selectOne(new EntityWrapper<ProductSell>().eq("pid",pid));
        model.addAttribute("productOrder",productOrder);
        model.addAttribute("product",product);
        model.addAttribute("productSell",productSell);
        return "index/order_detail";
    }
}

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@Controller
@RequestMapping("/manager/productOrder")
public class ProductManageOrderController {

    @Autowired
    private IProductOrderService productOrderService;

    @RequestMapping("/list")
    @ResponseBody
    public ServerResponse list(String keyword, @RequestParam(value="current",defaultValue="1") int current, @RequestParam(value="size",defaultValue="10") int size){
        EntityWrapper entityWrapper=new EntityWrapper();
        if (keyword!=null&!"".equals(keyword)){
            entityWrapper.eq("order_no",keyword).or().eq("username",keyword);
            entityWrapper.orderBy("create_time",false);
        }

        return ServerResponse.createBySuccess(productOrderService.selectPage(new Page<ProductOrder>(current,size),entityWrapper));
    }

    @RequestMapping("/detailView/{id}")
    public String detailView(@PathVariable String id, Model model){
        ProductOrder productOrder=productOrderService.selectById(id);
        model.addAttribute("order",productOrder);
        return "backend/order_detail";
    }

    @RequestMapping("/listView")
    public String listView(){
        return "backend/order_list";
    }

}

        if (current<=0||size<=0){
            return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(), ResponseCode.ILLEGAL_ARGUMENT.getDesc());
        }
        EntityWrapper entityWrapper=null;
        if (status!=null&&!"".equals(status)){
            entityWrapper=new EntityWrapper();
            entityWrapper.eq("status",Integer.parseInt(status));
        }

        return ServerResponse.createBySuccess(customizationService.selectMapsPage(new Page(current,size),entityWrapper)) ;
    }

}

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@Controller
@RequestMapping("/customization")
public class CustomizationController {

    @Autowired
    private ICustomizationService customizationService;

    @PostMapping("/save")
    @ResponseBody

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@Controller
@RequestMapping("/manager/user")
public class UserMangeController {

    @Autowired
    private IUserService userService;

    /**
     * 用户列表
     * @param keyword
     * @param current
     * @param size
     * @return
     */
    @ResponseBody
    @RequestMapping("/list")
    public ServerResponse list(String keyword, @RequestParam(value="current",defaultValue="1") int current, @RequestParam(value="size",defaultValue="10") int size){
        System.out.println(keyword);
        EntityWrapper<User> userEntityWrapper=new EntityWrapper<User>();
        userEntityWrapper.like("username",keyword).or().like("email",keyword).or().like("phone",keyword);
        return ServerResponse.createBySuccess(userService.selectPage(new Page<User>(current,size),userEntityWrapper));
    }

    /**
     *
     */
    @ResponseBody
    @RequestMapping("/count")
    public int getCountPage(){
        return userService.selectCount(null);
    }

    @RequestMapping("/index")
    public String indexView(Model model){

        int usernum=new User().selectCount(null);
        int pnum=new Product().selectCount(null);
        int onum= new ProductOrder().selectCount(null);
        int cusnum= new Customization().selectCount(null);
        model.addAttribute("usernum",usernum);
        model.addAttribute("pnum",pnum);
        model.addAttribute("onum",onum);
        model.addAttribute("cusnum",cusnum);
        return "backend/index";
    }

    @RequestMapping("/userlist")
    public String userlist(){
        return "backend/user_list";
    }

    @RequestMapping("/nav")
    public String navigation(){
        return "backend/nav";
    }

    @RequestMapping("userupdate")
    public String userupdate(){
        return "backend/user_update";
    }

    @RequestMapping("cuslist")
    public String cuslist(){
        return "backend/customization_list";
    }

    @RequestMapping("/themelist")
    public String thememlist(){
        return "backend/theme_list";
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/delete")
    public ServerResponse delete(String[] ids){
        return ServerResponse.createByResult(productSellService.deleteBatchIds(Arrays.asList(ids)));
    }

    /**
     * 批量新增
     * @param productSells
     * @return
     */
    @RequestMapping("/insertBatch")
    @ResponseBody
    public ServerResponse insertBatch(ProductSell productSells, int days){
        if (days>30){
            return ServerResponse.createByErrorMessage("不能连续设置超过30天的产品销售");
        }
        ArrayList<ProductSell> productSellArrayList=new ArrayList<>();
        for (int i=1;i<=days;i++){
            ProductSell productSell=new ProductSell(productSells);
            Calendar c = Calendar.getInstance();
            c.setTime(productSell.getStartDate());
            c.add(Calendar.DAY_OF_MONTH, i);// +i天
            productSell.setStartDate(c.getTime());
            productSell.setCreateTime(new Date());
            productSellArrayList.add(productSell);
        }

        return ServerResponse.createByResult(productSellService.insertBatch(productSellArrayList));
    }

    @RequestMapping("/addView")
    public String addView(String pid, String title,Double price, Model model) throws UnsupportedEncodingException {
        String param = new String(title.getBytes("UTF-8"), "UTF-8");//解决get乱码
        model.addAttribute("pid",pid);
        model.addAttribute("title",param);
        model.addAttribute("price",price);
        return "backend/productSell_add";
    }

    @RequestMapping("/listView/{pid}")
    public String listView(@PathVariable String pid,Model model){
        model.addAttribute("pid",pid);
        return "backend/productSell_list";
        for (int i=0;i<themeName.length;i++){
            String themeId=themeService.selectIdByName(themeName[i]);
            if (null==themeId){
                return ServerResponse.createByErrorMessage("不存在该主题");
            }
            themeProducts[i]=new ThemeProduct();
            themeProducts[i].setThemeId(themeId);
            themeProducts[i].setThemeName(themeName[i]);
        }

        try {
            productService.create(product,productDesc,themeProducts);
        } catch (Exception e) {
            return ServerResponse.createByError();
        }

        return ServerResponse.createBySuccess();
    }

    @RequestMapping("/update/{pid}")
    @ResponseBody
    public ServerResponse update(@PathVariable String pid, Product product, ProductDesc productDesc, String[] themeName){

        product.setPid(pid);
        ThemeProduct[] themeProducts=new ThemeProduct[themeName.length];
        for (int i=0;i<themeName.length;i++){
            String themeId=themeService.selectIdByName(themeName[i]);
            if (null==themeId){
                return ServerResponse.createByErrorMessage("不存在该主题");
            }
            themeProducts[i]=new ThemeProduct();
            themeProducts[i].setThemeId(themeId);
            themeProducts[i].setThemeName(themeName[i]);
        }

        try {
            productService.update(product,productDesc,themeProducts);
        } catch (Exception e) {
            return ServerResponse.createByError();
        }

        return ServerResponse.createBySuccess();
    }

    /**
     * 下架
     * @param pid
     * @return
     */
    @PostMapping("/register")
    @ResponseBody
    public ServerResponse<String> register (User user, String registerCode){
        System.out.println(user.toString());
        //对传参进行校验

        //验证邮箱验证码
        EntityWrapper<EmailValidate> entityWrapper=new EntityWrapper<>();
        entityWrapper.eq("email",user.getEmail())
                .eq("validate_code",registerCode);
        if(emailValidateService.selectCount(entityWrapper)<=0){
            return ServerResponse.createByErrorMessage("注册码错误");
        }

        //保存
        user.setCreateTime(new Date());
        user.setRole(10);
        if (user.insert()){
            return ServerResponse.createBySuccessMessage("注册成功");
        }else{
            return ServerResponse.createByError();
        }

    }

    /**
     * 用户登录
     * @param  username
     * @param  password
     * @param  session
     * @return
     */
    @RequestMapping("/login")
    @ResponseBody
    public ServerResponse<User> login(String username, String password, HttpSession session){

        ServerResponse<User> response= userService.logion(username,password);
        if (response.isSuccess()){
            session.setAttribute(Const.CURRENT_USER,response.getData());
        }
        return  response;
    }

    /**
     * 用户登录
     * @param  username
     * @param  password
     * @param  session
     * @return
     */
    }

    @RequestMapping("/detailView/{id}")
    public String detailView(@PathVariable String id, Model model){
        ProductOrder productOrder=productOrderService.selectById(id);
        model.addAttribute("order",productOrder);
        return "backend/order_detail";
    }

    @RequestMapping("/listView")
    public String listView(){
        return "backend/order_list";
    }

}

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
    @ResponseBody
    public ServerResponse update(@PathVariable String pid, Product product, ProductDesc productDesc, String[] themeName){

        product.setPid(pid);
        ThemeProduct[] themeProducts=new ThemeProduct[themeName.length];
        for (int i=0;i<themeName.length;i++){
            String themeId=themeService.selectIdByName(themeName[i]);
            if (null==themeId){
                return ServerResponse.createByErrorMessage("不存在该主题");
            }
            themeProducts[i]=new ThemeProduct();
            themeProducts[i].setThemeId(themeId);
            themeProducts[i].setThemeName(themeName[i]);
        }

        try {
            productService.update(product,productDesc,themeProducts);
        } catch (Exception e) {
            return ServerResponse.createByError();
        }

        return ServerResponse.createBySuccess();
    }

    /**
     * 下架
     * @param pid
     * @return
     */
    @ResponseBody
    @RequestMapping("/shelf/{pid}")
    public ServerResponse shelf(@PathVariable  String pid){
        Product product=new Product();
        product.setPid(pid);
        product.setStatus(2);//下架
        return ServerResponse.createByResult(product.updateById());
    }

    /**
     * 删除
     * @param pid
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/delete/{pid}")
    public ServerResponse delete(@PathVariable  String pid){

        productService.cascadeDeleteById(pid);
        return ServerResponse.createBySuccess();
        return "index/user_info";
    }

    /*
    @GetMapping("/check_email/{id}")
    @ResponseBody
    public ServerResponse<String>checkEmail(@PathVariable String id){

    }*/

}

/**
 */
@Controller
public class IndexController {

    @Autowired
    private IProductService productService;

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值