package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
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.transaction.annotation.Transactional;
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.YonghuEntity;
import com.entity.view.YonghuView;
import com.service.YonghuService;
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 2023-03-25 23:11:57
*/
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
@Autowired
private YonghuService yonghuService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(u==null || !u.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YonghuEntity yonghu){
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yonghu.setId(uId);
yonghuService.insert(yonghu);
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");
YonghuEntity u = yonghuService.selectById(id);
return R.ok().put("data", u);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(u==null) {
return R.error("账号不存在");
}
u.setMima("123456");
yonghuService.updateById(u);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YonghuEntity yonghu){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
return R.ok().put("data", yonghuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YonghuEntity yonghu){
EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
YonghuView yonghuView = yonghuService.selectView(ew);
return R.ok("查询用户成功").put("data", yonghuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
//ValidatorUtils.validateEntity(yonghu);
yonghuService.updateById(yonghu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yonghuService.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 r
没有合适的资源?快使用搜索试试~ 我知道了~
基于SpringBoot+Vue.JS开发的高校电动车租赁系统 JAVA毕业设计 源码+数据库+论文(有项目截图)+启动教程
共532个文件
svg:161个
java:99个
vue:78个
需积分: 0 0 下载量 160 浏览量
2024-09-24
10:09:29
上传
评论 2
收藏 15.94MB ZIP 举报
温馨提示
项目启动教程:https://www.bilibili.com/video/BV11ktveuE2d 高校电动车租赁系统是基于Vue.js和SpringBoot框架开发的电动车租赁服务平台,旨在为高校师生提供便捷的电动车租赁服务。前端采用Vue.js构建了简洁易用的用户界面,包括电动车浏览、在线预订、租赁状态查询等功能。后端基于SpringBoot框架实现了电动车管理、租赁订单处理、用户认证等核心功能。高校电动车租赁系统结合了Vue.js和SpringBoot的技术优势,为高校师生提供了一个高效、便捷的电动车租赁服务,有效解决了校园出行需求,促进了校园绿色出行。
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot+Vue.JS开发的高校电动车租赁系统 JAVA毕业设计 源码+数据库+论文(有项目截图)+启动教程 (532个子文件)
update-password.vue.bak 3KB
main.js.bak 2KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
build.bat 14B
run.bat 14B
1-install.bat 12B
install.bat 12B
.classpath 2KB
mvnw.cmd 7KB
app.62a80282.css 317KB
chunk-vendors.717566f5.css 242KB
app.cc1412da.css 94KB
chunk-vendors.0fdd4e14.css 37KB
swiper.min.css 13KB
swiper.min.css 13KB
iconfont.css 622B
canvas-bg-1.css 391B
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-2.css 83B
canvas-bg-4.css 61B
canvas-bg-5.css 61B
canvas-bg-3.css 61B
canvas-bg-3.css 61B
springboothb0fi数据库文档.doc 909KB
.factorypath 15KB
.gitignore 364B
index.html 1KB
index.html 996B
index.html 822B
index.html 630B
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
YonghuController.java 9KB
DiandongchezulinController.java 8KB
BaiduUtil.java 8KB
DiandongchebaoxiuController.java 7KB
CommonController.java 7KB
DingdanxinxiController.java 7KB
DiandongchexinxiController.java 7KB
SystemintroController.java 7KB
NewsController.java 6KB
DiandongchezulinEntity.java 6KB
UsersController.java 5KB
MPUtil.java 5KB
DiandongchezulinModel.java 5KB
DingdanxinxiEntity.java 5KB
DiandongchezulinVO.java 5KB
MavenWrapperDownloader.java 5KB
DiandongchebaoxiuEntity.java 5KB
DiandongchexinxiEntity.java 5KB
CommonUtil.java 4KB
FileController.java 4KB
YonghuEntity.java 4KB
DingdanxinxiModel.java 4KB
DingdanxinxiVO.java 4KB
DiandongchebaoxiuModel.java 4KB
DiandongchebaoxiuVO.java 3KB
AuthorizationInterceptor.java 3KB
DiandongchexinxiModel.java 3KB
SystemintroEntity.java 3KB
ConfigController.java 3KB
DiandongchexinxiVO.java 3KB
NewsEntity.java 3KB
YonghuModel.java 3KB
Query.java 3KB
YonghuVO.java 3KB
TokenServiceImpl.java 2KB
TokenEntity.java 2KB
DiandongchebaoxiuServiceImpl.java 2KB
DiandongchexinxiServiceImpl.java 2KB
DiandongchezulinServiceImpl.java 2KB
SystemintroModel.java 2KB
DingdanxinxiServiceImpl.java 2KB
SystemintroVO.java 2KB
PageUtils.java 2KB
SystemintroServiceImpl.java 2KB
YonghuServiceImpl.java 2KB
NewsServiceImpl.java 2KB
NewsModel.java 1KB
InterceptorConfig.java 1KB
CommonServiceImpl.java 1KB
NewsVO.java 1KB
UsersServiceImpl.java 1KB
UsersEntity.java 1KB
SpringContextUtils.java 1KB
DiandongchebaoxiuService.java 1KB
DiandongchebaoxiuDao.java 1KB
ValidatorUtils.java 1KB
DiandongchexinxiService.java 1KB
DiandongchezulinService.java 1KB
DiandongchexinxiDao.java 1KB
共 532 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
杨荧
- 粉丝: 0
- 资源: 2372
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于Qt框架的海王网咖管理系统.zip
- (源码)基于Spring Boot和Material You设计语言的论坛管理系统.zip
- (源码)基于Nio的Mycat 2.0数据库代理系统.zip
- 通过go语言实现单例模式(Singleton Pattern).rar
- 通过python实现简单贪心算法示例.rar
- C语言中指针基本概念及应用详解
- (源码)基于Websocket和C++的咖啡机器人手臂控制系统.zip
- (源码)基于深度学习和LoRA技术的图书问答系统.zip
- (源码)基于Servlet和Vue的机动车车辆车库管理系统.zip
- (源码)基于ESP32C3和WiFi的LED控制系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功