基于java+springboot+vue的大学生考勤系统

🙊作者简介:多年编程开发经验,专注java技术领域和毕业设计项目实战,系统定制、远程部署调试、代码讲解、代码修改
🍅擅长语言:springboot、ssm、vue、html、jsp、php、python、爬虫、小程序、安卓app
⬇️源码获取:文末可以获取源码+数据库+文档

⚡感兴趣的可以先收藏+关注,后续会更新更多项目资料,所有项目均配有开发文档和安装配置教程

系统介绍

信息数据从传统到当代,是一直在变革当中,突如其来的互联网让传统的信息管理看到了革命性的曙光,因为传统信息管理从时效性,还是安全性,还是可操作性等各个方面来讲,遇到了互联网时代才发现能补上自古以来的短板,有效的提升管理的效率和业务水平。传统的管理模式,时间越久管理的内容越多,也需要更多的人来对数据进行整理,并且数据的汇总查询方面效率也是极其的低下,并且数据安全方面永远不会保证安全性能。结合数据内容管理的种种缺点,在互联网时代都可以得到有效的补充。结合先进的互联网技术,开发符合需求的软件,让数据内容管理不管是从录入的及时性,查看的及时性还是汇总分析的及时性,都能让正确率达到最高,管理更加的科学和便捷。

本次开发的大学生考勤系统实现了班级管理、成绩管理、字典管理、公告管理、老师管理、学生管理、学生考勤管理、学生考勤详情管理、学生请假管理、管理员管理等功能。系统用到了关系型数据库中王者MySql作为系统的数据库,有效的对数据进行安全的存储,有效的备份,对数据可靠性方面得到了保证。并且程序也具备程序需求的所有功能,使得操作性还是安全性都大大提高,让大学生考勤系统更能从理念走到现实,确确实实的让人们提升信息处理效率。

系统主要技术

开发语言:Java

使用框架:SpringBoot

系统架构:B/S

前端技术:Vue、JavaScript

数据库 :Mysql 5.7/8.0

编译工具:idea或者eclipse,jdk1.8,maven

系统功能结构设计

在管理员功能模块确下来的基础上,对管理员各个功能进行设计,确定管理员功能的详细模块。绘制的管理员功能结构见下图。

系统功能实现

5.1.1 学生考勤管理

此页面让管理员管理学生考勤的数据,学生考勤管理页面见下图。此页面主要实现学生考勤的增加、修改、删除、查看的功能。

图5-1 学生考勤管理页面

5.1.2 公告信息管理

公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。

图5.3 公告信息管理页面

5.1.3公告类型管理

公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。

图5.4 公告类型列表页面

5.1.4 学生请假管理

如图5.4显示的就是学生请假管理页面,此页面提供给管理员的功能有:新增学生请假,修改学生请假,删除学生请假。

图5.4学生请假管理页面

5.1.5 学生请假类型管理

如图5.5显示的就是学生请假类型管理页面,此页面提供给管理员的功能有:新增学生请假类型,修改学生请假类型,删除学生请假类型。

图5.5 学生请假类型管理页面

核心代码


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 学生考勤
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/xueshengKaoqin")
public class XueshengKaoqinController {
    private static final Logger logger = LoggerFactory.getLogger(XueshengKaoqinController.class);

    private static final String TABLE_NAME = "xueshengKaoqin";

