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.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;
/**
* 用户
* 后端接口
* @author
* @email
* @date 2021-05-02 02:14:09
*/
@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 user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"yonghu", "用户" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YonghuEntity yonghu){
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=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 user = yonghuService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
yonghuService.updateById(user);
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 user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=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 user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
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 remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.se
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
微信小程序毕业设计基于springboot框架+微信小程序的预防接种预约系统项目源码.zip 个人经导师指导并认可通过的高分设计项目,评审分98分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 项目介绍: 预防接种预约系统项目, 前端为微信小程序,后端接口为springboot框架实现,项目包含源码、数据库 毕业设计基于springboot框架+微信小程序的预防接种预约系统项目源码.zip 个人经导师指导并认可通过的高分设计项目,评审分98分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 项目主要功能: 这是一个基于SpringBoot框架和微信小程序的儿童预防接种预约系统源码。该项目旨在改善医院挂号信息管理,提供计算机化的解决方案。系统包含管理员和用户两种角色,管理员可管理用户、儿童及疫苗信息、预约接种等,用户则能注册登录、查看和预约接种。后端使用Java的SSM框架,配合MySQL数据库,前端借助微信开发者工具,确保系统稳定性和易用性。该系统特点是界面直观、操作简便、功
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot框架+微信小程序的预防接种预约系统项目源码 (875个子文件)
main.css.bak 63KB
update-password.vue.bak 3KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
1-install.bat 12B
mvnw.cmd 7KB
index.2d26d90a.css 79KB
icon.css 70KB
main.css 64KB
global-restaurant.css 7KB
mescroll-uni.css 4KB
animation.css 3KB
.gitignore 364B
index.html 1KB
index.html 552B
favicon.ico 4KB
maven-wrapper.jar 50KB
YonghuController.java 9KB
CommonController.java 8KB
YuyuejiezhongController.java 7KB
YimiaoxinxiEntity.java 6KB
ErtongxinxiEntity.java 6KB
ErtongjiezhongshiEntity.java 6KB
ErtongjiezhongEntity.java 6KB
MPUtil.java 5KB
UserController.java 5KB
YimiaoxinxiModel.java 5KB
ErtongxinxiModel.java 5KB
YimiaoxinxiVO.java 5KB
MavenWrapperDownloader.java 5KB
ErtongxinxiVO.java 5KB
ErtongjiezhongshiModel.java 5KB
ErtongjiezhongshiVO.java 5KB
ErtongjiezhongModel.java 4KB
ErtongjiezhongVO.java 4KB
YiliaojigouEntity.java 4KB
YonghuEntity.java 4KB
YuyuejiezhongEntity.java 4KB
QuxiaoyuyueEntity.java 4KB
BaiduUtil.java 4KB
FileController.java 4KB
AuthorizationInterceptor.java 3KB
ConfigController.java 3KB
DiscussyimiaoxinxiEntity.java 3KB
StoreupEntity.java 3KB
YimiaoanquanjiaoyuEntity.java 3KB
YiliaojigouModel.java 3KB
YonghuModel.java 3KB
YiliaojigouVO.java 3KB
YuyuejiezhongModel.java 3KB
YonghuVO.java 3KB
Query.java 3KB
YuyuejiezhongVO.java 3KB
QuxiaoyuyueModel.java 3KB
QuxiaoyuyueVO.java 2KB
TokenServiceImpl.java 2KB
TokenEntity.java 2KB
YimiaoanquanjiaoyuServiceImpl.java 2KB
DiscussyimiaoxinxiServiceImpl.java 2KB
ErtongjiezhongshiServiceImpl.java 2KB
ErtongjiezhongServiceImpl.java 2KB
YuyuejiezhongServiceImpl.java 2KB
PageUtils.java 2KB
QuxiaoyuyueServiceImpl.java 2KB
YiliaojigouServiceImpl.java 2KB
ErtongxinxiServiceImpl.java 2KB
YimiaoxinxiServiceImpl.java 2KB
StoreupServiceImpl.java 2KB
YonghuServiceImpl.java 2KB
DiscussyimiaoxinxiModel.java 2KB
StoreupModel.java 2KB
DiscussyimiaoxinxiVO.java 2KB
StoreupVO.java 2KB
YimiaoanquanjiaoyuModel.java 2KB
InterceptorConfig.java 1KB
YimiaoanquanjiaoyuVO.java 1KB
UserServiceImpl.java 1KB
CommonServiceImpl.java 1KB
UserEntity.java 1KB
DiscussyimiaoxinxiService.java 1KB
YimiaoanquanjiaoyuService.java 1KB
SpringContextUtils.java 1KB
ErtongjiezhongshiService.java 1KB
DiscussyimiaoxinxiDao.java 1KB
ValidatorUtils.java 1KB
YimiaoanquanjiaoyuDao.java 1KB
ErtongjiezhongshiDao.java 1KB
ErtongjiezhongService.java 1KB
SQLFilter.java 1KB
YuyuejiezhongService.java 1KB
ErtongjiezhongDao.java 1KB
YiliaojigouService.java 1KB
YimiaoxinxiService.java 1KB
ErtongxinxiService.java 1KB
QuxiaoyuyueService.java 1KB
YuyuejiezhongDao.java 1019B
HttpClientUtils.java 1013B
共 875 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
xziyuan
- 粉丝: 879
- 资源: 129
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功