基于java+springboot+vue的工资信息管理系统

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

 

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

aa3588a1000f4cf5b0e616ade1d4a613.png

系统介绍

本系统的使用角色分为管理员和用户,管理员的功能包括部门管理,公告类型管理,津贴管理,绩效管理,员工考勤管理,职位管理,套账管理。用户具有注册、查看津贴信息、绩效信息,考勤信息,留言信息等功能。

文中重点介绍了宿舍报修管理的专业技术发展背景和发展状况,随后遵照软件传统式研发流程,最先挑选适用思维和语言软件开发平台,依据需求分析报告模块和设计数据库结构,再根据系统功能模块的设计制作系统功能模块图、流程表和E-R图。随后,设计架构,并依据设计架构编写代码,并实现系统的每个功能模块。最终,基本完成系统检测通常是系统测试、单元测试卷和功能测试。检测结果显示,该系统能够实现所需要的作用,工作状态没有明显缺陷。

系统主要技术

开发语言:Java

使用框架:SpringBoot

系统架构:B/S

前端技术:Vue、JavaScript

数据库 :Mysql 5.7/8.0

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

系统功能结构设计

本系统主要通过使用Java语言编码设计系统功能,MySQL数据库管理数据,AJAX技术设计简洁的、友好的网址页面,然后在IDEA开发平台中,编写相关的Java代码文件,接着通过连接语言完成与数据库的搭建工作,再通过平台提供的Tomcat插件完成信息的交互,最后在浏览器中打开系统网址便可使用本系统。本系统的使用角色可以被分为用户和管理员,用户具有注册、查看信息、留言信息等功能,管理员具有修改用户信息,发布津贴等功能,系统总体功能设计图如图4-1所示。

2b03f6f325994b38b3d274e9cf037288.png

图4-1系统总体功能设计图

 

系统功能实现

5.1管理员功能模块实现

5.1.1管理员登录

管理员可以选择任一浏览器打开网址,输入信息无误后,以管理员的身份行使相关的管理权限,管理员登录界面设计如图5-1所示。

28ed577f59634a878e6c9b1296e8d87d.png

图5-1管理员登录界面

5.1.2用户信息管理

管理员可以通过选择用户管理,管理相关的用户信息记录,比如进行查看用户信息标题,修改用户信息来源等操作,用户管理界面设计如图5-2所示。

b8852da89e6940cab199a4f97361671b.png

图5-2用户管理界面

 

5.1.3公告信息管理

管理员可以通过选择公告管理,管理相关的公告信息记录,比如进行查看公告详情,删除错误的公告信息,发布公告等操作,公告管理界面如图5-3所示。

c9954e255ec642e88d131367ad42ac16.png

图5-3 公告管理界面

5.1.4公告类型管理

管理员可以通过选择公告类型管理,管理相关的公告类型信息,比如查看所有公告类型,删除无用公告类型,修改公告类型,添加公告类型等操作,公告类型管理界面设计如图5-4所示。

887745615f184ae1a274208481c2bfe7.png

图5-4公告类型管理界面

5.1.5 津贴信息管理

如图5.5显示的就是津贴管理页面,此页面提供给管理员的功能有:新增津贴,修改津贴,删除津贴。

c17fc7ba4cd64c66b751eea70a67b6d1.png

图5.5津贴管理页面

5.1.6 津贴类型管理

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

95ca60a70caa48d8bfa9e8a7c2566810.png

图5.6 津贴类型管理页面

论文参考

9a14762fd4e74e1c9a74297c453583b6.png

5671f607425042dbb91b7b4377cbb8a0.png

59ad98a95d4a4383a1fb231ec666fd21.png

 

核心代码


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("/xinzi")
public class XinziController {
    private static final Logger logger = LoggerFactory.getLogger(XinziController.class);

    private static final String TABLE_NAME = "xinzi";

