自用 java web 学生管理系统项目记录

声明:

本文章主要是为了记录开发的代码与开发的过程遇到的问题,没有注释只适合自己使用。

项目使用的主要是javaweb技术开发,前端使用html,css,js设计,并且有一部分的响应式。

数据库方面使用简单能懂的mysql进行建立,表跟表之间的关系较为简单,数据库连接方面使用c3p0进行,开发平台是windows,开发工具为idea。

该项目本人担当前后端的设计,数据库设计,其他功能并非由本人开发所以在这边只讲述自己的部分开发过程且不讲述所有的代码,但原代码在文章最下面也有给出。

再次声明本文章所有代码均由学生开发,不具备上线的规范,如果需要使用时千万注意!!

数据库的连接设置(c3p0需要自行获取):

<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
	<default-config>
		<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
		<property name="jdbcUrl">jdbc:mysql://localhost:3306/astu?useSSL=false&amp;serverTimezone=Asia/Shanghai&amp;characterEncoding=utf-8&amp;autoReconnect=true</property>
		<property name="user"></property>
		<property name="password"></property>
		<property name="acquireIncrement">10</property>
		<property name="initialPoolSize">10</property>
		<property name="maxPoolSize">100</property>
		<property name="maxIdleTime">60</property>
		<property name="minPoolSize">5</property>
	</default-config>
</c3p0-config>

这边需要注意的是端口号与数据库的密码是根据开发的设备进行更改。

前端设计代码:

1、登录页面

登录页面基础代码
<%--
  Created by IntelliJ IDEA.
  User: l'l
  Date: 2023/9/6
  Time: 17:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>

<%--    <link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/bootstrap.min.css">--%>
    <link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/Login.css">
<%--    <link href="https://fonts.googleapis.com/css?family=Poppins:600&display=swap" rel="stylesheet">--%>
    <script src="https://kit.fontawesome.com/a81368914c.js"></script>

</head>
<body>
<img src="Bootstrap/bootstrap/img/sky.png" class="wave">
<div class="container">
    <div class="img">
        <img src="Bootstrap/bootstrap/img/Logo.png" alt="#">
    </div>
    <div class="login-content">
        <form action="userLogin" method="post" onclick="return checkLogin()">
            <h2 class="title">教&nbsp;学&nbsp;管&nbsp;理&nbsp;系&nbsp;统</h2><br>
                    <div class="input-div one">
                        <div class="i">
                            <i class="fas fa-user"></i>
                        </div>
                        <div class="div">
                            <h5>账户</h5>
                            <input type="text" id="userAccount" name="userAccount" class="myText">
                        </div>
                    </div>
                    <div class="input-div pass">
                        <div class="i">
                            <i class="fas fa-lock"></i>
                        </div>
                        <div class="div">
                            <h5>密码</h5>
                            <input type="password" id="userPassword" name="userPassword" class="myText"><br><br><br>
                            <p style="color: #ff0000;font-size:10px" id="tip">${tip}</p>
                        </div>
                    </div><br>
                <input class="btn" type="submit" value="登录" onclick="tip()">
            <a href="#">忘记密码?</a>
        </form>
    </div>
</div>

<script src="Bootstrap/bootstrap/js/MyJs.js"></script>

</body>
</html>

<script>
    function checkLogin() {
    let userAccount = document.getElementById("userAccount").value;
    let userPassword = document.getElementById("userPassword").value;
        if(userAccount == null || userAccount.trim() == ""){
            document.getElementById("tip").innerHTML = "账户不能为空";
            return false;
        }
        if(userPassword == null || userPassword.trim()== ""){
            document.getElementById("tip").innerHTML = "密码不能为空";
            return false;
        }
        if(userAccount != null && userAccount.trim() != "" && userPassword != null && userPassword.trim() != ""){
            document.getElementById("tip").innerHTML = "";
            return true;
        }
    }
</script>
登录页面的css与js的设计代码
*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;

}

body{
    font-family: "poppins",sans-serif;
    overlow:hidden;
}
.wave{
    position: fixed;
    bottom: 0;
    left: 0;
    height: 120%;
    z-index: -1;
}
.container{
    /*vw,vh 表示按照不同窗口等比例大小*/
    width: 100vw;
    height: 100vh;
    /*网格布局*/
    display:grid;
    grid-template-columns: repeat(2,1fr);
    grid-gap: 7rem;
    padding: 0 2rem;
}
.img{
    display: flex;
    justify-content: flex-end;
    align-items: center;
    color: black;
}
.login-content{

    display: flex;
    justify-content: flex-start;
    align-items: center;
    text-align: center;


}
.img img{
    width: 500px;
}

