作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
管理员角色包含以下功能:
管理员登录,修改管理员资料,用户管理,公告管理,系别信息管理,班级管理,学生通讯录管理等功能。
用户角色包含以下功能:
用户登录,修改个人资料,查看公告,查看系别信息,班级查看,学生通讯信息查看等功能。
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:HTML+CSS+JavaScript+jsp
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
- package com.service;
-
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.OrderInfoDao;
- import com.entity.OrderInfo;
- import com.entity.TroubleInfo;
- import com.util.IDUtil;
- import com.util.Result;
- @Service
- public class OrderInfoServiceImpl implements OrderInfoService{
-
- @Resource
- OrderInfoDao dao;
-
- @Override
- public Result addOrderInfo(String user_id, String user_name, String plate, String trouble_code,String trouble_name, String contact,
- String contact_way, String remark) {
- // TODO Auto-generated method stub
- OrderInfo oi=new OrderInfo();
- String id=IDUtil.createId();
- oi.setId(id);
- oi.setUser_id(user_id);
- oi.setUser_name(user_name);
- oi.setPlate(plate);
- oi.setTrouble_code(trouble_code);
- oi.setTrouble_name(trouble_name);
- oi.setContact(contact);
- oi.setContact_way(contact_way);
- oi.setRemark(remark);
- oi.setCreart_time(getTime());
- oi.setLong_time(System.currentTimeMillis());
- oi.setStatus(0);
- dao.addOrderInfo(oi);
- return new Result("0", "订单信息添加成功", null);
- }
-
- private static String getTime(){
- SimpleDateFormat formatter=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
- Date curDate=new Date(System.currentTimeMillis());//获取当前时间
- String str=formatter.format(curDate);
- return str;
- }
-
-
- @Override
- public Result findAllOrder() {
- // TODO Auto-generated method stub
- List
list=dao.findAllOrder(); - return new Result("0", "订单信息加载成功", list);
- }
-
- @Override
- public Result delOrderInfo(String id) {
- // TODO Auto-generated method stub
- dao.delOrderInfo(id);
- return new Result("0", "订单信息删除成功", null);
- }
-
- @Override
- public Result changStatus(String id) {
- // TODO Auto-generated method stub
- dao.changStatus(id, 1);
- return new Result("0", "订单状态更改成功", null);
- }
-
- @Override
- public Result findOrder(String user_id) {
- // TODO Auto-generated method stub
- List
list=dao.findOrder(user_id); - return new Result("0", "订单信息加载成功", list);
- }
-
- @Override
- public Result searchOrderInfo(String type, String keywords) {
- // TODO Auto-generated method stub
- Map
params=new HashMap(); - if(!type.equals("") && keywords.equals("")){
- return new Result("1", "请输入关键字", null);
- }else if(type.equals("") && !keywords.equals("")){
- return new Result("1", "请选择分类", null);
- }else if(type.equals("1")){
- params.put("plate", "%"+keywords+"%");
- }else if(type.equals("2")){
- params.put("trouble_name", "%"+keywords+"%");
- }else if(type.equals("3")){
- params.put("user_name", "%"+keywords+"%");
- }else if(type.equals("4")){
- params.put("contact", "%"+keywords+"%");
- }
- List
list=dao.searchOrderInfo(params); - return new Result("0", "订单信息加载成功", list);
- }
-
- @Override
- public Result findDealOrder() {
- // TODO Auto-generated method stub
- List
list=dao.findByStatus(1); - return new Result("0", "订单信息加载成功", list);
- }
-
- @Override
- public Result findUndealOrder() {
- // TODO Auto-generated method stub
- List
list=dao.findByStatus(0); - return new Result("0", "订单信息加载成功", list);
- }
-
- @Override
- public Result findBySort() {
- // TODO Auto-generated method stub
- List
list=dao.findBySort(); - return new Result("0", "订单信息加载成功", list);
- }
-
- }
- package com.service;
-
- import java.util.List;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.PartsInfoDao;
- import com.entity.PartsInfo;
- import com.util.Result;
-
- @Service
- public class PartsInfoServiceImpl implements PartsInfoService{
- @Resource
- PartsInfoDao dao;
-
- @Override
- public Result buyParts(String id) {
- // TODO Auto-generated method stub
- dao.buyParts(id);
- return new Result("0", "零件购买成功", null);
- }
-
- @Override
- public Result findAllParts() {
- // TODO Auto-generated method stub
- List
list=dao.findAllParts(); - return new Result("0", "零件信息加载成功", list);
- }
-
- @Override
- public Result useParts(String id) {
- // TODO Auto-generated method stub
- dao.useParts(id);
- return new Result("0", "零件已使用", null);
- }
-
- }
- package com.service;
-
- import java.util.HashMap;
- import java.util.Map;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.PersonalInfoDao;
- import com.entity.PersonalInfo;
- import com.util.Result;
-
- @Service
- public class PersonalInfoServiceImpl implements PersonalInfoService {
-
- @Resource
- PersonalInfoDao dao;
-
- @Override
- public Result updatePersonalInfo(String user_id,String real_name, String sex, String birthday, String email, String address,
- String tel_num, String remark) {
- // TODO Auto-generated method stub
- PersonalInfo pi=new PersonalInfo();
- pi.setUser_id(user_id);
- pi.setReal_name(real_name);
- pi.setSex(sex);
- pi.setBirthday(birthday);
- pi.setEmail(email);
- pi.setTel_num(tel_num);
- pi.setReal_name(real_name);
- pi.setAddress(address);
- pi.setRemark(remark);
- dao.updatePersonalInfo(pi);
- return new Result("0", "个人信息修改成功", null);
-
- }
-
- @Override
- public Result showPersonalInfo(String user_id) {
- // TODO Auto-generated method stub
- PersonalInfo pi=dao.showPersonalInfo(user_id);
- return new Result("0", "个人信息加载成功", pi);
- }
-
- }
- package com.service;
-
- import java.util.List;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.TroubleInfoDao;
- import com.entity.TroubleInfo;
- import com.util.IDUtil;
- import com.util.Result;
- @Service
- public class TroubleInfoServiceImpl implements TroubleInfoService{
-
- @Resource
- TroubleInfoDao dao;
-
- @Override
- public Result addTroubleInfo(String trouble_code, String trouble_name, String trouble_remark) {
- // TODO Auto-generated method stub
-
- Result nr=null;
- if(trouble_code.equals("")){
- nr=new Result("1", "请输入故障码", null);
- }else if(trouble_name.equals("")){
- nr=new Result("1", "请输入故障名称", null);
- }else{
- String id=IDUtil.createId();
- TroubleInfo ti=new TroubleInfo();
- ti.setId(id);
- ti.setTrouble_code(trouble_code);
- ti.setTrouble_name(trouble_name);
- ti.setTrouble_remark(trouble_remark);
- ti.setStatus(0);
- dao.addTroubleInfo(ti);
- nr=new Result("0", "故障信息添加成功", null);
- }
- return nr;
- }
-
- @Override
- public Result troubleList() {
- // TODO Auto-generated method stub
- List
list=dao.troubleList(); - return new Result("0", "故障信息加载成功", list);
- }
-
- @Override
- public Result changStatus(String id) {
- // TODO Auto-generated method stub
- TroubleInfo ti=dao.findTrouble(id);
- Integer status=ti.getStatus();
- if(status==0){
- dao.changStatus(id, 1);
- }else{
- dao.changStatus(id, 0);
- }
- return new Result("0", "故障状态更改成功", null);
- }
-
- }
- package com.service;
-
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.PersonalInfoDao;
- import com.dao.UserDao;
- import com.dao.VisitorDao;
- import com.entity.User;
- import com.entity.Visitor;
- import com.util.MD5Util;
- import com.util.Result;
- import com.util.IDUtil;
- @Service
- public class UserServiceImpl implements UserService{
-
- @Resource
- private UserDao dao;
-
- @Resource
- private VisitorDao vd;
-
- @Resource
- private PersonalInfoDao pidao;
-
- public Result login(String userName, String userPwd) {
- // TODO Auto-generated method stub
- User user=dao.userLogin(userName);
- Result nr=null;
- String md5Password=MD5Util.md5(userPwd);
- if(user==null){
- nr=new Result("1", "用户名错误", null);
- }else if(!user.getPassword().equals(md5Password)){
- nr=new Result("1", "密码错误", null);
- }else if(user.getStatus()==1){
- nr=new Result("1", "该用户已被禁用", null);
- }else{
- Integer type=user.getType();
- String userId=user.getId();
- Map
data=new HashMap(); - data.put("type", type);
- data.put("userId", userId);
- nr=new Result("0", "登陆成功", data);//将用户身份id返回
- //添加访客
- if(user.getType()==0){
- List
v_list=vd.visitorList(); - if(v_list.size()>=12){
- vd.delVisitor();
- }
- Visitor v=new Visitor();
- v.setId(IDUtil.createId());
- v.setV_name(userName);
- v.setV_time(getTime());
- v.setLong_time(System.currentTimeMillis());
- vd.addVisitor(v);
- }
- }
- return nr;
- }
-
- private static String getTime(){
- SimpleDateFormat formatter=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
- Date curDate=new Date(System.currentTimeMillis());//获取当前时间
- String str=formatter.format(curDate);
- return str;
- }
-
-
- public Result changePwd(String user_id, String mpass, String newpass) {
- User user=dao.findUser(user_id);
- Result nr=null;
- if(mpass.equals("")){
- nr=new Result("1", "请输入原始密码", null);
- }else if(newpass.equals("")){
- nr=new Result("1", "请输入新密码", null);
- }else if(mpass.equals("") && newpass.equals("")){
- nr=new Result("1", "请输入密码", null);
- }else if(!MD5Util.md5(mpass).equals(user.getPassword())){
- nr=new Result("1", "原始密码不正确", null);
- }else{
- dao.changPwd(user_id, MD5Util.md5(newpass));
- nr=new Result("0", "密码修改成功", null);
- }
- return nr;
- }
-
- @Override
- public Result userList() {
- // TODO Auto-generated method stub
- List
list=dao.userList(); - return new Result("0", "用户信息加载成功", list);
- }
-
- @Override
- public Result addUser(String name, String password, Integer type) {
- // TODO Auto-generated method stub
- List
list=dao.userList(); - Result nr=null;
- if(name.equals("")){
- nr=new Result("1", "请输入用户名", null);
- }else if(password.equals("")){
- nr=new Result("1", "请输入密码", null);
- }else{
- for(int i=0;i
- if(list.get(i).getName().equals(name)){
- nr=new Result("1", "该用户名已存在", null);
- return nr;
- }
- }
- User user=new User();
- String id=IDUtil.createId();
- user.setId(id);
- user.setName(name);
- user.setPassword(MD5Util.md5(password));
- user.setType(type);
- user.setStatus(0);
- dao.addUser(user);
-
- pidao.addUserId(id);
- nr=new Result("0", "用户添加成功", null);
- }
- return nr;
-
- }
-
- @Override
- public Result changeStatus(String id) {
- // TODO Auto-generated method stub
- User user=dao.findUser(id);
- Integer status=user.getStatus();
- if(status==0){
- dao.changStatus(id, 1);
- }else{
- dao.changStatus(id, 0);
- }
- return new Result("0", "用户状态更改成功", null);
- }
-
- }
VisitorServiceImpl
- package com.service;
-
- import java.util.List;
-
- import javax.annotation.Resource;
-
- import org.springframework.stereotype.Service;
-
- import com.dao.CarInfoDao;
- import com.dao.VisitorDao;
- import com.entity.Visitor;
- import com.util.Result;
- @Service
- public class VisitorServiceImpl implements VisitorService{
-
- @Resource
- VisitorDao dao;
-
- @Override
- public Result visitorList() {
- // TODO Auto-generated method stub
- List
list=dao.visitorList(); - return new Result("0", "访客信息加载成功", list);
- }
-
- }
如果也想学习本系统,下面领取。关注并回复:149ssm