天天看點

學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼

學生選課系統 前後端分離 vue springboot

  • 系統描述
  • 一、系統功能
  • 二、系統截圖
    • 1.網絡爬蟲 新聞擷取代碼
    • 2.pom
  • 源碼

系統描述

基于spring boot vue的學生選課系統

前端:

Vue ElementUI axios

後端 springboot

持久層 mybatis Plus

會話 Spring Session +redis

日志 AOP MongoDB

資料庫 MySQL

Redis:session 新聞 配置資訊

MongoDB 業務日志

一、系統功能

學生 教師 管理者三種登入

利用網絡爬蟲 擷取網站新聞資訊 顯示在首頁

管理者登入:專業管理 班級管理 學生管理 教師管理 課程管理 選課管理 管理者管理

學生登入:選修課程 學生課程 課表查詢 考試查詢 成績查詢 資訊維護

教師登入:授課查詢 教師課表 成績錄入

二、系統截圖

學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼
學生選課系統 前後端分離 vue springboot系統描述一、系統功能二、系統截圖源碼

1.網絡爬蟲 新聞擷取代碼

代碼如下(示例):

package com.mecol.select_course.manager;

import com.mecol.select_course.dao.redis.SdnuNewsDAO;
import com.mecol.select_course.model.bo.SdnuNewsBO;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Component
public class SdnuNewsManager extends BaseManager {
    private static final int CRAWL_INTERVAL = 60 * 60 * 1000;
    private static final int CRAWL_TIMEOUT = 30 * 1000;
    private static final String CRAWL_TARGET_URL = "https://www.sdjtu.edu.cn/xxyw.htm";
    private static final String BASE_URL = "https://www.sdjtu.edu.cn/";

    private final SdnuNewsDAO sdnuNewsDAO;

    public SdnuNewsManager(SdnuNewsDAO sdnuNewsDAO) {
        this.sdnuNewsDAO = sdnuNewsDAO;
    }

    public List<SdnuNewsBO> getAllNews() {
        Map<String, String> map = sdnuNewsDAO.getAllNews();

        List<SdnuNewsBO> newsList = new ArrayList<>(map.size());
        for (String key : map.keySet()) {
            String value = map.get(key);
            // 2019/01/01http://host/path
            String date = value.substring(0, 10);
            String url = value.substring(10);
            newsList.add(new SdnuNewsBO(key, date, url));
        }

        return newsList;
    }
//定時任務 fixedDelay參數,傳入一個以毫秒為機關的時間間隔
    @Scheduled(fixedDelay = CRAWL_INTERVAL)
    public void crawlNews() {
        Document pageDoc = fetchPage();
        if (pageDoc == null) {
            return;
        }

        List<SdnuNewsBO> newsList = parseNews(pageDoc);
        sdnuNewsDAO.clear();
        for (SdnuNewsBO news : newsList) {
            sdnuNewsDAO.addNews(news.getTitle(), news.getDate() + news.getUrl());
        }
    }

    private Document fetchPage() {
        Document doc = null;
        try {
            doc = Jsoup.parse(new URL(CRAWL_TARGET_URL), CRAWL_TIMEOUT);
        } catch (IOException ex) {
            ex.printStackTrace();
        }

        return doc;
    }

    private List<SdnuNewsBO> parseNews(Document pageDoc) {
        /*
        Elements elements = pageDoc.body()
                .getElementsByClass("TB3").get(0)
                .getElementsByTag("table").get(0)
                .getElementsByTag("tr");*/
        Elements elements=pageDoc.body().getElementsByClass("news_list").select("li");
       // System.out.println(elements);

        List<SdnuNewsBO> newsList = new ArrayList<>();
        for (Element element : elements) {
           // System.out.println(element);
            //if (!element.attr("id").startsWith("line")) {
           //     continue;
           // }

           // Element aTag = element.getElementsByTag("a").get(0);
            //Element dateTag = element.getElementsByTag("td").get(2);
            String url = BASE_URL +element.getElementsByTag("a").attr("href");
            String title = element.getElementsByTag("a").attr("title");
            String date1 = element.getElementsByClass("left_date").text();
            String date=date1.substring(1,date1.length()-1);
           // System.out.println(date);
            newsList.add(new SdnuNewsBO(title, date, url));
        }

        return newsList;
    }
}

           

2.pom

代碼如下(示例):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.mecol</groupId>
    <artifactId>selectcourse</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>selectcourse</name>
    <description>selectcourse</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.12.1</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.3.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

           

源碼

https://pan.baidu.com/s/1-DKN_B9ifQ4VDmJV6gaS5Q?pwd=4785

提取碼:4785