Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)

发布时间:2024-10-06 08:01

源码获取:博客首页 "资源" 里下载!

主要功能设计:
运行环境: java jdk 1.8
环境:IDEA
tomcat环境: Tomcat 7.x、8

主要功能说明: 管理员角色包含以下功能:管理员登录,订单管理,摄影师管理,级别管理,标签管理,摄影地点管理,客片管理,轮播图管理,资讯管理等功能。

客户角色包含以下功能:客户首页,客片欣赏,预约摄影师,会员登录,填写预约摄影师信息,查看活动,订单查看等功能。

技术框架: HTML+CSS+JavaScript+jsp+mysql+Spring+SpringMVC+mybatis+Spring boot
数据库: Mysql数据库

主要功能截图如下:

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第1张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第2张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第3张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第4张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第5张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第6张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第7张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第8张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第9张图片

Java项目:婚纱影楼摄影预约网站设计和实现(javaweb+SSM+springboot)_第10张图片

管理员控制层:



/**
 * 
 *管理员控制层
 */
@Controller
@RequestMapping("/admin")
@Scope("prototype")
public class AdminController {

	private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
	private ReturnResult returnResult = new ReturnResult();

	@Resource(name = "adminService")
	private IAdminService adminService;

	/**
	 * 管理员登录
	 * @param admin
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "login", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult login(TAdmin admin, HttpSession session) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			admin = adminService.login(admin);
			if (admin != null) {
				admin.setPassword(null);
				session.setAttribute("admin", admin);
				returnResult.setStatus(ReturnCodeType.SUCCESS);
			}
		} catch (Exception e) {
			logger.error("登录失败:" + e);

		}
		return returnResult;

	}

	/**
	 * 从session获取管理员信息
	 * @param session
	 * @return
	 */
	@RequestMapping(value="getAdminInfo", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getAdminInfo(HttpSession session) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		TAdmin admin = (TAdmin) session.getAttribute("admin");
		if (admin != null) {
			returnResult.setStatus(ReturnCodeType.SUCCESS).setData(admin);
		} else {
			logger.info("获取管理员信息失败:管理员未登录");
		}
		return returnResult;
	}
	
	/**
	 * 退出
	 * @param session
	 * @return
	 */
	@RequestMapping(value="logout", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult logout(HttpSession session) {
		session.invalidate();
		return returnResult.setStatus(ReturnCodeType.SUCCESS);
	}
	
}

评论控制层:

/**
 * 评论控制层
 *
 */
@Controller
@Scope("prototype")
public class CommentController {

	private static final Logger logger = LoggerFactory.getLogger(CommentController.class);
	private ReturnResult returnResult = new ReturnResult();

	@Resource(name = "commentService")
	private ICommentService commentService;

	/**
	 * 添加评论
	 * 
	 * @param comment
	 * @param HttpServletRequest
	 * @return
	 */
	@RequestMapping(value = "addComment", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult addInfo(TComment comment,HttpSession session) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			TUser user = (TUser) session.getAttribute("user");
			comment.setUserid(user.getId());
			comment.setCreatetime(new Date());
			commentService.insert(comment);
			returnResult.setStatus(ReturnCodeType.SUCCESS);
		} catch (Exception e) {
			logger.error("新增comment失败" + e);
		}
		return returnResult;

	}

	/**
	 * 删除评论
	 * 
	 * @param comment
	 * @param HttpServletRequest
	 * @return
	 */
	@RequestMapping(value = "deleteComment", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult deleteComment(Integer id) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {

			commentService.deleteByPrimaryKey(id);
			returnResult.setStatus(ReturnCodeType.SUCCESS);
		} catch (Exception e) {
			logger.error("删除comment失败" + e);
		}
		return returnResult;

	}
	/**
	 * 根据摄影师id查询评论
	 * 
	 * @param comment
	 * @param HttpServletRequest
	 * @return
	 */
	@RequestMapping(value = "getCommentByPid", method = RequestMethod.GET)
	@ResponseBody
	public ReturnResult getCommentByPid(Integer pid) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			
			
