计算机毕业设计选题推荐-旅游攻略平台-Java/Python项目实战

作者主页 :IT研究室✨

个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。

☑文末获取源码☑
精彩专栏推荐 ⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目

文章目录

一、前言

随着国民经济的持续增长和居民可支配收入的提高,旅游已成为大众消费的重要组成部分。2015年,我国居民可支配收入达到21966元,增速达8.9%,这直接推动了旅游业的快速发展 。互联网大数据的普及和应用,为旅游行业提供了精准营销和用户体验提升的可能,智慧旅游的概念应运而生。

尽管旅游业发展迅速,但现有的旅游服务平台仍存在一些不足。例如,服务功能单一、用户体验不佳、信息更新不及时、缺乏个性化推荐等问题。这些问题限制了旅游服务平台在提升旅游体验和服务质量方面的潜力。

本课题旨在设计并实现一个功能全面、用户友好的旅游攻略平台。该平台将提供个性化旅游攻略等功能,以满足不同用户的需求。通过该系统,用户可以方便地获取旅游资讯。

在旅游攻略平台中,管理员负责用户账户的创建与维护、新闻资讯的发布、旅游攻略内容的监管;游客用户可以登录平台、阅读旅游攻略、发表旅游评论、修改个人信息。系统通过这些功能模块的整合,旨在为用户提供一个全面、互动的旅游信息获取和预订平台。

本课题的研究具有重要的理论意义和实际意义。从理论角度来看,它为旅游信息服务领域提供了新的研究思路,即如何利用信息技术提升旅游服务的质量和效率。从实际角度来看,旅游攻略平台的应用将有助于提高旅游信息的获取效率,增强旅游体验,推动旅游业的创新发展 。同时,系统的推广应用也将为旅游行业的信息化和智能化发展提供支持,促进旅游经济的增长。

二、开发环境

  • 开发语言:Java/Python
  • 数据库:MySQL
  • 系统架构:B/S
  • 后端:SpringBoot/SSM/Django/Flask
  • 前端:Vue

三、系统界面展示

  • 旅游攻略平台界面展示:
    管理员-旅游攻略管理:

    管理员-旅游资讯管理:

    用户-查看旅游攻略:

    用户-查看旅游资讯:

四、代码参考

  • 项目实战代码参考:
java(贴上部分代码) 复制代码
@RestController
@Controller
@RequestMapping("/gonglue")
public class GonglueController {
    private static final Logger logger = LoggerFactory.getLogger(GonglueController.class);

    private static final String TABLE_NAME = "gonglue";

    @Autowired
    private GonglueService gonglueService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private GonglueCollectionService gonglueCollectionService;//旅游攻略收藏
    @Autowired
    private JingdianService jingdianService;//景点
    @Autowired
    private JingdianCollectionService jingdianCollectionService;//景点收藏
    @Autowired
    private JingdianCommentbackService jingdianCommentbackService;//景点评价
    @Autowired
    private JingdianOrderService jingdianOrderService;//景点订单
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        params.put("gonglueDeleteStart",1);params.put("gonglueDeleteEnd",1);
        CommonUtil.checkMap(params);
        PageUtils page = gonglueService.queryPage(params);

