package cczu.tourism.web.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import cczu.tourism.web.constant.Constant;
import cczu.tourism.web.entity.SaveSceneCollectionDto;
import cczu.tourism.web.entity.SceneCollection;
import cczu.tourism.web.entity.SceneComments;
import cczu.tourism.web.entity.SceneInformation;
import cczu.tourism.web.entity.SearchRecord;
import cczu.tourism.web.entity.StrategyInfoemation;
import cczu.tourism.web.entity.TourismUser;
import cczu.tourism.web.service.SceneCollectionService;
import cczu.tourism.web.service.SceneCommentsService;
import cczu.tourism.web.service.SceneInformationService;
import cczu.tourism.web.service.SearchRecordService;
import cczu.tourism.web.service.StrategyInfoemationService;
import cczu.tourism.web.service.TourismUserService;
import cczu.tourism.web.util.DateUtil;
@Controller
@RequestMapping("/tourismWeb")
public class TourismWebController {
public Logger logger = LoggerFactory
.getLogger(TourismWebController.class);// 输出日志
@Autowired
private SceneInformationService sceneInformationService;
@Autowired
private SceneCommentsService sceneCommentsService;
@Autowired
private TourismUserService tourismUserService;
@Autowired
private SceneCollectionService sceneCollectionService;
@Autowired
private StrategyInfoemationService strategyInfoemationService;
@Autowired
private SearchRecordService searchRecordService;
@RequestMapping("/selectSceneAll")
@ResponseBody
public List<SceneInformation> selectSceneAll(HttpServletRequest request,HttpServletResponse response,String sceneName){
List<SceneInformation> list=new ArrayList<SceneInformation>();
if(StringUtils.isNotEmpty(sceneName)){
Map<String, Object> map=new HashMap<String, Object>();
map.put("scene_name",sceneName);
list=sceneInformationService.selectByMap(map);
}else{
list= sceneInformationService.selectByMap(null);
}
return list;
}
@RequestMapping("/selectSceneDetail")
public String selectSceneDetail(ModelMap map,String id){
SceneInformation sceneInformation = sceneInformationService.selectById(id);
map.put("sceneInformation",sceneInformation);
return "tourismWeb/senceDetail";
}
@RequestMapping("/selectSceneCommentsAll")
@ResponseBody
public JSONObject selectSceneCommentsAll(String id){
StringBuffer sb = new StringBuffer();
JSONObject json=new JSONObject();
Map<String, Object> map=new HashMap<>();
map.put("scene_id",id);
List<SceneComments> list=sceneCommentsService.selectByMap(map);
if(null != list && list.size() >0){
for(int i=0;i<list.size();i++){
sb.append("评论人:"+list.get(i).getCommentsName());
sb.append(" ");
sb.append("内容:"+list.get(i).getCommentsContent());
sb.append(" ");
sb.append("时间:"+DateUtil.getStrDate(list.get(i).getCreateTime()));
sb.append("\r\n");
}
}else{
sb.append("暂无");
sb.append("\r\n");
}
json.put("sb", sb);
return json;
}
@RequestMapping("/savecomments")
@ResponseBody
public JSONObject savecomments(HttpServletRequest request,HttpServletResponse response,String commentsContent,String sceneId){
SceneComments sceneComments =new SceneComments();
JSONObject json=new JSONObject();
boolean flag=true;
String userName="";
try{
sceneComments.setCreateTime(new Date());
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
userName=request.getSession().getAttribute("tourismUser").toString();
}
}
sceneComments.setCommentsName(userName);
sceneComments.setCommentsContent(commentsContent);
sceneComments.setSceneId(Integer.parseInt(sceneId));
Integer count=sceneCommentsService.insert(sceneComments);
if(count >0){
logger.info("保存评论成功");
}else{
flag =false;
}
}catch(Throwable te){
flag =false;
logger.error("保存评论异常信息为:",te);
}
json.put("flag", flag);
json.put("id", sceneId);
return json;
}
@RequestMapping("/jumpMayLike")
public String jumpMayLike(){
return "tourismWeb/maylike";
}
@RequestMapping("/saveSeceneCollection")
@ResponseBody
public JSONObject saveSeceneCollection(HttpServletRequest request,HttpServletResponse response,String sceneId){
JSONObject json=new JSONObject();
boolean flag=true;
String userName = "";
SceneCollection sceneCollection =new SceneCollection();
try{
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
userName=request.getSession().getAttribute("tourismUser").toString();
}
}
TourismUser tourismUser =new TourismUser();
tourismUser.setUserName(userName);
TourismUser retTourismUser= tourismUserService.selectOne(tourismUser);
if(null != retTourismUser){
sceneCollection.setUserId(retTourismUser.getId());
sceneCollection.setUserName(retTourismUser.getUserName());
}
SceneInformation retSceneInformation=sceneInformationService.selectById(sceneId);
if(null != retSceneInformation){
sceneCollection.setSceneId(retSceneInformation.getId());
sceneCollection.setSceneName(retSceneInformation.getSceneName());
}
sceneCollection.setCreateTime(new Date());
sceneCollection.setStatus(Constant.isUsd);
Integer count= sceneCollectionService.insert(sceneCollection);
if(count >0){
logger.info("收藏成功");
}else{
flag=false;
}
}catch(Throwable te){
flag=false;
te.printStackTrace();
}
json.put("flag", flag);
return json;
}
@RequestMapping("/selectMayLikeScene")
@ResponseBody
public JSONObject selectMayLikeScene(HttpServletRequest request,HttpServletResponse response){
String userName="";
JSONObject json =new JSONObject();
List<SceneInformation> list=new ArrayList<SceneInformation>();
try{
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
userName=request.getSession().getAttribute("tourismUser").toString();
}
}
TourismUser tourismUser =new TourismUser();
tourismUser.setUserName(userName);
TourismUser retTourismUser= tourismUserService.selectOne(tourismUser);
if(null != retTourismUser){
SceneInformation sceneInformation =new SceneInformation();
sceneInformation.setSceneName(retTourismUser.getWantScene());
SceneInformation retSceneInformation=sceneInformationService.selectOne(sceneInformation);
if(null != retSceneInformation){
list.add(retSceneInformation);
}
}
Map<String, Object> map=new HashMap<>();
map.put("user_name",userName);
List<SearchRecord> searchRecordList= searchRecordService.selectByMap(map);
if(null != searchRecordList){
for(int i=0;i<searchRecordList.size();i++){
if(null !=searchRecordList.get(i).getSceneId()){
SceneInformation ret=sceneInformationService.selectById(searchRecordList.get(i).getSceneId());
list.add(ret);
}
}
}
}catch(Throwable te){
te.printStackTrace();
}
json.put("list", list);
return json;
}
@RequestMapping("/jumpTourismPlan")
public String jumpTourismPlan(){
ret
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
采用ssm架构实现的旅游网站系统 包括网站展示和后台管理功能,网站主要是页面浏览以及评论、制定旅游方案、智能推荐功能 后台就是维护网站展示的内容,添加旅游景点、管理用户、查看用户的搜索记录功能 运行环境: 1、maven 2、jkd1.7 3、eclipse(不要最新版) 4、mysql 5.5以上 配置了拦截器,可以先访问看是否拦截登陆(答辩的时候是亮点) 网站访问地址:http://localhost:8080/tourism-system/index 网站用户登录:http://localhost:8080/tourism-system/userlogin 后台管理员账户密码写死的 admin 123456 输错会有提示,但是不是查询数据库 管理员登陆:http://localhost:8080/tourism-system/login 管理员后台地址:http://localhost:8080/tourism-system/backgroundweb/jumpMain
资源推荐
资源详情
资源评论
收起资源包目录
Java项目:诚途旅游系统(java+JSP+Spring+SSM+Mysql) (1310个子文件)
all-wcprops 19KB
all-wcprops 5KB
all-wcprops 5KB
all-wcprops 5KB
all-wcprops 3KB
all-wcprops 2KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 998B
all-wcprops 918B
all-wcprops 918B
all-wcprops 908B
all-wcprops 898B
all-wcprops 898B
all-wcprops 888B
all-wcprops 870B
all-wcprops 858B
all-wcprops 858B
all-wcprops 806B
all-wcprops 693B
all-wcprops 688B
all-wcprops 679B
all-wcprops 679B
all-wcprops 679B
all-wcprops 679B
all-wcprops 678B
all-wcprops 672B
all-wcprops 665B
all-wcprops 658B
all-wcprops 644B
all-wcprops 637B
all-wcprops 637B
all-wcprops 637B
all-wcprops 637B
all-wcprops 630B
all-wcprops 630B
all-wcprops 623B
all-wcprops 623B
all-wcprops 616B
all-wcprops 616B
all-wcprops 616B
all-wcprops 616B
all-wcprops 609B
all-wcprops 481B
all-wcprops 463B
all-wcprops 364B
all-wcprops 316B
all-wcprops 300B
all-wcprops 262B
all-wcprops 161B
all-wcprops 115B
new_default.css.bak 19KB
copyright.js.bak 4KB
bl_track_with_gcm.cgi 0B
TourismWebController.class 12KB
SysloginController.class 9KB
VeDate.class 9KB
TourismUserController.class 5KB
RandomValidateCodeUtil.class 5KB
JumpIndexController.class 4KB
CodeGenerationUtil.class 4KB
AttractionsDto.class 4KB
RecordLogAsync.class 4KB
BaseServiceImpl.class 4KB
StrategyInfoemation.class 4KB
SceneInformation.class 3KB
TourismUser.class 3KB
SearchRecord.class 3KB
SceneCollection.class 3KB
SceneComments.class 2KB
SearchRecordAop.class 2KB
UserLoginFilter.class 2KB
ValidationFilter.class 2KB
DateUtil.class 2KB
SearchRecordServiceImpl.class 1KB
BaseService.class 1KB
TourismUserServiceImpl.class 1KB
SearchRecordDto.class 1KB
UserDto.class 1KB
SaveSceneCollectionDto.class 1KB
PageBean.class 1KB
ResponseInformation.class 1007B
SearchRecordMapper.class 814B
TourismUserMapper.class 795B
StrategyInfoemationServiceImpl.class 710B
SceneInformationServiceImpl.class 692B
SceneCollectionServiceImpl.class 686B
SceneCommentsServiceImpl.class 674B
SearchRecordService.class 593B
TourismUserService.class 574B
StrategyInfoemationController.class 556B
SceneInformationController.class 544B
SceneCollectionController.class 540B
Constant.class 537B
SceneCommentsController.class 532B
SearchRecordController.class 528B
AppTest.class 479B
StrategyInfoemationMapper.class 337B
SceneInformationMapper.class 328B
SceneCollectionMapper.class 325B
共 1310 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
- AlluzeYu2022-04-27用户下载后在一定时间内未进行评价,系统默认好评。
OldWinePot
- 粉丝: 8981
- 资源: 426
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功