随着互联网技术的高速发展,人们生活的各方面都受到互联网技术的影响。现在人们可以通过互联网技术就能实现不出家门就可以通过网络进行系统管理,交易等,而且过程简单、快捷。同样的,在人们的工作生活中,也就需要互联网技术来方便人们的日常工作生活,实现工作办公的自动化处理,实现信息化,无纸化办公。
本课题在充分研究了在Springboot框架基础上,采用B/S模式,以Java为开发语言,MyEclipse为开发工具,MySQL为数据管理平台,实现的内容主要包括首页,个人中心,学生管理,教师管理,班级管理,综合测评管理等功能。
关键词班级综合测评管理;Java;Springboot
springboot班级综合测评管理系统源码和论文389
演示视频:
springboot班级综合测评管理系统源码和论文389
Abstract
With the rapid development of Internet technology, all aspects of people's life are affected by Internet technology. Now people can achieve through Internet technology can not go out of the house through the network system management, trading, and so on, and the process is simple and fast. Similarly, in people's work and life, Internet technology is also needed to facilitate People's Daily work and life, to achieve the automation of work and office, to achieve information, paperless office.
This topic in full study on the basis of Springboot framework, using B/S mode, Java as the development language, MyEclipse as the development tool, MySQL as the data management platform, the realization of the content mainly includes the home page, personal center, student management, teacher management, class management, comprehensive evaluation management and other functions.
Keywords:Class comprehensive assessment management; Java; Springboot
表4-1:用户表
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
username | varchar | 100 | 用户名 | ||
password | varchar | 100 | 密码 | ||
role | varchar | 100 | 角色 | 管理员 | |
addtime | timestamp | 新增时间 | CURRENT_TIMESTAMP |
表4-2:token表
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
userid | bigint | 用户id | |||
username | varchar | 100 | 用户名 | ||
tablename | varchar | 100 | 表名 | ||
role | varchar | 100 | 角色 | ||
token | varchar | 200 | 密码 | ||
addtime | timestamp | 新增时间 | CURRENT_TIMESTAMP | ||
expiratedtime | timestamp | 过期时间 | CURRENT_TIMESTAMP |
表4-3:教师
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
addtime | timestamp | 创建时间 | CURRENT_TIMESTAMP | ||
jiaoshigonghao | varchar | 200 | 教师工号 | ||
mima | varchar | 200 | 密码 | ||
jiaoshixingming | varchar | 200 | 教师姓名 | ||
xingbie | varchar | 200 | 性别 | ||
zhaopian | varchar | 200 | 照片 | ||
jiaoshidianhua | varchar | 200 | 教师电话 |
表4-4:配置文件
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
name | varchar | 100 | 配置参数名称 | ||
value | varchar | 100 | 配置参数值 |
表4-5:班级
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
addtime | timestamp | 创建时间 | CURRENT_TIMESTAMP | ||
banji | varchar | 200 | 班级 |
表4-6:综合测评
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
addtime | timestamp | 创建时间 | CURRENT_TIMESTAMP | ||
xuehao | varchar | 200 | 学号 | ||
xueshengxingming | varchar | 200 | 学生姓名 | ||
jiaoshigonghao | varchar | 200 | 教师工号 | ||
jiaoshixingming | varchar | 200 | 教师姓名 | ||
banji | varchar | 200 | 班级 | ||
deyu | float | 德育 | |||
zhiyu | float | 智育 | |||
tiyu | float | 体育 | |||
zonghechengji | float | 综合成绩 | |||
lurushijian | date | 录入时间 |
表4-7:学生
字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
id | bigint | 主键 | 主键 | ||
addtime | timestamp | 创建时间 | CURRENT_TIMESTAMP | ||
xuehao | varchar | 200 | 学号 | ||
mima | varchar | 200 | 密码 | ||
xueshengxingming | varchar | 200 | 学生姓名 | ||
xingbie | varchar | 200 | 性别 | ||
touxiang | varchar | 200 | 头像 | ||
xueshengshouji | varchar | 200 | 学生手机 | ||
banji | varchar | 200 | 班级 | ||
jiaoshigonghao | varchar | 200 | 教师工号 |
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("/chat")
public class ChatController {private static final Logger logger = LoggerFactory.getLogger(ChatController.class);private static final String TABLE_NAME = "chat";@Autowiredprivate ChatService chatService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate ForumService forumService;//论坛@Autowiredprivate NewsService newsService;//扶贫公告@Autowiredprivate RenwuService renwuService;//任务信息@Autowiredprivate RenwuYuyueService renwuYuyueService;//任务报名@Autowiredprivate XinwenService xinwenService;//新闻信息@Autowiredprivate XinwenCollectionService xinwenCollectionService;//新闻收藏@Autowiredprivate XinwenLiuyanService xinwenLiuyanService;//新闻留言@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate 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("yonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = chatService.queryPage(params);//字典表数据转换List<ChatView> list =(List<ChatView>)page.getList();for(ChatView 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);ChatEntity chat = chatService.selectById(id);if(chat !=null){//entity转viewChatView view = new ChatView();BeanUtils.copyProperties( chat , view );//把实体数据重构到view中//级联表 用户//级联表YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ChatEntity chat, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");else if("用户".equals(role))chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>().eq("yonghu_id", chat.getYonghuId()).eq("chat_issue", chat.getChatIssue()).eq("chat_reply", chat.getChatReply()).eq("zhuangtai_types", chat.getZhuangtaiTypes()).eq("chat_types", chat.getChatTypes());logger.info("sql语句:"+queryWrapper.getSqlSegment());ChatEntity chatEntity = chatService.selectOne(queryWrapper);if(chatEntity==null){chat.setInsertTime(new Date());chatService.insert(chat);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ChatEntity chat, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());ChatEntity oldChatEntity = chatService.selectById(chat.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));chatService.updateById(chat);//根据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<ChatEntity> oldChatList =chatService.selectBatchIds(Arrays.asList(ids));//要删除的数据chatService.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 yonghuId = 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<ChatEntity> chatList = 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){//循环ChatEntity chatEntity = new ChatEntity();
// chatEntity.setYonghuId(Integer.valueOf(data.get(0))); //提问用户 要改的
// chatEntity.setChatIssue(data.get(0)); //问题 要改的
// chatEntity.setIssueTime(sdf.parse(data.get(0))); //问题时间 要改的
// chatEntity.setChatReply(data.get(0)); //回复 要改的
// chatEntity.setReplyTime(sdf.parse(data.get(0))); //回复时间 要改的
// chatEntity.setZhuangtaiTypes(Integer.valueOf(data.get(0))); //状态 要改的
// chatEntity.setChatTypes(Integer.valueOf(data.get(0))); //数据类型 要改的
// chatEntity.setInsertTime(date);//时间chatList.add(chatEntity);//把要查询是否重复的字段放入map中}//查询是否重复chatService.insertBatch(chatList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = chatService.queryPage(params);//字典表数据转换List<ChatView> list =(List<ChatView>)page.getList();for(ChatView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ChatEntity chat = chatService.selectById(id);if(chat !=null){//entity转viewChatView view = new ChatView();BeanUtils.copyProperties( chat , view );//把实体数据重构到view中//级联表YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ChatEntity chat, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>().eq("yonghu_id", chat.getYonghuId()).eq("chat_issue", chat.getChatIssue()).eq("chat_reply", chat.getChatReply()).eq("zhuangtai_types", chat.getZhuangtaiTypes()).eq("chat_types", chat.getChatTypes())
// .notIn("chat_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());ChatEntity chatEntity = chatService.selectOne(queryWrapper);if(chatEntity==null){chat.setInsertTime(new Date());chatService.insert(chat);return R.ok();}else {return R.error(511,"表中有相同数据");}}}
package com.controller;import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;import com.entity.AddressEntity;
import com.entity.view.AddressView;import com.service.AddressService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;/*** 地址* 后端接口* @author * @email * @date 2022-04-06 15:28:34*/
@RestController
@RequestMapping("/address")
public class AddressController {@Autowiredprivate AddressService addressService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,AddressEntity address,HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {address.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,AddressEntity address, HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {address.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( AddressEntity address){EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();ew.allEq(MPUtil.allEQMapPre( address, "address")); return R.ok().put("data", addressService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(AddressEntity address){EntityWrapper< AddressEntity> ew = new EntityWrapper< AddressEntity>();ew.allEq(MPUtil.allEQMapPre( address, "address")); AddressView addressView = addressService.selectView(ew);return R.ok("查询地址成功").put("data", addressView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){AddressEntity address = addressService.selectById(id);return R.ok().put("data", address);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){AddressEntity address = addressService.selectById(id);return R.ok().put("data", address);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody AddressEntity address, HttpServletRequest request){address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(address);address.setUserid((Long)request.getSession().getAttribute("userId"));Long userId = (Long)request.getSession().getAttribute("userId");if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));}address.setUserid(userId);addressService.insert(address);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody AddressEntity address, HttpServletRequest request){address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(address);address.setUserid((Long)request.getSession().getAttribute("userId"));Long userId = (Long)request.getSession().getAttribute("userId");if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));}address.setUserid(userId);addressService.insert(address);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody AddressEntity address, HttpServletRequest request){//ValidatorUtils.validateEntity(address);if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", request.getSession().getAttribute("userId")));}addressService.updateById(address);//全部更新return R.ok();}/*** 获取默认地址*/@RequestMapping("/default")public R defaultAddress(HttpServletRequest request){Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>().eq("isdefault", "是").eq("userid", request.getSession().getAttribute("userId"));AddressEntity address = addressService.selectOne(wrapper);return R.ok().put("data", address);}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){addressService.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<AddressEntity> wrapper = new EntityWrapper<AddressEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}if(!request.getSession().getAttribute("role").toString().equals("管理员")) {wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));}int count = addressService.selectCount(wrapper);return R.ok().put("count", count);}}