form{
    width: 360px;
}
.login-content img{
    height: 100px;
}
.login-content h2{
    margin: 15px 0;
    color: black;
    text-transform: uppercase;
    font-size: 2.9rem;
}
.login-content .input-div{
     position: relative;
     display: grid;
     grid-template-columns: 7% 93%;
     margin: 25px 0;
     padding: 5px 0;
     border-bottom: 2px solid #d9d9d9;
 }
.content .input-div.one{
    margin-top: 0;
}
.i{
    color: #d9d9d9;
    display: flex;
    justify-content: center;
    align-items: center;
}
.i i{
    transition: .3s;
}
.input-div > div{
    position: relative;
    height: 45px;
}
.input-div > div > h5{

    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
    transition: .3s;
}

.input-div::before , .input-div::after{
    content: "";
    position: absolute;
    bottom: -2px;
    width: 0%;
    height: 2px;
    background-color: #1890ff;
    transition: .3s;
}

.input-div::before{
    right: 50%;
}

.input-div::after{
    left: 50%;
}

.input-div.focus::before , .input-div.focus::after{

    width: 50%;

}

.input-div.focus > div > h5{

    top:-5px;
    font-size: 15px;

}

.input-div.focus > .i > i{

    color: #1890ff;

}

.input-div > div > input{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding:0.5rem 0.7rem;
    background: none;
    font-size: 1.2rem;
    font-family: 'position',sans-serif;
}
.input-div.pass{
    margin-bottom: 4px;
}
a{
    display: block;
    text-align: right;
    text-decoration: none;
    color: #999;
    font-size: 0.9rem;
    transition: .2s;
}
a:hover{
    color:#1890ff;
}
.btn{
    display: block;
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: none;
    outline: none;
    background-image: linear-gradient(to right,#ffa116,#ffc123);
    background-size: 200%;
    font-size: 1.2rem;
    font-family: 'Poppins' , sans-serif;
    text-transform: uppercase;
    cursor: pointer;
    margin:1rem 0;
    transition: .3s;

}
.btn:hover{
    background-position: right;
}

#tip{
    position: absolute;
    margin-left: -20px;
}
@media screen and(max-width:1000px){
    form{
        width: 290px;
    }
    .login-content h2{
        font-size:2.4rem;
        margin:8px 0;
    }
    .img img{
         width: 400px;
     }
}
@media screen and (max-width: 900px){
    .container{
        grid-template-columns: 1fr;
    }
    .login-content{
        justify-content:center;
    }
    .img{
         display: none;
     }
}

@media (max-width: 768px) {
    .searchForm{
        display: none;
    }

    .myLogin{
        float: right;
        position: absolute;
        top: 0;
        left: 60%;
        margin-left: 6px;
    }
    .myLogin li{
        float: left;
    }
    .myLogin li a{
        font-size: 1em;
        padding: 10px 6px;
    }


}

其他页面的css代码与js不再给出。

2、主页面

主页面基础代码
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/bootstrap.min.css">
<%--    <link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/Login.css">--%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <link href="${pageContext.request.contextPath}/Bootstrap/bootstrap/css/css.css" rel="stylesheet" media="screen">
</head>
<body>

    <jsp:include page="${mainTop=null?'daoHang.jsp':mainTop}"></jsp:include>

<br><br><br><br>

    <jsp:include page="${mainRignt=null?'blank.jsp':mainRignt}"></jsp:include>

    <jsp:include page="${mainSign=null?'stuSign.jsp':mainSign}"></jsp:include>


<script src="Bootstrap/bootstrap/js/jquery/jquery-3.4.1.js"></script>
<script src="Bootstrap/bootstrap/js/jquery/jquery-3.4.1.min.js"></script>
<script src="Bootstrap/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

这边使用的是c标签把需要的盒子进行不同页面的分离。

