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.YuangongEntity;
import com.entity.view.YuangongView;
import com.service.YuangongService;
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-03-22 17:32:51
*/
@RestController
@RequestMapping("/yuangong")
public class YuangongController {
@Autowired
private YuangongService yuangongService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"yuangong", "员工" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YuangongEntity yuangong){
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yuangong.setId(uId);
yuangongService.insert(yuangong);
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");
YuangongEntity user = yuangongService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
yuangongService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YuangongEntity yuangong,
HttpServletRequest request){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
PageUtils page = yuangongService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangong), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YuangongEntity yuangong, HttpServletRequest request){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
PageUtils page = yuangongService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangong), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YuangongEntity yuangong){
EntityWrapper<YuangongEntity> ew = new EntityWrapper<YuangongEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangong, "yuangong"));
return R.ok().put("data", yuangongService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YuangongEntity yuangong){
EntityWrapper< YuangongEntity> ew = new EntityWrapper< YuangongEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangong, "yuangong"));
YuangongView yuangongView = yuangongService.selectView(ew);
return R.ok("查询员工成功").put("data", yuangongView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YuangongEntity yuangong = yuangongService.selectById(id);
return R.ok().put("data", yuangong);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YuangongEntity yuangong = yuangongService.selectById(id);
return R.ok().put("data", yuangong);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
yuangong.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yuangong.setId(new Date().getTime());
yuangongService.insert(yuangong);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
yuangong.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangong);
YuangongEntity user = yuangongService.selectOne(new EntityWrapper<YuangongEntity>().eq("gonghao", yuangong.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yuangong.setId(new Date().getTime());
yuangongService.insert(yuangong);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YuangongEntity yuangong, HttpServletRequest request){
//ValidatorUtils.validateEntity(yuangong);
yuangongService.updateById(yuangong);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yuangongService.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 remind
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
SpringBoot 项目,可作为毕业设计,课程设计,小区物业管理系统,项目经过严格调试,确保可以运行。 1 技术组成 前端:Vue/JSP 开发环境:idea/tomcat/mySql 后台框架:SpringBoot 1 实现功能 本系统主要包括以下功能模块:个人中心、业主管理、费用缴纳管理、疫情防控管理、小区车位管理、车位预约管理、小区活动管理、活动报名管理、小区论坛、系统管理等模块,通过这些模块的实现能够基本满足日常物业管理的操作 3. 部署 里面有部署文档,如果部署有疑问的话,可以加 vx xiaoxu_9411 咨询, 备注:咨询-昵称
资源推荐
资源详情
资源评论
收起资源包目录
基于 springboot+vue+java的的小区物业管理系统+数据库(毕业设计,包括源码,教程).zip (452个子文件)
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
.classpath 2KB
mvnw.cmd 7KB
app.9e7d3b64.css 253KB
chunk-vendors.a72b0961.css 37KB
.factorypath 15KB
.gitignore 364B
index.html 924B
index.html 552B
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
YuangongController.java 9KB
YonghuController.java 9KB
CommonController.java 8KB
TousubianhaoController.java 7KB
TingchexinxiController.java 7KB
FeiyongxinxiController.java 7KB
BaoxiuxinxiController.java 7KB
YezhuxinxiController.java 7KB
LoufangxinxiController.java 7KB
GonggaoxinxiController.java 7KB
CheweixinxiController.java 6KB
BumenxinxiController.java 6KB
MPUtil.java 5KB
UserController.java 5KB
BaoxiuxinxiEntity.java 5KB
MavenWrapperDownloader.java 5KB
TingchexinxiEntity.java 5KB
FeiyongxinxiEntity.java 5KB
YezhuxinxiEntity.java 4KB
YonghuEntity.java 4KB
YuangongEntity.java 4KB
TousubianhaoEntity.java 4KB
LoufangxinxiEntity.java 4KB
BaoxiuxinxiModel.java 4KB
BaoxiuxinxiVO.java 4KB
BaiduUtil.java 4KB
TingchexinxiModel.java 4KB
FileController.java 4KB
TingchexinxiVO.java 3KB
FeiyongxinxiModel.java 3KB
AuthorizationInterceptor.java 3KB
FeiyongxinxiVO.java 3KB
GonggaoxinxiEntity.java 3KB
CheweixinxiEntity.java 3KB
ConfigController.java 3KB
YuangongModel.java 3KB
YezhuxinxiModel.java 3KB
YonghuModel.java 3KB
BumenxinxiEntity.java 3KB
YuangongVO.java 3KB
YezhuxinxiVO.java 3KB
YonghuVO.java 3KB
TousubianhaoModel.java 3KB
TousubianhaoVO.java 3KB
Query.java 3KB
LoufangxinxiModel.java 3KB
LoufangxinxiVO.java 2KB
TokenServiceImpl.java 2KB
TokenEntity.java 2KB
GonggaoxinxiModel.java 2KB
LoufangxinxiServiceImpl.java 2KB
TingchexinxiServiceImpl.java 2KB
GonggaoxinxiServiceImpl.java 2KB
TousubianhaoServiceImpl.java 2KB
FeiyongxinxiServiceImpl.java 2KB
PageUtils.java 2KB
BaoxiuxinxiServiceImpl.java 2KB
CheweixinxiServiceImpl.java 2KB
CheweixinxiModel.java 2KB
YezhuxinxiServiceImpl.java 2KB
BumenxinxiServiceImpl.java 2KB
GonggaoxinxiVO.java 2KB
YuangongServiceImpl.java 2KB
CheweixinxiVO.java 2KB
YonghuServiceImpl.java 2KB
BumenxinxiModel.java 2KB
BumenxinxiVO.java 2KB
InterceptorConfig.java 1KB
UserServiceImpl.java 1KB
CommonServiceImpl.java 1KB
UserEntity.java 1KB
SpringContextUtils.java 1KB
ValidatorUtils.java 1KB
SQLFilter.java 1KB
LoufangxinxiService.java 1KB
TingchexinxiService.java 1KB
TousubianhaoService.java 1KB
GonggaoxinxiService.java 1KB
FeiyongxinxiService.java 1KB
BaoxiuxinxiService.java 1KB
CheweixinxiService.java 1KB
HttpClientUtils.java 1013B
共 452 条
- 1
- 2
- 3
- 4
- 5
gdutxiaoxu
- 粉丝: 1515
- 资源: 2910
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页