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 list = null; + + //根据权限选择标题行 + if (role == 0){ + headers = new String[]{"id", "员工编号", "姓名", "部门", "权限", "联系方式", "性别(0为使用,1为不使用)"}; + }else { + headers = new String[]{"id","员工编号","姓名","部门","权限","联系方式","密码","性别"}; + } + + //获取员工信息表数据 + list = employeeInfoService.selectAdmin(); + OutputStream out = null; + try { + out = new FileOutputStream("E://测试员工信息表.xls"); + excelService.export("测试员工信息表",headers,list,out,role); + System.out.println("导出成功!"); + } catch (IOException e) { + e.printStackTrace(); + return ResultVo.error(500,e.getMessage(),null); + }finally { + if (out != null){ + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + return ResultVo.ok(200,"已导出",null); + } + + @GetMapping("/roomOrderFile") + public ResultVo exportRoomExcel(){ + + //0为普管,1为超管 + int role = 1; + String[] headers = {"id", "会议室", "时间", "申请人", "联系电话", "会议主题", "是否使用设备(0为不使用,1为使用)", "预定状态", "审批人", "审批意见", + "参会名单", "会议室类型", "最大可容纳人数", "设备", "位置"}; + List list = roomOrderService.selectAdmin(role); + OutputStream out = null; + try { + out = new FileOutputStream("E://会议室预订记录表.xls"); + excelService.export("会议室预订记录表",headers,list,out,2); + System.out.println("导出成功!"); + } catch (IOException e) { + e.printStackTrace(); + return ResultVo.error(500,e.getMessage(),null); + }finally { + if (out != null){ + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + return ResultVo.ok(200,"已导出",null); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/RoleController.java b/meeting2/src/main/java/com/example/meetingroom/controller/RoleController.java new file mode 100644 index 0000000000000000000000000000000000000000..4b3e018e62136c1c6b22dacd341b691efe6bfb61 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/controller/RoleController.java @@ -0,0 +1,79 @@ +package com.example.meetingroom.controller; + +import com.example.meetingroom.entity.Depart; +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.entity.Role; +import com.example.meetingroom.service.RoleService; +import com.example.meetingroom.vo.ResultVo; +import org.apache.shiro.SecurityUtils; +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") +public class RoleController { + + @Autowired + private RoleService roleService; + +// @GetMapping("/one") +// public String select(@RequestParam String id){ +// Role role = roleService.selectOne(id); +// return role.toString(); +// } + + + /** + * @return + * 查询所有权限,用于员工表权限修改 + */ +// @RequestMapping(value = "/seleteRoleList",method = RequestMethod.GET) + @GetMapping("/role") + public ResultVo seleteRoleList(){ + List roleList = roleService.selectRoleList(); + + Map map = new HashMap<>(); + + + //判断成功与否 + if(roleList == null){ + return ResultVo.error(500,"展示权限信息失败",map); + } + map.put("权限信息", roleList); +// System.out.println(roleList); + return ResultVo.ok(200,"展示权限信息成功",map); + } + + /** + * 首页,登录界面,解决同个浏览器一个session却有多个用户共用的问题(即一个会话多用户登录) + * 通过检查Subject中principal是否为空来判断是否已经有用户登录过。 + * @return 根据情况返回相应页面 + */ + @GetMapping({"/","/index"}) + public ResultVo index(){ + EmployeeInfo principal = (EmployeeInfo) SecurityUtils.getSubject().getPrincipal(); + if (principal != null){ + Map data = new HashMap<>(); + System.out.println("当前存在已登录用户:"+principal); + String principalRole = roleService.getRoleByRoleId(principal.getRoleId()); + System.out.println("当前用户权限为:"+SecurityUtils.getSubject().getSession().getAttribute("identity")); + data.put("role",principalRole); + if ("超级管理员".equals(principalRole)){ + return ResultVo.ok(200,"已存在用户登录,跳转至超级管理员界面。",data); + }else{ + return ResultVo.ok(200,"已存在用户登录,跳转至用户界面。",data); + } + } + return ResultVo.ok(200,"当前会话无用户登录,则显示登录的界面。",null); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/RoomInfoController.java b/meeting2/src/main/java/com/example/meetingroom/controller/RoomInfoController.java new file mode 100644 index 0000000000000000000000000000000000000000..fc8516e9fd8cbdd183900445e568bb0da3a38c51 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/controller/RoomInfoController.java @@ -0,0 +1,134 @@ +package com.example.meetingroom.controller; + +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.service.RoomInfoService; +import com.example.meetingroom.vo.PageVo_xuan; +import com.example.meetingroom.vo.ResultVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.*; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +@RestController +@CrossOrigin +@RequestMapping("/api/oper") +public class RoomInfoController { + + + @Autowired + private RoomInfoService roomInfoService; + + //用于判断是否成功 + private Integer judge; + + + /** + * @param roomInfo + * @return ResultVo 统一消息回复 + * 用于超管对会议室信息的修改操作, + */ +// @RequestMapping(value = "/updateRoomInfo",method = RequestMethod.PUT) + @PutMapping("/roomInfo") + public ResultVo updateRoomInfo(@RequestBody RoomInfo roomInfo){ + + //用于判断是否成功 + Integer judge; + judge = roomInfoService.updateRoomInfo(roomInfo); + + Map map = new HashMap<>(); +// map.put("超管修改会议室信息", judge); + +// System.out.println(judge); + + //判断成功与否 + if(judge != 1){ + return ResultVo.error(500,"超管修改会议室失败",map); + } + +// System.out.println(ResultVo.ok(200, "超管修改会议室成功", map).toString()); + + return ResultVo.ok(200,"超管修改会议室成功",map); + + } + + /** + * @param id 会议室id,根据id进行删除操作 + * @return ResultVo 统一消息回复 + * 用于超管对会议室信息的删除操作 + */ +// @RequestMapping(value = "/deleteRoomInfo",method = RequestMethod.DELETE) + @DeleteMapping("/roomInfo/{id}") + public ResultVo deleteRoomInfo(@PathVariable("id")String id){ + + judge = roomInfoService.deleteRoomInfo(id); + + Map map = new HashMap<>(); +// map.put("超管删除会议室信息", judge); + + //判断成功与否 + if(judge != 1){ + return ResultVo.error(500,"超管删除会议室失败",map); + } + return ResultVo.ok(200,"超管删除会议室成功",map); + } + + /** + * @param roomInfo + * @return ResultVo 统一消息回复 + * 用于超管新增会议室信息 + */ +// @RequestMapping(value = "/insertRoomInfo",method = RequestMethod.POST) + @PostMapping("/roomInfo") + public ResultVo insertRoomInfo(@RequestBody RoomInfo roomInfo){ + + judge = roomInfoService.insertRoomInfo(roomInfo); + + Map map = new HashMap<>(); +// map.put("超管新增会议室信息", judge); + + //判断成功与否 + if(judge != 1){ + return ResultVo.error(500,"超管新增会议室失败",map); + } + return ResultVo.ok(200,"超管新增会议室成功",map); + + } + + /** + * @param currentPage 前端跳转页参数 + * @param currentCount 每页显示数据量数 + * @return ResultVo 统一消息回复 + * 用于分页和分页跳转 + */ +// @RequestMapping(value = "/selectRoomInfoPage/{currentPage}/{currentCount}",method = RequestMethod.GET) + @GetMapping("/roomInfo/{currentPage}/{currentCount}") + public ResultVo selectRoomInfoPage(@PathVariable("currentPage")Integer currentPage + ,@PathVariable("currentCount")Integer currentCount){ + + Map map = new HashMap<>(); + + PageVo_xuan roomInfoList = null; + try { + roomInfoList = roomInfoService.selectRoomInfoPage(currentPage, currentCount); + } catch (Exception e) { + return ResultVo.error(500, "参数异常,跳转页不能为0",map); + } + + if(roomInfoList.getList() == null){ + return ResultVo.error(500,"请求参数大于总页数,跳转失败",map); + } + map.put("pageData", roomInfoList); + + + return ResultVo.ok(200, "跳转成功",map); + + } + + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/RoomOrderController.java b/meeting2/src/main/java/com/example/meetingroom/controller/RoomOrderController.java new file mode 100644 index 0000000000000000000000000000000000000000..c9f70a20a5e13b28d837a12afff0ceff773466b4 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/controller/RoomOrderController.java @@ -0,0 +1,230 @@ +package com.example.meetingroom.controller; + +import com.example.meetingroom.service.RoomOrderService; +import com.example.meetingroom.vo.*; +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.List; +import java.util.Map; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +@RestController +@CrossOrigin +@RequestMapping("/api") +public class RoomOrderController { + + @Autowired + private RoomOrderService roomOrderService; + + /** + * 业务:“()年()月会议室使用次数” + * 功能:获取某年月各会议室的使用次数及对应的会议室名称 + */ + @GetMapping("/RoomOrderNumber/{selectTime}") + public RoomOrderResultVo getRoomOrderNumber(@PathVariable String selectTime){ + List roomOrderList = roomOrderService.getRoomOrderNumber(selectTime); + + Map> map = new HashMap<>(); + + map.put("roomOrderList",roomOrderList); + + return RoomOrderResultVo.ok(200,"成功",map); + } + + /** + * 业务:“会议室简介” + * 功能:从room_info表中获取会议室信息 + */ + @GetMapping("/AllRoomInfo") + public RoomOrderResultVo getAllRoomInfo(){ + List roomInfoList = roomOrderService.getAllRoomInfo(); + + Map> map = new HashMap<>(); + + map.put("RoomInfoList",roomInfoList); + + return RoomOrderResultVo.ok(200,"成功",map); + } + + /** + * 业务:“已预订” + * 功能:从room_order表中获取已预订会议室信息 + */ + @GetMapping("/AllRoomOrderMessage/{name}") + public RoomOrderResultVo getAllRoomOrderMessage(@PathVariable String name){ + List roomOrderMessage = roomOrderService.getAllRoomOrderMessage(name); + + Map> map = new HashMap<>(); + + map.put("roomOrderMessage",roomOrderMessage); + + return RoomOrderResultVo.ok(200,"成功",map); + } + + /** + * ---------------------------------总业务:“会议室预订”------------------------------------------------- + * 分业务:“会议室选择” + * 功能:获取所有会议室名称 + */ + @GetMapping("/AllRoomName") + public RoomOrderResultVo getAllRoomName(){ + List roomNameList = roomOrderService.getAllRoomName(); + + Map> map = new HashMap<>(); + + map.put("roomNameList",roomNameList); + + return RoomOrderResultVo.ok(200,"成功",map); + } + + /** + * 分业务:“参与会议员工” + * 功能:获取所有员工的名称 + */ + @GetMapping("/AllEmployeeName") + public RoomOrderResultVo getAllEmployeeName(){ + List EmployeeNameList = roomOrderService.getAllEmployeeName(); + + Map> map = new HashMap<>(); + + map.put("EmployeeNameList",EmployeeNameList); + + return RoomOrderResultVo.ok(200,"成功",map); + } + + /** + * 分业务:“提交申请” + * 功能:将前端返回的“会议室预订”信息,插入到room_order表中 + */ + @PostMapping("/RoomOrderMessage") + public ResultVo insertRoomOrderMessage(RoomOrderMessageVo roomOrderMessageVo){ + Object RoomOrderMessage = roomOrderService.insertRoomOrderMessage(roomOrderMessageVo); + + Map map = new HashMap<>(); + + map.put("ExecuteNumber",RoomOrderMessage); + + return ResultVo.ok(200,"成功",map); + } + + /** + * -------------------------------------------------------------------------------------------------- + */ + + /** + * @description: 请求会议室预订记录与详情 + * @param: 查询类型,显示行数、显示页数 + * 查询类型 userOrder个人记录 auditOrder待审核 completedOrder所有记录 + * @return: ResultVo + * @author feng + * @date: 2021/9/8 16:12 + */ + @GetMapping("/orders/{selectType}/{pageNum}/{lineNum}") + public ResultVo selectOrder(@PathVariable String selectType, @PathVariable Integer lineNum, @PathVariable Integer pageNum){ + + //普通管理员0,超级管理员1,普通员工也是0,员工用不到role,因为他只需要查他自己,role是为了分辨超管和普管,因为超管可以看到被逻辑删除的数据,普管不可以 + // Integer role =SecurityUtils.getSubject().getSession().getAttribute("identity").equals("普通管理员")?0:1; + //用户id + //String userId = (String) SecurityUtils.getSubject().getSession().getAttribute("userid"); + //还没合体所以,先用默认参数 + + Integer role=1; + String userId = "1"; + //判断参数是否合法 + PageVo pageVo = roomOrderService.checkParams(selectType,lineNum,pageNum,role,userId); + + if(pageVo==null){ + return ResultVo.error(500,"显示行数或当前显示页数错误",null); + } + + //从数据库查询数据获取数据 + Object list = roomOrderService.select(selectType,pageNum,lineNum,role,userId); + + //返回结果对象 + HashMap map=new HashMap(); + map.put("pageData",pageVo); + map.put("orderData",list); + return ResultVo.ok(200, "成功",map); + } + + /** + * @description: 员工修改订单信息 + * @param: 订单编号,订单信息对象 + * @return: ResultVo + * @author feng + * @date: 2021/9/11 12:36 + */ + @PutMapping("/orders/{orderId}") + public ResultVo updateUserOrder(@PathVariable String orderId,@RequestBody RoomOrderUserVo roomOrderUserVo){ + //判断订单是否已被审核 + boolean status = roomOrderService.checkOrderStatus(orderId); + if(status==false){ + //存在一种情况,员工查看自己审核订单时候,订单还没被审核,所以去修改,但在修改提交前的这段时间里订单已经被审核了 + //此时建议前端刷新页面 + return ResultVo.error(500,"该订单已被审核,无法修改",null); + } + //检查参数是否正确,只需检查会议室 + boolean roomExist = roomOrderService.checkRoomExist(roomOrderUserVo.getRoomName()); + if(roomExist==false){ + return ResultVo.error(500,"会议室不存在,",null); + } + //对订单信息进行更新 + if(roomOrderService.updateUserOrderInfo(orderId,roomOrderUserVo)){ + return ResultVo.ok(200,"更新成功",null); + } + return ResultVo.error(500,"更新失败",null); + } + + /** + * @description: 管理员审核预约记录 + * @param: null + * @return: + * @author feng + * @date: 2021/9/11 19:41 + */ + @PutMapping("/orders/audit") + public ResultVo auditOrder(@RequestBody AuditVo auditVo){ + Boolean result =roomOrderService.auditOrder(auditVo); + if(result){ + return ResultVo.ok(200,"审核成功",null); + } + return ResultVo.error(500,"审核失败",null); + } + + /** + * @description: 超管逻辑删除 + * @param: null + * @return: + * @author feng + * @date: 2021/9/11 21:26 + */ + @DeleteMapping("/orders/{orderId}") + public ResultVo deleteOrder(@PathVariable String orderId){ + Boolean result = roomOrderService.deleteOrder(orderId); + if(result){ + return ResultVo.ok(200,"删除成功",null); + } + return ResultVo.error(500,"删除失败",null); + } + + //测试添加在session中添加role + //模拟超级管理员 + @GetMapping("login") + public void login(HttpServletRequest request){ + request.getSession().setAttribute("role",1); + } + //模拟普通管理员 + @GetMapping("login2") + public void login2(HttpServletRequest request){ + request.getSession().setAttribute("role",0); + } + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/controller/SendMessageController.java b/meeting2/src/main/java/com/example/meetingroom/controller/SendMessageController.java new file mode 100644 index 0000000000000000000000000000000000000000..7dbdcd7c07cc5d0d946153aa18c587b77d3df64e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/controller/SendMessageController.java @@ -0,0 +1,55 @@ +package com.example.meetingroom.controller; + +import com.example.meetingroom.service.SendMessageService; +import com.example.meetingroom.vo.ResultVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @Function: 发送短信的控制类 + * @Author: Chen si ran + * @Date: 2021/9/8 14:44 + */ +@RestController +@CrossOrigin +@RequestMapping("/api") +public class SendMessageController { + + @Autowired + private SendMessageService sendMessageService; + + /** + * @function 发送短信 + * @param opinion pass(通过)/notPass(不通过) + * @param phone 电话号码 + * @parm opinion 审批意见 + * @return + */ + @GetMapping("/message/{operation}/{phone}/{opinion}") + public ResultVo sendPass(@PathVariable("operation") String operation,@PathVariable("phone") String phone,@PathVariable("opinion") String opinion) { + + //根据电话号码长度检验是否合理 + if (phone.length() != 11 && phone.startsWith("1")) { + return ResultVo.error(500,"请输入正确的电话号码!",null); + } + + String result = null; + + //判断要执行哪一个方法去发送短信(通过/未通过) + switch (operation){ + case "pass": + result = sendMessageService.sendPass(phone); + break; + + case "notPass": + result = sendMessageService.sendNotPass(phone,opinion); + break; + } + + //调用发送方法,若返回值等于Ok则发送成功 + if ("Ok".equals(result)) { + return ResultVo.ok(200,"短信发送成功!",null); + } + return ResultVo.error(500,"短信发送失败!" + result,null); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/DepartDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/DepartDao.java new file mode 100644 index 0000000000000000000000000000000000000000..0abcb9d1f52d2e7913c0555155bb58880e2d1e03 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/DepartDao.java @@ -0,0 +1,52 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.Depart; +import com.example.meetingroom.entity.Role; +import com.example.meetingroom.entity.RoomInfo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @function: + * @author: + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface DepartDao { + +// Depart selectOne(String id); +// +// int insertOne(Depart depart); + + /** + * @return List 返回数据库数据列表 + * 用于向超管展示部门信息 + */ + List selectDepartList(); + + + /** + * @param depart + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + int updateDepart(Depart depart); +// + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + int deleteDepart(String id); + + /** + * @param depart + * @return int 0或1 + * 用于超管新增部门信息 + */ + int insertDepart(Depart depart); + + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeInfoDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeInfoDao.java new file mode 100644 index 0000000000000000000000000000000000000000..4b7e9e5534738188fc3ae54bcf4998b29133f472 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeInfoDao.java @@ -0,0 +1,109 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.vo.EmployeeInfoVo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @function: + * @author: + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface EmployeeInfoDao { + +// EmployeeInfoVo selectOne(String id); + + /** + * @param roomInfoPageVo + * @return 普管,超管分页查看员工信息 + */ + List selectEmployeeInfoVoPage(@Param("page")PageVo_xuan roomInfoPageVo,@Param("role") Integer role); + + + /** + * @return count 得到总数据量 + * 用于分页 + */ + Integer count(); + + + /** + * @param employeeInfo + * @return int 1或0 + * 用于超管对员工信息的修改操作 + */ + int updateEmployeeInfo(@Param("e")EmployeeInfo employeeInfo,@Param("role") Integer role); + + + + /** + * @param id + * @return int 1或0 + * 用于普管和超管对员工信息的删除操作 + */ + int deleteEmployeeInfo(String id); + + /** + * @param employeeInfo + * @return int 1或0 + * 用于普管和超管对员工信息的添加操作 + */ + int insertEmployeeInfo(EmployeeInfo employeeInfo); + + /** + * @param id + * @return 获取审核人姓名 + */ + String selectEmployeeInfoName(String id); + + /** + * @param + * @return employeeInfoVo对象集合 + * @function: 联表查询返回的数据 + */ + List selectAdmin(); + + /** + * @param lists employee对象集合 + * @return 成功插入的数量 + * @function: 批量插入多条数据 + */ + int insertBatch(List lists); + + List selectNameOrNunberObtainEmployeeInfo(@Param("str")String str, @Param("role")Integer role); + + /** + * 根据账号和密码得到EmployeeInfo + * @param phone 账号 + * @param password 密码 + * @return EmployeeInfo + */ + EmployeeInfo getEmployeeInfoByPhoneAndPassword(String phone,String password); + + /** + * 根据账号得到EmployeeInfo + * @param phone 账号 + * @return EmployeeInfo + */ + EmployeeInfo getEmployeeInfoByPhone(String phone); + + /** + * 根据账号获取权限ID + * @param phone 账号 + * @return 权限ID + */ + String getRoleIdByPhone(String phone); + + /** + * 根据账号来修改密码 + * @param phone 账号 + * @param newPassword 密码 + * @return + */ + int updatePassword(String phone, String newPassword); +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeRegisterDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeRegisterDao.java new file mode 100644 index 0000000000000000000000000000000000000000..8d37a7fbad1437e3545e5d6a2dd71457f5f7f70e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/EmployeeRegisterDao.java @@ -0,0 +1,80 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.entity.EmployeeRegister; +import com.example.meetingroom.vo.EmployeeRegisterVo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @function: + * @author: + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface EmployeeRegisterDao { + + + /** + * @param employeeRegisterPageVo + * @return List 数据库结果返回列表 + * 分页展示数据 普管,超管 + */ + List selectEmployeeRegisterPage(@Param("page")PageVo_xuan employeeRegisterPageVo,@Param("role") Integer role); + + /** + * @return count 总数据量 + * 得到总数据量用于分页 + */ + Integer count(Integer role); + + + /** + * @param id + * @return int 1或0 + * 用于普管和超管对注册表信息的删除操作 + */ + int deleteEmployeeRegister(String id); + + + /** + * @param employeeRegister + * @return int 1或0 + * 用于管理员对注册表的修改操作 + */ + int updateEmployeeRegister(EmployeeRegister employeeRegister); + + /** + * @param employeeInfo + * @return + * 审核通过后添加到员工信息表 + */ + int insertEmployeeInfo(EmployeeRegister employeeInfo); + + /** + * @param id + * @return + * 获取注册表状态 + */ + String selectEmployeeRegisterStatus(String id); + + /** + * @param phone + * @return + * 超管否决普管已通过注册信息,根据电话令其注册信息从员工信息表删除 + */ + int deleteEmployeeInfoPhone(String phone); + + /** + * @param phont + * @return + * 根据联系方式获取注册表密码 + */ + String selectEmployeeInfoPasswode(String phont); + + int insertRegister(EmployeeRegister register); + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/RoleDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/RoleDao.java new file mode 100644 index 0000000000000000000000000000000000000000..22736de3875d9eec69012984a931e5aa86eb78f8 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/RoleDao.java @@ -0,0 +1,35 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.Depart; +import com.example.meetingroom.entity.Role; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @function: + * @author: + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface RoleDao { + + + + /** + * @return int 0或1 + * 查询所有权限,用于员工表权限修改 + */ + List selectRoleList(); + + String getRoleByEmployeeInfo(String roleId); + + String getRoleByPhone(String Phone); + + /** + * 根据权限ID来获取权限名 + * @param id 权限ID + * @return 权限名 + */ + String getRoleByRoleId(String id); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/RoomInfoDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/RoomInfoDao.java new file mode 100644 index 0000000000000000000000000000000000000000..9b133553d8ecfc675682f04c26120bd47632b194 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/RoomInfoDao.java @@ -0,0 +1,54 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @function: 会议室信息 dao + * @author: xuan + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface RoomInfoDao { + + +// RoomInfoDto selectOne(String id); + + /** + * @param roomInfoPageVo + * @return List 数据库结果返回列表 + * 用于分页 + */ + List selectRoomInfoPage(PageVo_xuan roomInfoPageVo); + + /** + * @return count 得到总数据量 + * 用于分页 + */ + Integer count(); + + /** + * @param roomInfo + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + int updateRoomInfo(RoomInfo roomInfo); + + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + int deleteRoomInfo(String id); + + /** + * @param roomInfo + * @return int 0或1 + * 用于超管新增会议室信息 + */ + int insertRoomInfo(RoomInfo roomInfo); + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/dao/RoomOrderDao.java b/meeting2/src/main/java/com/example/meetingroom/dao/RoomOrderDao.java new file mode 100644 index 0000000000000000000000000000000000000000..33ad4fb6ca18c3aacaed92d44b681423b9f88c80 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/dao/RoomOrderDao.java @@ -0,0 +1,202 @@ +package com.example.meetingroom.dao; + +import com.example.meetingroom.entity.Role; +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.entity.RoomOrder; +import com.example.meetingroom.vo.AuditVo; +import com.example.meetingroom.vo.RoomOrderAuditVo; +import com.example.meetingroom.vo.RoomOrderUserVo; +import com.example.meetingroom.vo.RoomOrderVo; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Date; +import java.util.List; + +/** + * @function: + * @author: + * @time: 2021-9-7 23:03:30 + */ +@Repository +public interface RoomOrderDao { + + RoomOrder selectOne(String id); + + /** + * 业务:“()年()月会议室使用次数” + * 功能:获取某年月各会议室的使用次数及对应的会议室名称 + */ + List getRoomOrderNumber(String selectTime); + + + /** + * 业务:“会议室简介” + * 功能:从room_info表中获取会议室信息 + */ + List getAllRoomInfo(); + + /** + * 业务:“已预订” + * 功能:从room_order表中获取已预订会议室信息 + */ + List getAllRoomOrderMessage(String name); + + /** + * ---------------------------------总业务:“会议室预订”------------------------------------------------- + * 分业务:“会议室选择” + * 功能:获取所有会议室名称 + */ + List getAllRoomName(); + + /** + * 分业务:“参与会议员工” + * 功能:获取所有员工的名称 + */ + List getAllEmployeeName(); + + /** + * 分业务:“提交申请” + * 功能:将前端返回的“会议室预订”信息,插入到room_order表中 + */ + int insertRoomOrderMessage(String room_id,String employee_info_id,String subject,String is_use, + String applicant,String phone,String employee_list,String start_time, + String end_time,String room_order_status,int deleted); + + /** + * 功能:根据上述的“applicant”,查询其对应的employee_info_id + */ + String getEmployeeInfoId(String applicant); + + /** + * -------------------------------------------------------------------------------------------------- + */ + + List selectAdmin(@Param("role") Integer role); + + /** + * @description: 预订记录数据 + * @param: 页数,每页显示行数,角色(因为要在if标签中使用参数,所以得加Param) + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/8 13:34 + */ + List selectCompletedOrder(Integer pageNum,Integer lineNum, @Param("role") Integer role); + + /** + * @description: 审核预订记录总数 + * @param: 页数,每页显示行数 + * @return: 数据总数 + * @author feng + * @date: 2021/9/10 11:22 + */ + List selectAuditOrder(Integer pageNum, Integer lineNum); + + /** + * @description: 员工个人预订记录 + * @param: 页数,每页显示行数,员工id + * @return: 数据总数 + * @author feng + * @date: 2021/9/10 11:22 + */ + List selectUserOrder(Integer pageNum, Integer lineNum, String userId); + + /** + * @description: 查找数据总数 + * @param: 用户身份(普管/超管) + * @return: 数据总数 + * @author feng + * @date: 2021/9/10 11:22 + */ + Integer selectCountsCompletedOrder(@Param("role") Integer role); + + /** + * @description: 查找数据总数 + * @return: 数据总数 + * @author feng + * @date: 2021/9/10 11:22 + */ + Integer selectCountsAuditOrder(); + /** + * @description: 查找数据总数 + * @param: 员工id + * @return: 数据总数 + * @author feng + * @date: 2021/9/10 11:22 + */ + Integer selectCountsUserOrder(String userId); + +// /** +// * @description: 更新 +// * @param: 审核状态、订单id +// * @return: 数据总数 +// * @author feng +// * @date: 2021/9/10 11:22 +// */ +// Integer updateByOrderId(Integer status,String orderId); + + /** + * @description: 检查订单是否已被审核 + * @param: 订单id + * @return: status审核状态 + * @author feng + * @date: 2021/9/11 13:23 + */ + String selectOrderStatusById(String orderId); + + /** + * @description: 检查修改信息中的RoomName是否合法即是否存在 + * @param: 要修改的房间名 + * @return: 存在1,不存在0 + * @author feng + * @date: 2021/9/11 14:09 + */ + Integer selectExistByRoomName(String roomName); + + /** + * @description: 查看员工有无修改会议室房间 + * @param: null + * @return: + * @author feng + * @date: 2021/9/11 15:30 + */ + String selectOrderRoom(String roomId); + + /** + * @description: 获取会议室信息 + * @param: 房间号 + * @return: 会议室信息 + * @author feng + * @date: 2021/9/11 15:40 + */ + RoomInfo selectRoomInfoByRoomName(String roomName); + + /** + * @description: 员工修改个人预约记录(还未被审核的记录) + * @param: 订单id,修改的订单信息对象 + * @return: 修改结果 + * @author feng + * @date: 2021/9/11 14:47 + */ + Integer updateOrderByOrderId(String orderId, Date startTime, Date endTime, RoomOrderUserVo order); + + /** + * @description: 审核订单 + * @param: 审核结果 + * @return: 修改数据库结果 + * @author feng + * @date: 2021/9/10 14:19 + */ + Integer auditOrder(@Param("auditVo") AuditVo auditVo); + + /** + * @description: 超管逻辑删除 + * @param: null + * @return: + * @author feng + * @date: 2021/9/12 8:13 + */ + Integer deleteOrderById(String orderId); +} + + diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/Depart.java b/meeting2/src/main/java/com/example/meetingroom/entity/Depart.java new file mode 100644 index 0000000000000000000000000000000000000000..eee9efea196441633aed742b82ba855306b63680 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/Depart.java @@ -0,0 +1,90 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 部门表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class Depart { + + //部门表主键id + private String id; + + //部门名称 + private String name; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + * @param +// public DepartDto() { +// } + +// /** +// * @function: 有参构造 +// */ +// public Depart(String name) { +// this.name = name; +// } + + /** + * @function: 有参构造 + */ + public Depart(String id, String name) { + this.id = id; + this.name = name; + } + + public Depart() { + + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "DepartDto{" + + "id='" + id + '\'' + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeInfo.java b/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..d50574d2c12eb9f85574d76cb79f0e3707f7b85d --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeInfo.java @@ -0,0 +1,163 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 员工信息表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class EmployeeInfo { + + //员工信息表主键id + private String id; + + //关联的角色表主键id + private String roleId; + + //关联的部门表主键id + private String departId; + + //员工编号 + private int number; + + //员工姓名 + private String name; + + //联系方式 + private String phone; + + //密码 + private String password; + + //性别(0为女,1为男) + private int sex; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + */ + public EmployeeInfo() { + } + + public EmployeeInfo(String id, String roleId, String departId, int number, String name, String phone, String password, int sex, Date createTime, Date updateTime) { + this.id = id; + this.roleId = roleId; + this.departId = departId; + this.number = number; + this.name = name; + this.phone = phone; + this.password = password; + this.sex = sex; + this.createTime = createTime; + this.updateTime = updateTime; + } + + /** + * @function: 有参构造 + */ + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getDepartId() { + return departId; + } + + public void setDepartId(String departId) { + this.departId = departId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "EmployeeInfo{" + + "id='" + id + '\'' + + ", roleId='" + roleId + '\'' + + ", departId='" + departId + '\'' + + ", number=" + number + + ", name='" + name + '\'' + + ", phone='" + phone + '\'' + + ", password='" + password + '\'' + + ", sex=" + sex + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeRegister.java b/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeRegister.java new file mode 100644 index 0000000000000000000000000000000000000000..b97c09905b0608708cb638f49d95b5cc2ca9d979 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/EmployeeRegister.java @@ -0,0 +1,172 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 员工注册表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class EmployeeRegister { + + //员工注册表主键id + private String id; + + //关联的部门表主键id + private String departId; + + //员工姓名 + private String name; + + //联系方式 + private String phone; + + //密码 + private String password; + + //性别(0为女,1为男) + private int sex; + + //注册审批状态 + private String employeeRegisterStatus; + + //注册审批意见 + private String opinion; + + //审批人姓名 + private String adminName; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + */ + public EmployeeRegister() { + } + + public EmployeeRegister(String id, String departId, String name, String phone, String password, int sex, String employeeRegisterStatus, String opinion, String adminName) { + this.id = id; + this.departId = departId; + this.name = name; + this.phone = phone; + this.password = password; + this.sex = sex; + this.employeeRegisterStatus = employeeRegisterStatus; + this.opinion = opinion; + this.adminName = adminName; + } + + /** + * @function: 有参构造 + */ + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartId() { + return departId; + } + + public void setDepartId(String departId) { + this.departId = departId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getEmployeeRegisterStatus() { + return employeeRegisterStatus; + } + + public void setEmployeeRegisterStatus(String employeeRegisterStatus) { + this.employeeRegisterStatus = employeeRegisterStatus; + } + + public String getOpinion() { + return opinion; + } + + public void setOpinion(String opinion) { + this.opinion = opinion; + } + + public String getAdminName() { + return adminName; + } + + public void setAdminName(String adminName) { + this.adminName = adminName; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "EmployeeRegister{" + + "id='" + id + '\'' + + ", departId='" + departId + '\'' + + ", name='" + name + '\'' + + ", phone='" + phone + '\'' + + ", password='" + password + '\'' + + ", sex=" + sex + + ", employeeRegisterStatus='" + employeeRegisterStatus + '\'' + + ", opinion='" + opinion + '\'' + + ", adminName='" + adminName + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/Role.java b/meeting2/src/main/java/com/example/meetingroom/entity/Role.java new file mode 100644 index 0000000000000000000000000000000000000000..bb83a9c144bfcb5b759e7f667af7dfbbdd94c44b --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/Role.java @@ -0,0 +1,81 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + + + +import java.util.Date; + +/** + * @function: 角色表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class Role { + + //角色表主键id + private String id; + + //角色名称 + private String name; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + */ + public Role() { + } + + /** + * @function: 有参构造 + */ + public Role(String id, String name) { + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "RoleDto{" + + "id='" + id + '\'' + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/RoomInfo.java b/meeting2/src/main/java/com/example/meetingroom/entity/RoomInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..93fbc95b054585b03ad1a52976d0185f3395aa43 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/RoomInfo.java @@ -0,0 +1,131 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 会议室信息表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class RoomInfo { + + //会议室信息表id + private String id; + + //会议室名称 + private String name; + + //会议室类型 + private String type; + + //最大可容纳人数 + private int num; + + //设备 + private String equipment; + + //位置 + private String address; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + */ + public RoomInfo() { + } + + /** + * @function: 有参构造 + */ + public RoomInfo(String id, String name, String type, int num, String equipment, String address) { + this.id = id; + this.name = name; + this.type = type; + this.num = num; + this.equipment = equipment; + this.address = address; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getNum() { + return num; + } + + public void setNum(int num) { + this.num = num; + } + + public String getEquipment() { + return equipment; + } + + public void setEquipment(String equipment) { + this.equipment = equipment; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "RoomInfoDto{" + + "id='" + id + '\'' + + ", name='" + name + '\'' + + ", type='" + type + '\'' + + ", num=" + num + + ", equipment='" + equipment + '\'' + + ", address='" + address + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/entity/RoomOrder.java b/meeting2/src/main/java/com/example/meetingroom/entity/RoomOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..972603fd267635bd24e3644926e1f548d52a0617 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/entity/RoomOrder.java @@ -0,0 +1,215 @@ +package com.example.meetingroom.entity; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 会议室预定表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class RoomOrder { + + //会议室预定表id + private String id; + + //关联的会议室信息表id + private String roomId; + + //关联的员工信息表id + private String employeeInfoId; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUre; + + //申请人 + private String applicant; + + //联系方式 + private String phone; + + //参会名单 + private String employeeList; + + //会议开始时间 + private String startTime; + + //会议结束时间 + private String endTime; + + //申请状态 + private String roomOrderStatus; + + //逻辑删除(0为被删除,1位未删除) + private int deleted; + + //创建时间 + private Date createTime; + + //更新时间 + private Date updateTime; + + /** + * @function: 无参构造 + */ + public RoomOrder() { + } + + public RoomOrder(String id, String roomId, String employeeInfoId, String subject, int isUre, String applicant, String phone, String employeeList, String startTime, String endTime, String roomOrderStatus, int deleted, Date createTime, Date updateTime) { + this.id = id; + this.roomId = roomId; + this.employeeInfoId = employeeInfoId; + this.subject = subject; + this.isUre = isUre; + this.applicant = applicant; + this.phone = phone; + this.employeeList = employeeList; + this.startTime = startTime; + this.endTime = endTime; + this.roomOrderStatus = roomOrderStatus; + this.deleted = deleted; + this.createTime = createTime; + this.updateTime = updateTime; + } + + /** + * @function: 有参构造 + */ + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoomId() { + return roomId; + } + + public void setRoomId(String roomId) { + this.roomId = roomId; + } + + public String getEmployeeInfoId() { + return employeeInfoId; + } + + public void setEmployeeInfoId(String employeeInfoId) { + this.employeeInfoId = employeeInfoId; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmployeeList() { + return employeeList; + } + + public void setEmployeeList(String employeeList) { + this.employeeList = employeeList; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getRoomOrderStatus() { + return roomOrderStatus; + } + + public void setRoomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } + + public int getDeleted() { + return deleted; + } + + public void setDeleted(int deleted) { + this.deleted = deleted; + } + + public int getIsUre() { + return isUre; + } + + public void setIsUre(int isUre) { + this.isUre = isUre; + } + + /** + * function: 获取创建时间并格式化 + * @return + */ + public String getCreateTime() { + return DateUtil.dateFormat(createTime); + } + + /** + * function: 获取更新时间并格式化 + * @return + */ + public String getUpdateTime() { + return DateUtil.dateFormat(updateTime); + } + + @Override + public String toString() { + return "RoomOrder{" + + "id='" + id + '\'' + + ", roomId='" + roomId + '\'' + + ", employeeInfoId='" + employeeInfoId + '\'' + + ", subject='" + subject + '\'' + + ", isUre=" + isUre + + ", applicant='" + applicant + '\'' + + ", phone='" + phone + '\'' + + ", employeeList='" + employeeList + '\'' + + ", startTime='" + startTime + '\'' + + ", endTime='" + endTime + '\'' + + ", roomOrderStatus='" + roomOrderStatus + '\'' + + ", deleted=" + deleted + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/filter/CustomRolesAuthorizationFilter.java b/meeting2/src/main/java/com/example/meetingroom/filter/CustomRolesAuthorizationFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..b46710a16879cd0b3b3cd084074bc5a84ee24a72 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/filter/CustomRolesAuthorizationFilter.java @@ -0,0 +1,30 @@ +package com.example.meetingroom.filter; + +import org.apache.shiro.subject.Subject; +import org.apache.shiro.web.filter.authz.AuthorizationFilter; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * 改写shiro判断身份权限的过滤器,使其满足其中一个身份便可以不拦截。 + */ +@Component +public class CustomRolesAuthorizationFilter extends AuthorizationFilter { + + @Override + protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) throws Exception { + Subject subject = getSubject(servletRequest, servletResponse); + String[] identitys = (String[]) o; + if (identitys == null || identitys.length==0){ + return true; + } + for (int i = 0; i < identitys.length; i++) { + if (subject.hasRole(identitys[i])){ + return true; + } + } + return false; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/DepartService.java b/meeting2/src/main/java/com/example/meetingroom/service/DepartService.java new file mode 100644 index 0000000000000000000000000000000000000000..156b4f03ed4df6f2743a1c5ba4cdfa96d6ee7334 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/DepartService.java @@ -0,0 +1,47 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.Depart; + +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface DepartService { + +// Depart selectOne(String id); + + /** + * @param depart + * @return int 0或1 + * 用于超管新增部门信息 + */ + int insertDepart(Depart depart); + + /** + * @param depart + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + int updateDepart(Depart depart); + + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + int deleteDepart(String id); + + /** + * @return List 返回数据库数据列表 + * 用于向超管展示部门信息 + */ + List selectDepartList(); + + + + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/EmployeeInfoService.java b/meeting2/src/main/java/com/example/meetingroom/service/EmployeeInfoService.java new file mode 100644 index 0000000000000000000000000000000000000000..6cb8eebdc35efe91db25c70a3be4b229ee1e947e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/EmployeeInfoService.java @@ -0,0 +1,98 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.vo.EmployeeInfoVo; +import com.example.meetingroom.vo.PageVo_xuan; + +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface EmployeeInfoService { + +// EmployeeInfoVo selectOne(String id); + + /** + * @param currentPage 前端传回的跳转页码 + * @param currentCount 默认每页数据量 + * @return PageVo_xuan 数据库结果返回列表 + * 用于员工信息的分页和分页跳转 + */ + PageVo_xuan selectEmployeeInfoPage(Integer currentPage, Integer currentCount, Integer role) throws Exception; + + + List selectNameOrNunberObtainEmployeeInfo(String str,Integer role); + + + + + /** + * @function: 联表查询返回的数据 + * @param + * @return employeeInfoVo对象集合 + */ + List selectAdmin(); + + /** + * @param employeeInfo + * @return int 1或0 + * 用于普管对员工信息的修改操作 + */ + int updateEmployeeInfo(EmployeeInfo employeeInfo,Integer role); + + + /** + * @param id + * @return int 1或0 + * 用于普管和超管对员工信息的删除操作 + */ + int deleteEmployeeInfo(String id); + + /** + * @param employeeInfo + * @return int 1或0 + * 用于普管和超管对员工信息的新增操作 + */ + int insertEmployeeInfo(EmployeeInfo employeeInfo,Integer role); + + /** + * @function: 将excel数据集合 转成 employeeInfo对象集合,并批量插入数据库 + * @param excelDataList excel数据集合 + * @param role 该操作是普管(0)执行的还是超管(1)执行的 + * @return 批量插入是否成功 + */ + Boolean insertBatch(List> excelDataList, int role); + + /** + * 根据账号得到EmployeeInfo + * @param phone 账号 + * @return EmployeeInfo + */ + EmployeeInfo getEmployeeInfoByPhone(String phone); + + /** + * 根据账号和密码获取EmployeeInfo + * @param phone 账号 + * @param password 密码 + * @return EmployeeInfo + */ + EmployeeInfo getEmployeeInfoByPhoneAndPassword(String phone,String password); + + /** + * 根据用户手机号码来获得权限ID + * @param phone 账号 + * @return 权限ID + */ + String getRoleIdByPhone(String phone); + + /** + * 用户更新密码 + * @param phone 账号 + * @param newPassword 密码 + * @return 成功更新条数 + */ + int updatePassword(String phone, String newPassword); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/EmployeeRegisterService.java b/meeting2/src/main/java/com/example/meetingroom/service/EmployeeRegisterService.java new file mode 100644 index 0000000000000000000000000000000000000000..254754d00b9b747918ea9e842864508c47e33dd0 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/EmployeeRegisterService.java @@ -0,0 +1,74 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.entity.EmployeeRegister; +import com.example.meetingroom.vo.EmployeeRegisterVo; +import com.example.meetingroom.vo.PageVo_xuan; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface EmployeeRegisterService { + + + /** + * @param currentPage 跳转页 + * @param currentCount 每页展示数据量 + * @param role 权限信息 + * @return + * 用于向普管和超管分页展示注册表信息 + */ + PageVo_xuan selectEmployeeRegisterPage(Integer currentPage, Integer currentCount, Integer role) throws Exception; + + /** + * @param id 需要删除的注册表信息id + * @return int 0或1 + * 普管和超管删除注册表信息 + */ + int deleteEmployeeRegister(String id); + + /** + * @param employeeRegister 注册表实体类 + * @param adminId 修改表的管理员id + * @return int 0或1 + * 用于普管和超管修改注册表状态,并默认记录普管或超管姓名 + */ + int updateEmployeeRegister(EmployeeRegister employeeRegister , String adminId); + + /** + * @param employeeRegister + * @return + * 注册表审核通过后添加到员工信息表 + */ + int insertEmployeeInfo(EmployeeRegister employeeRegister); + + /** + * @param id + * @return + * 获取注册表状态 + */ + String selectEmployeeRegisterStatus(String id); + + /** + * @param phone + * @return + * 超管否决普管已通过注册信息,根据电话令其注册信息从员工信息表删除 + */ + int deleteEmployeeRegisterPhone(String phone); + + /** + * @param phone + * @return + * 根据联系方式获取注册表密码 + */ + String selectEmployeeInfoPasswode(String phone); + + /** + * 插入新的注册用户 + * @param register + * @return 成功条数 + */ + int insertRegister(EmployeeRegister register); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/ExcelService.java b/meeting2/src/main/java/com/example/meetingroom/service/ExcelService.java new file mode 100644 index 0000000000000000000000000000000000000000..994e83b0a3cebd1a13703d4dac7d30c5aafd4768 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/ExcelService.java @@ -0,0 +1,48 @@ +package com.example.meetingroom.service; + +import org.apache.poi.ss.usermodel.Sheet; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.List; + +/** + * @Function: TODO + * @Author: Chen si ran + * @Date: 2021/9/9 14:52 + */ +public interface ExcelService { + + /** + * @function: 根据文件名截取文件类型并返回 + * @param fullName 文件名 + * @return 文件类型 + */ + String getType(String fullName); + + /** + * @function: 获取目标工作表记录行数 + * @param sheet 目标工作表 + * @return 目标工作表记录行数 + */ + int getSize(Sheet sheet); + + /** + * @function: 获取目标工作表所有数据 + * @param sheet 目标工作表 + * @return SheetData 目标工作表数据 + */ + List> getSheetValue(Sheet sheet); + + /** + * @function: 导出所有数据 + * @param title Excel表名 + * @param headers 标题列表 + * @param dataset 要导出的数据集合 + * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中 + * @param role 该操作是普管(0)执行的还是超管(1)执行的 + * @return + */ + void export(String title, String[] headers, List dataset, OutputStream out, int role) throws IOException; + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/PageService.java b/meeting2/src/main/java/com/example/meetingroom/service/PageService.java new file mode 100644 index 0000000000000000000000000000000000000000..9d9f513a2dfd281f6fee118242ef38b12e640a8e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/PageService.java @@ -0,0 +1,19 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.vo.PageVo_xuan; + +/** + * @author : C_xuan + * @date : 18:45 2021/9/11 + */ +public interface PageService { + + /** + * @param currentPage 跳转页数 + * @param currentCount 每页数据量 + * @param totalRecord 数据总量 + * @return + * 分页公共方法 + */ + PageVo_xuan selectPage(Integer currentPage, Integer currentCount, Integer totalRecord) throws Exception; +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/RoleService.java b/meeting2/src/main/java/com/example/meetingroom/service/RoleService.java new file mode 100644 index 0000000000000000000000000000000000000000..d0fc511c94e818a41b237e13633d5a1b094e0e09 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/RoleService.java @@ -0,0 +1,30 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.Role; + +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface RoleService { + +// Role selectOne(String id); + + /** + * @return + * 查询所有权限,用于员工表权限修改 + */ + List selectRoleList(); + + String getRoleByPhone(String phone); + + /** + * 根据权限ID来获取权限名 + * @param id 权限ID + * @return 权限名 + */ + String getRoleByRoleId(String id); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/RoomInfoService.java b/meeting2/src/main/java/com/example/meetingroom/service/RoomInfoService.java new file mode 100644 index 0000000000000000000000000000000000000000..cbad3f72746c3014055674af7b8b1bce028741f9 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/RoomInfoService.java @@ -0,0 +1,47 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.vo.PageVo_xuan; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface RoomInfoService { + +// RoomInfoDto selectOne(String id); + +// Page selectRoomInfoPage(); + + /** + * @param roomInfo + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + int updateRoomInfo(RoomInfo roomInfo); + + + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + int deleteRoomInfo(String id); + + /** + * @param roomInfo + * @return int 0或1 + * 用于超管新增会议室信息 + */ + int insertRoomInfo(RoomInfo roomInfo); + + /** + * @param currentPage 前端传回的跳转页码 + * @param currentCount 默认每页数据量 + * @return PageVo_xuan 数据库结果返回列表 + * 用于会议室信息的分页和分页跳转 + */ + PageVo_xuan selectRoomInfoPage(Integer currentPage, Integer currentCount) throws Exception; + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/RoomOrderService.java b/meeting2/src/main/java/com/example/meetingroom/service/RoomOrderService.java new file mode 100644 index 0000000000000000000000000000000000000000..8c0f1b58b37d4c86bc94392591ada91f831fddff --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/RoomOrderService.java @@ -0,0 +1,165 @@ +package com.example.meetingroom.service; + +import com.example.meetingroom.entity.RoomOrder; +import com.example.meetingroom.vo.*; + +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:10:07 + */ +public interface RoomOrderService { + + + RoomOrder selectOne(String id); + + /** + * 业务:“()年()月会议室使用次数” + * 功能:调用dao层getRoomOrderNumber(String selectTime)方法,获取某年月各会议室的使用次数及对应的会议室名称 + */ + List getRoomOrderNumber(String selectTime); + + /** + * 业务:“会议室简介” + * 功能:从room_info表中获取会议室信息 + */ + List getAllRoomInfo(); + + /** + * 业务:“已预订” + * 功能:从room_order表中获取已预订会议室信息 + */ + List getAllRoomOrderMessage(String name); + + /** + * ---------------------------------总业务:“会议室预订”------------------------------------------------- + * 分业务:“会议室选择” + * 功能:调用dao层getAllRoomName()方法,获取所有会议室名称 + */ + List getAllRoomName(); + + /** + * 分业务:“参与会议员工” + * 功能:调用getAllEmployeeName()方法,获取所有员工的名称 + */ + List getAllEmployeeName(); + + /** + * 分业务:“提交申请” + * 功能:调用insertRoomOrderMessage(……)和 getEmployeeInfoId(String applicant)方法,将前端返回的“会议室预订”信息,插入到room_order表中 + */ + Object insertRoomOrderMessage(RoomOrderMessageVo roomOrderMessageVo); + + /** + * -------------------------------------------------------------------------------------------------- + */ + + Object select(String type,Integer pageNum, Integer lineNum, Integer role, String userId); + + /** + * @function: 联表查询返回给普通管理员的数据 + * @param + * @return employeeInfoVo对象集合 + */ + List selectAdmin(Integer role); + + /** + * @description: 预订记录数据 + * @param: 页数,每页显示行数 + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/8 13:32 + */ + List selectCompletedOrder(Integer pageNum, Integer lineNum, Integer role); + + /** + * @description: 待审核预订记录数据 + * @param: 页数,每页显示行数 + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/8 13:32 + */ + List selectAuditOrder(Integer pageNum, Integer lineNum); + + /** + * @description: 个人预订记录数据 + * @param: 页数,每页显示行数 + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/8 13:32 + */ + List selectUserOrder(Integer pageNum, Integer lineNum, String userId); + + /** + * @description: 查询预定记录数据总量 + * @param: 用户身份 + * @return: 全部预定记录数据总量 + * @author feng + * @date: 2021/9/8 16:16 + */ + Integer selectCounts(String selectType, Integer role,String userId); + + /** + * @description: 获取预定记录总页数 + * @param: 显示行数,用户身份 + * @return: + * @author feng + * @date: 2021/9/8 17:02 + */ + Integer selectPages(Integer lineNum,Integer role); + + /** + * @description: 检查参数是否正常 + * @param: 显示行数,显示第几页页数,用户身份 + * @return:成功返回Page对象,失败返回null + * @author feng + * @date: 2021/9/9 20:23 + */ + PageVo checkParams(String selectType, Integer lineNum, Integer pageNum, Integer role,String userId); + + /** + * @description: 审核订单 + * @param: 审核结果 + * @return: 修改数据库结果 + * @author feng + * @date: 2021/9/10 14:19 + */ + Boolean auditOrder(AuditVo auditVo); + + /** + * @description: 检查订单是否已被审核 + * @param: 订单id + * @return: 未审核1,已审核0 + * @author feng + * @date: 2021/9/11 13:23 + */ + Boolean checkOrderStatus(String orderId); + + /** + * @description: 检查修改信息中的RoomName是否合法即是否存在 + * @param: 要修改的房间名 + * @return: 存在1,不存在0 + * @author feng + * @date: 2021/9/11 14:09 + */ + Boolean checkRoomExist(String roomName); + + /** + * @description: 员工修改个人预约记录(还未被审核的记录) + * @param: 订单id,修改的订单信息对象 + * @return: 修改结果 + * @author feng + * @date: 2021/9/11 14:47 + */ + Boolean updateUserOrderInfo(String orderId,RoomOrderUserVo roomOrderUserVo); + /** + * @description: 逻辑删除预订记录 + * @param: 订单编号 + * @return: 操作结果 + * @author feng + * @date: 2021/9/11 21:31 + */ + Boolean deleteOrder(String orderId); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/SendMessageService.java b/meeting2/src/main/java/com/example/meetingroom/service/SendMessageService.java new file mode 100644 index 0000000000000000000000000000000000000000..f8378039634798c3e177b6835cf3b0ee8bc2a9c4 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/SendMessageService.java @@ -0,0 +1,24 @@ +package com.example.meetingroom.service; + +/** + * @Function: 发送短信 + * @Author: Chen si ran + * @Date: 2021/9/8 12:16 + */ + +public interface SendMessageService { + + /** + * @function: 发送短信-告知用户注册审核通过 + * @param phoneNum 电话号码 + * @return 短信是否发送成功 + */ + String sendPass(String phoneNum); + + /** + * @function: 发送短信-告知用户注册审核未通过 + * @param phoneNum 电话号码 + * @return 短信是否发送成功 + */ + String sendNotPass(String phoneNum,String opinion); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/UploadService.java b/meeting2/src/main/java/com/example/meetingroom/service/UploadService.java new file mode 100644 index 0000000000000000000000000000000000000000..5883845974dcb0febaec8e9f833af50c68cd36d6 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/UploadService.java @@ -0,0 +1,13 @@ +package com.example.meetingroom.service; + +import org.springframework.web.multipart.MultipartFile; + +/** + * @Description: 上传方法接口 + * @Author: Computer Association + * @Date: Create in 2021/3/11 15:14 + * @Version: V1.0 + */ +public interface UploadService { + String uploadDocument(MultipartFile multipartFile); +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/DepartServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/DepartServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2ef5104abbb8ee8df08ba902a0da881f226aa1a5 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/DepartServiceImpl.java @@ -0,0 +1,69 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.DepartDao; +import com.example.meetingroom.entity.Depart; +import com.example.meetingroom.service.DepartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.swing.*; +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class DepartServiceImpl implements DepartService { + + @Autowired + private DepartDao departDao; + + + /** + * @param depart + * @return int 0或1 + * 用于超管新增部门信息 + */ + @Override + @Transactional + public int insertDepart(Depart depart){ + return departDao.insertDepart(depart); + } + + + /** + * @param depart + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + @Override + public int updateDepart(Depart depart){ + return departDao.updateDepart(depart); + } + + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + @Override + public int deleteDepart(String id){ + return departDao.deleteDepart(id); + } + + + + /** + * @return List 返回数据库数据列表 + * 用于向超管展示部门信息 + */ + @Override + public List selectDepartList(){ + return departDao.selectDepartList(); + } + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeInfoServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeInfoServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c5d4ef0efe5f3ae41c169b3cc13a800062df60e6 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeInfoServiceImpl.java @@ -0,0 +1,218 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.EmployeeInfoDao; +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.service.EmployeeInfoService; + +import com.example.meetingroom.vo.EmployeeInfoVo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class EmployeeInfoServiceImpl implements EmployeeInfoService { + + @Autowired + private EmployeeInfoDao employeeInfoDao; + + @Autowired + private PageServiceImpl pageService; + + +// @Override +// public EmployeeInfoVo selectOne(String id) { +// return employeeInfoDao.selectOne(id); +// } + + + /** + * @param currentPage 前端传回的跳转页码 + * @param currentCount 默认每页数据量 + * @param role 身份验证信息 + * @return PageVo_xuan 数据库结果返回列表 + * 用于员工信息的分页和分页跳转 + */ + @Override + public PageVo_xuan selectEmployeeInfoPage(Integer currentPage, Integer currentCount, Integer role) throws Exception { + //获取总数据量 + Integer totalRecord = employeeInfoDao.count(); + + PageVo_xuan employeeInfoVoPageVo = pageService.selectPage(currentPage, currentCount, totalRecord); + + //判断参数是否合法 + if (employeeInfoVoPageVo.getCurrentPage() == -1){ + return employeeInfoVoPageVo; + } + + employeeInfoVoPageVo.setList(employeeInfoDao.selectEmployeeInfoVoPage(employeeInfoVoPageVo, role)); + return employeeInfoVoPageVo; + } + + + @Override + public List selectNameOrNunberObtainEmployeeInfo(String str, Integer role){ + return employeeInfoDao.selectNameOrNunberObtainEmployeeInfo(str, role); + } + + /** + * @function: 联表查询返回给普通管理员的数据 + * @param + * @return employeeInfoVo对象集合 + */ + @Override + public List selectAdmin() { + return employeeInfoDao.selectAdmin(); + } + + /** + * @param employeeInfo + * @return int 1或0 + * 用于管理员对员工信息的修改操作 + */ + @Override + public int updateEmployeeInfo(EmployeeInfo employeeInfo,Integer role){ + return employeeInfoDao.updateEmployeeInfo(employeeInfo, role); + + } + + /** + * @param id + * @return int 1或0 + * 用于普管和超管对员工信息的删除操作 + */ + @Override + public int deleteEmployeeInfo(String id){ + return employeeInfoDao.deleteEmployeeInfo(id); + } + + /** + * @param employeeInfo + * @return int 1或0 + * 用于普管和超管对员工信息的新增操作 + */ + @Override + public int insertEmployeeInfo(EmployeeInfo employeeInfo,Integer role){ + if(role == 0){ + employeeInfo.setPassword("123456"); + employeeInfo.setRoleId("1"); + } + return employeeInfoDao.insertEmployeeInfo(employeeInfo); + } + + /** + * @function: 将excel数据集合 转成 employeeInfo对象集合,并批量插入数据库 + * @param excelDataList excel数据集合 + * @param role 该操作是普管(0)执行的还是超管(1)执行的 + * @return 批量插入是否成功 + */ + @Override + public Boolean insertBatch(List> excelDataList,int role) throws NumberFormatException{ + + List employeeInfoList = new ArrayList<>(); + List list = null; + int recordNumber = excelDataList.size(); + + //遍历excel数据集合,实例化employeeInfo对象并通为其赋值,存入List集合中 + for (int i = 1; i < recordNumber; i++) { + + //获取一行excel数据 + list = excelDataList.get(i); + + EmployeeInfo employeeInfo = new EmployeeInfo(); + + employeeInfo.setDepartId(list.get(0).toString()); + employeeInfo.setName(list.get(1).toString()); + employeeInfo.setSex(Integer.parseInt(list.get(2).toString())); + employeeInfo.setPhone(list.get(3).toString()); + //权限id为1(普通员工),密码为123456(密文) + employeeInfo.setRoleId("1"); + if (role == 0){ + employeeInfo.setPassword("123456"); + }else { + //超管--可导入密码 + employeeInfo.setPassword(list.get(4).toString()); + } + + employeeInfoList.add(employeeInfo); + } + + //超管--可导入密码 + /*for (int i = 1; i < recordNumber; i++) { + + //获取一行excel数据 + list = excelDataList.get(i); + + EmployeeInfo employeeInfo = new EmployeeInfo(); + + employeeInfo.setDepartId(list.get(0).toString()); + employeeInfo.setName(list.get(1).toString()); + employeeInfo.setPhone(list.get(3).toString()); + employeeInfo.setSex(Integer.parseInt(list.get(2).toString())); + //权限id为1(普通员工),密码为123456(密文) + employeeInfo.setRoleId("1"); + employeeInfo.setPassword(list.get().toString()); + + employeeInfoList.add(employeeInfo); + }*/ + + //调用批量插入的方法,得到插入总记录数 + int count = employeeInfoDao.insertBatch(employeeInfoList); + System.out.println("插入记录条数" + count); + //如果 插入总记录数 等于 (数据总行数-1),说明插入成功 + if (count == (recordNumber - 1)){ + return true; + } + + return false; + } + + /** + * 根据账号得到EmployeeInfo + * @param phone 账号 + * @return EmployeeInfo + */ + @Override + public EmployeeInfo getEmployeeInfoByPhone(String phone) { + return employeeInfoDao.getEmployeeInfoByPhone(phone); + } + + /** + * 根据账号和密码得到EmployeeInfo + * @param phone 账号 + * @param password 密码 + * @return EmployeeInfo + */ + @Override + public EmployeeInfo getEmployeeInfoByPhoneAndPassword(String phone, String password) { + return employeeInfoDao.getEmployeeInfoByPhoneAndPassword(phone,password); + } + + /** + * 根据账号获取权限ID + * @param phone 账号 + * @return 权限ID + */ + @Override + public String getRoleIdByPhone(String phone) { + return employeeInfoDao.getRoleIdByPhone(phone); + } + + /** + * 根据账号来修改密码 + * @param phone 账号 + * @param newPassword 密码 + * @return + */ + @Override + public int updatePassword(String phone, String newPassword) { + return employeeInfoDao.updatePassword(phone,newPassword); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeRegisterServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeRegisterServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..adaf036914915fb8d9ae64412df85d6a89f24969 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/EmployeeRegisterServiceImpl.java @@ -0,0 +1,170 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.EmployeeInfoDao; +import com.example.meetingroom.dao.EmployeeRegisterDao; +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.entity.EmployeeRegister; +import com.example.meetingroom.service.EmployeeRegisterService; +import com.example.meetingroom.vo.EmployeeRegisterVo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.apache.commons.collections4.Get; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; +import java.util.TreeSet; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class EmployeeRegisterServiceImpl implements EmployeeRegisterService { + + @Autowired + private EmployeeRegisterDao employeeRegisterDao; + + @Autowired + private EmployeeInfoDao employeeInfoDao; + + @Autowired + private PageServiceImpl pageService; + + /** + * @param currentPage 跳转页 + * @param currentCount 每页展示数据量 + * @param role 权限信息 + * @return + * 用于向普管和超管分页展示注册表信息 + */ + @Override + public PageVo_xuan selectEmployeeRegisterPage(Integer currentPage, Integer currentCount, Integer role) throws Exception { + + //获取总数据量 + Integer totalRecord = employeeRegisterDao.count(role); + + + PageVo_xuan employeeRegisterVoPageVo = pageService.selectPage(currentPage, currentCount, totalRecord); + + //跳转参数判断 + if (employeeRegisterVoPageVo.getCurrentPage() == -1){ + return employeeRegisterVoPageVo; + } + + employeeRegisterVoPageVo.setList(employeeRegisterDao.selectEmployeeRegisterPage(employeeRegisterVoPageVo, role)); + + + return employeeRegisterVoPageVo; + } + + /** + * @param id 需要删除的注册表信息id + * @return int 0或1 + * 普管和超管删除注册表信息 + */ + @Override + public int deleteEmployeeRegister(String id){ + return employeeRegisterDao.deleteEmployeeRegister(id); + } + + /** + * @param employeeRegister 注册表实体类 + * @param adminId 修改表的管理员id + * @return int 0或1 + * 用于普管和超管修改注册表状态,并默认记录普管或超管姓名 + */ + @Override + public int updateEmployeeRegister(EmployeeRegister employeeRegister, String adminId){ + + //判断是否需要拼接 + String adminNames = employeeInfoDao.selectEmployeeInfoName(adminId); +// System.out.println("操作前" + adminNames); + if (employeeRegister.getAdminName() != null){ + adminNames = adminNames + ',' +employeeRegister.getAdminName(); + } + + System.out.println(adminNames); + + //转list去重 + List list=new ArrayList(); + StringTokenizer adminName = new StringTokenizer(adminNames,","); + while(adminName.hasMoreTokens()){ + list.add(adminName.nextToken()); + } + List stringList = new ArrayList(new TreeSet(list)); + + + //重转成String + adminNames = ""; + for (int i = 0; i < stringList.size(); i++) { + if (i == stringList.size()-1){ + adminNames = adminNames + stringList.get(i); + }else { + adminNames = adminNames + stringList.get(i)+ ','; + } + + } + + employeeRegister.setAdminName(adminNames); + System.out.println("操作后" + adminNames); + + + + return employeeRegisterDao.updateEmployeeRegister(employeeRegister); + } + + /** + * @param employeeRegister + * @return + * 注册表审核通过后添加到员工信息表 + */ + @Override + public int insertEmployeeInfo(EmployeeRegister employeeRegister){ + return employeeRegisterDao.insertEmployeeInfo(employeeRegister); + } + + /** + * @param id + * @return + * 获取注册表状态 + */ + @Override + public String selectEmployeeRegisterStatus(String id){ + return employeeRegisterDao.selectEmployeeRegisterStatus(id); + } + + /** + * @param phone + * @return + * 超管否决普管已通过注册信息,根据电话令其注册信息从员工信息表删除 + */ + @Override + public int deleteEmployeeRegisterPhone(String phone){ + return employeeRegisterDao.deleteEmployeeInfoPhone(phone); + } + + /** + * @param phone + * @return + * 根据联系方式获取注册表密码 + */ + @Override + public String selectEmployeeInfoPasswode(String phone){ + return employeeRegisterDao.selectEmployeeInfoPasswode(phone); + } + + /** + * 插入新的注册用户 + * @param register + * @return 成功条数 + */ + @Override + public int insertRegister(EmployeeRegister register) { + return employeeRegisterDao.insertRegister(register); + } + + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/ExcelServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/ExcelServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c158541415a599221385361fe6c36940b4b7e824 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/ExcelServiceImpl.java @@ -0,0 +1,386 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.service.ExcelService; +import com.example.meetingroom.utils.DateUtil; +import com.example.meetingroom.vo.EmployeeInfoSuperVo; +import com.example.meetingroom.vo.EmployeeInfoVo; +import com.example.meetingroom.vo.RoomOrderListVo; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @Function: 对Excel导入导出业务的实现 + * @Author: Chen si ran + * @Date: 2021/9/9 14:57 + */ +@Service +public class ExcelServiceImpl implements ExcelService { + + /** + * @function: 根据文件名截取文件类型并返回 + * @param fullName 文件名 + * @return 文件类型 + */ + @Override + public String getType(String fullName) { + return fullName.substring(fullName.lastIndexOf(".")+1); + } + + /** + * @function: 获取目标工作表记录行数 + * @param sheet 目标工作表 + * @return 目标工作表记录行数 + */ + @Override + public int getSize(Sheet sheet) { + return sheet.getPhysicalNumberOfRows(); + } + + /** + * @function: 获取目标工作表所有数据 + * @param sheet 目标工作表 + * @return SheetData 目标工作表数据 + */ + @Override + public List> getSheetValue(Sheet sheet) { + + List> SheetData = new ArrayList<>(); + + //获取行数 + int rowCount = getSize(sheet); + + //通过遍历获取各行各单元格数据 + for (int rowNum = 0; rowNum < rowCount; rowNum++) { + SheetData.add(getRowValue(sheet.getRow(rowNum))); + } + + return SheetData; + } + + /** + * @function: 获取目标行所有单元格数据 + * @param row 目标行 + * @return rowData 目标行数据 + */ + public List getRowValue(Row row){ + + List rowData = new ArrayList<>(); + + //判断标题行是否为空 + if (row != null){ + + //获取标题行的列数 + int cellCount = row.getPhysicalNumberOfCells(); + + //遍历目标行 + for (int cellNum = 0; cellNum < cellCount; cellNum++) { + + Cell cell = row.getCell(cellNum); + + //判断该单元格是否为空,若不为空则获取该标题 + if (cell != null){ + Object cellValue = getCellValue(cell); + rowData.add(cellValue); + } + + } + } + + return rowData; + + } + + /** + * @function: 获取目标单元格数据 + * @param cell 目标单元格 + * @return cellValue 单元格数据 + */ + public Object getCellValue(Cell cell){ + + CellType type = cell.getCellTypeEnum(); + Object cellValue = ""; + + switch (type){ + case _NONE: + System.out.print("为_NONE"); + break; + case NUMERIC: + if (HSSFDateUtil.isCellDateFormatted(cell)){ + Date date = cell.getDateCellValue(); + cellValue = DateUtil.dateFormat(date); + }else { + cellValue = (int)cell.getNumericCellValue(); + } + break; + case STRING: + cellValue = cell.getStringCellValue(); + break; + case FORMULA: + System.out.print("为FORMULA"); + break; + case BLANK: + //System.out.print("该单元格为空"); + break; + case BOOLEAN: + cellValue = String.valueOf(cell.getBooleanCellValue()); + break; + case ERROR: + System.out.print("该单元格有误"); + break; + default: + System.out.println("啥也不知道"); + } + return cellValue; + } + + /** + * @function: 使用Excel表格导出数据 + * @param title Excel表名 + * @param headers 标题列表 + * @param dataset 要导出的数据集合 + * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中 + * @return + */ + /*@Override + public void export(String title, String[] headers, List dataset, OutputStream out){ + + //创建一个工作簿 + Workbook workbook = new XSSFWorkbook(); + + //创建一个表 + Sheet sheet = workbook.createSheet(title); + + //创建标题行并赋值 + Row row = sheet.createRow(0); + + //根据标题列表长度创建标题行并赋值 + for (int column = 0; column < headers.length; column++) { + Cell cell = row.createCell(column); + cell.setCellValue(headers[column]); + } + + *//*for (int i = 0; i < dataset.size(); i++) { + row = sheet.createRow(i); + + + }*//* + + // 遍历集合数据,产生数据行 + *//*Iterator iterator = dataset.iterator(); + int index = 0; + while(iterator.hasNext()){ + index++; + row = sheet.createRow(index); + Object next = iterator.next(); + + //根据反射获取javabean属性,动态调用getXXX()方法得到属性值 + Field[] fields = next.getClass().getDeclaredFields(); + + //创建单元格并赋值 + for (int i = 0; i < fields.length; i++) { + + Cell cell = row.createCell(i); + + //拼接一个getXX方法 + String fieldName = fields[i].getName(); + String getMethodName = "get" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1); + + try { + //通过反射得到getter方法 + Class tCls = next.getClass(); + Method getMethod = tCls.getMethod(getMethodName, new Class[]{}); + + //获取这个值 + Object value = getMethod.invoke(next, new Object[]{}); + // 判断值的类型后进行强制类型转换 + String textValue = null; + + if (value instanceof Integer) { + int intValue = (Integer) value; + cell.setCellValue(intValue); + }else { + // 其它数据类型都当作字符串简单处理 + textValue = value.toString(); + } + + //为单元格赋值 + cell.setCellValue(textValue); + + } catch (SecurityException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } finally { + // 清理资源 + } + } + + }*//* + + //导出文档 + try { + workbook.write(out); + } catch (IOException e) { + e.printStackTrace(); + } + }*/ + + /** + * @function: 导出所有数据 + * @param title Excel表名 + * @param headers 标题列表 + * @param dataset 要导出的数据集合 + * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中 + * @param role 该操作是普管(0)执行的还是超管(1)执行的 + * @return + */ + @Override + public void export(String title, String[] headers, List dataset, OutputStream out, int role) throws IOException{ + //创建一个工作簿 + Workbook workbook = new XSSFWorkbook(); + //创建一个表 + Sheet sheet = workbook.createSheet(title); + //创建标题行并赋值 + Row row = sheet.createRow(0); + Cell cell = null; + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + + //根据标题列表长度创建标题行并赋值 + for (int column = 0; column < headers.length; column++) { + sheet.setColumnWidth(column,15*256); + cell = row.createCell(column); + cell.setCellValue(headers[column]); + cell.setCellStyle(cellStyle); + } + + //使用数据集赋值 + for (int rowCount = 0; rowCount < dataset.size(); rowCount++) { + //创建行 + row = sheet.createRow(rowCount+1); + + //选择导出普管、超管的员工信息表还是会议室预订记录表 + if (role == 0){ + EmployeeInfoSuperVo employeeInfoSuperVo = (EmployeeInfoSuperVo)dataset.get(rowCount); + //为各单元格赋值(EmployeeInfoVo) + cell = row.createCell(0); + cell.setCellValue(employeeInfoSuperVo.getId()); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue(employeeInfoSuperVo.getNumber()); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue(employeeInfoSuperVo.getName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue(employeeInfoSuperVo.getDepartName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue(employeeInfoSuperVo.getRoleName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue(employeeInfoSuperVo.getPhone()); + cell.setCellStyle(cellStyle); + cell = row.createCell(6); + cell.setCellValue(employeeInfoSuperVo.getSex()); + cell.setCellStyle(cellStyle); + }else if(role == 1){ + EmployeeInfoSuperVo employeeInfoSuperVo = (EmployeeInfoSuperVo)dataset.get(rowCount); + //为各单元格赋值(EmployeeInfoVo) + cell = row.createCell(0); + cell.setCellValue(employeeInfoSuperVo.getId()); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue(employeeInfoSuperVo.getNumber()); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue(employeeInfoSuperVo.getName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue(employeeInfoSuperVo.getDepartName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue(employeeInfoSuperVo.getRoleName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue(employeeInfoSuperVo.getPhone()); + cell.setCellStyle(cellStyle); + cell = row.createCell(6); + cell.setCellValue(employeeInfoSuperVo.getSex()); + cell.setCellStyle(cellStyle); + cell = row.createCell(7); + cell.setCellValue(employeeInfoSuperVo.getPassword()); + cell.setCellStyle(cellStyle); + }else if(role == 2){ + + RoomOrderListVo roomOrderVo = (RoomOrderListVo)dataset.get(rowCount); + //为各单元格赋值 + cell = row.createCell(0); + cell.setCellValue(roomOrderVo.getId()); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue(roomOrderVo.getRoomName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue(roomOrderVo.getTime()); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue(roomOrderVo.getApplicant()); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue(roomOrderVo.getPhone()); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue(roomOrderVo.getSubject()); + cell.setCellStyle(cellStyle); + cell = row.createCell(6); + cell.setCellValue(roomOrderVo.getIsUse()); + cell.setCellStyle(cellStyle); + cell = row.createCell(7); + cell.setCellValue(roomOrderVo.getRoomOrderStatus()); + cell.setCellStyle(cellStyle); + cell = row.createCell(8); + cell.setCellValue(roomOrderVo.getOperationPeopleName()); + cell.setCellStyle(cellStyle); + cell = row.createCell(9); + cell.setCellValue(roomOrderVo.getOpinion()); + cell.setCellStyle(cellStyle); + cell = row.createCell(10); + cell.setCellValue(roomOrderVo.getEmployeeList()); + cell.setCellStyle(cellStyle); + cell = row.createCell(11); + cell.setCellValue(roomOrderVo.getType()); + cell.setCellStyle(cellStyle); + cell = row.createCell(12); + cell.setCellValue(roomOrderVo.getNum()); + cell.setCellStyle(cellStyle); + cell = row.createCell(13); + cell.setCellValue(roomOrderVo.getEquipment()); + cell.setCellStyle(cellStyle); + cell = row.createCell(14); + cell.setCellValue(roomOrderVo.getAddress()); + cell.setCellStyle(cellStyle); + } + } + + //导出文档 + workbook.write(out); + } + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/PageServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/PageServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f58d5f07d204a0f10640e4e6a06e4ffb5a98ffb8 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/PageServiceImpl.java @@ -0,0 +1,52 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.service.PageService; +import com.example.meetingroom.vo.PageVo_xuan; +import org.springframework.stereotype.Service; + +/** + * @author : C_xuan + * @date : 20:11 2021/9/10 + */ +@Service +public class PageServiceImpl implements PageService { + + /** + * @param currentPage 跳转页数 + * @param currentCount 每页数据量 + * @param totalRecord 数据总量 + * @return + * 分页公共方法 + */ + @Override + public PageVo_xuan selectPage(Integer currentPage, Integer currentCount, Integer totalRecord)throws Exception{ + + PageVo_xuan pageVo = new PageVo_xuan<>(); + + pageVo.setCurrentCount(currentCount); + pageVo.setTotalRecord(totalRecord); + pageVo.setCurrentPage(currentPage); + + + //总页数 + Integer totalPage; + if (totalRecord%pageVo.getCurrentCount() != 0){ + totalPage = totalRecord/pageVo.getCurrentCount()+1; + }else { + totalPage = totalRecord/pageVo.getCurrentCount(); + } + pageVo.setTotalPage(totalPage); + + //判断参数是否合法 + if (totalPage < currentPage){ + pageVo.setCurrentPage(-1); + return pageVo; + } + //对默认初始页面和默认每页展示数据量进行覆盖 + pageVo.setOffset((currentPage-1)*currentCount); + pageVo.setCurrentCount(currentCount); + + + return pageVo; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/RoleServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fd57c78a4a384598d63a527fc1f758058daeae38 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoleServiceImpl.java @@ -0,0 +1,51 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.RoleDao; +import com.example.meetingroom.dao.RoomInfoDao; +import com.example.meetingroom.entity.Role; +import com.example.meetingroom.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class RoleServiceImpl implements RoleService { + + @Autowired + private RoleDao roleDao; + +// @Override +// public Role selectOne(String id) { +// return roleDao.selectOne(id); +// } + + /** + * @return + * 查询所有权限,用于员工表权限修改 + */ + @Override + public List selectRoleList(){ + return roleDao.selectRoleList(); + } + + @Override + public String getRoleByPhone(String phone) { + return roleDao.getRoleByPhone(phone); + } + + /** + * 根据权限ID来获取权限名 + * @param id 权限ID + * @return 权限名 + */ + @Override + public String getRoleByRoleId(String id) { + return roleDao.getRoleByRoleId(id); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomInfoServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomInfoServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..79025641916416e01ca1dcac9282d1146fc2b56b --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomInfoServiceImpl.java @@ -0,0 +1,91 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.RoomInfoDao; +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.service.RoomInfoService; +import com.example.meetingroom.vo.PageVo_xuan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class RoomInfoServiceImpl implements RoomInfoService { + + @Autowired + private RoomInfoDao roomInfoDao; + + @Autowired + private PageServiceImpl pageService; + + +// @Override +// public Page selectRoomInfoPage(){ +// Page page = new Page<>(); +// +// Page commodityVoPage = baseMapper.selectPage(page,null); +// return +// } + +// @Override +// public RoomInfoDto selectOne(String id) { +// return roomInfoDao.selectOne(id); +// } + + /** + * @param roomInfo + * @return int 1或0 + * 用于超管对会议室信息的修改操作 + */ + @Override + @Transactional + public int updateRoomInfo(RoomInfo roomInfo){ + return roomInfoDao.updateRoomInfo(roomInfo); + + } + + /** + * @param id 会议室id,根据id进行删除操作 + * @return int 0或1 + * 用于超管对会议室信息的删除操作 + */ + @Override + public int deleteRoomInfo(String id){ + return roomInfoDao.deleteRoomInfo(id); + } + + /** + * @param roomInfo + * @return int 0或1 + * 用于超管新增会议室信息 + */ + @Override + public int insertRoomInfo(RoomInfo roomInfo){ + return roomInfoDao.insertRoomInfo(roomInfo); + } + + /** + * @param currentPage 前端传回的跳转页码 + * @param currentCount 默认每页数据量 + * @return PageVo_xuan 数据库结果返回列表 + * 用于会议室信息的分页和分页跳转 + */ + @Override + public PageVo_xuan selectRoomInfoPage(Integer currentPage, Integer currentCount) throws Exception { + //获取总数据量 + Integer totalRecord = roomInfoDao.count(); + + PageVo_xuan roomInfoPageVo = pageService.selectPage(currentPage, currentCount, totalRecord);; + + //判断参赛是否合法 + if (roomInfoPageVo.getCurrentPage() == -1){ + return roomInfoPageVo; + } + roomInfoPageVo.setList(roomInfoDao.selectRoomInfoPage(roomInfoPageVo)); + return roomInfoPageVo; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomOrderServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomOrderServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2fe53f5915aebad2b2a75a76f6b4e8d13802031e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/RoomOrderServiceImpl.java @@ -0,0 +1,341 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.dao.RoomOrderDao; +import com.example.meetingroom.entity.RoomInfo; +import com.example.meetingroom.entity.RoomOrder; +import com.example.meetingroom.service.RoomOrderService; +import com.example.meetingroom.vo.*; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + * @function: + * @Author: + * @Date: 2021-9-8 08:15:42 + */ +@Service +public class RoomOrderServiceImpl implements RoomOrderService { + + @Autowired + private RoomOrderDao roomOrderDao; + + /*@Override + public RoomOrder selectOne(String id) { + return roomOrderDao.selectOne(id); + }*/ + + /** + * 业务:“()年()月会议室使用次数” + * 功能:实现接口,获取某年月各会议室的使用次数及对应的会议室名称 + */ + @Override + public List getRoomOrderNumber(String selectTime) { + return roomOrderDao.getRoomOrderNumber(selectTime); + } + + /** + * 业务:“会议室简介” + * 功能:从room_info表中获取会议室信息 + */ + @Override + public List getAllRoomInfo() { + return roomOrderDao.getAllRoomInfo(); + } + + /** + * 业务:“已预订” + * 功能:从room_order表中获取已预订会议室信息 + */ + @Override + public List getAllRoomOrderMessage(String name) { + return roomOrderDao.getAllRoomOrderMessage(name); + } + + /** + * ---------------------------------总业务:“会议室预订”------------------------------------------------- + * 分业务:“会议室选择” + * 功能:实现接口,获取所有会议室名称 + */ + @Override + public List getAllRoomName() { + return roomOrderDao.getAllRoomName(); + } + + /** + * 分业务:“参与会议员工” + * 功能:实现接口,获取所有员工的名称 + */ + @Override + public List getAllEmployeeName() { + return roomOrderDao.getAllEmployeeName(); + } + + /** + * 分业务:“提交申请” + * 功能:实现接口,将前端返回的“会议室预订”信息,插入到room_order表中 + */ + @Override + public Object insertRoomOrderMessage(RoomOrderMessageVo roomOrderMessageVo) { + String employee_info_id = roomOrderDao.getEmployeeInfoId(roomOrderMessageVo.getApplicant()); + return roomOrderDao.insertRoomOrderMessage(roomOrderMessageVo.getRoom_id(), + employee_info_id, + roomOrderMessageVo.getSubject(), + "0", + roomOrderMessageVo.getApplicant(), + roomOrderMessageVo.getPhone(), + roomOrderMessageVo.getEmployee_list(), + roomOrderMessageVo.getYear()+"-"+roomOrderMessageVo.getMonth()+"-"+roomOrderMessageVo.getDay()+" "+roomOrderMessageVo.getStartTime(), + roomOrderMessageVo.getYear()+"-"+roomOrderMessageVo.getMonth()+"-"+roomOrderMessageVo.getDay()+" "+roomOrderMessageVo.getEndTime(), + "待审核", + 1); + } + + /** + * -------------------------------------------------------------------------------------------------- + */ + + @Override + public RoomOrder selectOne(String id) { + return roomOrderDao.selectOne(id); + } + + @Override + public List selectAdmin(Integer role) { + return roomOrderDao.selectAdmin(role); + } + + /** + * @description: 查询全部预定记录数据总量 + * @param: 查询类型(用户个人预约记录-0、审批预订记录-1、已完成预订记录-2),用户身份(管理员,或超管) + * @return: 全部预定记录数据总量 + * @author feng + * @date: 2021/9/8 16:16 + */ + @Override + public Integer selectCounts(String selectType, Integer role,String userId) { + + Integer result = null; + + //判断查询类型 + switch (selectType){ + case "userOrder": + result = roomOrderDao.selectCountsUserOrder(userId); + break; + case "auditOrder": + result = roomOrderDao.selectCountsAuditOrder(); + break; + case "completedOrder": + result = roomOrderDao.selectCountsCompletedOrder(role); + } + return result; + } + + /** + * @description: 获取预定记录总页数 + * @param: 显示行数,记录总数 + * @return: + * @author feng + * @date: 2021/9/8 17:01 + */ + @Override + public Integer selectPages(Integer lineNum,Integer counts) { + //总页数-->记录总数/每页显示行数 + Integer PageCount =counts%lineNum>0?counts/lineNum+1:counts/lineNum; + return PageCount; + } + + /** + * @description: 检查参数是否合法 + * @param: 每页显示行数,显示第几页页数 + * @return: boolean + * @author feng + * @date: 2021/9/9 14:30 + */ + @Override + public PageVo checkParams(String selectType,Integer lineNum, Integer pageNum,Integer role,String userId) { + //总记录数 + Integer counts = selectCounts(selectType,role,userId); + //总页数 + Integer pageCount = selectPages(lineNum,counts); + //判断参数 + if(lineNum<0 || pageNum<0 || pageNum>pageCount){ + return null; + } + //有可能显示条数7,但只有6条数据,那么当前页面显示的数据就是6条 + if(lineNum>=counts){ + return new PageVo(pageNum,counts,counts,pageCount); + } + return new PageVo(pageNum,lineNum,counts,pageCount); + } + + //查询预订记录数据 + @Override + public Object select(String type,Integer pageNum, Integer lineNum, Integer role, String userId){ + Object data = null; + //判断查询类型 + switch (type){ + case "userOrder": + data = selectUserOrder(pageNum,lineNum,userId); + break; + case "auditOrder": + data = selectAuditOrder(pageNum,lineNum); + break; + case "completedOrder": + data = selectCompletedOrder(pageNum,lineNum,role); + break; + default: + System.out.println("err"); + } + return data; + } + + /** + * @description: 根据员工id查找员工的预约记录 + * @param: null + * @return: + * @author feng + * @date: 2021/9/11 15:25 + */ + @Override + public List selectUserOrder(Integer pageNum, Integer lineNum, String userId) { + return roomOrderDao.selectUserOrder(pageNum*lineNum-lineNum,lineNum,userId); + } + + /** + * @description: 按照页数查询数据(会议室预订记录) + * @param: 页数,每页显示行数 + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/8 13:33 + */ + @Override + public List selectCompletedOrder(Integer pageNum, Integer lineNum, Integer role) { + //因为数据库的页数参数是从0开始,所以这里pageNum-1 + List list=roomOrderDao.selectCompletedOrder(pageNum*lineNum-lineNum,lineNum,role); + return list; + } + /** + * @description: 按照页数查询数据(会议室待审核记录) + * @param: 页数,每页显示行数 + * @return: 查询到的数据集合 + * @author feng + * @date: 2021/9/10 11:28 + */ + @Override + public List selectAuditOrder(Integer pageNum, Integer lineNum) { + //因为数据库的页数参数是从0开始,所以这里pageNum-1 + List list=roomOrderDao.selectAuditOrder(pageNum*lineNum-lineNum,lineNum); + return list; + } + + + + /** + * @description: 检查订单是否已被审核 + * @param: 订单id + * @return: 未审核1,已审核0 + * @author feng + * @date: 2021/9/11 13:23 + */ + @Override + public Boolean checkOrderStatus(String orderId) { + Integer result = roomOrderDao.selectOrderStatusById(orderId).equals("待审核")?1:0; + if(result == 1){ + return true; + } + return false; + } + + /** + * @description: 检查修改信息中的RoomName是否合法即是否存在 + * @param: 要修改的房间名 + * @return: 存在1,不存在0 + * @author feng + * @date: 2021/9/11 14:09 + */ + @Override + public Boolean checkRoomExist(String roomName) { + Integer result =roomOrderDao.selectExistByRoomName(roomName); + if(result == 1){ + return true; + } + return false; + } + + /** + * @description: 员工修改个人预约记录(还未被审核的记录) + * @param: 订单id,修改的订单信息对象 + * @return: 修改结果 + * @author feng + * @date: 2021/9/11 14:47 + */ + @Override + public Boolean updateUserOrderInfo(String orderId, RoomOrderUserVo roomOrderUserVo) { + //查看用户有没有修改会议室房间 + String roomName = roomOrderDao.selectOrderRoom(orderId); + //获取会议开始时间和结束时间 + String time = roomOrderUserVo.getTime(); + String YMTime = time.substring(0,10); + String sTime = YMTime+" "+time.substring(11,16); + String eTime = YMTime+" "+time.substring(17,time.length()); + Date start_time = new Date(sTime); + Date end_time = new Date(eTime); + + //如果员工修改了预订的会议室房间,则需要修改详情中的房间信息 + RoomInfo roomInfo = null; + if(!roomName.equals(roomOrderUserVo.getRoomName())){ + roomInfo = roomOrderDao.selectRoomInfoByRoomName(roomOrderUserVo.getRoomName()); + roomOrderUserVo.getRoomOrderDetails().setName(roomInfo.getName()); + roomOrderUserVo.getRoomOrderDetails().setType(roomInfo.getType()); + roomOrderUserVo.getRoomOrderDetails().setNum(roomInfo.getNum()); + roomOrderUserVo.getRoomOrderDetails().setAddress(roomInfo.getAddress()); + roomOrderUserVo.getRoomOrderDetails().setPhone(roomOrderUserVo.getPhone()); + roomOrderUserVo.getRoomOrderDetails().setIsUse(roomOrderUserVo.getIsUse()); + } + Integer result = roomOrderDao.updateOrderByOrderId(orderId, start_time, end_time, roomOrderUserVo); + if(result==1){ + return true; + } + return false; + } + + /** + * @description: 逻辑删除预订记录 + * @param: 订单编号 + * @return: 操作结果 + * @author feng + * @date: 2021/9/11 21:31 + */ + @Override + @Transactional + public Boolean deleteOrder(String orderId) { + Integer result = roomOrderDao.deleteOrderById(orderId); + if(result==1){ + return true; + } + return false; + } + + /** + * @description: 审核订单 + * @param: 审核结果 + * @return: 修改数据库结果 + * @author feng + * @date: 2021/9/10 14:19 + */ + @Override + @Transactional + public Boolean auditOrder(AuditVo auditVo) { + Integer result = roomOrderDao.auditOrder(auditVo); + if(result==1){ + return true; + } + return false; + } + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/SendMessageServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/SendMessageServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dfeef7fa1d7d15e0e678b445c2f6973b26656a39 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/SendMessageServiceImpl.java @@ -0,0 +1,147 @@ +package com.example.meetingroom.service.impl; + +import com.example.meetingroom.service.SendMessageService; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.sms.v20190711.SmsClient; +import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest; +import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse; +import com.tencentcloudapi.sms.v20190711.models.SendStatus; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +/** + * @Function: 使用腾讯云短信服务发送短信 + * @Author: Chen si ran + * @Date: 2021/9/8 12:23 + */ +@Service +public class SendMessageServiceImpl implements SendMessageService { + + //配置腾讯云秘钥 + @Value("${sendMessage.accessKeyId}") + private String accessKeyId; + + //配置腾讯云秘钥 + @Value("${sendMessage.accessSecret}") + private String accessKeySecret; + + //短信服务SdkAppId + @Value("${sendMessage.sdkAppId}") + private String sdkAppId; + + //模板ID--注册审核-通过 + @Value("${sendMessage.templateCodePass}") + private String templateCodePass; + + //模板ID--注册审核-未通过 + @Value("${sendMessage.templateCodeNotPass}") + private String templateCodeNotPass; + + //签名内容 + @Value("${sendMessage.signName}") + private String signName; + + /** + * @function: 初始化短信配置 + * @param phone 目标电话号码 + * @return 初始化后的request + */ + private SendSmsRequest initRequest(String phone){ + + //实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数 + SendSmsRequest request = new SendSmsRequest(); + + //将目标电话号码添加到对应配置集合中 + String[] phoneNumSet = {"+86" + phone}; + + //腾讯云短信服务目标电话号码 + request.setPhoneNumberSet(phoneNumSet); + + //腾讯云短信服务的sdkAppId + request.setSmsSdkAppid(sdkAppId); + + //腾讯云短信服务的签名内容 + request.setSign(signName); + + return request; + } + + /** + * @function: 审核通过 的短信 的配置 + * @param phoneNumber 目标电话号码 + * @return 配置完的request + */ + @Override + public String sendPass(String phoneNumber) { + + SendSmsRequest request = initRequest(phoneNumber); + + //腾讯云短信服务模板ID--注册审核-通过 + request.setTemplateID(templateCodePass); + + return sendResult(request); + } + + /** + * @function: 审核未通过 的短信 的配置 + * @param phoneNumber 目标电话号码 + * @return 配置完的request + */ + @Override + public String sendNotPass(String phoneNumber,String opinion) { + + SendSmsRequest request = initRequest(phoneNumber); + + //腾讯云短信服务模板ID--注册审核-未通过 + request.setTemplateID(templateCodeNotPass); + + //模板参数--审批意见 + String[] templateParamSet = {opinion}; + request.setTemplateParamSet(templateParamSet); + + return sendResult(request); + } + + /** + * @function: 发送短信 + * @param request 配置完的request + * @return 短信是否发送成功 + */ + private String sendResult(SendSmsRequest request){ + + //实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId 和 secretKey + Credential credential = new Credential(accessKeyId, accessKeySecret); + + //实例化 SMS 的 client 对象,第二个参数是地域信息 + SmsClient smsClient = new SmsClient(credential, "ap-guangzhou"); + + //存储短信发送的结果 + SendSmsResponse response = null; + try { + //通过 client 对象调用 SendSms 方法发起请求 + response = smsClient.SendSms(request); + + //获取短信发送状态 + SendStatus[] statusSet = response.getSendStatusSet(); + + /*System.out.println("---日志---"); + System.out.println("返回值response:" + SendSmsResponse.toJsonString(response)); + System.out.println("唯一请求ID RequestId:" + response.getRequestId()); + System.out.println("---------");*/ + + //获取返回的结果 + String result = statusSet[0].getCode(); + + //根据短信发送状态返回值判断发送是否成功(若结果等于Ok则发送成功,失败则返回失败信息) + if ("Ok".equals(result)) { + return result; + } else { + return result; + } + } catch (TencentCloudSDKException e) { + e.printStackTrace(); + } + return "短信发送失败"; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/service/impl/UploadServiceImpl.java b/meeting2/src/main/java/com/example/meetingroom/service/impl/UploadServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1d03257681778888dada20b98c5446580791579e --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/service/impl/UploadServiceImpl.java @@ -0,0 +1,125 @@ +package com.example.meetingroom.service.impl; + +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.common.utils.StringUtils; +import com.aliyun.oss.model.CannedAccessControlList; +import com.aliyun.oss.model.CreateBucketRequest; +import com.aliyun.oss.model.StorageClass; +import com.example.meetingroom.service.UploadService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +/** + * @ClassName UploadServiceImpl + * @Description: 上传文件接口实现类 + * @Author: Computer Association + * @Date: Create in 2021/3/11 15:15 + * @Version: V1.0 + */ +@Service +public class UploadServiceImpl implements UploadService { + + // 外网访问地址 + @Value("${sendOss.ENDPOINT}") + private static String ENDPOINT; + + // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高 + @Value("${sendOss.ACCESSKEYID}") + private static String ACCESSKEYID; + + @Value("${sendOss.ACCESSKEYSECERT}") + private static String ACCESSKEYSECERT; + + //仓库名称 + @Value("${sendOss.BUCKETNAME}") + private static String BUCKETNAME; + + //上传成功后返回的URL + @Value("${sendOss.SUFFER_URL}") + private static String SUFFER_URL; + + /** + * @param multipartFile 需要上传的文件 + * @Description: TODO + * @Return: url 上传的文件在云服务器中的位置(可通过外网访问) + * @Author: Computer Association + * @Date: 2021/3/11 10:59 + */ + @Override + public String uploadDocument(MultipartFile multipartFile) { + //获取oss连接 + OSS ossClient = this.getOssClient(); + //获取上传文件的全称 + String ext = multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf(".")); + //后缀名(文件类型) + String businessType = ext.substring(1); + //组合文件名 + String fileName = getFileName(businessType, ext); + String url = null; + try { + ossClient.putObject(BUCKETNAME, fileName, new ByteArrayInputStream(multipartFile.getBytes())); + url = SUFFER_URL + fileName; + System.out.println("上传资料成功,url路径为:" + url); + } catch (IOException e) { + e.printStackTrace(); + } finally { + ossClient.shutdown(); + } + return url; + } + + /** + * @return ossClient 一个OSSClient实例 + * @Description: 获取ossClient实例对象 + * @Author: Computer Association + * @Date: 2021/3/11 15:37 + **/ + public OSS getOssClient() { + //创建一个OSSClient实例 + OSS ossClient = new OSSClientBuilder().build(ENDPOINT, ACCESSKEYID, ACCESSKEYSECERT); + //判断该bucket是否存在 + if (ossClient.doesBucketExist(BUCKETNAME)) { + System.out.println("bucket创建成功!"); + } else { + System.out.println("bucket不存在,创建bucket:" + BUCKETNAME); + //创建一个bucket仓库,可先不赋值仓库名,通过set赋值 + CreateBucketRequest bucketRequest = new CreateBucketRequest(null); + bucketRequest.setBucketName(BUCKETNAME);//设置该仓库名 + bucketRequest.setStorageClass(StorageClass.IA);//设置存储类型为低频访问类型,默认为标准类型 + bucketRequest.setCannedACL(CannedAccessControlList.PublicRead);//设置该仓库访问权限 + //创建bucket仓库 + ossClient.createBucket(bucketRequest); + } + return ossClient; + } + + /** + * @Description: 获得上传文件组合后的文件名(服务器中的地址) + * @param: businessType 上传文件的类型 + * @param: ext 上传文件的全称 + * @return: filename 组合后的文件名(服务器里的地址) + * @Author: Computer Association + * @Date: 2021/3/11 11:14 + **/ + public String getFileName(String businessType, String ext) { + //格式化日期 + String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); + if (StringUtils.isNullOrEmpty(businessType)) { + businessType = "default"; + } + //为了避免文件重名,使用UUID命名图片 + String uuid = UUID.randomUUID().toString().replace("-", ""); + //组合filename + String filename = businessType + "/" + date + "/" + uuid + ext; + return filename; + } + +} diff --git a/meeting2/src/main/java/com/example/meetingroom/utils/DateUtil.java b/meeting2/src/main/java/com/example/meetingroom/utils/DateUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..245f18b459fdf9c7c689f8de167b406abec394ee --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/utils/DateUtil.java @@ -0,0 +1,23 @@ +package com.example.meetingroom.utils; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @function: 时间格式化工具类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class DateUtil { + + /** + * 将时间参数格式化,以字符串形式输出 + * @param date date类型的时间 + * @return String类型且格式化好的时间 + */ + public static String dateFormat(Date date){ + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return dateFormat.format(date); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/AllOrderMessageVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/AllOrderMessageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..1f8c4e2c4229577c6ef7115b43c57b3fb6d796bc --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/AllOrderMessageVo.java @@ -0,0 +1,60 @@ +package com.example.meetingroom.vo; + +/** + * @function: 定义dao层中的RoomOrderDao的getAllRoomOrder方法的返回值类型 + * @author:ljh + * @time: 2021-9-9 20:17:20 + */ +public class AllOrderMessageVo { + + private String name; + + private String applicant; + + private String startTime; + + private String roomOrderStatus; + + public AllOrderMessageVo(){ + + } + + public AllOrderMessageVo(String name, String applicant, String startTime, String roomOrderStatus) { + this.name = name; + this.applicant = applicant; + this.startTime = startTime; + this.roomOrderStatus = roomOrderStatus; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getroomOrderStatus() { + return roomOrderStatus; + } + + public void setroomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/AuditVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/AuditVo.java new file mode 100644 index 0000000000000000000000000000000000000000..dd6a9b90b62f30fcd9e7a350368ab2451ee3b286 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/AuditVo.java @@ -0,0 +1,74 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: 审核订单时,前端发送的订单关键信息 + * @date 2021/9/11 20:05 + */ +public class AuditVo { + + //审核预约记录id + private String orderId; + + //审核人 + private String operationPeopleId; + + //审核意见 + private String opinion; + + //审核结果 + private Boolean auditResult; + + public AuditVo() { + } + + + public AuditVo(String orderId, String operationPeopleId, String opinion, Boolean auditResult) { + this.orderId = orderId; + this.operationPeopleId = operationPeopleId; + this.opinion = opinion; + this.auditResult = auditResult; + } + + public Boolean getAuditResult() { + return auditResult; + } + + public void setAuditResult(Boolean auditResult) { + this.auditResult = auditResult; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getOperationPeopleId() { + return operationPeopleId; + } + + public void setOperationPeopleId(String operationPeopleId) { + this.operationPeopleId = operationPeopleId; + } + + public String getOpinion() { + return opinion; + } + + public void setOpinion(String opinion) { + this.opinion = opinion; + } + + @Override + public String toString() { + return "AuditVo{" + + "orderId='" + orderId + '\'' + + ", operationPeopleId='" + operationPeopleId + '\'' + + ", opinion='" + opinion + '\'' + + ", auditResult=" + auditResult + + '}'; + } +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/CountVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/CountVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9574e27fcd9bd99030f798b7889df5eea49e31ad --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/CountVo.java @@ -0,0 +1,37 @@ +package com.example.meetingroom.vo; + +/** + * @function: 定义dao层中的RoomOrderDao的getRoomOrderNumber方法的返回值类型 + * @author:ljh + * @time: 2021-9-9 20:17:20 + */ +public class CountVo { + + private int value; + + private String name; + + public CountVo() { + } + + public CountVo(String name, int value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoSuperVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoSuperVo.java new file mode 100644 index 0000000000000000000000000000000000000000..2ec993a856a1b3f1079301b7fe3445743c047eca --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoSuperVo.java @@ -0,0 +1,131 @@ +package com.example.meetingroom.vo; + +/** + * @Function: 超级管理员-员工管理类(继承普通管理员-员工管理类) + * @Author: Chen si ran + * @Date: 2021/9/10 12:08 + */ +public class EmployeeInfoSuperVo{ + + //员工信息表主键id + private String id; + + //关联的角色表的角色名 + private String roleName; + + //关联的部门表的部门名 + private String departName; + + //员工姓名 + private String name; + + //员工编号 + private int number; + + //联系方式 + private String phone; + + //性别(0为女,1为男) + private int sex; + + //密码 + private String password; + + /** + * @function: 无参构造 + */ + public EmployeeInfoSuperVo() { + } + + /** + * @function: 有参构造 + */ + public EmployeeInfoSuperVo(String id, String roleName, String departName, String name, int number, String phone, int sex, String password) { + this.id = id; + this.roleName = roleName; + this.departName = departName; + this.name = name; + this.number = number; + this.phone = phone; + this.sex = sex; + this.password = password; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getDepartName() { + return departName; + } + + public void setDepartName(String departName) { + this.departName = departName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public String toString() { + return "EmployeeInfoSuperVo{" + + "id='" + id + '\'' + + ", roleName='" + roleName + '\'' + + ", departName='" + departName + '\'' + + ", name='" + name + '\'' + + ", number=" + number + + ", phone='" + phone + '\'' + + ", sex=" + sex + + ", password='" + password + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..ed5a2495b2ed7bb21c4b26960ad6e33eb9372b14 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeInfoVo.java @@ -0,0 +1,159 @@ +package com.example.meetingroom.vo; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 员工信息表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class EmployeeInfoVo { + + //员工信息表主键id + private String id; + + //关联的角色表的角色名 + private String roleName; + + //关联的部门表的部门名 + private String departName; + + //员工姓名 + private String name; + + //员工编号 + private int number; + + //联系方式 + private String phone; + + //密码 + private String password; + + //性别(0为女,1为男) + private int sex; + +// //创建时间 +// private Date createTime; +// +// //更新时间 +// private Date updateTime; + + /** + * @function: 无参构造 + */ + public EmployeeInfoVo() { + } + + public EmployeeInfoVo(String id, String roleName, String departName, String name, int number, String phone, String password, int sex) { + this.id = id; + this.roleName = roleName; + this.departName = departName; + this.name = name; + this.number = number; + this.phone = phone; + this.password = password; + this.sex = sex; + } + + /** + * @function: 有参构造 + */ + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getDepartName() { + return departName; + } + + public void setDepartName(String departName) { + this.departName = departName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + +// /** +// * function: 获取创建时间并格式化 +// * @return +// */ +// public String getCreateTime() { +// return DateUtil.dateFormat(createTime); +// } +// +// /** +// * function: 获取更新时间并格式化 +// * @return +// */ +// public String getUpdateTime() { +// return DateUtil.dateFormat(updateTime); +// } + + @Override + public String toString() { + return "EmployeeInfoVo{" + + "id='" + id + '\'' + + ", roleName='" + roleName + '\'' + + ", departName='" + departName + '\'' + + ", name='" + name + '\'' + + ", number=" + number + + ", phone='" + phone + '\'' + + ", password='" + password + '\'' + + ", sex=" + sex + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeRegisterVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeRegisterVo.java new file mode 100644 index 0000000000000000000000000000000000000000..87fc908a88bfba9a0ae2df6c9a03c0e9f062d56d --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/EmployeeRegisterVo.java @@ -0,0 +1,158 @@ +package com.example.meetingroom.vo; + +import com.example.meetingroom.utils.DateUtil; + +import java.util.Date; + +/** + * @function: 员工注册表实体类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class EmployeeRegisterVo { + + //员工注册表主键id + private String id; + + //关联的部门表名 + private String departName; + + //关联的部门id + private String departId; + + //员工姓名 + private String name; + + //联系方式 + private String phone; + + //密码 + private String password; + + //性别(0为女,1为男) + private int sex; + + //注册审批状态 + private String employeeRegisterStatus; + + //注册审批意见 + private String opinion; + + //审批人姓名 + private String adminName; + + /** + * @function: 无参构造 + */ + public EmployeeRegisterVo() { + } + + public EmployeeRegisterVo(String id, String departName, String departId, String name, String phone, String password, int sex, String employeeRegisterStatus, String opinion, String adminName) { + this.id = id; + this.departName = departName; + this.departId = departId; + this.name = name; + this.phone = phone; + this.password = password; + this.sex = sex; + this.employeeRegisterStatus = employeeRegisterStatus; + this.opinion = opinion; + this.adminName = adminName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartName() { + return departName; + } + + public void setDepartName(String departName) { + this.departName = departName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getEmployeeRegisterStatus() { + return employeeRegisterStatus; + } + + public void setEmployeeRegisterStatus(String employeeRegisterStatus) { + this.employeeRegisterStatus = employeeRegisterStatus; + } + + public String getOpinion() { + return opinion; + } + + public void setOpinion(String opinion) { + this.opinion = opinion; + } + + public String getAdminName() { + return adminName; + } + + public void setAdminName(String adminName) { + this.adminName = adminName; + } + + public String getDepartId() { + return departId; + } + + public void setDepartId(String departId) { + this.departId = departId; + } + + @Override + public String toString() { + return "EmployeeRegisterVo{" + + "id='" + id + '\'' + + ", departName='" + departName + '\'' + + ", departId='" + departId + '\'' + + ", name='" + name + '\'' + + ", phone='" + phone + '\'' + + ", password='" + password + '\'' + + ", sex=" + sex + + ", employeeRegisterStatus='" + employeeRegisterStatus + '\'' + + ", opinion='" + opinion + '\'' + + ", adminName='" + adminName + '\'' + + '}'; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/PageVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/PageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..e1a75fd6d12632a04bc556315bd0fff774329d49 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/PageVo.java @@ -0,0 +1,66 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: 底部页面选项类 + * @date 2021/9/8 11:43 + */ +public class PageVo { + + // 1.当前页数 从页面获取 + private int currentPage; + // 2.每页显示数据个数,赋初值或者setter获取 + private int currentCount; + // 3.总条数,从数据库获取 + private int totalRecord; + // 4.总页数,计算得到 + private int totalPage; + + public PageVo(int currentPage, int currentCount, int totalRecord, int totalPage) { + this.currentPage = currentPage; + this.currentCount = currentCount; + this.totalRecord = totalRecord; + this.totalPage = totalPage; + } + + //后来添加 + public PageVo(int currentPage, int currentCount) { + this.currentPage = currentPage; + this.currentCount = currentCount; + } + + public PageVo() { + } + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public int getCurrentCount() { + return currentCount; + } + + public void setCurrentCount(int currentCount) { + this.currentCount = currentCount; + } + + public int getTotalRecord() { + return totalRecord; + } + + public void setTotalRecord(int totalRecord) { + this.totalRecord = totalRecord; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/PageVo_xuan.java b/meeting2/src/main/java/com/example/meetingroom/vo/PageVo_xuan.java new file mode 100644 index 0000000000000000000000000000000000000000..19a1ec2a0d6a63c5b3db6c2e81c82ebd3512c006 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/PageVo_xuan.java @@ -0,0 +1,99 @@ +package com.example.meetingroom.vo; + +import com.example.meetingroom.entity.EmployeeInfo; +import org.springframework.data.domain.Page; + +import java.util.List; + +/** + * @author feng + * @description: 底部页面选项类 + * @date 2021/9/8 11:43 + */ +public class PageVo_xuan{ + + // 1.当前页数 从页面获取 + private int currentPage = 1; + // 2.每页显示数据个数,赋初值或者setter获取 + private int currentCount = 3; + // 3.总条数,从数据库获取 + private int totalRecord; + // 4.总页数,计算得到 + private int totalPage; + // 5.数据库返回结果 + private List list; + // 6.limit 跳过前面数据数 + private int offset; + + public PageVo_xuan(int currentPage, int currentCount, int totalRecord, int totalPage, List list, int offset) { + this.currentPage = currentPage; + this.currentCount = currentCount; + this.totalRecord = totalRecord; + this.totalPage = totalPage; + this.list = list; + this.offset = offset; + } + + public PageVo_xuan() { + } + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public int getCurrentCount() { + return currentCount; + } + + public void setCurrentCount(int currentCount) { + this.currentCount = currentCount; + } + + public int getTotalRecord() { + return totalRecord; + } + + public void setTotalRecord(int totalRecord) { + this.totalRecord = totalRecord; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +// public int getOffset() { +// return offset; +// } + + public void setOffset(int offset) { + this.offset = offset; + } + + @Override + public String toString() { + return "PageVo_xuan{" + + "currentPage=" + currentPage + + ", currentCount=" + currentCount + + ", totalRecord=" + totalRecord + + ", totalPage=" + totalPage + + ", list=" + list + + ", offset=" + offset + + '}'; + } +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/ResultVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/ResultVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c1212afda465e875fbe489c52c62b972063162a9 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/ResultVo.java @@ -0,0 +1,98 @@ +package com.example.meetingroom.vo; + +import java.util.HashMap; +import java.util.Map; + +/** + * @function: 统一返回结果类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class ResultVo { + + //操作是否成功 + private Boolean success; + + //返回码 + private int code; + + //返回消息 + private String message; + + //返回数据 + private Map data = new HashMap<>(); + + public ResultVo() { + } + + public ResultVo(Boolean success, int code, String message, Map data) { + this.success = success; + this.code = code; + this.message = message; + this.data = data; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } + + /** + * 返回成功结果 + * @param code 返回码 + * @param message 返回消息 + * @param data 返回数据 + * @return 返回的一个结果集合 + */ + public static ResultVo ok(int code, String message, Map data){ + return new ResultVo(true, code, message, data); + } + + @Override + public String toString() { + return "ResultVo{" + + "success=" + success + + ", code=" + code + + ", message='" + message + '\'' + + ", data=" + data + + '}'; + } + + /** + * 返回失败结果 + * @param code 返回码 + * @param message 返回消息 + * @param data 返回数据 + * @return 返回的一个结果集合 + */ + public static ResultVo error(int code, String message, Map data){ + return new ResultVo(false, code, message, data); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomInfoVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..937616de1c1a4be7dc057f54a7fe466cb338b5cd --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomInfoVo.java @@ -0,0 +1,72 @@ +package com.example.meetingroom.vo; + + +/** + * @function: 定义dao层中的RoomOrderDao的getAllRoomInfo()方法的返回值类型 + * @author:ljh + * @time: 2021-9-9 20:17:20 + */ +public class RoomInfoVo { + + private String name; + + private String type; + + private int num; + + private String equipment; + + private String address; + + public RoomInfoVo(){ + + } + + public RoomInfoVo(String name, String type, int num, String equipment, String address) { + this.name = name; + this.type = type; + this.num = num; + this.equipment = equipment; + this.address = address; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getNum() { + return num; + } + + public void setNum(int num) { + this.num = num; + } + + public String getEquipment() { + return equipment; + } + + public void setEquipment(String equipment) { + this.equipment = equipment; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderAuditVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderAuditVo.java new file mode 100644 index 0000000000000000000000000000000000000000..219e8f569b2c4e7f58327b00f165515648bfd407 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderAuditVo.java @@ -0,0 +1,138 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: 对应审批预定页面的VO对象 + * @date 2021/9/8 20:24 + */ +public class RoomOrderAuditVo { + + //ID + private String id; + + //会议室名称 + private String roomName; + + //会议时间 + private String time; + + //申请人 + private String applicant; + + //联系电话 + private String phone; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUse; + + //审批意见 + private String opinion; + + //用不到的属性,但和RoomOrderVo用的同一个sql片段 所以。。得有个属性给他赋值 + private String roomOrderStatus; + + //预定详情 + private RoomOrderDetailsVo roomOrderDetails; + + + public RoomOrderAuditVo(String id, String roomName, String time, String applicant, String phone, String subject, int isUse, String opinion, RoomOrderDetailsVo roomOrderDetails) { + this.id = id; + this.roomName = roomName; + this.time = time; + this.applicant = applicant; + this.phone = phone; + this.subject = subject; + this.isUse = isUse; + this.opinion = opinion; + this.roomOrderDetails = roomOrderDetails; + } + + public RoomOrderAuditVo(){ + } + + + public String getOpinion() { + return opinion; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public void setOpinion(String opinion) { + this.opinion = opinion; + } + + public String getRoomName() { + return roomName; + } + + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public int getIsUse() { + return isUse; + } + + public void setIsUse(int isUse) { + this.isUse = isUse; + } + + public RoomOrderDetailsVo getRoomOrderDetails() { + return roomOrderDetails; + } + + public String getRoomOrderStatus() { + return roomOrderStatus; + } + + public void setRoomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } + + public void setRoomOrderDetails(RoomOrderDetailsVo roomOrderDetails) { + this.roomOrderDetails = roomOrderDetails; + } + + +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderDetailsVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderDetailsVo.java new file mode 100644 index 0000000000000000000000000000000000000000..68c16c4cb1eaf619d7383f6890b0250fa551e997 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderDetailsVo.java @@ -0,0 +1,148 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: 对应预订详情页面的VO对象 + * @date 2021/9/8 20:35 + */ +//因为RoomInfo所有的属性都是详情对象共有的 +public class RoomOrderDetailsVo { + + //申请人 + private String applicant; + + //联系电话 + private String phone; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUse; + + //参与会议员工 + private String employeeList; + + //会议室信息表id + private String id; + + //会议室名称 + private String name; + + //会议室类型 + private String type; + + //最大可容纳人数 + private int num; + + //设备 + private String equipment; + + //位置 + private String address; + + public RoomOrderDetailsVo(String applicant, String phone, String subject, int isUse, String employeeList, String id, String name, String type, int num, String equipment, String address) { + this.applicant = applicant; + this.phone = phone; + this.subject = subject; + this.isUse = isUse; + this.employeeList = employeeList; + this.id = id; + this.name = name; + this.type = type; + this.num = num; + this.equipment = equipment; + this.address = address; + } + + public RoomOrderDetailsVo() { + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public int getIsUse() { + return isUse; + } + + public void setIsUse(int isUse) { + this.isUse = isUse; + } + + public String getEmployeeList() { + return employeeList; + } + + public void setEmployeeList(String employeeList) { + this.employeeList = employeeList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getNum() { + return num; + } + + public void setNum(int num) { + this.num = num; + } + + public String getEquipment() { + return equipment; + } + + public void setEquipment(String equipment) { + this.equipment = equipment; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderListVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..d9944eb0e00425852deaa4fc6aab9b4e12e0f502 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderListVo.java @@ -0,0 +1,225 @@ +package com.example.meetingroom.vo; + +/** + * @author chen si ran + * @description: TODO + * @date 2021/9/8 20:24 + */ +public class RoomOrderListVo { + + //预约记录id + private String id; + + //会议室名称 + private String roomName; + + //会议时间 + private String time; + + //申请人 + private String applicant; + + //联系电话 + private String phone; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUse; + + //预定状态 + private String roomOrderStatus; + + //审批人 + private String operationPeopleName; + + //审批意见 + private String opinion; + + //参会人员名单 + private String employeeList; + + //会议室类型 + private String type; + + //最大可容纳人数 + private int num; + + //设备 + private String equipment; + + //位置 + private String address; + + /** + * @function: 无参构造 + * @param + * @return + */ + public RoomOrderListVo(){ + } + + /** + * @function: 有参构造 + * @param + * @return + */ + public RoomOrderListVo(String id, String roomName, String time, String applicant, String phone, String subject, int isUse, String roomOrderStatus, String operationPeopleName, String opinion, String employeeList, String type, int num, String equipment, String address) { + this.id = id; + this.roomName = roomName; + this.time = time; + this.applicant = applicant; + this.phone = phone; + this.subject = subject; + this.isUse = isUse; + this.roomOrderStatus = roomOrderStatus; + this.operationPeopleName = operationPeopleName; + this.opinion = opinion; + this.employeeList = employeeList; + this.type = type; + this.num = num; + this.equipment = equipment; + this.address = address; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoomOrderStatus() { + return roomOrderStatus; + } + + public void setRoomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } + + public String getOperationPeopleName() { + return operationPeopleName; + } + + public void setOperationPeopleName(String operationPeopleName) { + this.operationPeopleName = operationPeopleName; + } + public String getRoomName() { + return roomName; + } + + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public int getIsUse() { + return isUse; + } + + public void setIsUse(int isUse) { + this.isUse = isUse; + } + + public String getOpinion() { + return opinion; + } + + public void setOpinion(String opinion) { + this.opinion = opinion; + } + + public String getEmployeeList() { + return employeeList; + } + + public void setEmployeeList(String employeeList) { + this.employeeList = employeeList; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getNum() { + return num; + } + + public void setNum(int num) { + this.num = num; + } + + public String getEquipment() { + return equipment; + } + + public void setEquipment(String equipment) { + this.equipment = equipment; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "RoomOrderVo{" + + "id='" + id + '\'' + + ", roomName='" + roomName + '\'' + + ", time='" + time + '\'' + + ", applicant='" + applicant + '\'' + + ", phone='" + phone + '\'' + + ", subject='" + subject + '\'' + + ", isUse=" + isUse + + ", roomOrderStatus='" + roomOrderStatus + '\'' + + ", operationPeopleName='" + operationPeopleName + '\'' + + ", opinion='" + opinion + '\'' + + ", employeeList='" + employeeList + '\'' + + ", type='" + type + '\'' + + ", num=" + num + + ", equipment='" + equipment + '\'' + + ", address='" + address + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderMessageVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderMessageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..251c16d782a23b730a1133b01e9b0d6b9ec4dcfc --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderMessageVo.java @@ -0,0 +1,126 @@ +package com.example.meetingroom.vo; + +/** + * @function: 存储“会议室预订”页面返回的数据信息 + * @author:ljh + * @time: 2021-9-11 15:29:20 + */ +public class RoomOrderMessageVo { + + private String room_id; + + private String subject; + + private String applicant; + + private String phone; + + private String year; + + private String month; + + private String day; + + private String startTime; + + private String endTime; + + private String employee_list; + + public RoomOrderMessageVo() { + } + + public RoomOrderMessageVo(String room_id, String subject, String applicant, String phone, String year, String month, String day, String startTime, String endTime, String employee_list) { + this.room_id = room_id; + this.subject = subject; + this.applicant = applicant; + this.phone = phone; + this.year = year; + this.month = month; + this.day = day; + this.startTime = startTime; + this.endTime = endTime; + this.employee_list = employee_list; + } + + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getMonth() { + return month; + } + + public void setMonth(String month) { + this.month = month; + } + + public String getDay() { + return day; + } + + public void setDay(String day) { + this.day = day; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getEmployee_list() { + return employee_list; + } + + public void setEmployee_list(String employee_list) { + this.employee_list = employee_list; + } + + public String getRoom_id() { + return room_id; + } + + public void setRoom_id(String room_id) { + this.room_id = room_id; + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderResultVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderResultVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b612da00d324181a0462c5491e4da902bd6a7d1b --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderResultVo.java @@ -0,0 +1,88 @@ +package com.example.meetingroom.vo; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @function: 会议室名称统一返回结果类 + * @author: + * @time: 2021-9-7 23:03:30 + */ +public class RoomOrderResultVo { + //操作是否成功 + private Boolean success; + + //返回码 + private int code; + + //返回消息 + private String message; + + //返回数据 + private Map> data = new HashMap<>(); + + public RoomOrderResultVo() { + } + + public RoomOrderResultVo(Boolean success, int code, String message, Map> data) { + this.success = success; + this.code = code; + this.message = message; + this.data = data; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Map> getData() { + return data; + } + + public void setData(Map> data) { + this.data = data; + } + + /** + * 返回成功结果 + * @param code 返回码 + * @param message 返回消息 + * @param data 返回数据 + * @return 返回的一个结果集合 + */ + public static RoomOrderResultVo ok(int code, String message, Map> data){ + return new RoomOrderResultVo(true, code, message, data); + } + + /** + * 返回失败结果 + * @param code 返回码 + * @param message 返回消息 + * @param data 返回数据 + * @return 返回的一个结果集合 + */ + public static RoomOrderResultVo error(int code, String message, Map> data){ + return new RoomOrderResultVo(false, code, message, data); + } +} diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderUserVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderUserVo.java new file mode 100644 index 0000000000000000000000000000000000000000..a520946cebd5abdeef69f407930d2e31938add41 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderUserVo.java @@ -0,0 +1,128 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: TODO + * @date 2021/9/8 20:24 + */ +public class RoomOrderUserVo { + + //预约记录id + private String id; + + //会议室名称 + private String roomName; + + //会议时间 + private String time; + + //申请人 + private String applicant; + + //联系电话 + private String phone; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUse; + + //申请状态 + private String roomOrderStatus; + + //预定详情 + private RoomOrderDetailsVo roomOrderDetails; + + + + + public RoomOrderUserVo(String id, String roomName, String time, String applicant, String phone, String subject, int isUse, String roomOrderStatus, RoomOrderDetailsVo roomOrderDetails) { + this.id = id; + this.roomName = roomName; + this.time = time; + this.applicant = applicant; + this.phone = phone; + this.subject = subject; + this.isUse = isUse; + this.roomOrderStatus = roomOrderStatus; + this.roomOrderDetails = roomOrderDetails; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoomOrderStatus() { + return roomOrderStatus; + } + + public void setRoomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } + + public RoomOrderUserVo(){ + } + + public String getRoomName() { + return roomName; + } + + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public int getIsUse() { + return isUse; + } + + public void setIsUse(int isUse) { + this.isUse = isUse; + } + + public RoomOrderDetailsVo getRoomOrderDetails() { + return roomOrderDetails; + } + + public void setRoomOrderDetails(RoomOrderDetailsVo roomOrderDetails) { + this.roomOrderDetails = roomOrderDetails; + } + + +} \ No newline at end of file diff --git a/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderVo.java b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderVo.java new file mode 100644 index 0000000000000000000000000000000000000000..5324fb41a56abaabb77bb6f6f88f4898762212b5 --- /dev/null +++ b/meeting2/src/main/java/com/example/meetingroom/vo/RoomOrderVo.java @@ -0,0 +1,150 @@ +package com.example.meetingroom.vo; + +/** + * @author feng + * @description: TODO + * @date 2021/9/8 20:24 + */ +public class RoomOrderVo { + + //预约记录id + private String id; + + //会议室名称 + private String roomName; + + //会议时间 + private String time; + + //申请人 + private String applicant; + + //联系电话 + private String phone; + + //会议主题 + private String subject; + + //是否使用设备 + private int isUse; + + //申请状态 + private String roomOrderStatus; + + //审批人 + private String operationPeopleName; + + //逻辑删除 + private Integer deleted; + + //预定详情 + private RoomOrderDetailsVo roomOrderDetails; + + + public RoomOrderVo(String id, String roomName, String time, String applicant, String phone, String subject, int isUse, String roomOrderStatus, String operationPeopleName, Integer deleted, RoomOrderDetailsVo roomOrderDetails) { + this.id = id; + this.roomName = roomName; + this.time = time; + this.applicant = applicant; + this.phone = phone; + this.subject = subject; + this.isUse = isUse; + this.roomOrderStatus = roomOrderStatus; + this.operationPeopleName = operationPeopleName; + this.deleted = deleted; + this.roomOrderDetails = roomOrderDetails; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoomOrderStatus() { + return roomOrderStatus; + } + + public void setRoomOrderStatus(String roomOrderStatus) { + this.roomOrderStatus = roomOrderStatus; + } + + public String getOperationPeopleName() { + return operationPeopleName; + } + + public void setOperationPeopleName(String operationPeopleName) { + this.operationPeopleName = operationPeopleName; + } + + public RoomOrderVo(){ + } + + public String getRoomName() { + return roomName; + } + + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getApplicant() { + return applicant; + } + + public void setApplicant(String applicant) { + this.applicant = applicant; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public int getIsUse() { + return isUse; + } + + public void setIsUse(int isUse) { + this.isUse = isUse; + } + + public Integer getDeleted() { + return deleted; + } + + public void setDeleted(Integer deleted) { + this.deleted = deleted; + } + + public RoomOrderDetailsVo getRoomOrderDetails() { + return roomOrderDetails; + } + + public void setRoomOrderDetails(RoomOrderDetailsVo roomOrderDetails) { + this.roomOrderDetails = roomOrderDetails; + } + + +} \ No newline at end of file diff --git a/meeting2/src/main/resources/application.yaml b/meeting2/src/main/resources/application.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8f608afa809ef30859b9ebadb23b9ccdfd99e971 --- /dev/null +++ b/meeting2/src/main/resources/application.yaml @@ -0,0 +1,41 @@ +server: + port: 8081 + +spring: + #mysql数据源配置 + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/meeting_room?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + username: root + password: chenzikang + +mybatis: + mapper-locations: classpath*:mapper/*.xml + configuration: + map-underscore-to-camel-case: true + type-aliases-package: com.example.meetingroom.dao + +logging: + level: + com: + example: + meetingroom: + dao: + DEBUG + +#腾讯短信发送 +sendMessage: + accessKeyId: "AKIDrUt00lBWt40g6TqU7pI1WkTyC8SWd6XQ " + accessSecret: "qBCSSCfwDE3b0C4fz1xDgsnRovmNnxyN" + sdkAppId: "1400503015" + templateCodePass: "1113098" + templateCodeNotPass: "1113009" + signName: "江岸摆渡" + +#阿里云对象存储 +sendOss: + ENDPOINT: "oss-cn-shenzhen.aliyuncs.com" # 外网访问地址 + ACCESSKEYID: "LTAI4G92xKXsNh8UtbFyNCZw" + ACCESSKEYSECERT: "6UrL5dApnI76kqvuTFRWLUxBNN0nwQ" + BUCKETNAME: "chensiran" # 仓库名称 + SUFFER_URL: "http://chensiran.oss-cn-shenzhen.aliyuncs.com/" # 上传成功后返回的URL \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/DepartMapper.xml b/meeting2/src/main/resources/mapper/DepartMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..342aebf4477df1e4825be4f17790fccc53cc45e5 --- /dev/null +++ b/meeting2/src/main/resources/mapper/DepartMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + select REPLACE(UUID(),'-','') + + insert into meeting_room.depart (id, name) values (#{id},#{name}); + + + + + update meeting_room.depart + set depart.name = #{name} + where depart.id = #{id}; + + + + + delete from meeting_room.depart + where id = #{id}; + + + + + + + + + \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/EmployeeInfoMapper.xml b/meeting2/src/main/resources/mapper/EmployeeInfoMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..de7a26aad754cc4247e35cc982d8038f40366195 --- /dev/null +++ b/meeting2/src/main/resources/mapper/EmployeeInfoMapper.xml @@ -0,0 +1,140 @@ + + + + + + + select replace(UUID(),'-','') + + + insert into meeting_room.employee_info(id, role_id, depart_id, name, phone, password, sex) + values (#{id},#{roleId},#{departId},#{name},#{phone},#{password},#{sex}); + + + + + + INSERT INTO + employee_info + (id,role_id,depart_id,name,phone,password,sex) + VALUES + + (REPLACE(UUID(),'-',''),#{item.roleId},#{item.departId},#{item.name},#{item.phone},MD5(#{item.password}),#{item.sex}) + + + + + + + update meeting_room.employee_info + set employee_info.name = #{e.name}, + + employee_info.password = #{e.password}, + employee_info.role_id = #{e.roleId}, + + employee_info.sex = #{e.sex}, + employee_info.phone = #{e.phone}, + employee_info.depart_id = #{e.departId} + where employee_info.id = #{e.id} + and employee_info.role_id != "3"; + + + + + + delete from meeting_room.employee_info + where id = #{id} + and employee_info.role_id != "3"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update employee_info set password = #{param2} + where phone = #{param1} + + \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/EmployeeRegisterMapper.xml b/meeting2/src/main/resources/mapper/EmployeeRegisterMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3bc87ad40f1efccf5325db0a45b139ba4b888e3a --- /dev/null +++ b/meeting2/src/main/resources/mapper/EmployeeRegisterMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + select replace(UUID(),'-','') + + + insert into meeting_room.employee_info(id, role_id, depart_id, name,phone, password) + values (#{id},"1",#{departId},#{name},#{phone},#{password}); + + + + update meeting_room.employee_register + set employee_register.employee_register_status = #{employeeRegisterStatus}, + employee_register.opinion = #{opinion}, + employee_register.admin_name = #{adminName} + where employee_register.id = #{id}; + + + + + + delete from meeting_room.employee_register + where id = #{id}; + + + + + delete from meeting_room.employee_info + where phone = #{phone} and role_id != "3" + + + + + + + + + + + + + + + + + + + + select REPLACE(UUID(),'-','') + + insert into employee_register(id,name,sex,phone,password,depart_id,employee_register_status) + values(#{id},#{name},#{sex},#{phone},#{password},#{departId},#{employeeRegisterStatus}); + + + + + + \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/RoleMapper.xml b/meeting2/src/main/resources/mapper/RoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..1b315fd86d05b154a6aaf708daa4dc09b66ab1ce --- /dev/null +++ b/meeting2/src/main/resources/mapper/RoleMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/RoomInfoMapper.xml b/meeting2/src/main/resources/mapper/RoomInfoMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9c97dbd492640679417e48e122dc3342b105776 --- /dev/null +++ b/meeting2/src/main/resources/mapper/RoomInfoMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + select replace(UUID(),'-','') + + + insert into meeting_room.room_info(id,name, type, num, equipment, address) + values (#{id},#{name},#{type},#{num},#{equipment},#{address}); + + + + + update meeting_room.room_info + set room_info.name = #{name}, + room_info.type = #{type}, + room_info.num = #{num}, + room_info.equipment = #{equipment}, + room_info.address = #{address} + where room_info.id = #{id}; + + + + + delete from meeting_room.room_info + where id = #{id}; + + + + + + + + + + \ No newline at end of file diff --git a/meeting2/src/main/resources/mapper/RoomOrderMapper.xml b/meeting2/src/main/resources/mapper/RoomOrderMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5cd18feda00d15fd9406cc19ad41709c1dc0ffc --- /dev/null +++ b/meeting2/src/main/resources/mapper/RoomOrderMapper.xml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.id o_id, + Concat(date_format( o.start_time, '%Y/%m/%d %H:%i' ),"-",HOUR ( o.end_time ),":", MINUTE ( o.end_time )) o_time, + o.SUBJECT o_subject, + o.is_use o_isUse, + o.room_order_status o_status, + o.phone o_phone, + o.employee_list o_list, + o.opinion o_opinion, + o.deleted o_deleted, + o.applicant o_applicant, + o.operation_people_id o_operation_people_id, + i.id i_id, + i.type i_type, + i.NAME i_name, + i.equipment i_equipment, + i.address i_address, + i.num i_num, + (select name from employee_info where id = o.operation_people_id) e_name + FROM + room_info i + + + + + + + + + + + + + + + + + + + update room_order set + room_id = (select id from room_info where name = #{order.roomName}) , + start_time = #{startTime}, + end_time = #{endTime}, + phone = #{order.phone}, + subject = #{order.subject}, + is_use = #{order.isUse}, + employee_list = #{order.roomOrderDetails.employeeList} + where id = #{orderId} + + + + + update room_order set + room_order_status = "已通过" + room_order_status = "未通过" + , + operation_people_id = #{auditVo.operationPeopleId}, + opinion = #{auditVo.opinion} + where id=#{auditVo.orderId} + + + + + update room_order set + deleted = 0 + where id = #{orderId} + + + + + + + + + + + + + + + select REPLACE(UUID(),'-','') + + insert into + room_order(id,room_id,employee_info_id,subject,is_use,applicant,phone,employee_list,start_time,end_time,room_order_status,deleted) + values + (#{id},#{room_id},#{employee_info_id},#{subject},#{is_use},#{applicant},#{phone},#{employee_list},#{start_time},#{end_time},#{room_order_status},#{deleted}) + + + + \ No newline at end of file diff --git a/meeting2/src/test/java/com/example/meetingroom/MeetingroomApplicationTests.java b/meeting2/src/test/java/com/example/meetingroom/MeetingroomApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..ec097a92eb5baae4abffc092ec385e365452035a --- /dev/null +++ b/meeting2/src/test/java/com/example/meetingroom/MeetingroomApplicationTests.java @@ -0,0 +1,69 @@ +package com.example.meetingroom; + +import com.example.meetingroom.dao.*; +import com.example.meetingroom.entity.EmployeeInfo; +import com.example.meetingroom.entity.EmployeeRegister; +import com.example.meetingroom.service.RoleService; +import com.example.meetingroom.service.impl.EmployeeRegisterServiceImpl; +import com.example.meetingroom.vo.EmployeeInfoVo; +import com.example.meetingroom.vo.PageVo_xuan; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.domain.Page; + +import java.util.List; + + +@SpringBootTest +class MeetingroomApplicationTests { + + @Autowired + private EmployeeInfoDao employeeInfoDao; + + @Autowired + private EmployeeRegisterDao employeeRegisterDao; + + @Autowired + private EmployeeRegisterServiceImpl employeeRegisterService; + + @Autowired + private RoleService roleService; + + @Test + void contextLoads() { + System.out.println(employeeInfoDao.deleteEmployeeInfo("001")); + + /*PageVo_xuan page = new PageVo_xuan(); + page.setCurrentPage(1); + page.setCurrentCount(30); + + List voList = employeeInfoDao.selectEmployeeInfoVoPageCommon(page); + for (EmployeeInfoVo employeeInfoVo : voList) { + System.out.println(employeeInfoVo.toString()); + }*/ + } + + @Test + void test(){ + System.out.println(employeeRegisterService.selectEmployeeInfoPasswode("11611171118")); + } + + +// @Test +// public void test1(){ +// PageVo_xuan employeeInfoVoPageVo_xuan = new PageVo_xuan<>(); +// employeeInfoVoPageVo_xuan.getTotalRecord(); +// System.out.println(employeeInfoDao.selectEmployeeInfoVoPageCommon(employeeInfoVoPageVo_xuan,0)); +// +// +// } + + @Test + public void test01(){ + + } + + + +}