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 java.io.IOException;
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.ShoufeirenyuanEntity;
import com.entity.view.ShoufeirenyuanView;
import com.service.ShoufeirenyuanService;
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 2022-02-16 20:15:07
*/
@RestController
@RequestMapping("/shoufeirenyuan")
public class ShoufeirenyuanController {
@Autowired
private ShoufeirenyuanService shoufeirenyuanService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
ShoufeirenyuanEntity user = shoufeirenyuanService.selectOne(new EntityWrapper<ShoufeirenyuanEntity>().eq("shoufeizhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"shoufeirenyuan", "收费人员" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody ShoufeirenyuanEntity shoufeirenyuan){
//ValidatorUtils.validateEntity(shoufeirenyuan);
ShoufeirenyuanEntity user = shoufeirenyuanService.selectOne(new EntityWrapper<ShoufeirenyuanEntity>().eq("shoufeizhanghao", shoufeirenyuan.getShoufeizhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
shoufeirenyuan.setId(uId);
shoufeirenyuanService.insert(shoufeirenyuan);
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");
ShoufeirenyuanEntity user = shoufeirenyuanService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
ShoufeirenyuanEntity user = shoufeirenyuanService.selectOne(new EntityWrapper<ShoufeirenyuanEntity>().eq("shoufeizhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
shoufeirenyuanService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ShoufeirenyuanEntity shoufeirenyuan,
HttpServletRequest request){
EntityWrapper<ShoufeirenyuanEntity> ew = new EntityWrapper<ShoufeirenyuanEntity>();
PageUtils page = shoufeirenyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shoufeirenyuan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ShoufeirenyuanEntity shoufeirenyuan,
HttpServletRequest request){
EntityWrapper<ShoufeirenyuanEntity> ew = new EntityWrapper<ShoufeirenyuanEntity>();
PageUtils page = shoufeirenyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shoufeirenyuan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ShoufeirenyuanEntity shoufeirenyuan){
EntityWrapper<ShoufeirenyuanEntity> ew = new EntityWrapper<ShoufeirenyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( shoufeirenyuan, "shoufeirenyuan"));
return R.ok().put("data", shoufeirenyuanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ShoufeirenyuanEntity shoufeirenyuan){
EntityWrapper< ShoufeirenyuanEntity> ew = new EntityWrapper< ShoufeirenyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( shoufeirenyuan, "shoufeirenyuan"));
ShoufeirenyuanView shoufeirenyuanView = shoufeirenyuanService.selectView(ew);
return R.ok("查询收费人员成功").put("data", shoufeirenyuanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ShoufeirenyuanEntity shoufeirenyuan = shoufeirenyuanService.selectById(id);
return R.ok().put("data", shoufeirenyuan);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ShoufeirenyuanEntity shoufeirenyuan = shoufeirenyuanService.selectById(id);
return R.ok().put("data", shoufeirenyuan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ShoufeirenyuanEntity shoufeirenyuan, HttpServletRequest request){
shoufeirenyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shoufeirenyuan);
ShoufeirenyuanEntity user = shoufeirenyuanService.selectOne(new EntityWrapper<ShoufeirenyuanEntity>().eq("shoufeizhanghao", shoufeirenyuan.getShoufeizhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
shoufeirenyuan.setId(new Date().getTime());
shoufeirenyuanService.insert(shoufeirenyuan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShoufeirenyuanEntity shoufeirenyuan, HttpServletRequest request){
shoufeirenyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shoufeirenyuan);
ShoufeirenyuanEntity user = shoufeirenyuanService.selectOne(new EntityWrapper<ShoufeirenyuanEntity>().eq("shoufeizhanghao", shoufeirenyuan.getShoufeizhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
shoufeirenyuan.setId(new Date().getTime());
shoufeirenyuanService.insert(shoufeirenyuan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShoufeirenyuanEntity shoufeirenyuan, HttpServletRequest request){
//ValidatorUtils.validateEntity(shoufeirenyuan);
shoufeirenyuanService.updateById(shoufeirenyuan);//全部更新
return R.ok();
}
/**
* 删除
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java毕业设计之大健康老年公寓管理系统(ssm+vue完整源码+说明文档) 开发语言:Java 框架:ssm 技术:vue JDK版本:JDK1.8 服务器:tomcat7+ 数据库:mysql 5.7+ 数据库工具:Navicat11+ 开发软件: idea Maven包:Maven3.3.9+
资源推荐
资源详情
资源评论
收起资源包目录
java毕业设计之大健康老年公寓管理系统(ssm+vue完整源码+说明文档).zip (556个子文件)
update-password.vue.bak 3KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
1-install.bat 12B
.classpath 1KB
org.eclipse.wst.common.component 689B
org.eclipse.wst.jsdt.ui.superType.container 49B
app.a619952e.css 270KB
bootstrap.css 143KB
bootstrap.min.css 118KB
chunk-vendors.a72b0961.css 37KB
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-3.css 61B
glyphicons-halflings-regular.eot 20KB
.gitignore 10B
index.html 924B
index.html 552B
favicon.ico 4KB
favicon.ico 4KB
ShoufeirenyuanController.java 9KB
JiedairenyuanController.java 9KB
HulirenyuanController.java 9KB
LaorenController.java 9KB
ChuangweixinxiController.java 8KB
FangjianxinxiController.java 8KB
HulijiluController.java 8KB
JiesuanqingdanController.java 7KB
LaorendanganController.java 7KB
JiedaidengjiController.java 7KB
QuxiaoyuyueController.java 7KB
LaorenyuyueController.java 7KB
RuzhudengjiController.java 7KB
ShengritixingController.java 7KB
LaorenqingjiaController.java 7KB
StoreupController.java 7KB
ShoufeibiaozhunController.java 7KB
CommonController.java 6KB
LaorendanganEntity.java 6KB
JiesuanqingdanEntity.java 6KB
UserController.java 5KB
MPUtil.java 5KB
FangjianxinxiEntity.java 5KB
QuxiaoyuyueEntity.java 5KB
LaorenyuyueEntity.java 5KB
LaorendanganModel.java 5KB
LaorendanganVO.java 5KB
JiesuanqingdanModel.java 5KB
JiesuanqingdanVO.java 5KB
LaorenqingjiaEntity.java 4KB
RuzhudengjiEntity.java 4KB
JiedaidengjiEntity.java 4KB
HulijiluEntity.java 4KB
ChuangweixinxiEntity.java 4KB
JiedairenyuanEntity.java 4KB
FangjianxinxiModel.java 4KB
ShoufeirenyuanEntity.java 4KB
QuxiaoyuyueModel.java 4KB
HulirenyuanEntity.java 4KB
FangjianxinxiVO.java 4KB
LaorenyuyueModel.java 4KB
QuxiaoyuyueVO.java 4KB
LaorenyuyueVO.java 4KB
BaiduUtil.java 4KB
StoreupEntity.java 4KB
LaorenEntity.java 3KB
LaorenqingjiaModel.java 3KB
FileController.java 3KB
RuzhudengjiModel.java 3KB
LaorenqingjiaVO.java 3KB
JiedaidengjiModel.java 3KB
HulijiluModel.java 3KB
RuzhudengjiVO.java 3KB
JiedaidengjiVO.java 3KB
ConfigController.java 3KB
ShengritixingEntity.java 3KB
HulijiluVO.java 3KB
AuthorizationInterceptor.java 3KB
ChuangweixinxiModel.java 3KB
ChuangweixinxiVO.java 3KB
JiedairenyuanModel.java 3KB
ShoufeirenyuanModel.java 3KB
HulirenyuanModel.java 3KB
JiedairenyuanVO.java 3KB
ShoufeibiaozhunEntity.java 3KB
Query.java 3KB
ShoufeirenyuanVO.java 3KB
HulirenyuanVO.java 3KB
TokenServiceImpl.java 2KB
StoreupModel.java 2KB
LaorenModel.java 2KB
StoreupVO.java 2KB
CommonUtil.java 2KB
LaorenVO.java 2KB
TokenEntity.java 2KB
ShoufeibiaozhunServiceImpl.java 2KB
共 556 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
风月歌
- 粉丝: 1644
- 资源: 3433
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功