导航盒子
<%--
  Created by IntelliJ IDEA.
  User: l'l
  Date: 2023/9/16
  Time: 0:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>Title</title>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <script src="https://kit.fontawesome.com/a81368914c.js"></script>
  </head>
  <body>
  <header>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid" style="background-color:#282828">
        <a class="navbar-brand" href="common.action?action=index" style="margin: 0 0;padding: 0 0;">
          <img src="Bootstrap/bootstrap/img/Logo.png" style="width: 140px" height="50px" alt="LOGO"/>
        </a>
        <div class="navbar-header">
          <!-- 缩小屏幕后显示出的按钮 -->
          <button class="navbar-toggle navbar-right" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="icon-bar"> </span>
            <span class="icon-bar"> </span>
            <span class="icon-bar"> </span>
            <span class="icon-bar"> </span>
          </button>
        </div>
        <!-- 屏幕小于768px时默认隐藏,点击按钮后打开 -->
        <div class="collapse navbar-collapse navbar-left"  >
          <c:if test="${session_person.userIdentify == 0}">
            <ul class="nav navbar-nav">
              <li><a href="#">进入课堂</a></li>
              <li><a href="#">查看老师</a></li>
              <li><a href="#">查看作业</a></li>
              <li><a href="chat.html">查看提问</a></li>
              <li><a href="#">个人中心</a></li>
            </ul>
          </c:if>
          <c:if test="${session_person.userIdentify == 1}">
            <ul class="nav navbar-nav">
              <li><a href="#">进入课堂</a></li>
              <li><a href="tea.action?action=goMyStu">学生管理</a></li>
              <li><a href="tea.action?action=goMyEval">我的评价</a></li>
              <li><a href="tea.action?action=goAddEval">评价学生</a></li>
              <li><a href="#">课堂提问</a></li>
              <li><a href="#">个人中心</a></li>
            </ul>
          </c:if>
          <c:if test="${session_person.userIdentify == 2}">
            <ul class="nav navbar-nav">
              <li><a href="#">老师管理</a></li>
              <li><a href="man.action?action=list">学员管理</a></li>
              <li><a href="#">课程查看</a></li>
              <li><a href="#">任务管理</a></li>
              <li><a href="#">个人中心</a></li>
            </ul>
          </c:if>

        </div>
        <ul class="nav navbar-nav navbar-right myLogin" style="margin-right: 1vw">
          <li><a href="outLogin" class="fas fa-sign-out-alt"> 退出登录 </a></li>
        </ul>

      </div>
    </nav>
  </header>
  </body>
</html>
<style>
  @media (max-width: 768px) {

    .myLogin{
      float: right;
      position: absolute;
      top: 0;
      left: 60%;
      margin-left: 6px;
    }
    .myLogin li{
      float: left;

    }
    .myLogin li a{
      font-size: 1em;
      padding: 10px 6px;
    }

  }
</style>
<script>
  // function Exit_login(){
  //   alert("确认退出?")
  // }
</script>
文本盒子
<%--
  Created by IntelliJ IDEA.
  User: l'l
  Date: 2023/9/10
  Time: 18:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/bootstrap.min.css">
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <title>Title</title>
</head>
<body class="container">

<c:if test="${session_person.userIdentify == 0}">

    <h1><span>你好!${session_person.userName}学生。</span></h1>

</c:if>

<c:if test="${session_person.userIdentify == 1}">

    <h1><span>你好!${session_person.userName}老师。</span></h1>

</c:if>

<c:if test="${session_person.userIdentify == 2}">

    <h1><span>你好!${session_person.userName}辅导员。</span></h1>

</c:if>

</body>
<script type="text/javascript">


</script>
</html>




提示小窗口盒子
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" type="text/css" href="Bootstrap/bootstrap/css/sign.css">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="https://kit.fontawesome.com/a81368914c.js"></script>
<html>
<head>
    <title>学生签到</title>
</head>
<body>
<div class="baowei">
    <form action="stu.action?action=stuSign" method="post">
        <div class="kaoqinbiao">
            <c:if test="${session_person.userIdentify == 0}">
                <div class="kaoqin">考勤</div>
            </c:if>
            <c:if test="${session_person.userIdentify == 1}">
                <div class="kaoqin">课堂</div>
            </c:if>
        </div>
        <div class="qiandaobiao">
            <c:if test="${session_person.userIdentify == 0}">
                <div id="qiandao"><input class="btn" type="submit" value="签到" onclick="tip()"></div>
                <div id="xiangqing"><input class="btn" type="submit" value="详情" onclick="tip_l()"></div>
            </c:if>
            <c:if test="${session_person.userIdentify == 1}">
                <a href="#" style="text-decoration: none" id="ketang">进入课堂</a>
            </c:if>
        </div>
    </form>
