基于javaweb+jsp的大学生个人财务记账系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

技术框架

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap

基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

登录、注册、退出、用户模块、公告模块、收入模块、支出模块的增删改查管理

java 财务月结操作_ico

<div class="field field-icon-right">
                                <input type="password" class="input input-big" name="password" id="password" placeholder="登录密码"/>
                                <span class="icon icon-key margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="password" class="input input-big" name="password2" id="password2" placeholder="确认密码"/>
                                <span class="icon icon-key margin-small"></span>
                            </div>
                        </div>
                    </div>
                    <div style="padding:30px;">
                        <input type="submit" class="button button-block bg-main text-big input-big" value="注册">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<if test ='noticeType != null'>#{noticeType},</if>
                    <if test ='createDate != null'>#{createDate}</if>
        </trim>
    </insert>

    <!--批量删除-->
    <delete id="doRemoveBatch" parameterType="java.util.Collection">
        DELETE FROM `t_notice` WHERE `id` IN
        <foreach collection="list" item="id" separator="," open="(" close=")">
            #{id}
        </foreach>
    </delete>

    <!--修改-->
    <update id="doUpdate" parameterType="com.demo.vo.Notice">
        UPDATE `t_notice`
        <set>
                <if test ='id != null'>`id` = #{id},</if>
                <if test ='noticeName != null'>`notice_name` = #{noticeName},</if>
                <if test ='noticeText != null'>`notice_text` = #{noticeText},</if>
                <if test ='noticeType != null'>`notice_type` = #{noticeType},</if>
                <if test ='createDate != null'>`create_date` = #{createDate}</if>
        </set>