        //字典表数据转换
        List<GonglueView> list =(List<GonglueView>)page.getList();
        for(GonglueView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GonglueEntity gonglue = gonglueService.selectById(id);
        if(gonglue !=null){
            //entity转view
            GonglueView view = new GonglueView();
            BeanUtils.copyProperties( gonglue , view );//把实体数据重构到view中
            //级联表 景点
            //级联表
            JingdianEntity jingdian = jingdianService.selectById(gonglue.getJingdianId());
            if(jingdian != null){
            BeanUtils.copyProperties( jingdian , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setJingdianId(jingdian.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody GonglueEntity gonglue, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,gonglue:{}",this.getClass().getName(),gonglue.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<GonglueEntity> queryWrapper = new EntityWrapper<GonglueEntity>()
            .eq("jingdian_id", gonglue.getJingdianId())
            .eq("gonglue_name", gonglue.getGonglueName())
            .eq("gonglue_chu_address", gonglue.getGonglueChuAddress())
            .eq("gonglue_tujing_address", gonglue.getGonglueTujingAddress())
            .eq("gonglue_mu_address", gonglue.getGonglueMuAddress())
            .eq("zan_number", gonglue.getZanNumber())
            .eq("cai_number", gonglue.getCaiNumber())
            .eq("gonglue_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonglueEntity gonglueEntity = gonglueService.selectOne(queryWrapper);
        if(gonglueEntity==null){
            gonglue.setZanNumber(1);
            gonglue.setCaiNumber(1);
            gonglue.setGonglueDelete(1);
            gonglue.setInsertTime(new Date());
            gonglue.setCreateTime(new Date());
            gonglueService.insert(gonglue);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody GonglueEntity gonglue, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,gonglue:{}",this.getClass().getName(),gonglue.toString());
        GonglueEntity oldGonglueEntity = gonglueService.selectById(gonglue.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(gonglue.getGongluePhoto()) || "null".equals(gonglue.getGongluePhoto())){
                gonglue.setGongluePhoto(null);
        }
        if("".equals(gonglue.getGonglueContent()) || "null".equals(gonglue.getGonglueContent())){
                gonglue.setGonglueContent(null);
        }
        if("".equals(gonglue.getGonglueXiandaiContent()) || "null".equals(gonglue.getGonglueXiandaiContent())){
                gonglue.setGonglueXiandaiContent(null);
        }

            gonglueService.updateById(gonglue);//根据id更新
            return R.ok();
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<GonglueEntity> oldGonglueList =gonglueService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        ArrayList<GonglueEntity> list = new ArrayList<>();
        for(Integer id:ids){
            GonglueEntity gonglueEntity = new GonglueEntity();
            gonglueEntity.setId(id);
            gonglueEntity.setGonglueDelete(2);
            list.add(gonglueEntity);
        }
        if(list != null && list.size() >0){
            gonglueService.updateBatchById(list);
        }

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<GonglueEntity> gonglueList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("../../upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            GonglueEntity gonglueEntity = new GonglueEntity();
//                            gonglueEntity.setJingdianId(Integer.valueOf(data.get(0)));   //景点 要改的
//                            gonglueEntity.setGonglueName(data.get(0));                    //攻略名称 要改的
//                            gonglueEntity.setGonglueUuidNumber(data.get(0));                    //攻略编号 要改的
//                            gonglueEntity.setGongluePhoto("");//详情和图片
//                            gonglueEntity.setGonglueChuAddress(data.get(0));                    //出发地点 要改的
//                            gonglueEntity.setGonglueTujingAddress(data.get(0));                    //途径地 要改的
//                            gonglueEntity.setGonglueMuAddress(data.get(0));                    //目的地点 要改的
//                            gonglueEntity.setZanNumber(Integer.valueOf(data.get(0)));   //赞 要改的
//                            gonglueEntity.setCaiNumber(Integer.valueOf(data.get(0)));   //踩 要改的
//                            gonglueEntity.setGonglueContent("");//详情和图片
//                            gonglueEntity.setGonglueXiandaiContent("");//详情和图片
//                            gonglueEntity.setGonglueDelete(1);//逻辑删除字段
//                            gonglueEntity.setInsertTime(date);//时间
//                            gonglueEntity.setCreateTime(date);//时间
                            gonglueList.add(gonglueEntity);


                            //把要查询是否重复的字段放入map中
                                //攻略编号
                                if(seachFields.containsKey("gonglueUuidNumber")){
                                    List<String> gonglueUuidNumber = seachFields.get("gonglueUuidNumber");
                                    gonglueUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> gonglueUuidNumber = new ArrayList<>();
                                    gonglueUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("gonglueUuidNumber",gonglueUuidNumber);
                                }
                        }

                        //查询是否重复
                         //攻略编号
                        List<GonglueEntity> gonglueEntities_gonglueUuidNumber = gonglueService.selectList(new EntityWrapper<GonglueEntity>().in("gonglue_uuid_number", seachFields.get("gonglueUuidNumber")).eq("gonglue_delete", 1));
                        if(gonglueEntities_gonglueUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(GonglueEntity s:gonglueEntities_gonglueUuidNumber){
                                repeatFields.add(s.getGonglueUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [攻略编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        gonglueService.insertBatch(gonglueList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }



    /**
    * 个性推荐
    */
    @IgnoreAuth
    @RequestMapping("/gexingtuijian")
    public R gexingtuijian(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("gexingtuijian方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        CommonUtil.checkMap(params);
        List<GonglueView> returnGonglueViewList = new ArrayList<>();

        //查看收藏
        Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));
        params1.put("shangxiaTypes",1);
        params1.put("gonglueYesnoTypes",2);
        PageUtils pageUtils = gonglueCollectionService.queryPage(params1);
        List<GonglueCollectionView> collectionViewsList =(List<GonglueCollectionView>)pageUtils.getList();
        Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型list
//        for(GonglueCollectionView collectionView:collectionViewsList){
//            Integer gonglueTypes = collectionView.getGonglueTypes();
//            if(typeMap.containsKey(gonglueTypes)){
//                typeMap.put(gonglueTypes,typeMap.get(gonglueTypes)+1);
//            }else{
//                typeMap.put(gonglueTypes,1);
//            }
//        }
        List<Integer> typeList = new ArrayList<>();//排序后的有序的类型 按最多到最少
        typeMap.entrySet().stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).forEach(e -> typeList.add(e.getKey()));//排序
        Integer limit = Integer.valueOf(String.valueOf(params.get("limit")));
        for(Integer type:typeList){
            Map<String, Object> params2 = new HashMap<>(params);params2.put("gonglueTypes",type);
            params2.put("shangxiaTypes",1);
            params2.put("gonglueYesnoTypes",2);
            PageUtils pageUtils1 = gonglueService.queryPage(params2);
            List<GonglueView> gonglueViewList =(List<GonglueView>)pageUtils1.getList();
            returnGonglueViewList.addAll(gonglueViewList);
            if(returnGonglueViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环
        }
        params.put("shangxiaTypes",1);
        params.put("gonglueYesnoTypes",2);
        //正常查询出来商品,用于补全推荐缺少的数据
        PageUtils page = gonglueService.queryPage(params);
        if(returnGonglueViewList.size()<limit){//返回数量还是小于要求数量
            int toAddNum = limit - returnGonglueViewList.size();//要添加的数量
            List<GonglueView> gonglueViewList =(List<GonglueView>)page.getList();
            for(GonglueView gonglueView:gonglueViewList){
                Boolean addFlag = true;
                for(GonglueView returnGonglueView:returnGonglueViewList){
                    if(returnGonglueView.getId().intValue() ==gonglueView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品
                }
                if(addFlag){
                    toAddNum=toAddNum-1;
                    returnGonglueViewList.add(gonglueView);
                    if(toAddNum==0) break;//够数量了
                }
            }
        }else {
            returnGonglueViewList = returnGonglueViewList.subList(0, limit);
        }

        for(GonglueView c:returnGonglueViewList)
            dictionaryService.dictionaryConvert(c, request);
        page.setList(returnGonglueViewList);
        return R.ok().put("data", page);
    }

    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        CommonUtil.checkMap(params);
        PageUtils page = gonglueService.queryPage(params);

        //字典表数据转换
        List<GonglueView> list =(List<GonglueView>)page.getList();
        for(GonglueView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Integer id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GonglueEntity gonglue = gonglueService.selectById(id);
            if(gonglue !=null){


                //entity转view
                GonglueView view = new GonglueView();
                BeanUtils.copyProperties( gonglue , view );//把实体数据重构到view中

                //级联表
                    JingdianEntity jingdian = jingdianService.selectById(gonglue.getJingdianId());
                if(jingdian != null){
                    BeanUtils.copyProperties( jingdian , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setJingdianId(jingdian.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody GonglueEntity gonglue, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,gonglue:{}",this.getClass().getName(),gonglue.toString());
        Wrapper<GonglueEntity> queryWrapper = new EntityWrapper<GonglueEntity>()
            .eq("jingdian_id", gonglue.getJingdianId())
            .eq("gonglue_name", gonglue.getGonglueName())
            .eq("gonglue_uuid_number", gonglue.getGonglueUuidNumber())
            .eq("gonglue_chu_address", gonglue.getGonglueChuAddress())
            .eq("gonglue_tujing_address", gonglue.getGonglueTujingAddress())
            .eq("gonglue_mu_address", gonglue.getGonglueMuAddress())
            .eq("zan_number", gonglue.getZanNumber())
            .eq("cai_number", gonglue.getCaiNumber())
            .eq("gonglue_delete", gonglue.getGonglueDelete())
//            .notIn("gonglue_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonglueEntity gonglueEntity = gonglueService.selectOne(queryWrapper);
        if(gonglueEntity==null){
                gonglue.setZanNumber(1);
                gonglue.setCaiNumber(1);
            gonglue.setGonglueDelete(1);
            gonglue.setInsertTime(new Date());
            gonglue.setCreateTime(new Date());
        gonglueService.insert(gonglue);

            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

}
java(贴上部分代码) 复制代码
@RestController
@Controller
@RequestMapping("/gonglueCollection")
public class GonglueCollectionController {
    private static final Logger logger = LoggerFactory.getLogger(GonglueCollectionController.class);

    private static final String TABLE_NAME = "gonglueCollection";

    @Autowired
    private GonglueCollectionService gonglueCollectionService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private GonglueService gonglueService;//旅游攻略
    @Autowired
    private JingdianService jingdianService;//景点
    @Autowired
    private JingdianCollectionService jingdianCollectionService;//景点收藏
    @Autowired
    private JingdianCommentbackService jingdianCommentbackService;//景点评价
    @Autowired
    private JingdianOrderService jingdianOrderService;//景点订单
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = gonglueCollectionService.queryPage(params);

        //字典表数据转换
        List<GonglueCollectionView> list =(List<GonglueCollectionView>)page.getList();
        for(GonglueCollectionView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GonglueCollectionEntity gonglueCollection = gonglueCollectionService.selectById(id);
        if(gonglueCollection !=null){
            //entity转view
            GonglueCollectionView view = new GonglueCollectionView();
            BeanUtils.copyProperties( gonglueCollection , view );//把实体数据重构到view中
            //级联表 旅游攻略
            //级联表
            GonglueEntity gonglue = gonglueService.selectById(gonglueCollection.getGonglueId());
            if(gonglue != null){
            BeanUtils.copyProperties( gonglue , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setGonglueId(gonglue.getId());
            }
            //级联表 用户
            //级联表
            YonghuEntity yonghu = yonghuService.selectById(gonglueCollection.getYonghuId());
            if(yonghu != null){
            BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYonghuId(yonghu.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody GonglueCollectionEntity gonglueCollection, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,gonglueCollection:{}",this.getClass().getName(),gonglueCollection.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            gonglueCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<GonglueCollectionEntity> queryWrapper = new EntityWrapper<GonglueCollectionEntity>()
            .eq("gonglue_id", gonglueCollection.getGonglueId())
            .eq("yonghu_id", gonglueCollection.getYonghuId())
            .eq("gonglue_collection_types", gonglueCollection.getGonglueCollectionTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonglueCollectionEntity gonglueCollectionEntity = gonglueCollectionService.selectOne(queryWrapper);
        if(gonglueCollectionEntity==null){
            gonglueCollection.setInsertTime(new Date());
            gonglueCollection.setCreateTime(new Date());
            gonglueCollectionService.insert(gonglueCollection);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody GonglueCollectionEntity gonglueCollection, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,gonglueCollection:{}",this.getClass().getName(),gonglueCollection.toString());
        GonglueCollectionEntity oldGonglueCollectionEntity = gonglueCollectionService.selectById(gonglueCollection.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            gonglueCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

            gonglueCollectionService.updateById(gonglueCollection);//根据id更新
            return R.ok();
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<GonglueCollectionEntity> oldGonglueCollectionList =gonglueCollectionService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        gonglueCollectionService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<GonglueCollectionEntity> gonglueCollectionList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("../../upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            GonglueCollectionEntity gonglueCollectionEntity = new GonglueCollectionEntity();
//                            gonglueCollectionEntity.setGonglueId(Integer.valueOf(data.get(0)));   //旅游攻略 要改的
//                            gonglueCollectionEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户 要改的
//                            gonglueCollectionEntity.setGonglueCollectionTypes(Integer.valueOf(data.get(0)));   //类型 要改的
//                            gonglueCollectionEntity.setInsertTime(date);//时间
//                            gonglueCollectionEntity.setCreateTime(date);//时间
                            gonglueCollectionList.add(gonglueCollectionEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        gonglueCollectionService.insertBatch(gonglueCollectionList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        CommonUtil.checkMap(params);
        PageUtils page = gonglueCollectionService.queryPage(params);

        //字典表数据转换
        List<GonglueCollectionView> list =(List<GonglueCollectionView>)page.getList();
        for(GonglueCollectionView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Integer id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GonglueCollectionEntity gonglueCollection = gonglueCollectionService.selectById(id);
            if(gonglueCollection !=null){


                //entity转view
                GonglueCollectionView view = new GonglueCollectionView();
                BeanUtils.copyProperties( gonglueCollection , view );//把实体数据重构到view中

                //级联表
                    GonglueEntity gonglue = gonglueService.selectById(gonglueCollection.getGonglueId());
                if(gonglue != null){
                    BeanUtils.copyProperties( gonglue , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setGonglueId(gonglue.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(gonglueCollection.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody GonglueCollectionEntity gonglueCollection, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,gonglueCollection:{}",this.getClass().getName(),gonglueCollection.toString());
        Wrapper<GonglueCollectionEntity> queryWrapper = new EntityWrapper<GonglueCollectionEntity>()
            .eq("gonglue_id", gonglueCollection.getGonglueId())
            .eq("yonghu_id", gonglueCollection.getYonghuId())
            .eq("gonglue_collection_types", gonglueCollection.getGonglueCollectionTypes())
//            .notIn("gonglue_collection_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonglueCollectionEntity gonglueCollectionEntity = gonglueCollectionService.selectOne(queryWrapper);
        if(gonglueCollectionEntity==null){
            gonglueCollection.setInsertTime(new Date());
            gonglueCollection.setCreateTime(new Date());
        gonglueCollectionService.insert(gonglueCollection);

            return R.ok();
        }else {
            return R.error(511,"您已经收藏过了");
        }
    }

}

五、论文参考

  • 计算机毕业设计选题推荐-旅游攻略平台论文参考:

六、系统视频

旅游攻略平台项目视频:

计算机毕业设计选题推荐-旅游攻略平台-Java/Python

结语

计算机毕业设计选题推荐-旅游攻略平台-Java/Python项目实战

大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:⬇⬇⬇

精彩专栏推荐 ⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目

相关推荐
w_31234544 分钟前
自定义一个maven骨架 | 最佳实践
java·maven·intellij-idea
岁岁岁平安6 分钟前
spring学习(spring-DI(字符串或对象引用注入、集合注入)(XML配置))
java·学习·spring·依赖注入·集合注入·基本数据类型注入·引用数据类型注入
武昌库里写JAVA9 分钟前
Java成长之路(一)--SpringBoot基础学习--SpringBoot代码测试
java·开发语言·spring boot·学习·课程设计
Q_192849990616 分钟前
基于Spring Boot的九州美食城商户一体化系统
java·spring boot·后端
张国荣家的弟弟34 分钟前
【Yonghong 企业日常问题 06】上传的文件不在白名单,修改allow.jar.digest属性添加允许上传的文件SH256值?
java·jar·bi
ZSYP-S1 小时前
Day 15:Spring 框架基础
java·开发语言·数据结构·后端·spring
yuanbenshidiaos1 小时前
C++----------函数的调用机制
java·c++·算法
是小崔啊1 小时前
开源轮子 - EasyExcel01(核心api)
java·开发语言·开源·excel·阿里巴巴
黄公子学安全1 小时前
Java的基础概念(一)
java·开发语言·python
liwulin05061 小时前
【JAVA】Tesseract-OCR截图屏幕指定区域识别0.4.2
java·开发语言·ocr