<%--    <span style="margin-left: 50px;font-size: 15px;color: red">${tip}</span>--%>

</div>
<script type="text/javascript">

    function tip() {

        var AA = new Date();
        var miao = AA.getMinutes()
        if(miao < 10){
            alert("于 "+AA.getHours()+ " : " + "0" + miao+" 发起签到,点击详情查看签到情况");
        }else{
            alert("于 "+AA.getHours() + " : " + miao+" 发起签到,点击详情查看签到情况");
        }
    }
    function tip_l(){

        alert("${tip}")
    }

</script>
</body>
</html>

后端逻辑代码

登录逻辑代码

package cm.stu.servlet;

import cm.stu.bean.Person;
import cm.stu.service.UserLoginService;
import cm.stu.service.UserLoginServiceImpl;
import cm.stu.util.Test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/userLogin")
public class UserLoginServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
//        把前端数据传递数值到到后端
        String userAccount = req.getParameter("userAccount");
        String userPassword = req.getParameter("userPassword");
        Person person = new Person(userAccount,userPassword);
        UserLoginService ul = new UserLoginServiceImpl();
        Person newPerson = ul.getLogin(person);
        String date = Test.getDate();
        String time = Test.getBlank();
        req.setAttribute("say",""+time+"");
        req.setAttribute("date",""+date+"");
//        进行比较 .equals比较字符串 ==比较内存地址

        if(newPerson != null){

            HttpSession session = req.getSession();
            session.setAttribute("session_person",newPerson);

            req.setAttribute("mainTop","daoHang.jsp");
            //不用进行操作,直接进入主页面
            req.setAttribute("mainRignt","blank.jsp");
            req.setAttribute("mainSign","stuSign.jsp");
            req.getRequestDispatcher("main.jsp").forward(req,resp);

        }
        else{
            //错误的话就一直返回登录页面
            req.setAttribute("tip","账户或密码错误");
            req.getRequestDispatcher("userLogin.jsp").forward(req,resp);

        }




    }
}

持久层代码:

package cm.stu.dao;

import cm.stu.bean.Person;
import cm.stu.util.ConnectionFactory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserLoginDaoImpl implements UserLoginDao{
    @Override
    public Person getLogin(Person person) {
        String sql ="select * from person where userAccount='" + person.getUserAccount() + "' and userPassword= '"+person.getUserPassword()+"'";
        Connection connection= ConnectionFactory.getConnection();
        PreparedStatement pre = null;
        ResultSet res =null;
        Person newPerson =null;
        try{
            pre = connection.prepareStatement(sql);
            res = pre.executeQuery();
            while(res.next()){
                newPerson = new Person();
//`userAccount``userName``userSex``userBirthday``userIdCard``userPassword``userIdentify``userOtherName`
                newPerson.setUserAccount(res.getString("userAccount"));
                newPerson.setUserName(res.getString("userName"));
                newPerson.setUserSex(res.getString("userSex"));
                newPerson.setUserBirthday(res.getString("userBirthday"));
                newPerson.setUserIdCard(res.getString("userIdCard"));
                newPerson.setUserPassword(res.getString("userPassword"));
                newPerson.setUserIdentify(res.getInt("userIdentify"));
                newPerson.setUserOtherName(res.getString("userOtherName"));

            }

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {

        }

        return newPerson;

    }
}

学生签到逻辑代码

package cm.stu.servlet;

import cm.stu.bean.Person;
import cm.stu.util.Test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/stu.action")
public class StudentServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String action = req.getParameter("action");
        Person person = (Person)req.getSession().getAttribute("session_person");
        String userAccount = person.getUserAccount();
        String date = Test.getDate();
        int sign = Test.getSign(date,userAccount);
            System.out.println("你好");
        if(action.equals("stuSign")){

            int SiDa = Test.ju_sign(date,userAccount,sign);

            if(SiDa==0){

                req.setAttribute("tip","没有签到记录,签到成功");

            }else if(SiDa == 1){

                req.setAttribute("tip","已有签到记录,请不要重复签到 签到日期:"+ date +"");

            }else if(SiDa == 2){

                req.setAttribute("tip","你的签到时间已经晚五分钟,视为迟到,请联系老师进行处理");

            }else if(SiDa == 3){

                req.setAttribute("tip","你的签到时间已经晚三十分钟,视为为旷课,请联系老师进行处理");

            }else if(SiDa == 4){

                req.setAttribute("tip","请在有课的时间签到");

            }else{

                req.setAttribute("tip","请在上课时间签到");

            }
        }
        req.setAttribute("mainRignt","blank.jsp");
        req.setAttribute("mainTop","daoHang.jsp");
        req.setAttribute("mainSign","stuSign.jsp");
        req.getRequestDispatcher("main.jsp").forward(req,resp);
    }
}