if (!Character.isLetterOrDigit(c)) {
                if (!isChinese(c)) {
                    count = count + 1;
                }
                chLength++;
            }
        }
        return count / chLength > 0.4;
    }

    /**
     * 为防止页面传进来的内容因为编码不同等原因造成乱码,这里作统一的转换
     *
     * @param parameterName
if (!loginUser.getPassword().equals(oldPassword)) {
            msg = "原密码错误!";
        } else {
            String newPassword = Util.decode(request, "newPassword");
            loginUser.setPassword(newPassword);
            this.userService.update(loginUser);
            msg = "修改成功!";
        }
        request.getSession().setAttribute("alert_msg", msg);
        request.getRequestDispatcher("reset_password.jsp").forward(request, response);
    }

    // 返回一个随机颜色(Color对象)
    private Color getRandomColor(int minColor, int maxColor) {
        Random random = new Random();
count = count + 1;
                }
                chLength++;
            }
        }
        return count / chLength > 0.4;
    }

    /**
     * 为防止页面传进来的内容因为编码不同等原因造成乱码,这里作统一的转换
     *
     * @param parameterName
     * @return
     */
    public static String decode(javax.servlet.http.HttpServletRequest request, String parameterName) {
        String str;
        if ((str = request.getParameter(parameterName)) == null) {
            return null;
        }
        try {
            if (isMessyCode(str)) {
                str = new String(str.getBytes("ISO-8859-1"), "UTF-8");
            }
            if (isMessyCode(str)) {
private int pageSize;//每页显示的数据条数。
    //需要计算得来
    private int totalPage;    //总页数,通过totalRecord和pageSize计算可以得来
    //开始索引,也就是我们在数据库中要从第几行数据开始拿,有了startIndex和pageSize,
    //就知道了limit语句的两个数据,就能获得每页需要显示的数据了
    private int startIndex;
    //分页显示的页数,比如在页面上显示1,2,3,4,5页,start就为1,end就为5,这个也是算过来的
    private int start;
    private int end;

    private String servlet;//查询时要请求的接口
    private String searchColumn;//待模糊查询的列
    private String keyword;//待模糊查询的关键字

    //通过pageNum,pageSize,totalRecord计算得来tatalPage和startIndex,构造方法中将pageNum,pageSize,totalRecord获得
    public PageBean(int pageNum, int totalRecord) {
        this.pageNum = (pageNum = Math.max(pageNum, 1));
        this.pageSize = 10;//默认为10
        this.totalRecord = totalRecord;
        //totalPage 总页数
        if (totalRecord % pageSize == 0) {
response.sendRedirect("shouru_list.jsp");
    }
}
package com.demo.controller;

import com.demo.util.Util;
import com.demo.service.ZhichuService;
import com.demo.vo.Zhichu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
UPDATE `t_user`
        <set>
                <if test ='id != null'>`id` = #{id},</if>
                <if test ='username != null'>`username` = #{username},</if>
                <if test ='password != null'>`password` = #{password},</if>
                <if test ='realName != null'>`real_name` = #{realName},</if>
                <if test ='userSex != null'>`user_sex` = #{userSex},</if>
                <if test ='userPhone != null'>`user_phone` = #{userPhone},</if>
                <if test ='userText != null'>`user_text` = #{userText},</if>
                <if test ='userType != null'>`user_type` = #{userType}</if>
        </set>
        WHERE `id` = #{id}
    </update>

    <!--获取-->
    <select id="findById" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM `t_user` WHERE `id` = #{id}
    </select>

    <!--列表-->
    <select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
Integer totalRecord = (Integer) map.get("totalCount");//根据查询条件取出对应的总记录数,用于分页
        String pageNum = Util.decode(request, "pageNum");//封装分页参数
        com.demo.util.PageBean<Object> pb = new com.demo.util.PageBean(Integer.valueOf(pageNum != null ? pageNum : "1"), totalRecord);
        params.put("startIndex", pb.getStartIndex());
        params.put("pageSize", pb.getPageSize());
        List list = (List) shouruService.list(params).get("list");//根据分页参数startIndex、pageSize查询出来的最终结果list
        pb.setServlet("shouruList");
        pb.setSearchColumn(searchColumn);
        pb.setKeyword(keyword);
        pb.setList(list);
        request.getSession().setAttribute("pageBean", pb);
        request.getSession().setAttribute("list", pb.getList());

        response.sendRedirect("shouru_list.jsp");
    }
}
package com.demo.controller;

import com.demo.util.Util;
import com.demo.service.ZhichuService;
import com.demo.vo.Zhichu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
vo.setUsername(Util.decode(request, "username"));
        vo.setPassword(Util.decode(request, "password"));
        vo.setRealName(Util.decode(request, "realName"));
        vo.setUserSex(Util.decode(request, "userSex"));
        vo.setUserPhone(Util.decode(request, "userPhone"));
        vo.setUserText(Util.decode(request, "userText"));
        vo.setUserType(Util.decode(request, "userType"));
        //调用Service层的增加(insert)方法
        userService.insert(vo);
        this.redirectList(request, response);
    }

    /**
     * 删除用户
     *
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping("userDelete")
    public void delete(HttpServletResponse response, HttpServletRequest request) throws IOException {
        Serializable id = Util.decode(request, "id");
vo.setShouruFangshi(Util.decode(request, "shouruFangshi"));
        vo.setShouruTime(Util.decode(request, "shouruTime"));
        vo.setShouruText(Util.decode(request, "shouruText"));
        shouruService.update(vo);
        this.redirectList(request, response);
    }

    /**
     * 获取收入的详细信息(详情页面与编辑页面要显示该收入的详情)并跳转回页面
     *
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping({"shouruGet", "shouruEditPre"})
return true;
    }
</script>
</html>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>用户添加</title>
    <%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
    <ul class="nav nav-tabs">
        <li><a href="userList?">用户列表</a></li>
        <li class="active"><a href="#">添加</a></li>
    </ul>
    <br/>
    <form class="form-horizontal" role="form" action="userAdd" method="post" onsubmit="return check()">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户名:</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="username" name="username">
            </div>
        </div>
//已知数据
    private int pageNum;//当前页,从请求那边传过来。
    private int pageSize;//每页显示的数据条数。
    //需要计算得来
    private int totalPage;    //总页数,通过totalRecord和pageSize计算可以得来
    //开始索引,也就是我们在数据库中要从第几行数据开始拿,有了startIndex和pageSize,
    //就知道了limit语句的两个数据,就能获得每页需要显示的数据了
    private int startIndex;
    //分页显示的页数,比如在页面上显示1,2,3,4,5页,start就为1,end就为5,这个也是算过来的
    private int start;
    private int end;

    private String servlet;//查询时要请求的接口
    private String searchColumn;//待模糊查询的列
    private String keyword;//待模糊查询的关键字

    //通过pageNum,pageSize,totalRecord计算得来tatalPage和startIndex,构造方法中将pageNum,pageSize,totalRecord获得
    public PageBean(int pageNum, int totalRecord) {
        this.pageNum = (pageNum = Math.max(pageNum, 1));
        this.pageSize = 10;//默认为10
        this.totalRecord = totalRecord;
*
     * @param c
     * @return
     */
    private static boolean isChinese(char c) {
        Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
        return (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
                || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
                || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
                || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
                || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS);
    }

    /**
     * 判断字符串是否是乱码
     *
     * @param strName
     * @return
     */
    public static boolean isMessyCode(String strName) {
        java.util.regex.Pattern p = java.util.regex.Pattern.compile("\\s*|\t*|\r*|\n*");
        java.util.regex.Matcher m = p.matcher(strName);
import com.demo.service.ShouruService;
import com.demo.vo.Shouru;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping
public class ShouruController {

    @Autowired
    private ShouruService shouruService;

    /**
     * 增加收入
     *

java 财务月结操作_java 财务月结操作_02


java 财务月结操作_java_03


java 财务月结操作_java_04


java 财务月结操作_java_05


java 财务月结操作_java_06


java 财务月结操作_spring_07


java 财务月结操作_ico_08


java 财务月结操作_mysql_09


java 财务月结操作_mysql_10


java 财务月结操作_ico_11


java 财务月结操作_java 财务月结操作_12


java 财务月结操作_spring_13


java 财务月结操作_spring_14


java 财务月结操作_java_15