			returnResult.setStatus(ReturnCodeType.SUCCESS).setData(commentService.selectBySQL("SELECT a.`comment`,a.createTime,b.`name` FROM t_comment a,t_user b where a.userId=b.id AND a.photographerId="+pid));
		} catch (Exception e) {
			logger.error("根据摄影师id查询评论" + e);
		}
		return returnResult;
		
	}
	
	/**
	 * 分页获取comment
	 * @return
	 */
	@RequestMapping(value = "getCommentListByPage", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getCommentListByPage(PageVO page) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			Map resultMap = new HashMap();
			StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_comment WHERE 1=1");
		
			
			List> results = commentService.selectPageBySQL(sql.toString(), page.getPage() - 1,
					page.getRows());
			if (!results.isEmpty() && results != null) {
				int total = commentService.selectCount(new TComment());
				int rows = page.getRows();
				rows = rows == 0 ? 10 : rows;
				resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
				resultMap.put("page", page.getPage());
				resultMap.put("records", total);
				resultMap.put("rows", results);
				returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
			}
		}catch (Exception e) {
			logger.error("分页获取comment失败" + e);
		}
		return returnResult;
	}
	

}

景点信息控制层:

/**
 * 
 *景点信息控制层
 */
@Controller
@Scope("prototype")
public class SpotsController {

	private static final Logger logger = LoggerFactory.getLogger(SpotsController.class);
	private ReturnResult returnResult = new ReturnResult();

	@Resource(name = "spotsService")
	private ISpotsService spotsService;

	/**
	 * 添加拍摄景点
	 * 
	 * @param spots
	 * @param HttpServletRequest
	 * @return
	 */
	@RequestMapping(value = "addSpots", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult addSpots(TSpots spots, HttpServletRequest request) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {

			Map map = OperationFileUtil.multiFileUpload(request,
					request.getServletContext().getRealPath("/") + "uploads\\spots\\");
			String filePath = "";
			for (Map.Entry entry : map.entrySet()) {
				filePath = entry.getValue();
			}
			filePath = filePath.replace(request.getServletContext().getRealPath("/"), "/");
			spots.setPath(filePath);
			spots.setCreatetime(new Date());
			spotsService.insert(spots);
			returnResult.setStatus(ReturnCodeType.SUCCESS);
		} catch (Exception e) {
			logger.error("新增spots失败" + e);
		}
		return returnResult;

	}

	
	/**
	 * 修改spots
	 * @param spots
	 * @return
	 */
	@RequestMapping(value = "updateSpots", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult updateSpots(TSpots spots) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			spotsService.updateBySQL("UPDATE t_spots SET name='" + spots.getName() + "',content='"+spots.getContent()+"', status="+spots.getStatus()+" WHERE id=" + spots.getId());
			returnResult.setStatus(ReturnCodeType.SUCCESS);
		} catch (Exception e) {
			logger.error("修改spots失败" + e);
		}
		return returnResult;
	}
	
	/**
	 * 分页获取spots
	 * @return
	 */
	@RequestMapping(value = "getSpotsListByPage", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getSpotsListByPage(PageVO page) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			Map resultMap = new HashMap();
			StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_spots WHERE 1=1");
		
			
			List> results = spotsService.selectPageBySQL(sql.toString(), page.getPage() - 1,
					page.getRows());
			if (!results.isEmpty() && results != null) {
				int total = spotsService.selectCount(new TSpots());
				int rows = page.getRows();
				rows = rows == 0 ? 10 : rows;
				resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
				resultMap.put("page", page.getPage());
				resultMap.put("records", total);
				resultMap.put("rows", results);
				returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
			}
		}catch (Exception e) {
			logger.error("分页获取spots失败" + e);
		}
		return returnResult;
	}
	/**
	 * 根据获取id spots
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "getSpotsById", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getSpotsById(Integer id) {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
				returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.selectByPrimaryKey(id));
		}catch (Exception e) {
			logger.error("根据获取spots失败" + e);
		}
		return returnResult;
	}
	
	/**
	 * 获取所有启用的spots
	 * @return
	 */
	@RequestMapping(value = "getAllSpots", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getAllSpots() {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.getAllSpots());
		} catch (Exception e) {
			logger.error("获取所有启用spots失败" + e);
		}
		return returnResult;
	}
	/**
	 * 获取所有5条启用的spots
	 * @return
	 */
	@RequestMapping(value = "getFiveSpots", method = RequestMethod.POST)
	@ResponseBody
	public ReturnResult getFiveSpots() {
		returnResult.setStatus(ReturnCodeType.FAILURE);
		try {
			returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.selectBySQL("select * from t_spots  ORDER BY id DESC limit 0,5"));
		} catch (Exception e) {
			logger.error("获取所有5条启用的spots失败" + e);
		}
		return returnResult;
	}

}

源码获取:博客首页 "资源" 里下载!

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号