目录
一、项目介绍
二、项目主要技术
三、系统体系结构
四、系统实现
五、实现代码
一、项目介绍
本系统采用Mysql数据库和java语言,SpringBoot框架进行开发而成,极大程度上的保证了系统的稳定性。管理人员可以管理个人中心、驾驶员管理、用户管理、车辆登记管理、维修信息管理、事故信息管理、违章信息管理、车辆运营管理、企业论坛、系统管理等进行管理。
二、项目主要技术
开发语言:Java
使用框架:spring boot
前端技术:JavaScript、Vue 、css3
开发工具:IDEA/MyEclipse/Eclipse、Visual Studio Code
数据库:MySQL 5.7/8.0
数据库管理工具:phpstudy/Navicat
JDK版本:jdk1.8
Maven: apache-maven 3.8.1-bin
三、系统体系结构
系统启动后,在登录界面,输入正确的账号密码,选择进入管理员界面、驾驶员界面或用户界面;系统登录结构图如图所示。
管理员模块属于是网站的后台,进入之后有大量的管理员功能,管理员也可以使用其他用户模块的功能,为了维护网站的稳定与页面的布局,将管理员模块的功能详细化后可以使用系统管理对页面进行布局修改,可以发布公告提示用户规范,企业车辆管理系统总体结构图如图所示。
四、系统实现
系统首页界面
驾驶员详细页面
车辆登记详细页面
后台登录界面
驾驶员管理界面
车辆登记管理界面
违章信息管理界面
五、实现代码
@RestController
@RequestMapping("/jiashiyuan")
public class JiashiyuanController {
@Autowired
private JiashiyuanService jiashiyuanService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
JiashiyuanEntity u = jiashiyuanService.selectOne(new EntityWrapper<JiashiyuanEntity>().eq("gonghao", username));
if(u==null || !u.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(u.getId(), username,"jiashiyuan", "驾驶员" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody JiashiyuanEntity jiashiyuan){
//ValidatorUtils.validateEntity(jiashiyuan);
JiashiyuanEntity u = jiashiyuanService.selectOne(new EntityWrapper<JiashiyuanEntity>().eq("gonghao", jiashiyuan.getGonghao()));
if(u!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
jiashiyuan.setId(uId);
jiashiyuanService.insert(jiashiyuan);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
JiashiyuanEntity u = jiashiyuanService.selectById(id);
return R.ok().put("data", u);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
JiashiyuanEntity u = jiashiyuanService.selectOne(new EntityWrapper<JiashiyuanEntity>().eq("gonghao", username));
if(u==null) {
return R.error("账号不存在");
}
u.setMima("123456");
jiashiyuanService.updateById(u);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,JiashiyuanEntity jiashiyuan,
HttpServletRequest request){
EntityWrapper<JiashiyuanEntity> ew = new EntityWrapper<JiashiyuanEntity>();
PageUtils page = jiashiyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiashiyuan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,JiashiyuanEntity jiashiyuan,
HttpServletRequest request){
EntityWrapper<JiashiyuanEntity> ew = new EntityWrapper<JiashiyuanEntity>();
PageUtils page = jiashiyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiashiyuan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JiashiyuanEntity jiashiyuan){
EntityWrapper<JiashiyuanEntity> ew = new EntityWrapper<JiashiyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( jiashiyuan, "jiashiyuan"));
return R.ok().put("data", jiashiyuanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JiashiyuanEntity jiashiyuan){
EntityWrapper< JiashiyuanEntity> ew = new EntityWrapper< JiashiyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( jiashiyuan, "jiashiyuan"));
JiashiyuanView jiashiyuanView = jiashiyuanService.selectView(ew);
return R.ok("查询驾驶员成功").put("data", jiashiyuanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JiashiyuanEntity jiashiyuan = jiashiyuanService.selectById(id);
return R.ok().put("data", jiashiyuan);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JiashiyuanEntity jiashiyuan = jiashiyuanService.selectById(id);
return R.ok().put("data", jiashiyuan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JiashiyuanEntity jiashiyuan, HttpServletRequest request){
jiashiyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiashiyuan);
JiashiyuanEntity u = jiashiyuanService.selectOne(new EntityWrapper<JiashiyuanEntity>().eq("gonghao", jiashiyuan.getGonghao()));
if(u!=null) {
return R.error("用户已存在");
}
jiashiyuan.setId(new Date().getTime());
jiashiyuanService.insert(jiashiyuan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody JiashiyuanEntity jiashiyuan, HttpServletRequest request){
jiashiyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiashiyuan);
JiashiyuanEntity u = jiashiyuanService.selectOne(new EntityWrapper<JiashiyuanEntity>().eq("gonghao", jiashiyuan.getGonghao()));
if(u!=null) {
return R.error("用户已存在");
}
jiashiyuan.setId(new Date().getTime());
jiashiyuanService.insert(jiashiyuan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody JiashiyuanEntity jiashiyuan, HttpServletRequest request){
//ValidatorUtils.validateEntity(jiashiyuan);
jiashiyuanService.updateById(jiashiyuan);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
jiashiyuanService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
此源码非开源,若需要此源码可扫码添加微信或者qq:2214904953进行咨询!
2600多套项目欢迎咨询