持久层代码:
package cm.stu.util;

import cm.stu.dao.CeCur;
import cm.stu.dao.Deal;
import cm.stu.dao.L_Eval;
import cm.stu.service.TeacherService;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.time.LocalTime;

public class Test {


    public static void main(String[] args) {



//        String userAccount = "12345678";
//
//        String teacherAccount = "12365192";
//
//        String date = "2023-12-15";
//
//        int cur = 1;
//
//        System.out.println(L_Eval.getAllMyEval(userAccount,date,cur,teacherAccount));


//        String curSign_1 = " ";
//        String curSign_2 = " ";
//        String curSign_3 = " ";
//        String curSign_4 = " ";
//        String curSign_5 = " ";
//        String curSign_6 = " ";
//        String curSign_7 = " ";
//        String curSign_8 = " ";

//        if(c == 11111111){
//            System.out.println("全部课程已签到");
//        }else if(c == 0){
//            System.out.println("全部课程都未签到");
//        }else{
//            if(c % 10 == 1){
//                curSign_1 = "第1节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_2 = "第2节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_3 = "第3节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_4= "第4节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_5 = "第5节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_6 = "第6节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_7 = "第7节课已签到";
//            }c = c / 10;
//            if(c % 10== 1){
//                curSign_8 = "第8节课已签到";
//            };
//            System.out.println(curSign_1);
//            System.out.println(curSign_2);
//            System.out.println(curSign_3);
//            System.out.println(curSign_4);
//            System.out.println(curSign_5);
//            System.out.println(curSign_6);
//            System.out.println(curSign_7);
//            System.out.println(curSign_8);
//        }


    }

    private static String getCurNull(int num, String date) {

        return CeCur.getCurNull(num,date);

    }

