最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之生活旅行分享平臺的實(shí)現(xiàn)

 更新時(shí)間:2022年02月05日 12:49:19   作者:qq_1334611189  
這是一個(gè)使用了java+Springboot+JPA+Jsp+Html+js+Ajax+maven+mysql開發(fā)的生活旅行分享平臺,是一個(gè)畢業(yè)設(shè)計(jì)的實(shí)戰(zhàn)練習(xí),具有分享發(fā)布平臺該有的所有功能,感興趣的朋友快來看看吧

一、項(xiàng)目運(yùn)行

環(huán)境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

項(xiàng)目技術(shù):

Springboot+ SpringMVC + JPA+ Jsp + Html+ JavaScript + JQuery + Ajax + maven等等

評論業(yè)務(wù)控制器:

/**
 * 評論控制器
 * @author yy
 *
 */
@RestController
@RequestMapping("/comment")
public class CommentController {
 
  @Resource
  private CommentService commentService;
 
  @Resource
  private ArticleService articleService;
 
  @Resource
  private ReplyService replyService;
 
  /**
   * 分頁查詢評論
   * @param comment
   * @param page
   * @param pageSize
   * @return
   */
  @RequestMapping("/list")
  public Map<String, Object> commentList(Comment comment, @RequestParam(value = "page", required = false) Integer page,
                                         @RequestParam(value = "pageSize", required = false) Integer pageSize) {
    List<Comment> commentList = commentService.list(comment, null, null, page - 1, pageSize, null);
    Long total = commentService.getCount(comment, null, null, null);
    int totalPage = (int) (total % pageSize == 0 ? total / pageSize : total / pageSize + 1);
    Map<String, Object> resultMap = new HashMap<String, Object>();
    resultMap.put("totalPage", totalPage);
    resultMap.put("data", commentList);
    return resultMap;
  }
 
  /**
   * 分頁查詢評論
   * @param page
   * @param pageSize
   * @return
   */
  @RequestMapping("/massageList")
  public Map<String, Object> massageList(@RequestParam(value = "page", required = false) Integer page,
                                         @RequestParam(value = "pageSize", required = false) Integer pageSize) {
    List<Comment> commentList = commentService.massageList(page - 1, pageSize);
    Long total = commentService.getCount2();
    int totalPage = (int) (total % pageSize == 0 ? total / pageSize : total / pageSize + 1);
    Map<String, Object> resultMap = new HashMap<String, Object>();
    resultMap.put("totalPage", totalPage);
    resultMap.put("data", commentList);
    return resultMap;
  }
 
  /**
   * 添加評論
   * @Title: add
   * @param comment  評論實(shí)體
   * @return  參數(shù)說明
   * @return Map<String,Object>    返回類型
   * @throws
   */
  @RequestMapping("/add")
  public Map<String, Object> add(Comment comment, HttpSession session) {
    User currentUser = (User) session.getAttribute("user");
    Map<String, Object> resultMap = new HashMap<String, Object>();
    comment.setCommentDate(new Date());
    comment.setUser(currentUser);
    commentService.add(comment);
    if (comment.getArticle() != null) {
      articleService.increaseComment(comment.getArticle().getArticleId());
    }
    resultMap.put("comment", comment);
    resultMap.put("success", true);
    return resultMap;
  }
 
}

回復(fù)業(yè)務(wù)控制器:

/**
 * 回復(fù)控制器
 * @author yy
 *
 */
@RestController
@RequestMapping("/reply")
public class ReplyController {
 
  @Resource
  private ReplyService replyService;
 
  /**
   * 獲取回復(fù)
   * @param reply
   * @return
   */
  @RequestMapping("/list")
  public Map<String, Object> replyList(Reply reply) {
    List<Reply> replyList = replyService.list(reply);
    Map<String, Object> resultMap = new HashMap<String, Object>();
    resultMap.put("data", replyList);
    return resultMap;
  }
 
  /**
   * 添加回復(fù)
   * @param reply
   * @return
   */
  @RequestMapping("/add")
  public Map<String, Object> add(Reply reply, HttpSession session) {
    User currentUser = (User) session.getAttribute("user");
    Map<String, Object> resultMap = new HashMap<String, Object>();
    reply.setReplyDate(new Date());
    reply.setUser(currentUser);
    replyService.add(reply);
    resultMap.put("reply", reply);
    resultMap.put("success", true);
    return resultMap;
  }
 
}

