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

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

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

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

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

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

主要功能截图如下:

管理员控制层:



/**
 * 
 *管理员控制层
 */
@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<String, Object> resultMap = new HashMap<String, Object>();
			StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_comment WHERE 1=1");
		
			
			List<Map<String, Object>> 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<String, String> map = OperationFileUtil.multiFileUpload(request,
					request.getServletContext().getRealPath("/") + "uploads\\spots\\");
			String filePath = "";
			for (Map.Entry<String, String> 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<String, Object> resultMap = new HashMap<String, Object>();
			StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_spots WHERE 1=1");
		
			
			List<Map<String, Object>> 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;
	}

}

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

  • 6
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 20
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beyondwild

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值