    private static int ju_signLate(double count,String UserAccount,String date,int Sign) {

        LocalTime nowtTime = LocalTime.now();

        LocalTime cur_1 = LocalTime.of(8, 10, 0);
        LocalTime cur_2 = LocalTime.of(9, 5, 0);
        LocalTime cur_3 = LocalTime.of(10, 10, 0);
        LocalTime cur_4 = LocalTime.of(11, 5, 0);
        LocalTime cur_5 = LocalTime.of(14, 30, 0);
        LocalTime cur_6 = LocalTime.of(15, 25, 0);
        LocalTime cur_7 = LocalTime.of(16, 20, 0);
        LocalTime cur_8 = LocalTime.of(17, 15, 0);

        LocalTime cur_e1 = LocalTime.of(8, 55, 0);
        LocalTime cur_e2 = LocalTime.of(9, 50, 0);
        LocalTime cur_e3 = LocalTime.of(10, 55, 0);
        LocalTime cur_e4 = LocalTime.of(11, 50, 0);
        LocalTime cur_e5 = LocalTime.of(15, 15, 0);
        LocalTime cur_e6 = LocalTime.of(16, 10, 0);
        LocalTime cur_e7 = LocalTime.of(17, 5, 0);
        LocalTime cur_e8 = LocalTime.of(18, 0, 0);

        LocalTime cur = LocalTime.of(0, 0, 0);
        LocalTime cur_e = LocalTime.of(0, 0, 0);

        if (nowtTime.isAfter(cur_1) && nowtTime.isBefore(cur_e1)) {
            System.out.println("第1节课");
            cur = cur_1;
            cur_e = cur_e1;
            count += 1;
            if(Test.getCurNull((int)count, date)==null) {

                return 4;

            }
        } else if (nowtTime.isAfter(cur_2) && nowtTime.isBefore(cur_e2)) {
            System.out.println("第2节课");
            cur = cur_2;
            cur_e = cur_e2;
            count += 2;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_3) && nowtTime.isBefore(cur_e3)) {
            System.out.println("第3节课");
            cur = cur_3;
            cur_e = cur_e3;
            count += 3;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_4) && nowtTime.isBefore(cur_e4)) {
            System.out.println("第4节课");
            cur = cur_4;
            cur_e = cur_e4;
            count += 4;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_5) && nowtTime.isBefore(cur_e5)) {
            System.out.println("第5节课");
            cur = cur_5;
            cur_e = cur_e5;
            count += 5;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_6) && nowtTime.isBefore(cur_e6)) {
            System.out.println("第6节课");
            cur = cur_6;
            cur_e = cur_e6;
            count += 6;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_7) && nowtTime.isBefore(cur_e7)) {
            System.out.println("第7节课");
            cur = cur_7;
            cur_e = cur_e7;
            count += 7;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else if (nowtTime.isAfter(cur_8) && nowtTime.isBefore(cur_e8)) {
            System.out.println("第8节课");
            cur = cur_8;
            cur_e = cur_e8;
            count += 8;
            if(Test.getCurNull((int)count, date)==null) {
                return 4;
            }
        } else {
            System.out.println("请在上课时间签到!");
            return 5;
        }

        double num_c = Math.pow(10, count-1);

        if (num_c <= Sign) {

            return 1;

        } else {

            int num = Test.ju_signLate(cur, cur_e, nowtTime, UserAccount, date, Sign, num_c);

            if (num == 3) {

                return 3;

            } else if (num == 2) {

                return 2;

            } else {

                return 0;

            }

        }
    }

    private static int ju_signLate(LocalTime cur, LocalTime cur_e, LocalTime nowtTime, String UserAccount, String date, int Sign, double num_c){

        if(nowtTime.isAfter(cur.plusMinutes(30))&&nowtTime.isBefore(cur_e)){

            System.out.println("旷课处理");
            num_c *= 3;
            num_c += Sign;
            CeCur.changeSign(num_c,UserAccount,date);
            return 3;


        } else if (nowtTime.isAfter(cur.plusMinutes(5))&&nowtTime.isBefore(cur_e)){

            System.out.println("迟到处理");
            num_c *= 2;
            num_c += Sign;
            CeCur.changeSign(num_c,UserAccount,date);
            return 2;

        }else{

            System.out.println("正常签到");
            num_c += Sign;
            CeCur.changeSign(num_c,UserAccount,date);
            return 0;

        }
    }


    public static String getDate() {

        Date t_date = new Date(System.currentTimeMillis());
        SimpleDateFormat sdt = new SimpleDateFormat(" yyyy-MM-dd");
        return sdt.format(t_date);

    }

    public static int ju_sign(String date, String userAccount, int sign) {

        double count = 0;

        int SiDa = Test.ju_signLate(count,userAccount,date,sign);

        return SiDa;

    }
    public static int getSign(String date, String userAccount) {

        int sign = Deal.getSign(date,userAccount);

        return sign;
    }

    public static String getBlank() {

        LocalTime cur_mo = LocalTime.of(5, 0, 0);
        LocalTime cur_no = LocalTime.of(11, 0, 0);
        LocalTime cur_af = LocalTime.of(13, 0, 0);
        LocalTime cur_ni = LocalTime.of(17, 0,0);
        LocalTime cur_we = LocalTime.of(0, 0,0);

        if((LocalTime.now().isAfter(cur_mo) && LocalTime.now().isBefore(cur_no))){

            return "早上好 ";

        }else if((LocalTime.now().isAfter(cur_no) && LocalTime.now().isBefore(cur_af))){

            return "中午好 ";

        }else if((LocalTime.now().isAfter(cur_af) && LocalTime.now().isBefore(cur_ni))){

            return "下午好 ";

        }else if((LocalTime.now().isAfter(cur_ni) && LocalTime.now().isBefore(cur_we))){

            return "晚上好 ";

        }else{

            return "凌晨好";

        }
    }
}



页面图片详解

登录页面

登录失败会提示并返回登录页面

具有一部分响应式

主页面

其他的还有很多功能跟代码就不一一赘述了,这边直接把源码发到这边自行提取。

代码:mStu.zip - 蓝奏云

数据库

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值