管理員業(yè)務(wù)控制器:

/**
 * 管理員控制器
 * @author yy
 *
 */
@RestController
@RequestMapping("/admin")
public class AdminController {
 
  @Value("${MD5Salt}")
  private String salt; // md5加密鹽
 
  @Resource
  private AdminService adminService;
  @Resource
  private UserService userService;
  @Resource
  private ArticleService articleService;
  @Resource
  private ClassifyService classifyService;
 
  /**
   * 后臺管理員登錄驗(yàn)證
   * @param admin
   * @param request
   * @return
   */
  @RequestMapping("/login")
  public ModelAndView login(Admin admin, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    HttpSession session = request.getSession();
    try {
      Admin resultUser = adminService.findByUserNameAndPassword(admin.getUserName(), admin.getPassword());
      if (resultUser == null) {
        mav.addObject("errorInfo", "用戶名或者密碼錯(cuò)誤!");
        mav.setViewName("/login");
      } else {
        session.setAttribute("adminUser", resultUser);
        // 統(tǒng)計(jì)用戶總數(shù)
        Long userCount = userService.getCount();
        // 統(tǒng)計(jì)今天注冊
        Long userRegCount = userService.getTodayRegistCount(new User(), "1", "1");
        // 統(tǒng)計(jì)今日登錄
        Long userLogCount = userService.getCount(new User(), "1", "1");
        // 統(tǒng)計(jì)筆記總數(shù)
        Long artCount = articleService.getCount();
        // 統(tǒng)計(jì)筆記分類
        Long classCount = classifyService.getCount();
 
        session.setAttribute("userCount", userCount);
        session.setAttribute("userRegCount", userRegCount);
        session.setAttribute("userLogCount", userLogCount);
        session.setAttribute("artCount", artCount);
        session.setAttribute("classCount", classCount);
 
        mav.addObject("success", true);
        mav.setViewName("/admin/index");
      }
    } catch (Exception e) { // 用戶名密碼錯(cuò)誤
      e.printStackTrace();
      mav.addObject("admin", admin);
      mav.addObject("errorInfo", "用戶名或者密碼錯(cuò)誤!");
      mav.setViewName("/login");
    }
    return mav;
  }
 
  /**
   * 查看個(gè)人信息
   * 
   * @return
   */
  @RequestMapping("viewPerson")
  public ModelAndView viewPerson(HttpServletRequest request) {
    Admin admin = (Admin) request.getSession().getAttribute("adminUser");
    ModelAndView mav = new ModelAndView();
    Admin u = adminService.findById(admin.getAdminId());
    mav.addObject("user", u);
    mav.setViewName("/admin/adminViewPerson");
    return mav;
  }
 
  /**
   * 保存用戶信息
   * 
   * @param user
   * @return
   */
  @RequestMapping("/save")
  public ModelAndView save(Admin user) {
    ModelAndView mav = new ModelAndView();
    adminService.save(user);
    mav.setViewName("/admin/index");
    return mav;
  }
}

用戶業(yè)務(wù)控制器:

/**
 * 用戶控制器
 *
 */
@RestController
@RequestMapping("/admin/user")
public class UserAdminController {
 
  @Resource
  private UserService userService;
 
  @Value("${MD5Salt}")
  private String salt; // md5加密鹽
 
