基于SSM的供电公司安全生产考试系统设计与实现

这篇具有很好参考价值的文章主要介绍了基于SSM的供电公司安全生产考试系统设计与实现。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能展示

教师信息管理

学生信息管理

主观题管理

试题信息管理

主观题答题

成绩信息统计

三、核心代码

登录相关

文件上传

封装


一、项目简介

使用旧方法对安全生产考试信息进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在安全生产考试信息的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。

这次开发的供电公司安全生产考试系统管理员,教师,学生。管理员功能有个人中心,学生管理,教师管理,主观题信息管理,主观题回答管理,主观题评分管理,成绩信息管理,试卷管理,试题管理,考试管理。教师可以发布考试信息,学生进行考试。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择B/S模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行供电公司安全生产考试系统程序的开发,在数据库的选择上面,选择功能强大的MySQL数据库进行数据的存放操作。

供电公司安全生产考试系统被人们投放于现在的生活中进行使用,该款管理类软件就可以让管理人员处理信息的时间介于十几秒之间。在这十几秒内就能完成信息的编辑等操作。有了这样的管理软件,安全生产考试信息的管理就离无纸化办公的目标更贴近了。


二、系统功能展示

教师信息管理

管理员可以管理教师信息,可以添加,修改,删除教师信息信息。下图就是教师信息管理页面。

基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse

学生信息管理

管理员可以对学生信息进行查询和修改操作。下图就是学生信息管理页面。

 基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse

主观题管理

教师可以对主观题进行进行添加,修改,删除操作。下图就是主观题信息管理页面。

 基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse

试题信息管理

教师可以管理试题信息,可以添加,修改,删除试题信息信息。下图就是试题信息管理页面。

 基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse

主观题答题

学生可以在主观题信息里进行答题。下图就是主观题信息管理页面。

 基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse

成绩信息统计

教师可以对学生的成绩信息进行统计。下图就是成绩信息管理页面。

 基于SSM的供电公司安全生产考试系统设计与实现,安全,java,前端,javascript,学习,eclipse文章来源地址https://www.toymoban.com/news/detail-758395.html


三、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

到了这里,关于基于SSM的供电公司安全生产考试系统设计与实现的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • ssm安全生产培训管理平台-计算机毕设 附源码 26918

                                                        摘  要 Abstract 第1章  前  言 1.1  研究背景 1.2  研究现状 1.3  系统开发目标 第2章  系统开发环境 2.1 JAVA简介 2.2 MySql数据库 2.3  B/S架构 2.4 JSP技术介绍 2.5 SSM三大框架 第3章  需求分析 3.1  需求

    2024年02月04日
    浏览(47)
  • 让企业的招投标文件、生产工艺、流程配方、研发成果、公司计划、员工信息、客户信息等核心数据更安全。

    PC端访问地址1: www.drhchina.com PC端访问地址2: https://isite.baidu.com/site/wjz012xr/2eae091d-1b97-4276-90bc-6757c5dfedee 信息防泄漏是一项系统的整体部署工程,加密+监控已成为多数企事业单位信息防泄密的共同选择 全面的加密模式,有效防止数据泄密 透明无感知加密:对机密数据自动加密

    2024年02月02日
    浏览(40)
  • 2023全国安全生产合格证危险化学品经营单位主要负责人模拟考试试卷一[安考星]

    该模拟试题来源于安考星公众号 1、信息上报就是明确事故发生后向上级主管单位报告事故信息的流程、内容和时限。 正确答案:错误 参考解析:《生产经营单位安全生产事故应急预案编制导则》规定:信息上报是明确事故发生后向上级主管部门、上级单位报告事故信息的流

    2024年02月10日
    浏览(38)
  • 【计算机设计大赛】国赛一等奖项目分享——基于多端融合的化工安全生产监管可视化系统

    今年参加计算机设计大赛软件应用与开发获得了国赛一等奖。 参加了两届计算机设计大赛,个人感觉拿奖还是比较容易。目前了解的几个参赛项目获奖级别都比较高,但是感觉几个项目实际也都没有什么特别之处,使用的技术栈也都比较平常。最重要的是我自己的参赛项目的

    2024年02月13日
    浏览(27)
  • 安全生产管理系统助力企业安全细化管理

    安全生产管理系统利用完整的安全生产管理体系,结合信息化、数字化和智能化等技术手段,将安全生产过程中的各个环节进行有效整合,使安全管理更加科学、规范和高效。 安全生产管理系统可以对企业安全生产进行全面、细致的管理。它能够实现对企业安全生产活动的全

    2024年02月06日
    浏览(39)
  • Lnton 羚通智能分析算法矿山安全生产监测预警系统

    Lnton 羚通描述如何使用输入数据进行计算和产生输出结果,用于解决问题或执行特定任务的计算过程以及解决各种问题,例如排序、搜索、图像处理、机器学习等,被广泛应用于计算机科学、数学和工程等领域。 矿山安全生产监测预警系统通过 python+opencv 网络模型计算机视觉

    2024年02月07日
    浏览(38)
  • 天拓四方分享:企业安全生产管控系统的构建、实施与优化

    在当今社会,安全生产已成为各行各业的重要关注点。对于企业而言,构建和实施一套有效的安全生产管控系统是确保员工生命安全、提高工作效率以及维护企业稳定发展的关键。本文将深入探讨企业安全生产管控系统的构建、实施与优化。 一、企业安全生产管控系统的构建

    2024年02月06日
    浏览(32)
  • 智慧工厂:如何打造工厂安全生产AI视频监管与风险预警系统?

    现代工厂多是机械操作,少量人员看守,甚至是无人化管理模式。企业都会在生产车间、仓库等重点区域安置摄像头留存画面用作回溯依据。但问题出现后再溯源,或许已经造成严重的生命安全事故和财产损失了。因此,对工厂各区域启用在线监管视频预警系统尤为重要,不

    2024年02月16日
    浏览(28)
  • 瓦斯抽采VR应急救援模拟仿真系统筑牢企业安全生产防线

    矿工素质对安全生产的影响很大。传统的煤矿安全事故培训出于条件差、经验少加上侥幸心理,导致其在教学内容时过于简单且不切合实际,无法真正发挥培训作用。瓦斯检查作业VR模拟实操培训通过真实还原煤矿作业环境,让受训者身临其境地进入三维仿真场景中模拟实操

    2024年02月05日
    浏览(51)
  • 安全生产管理平台——革新传统安全生产管理方式,重塑企业安全文化

    安全生产管理在现代企业中占据着至关重要的地位。传统的安全生产管理方式虽然在一定程度上能够保障企业的生产安全,但随着企业规模的不断扩大和生产环境的日益复杂,其局限性也愈发凸显。而安全生产管理平台的出现,正是为了解决这一问题。 平台功能与特点 安全

    2024年01月18日
    浏览(38)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包