diff --git a/meeting2/.gitignore b/meeting2/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2
--- /dev/null
+++ b/meeting2/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/meeting2/README.md b/meeting2/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..4de2953dc4bbc676e2b3931d016d7c99388358d5
--- /dev/null
+++ b/meeting2/README.md
@@ -0,0 +1,39 @@
+# TheMeetingRoom
+
+#### 介绍
+{**以下是 Gitee 平台说明,您可以替换此简介**
+Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
+无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
+
+#### 软件架构
+软件架构说明
+
+
+#### 安装教程
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### 使用说明
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### 参与贡献
+
+1. Fork 本仓库
+2. 新建 Feat_xxx 分支
+3. 提交代码
+4. 新建 Pull Request
+
+
+#### 特技
+
+1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
+2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
+3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
+4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
+5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
+6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/meeting2/pom.xml b/meeting2/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5118fd41a454bdb28949b28fdfec8846d521b065
--- /dev/null
+++ b/meeting2/pom.xml
@@ -0,0 +1,139 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.4
+
+
+ com.example
+ meetingroom
+ 0.0.1-SNAPSHOT
+ meetingroom
+ Demo project for Spring Boot
+
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.2.0
+
+
+
+
+ org.apache.shiro
+ shiro-all
+ 1.7.1
+
+
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.3.1
+
+
+
+ commons-io
+ commons-io
+ 2.5
+
+
+
+
+ org.apache.poi
+ poi
+ 3.17
+
+
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+
+ com.tencentcloudapi
+ tencentcloud-sdk-java
+ 3.1.352
+
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.62
+
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.10.2
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/meeting2/src/main/java/com/example/meetingroom/MeetingroomApplication.java b/meeting2/src/main/java/com/example/meetingroom/MeetingroomApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..6399586e286a6ec86e082cfca837f8539f0e54b2
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/MeetingroomApplication.java
@@ -0,0 +1,17 @@
+package com.example.meetingroom;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@MapperScan("com.example.meetingroom.dao")
+@SpringBootApplication
+@EnableTransactionManagement
+public class MeetingroomApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(MeetingroomApplication.class, args);
+ }
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/config/EmployeeRealm.java b/meeting2/src/main/java/com/example/meetingroom/config/EmployeeRealm.java
new file mode 100644
index 0000000000000000000000000000000000000000..2cfff9e07c5f1dc01c6f503f25a7d7ef4edcf754
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/config/EmployeeRealm.java
@@ -0,0 +1,94 @@
+package com.example.meetingroom.config;
+
+import com.example.meetingroom.entity.EmployeeInfo;
+import com.example.meetingroom.service.EmployeeInfoService;
+import com.example.meetingroom.service.RoleService;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.subject.support.DefaultSubjectContext;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+
+/**
+ * Shiro中自定义Realm,自定义认证和授权
+ */
+@Component
+public class EmployeeRealm extends AuthorizingRealm {
+
+ @Autowired
+ private EmployeeInfoService employeeInfoService;
+
+ @Autowired
+ private RoleService roleService;
+
+ /**
+ * +
+ * 对用户进行授权,同时传递该用户的身份信息。
+ *
+ * @param principalCollection
+ * @return
+ */
+ @Override
+ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
+ System.out.println("正在授权...");
+ EmployeeInfo primaryPrincipal = (EmployeeInfo) principalCollection.getPrimaryPrincipal();
+ System.out.println("------------------" + primaryPrincipal);
+ String id = employeeInfoService.getRoleIdByPhone(primaryPrincipal.getPhone());
+ String role = roleService.getRoleByRoleId(primaryPrincipal.getRoleId());
+ SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
+ SecurityUtils.getSubject().getSession().setAttribute("identity", role);
+ SecurityUtils.getSubject().getSession().setAttribute("id", primaryPrincipal.getId());
+ System.out.println(SecurityUtils.getSubject().getSession().getAttribute("identity"));
+ System.out.println("授权-----------" + role);
+ info.addRole(role);
+ return info;
+ }
+
+ /**
+ * 进行用户的登录。登录之前会调用Session管理器,来找到活跃的Sessions,查看是否有相同的用户进行登录,有则进行下线处理。
+ * 然后再进行账号密码的比对进行登录。
+ *
+ * @param authenticationToken
+ * @return
+ * @throws AuthenticationException
+ */
+ @Override
+ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
+ //实现单用户登录,通过安全管理器,得到Session管理器,再去获得正在活跃的Sessions。
+ UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
+ Object principal = token.getPrincipal();
+ String username = token.getUsername();
+ EmployeeInfo employee = employeeInfoService.getEmployeeInfoByPhone(username);
+ //处理session
+ DefaultWebSecurityManager securityManager = (DefaultWebSecurityManager) SecurityUtils.getSecurityManager();
+ DefaultWebSessionManager sessionManager = (DefaultWebSessionManager) securityManager.getSessionManager();
+ Collection sessions = sessionManager.getSessionDAO().getActiveSessions();//获取当前已登录的用户session列表
+ System.out.println("principal:" + principal);
+ System.out.println("当前正活跃Session个数:" + sessions.size());
+ for (Session session : sessions) {
+ //通过比较当前用户的toString及Session中的用户toString,来判断是否是同一账号。是则进行剔除。
+ System.out.println("已存在的活跃Session:" + session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY));
+ if (String.valueOf(employee).equals(String.valueOf(session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY)))) {
+ sessionManager.getSessionDAO().delete(session);
+ System.out.println("成功剔除相同用户。");
+ }
+ }
+ System.out.println("正在认证...");
+ //根据是否查询到用户而进行对应处理:查无则抛异常,查到则进行认证。
+ if (employee == null) {
+ throw new UnknownAccountException("请检查您的用户名及密码是否有误。");
+ }
+ AuthenticationInfo info = new SimpleAuthenticationInfo(employee, employee.getPassword(), null, getName());
+ return info;
+ }
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/config/GlobalCorsConfig.java b/meeting2/src/main/java/com/example/meetingroom/config/GlobalCorsConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..ac0f8cbe90ed6a1e4fda9b04f8192a3541047a27
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/config/GlobalCorsConfig.java
@@ -0,0 +1,53 @@
+package com.example.meetingroom.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 前后端分离所产生的跨域问题所需配置,全局跨域
+ */
+@Configuration
+public class GlobalCorsConfig {
+
+ /**
+ * 返回一个Cors过滤器,对相应的HTTP请求的放行及配置。
+ * @return
+ */
+ @Bean
+ public CorsFilter corsFilter() {
+ CorsConfiguration corsConfig = new CorsConfiguration();
+ //设置Origin(原始域)
+ corsConfig.addAllowedOrigin("*");
+ //设置是否发送cookie
+ corsConfig.setAllowCredentials(true);
+ //放行哪些原始域(头部信息)
+ corsConfig.addAllowedHeader("*");
+ //暴露哪些头部信息
+ corsConfig.addExposedHeader("*");
+ //配置映射路径
+ UrlBasedCorsConfigurationSource configurationSource = new UrlBasedCorsConfigurationSource();
+ configurationSource.registerCorsConfiguration("/**", corsConfig);
+ return new CorsFilter(configurationSource);
+ }
+
+ /**
+ * 对请求方式的放行。
+ * @return
+ */
+ @Bean
+ public WebMvcConfigurer webMvcConfigurer() {
+ return new WebMvcConfigurer() {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**").allowedOriginPatterns("*").allowCredentials(true).
+ allowedMethods("*").maxAge(3600);
+ }
+ };
+ }
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/config/ShiroConfig.java b/meeting2/src/main/java/com/example/meetingroom/config/ShiroConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..566b13d459febd62977cf396090ad48a34fa5a84
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/config/ShiroConfig.java
@@ -0,0 +1,92 @@
+package com.example.meetingroom.config;
+
+import com.example.meetingroom.filter.CustomRolesAuthorizationFilter;
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+;
+
+/**
+ * Shiro的配置文件,在这里配置Shiro的三件套及登录拦截。
+ */
+@Configuration
+public class ShiroConfig {
+
+
+ /**
+ * 配置过滤的相关信息。如过滤何种界面,设置登录返回界面等。
+ *
+ * @param webSecurityManager
+ * @return ShiroFilterFactoryBean
+ */
+ @Bean
+ public ShiroFilterFactoryBean shiroFilter(@Qualifier("defaultWebSecurityManager") SecurityManager webSecurityManager) {
+ ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
+ shiroFilterFactoryBean.setSecurityManager(webSecurityManager);
+ Map filterChainDefinitionMap = new LinkedHashMap<>();
+ Map filterMap = new LinkedHashMap<>();
+ filterMap.put("roleOf", new CustomRolesAuthorizationFilter());
+ shiroFilterFactoryBean.setFilters(filterMap);
+ //设置登录失败返回的页面
+ shiroFilterFactoryBean.setLoginUrl("/api/");
+ //静态资源的放行
+
+ //权限放行
+ filterChainDefinitionMap.put("/login", "anon");
+ filterChainDefinitionMap.put("/api/oper/**", "authc,roles[超级管理员]");
+ filterChainDefinitionMap.put("/logout", "logout");
+
+ shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+ return shiroFilterFactoryBean;
+ }
+
+ /**
+ * Session管理器,设置全局Session的配置。
+ *
+ * @return DefaultWebSessionManager
+ */
+ @Bean
+ public DefaultWebSessionManager sessionManager() {
+ DefaultWebSessionManager defaultSessionManager = new DefaultWebSessionManager();
+ //分别设置 session状态,全局会话时间,及删除失效session
+ defaultSessionManager.setSessionValidationSchedulerEnabled(false);
+ defaultSessionManager.setGlobalSessionTimeout(60 * 30 * 1000);
+ defaultSessionManager.setDeleteInvalidSessions(true);
+ return defaultSessionManager;
+ }
+
+ /**
+ * 安全管理器,设置自用Realm和其他管理器。
+ *
+ * @param realm
+ * @param sessionManager
+ * @return SecurityManager
+ */
+ @Bean
+ public SecurityManager defaultWebSecurityManager(EmployeeRealm realm,
+ DefaultWebSessionManager sessionManager) {
+ //关于Shiro管理session的设置(启用session)
+ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+ securityManager.setRealm(realm);
+ securityManager.setSessionManager(sessionManager);
+ return securityManager;
+ }
+
+ /**
+ * 自用Realm,当前是EmployeeRealm。
+ *
+ * @return EmployeeRealm
+ */
+ @Bean
+ public EmployeeRealm realm() {
+ return new EmployeeRealm();
+ }
+}
\ No newline at end of file
diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/DepartController.java b/meeting2/src/main/java/com/example/meetingroom/controller/DepartController.java
new file mode 100644
index 0000000000000000000000000000000000000000..38a5f2407362ec99d8157bd014c3429829abc2e4
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/controller/DepartController.java
@@ -0,0 +1,115 @@
+package com.example.meetingroom.controller;
+
+import com.example.meetingroom.entity.Depart;
+import com.example.meetingroom.service.DepartService;
+import com.example.meetingroom.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @function:
+ * @Author:
+ * @Date: 2021-9-8 08:10:07
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/api/oper")
+public class DepartController {
+
+ @Autowired
+ private DepartService departService;
+
+ //用于判断是否成功
+ private Integer judge;
+
+ /**
+ * @param depart
+ * @return ResultVo 统一消息回复
+ * 用于超管新增部门信息
+ */
+// @RequestMapping(value = "/depart",method = RequestMethod.POST)
+ @PostMapping("/depart")
+ public ResultVo insertDepart(@RequestBody Depart depart){
+
+ judge = departService.insertDepart(depart);
+
+ Map map = new HashMap<>();
+// map.put("超管新增部门信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管新增部门失败",map);
+ }
+ return ResultVo.ok(200,"超管新增部门成功",map);
+ }
+
+ /**
+ * @param depart
+ * @return ResultVo 统一消息回复
+ * 用于超管对会议室信息的修改操作
+ */
+// @RequestMapping(value = "/updateDepart",method = RequestMethod.PUT)
+ @PutMapping("/depart")
+ public ResultVo updateDepart(@RequestBody Depart depart){
+
+ judge = departService.updateDepart(depart);
+
+ Map map = new HashMap<>();
+// map.put("超管修改部门信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管修改部门失败",map);
+ }
+ return ResultVo.ok(200,"超管修改部门成功",map);
+ }
+
+ /**
+ * @param id 会议室id,根据id进行删除操作
+ * @return ResultVo 统一消息回复
+ * 用于超管对会议室信息的删除操作
+ */
+// @RequestMapping(value = "/deleteDepart",method = RequestMethod.DELETE)
+ @DeleteMapping("/depart/{id}")
+ public ResultVo deleteDepart(@PathVariable("id")String id){
+ judge = departService.deleteDepart(id);
+
+ Map map = new HashMap<>();
+// map.put("超管删除部门信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管删除部门失败",map);
+ }
+ return ResultVo.ok(200,"超管删除部门成功",map);
+ }
+
+ /**
+ * @return ResultVo 统一消息回复
+ * 用于向超管展示部门信息
+ */
+// @RequestMapping(value = "/selectDepartList",method = RequestMethod.GET)
+ @GetMapping("/depart")
+ public ResultVo selectDepartList(){
+
+ List departList = departService.selectDepartList();
+
+ Map map = new HashMap<>();
+
+
+ //判断成功与否
+ if(departList == null){
+ return ResultVo.error(500,"向展示部门信息失败",map);
+ }
+ map.put("departData", departList);
+ System.out.println(departList);
+ return ResultVo.ok(200,"向展示部门信息成功",map);
+ }
+
+
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeInfoController.java b/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeInfoController.java
new file mode 100644
index 0000000000000000000000000000000000000000..9bf2a6f86fc76b8d9890f93b651d88d407072b9e
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeInfoController.java
@@ -0,0 +1,229 @@
+package com.example.meetingroom.controller;
+
+import com.example.meetingroom.entity.EmployeeInfo;
+import com.example.meetingroom.service.EmployeeInfoService;
+import com.example.meetingroom.service.RoleService;
+import com.example.meetingroom.vo.EmployeeInfoVo;
+import com.example.meetingroom.vo.PageVo_xuan;
+import com.example.meetingroom.vo.ResultVo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @function:
+ * @Author:
+ * @Date: 2021-9-8 08:10:07
+ */
+@RestController
+@CrossOrigin()
+@RequestMapping("/api")
+public class EmployeeInfoController {
+
+ @Autowired
+ private EmployeeInfoService employeeInfoService;
+
+ //用于判断是否成功
+ private Integer judge;
+
+ /**
+ * @param currentPage 前端跳转页参数
+ * @param currentCount 每页显示数据量数
+ * @return ResultVo 统一消息回复
+ * 用于分页和分页跳转
+ */
+ @GetMapping("/employeeInfo/{currentPage}/{currentCount}")
+ public ResultVo selectEmployeeInfoPage(@PathVariable("currentPage")Integer currentPage
+ , @PathVariable("currentCount")Integer currentCount,HttpServletRequest request){
+
+// Object role = request.getSession().getAttribute("identity");
+
+
+// if (role == "???"){
+// PageVo_xuan EmployeeInfoList = employeeInfoService.selectEmployeeInfoPage(currentPage, currentCount,1);
+// }else {
+// PageVo_xuan EmployeeInfoList = employeeInfoService.selectEmployeeInfoPage(currentPage, currentCount,0);
+//
+// }
+
+ Map map = new HashMap<>();
+ PageVo_xuan EmployeeInfoList = null;
+ try {
+ EmployeeInfoList = employeeInfoService.selectEmployeeInfoPage(currentPage, currentCount,1);
+ } catch (Exception e) {
+ return ResultVo.error(500, "参数异常,跳转页不能为0",map);
+ }
+
+
+
+
+ map.put("pageData", EmployeeInfoList);
+
+ if(EmployeeInfoList.getList() == null){
+ return ResultVo.error(500,"请求参数大于总页数,跳转失败",map);
+ }
+
+ return ResultVo.ok(200, "跳转成功",map);
+
+ }
+
+ @GetMapping("/employeeInfo/{str}")
+ public ResultVo selectNameOrNunberObtainEmployeeInfo(@PathVariable("str") String str){
+
+ //最后 int 类型参数为权限信息,现为虚假数据
+ List employeeInfoVoList = employeeInfoService.selectNameOrNunberObtainEmployeeInfo(str, 0);
+
+ Map map = new HashMap<>();
+
+
+ if (employeeInfoVoList.size() == 0){
+ return ResultVo.error(200, "查询不存在", map);
+ }
+ map.put("查询结果", employeeInfoVoList);
+ return ResultVo.ok(200, "查询成功",map);
+ }
+
+ /**
+ * @param employeeInfo
+ * @return ResultVo 统一消息回复
+ * 用于普管和超管修改员工信息
+ */
+ @PutMapping("/employeeInfo")
+ public ResultVo updateEmployeeInfo(@RequestBody EmployeeInfo employeeInfo){
+
+// Object role = request.getSession();
+// if (role != null){
+// judge = employeeInfoService.updateEmployeeInfo(employeeInfo,1);
+// }else {
+// judge = employeeInfoService.updateEmployeeInfo(employeeInfo,0);
+// }
+
+ //最后 int 类型参数为权限信息,现为虚假数据
+ judge = employeeInfoService.updateEmployeeInfo(employeeInfo,1);
+
+ Map map = new HashMap<>();
+// map.put("超管修改员工信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管修改员工信息失败",map);
+ }
+ return ResultVo.ok(200,"超管修改员工信息成功",map);
+ }
+
+
+ /**
+ * @param id
+ * @return ResultVo 统一消息回复
+ * 用于普管和超管对员工信息的删除操作
+ */
+ @DeleteMapping("/employeeInfo/{id}")
+ public ResultVo deleteEmployeeInfo(@PathVariable("id")String id){
+ judge = employeeInfoService.deleteEmployeeInfo(id);
+
+ Map map = new HashMap<>();
+// map.put("管理员删除员工信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管删除员工信息失败",map);
+ }
+ return ResultVo.ok(200,"超管删除员工信息成功",map);
+ }
+
+ /**
+ * @param employeeInfo
+ * @return
+ * 用于普管和超管对员工信息的新增操作
+ */
+// @RequestMapping(value = "/insertEmployeeInfo",method = RequestMethod.POST)
+ @PostMapping("/employeeInfo")
+ public ResultVo insertEmployeeInfo(@RequestBody EmployeeInfo employeeInfo){
+
+ //最后一个参数为权限,现为模拟
+ judge = employeeInfoService.insertEmployeeInfo(employeeInfo,0);
+
+ Map map = new HashMap<>();
+// map.put("超管新增员工信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管新增新增员工信息失败",map);
+ }
+ return ResultVo.ok(200,"超管新增新增员工信息成功",map);
+ }
+
+ /**
+ * 用户登录。若登录成功,会根据其所有的权限来进行相应界面的跳转。
+ *
+ * @param phone 账号
+ * @param password 前端加密后的MD5密码
+ * @return
+ */
+ @RequestMapping(value = "/login", method = RequestMethod.POST)
+ public ResultVo login(@RequestParam("phone") String phone,
+ @RequestParam("password") String password) {
+ Map data = new LinkedHashMap<>();
+ UsernamePasswordToken token = new UsernamePasswordToken(phone, password);
+ //Shiro框架中获取Subject对象,之后让Shiro进行用户名和密码的校验。
+ Subject user = SecurityUtils.getSubject();
+ if (!user.isAuthenticated()) {
+ try {
+ user.login(token);
+ } catch (AuthenticationException e) {
+ //认证失败则会返回失败的信息。
+ data.put("登录状态", "失败");
+ return ResultVo.error(404, "请检查您的用户密码是否有误。", data);
+ }
+ }
+ //登陆成功后
+ data.put("登录状态", "成功");
+ if (user.hasRole("超级管理员")) {
+ return ResultVo.ok(200, "登录成功,跳转到超级管理员界面。", data);
+ }
+ return ResultVo.ok(200, "登录成功。跳转到员工界面。", data);
+ }
+
+ /**
+ * 用户登出,登出之后会进行JSESSION的清空。
+ *
+ * @return 提示用户已经登出。
+ */
+ @RequestMapping(value = "/logout", method = RequestMethod.GET)
+ public ResultVo logout() {
+ SecurityUtils.getSubject().logout();
+ return ResultVo.ok(200, "用户已登出系统。", null);
+ }
+
+ /**
+ * 用户修改密码,会先验证存在的账号和旧密码是否属实,若成功则进行密码的修改。
+ *
+ * @param phone 账号
+ * @param oldPassword 旧密码
+ * @param newPassword 新密码
+ * @return 根据密码是否修改来返回是否修改成功的信息。
+ */
+ @RequestMapping(value = "/changePassword", method = RequestMethod.POST)
+ public ResultVo changePassword(@RequestParam("phone") String phone,
+ @RequestParam("oldPassword") String oldPassword,
+ @RequestParam("newPassword") String newPassword) {
+ EmployeeInfo employee = employeeInfoService.getEmployeeInfoByPhoneAndPassword(phone, oldPassword);
+ if (employee != null) {
+ int isSuccess = employeeInfoService.updatePassword(phone, newPassword);
+ } else {
+ return ResultVo.error(404, "请确认您的旧密码是否有误!", null);
+ }
+ return ResultVo.ok(200, "您的密码已成功修改!", null);
+ }
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeRegisterController.java b/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeRegisterController.java
new file mode 100644
index 0000000000000000000000000000000000000000..3aaca7e5f67bcfc007b3891ead0003cbadd9674b
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/controller/EmployeeRegisterController.java
@@ -0,0 +1,191 @@
+package com.example.meetingroom.controller;
+
+import com.example.meetingroom.entity.EmployeeInfo;
+import com.example.meetingroom.entity.EmployeeRegister;
+import com.example.meetingroom.service.EmployeeInfoService;
+import com.example.meetingroom.service.EmployeeRegisterService;
+import com.example.meetingroom.vo.EmployeeRegisterVo;
+import com.example.meetingroom.vo.PageVo_xuan;
+import com.example.meetingroom.vo.ResultVo;
+import io.lettuce.core.output.SocketAddressOutput;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @function:
+ * @Author:
+ * @Date: 2021-9-8 08:10:07
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/api")
+public class EmployeeRegisterController {
+
+
+ @Autowired
+ private EmployeeRegisterService employeeRegisterService;
+
+ @Autowired
+ private EmployeeInfoService employeeInfoService;
+
+ //用于判断是否成功
+ private Integer judge;
+
+ /**
+ * @param currentPage 前端跳转页参数
+ * @param currentCount 每页显示数据量数
+ * @return ResultVo 统一消息回复
+ * 用于分页和分页跳转
+ */
+// @RequestMapping(value = "/selectEmployeeRegisterPage/{currentPage}/{currentCount}",method = RequestMethod.GET)
+ @GetMapping("/employeeRegister/{currentPage}/{currentCount}")
+ public ResultVo selectEmployeeRegisterPage(@PathVariable("currentPage")Integer currentPage
+ , @PathVariable("currentCount")Integer currentCount, HttpServletRequest request){
+
+ // Object role = request.getSession().getAttribute("identity");
+
+
+// if (role == "???"){
+// PageVo_xuan EmployeeInfoList = employeeInfoService.selectEmployeeInfoPage(currentPage, currentCount,1);
+// }else {
+// PageVo_xuan EmployeeInfoList = employeeInfoService.selectEmployeeInfoPage(currentPage, currentCount,0);
+//
+// }
+
+ Map map = new HashMap<>();
+ //最后 int 类型参数为权限信息,现为虚假数据
+ PageVo_xuan employeeRegisterVoPageVo = null;
+ try {
+ employeeRegisterVoPageVo = employeeRegisterService.selectEmployeeRegisterPage(currentPage, currentCount, 1);
+ } catch (Exception e) {
+ return ResultVo.error(500, "参数异常,跳转页不能为0",map);
+ }
+
+
+ map.put("pageData", employeeRegisterVoPageVo);
+
+
+ if(employeeRegisterVoPageVo.getList() == null){
+ return ResultVo.error(500,"请求参数大于总页数,跳转失败",map);
+ }
+
+ return ResultVo.ok(200, "跳转成功",map);
+
+ }
+
+// @RequestMapping(value = "/deleteEmployeeRegister",method = RequestMethod.DELETE)
+ @DeleteMapping("/employeeRegister/{id}")
+ public ResultVo deleteEmployeeRegister(@PathVariable("id")String id){
+ judge = employeeRegisterService.deleteEmployeeRegister(id);
+
+ Map map = new HashMap<>();
+// map.put("超管删除注册表信息", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管删除注册表信息失败",map);
+ }
+ return ResultVo.ok(200,"超管删除注册表信息成功",map);
+ }
+
+
+
+
+
+// ================================================================================================
+
+ /**
+ * @param employeeRegister
+ * @return
+ * 管理员修改注册表
+ */
+// @RequestMapping(value = "/updateEmployeeRegister",method = RequestMethod.PUT)
+ @PutMapping("/employeeRegister")
+ public ResultVo updateEmployeeRegister(@RequestBody EmployeeRegister employeeRegister){
+
+ //模拟管理员id
+ String adminId = "1";
+
+ judge = 0;
+
+ //previousState:审前状态,afterState:审后状态
+ String previousState = employeeRegisterService.selectEmployeeRegisterStatus(employeeRegister.getId());
+ String afterState = employeeRegister.getEmployeeRegisterStatus();
+
+ //判断修改前后状态
+ // (相同状态) || (审前待审核 && 审后未通过)这种情况不用新增和删除员工,只用更改注册表
+ if (previousState.equals(afterState) || (previousState.equals("待审核") && afterState.equals("未通过"))){
+
+ System.out.println("(相同状态) || (审前待审核 && 审后未通过)这种情况不用新增和删除员工,只用更改注册表");
+ judge = employeeRegisterService.updateEmployeeRegister(employeeRegister,adminId);
+
+ } else if((previousState.equals("待审核") && afterState.equals("已通过")) ||
+ (previousState.equals("未通过") && afterState.equals("已通过"))){
+ //(审前待审核 && 审后已通过) || (审前未通过 && 审后已通过) 这种情况需要新增员工和用更改注册表
+
+ System.out.println("(审前待审核 && 审后已通过) || (审前未通过 && 审后已通过) 这种情况需要新增员工和用更改注册表");
+ judge = employeeRegisterService.updateEmployeeRegister(employeeRegister,adminId);
+
+ //查询注册密码
+ employeeRegister.setPassword(employeeRegisterService.selectEmployeeInfoPasswode(employeeRegister.getPhone()));
+ employeeRegisterService.insertEmployeeInfo(employeeRegister);
+
+ } else if(previousState.equals("已通过") && afterState.equals("未通过")){
+ // 审前已通过 && 审后未通过 这种情况需要删除员工和用更改注册表
+
+ System.out.println("审前已通过 && 审后未通过 这种情况需要删除员工和用更改注册表");
+ judge = employeeRegisterService.updateEmployeeRegister(employeeRegister,adminId);
+ employeeRegisterService.deleteEmployeeRegisterPhone(employeeRegister.getPhone());
+
+
+ }else{
+ System.out.println("error");
+ }
+
+
+ Map map = new HashMap<>();
+// map.put("管理员修改注册表审核结果和原因", judge);
+
+ //判断成功与否
+ if(judge != 1){
+ return ResultVo.error(500,"超管修改注册表审核结果和原因失败",map);
+ }
+ return ResultVo.ok(200,"超管修改注册表审核结果和原因成功",map);
+ }
+
+ /**
+ * 传入的数据封装成EmployeeRegister,再通过EmployeeRegisterDao插入一名新用户。
+ * 考虑到会有已注册账号进行注册的问题,同时需要管理员审核的问题,故会检测是否有该用户注册过,返回验证的信息、
+ * @param register Post请求传入的注册信息
+ * @return 返回是否能够注册,同时返回是否已经注册过。
+ */
+ @PostMapping("/register")
+ public ResultVo register(EmployeeRegister register) {
+ EmployeeRegister registerEmployee = register;
+ ResultVo resultVo;
+ Map data = new LinkedHashMap<>();
+ //设置注册状态为”待审批“。
+ registerEmployee.setEmployeeRegisterStatus("待审批");
+ //查看是否有重复手机号码注册的情况,如若有则提示存在相同号码,但不影响待审批
+ EmployeeInfo registeredUser = employeeInfoService.getEmployeeInfoByPhone(register.getPhone());
+ if (registeredUser == null) {
+ data.put("用户注册状态", "该手机号未注册。");
+ } else {
+ data.put("用户注册状态", "该手机号已注册。");
+ }
+ //调用EmployeeRegisterDao来插入一条新用户,并根据成功与否来决定返回的结果
+ int isInsert = employeeRegisterService.insertRegister(registerEmployee);
+ if (isInsert == 1) {
+ resultVo = ResultVo.ok(200, "成功将注册信息添加至审核表中。", data);
+ } else {
+ resultVo = ResultVo.error(500, "系统出错。", data);
+ }
+ return resultVo;
+ }
+
+}
diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/ExcelController.java b/meeting2/src/main/java/com/example/meetingroom/controller/ExcelController.java
new file mode 100644
index 0000000000000000000000000000000000000000..84b22d74dd79f0bf3e431c71ead9827ed01cbe8d
--- /dev/null
+++ b/meeting2/src/main/java/com/example/meetingroom/controller/ExcelController.java
@@ -0,0 +1,160 @@
+package com.example.meetingroom.controller;
+
+import com.example.meetingroom.service.EmployeeInfoService;
+import com.example.meetingroom.service.ExcelService;
+import com.example.meetingroom.service.RoomOrderService;
+import com.example.meetingroom.vo.ResultVo;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * @Function: TODO
+ * @Author: Chen si ran
+ * @Date: 2021/9/9 8:57
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/api")
+public class ExcelController {
+
+ @Autowired
+ private ExcelService excelService;
+
+ @Autowired
+ private EmployeeInfoService employeeInfoService;
+
+ @Autowired
+ private RoomOrderService roomOrderService;
+
+ /**
+ * @function: TODO
+ * @param
+ * @return
+ */
+ @PostMapping("/employeeFile")
+ public ResultVo importExcel(@RequestParam("uploadFile")MultipartFile uploadFile) throws IOException {
+
+ //判断文件不为空(传递判空)
+ if (uploadFile.isEmpty()){
+ return ResultVo.error(500,"导入失败,该文件为空!",null);
+ }
+
+ //0为普管,1为超管
+ int role = 1;
+
+ //获取上传文件的全称
+ String fileType = excelService.getType(uploadFile.getOriginalFilename());
+
+ //创建工作簿
+ Workbook workbook = null;
+
+ //根据类型判断使用哪个版本的实现类(03/07)
+ switch (fileType){
+ //03版本的excel
+ case "xls":
+ workbook = new HSSFWorkbook(uploadFile.getInputStream());
+ break;
+ //07版本的excel
+ case "xlsx":
+ workbook = new XSSFWorkbook(uploadFile.getInputStream());
+ break;
+ default:
+ return ResultVo.error(500,"导入失败,请导入Excel表格!",null);
+ }
+
+ //获取一个工作表
+ Sheet sheet = workbook.getSheetAt(0);
+
+ List> excelData = excelService.getSheetValue(sheet);
+
+ //执行批量插入方法,若返回值为true则表示插入成功
+ try {
+ if (employeeInfoService.insertBatch(excelData,role)){
+ return ResultVo.ok(200,"导入成功!",null);
+ }
+ }catch (NumberFormatException e){
+ e.printStackTrace();
+ return ResultVo.error(500,"导入失败,第一个表为空!",null);
+ }
+
+ return ResultVo.ok(500,"导入失败,请检查文件是否符合格式!",null);
+ }
+
+ @GetMapping("/employeeFile")
+ public ResultVo exportEmployeeExcel(){
+
+ //0为普管,1为超管
+ int role = 0;
+ String[] headers = {};
+ List