  /**
   * 根據(jù)ID查找用戶
   * @param userId
   * @return
   */
  @RequestMapping("/findById")
  public Map<String, Object> findById(Integer userId) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    User user = userService.findById(userId);
    resultMap.put("errorNo", 0);
    resultMap.put("data", user);
    return resultMap;
  }
 
  /**
   * 分頁查詢用戶
   * @param user
   * @param registrationDates
   * @param page
   * @param limit
   * @return
   */
  @RequestMapping("/list")
  public Map<String, Object> list(User user,
      @RequestParam(value = "latelyLoginTimes", required = false) String latelyLoginTimes,
      @RequestParam(value = "page", required = false) Integer page,
      @RequestParam(value = "pageSize", required = false) Integer pageSize) {
    String s_bregistrationDate = null; // 開始時(shí)間
    String s_eregistrationDate = null; // 結(jié)束時(shí)間
    if (StringUtil.isNotEmpty(latelyLoginTimes)) {
      String[] strs = latelyLoginTimes.split(" - "); // 拆分時(shí)間段
      s_bregistrationDate = strs[0];
      s_eregistrationDate = strs[1];
    }
    List<User> userList = userService.list(user, s_bregistrationDate, s_eregistrationDate, page - 1, pageSize);
    Long total = userService.getCount(user, s_bregistrationDate, s_eregistrationDate);
    Map<String, Object> resultMap = new HashMap<String, Object>();
    resultMap.put("errorNo", 0);
    resultMap.put("data", userList);
    resultMap.put("total", total);
    return resultMap;
  }
 
  @RequestMapping("/delete")
  public Map<String, Object> delete(Integer userId) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    userService.delete(userId);
    resultMap.put("errorNo", 0);
    return resultMap;
  }
 
  /**
   * 取消關(guān)注
   * @param request
   * @param userId
   * @return
   */
  @RequestMapping("/removeFocusUser")
  public ModelAndView removeFocusUser(HttpServletRequest request, String userId) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");// 當(dāng)前登錄用戶
 
    String userIds = user.getUserIds();
    List<String> tempList = Arrays.asList(userIds.split(","));
    List<String> lineIdList = new ArrayList<>(tempList);
    lineIdList.remove(userId);
    String ret = StringUtils.join(lineIdList, ",");
 
    user.setUserIds(ret);
 
    userService.save(user);
    mav.setViewName("redirect:/viewFocusUser");
    return mav;
  }
 
  /**
   * 關(guān)注用戶
   * @param request
   * @param userId
   * @return
   */
  @RequestMapping("/addFocusUser")
  public ModelAndView addFocusUser(HttpServletRequest request, String userId) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");// 當(dāng)前登錄用戶
 
    String userIds = user.getUserIds();
    List<String> tempList = Arrays.asList(userIds.split(","));
    List<String> lineIdList = new ArrayList<>(tempList);
    lineIdList.add(userId);
    String ret = StringUtils.join(lineIdList, ",");
 
    user.setUserIds(ret);
 
    userService.save(user);
    mav.setViewName("redirect:/viewFocusUser");
    return mav;
  }
 
  @RequestMapping("/addFocusUser/{userId}")
  public ModelAndView addFocusUser(@PathVariable(value = "userId", required = false) Integer userId,
      HttpSession session) {
    ModelAndView mav = new ModelAndView();
    User user = (User) session.getAttribute("user");// 當(dāng)前登錄用戶
 
    String userIds = user.getUserIds();
    List<String> tempList = new ArrayList<>();
    if (userIds != null) {
      tempList = Arrays.asList(userIds.split(","));
    }
    List<String> lineIdList = new ArrayList<>(tempList);
    lineIdList.add(userId.toString());
    String ret = StringUtils.join(lineIdList, ",");
 
    user.setUserIds(ret);
 
    userService.save(user);
    mav.setViewName("redirect:/viewFocusUser");
    return mav;
  }
 
  /**
   * 取消收藏
   * @param request
   * @param userId
   * @return
   */
  @RequestMapping("/removeCollection")
  public ModelAndView removeCollection(HttpServletRequest request, String artId) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");// 當(dāng)前登錄用戶
 
    String artIds = user.getArticleIds();
    List<String> tempList = Arrays.asList(artIds.split(","));
    List<String> lineIdList = new ArrayList<>(tempList);
    lineIdList.remove(artId);
    String ret = StringUtils.join(lineIdList, ",");
 
    user.setArticleIds(ret);
 
    userService.save(user);
    mav.setViewName("redirect:/viewCollection");
    return mav;
  }
 
  /**
   * 收藏
   * @param request
   * @param userId
   * @return
   */
  @RequestMapping("/addCollection")
  public ModelAndView addCollection(HttpServletRequest request, String artId) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");// 當(dāng)前登錄用戶
 
    String artIds = user.getArticleIds();
    List<String> tempList = Arrays.asList(artIds.split(","));
    List<String> lineIdList = new ArrayList<>(tempList);
    lineIdList.add(artId);
    String ret = StringUtils.join(lineIdList, ",");
 
    user.setArticleIds(ret);
 
    userService.save(user);
    mav.setViewName("redirect:/viewCollection");
    return mav;
  }
}

