基于ssm+vue的新能源汽车在线租赁管理系统源码和论文PPT010
开发环境:
开发工具:idea
数据库mysql5.7+(mysql5.7最佳)
数据库链接工具:navcat,小海豚等
开发技术:java ssm tomcat8.5
摘 要
随着科学技术的飞速发展,社会的方方面面、各行各业都在努力与现代的先进技术接轨,通过科技手段来提高自身的优势,新能源汽车在线租赁当然也不能排除在外。新能源汽车在线租赁是以实际运用为开发背景,运用软件工程开发方法,采用SSM技术构建的一个管理系统。整个开发过程首先对软件系统进行需求分析,得出系统的主要功能。接着对系统进行总体设计和详细设计。总体设计主要包括系统总体结构设计、系统数据结构设计、系统功能设计和系统安全设计等;详细设计主要包括模块实现的关键代码,系统数据库访问和主要功能模块的具体实现等。最后对系统进行功能测试,并对测试结果进行分析总结,及时改进系统中存在的不足,为以后的系统维护提供了方便,也为今后开发类似系统提供了借鉴和帮助。
本新能源汽车在线租赁采用的数据库是Mysql,使用SSM框架开发。在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。
关键词:新能源汽车在线租赁,SSM框架,Mysql 数据库
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.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.ZhandianguanliyuanEntity;
import com.entity.view.ZhandianguanliyuanView;import com.service.ZhandianguanliyuanService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;/*** 站点管理员* 后端接口* @author * @email * @date 2023-01-20 17:21:57*/
@RestController
@RequestMapping("/zhandianguanliyuan")
public class ZhandianguanliyuanController {@Autowiredprivate ZhandianguanliyuanService zhandianguanliyuanService;@Autowiredprivate TokenService tokenService;/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectOne(new EntityWrapper<ZhandianguanliyuanEntity>().eq("zhanghao", username));if(user==null || !user.getMima().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(), username,"zhandianguanliyuan", "站点管理员" );return R.ok().put("token", token);}/*** 注册*/@IgnoreAuth@RequestMapping("/register")public R register(@RequestBody ZhandianguanliyuanEntity zhandianguanliyuan){//ValidatorUtils.validateEntity(zhandianguanliyuan);ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectOne(new EntityWrapper<ZhandianguanliyuanEntity>().eq("zhanghao", zhandianguanliyuan.getZhanghao()));if(user!=null) {return R.error("注册用户已存在");}Long uId = new Date().getTime();zhandianguanliyuan.setId(uId);zhandianguanliyuanService.insert(zhandianguanliyuan);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");ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectById(id);return R.ok().put("data", user);}/*** 密码重置*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request){ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectOne(new EntityWrapper<ZhandianguanliyuanEntity>().eq("zhanghao", username));if(user==null) {return R.error("账号不存在");}user.setMima("123456");zhandianguanliyuanService.updateById(user);return R.ok("密码已重置为:123456");}/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,ZhandianguanliyuanEntity zhandianguanliyuan, HttpServletRequest request){EntityWrapper<ZhandianguanliyuanEntity> ew = new EntityWrapper<ZhandianguanliyuanEntity>();PageUtils page = zhandianguanliyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhandianguanliyuan), params), params));return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,ZhandianguanliyuanEntity zhandianguanliyuan, HttpServletRequest request){EntityWrapper<ZhandianguanliyuanEntity> ew = new EntityWrapper<ZhandianguanliyuanEntity>();PageUtils page = zhandianguanliyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhandianguanliyuan), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( ZhandianguanliyuanEntity zhandianguanliyuan){EntityWrapper<ZhandianguanliyuanEntity> ew = new EntityWrapper<ZhandianguanliyuanEntity>();ew.allEq(MPUtil.allEQMapPre( zhandianguanliyuan, "zhandianguanliyuan")); return R.ok().put("data", zhandianguanliyuanService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(ZhandianguanliyuanEntity zhandianguanliyuan){EntityWrapper< ZhandianguanliyuanEntity> ew = new EntityWrapper< ZhandianguanliyuanEntity>();ew.allEq(MPUtil.allEQMapPre( zhandianguanliyuan, "zhandianguanliyuan")); ZhandianguanliyuanView zhandianguanliyuanView = zhandianguanliyuanService.selectView(ew);return R.ok("查询站点管理员成功").put("data", zhandianguanliyuanView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){ZhandianguanliyuanEntity zhandianguanliyuan = zhandianguanliyuanService.selectById(id);return R.ok().put("data", zhandianguanliyuan);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){ZhandianguanliyuanEntity zhandianguanliyuan = zhandianguanliyuanService.selectById(id);return R.ok().put("data", zhandianguanliyuan);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ZhandianguanliyuanEntity zhandianguanliyuan, HttpServletRequest request){zhandianguanliyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(zhandianguanliyuan);ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectOne(new EntityWrapper<ZhandianguanliyuanEntity>().eq("zhanghao", zhandianguanliyuan.getZhanghao()));if(user!=null) {return R.error("用户已存在");}zhandianguanliyuan.setId(new Date().getTime());zhandianguanliyuanService.insert(zhandianguanliyuan);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ZhandianguanliyuanEntity zhandianguanliyuan, HttpServletRequest request){zhandianguanliyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(zhandianguanliyuan);ZhandianguanliyuanEntity user = zhandianguanliyuanService.selectOne(new EntityWrapper<ZhandianguanliyuanEntity>().eq("zhanghao", zhandianguanliyuan.getZhanghao()));if(user!=null) {return R.error("用户已存在");}zhandianguanliyuan.setId(new Date().getTime());zhandianguanliyuanService.insert(zhandianguanliyuan);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody ZhandianguanliyuanEntity zhandianguanliyuan, HttpServletRequest request){//ValidatorUtils.validateEntity(zhandianguanliyuan);zhandianguanliyuanService.updateById(zhandianguanliyuan);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){zhandianguanliyuanService.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<ZhandianguanliyuanEntity> wrapper = new EntityWrapper<ZhandianguanliyuanEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}int count = zhandianguanliyuanService.selectCount(wrapper);return R.ok().put("count", count);}}
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.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.DingdanxinxiEntity;
import com.entity.view.DingdanxinxiView;import com.service.DingdanxinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;/*** 订单信息* 后端接口* @author * @email * @date 2021-01-20 17:21:57*/
@RestController
@RequestMapping("/dingdanxinxi")
public class DingdanxinxiController {@Autowiredprivate DingdanxinxiService dingdanxinxiService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){String tableName = request.getSession().getAttribute("tableName").toString();if(tableName.equals("zhandianguanliyuan")) {dingdanxinxi.setZhanghao((String)request.getSession().getAttribute("username"));}if(tableName.equals("yonghu")) {dingdanxinxi.setYonghuming((String)request.getSession().getAttribute("username"));}EntityWrapper<DingdanxinxiEntity> ew = new EntityWrapper<DingdanxinxiEntity>();PageUtils page = dingdanxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dingdanxinxi), params), params));return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){EntityWrapper<DingdanxinxiEntity> ew = new EntityWrapper<DingdanxinxiEntity>();PageUtils page = dingdanxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dingdanxinxi), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( DingdanxinxiEntity dingdanxinxi){EntityWrapper<DingdanxinxiEntity> ew = new EntityWrapper<DingdanxinxiEntity>();ew.allEq(MPUtil.allEQMapPre( dingdanxinxi, "dingdanxinxi")); return R.ok().put("data", dingdanxinxiService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(DingdanxinxiEntity dingdanxinxi){EntityWrapper< DingdanxinxiEntity> ew = new EntityWrapper< DingdanxinxiEntity>();ew.allEq(MPUtil.allEQMapPre( dingdanxinxi, "dingdanxinxi")); DingdanxinxiView dingdanxinxiView = dingdanxinxiService.selectView(ew);return R.ok("查询订单信息成功").put("data", dingdanxinxiView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){DingdanxinxiEntity dingdanxinxi = dingdanxinxiService.selectById(id);return R.ok().put("data", dingdanxinxi);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){DingdanxinxiEntity dingdanxinxi = dingdanxinxiService.selectById(id);return R.ok().put("data", dingdanxinxi);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){dingdanxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(dingdanxinxi);dingdanxinxiService.insert(dingdanxinxi);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){dingdanxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(dingdanxinxi);dingdanxinxiService.insert(dingdanxinxi);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){//ValidatorUtils.validateEntity(dingdanxinxi);dingdanxinxiService.updateById(dingdanxinxi);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){dingdanxinxiService.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<DingdanxinxiEntity> wrapper = new EntityWrapper<DingdanxinxiEntity>();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("zhandianguanliyuan")) {wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));}if(tableName.equals("yonghu")) {wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username"));}int count = dingdanxinxiService.selectCount(wrapper);return R.ok().put("count", count);}}