    @Autowired
    private XueshengKaoqinService xueshengKaoqinService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private BanjiService banjiService;//班级
    @Autowired
    private ChengjiService chengjiService;//成绩
    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private LaoshiService laoshiService;//老师
    @Autowired
    private XueshengService xueshengService;//学生
    @Autowired
    private XueshengKaoqinListService xueshengKaoqinListService;//学生考勤详情
    @Autowired
    private XueshengqingjiaService xueshengqingjiaService;//学生请假
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("学生".equals(role))
            params.put("xueshengId",request.getSession().getAttribute("userId"));
        else if("老师".equals(role))
            params.put("laoshiId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = xueshengKaoqinService.queryPage(params);

        //字典表数据转换
        List<XueshengKaoqinView> list =(List<XueshengKaoqinView>)page.getList();
        for(XueshengKaoqinView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        XueshengKaoqinEntity xueshengKaoqin = xueshengKaoqinService.selectById(id);
        if(xueshengKaoqin !=null){
            //entity转view
            XueshengKaoqinView view = new XueshengKaoqinView();
            BeanUtils.copyProperties( xueshengKaoqin , view );//把实体数据重构到view中
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody XueshengKaoqinEntity xueshengKaoqin, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,xueshengKaoqin:{}",this.getClass().getName(),xueshengKaoqin.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<XueshengKaoqinEntity> queryWrapper = new EntityWrapper<XueshengKaoqinEntity>()
            .eq("xuesheng_kaoqin_name", xueshengKaoqin.getXueshengKaoqinName())
            .eq("xuesheng_kaoqin_types", xueshengKaoqin.getXueshengKaoqinTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XueshengKaoqinEntity xueshengKaoqinEntity = xueshengKaoqinService.selectOne(queryWrapper);
        if(xueshengKaoqinEntity==null){
            xueshengKaoqin.setInsertTime(new Date());
            xueshengKaoqin.setCreateTime(new Date());
            xueshengKaoqinService.insert(xueshengKaoqin);
            List<XueshengEntity> xueshengEntityList = xueshengService.selectList(new EntityWrapper<XueshengEntity>()
            );
            if(xueshengEntityList == null){
            return R.error("没有被考勤的人群,请核实后再添加");
            }
            List<XueshengKaoqinListEntity> xueshengKaoqinListList = new ArrayList<>();
            for(XueshengEntity x:xueshengEntityList){
                XueshengKaoqinListEntity xueshengKaoqinListEntity = new XueshengKaoqinListEntity();
                xueshengKaoqinListEntity.setXueshengId(x.getId());//注册表
                xueshengKaoqinListEntity.setXueshengKaoqinId(xueshengKaoqin.getId());//考勤表
                xueshengKaoqinListEntity.setXueshengKaoqinListTypes(1);
                xueshengKaoqinListEntity.setCreateTime(new Date());
                xueshengKaoqinListEntity.setInsertTime(new Date());
                xueshengKaoqinListList.add(xueshengKaoqinListEntity);

            }
            xueshengKaoqinListService.insertBatch(xueshengKaoqinListList);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody XueshengKaoqinEntity xueshengKaoqin, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,xueshengKaoqin:{}",this.getClass().getName(),xueshengKaoqin.toString());
        XueshengKaoqinEntity oldXueshengKaoqinEntity = xueshengKaoqinService.selectById(xueshengKaoqin.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(xueshengKaoqin.getXueshengKaoqinContent()) || "null".equals(xueshengKaoqin.getXueshengKaoqinContent())){
                xueshengKaoqin.setXueshengKaoqinContent(null);
        }

            xueshengKaoqinService.updateById(xueshengKaoqin);//根据id更新
            return R.ok();
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<XueshengKaoqinEntity> oldXueshengKaoqinList =xueshengKaoqinService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        xueshengKaoqinService.deleteBatchIds(Arrays.asList(ids));
        xueshengKaoqinListService.delete(new EntityWrapper<XueshengKaoqinListEntity>().in("xuesheng_kaoqin_id",ids));

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer xueshengId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<XueshengKaoqinEntity> xueshengKaoqinList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            XueshengKaoqinEntity xueshengKaoqinEntity = new XueshengKaoqinEntity();
//                            xueshengKaoqinEntity.setXueshengKaoqinUuidNumber(data.get(0));                    //考勤唯一编号 要改的
//                            xueshengKaoqinEntity.setXueshengKaoqinName(data.get(0));                    //考勤标题 要改的
//                            xueshengKaoqinEntity.setXueshengKaoqinTypes(Integer.valueOf(data.get(0)));   //学生考勤类型 要改的
//                            xueshengKaoqinEntity.setXueshengKaoqinContent("");//详情和图片
//                            xueshengKaoqinEntity.setInsertTime(date);//时间
//                            xueshengKaoqinEntity.setJiezhiTime(sdf.parse(data.get(0)));          //考勤截止时间 要改的
//                            xueshengKaoqinEntity.setCreateTime(date);//时间
                            xueshengKaoqinList.add(xueshengKaoqinEntity);


                            //把要查询是否重复的字段放入map中
                                //考勤唯一编号
                                if(seachFields.containsKey("xueshengKaoqinUuidNumber")){
                                    List<String> xueshengKaoqinUuidNumber = seachFields.get("xueshengKaoqinUuidNumber");
                                    xueshengKaoqinUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> xueshengKaoqinUuidNumber = new ArrayList<>();
                                    xueshengKaoqinUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("xueshengKaoqinUuidNumber",xueshengKaoqinUuidNumber);
                                }
                        }

                        //查询是否重复
                         //考勤唯一编号
                        List<XueshengKaoqinEntity> xueshengKaoqinEntities_xueshengKaoqinUuidNumber = xueshengKaoqinService.selectList(new EntityWrapper<XueshengKaoqinEntity>().in("xuesheng_kaoqin_uuid_number", seachFields.get("xueshengKaoqinUuidNumber")));
                        if(xueshengKaoqinEntities_xueshengKaoqinUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(XueshengKaoqinEntity s:xueshengKaoqinEntities_xueshengKaoqinUuidNumber){
                                repeatFields.add(s.getXueshengKaoqinUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [考勤唯一编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        xueshengKaoqinService.insertBatch(xueshengKaoqinList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




}

论文参考

本例是轻量急速的Java开源企业考勤系统ClockSimpleJEE4。 以下是他的Readme和Release Note Readme: ClockSimpleJEE4是开源企业考勤系统 用于Java,mysql学习。 所有程序在GPLv3条款下开源,关于GPLv3相关pdf已放置在doc子目录下。 数据库脚本在sql子目录下。请恢复名为clock的产品库和名为clock_test的测试库。 clock_test是用于单元测试的JUnit套件的测试空库。 请启动测试套件,享受104个测试方法编制的绵密的测试网。 doc下另有所有版本的release note bug报告jerry_shen_sjf@qq.com 用如下管理员登录 用户名:160208 密码:jerry 火鸟 2013.6.10 Release Note 本版本是ClockSimpleJEE4的预发布版本0.9.0 ClockSimpleJEE4是Java开源企业考勤系统。基于笔者PHP作品Clock Online System 本版本所有的亮点如下。 1)集成的一体化JUnit测试套件,共104个测试方法,编集为绵密的测试安全网。 2)JUnit单元测试黄金法则:在测试空库上无限次运行不出错。 3)测试并行系统:可以在正常工作时启动测试套件,测试套件任然使用测试空库, 而同时的正常操作使用产品库。 4)JUnit EE,可以使用Web界面运行JUnit测试套件。 5)优化的加班算法。9:00上班,但是工作日的计算是从7:00到次日的6:59:59 保证彻夜加班的码农们的利益。 6)报表自动化生成系统:所有的原始数据只有员工的打卡记录。所有的报表都是 算法生成的。 本软件还不完善,所以需要广泛的测试和反馈。希望读者不吝反馈。 作者:火鸟 jerry_shen_sjf@qq.com 2013.6.10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值