    @Autowired
    private XinziService xinziService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典表
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private JintieService jintieService;//津贴
    @Autowired
    private JixiaoService jixiaoService;//绩效
    @Autowired
    private YuangongService yuangongService;//用户
    @Autowired
    private YuangongKaoqinService yuangongKaoqinService;//员工考勤
    @Autowired
    private YuangongKaoqinListService yuangongKaoqinListService;//员工考勤详情
    @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("yuangongId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = xinziService.queryPage(params);

        //字典表数据转换
        List<XinziView> list =(List<XinziView>)page.getList();
        for(XinziView 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);
        XinziEntity xinzi = xinziService.selectById(id);
        if(xinzi !=null){
            //entity转view
            XinziView view = new XinziView();
            BeanUtils.copyProperties( xinzi , view );//把实体数据重构到view中
            //级联表 用户
            //级联表
            YuangongEntity yuangong = yuangongService.selectById(xinzi.getYuangongId());
            if(yuangong != null){
            BeanUtils.copyProperties( yuangong , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yuangongId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYuangongId(yuangong.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            xinzi.setYuangongId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<XinziEntity> queryWrapper = new EntityWrapper<XinziEntity>()
            .eq("yuangong_id", xinzi.getYuangongId())
            .eq("xinzi_month", xinzi.getXinziMonth())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XinziEntity xinziEntity = xinziService.selectOne(queryWrapper);
        if(xinziEntity==null){

            YuangongEntity yuangong = yuangongService.selectById(xinzi.getYuangongId());
            if(yuangong == null)
                return R.error("查不到员工");
            DictionaryEntity one = dictionaryService.selectOne(new EntityWrapper<DictionaryEntity>()
                    .eq("dic_code", "zhiwei_types")
                    .eq("code_index", yuangong.getZhiweiTypes())
            );


            xinzi.setInsertTime(new Date());
            xinzi.setCreateTime(new Date());
            xinzi.setShifaJine(xinzi.getJixiaoJine()+xinzi.getJiangjinJine()+xinzi.getButieJine()+Double.valueOf(one.getBeizhu()));//薪资表特有,不需要可以手动删掉
            xinziService.insert(xinzi);
            return R.ok();
        }else {
            return R.error(511,"该员工该月份已有薪资记录,不能重复添加");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            xinzi.setYuangongId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        if("".equals(xinzi.getXinziContent()) || "null".equals(xinzi.getXinziContent())){
                xinzi.setXinziContent(null);
        }

        YuangongEntity yuangong = yuangongService.selectById(xinzi.getYuangongId());
        if(yuangong == null)
            return R.error("查不到员工");
        DictionaryEntity one = dictionaryService.selectOne(new EntityWrapper<DictionaryEntity>()
                .eq("dic_code", "zhiwei_types")
                .eq("code_index", yuangong.getZhiweiTypes())
        );

        xinzi.setShifaJine(xinzi.getJixiaoJine()+xinzi.getJiangjinJine()+xinzi.getButieJine()+Double.valueOf(one.getBeizhu()));//薪资表特有,不需要可以手动删掉
        xinziService.updateById(xinzi);//根据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<XinziEntity> oldXinziList =xinziService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        xinziService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yuangongId = 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<XinziEntity> xinziList = 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){
                            //循环
                            XinziEntity xinziEntity = new XinziEntity();
//                            xinziEntity.setYuangongId(Integer.valueOf(data.get(0)));   //员工 要改的
//                            xinziEntity.setXinziUuidNumber(data.get(0));                    //薪资编号 要改的
//                            xinziEntity.setXinziMonth(data.get(0));                    //月份 要改的
//                            xinziEntity.setJiangjinJine(data.get(0));                    //提成 要改的
//                            xinziEntity.setJixiaoJine(data.get(0));                    //绩效 要改的
//                            xinziEntity.setButieJine(data.get(0));                    //津贴 要改的
//                            xinziEntity.setShifaJine(data.get(0));                    //实发 要改的
//                            xinziEntity.setXinziContent("");//详情和图片
//                            xinziEntity.setInsertTime(date);//时间
//                            xinziEntity.setCreateTime(date);//时间
                            xinziList.add(xinziEntity);


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

                        //查询是否重复
                         //薪资编号
                        List<XinziEntity> xinziEntities_xinziUuidNumber = xinziService.selectList(new EntityWrapper<XinziEntity>().in("xinzi_uuid_number", seachFields.get("xinziUuidNumber")));
                        if(xinziEntities_xinziUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(XinziEntity s:xinziEntities_xinziUuidNumber){
                                repeatFields.add(s.getXinziUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [薪资编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        xinziService.insertBatch(xinziList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




}

 

 

  • 14
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值