到此這篇關(guān)于Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之生活旅行分享平臺的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Java 生活旅行分享平臺內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 詳解SpringBoot依賴注入和使用配置文件

    詳解SpringBoot依賴注入和使用配置文件

    這篇文章主要介紹了SpringBoot依賴注入和使用配置文件的相關(guān)知識,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2024-01-01
  • Java多線程中的互斥鎖解析

    Java多線程中的互斥鎖解析

    這篇文章主要介紹了Java多線程中的互斥鎖解析,Java語言中,引入了對象互斥鎖的概念,來保證共享數(shù)據(jù)操作的完整性,每個(gè)對象都對應(yīng)于一個(gè)可稱為互斥鎖的標(biāo)記,這個(gè)標(biāo)記用來保證在任一時(shí)刻,只能有一個(gè)線程訪問該對象,需要的朋友可以參考下
    2023-09-09
  • tk-mybatis整合springBoot使用兩個(gè)數(shù)據(jù)源的方法

    tk-mybatis整合springBoot使用兩個(gè)數(shù)據(jù)源的方法

    單純的使用mybaits進(jìn)行多數(shù)據(jù)配置網(wǎng)上資料很多,但是關(guān)于tk-mybaits多數(shù)據(jù)源配置沒有相關(guān)材料,本文就詳細(xì)的介紹一下如何使用,感興趣的可以了解一下
    2021-12-12
  • java sqlserver text 類型字段讀取方法

    java sqlserver text 類型字段讀取方法

    有這樣一個(gè)需求,需要將原本存儲在數(shù)據(jù)庫中的文檔轉(zhuǎn)存至文件系統(tǒng)中,于是寫了一個(gè)簡單的程序完成此功能
    2012-11-11
  • Java 判斷線程池所有任務(wù)是否執(zhí)行完畢的操作

    Java 判斷線程池所有任務(wù)是否執(zhí)行完畢的操作

    這篇文章主要介紹了Java 判斷線程池所有任務(wù)是否執(zhí)行完畢的操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • 解析mybatis-plus中的resultMap簡單使用

    解析mybatis-plus中的resultMap簡單使用

    mybatis-plus也只是聽過,可是終究沒有使用過。于是自己花幾天晚上的時(shí)間研究mybatis-plus的使用。這篇文章主要介紹了mybatis-plus的resultMap簡單使用,需要的朋友可以參考下
    2021-11-11
  • SpringCloud集成zookeeper實(shí)現(xiàn)服務(wù)注冊并訪問功能

    SpringCloud集成zookeeper實(shí)現(xiàn)服務(wù)注冊并訪問功能

    zookeeper和eureka一樣,是用于充當(dāng)服務(wù)注冊功能服務(wù)器的一個(gè)springcloud插件,這篇文章主要介紹了SpringCloud集成zookeeper實(shí)現(xiàn)服務(wù)注冊并訪問,需要的朋友可以參考下
    2022-06-06
  • 詳解SpringBoot如何創(chuàng)建自定義Starter

    詳解SpringBoot如何創(chuàng)建自定義Starter

    Spring Boot的自動(dòng)配置機(jī)制為開發(fā)人員提供了一種輕松集成和配置各種功能的便捷方式,本文將深入探討在Spring Boot中如何創(chuàng)建自定義Starter,為構(gòu)建模塊化且易維護(hù)的應(yīng)用提供有力的支持,需要的朋友可以參考下
    2024-02-02
  • 高內(nèi)聚低耦合原則_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    高內(nèi)聚低耦合原則_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    耦合度就是某模塊(類)與其它模塊(類)之間的關(guān)聯(lián)、感知和依賴的程度,是衡量代碼獨(dú)立性的一個(gè)指標(biāo),也是軟件工程設(shè)計(jì)及編碼質(zhì)量評價(jià)的一個(gè)標(biāo)準(zhǔn)
    2017-08-08
  • springboot中將日志信息存儲在catalina.base中過程解析

    springboot中將日志信息存儲在catalina.base中過程解析

    這篇文章主要介紹了springboot中將日志信息存儲在catalina.base中過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-09-09

最新評論

成安县| 中超| 苗栗市| 九江市| 容城县| 扎囊县| 苍梧县| 瑞安市| 遵义市| 康马县| 溧阳市| 商河县| 夹江县| 平陆县| 古田县| 繁昌县| 张家港市| 秦安县| 邯郸市| 扶风县| 嫩江县| 芜湖市| 新化县| 桐庐县| 安阳县| 盐城市| 抚州市| 临沭县| 江都市| 永寿县| 平舆县| 肃宁县| 唐海县| 麻城市| 洮南市| 山西省| 平武县| 黎城县| 工布江达县| 招远市| 宣化县|