当前位置:   article > 正文

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

摄影网站java项目

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

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

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

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

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

主要功能截图如下:

管理员控制层:

  1. /**
  2. *
  3. *管理员控制层
  4. */
  5. @Controller
  6. @RequestMapping("/admin")
  7. @Scope("prototype")
  8. public class AdminController {
  9. private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
  10. private ReturnResult returnResult = new ReturnResult();
  11. @Resource(name = "adminService")
  12. private IAdminService adminService;
  13. /**
  14. * 管理员登录
  15. * @param admin
  16. * @param session
  17. * @return
  18. */
  19. @RequestMapping(value = "login", method = RequestMethod.POST)
  20. @ResponseBody
  21. public ReturnResult login(TAdmin admin, HttpSession session) {
  22. returnResult.setStatus(ReturnCodeType.FAILURE);
  23. try {
  24. admin = adminService.login(admin);
  25. if (admin != null) {
  26. admin.setPassword(null);
  27. session.setAttribute("admin", admin);
  28. returnResult.setStatus(ReturnCodeType.SUCCESS);
  29. }
  30. } catch (Exception e) {
  31. logger.error("登录失败:" + e);
  32. }
  33. return returnResult;
  34. }
  35. /**
  36. * 从session获取管理员信息
  37. * @param session
  38. * @return
  39. */
  40. @RequestMapping(value="getAdminInfo", method = RequestMethod.POST)
  41. @ResponseBody
  42. public ReturnResult getAdminInfo(HttpSession session) {
  43. returnResult.setStatus(ReturnCodeType.FAILURE);
  44. TAdmin admin = (TAdmin) session.getAttribute("admin");
  45. if (admin != null) {
  46. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(admin);
  47. } else {
  48. logger.info("获取管理员信息失败:管理员未登录");
  49. }
  50. return returnResult;
  51. }
  52. /**
  53. * 退出
  54. * @param session
  55. * @return
  56. */
  57. @RequestMapping(value="logout", method = RequestMethod.POST)
  58. @ResponseBody
  59. public ReturnResult logout(HttpSession session) {
  60. session.invalidate();
  61. return returnResult.setStatus(ReturnCodeType.SUCCESS);
  62. }
  63. }

评论控制层:

  1. /**
  2. * 评论控制层
  3. *
  4. */
  5. @Controller
  6. @Scope("prototype")
  7. public class CommentController {
  8. private static final Logger logger = LoggerFactory.getLogger(CommentController.class);
  9. private ReturnResult returnResult = new ReturnResult();
  10. @Resource(name = "commentService")
  11. private ICommentService commentService;
  12. /**
  13. * 添加评论
  14. *
  15. * @param comment
  16. * @param HttpServletRequest
  17. * @return
  18. */
  19. @RequestMapping(value = "addComment", method = RequestMethod.POST)
  20. @ResponseBody
  21. public ReturnResult addInfo(TComment comment,HttpSession session) {
  22. returnResult.setStatus(ReturnCodeType.FAILURE);
  23. try {
  24. TUser user = (TUser) session.getAttribute("user");
  25. comment.setUserid(user.getId());
  26. comment.setCreatetime(new Date());
  27. commentService.insert(comment);
  28. returnResult.setStatus(ReturnCodeType.SUCCESS);
  29. } catch (Exception e) {
  30. logger.error("新增comment失败" + e);
  31. }
  32. return returnResult;
  33. }
  34. /**
  35. * 删除评论
  36. *
  37. * @param comment
  38. * @param HttpServletRequest
  39. * @return
  40. */
  41. @RequestMapping(value = "deleteComment", method = RequestMethod.POST)
  42. @ResponseBody
  43. public ReturnResult deleteComment(Integer id) {
  44. returnResult.setStatus(ReturnCodeType.FAILURE);
  45. try {
  46. commentService.deleteByPrimaryKey(id);
  47. returnResult.setStatus(ReturnCodeType.SUCCESS);
  48. } catch (Exception e) {
  49. logger.error("删除comment失败" + e);
  50. }
  51. return returnResult;
  52. }
  53. /**
  54. * 根据摄影师id查询评论
  55. *
  56. * @param comment
  57. * @param HttpServletRequest
  58. * @return
  59. */
  60. @RequestMapping(value = "getCommentByPid", method = RequestMethod.GET)
  61. @ResponseBody
  62. public ReturnResult getCommentByPid(Integer pid) {
  63. returnResult.setStatus(ReturnCodeType.FAILURE);
  64. try {
  65. 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));
  66. } catch (Exception e) {
  67. logger.error("根据摄影师id查询评论" + e);
  68. }
  69. return returnResult;
  70. }
  71. /**
  72. * 分页获取comment
  73. * @return
  74. */
  75. @RequestMapping(value = "getCommentListByPage", method = RequestMethod.POST)
  76. @ResponseBody
  77. public ReturnResult getCommentListByPage(PageVO page) {
  78. returnResult.setStatus(ReturnCodeType.FAILURE);
  79. try {
  80. Map<String, Object> resultMap = new HashMap<String, Object>();
  81. StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_comment WHERE 1=1");
  82. List<Map<String, Object>> results = commentService.selectPageBySQL(sql.toString(), page.getPage() - 1,
  83. page.getRows());
  84. if (!results.isEmpty() && results != null) {
  85. int total = commentService.selectCount(new TComment());
  86. int rows = page.getRows();
  87. rows = rows == 0 ? 10 : rows;
  88. resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
  89. resultMap.put("page", page.getPage());
  90. resultMap.put("records", total);
  91. resultMap.put("rows", results);
  92. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
  93. }
  94. }catch (Exception e) {
  95. logger.error("分页获取comment失败" + e);
  96. }
  97. return returnResult;
  98. }
  99. }

