文末获取源码
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7/8.0
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
前言介绍
大学生体质测试管理系统提供给用户一个简单方便体质测试管理信息,通过留言区互动更方便。本系统采用了B/S体系的结构,使用了java技术以及MYSQL作为后台数据库进行开发。
本系统主要包括管理员,学生和教师三个角色组成,主要包括以下功能:
(1)前台:首页、体质测试、公告资讯、留言板、个人中心、后台管理 。
(2)管理员:首页、个人中心、用户管理、教师管理、体质测试管理、测试报告管理、测试成绩管理、请假信息管理、申请信息管理、留言板、系统管理等功能。
(3)用户:首页、个人中心、测试报告管理、测试成绩管理、请假信息管理、申请信息管理等功能。
(4)教师:首页、个人中心、体质测试管理、测试报告管理、测试成绩管理、请假信息管理、申请信息管理等功能。
系统功能结构图
系统功能模块
大学生体质测试管理系统,在系统首页可以查看首页、体质测试、公告资讯、留言板、个人中心、后台管理等内容进行详细操作,如图
体质测试
在体质测试页面可以查看测试名称、测试编号、测试说明、测试文件、发布日期、教师工号等内容进行测试等操作,如图
用户注册
通过填写用户账号、密码、确认密码、用户姓名、班级、联系方式等内容进行注册等操作,如图
个人中心
在个人中心页面通过填写用户账号、密码、用户姓名、性别、班级、联系方式、图片等内容进行更新信息等操作;如图
管理员功能模块
管理员登录,管理员通过输入用户,密码,选择角色等信息进行系统登录,如图
管理员登录进入大学生体质测试管理系统可以查看首页、个人中心、用户管理、教师管理、体质测试管理、测试报告管理、测试成绩管理、留言板、系统管理等内容进行详细操作,如图
用户管理
在用户管理页面可以对索引、用户账号、用户姓名、性别、班级、联系方式、头像等内容详情、修改或删除等操作,如图
教师管理
在教师管理页面可以对教师工号、教师姓名、性别、职称、联系电话、头像等内容进行详情、修改或删除等操作,如图
体质测试管理
在体质测试管理页面可以对索引、测试编号、测试名称、测试文件、图片、发布日期、教师工号、教师姓名等内容进行详情、修改或删除等操作,如图
测试报告管理
在测试报告管理页面可以对索引、测试编号、测试名称、教师工号、教师姓名、报告文件、提交日期、用户账号、用户姓名、班级等内容进行详情、修改或删除等详细的操作,如图
测试成绩管理
在测试成绩管理页面可以对索引、测试编号、、测试名称、教师工号、教师姓名、测试评分、测试评级、评分时间、用户账号、用户姓名、班级等内容进行详情、修改或删除等详细的操作,如图
留言板
在留言板页面可以对索引、用户名、留言内容、留言图片、回复内容、回复图片等内容进行详情、修改、回复或删除等操作,如图
系统管理
在公告资讯页面中可以对索引、标题、图片等内容进行详情、修改或删除等操作,也可以对轮播图管理进行相应的操作,如图
用户功能模块
用户进入大学生体质测试管理系统可以查看首页、个人中心、测试报告管理、测试成绩管理等内容进行详细操作,如图
测试报告管理
在测试报告管理页面中可以对索引、测试编号、测试名称、教师工号、教师姓名、报告文件、提交日期、用户账号、用户姓名、班级等内容进行详情或删除等详细的操作,如图
教师功能模块
教师注册,通过填写教师工号、密码、确认密码、教师姓名、职称、联系电话等内容进行注册,如图
进入教师页面中可以查看首页、个人中心、体质测试管理、测试报告管理、测试成绩管理等内容进行相应的操作,如图
体质测试管理
在体质测试管理页面中可以对索引、测试编号、测试名称、测试文件、图片、发布日期、教师工号、教师姓名等内容进行详细等操作,如图
测试报告管理
在测试报告管理页面中可以对索引、测试编号、测试名称、教师工号、教师姓名、报告文件、提交日期、用户账号、用户姓名、班级等内容进行详细等操作,如图
部分核心代码
/**
* 测试成绩
* 后端接口
* @author
* @email
* @date 2022-04-18 19:20:01
*/
@RestController
@RequestMapping("/ceshichengji")
public class CeshichengjiController {
@Autowired
private CeshichengjiService ceshichengjiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,CeshichengjiEntity ceshichengji,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ceshichengji.setJiaoshigonghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
ceshichengji.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
PageUtils page = ceshichengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ceshichengji), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,CeshichengjiEntity ceshichengji,
HttpServletRequest request){
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
PageUtils page = ceshichengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ceshichengji), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( CeshichengjiEntity ceshichengji){
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
ew.allEq(MPUtil.allEQMapPre( ceshichengji, "ceshichengji"));
return R.ok().put("data", ceshichengjiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(CeshichengjiEntity ceshichengji){
EntityWrapper< CeshichengjiEntity> ew = new EntityWrapper< CeshichengjiEntity>();
ew.allEq(MPUtil.allEQMapPre( ceshichengji, "ceshichengji"));
CeshichengjiView ceshichengjiView = ceshichengjiService.selectView(ew);
return R.ok("查询测试成绩成功").put("data", ceshichengjiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
CeshichengjiEntity ceshichengji = ceshichengjiService.selectById(id);
return R.ok().put("data", ceshichengji);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
CeshichengjiEntity ceshichengji = ceshichengjiService.selectById(id);
return R.ok().put("data", ceshichengji);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CeshichengjiEntity ceshichengji, HttpServletRequest request){
ceshichengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ceshichengji);
ceshichengjiService.insert(ceshichengji);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CeshichengjiEntity ceshichengji, HttpServletRequest request){
ceshichengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ceshichengji);
ceshichengjiService.insert(ceshichengji);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody CeshichengjiEntity ceshichengji, HttpServletRequest request){
//ValidatorUtils.validateEntity(ceshichengji);
ceshichengjiService.updateById(ceshichengji);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
ceshichengjiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<CeshichengjiEntity> wrapper = new EntityWrapper<CeshichengjiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
wrapper.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
wrapper.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = ceshichengjiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
ew.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = ceshichengjiService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
ew.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = ceshichengjiService.selectTimeStatValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 分组统计
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
EntityWrapper<CeshichengjiEntity> ew = new EntityWrapper<CeshichengjiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
ew.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
ew.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = ceshichengjiService.selectGroup(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
}
/**
* 上传文件映射表
*/
@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);
/**
* 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
* 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
* 并且项目路径不能存在中文、空格等特殊字符
*/
// FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\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);
}
}