景点信息控制层:

  1. /**
  2. *
  3. *景点信息控制层
  4. */
  5. @Controller
  6. @Scope("prototype")
  7. public class SpotsController {
  8. private static final Logger logger = LoggerFactory.getLogger(SpotsController.class);
  9. private ReturnResult returnResult = new ReturnResult();
  10. @Resource(name = "spotsService")
  11. private ISpotsService spotsService;
  12. /**
  13. * 添加拍摄景点
  14. *
  15. * @param spots
  16. * @param HttpServletRequest
  17. * @return
  18. */
  19. @RequestMapping(value = "addSpots", method = RequestMethod.POST)
  20. @ResponseBody
  21. public ReturnResult addSpots(TSpots spots, HttpServletRequest request) {
  22. returnResult.setStatus(ReturnCodeType.FAILURE);
  23. try {
  24. Map<String, String> map = OperationFileUtil.multiFileUpload(request,
  25. request.getServletContext().getRealPath("/") + "uploads\\spots\\");
  26. String filePath = "";
  27. for (Map.Entry<String, String> entry : map.entrySet()) {
  28. filePath = entry.getValue();
  29. }
  30. filePath = filePath.replace(request.getServletContext().getRealPath("/"), "/");
  31. spots.setPath(filePath);
  32. spots.setCreatetime(new Date());
  33. spotsService.insert(spots);
  34. returnResult.setStatus(ReturnCodeType.SUCCESS);
  35. } catch (Exception e) {
  36. logger.error("新增spots失败" + e);
  37. }
  38. return returnResult;
  39. }
  40. /**
  41. * 修改spots
  42. * @param spots
  43. * @return
  44. */
  45. @RequestMapping(value = "updateSpots", method = RequestMethod.POST)
  46. @ResponseBody
  47. public ReturnResult updateSpots(TSpots spots) {
  48. returnResult.setStatus(ReturnCodeType.FAILURE);
  49. try {
  50. spotsService.updateBySQL("UPDATE t_spots SET name='" + spots.getName() + "',content='"+spots.getContent()+"', status="+spots.getStatus()+" WHERE id=" + spots.getId());
  51. returnResult.setStatus(ReturnCodeType.SUCCESS);
  52. } catch (Exception e) {
  53. logger.error("修改spots失败" + e);
  54. }
  55. return returnResult;
  56. }
  57. /**
  58. * 分页获取spots
  59. * @return
  60. */
  61. @RequestMapping(value = "getSpotsListByPage", method = RequestMethod.POST)
  62. @ResponseBody
  63. public ReturnResult getSpotsListByPage(PageVO page) {
  64. returnResult.setStatus(ReturnCodeType.FAILURE);
  65. try {
  66. Map<String, Object> resultMap = new HashMap<String, Object>();
  67. StringBuffer sql = new StringBuffer("SELECT DISTINCT * FROM t_spots WHERE 1=1");
  68. List<Map<String, Object>> results = spotsService.selectPageBySQL(sql.toString(), page.getPage() - 1,
  69. page.getRows());
  70. if (!results.isEmpty() && results != null) {
  71. int total = spotsService.selectCount(new TSpots());
  72. int rows = page.getRows();
  73. rows = rows == 0 ? 10 : rows;
  74. resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
  75. resultMap.put("page", page.getPage());
  76. resultMap.put("records", total);
  77. resultMap.put("rows", results);
  78. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
  79. }
  80. }catch (Exception e) {
  81. logger.error("分页获取spots失败" + e);
  82. }
  83. return returnResult;
  84. }
  85. /**
  86. * 根据获取id spots
  87. * @param id
  88. * @return
  89. */
  90. @RequestMapping(value = "getSpotsById", method = RequestMethod.POST)
  91. @ResponseBody
  92. public ReturnResult getSpotsById(Integer id) {
  93. returnResult.setStatus(ReturnCodeType.FAILURE);
  94. try {
  95. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.selectByPrimaryKey(id));
  96. }catch (Exception e) {
  97. logger.error("根据获取spots失败" + e);
  98. }
  99. return returnResult;
  100. }
  101. /**
  102. * 获取所有启用的spots
  103. * @return
  104. */
  105. @RequestMapping(value = "getAllSpots", method = RequestMethod.POST)
  106. @ResponseBody
  107. public ReturnResult getAllSpots() {
  108. returnResult.setStatus(ReturnCodeType.FAILURE);
  109. try {
  110. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.getAllSpots());
  111. } catch (Exception e) {
  112. logger.error("获取所有启用spots失败" + e);
  113. }
  114. return returnResult;
  115. }
  116. /**
  117. * 获取所有5条启用的spots
  118. * @return
  119. */
  120. @RequestMapping(value = "getFiveSpots", method = RequestMethod.POST)
  121. @ResponseBody
  122. public ReturnResult getFiveSpots() {
  123. returnResult.setStatus(ReturnCodeType.FAILURE);
  124. try {
  125. returnResult.setStatus(ReturnCodeType.SUCCESS).setData(spotsService.selectBySQL("select * from t_spots ORDER BY id DESC limit 0,5"));
  126. } catch (Exception e) {
  127. logger.error("获取所有5条启用的spots失败" + e);
  128. }
  129. return returnResult;
  130. }
  131. }

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/792122
推荐阅读
相关标签
  

闽ICP备14008679号