├── .gitignore ├── README.md ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── cc │ │ │ ├── ManageBackendApplication.java │ │ │ ├── config │ │ │ ├── mvc │ │ │ │ └── WebMvcConfig.java │ │ │ ├── mybatis │ │ │ │ └── MyBatisPlusConfig.java │ │ │ └── security │ │ │ │ ├── SpringSecurityConfig.java │ │ │ │ ├── exception │ │ │ │ └── CustomerAuthenionException.java │ │ │ │ ├── filter │ │ │ │ └── CheckTokenFilter.java │ │ │ │ ├── handler │ │ │ │ ├── CustomAccessDeineHandler.java │ │ │ │ └── LoginFailureHandler.java │ │ │ │ └── service │ │ │ │ └── CustomUserDetailService.java │ │ │ ├── controller │ │ │ ├── BuildingController.java │ │ │ ├── CommunityInfoController.java │ │ │ ├── ComplaintController.java │ │ │ ├── ElectricController.java │ │ │ ├── FacilitiesController.java │ │ │ ├── HouseController.java │ │ │ ├── LiverController.java │ │ │ ├── MenuController.java │ │ │ ├── NoticeController.java │ │ │ ├── ParkController.java │ │ │ ├── ParkingController.java │ │ │ ├── RecordsController.java │ │ │ ├── RepairController.java │ │ │ ├── ReportController.java │ │ │ ├── RoleController.java │ │ │ ├── UnitController.java │ │ │ ├── UserController.java │ │ │ ├── WaterController.java │ │ │ └── WorkerController.java │ │ │ ├── domain │ │ │ ├── parm │ │ │ │ ├── AssignHouseParm.java │ │ │ │ ├── BuildingParm.java │ │ │ │ ├── ComplaintParm.java │ │ │ │ ├── ElectricParm.java │ │ │ │ ├── FacilitiesParm.java │ │ │ │ ├── HouseParm.java │ │ │ │ ├── IndexNoticeParm.java │ │ │ │ ├── LiverElectricParm.java │ │ │ │ ├── LiverParkParm.java │ │ │ │ ├── LiverParm.java │ │ │ │ ├── LiverWaterParm.java │ │ │ │ ├── LoginParm.java │ │ │ │ ├── NoticeParm.java │ │ │ │ ├── ParkParm.java │ │ │ │ ├── ParkingParm.java │ │ │ │ ├── RepairParm.java │ │ │ │ ├── ResetPassParm.java │ │ │ │ ├── RoleAssignParm.java │ │ │ │ ├── RoleParm.java │ │ │ │ ├── RolePermissionParm.java │ │ │ │ ├── UnitParm.java │ │ │ │ ├── UserParm.java │ │ │ │ └── WaterParm.java │ │ │ ├── pojo │ │ │ │ ├── Building.java │ │ │ │ ├── ChangePassword.java │ │ │ │ ├── CommunityInfo.java │ │ │ │ ├── Complaint.java │ │ │ │ ├── Electric.java │ │ │ │ ├── Facilities.java │ │ │ │ ├── House.java │ │ │ │ ├── Liver.java │ │ │ │ ├── LiverAndHouse.java │ │ │ │ ├── LiverAndParking.java │ │ │ │ ├── LiverAndRole.java │ │ │ │ ├── Menu.java │ │ │ │ ├── Notice.java │ │ │ │ ├── Park.java │ │ │ │ ├── Parking.java │ │ │ │ ├── Repair.java │ │ │ │ ├── Role.java │ │ │ │ ├── RoleAndMenu.java │ │ │ │ ├── Unit.java │ │ │ │ ├── User.java │ │ │ │ ├── UserAndRole.java │ │ │ │ ├── UserInfo.java │ │ │ │ └── Water.java │ │ │ ├── status │ │ │ │ └── StatusCode.java │ │ │ └── vo │ │ │ │ ├── LoginResult.java │ │ │ │ ├── ResultVo.java │ │ │ │ ├── RolePermissionVo.java │ │ │ │ └── RouterVO.java │ │ │ ├── mapper │ │ │ ├── BuildingMapper.java │ │ │ ├── CommunityInfoMapper.java │ │ │ ├── ComplaintMapper.java │ │ │ ├── ElectricMapper.java │ │ │ ├── FacilitiesMapper.java │ │ │ ├── HouseMapper.java │ │ │ ├── LiverAndHouseMapper.java │ │ │ ├── LiverAndParkingMapper.java │ │ │ ├── LiverAndRoleMapper.java │ │ │ ├── LiverMapper.java │ │ │ ├── MenuMapper.java │ │ │ ├── NoticeMapper.java │ │ │ ├── ParkMapper.java │ │ │ ├── ParkingMapper.java │ │ │ ├── RepairMapper.java │ │ │ ├── RoleAndMenuMapper.java │ │ │ ├── RoleMapper.java │ │ │ ├── UnitMapper.java │ │ │ ├── UserAndRoleMapper.java │ │ │ ├── UserMapper.java │ │ │ ├── WaterMapper.java │ │ │ └── WorkerMapper.java │ │ │ ├── service │ │ │ ├── BuildingService.java │ │ │ ├── CommunityInfoService.java │ │ │ ├── ComplaintService.java │ │ │ ├── ElectricService.java │ │ │ ├── FacilitiesService.java │ │ │ ├── HouseService.java │ │ │ ├── LiverAndRoleService.java │ │ │ ├── LiverService.java │ │ │ ├── MenuService.java │ │ │ ├── NoticeService.java │ │ │ ├── ParkService.java │ │ │ ├── ParkingService.java │ │ │ ├── RepairService.java │ │ │ ├── RoleAndMenuService.java │ │ │ ├── RoleService.java │ │ │ ├── UnitService.java │ │ │ ├── UserAndRoleService.java │ │ │ ├── UserService.java │ │ │ ├── WaterService.java │ │ │ ├── WorkerService.java │ │ │ └── impl │ │ │ │ ├── BuildingServiceImpl.java │ │ │ │ ├── CommunityInfoServiceImpl.java │ │ │ │ ├── ComplaintServiceImpl.java │ │ │ │ ├── ElectricServiceImpl.java │ │ │ │ ├── FacilitiesServiceImpl.java │ │ │ │ ├── HouseServiceImpl.java │ │ │ │ ├── LiverAndRoleServiceImpl.java │ │ │ │ ├── LiverServiceImpl.java │ │ │ │ ├── MenuServiceImpl.java │ │ │ │ ├── NoticeServiceImpl.java │ │ │ │ ├── ParkServiceImpl.java │ │ │ │ ├── ParkingServiceImpl.java │ │ │ │ ├── RepairServiceImpl.java │ │ │ │ ├── RoleAndMenuServiceImpl.java │ │ │ │ ├── RoleServiceImpl.java │ │ │ │ ├── UnitServiceImpl.java │ │ │ │ ├── UserAndRoleServiceImpl.java │ │ │ │ ├── UserServiceImpl.java │ │ │ │ ├── WaterServiceImpl.java │ │ │ │ └── WorkerServiceImpl.java │ │ │ └── utils │ │ │ ├── DateUtils.java │ │ │ ├── JwtUtils.java │ │ │ ├── MyTreeUtils.java │ │ │ ├── ResultUtils.java │ │ │ ├── SMSUtils.java │ │ │ └── ValidateCodeUtils.java │ └── resources │ │ ├── META-INF │ │ └── additional-spring-configuration-metadata.json │ │ ├── application.yml │ │ ├── mapper │ │ ├── ComplaintMapper.xml │ │ ├── ElectricMapper.xml │ │ ├── HouseMapper.xml │ │ ├── LiverMapper.xml │ │ ├── MenuMapper.xml │ │ ├── NoticeMapper.xml │ │ ├── ParkMapper.xml │ │ ├── RepairMapper.xml │ │ ├── RoleAndMenuMapper.xml │ │ ├── UnitMapper.xml │ │ └── WaterMapper.xml │ │ └── system.sql └── test │ └── java │ └── com │ └── cc │ └── ManageBackendApplicationTests.java ├── 前台.png └── 后台.png /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 物业后台管理系统-后端 2 | 3 | ### 前端代码仓库链接 4 | [前端代码仓库](https://github.com/Pitayafruits/manage_front) 5 | 6 | ### 运行前配置 7 | 1. 在yml配置文件中修改自己的数据库配置 8 | 2. 在utils包下的SMSUtils下修改自己短信服务key 9 | 3. 数据库SQL文件在resources目录下 10 | 11 | ### 介绍 12 | 这是一款前后端分离的基于Spring Boot的物业管理系统,该系统实现了物业工作人员管理、业主管理、房屋管理、物业管理、人事管理、报修管理等主要功能。 13 | 14 | ### 软件架构 15 | * 核心框架:Spring Boot 2.3.7.RELEASE 16 | * 安全框架:Spring Security 5.3.6.RELEASE 17 | * 持久层框架:MyBatis-Plus 3.5.2 18 | * 关系型数据库: Mysql 5.7.35 19 | * 数据库连接池:Druid 1.2.11 20 | * 缓存数据库: Redis 4.0.9 21 | * 项目管理工具: Maven 3.8.4 22 | 23 | ### 界面展示 24 | 1. 前台页面展示 25 | 26 | ![](https://github.com/Pitayafruits/manage_backend/blob/master/%E5%89%8D%E5%8F%B0.png) 27 | 28 | 2. 后台页面展示 29 | 30 | ![](https://github.com/Pitayafruits/manage_backend/blob/master/%E5%90%8E%E5%8F%B0.png) 31 | 32 | ### 下一步工作 33 | * 在考虑把权限框架由Spring Security替换为更轻量的Sa-Token 34 | * 想把缴费管理改成定时任务那种批量自动生成账单的形式 35 | 36 | ### 感谢 37 | 感谢B站上那些分享无私技术的UP主,这个毕设项目对于我的提升主要在前端方面,在做它之前,自己还没有过独立完成前端项目的经验,而正是凭借B站上的那 38 | 些课程,也算磕磕绊绊地写出了自己满意的页面,这个项目也是给我的本科生涯画上了句号,希望自己的程序员生涯能够走得久一点吧! 39 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.cc 6 | manage_backend 7 | 0.0.1-SNAPSHOT 8 | manage_backend 9 | manage_backend 10 | 11 | 12 | 1.8 13 | UTF-8 14 | UTF-8 15 | 2.3.7.RELEASE 16 | 17 | 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | 31 | 32 | com.alibaba 33 | fastjson 34 | 2.0.19.graal 35 | 36 | 37 | 38 | 39 | org.projectlombok 40 | lombok 41 | true 42 | 43 | 44 | 45 | 46 | mysql 47 | mysql-connector-java 48 | runtime 49 | 50 | 51 | 52 | 53 | com.alibaba 54 | druid-spring-boot-starter 55 | 1.2.11 56 | 57 | 58 | 59 | 60 | com.baomidou 61 | mybatis-plus-boot-starter 62 | 3.5.2 63 | 64 | 65 | 66 | 67 | org.springframework.boot 68 | spring-boot-devtools 69 | runtime 70 | true 71 | 72 | 73 | 74 | 75 | io.jsonwebtoken 76 | jjwt 77 | 0.9.0 78 | 79 | 80 | 81 | 82 | org.springframework.boot 83 | spring-boot-starter-security 84 | 85 | 86 | 87 | 88 | com.tencentcloudapi 89 | tencentcloud-sdk-java 90 | 3.1.270 91 | 92 | 93 | 94 | 95 | org.springframework.boot 96 | spring-boot-starter-data-redis 97 | 98 | 99 | 100 | org.springframework.boot 101 | spring-boot-starter-test 102 | test 103 | 104 | 105 | org.junit.vintage 106 | junit-vintage-engine 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | org.springframework.boot 116 | spring-boot-dependencies 117 | ${spring-boot.version} 118 | pom 119 | import 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | org.apache.maven.plugins 128 | maven-compiler-plugin 129 | 3.8.1 130 | 131 | 1.8 132 | 1.8 133 | UTF-8 134 | 135 | 136 | 137 | org.springframework.boot 138 | spring-boot-maven-plugin 139 | 2.3.7.RELEASE 140 | 141 | com.cc.ManageBackendApplication 142 | 143 | 144 | 145 | repackage 146 | 147 | repackage 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /src/main/java/com/cc/ManageBackendApplication.java: -------------------------------------------------------------------------------- 1 | package com.cc; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ManageBackendApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ManageBackendApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/cc/config/mvc/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.mvc; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | @Configuration 8 | public class WebMvcConfig implements WebMvcConfigurer { 9 | /** 10 | * 跨域配置 11 | */ 12 | @Override 13 | public void addCorsMappings(CorsRegistry registry) { 14 | registry.addMapping("/**") 15 | .allowCredentials(true) 16 | .allowedOrigins("*") 17 | .allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"}) 18 | .allowedHeaders("*") 19 | .exposedHeaders("*"); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/config/mybatis/MyBatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.mybatis; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 6 | import org.mybatis.spring.annotation.MapperScan; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | * mybatis-plus配置类 12 | */ 13 | @Configuration 14 | @MapperScan("com.cc.mapper") 15 | public class MyBatisPlusConfig { 16 | 17 | //分页插件 18 | @Bean 19 | public MybatisPlusInterceptor mybatisPlusInterceptor(){ 20 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 21 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); 22 | return interceptor; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/SpringSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security; 2 | 3 | import com.cc.config.security.filter.CheckTokenFilter; 4 | import com.cc.config.security.handler.CustomAccessDeineHandler; 5 | import com.cc.config.security.handler.LoginFailureHandler; 6 | import com.cc.config.security.service.CustomUserDetailService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.security.authentication.AuthenticationManager; 11 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 12 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 13 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 14 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 15 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 16 | import org.springframework.security.config.http.SessionCreationPolicy; 17 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 18 | import org.springframework.security.crypto.password.PasswordEncoder; 19 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 20 | 21 | /** 22 | * SpringSecurity配置类 23 | */ 24 | 25 | @Configuration 26 | @EnableWebSecurity //启用spring security 27 | @EnableGlobalMethodSecurity(prePostEnabled = true) //启用spring security注解 28 | public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { 29 | 30 | @Autowired 31 | private CustomUserDetailService customUserDetailService; 32 | 33 | @Autowired 34 | private LoginFailureHandler loginFailureHandler; 35 | 36 | @Autowired 37 | private CustomAccessDeineHandler customAccessDeineHandler; 38 | 39 | @Autowired 40 | private CheckTokenFilter checkTokenFilter; 41 | 42 | @Bean 43 | public PasswordEncoder passwordEncoder(){ 44 | return new BCryptPasswordEncoder(); 45 | } 46 | 47 | //配置方法 48 | @Override 49 | protected void configure(HttpSecurity http) throws Exception { 50 | //解决跨域问题 51 | http.cors().and().headers().frameOptions().disable(); 52 | http.addFilterBefore(checkTokenFilter, UsernamePasswordAuthenticationFilter.class); 53 | //关闭跨域请求伪造 54 | http.csrf().disable() 55 | //基于token,所以不需要session 56 | .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) 57 | .and() 58 | //放行首页不需要认证的请求 59 | .authorizeRequests() 60 | .antMatchers("/user/login","/community/comminfo","/worker/workerList","/notice/getNoticeList","/facilities/getFacList","/liver/sendMsg","/liver/resetPassword").permitAll() 61 | .anyRequest().authenticated() 62 | .and().exceptionHandling().authenticationEntryPoint(loginFailureHandler).accessDeniedHandler(customAccessDeineHandler); 63 | } 64 | 65 | //注入AuthenticationManager 66 | @Bean 67 | @Override 68 | public AuthenticationManager authenticationManagerBean() throws Exception { 69 | return super.authenticationManagerBean(); 70 | } 71 | 72 | 73 | //配置自定义的UserDetailService 74 | @Override 75 | protected void configure(AuthenticationManagerBuilder auth) throws Exception{ 76 | auth.userDetailsService(customUserDetailService); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/exception/CustomerAuthenionException.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security.exception; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * 自定义异常 7 | */ 8 | public class CustomerAuthenionException extends AuthenticationException { 9 | public CustomerAuthenionException(String msg) { 10 | super(msg); 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/filter/CheckTokenFilter.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security.filter; 2 | 3 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 4 | import com.cc.config.security.exception.CustomerAuthenionException; 5 | import com.cc.config.security.handler.LoginFailureHandler; 6 | import com.cc.config.security.service.CustomUserDetailService; 7 | import com.cc.utils.JwtUtils; 8 | import io.jsonwebtoken.Claims; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Value; 11 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 12 | import org.springframework.security.core.AuthenticationException; 13 | import org.springframework.security.core.context.SecurityContextHolder; 14 | import org.springframework.security.core.userdetails.UserDetails; 15 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; 16 | import org.springframework.stereotype.Component; 17 | import org.springframework.web.filter.OncePerRequestFilter; 18 | 19 | import javax.servlet.FilterChain; 20 | import javax.servlet.ServletException; 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpServletResponse; 23 | import java.io.IOException; 24 | 25 | /** 26 | * token验证过滤器 27 | */ 28 | @Component("checkTokenFilter") 29 | public class CheckTokenFilter extends OncePerRequestFilter { 30 | 31 | //重置密码地址 32 | @Value("${cc.resetPassUrl}") 33 | private String resetPassUrl; 34 | 35 | //发送短信地址 36 | @Value("${cc.sendMsgUrl}") 37 | private String sendMsgUrl; 38 | 39 | //首页设施列表 40 | @Value("${cc.facListUrl}") 41 | private String facListUrl; 42 | 43 | //登录请求的地址 44 | @Value("${cc.loginUrl}") 45 | private String loginUrl; 46 | 47 | //首页小区信息的地址 48 | @Value("${cc.commInfoUrl}") 49 | private String commInfoUrl; 50 | 51 | //工作人员列表信息的地址 52 | @Value("${cc.workerListUrl}") 53 | private String workerListUrl; 54 | 55 | //公告列表的地址 56 | @Value("${cc.noticeListUrl}") 57 | private String noticeListUrl; 58 | 59 | @Autowired 60 | private JwtUtils jwtUtils; 61 | 62 | @Autowired 63 | private CustomUserDetailService customUserDetailService; 64 | 65 | @Autowired 66 | private LoginFailureHandler loginFailureHandler; 67 | 68 | @Override 69 | protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { 70 | try{ 71 | //获取当前请求的地址 72 | String url = httpServletRequest.getRequestURI(); 73 | //不需要token验证的请求 74 | //登录请求 小区基本信息请求 75 | if(!url.equals(loginUrl) && (!url.equals(commInfoUrl)) && (!url.equals(workerListUrl)) && (!url.equals(noticeListUrl)) && (!url.equals(facListUrl)) && (!url.equals(sendMsgUrl)) && (!url.equals(resetPassUrl))){ 76 | //非登录做token验证 77 | tokenValidate(httpServletRequest); 78 | } 79 | }catch (AuthenticationException e){ 80 | loginFailureHandler.commence(httpServletRequest,httpServletResponse,e); 81 | return; 82 | } 83 | filterChain.doFilter(httpServletRequest,httpServletResponse); 84 | } 85 | 86 | //token验证 87 | private void tokenValidate(HttpServletRequest httpServletRequest){ 88 | //获取token 89 | String token = httpServletRequest.getHeader("token"); 90 | if(StringUtils.isEmpty(token)){ 91 | token = httpServletRequest.getParameter("token"); 92 | } 93 | if(StringUtils.isEmpty(token)){ 94 | throw new CustomerAuthenionException("未获取到token!"); 95 | } 96 | //token获取到则解析 97 | String username = jwtUtils.getUsernameFromToken(token); 98 | if(StringUtils.isEmpty(username)){ 99 | throw new CustomerAuthenionException("登录已过期,请重新登录!"); 100 | } 101 | //获取用户类型 102 | Claims claims = jwtUtils.getClaimsFromToken(token); 103 | String userType = (String) claims.get("userType"); 104 | //查询用户信息,交给Spring Security 105 | UserDetails details = customUserDetailService.loadUserByUsername(username + ":" + userType); 106 | UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(details,null, details.getAuthorities()); 107 | authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpServletRequest)); 108 | //设置上下文 109 | SecurityContextHolder.getContext().setAuthentication(authenticationToken); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/handler/CustomAccessDeineHandler.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security.handler; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.alibaba.fastjson.serializer.SerializerFeature; 5 | import com.cc.domain.vo.ResultVo; 6 | import org.springframework.security.access.AccessDeniedException; 7 | import org.springframework.security.web.access.AccessDeniedHandler; 8 | import org.springframework.stereotype.Component; 9 | 10 | import javax.servlet.ServletException; 11 | import javax.servlet.ServletOutputStream; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | 16 | /** 17 | * 无权限访问 18 | */ 19 | @Component("customAccessDeineHandler") 20 | public class CustomAccessDeineHandler implements AccessDeniedHandler { 21 | @Override 22 | public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException { 23 | String res = JSONObject.toJSONString(new ResultVo(700,"无权限访问,请联系管理员!",null), SerializerFeature.DisableCircularReferenceDetect); 24 | //设置返回格式 25 | httpServletResponse.setContentType("application/json;charset=UTF-8"); 26 | ServletOutputStream out = httpServletResponse.getOutputStream(); 27 | out.write(res.getBytes("UTF-8")); 28 | out.flush(); 29 | out.close(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/handler/LoginFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security.handler; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.alibaba.fastjson.serializer.SerializerFeature; 5 | import com.cc.config.security.exception.CustomerAuthenionException; 6 | import com.cc.domain.vo.ResultVo; 7 | import org.springframework.security.authentication.*; 8 | import org.springframework.security.core.AuthenticationException; 9 | import org.springframework.security.web.AuthenticationEntryPoint; 10 | import org.springframework.stereotype.Component; 11 | 12 | import javax.servlet.ServletException; 13 | import javax.servlet.ServletOutputStream; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | 18 | /** 19 | * 认证失败处理器 20 | * 目的:返回JSON格式数据 21 | */ 22 | 23 | @Component("loginFailureHandler") 24 | public class LoginFailureHandler implements AuthenticationEntryPoint { 25 | @Override 26 | public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException { 27 | int code = 500; 28 | String str = ""; 29 | if(e instanceof AccountExpiredException){ 30 | str = "账户过期,登录失败!"; 31 | }else if(e instanceof BadCredentialsException){ 32 | str = "用户名或密码错误,登录失败!"; 33 | }else if(e instanceof CredentialsExpiredException){ 34 | str = "密码过期,登录失败!"; 35 | }else if(e instanceof DisabledException){ 36 | str = "账户被禁用,登录失败!"; 37 | }else if(e instanceof LockedException){ 38 | str = "账户被锁,登录失败!"; 39 | }else if(e instanceof InternalAuthenticationServiceException){ 40 | str = "账户不存在,登录失败!"; 41 | }else if(e instanceof CustomerAuthenionException){ 42 | code = 600; 43 | str = e.getMessage(); 44 | }else if(e instanceof InsufficientAuthenticationException){ 45 | str = "无权限访问资源!"; 46 | } 47 | else{ 48 | str = "登录失败!"; 49 | } 50 | String res = JSONObject.toJSONString(new ResultVo(code,str,null), SerializerFeature.DisableCircularReferenceDetect); 51 | //设置返回格式 52 | httpServletResponse.setContentType("application/json;charset=UTF-8"); 53 | ServletOutputStream out = httpServletResponse.getOutputStream(); 54 | out.write(res.getBytes("UTF-8")); 55 | out.flush(); 56 | out.close(); 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/config/security/service/CustomUserDetailService.java: -------------------------------------------------------------------------------- 1 | package com.cc.config.security.service; 2 | 3 | import com.cc.domain.pojo.Liver; 4 | import com.cc.domain.pojo.Menu; 5 | import com.cc.domain.pojo.User; 6 | import com.cc.service.LiverService; 7 | import com.cc.service.MenuService; 8 | import com.cc.service.UserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.core.GrantedAuthority; 11 | import org.springframework.security.core.authority.AuthorityUtils; 12 | import org.springframework.security.core.userdetails.UserDetails; 13 | import org.springframework.security.core.userdetails.UserDetailsService; 14 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 15 | import org.springframework.stereotype.Component; 16 | 17 | import java.util.List; 18 | import java.util.stream.Collectors; 19 | 20 | /** 21 | * 自定义UserDetailService 22 | */ 23 | @Component("customUserDetailService") 24 | public class CustomUserDetailService implements UserDetailsService { 25 | 26 | @Autowired 27 | private UserService userService; 28 | 29 | @Autowired 30 | private LiverService liverService; 31 | 32 | @Autowired 33 | private MenuService menuService; 34 | 35 | @Override 36 | public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { 37 | //获取用户类型 0:业主 1:物业 38 | int index = s.indexOf(":"); 39 | //截取账号和用户类型 40 | String username = s.substring(0,index); 41 | String userType = s.substring(index + 1, s.length()); 42 | //根据用户类型查询不同表 43 | //UserDetails user = null; 44 | if(userType.equals("0")){ //业主 45 | Liver liver = liverService.loadUser(username); 46 | if(liver == null){ 47 | throw new UsernameNotFoundException("用户账号不存在!"); 48 | } 49 | //查询业主权限 50 | List liverMenuList = menuService.getMenuByLiverId(liver.getLiverId()); 51 | //获取权限字段 52 | List menuList = liverMenuList.stream() 53 | .filter(item -> item != null).map(item -> item.getMenuCode()) 54 | .filter(item -> item != null).collect(Collectors.toList()); 55 | //转数组 56 | String[] menuArray = menuList.toArray(new String[menuList.size()]); 57 | List authorityList = AuthorityUtils.createAuthorityList(menuArray); 58 | //设置物业权限 59 | liver.setAuthorities(authorityList); 60 | return liver; 61 | }else if(userType.equals("1")){ //物业 62 | User user = userService.loadUser(username); 63 | if(user == null){ 64 | throw new UsernameNotFoundException("用户账号不存在!"); 65 | } 66 | //查询物业权限 67 | List userMenuList = menuService.getMenuByUserId(user.getUserId()); 68 | //获取权限字段 69 | List menuList = userMenuList.stream() 70 | .filter(item -> item != null).map(item -> item.getMenuCode()) 71 | .filter(item -> item != null).collect(Collectors.toList()); 72 | //转数组 73 | String[] menuArray = menuList.toArray(new String[menuList.size()]); 74 | List authorityList = AuthorityUtils.createAuthorityList(menuArray); 75 | //设置物业权限 76 | user.setAuthorities(authorityList); 77 | return user; 78 | }else{ 79 | throw new UsernameNotFoundException("用户类型不存在!"); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/BuildingController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.Building; 5 | import com.cc.domain.parm.BuildingParm; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.BuildingService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 楼宇controller 17 | */ 18 | @RestController 19 | @RequestMapping("/building") 20 | public class BuildingController { 21 | 22 | @Autowired 23 | private BuildingService buildingService; 24 | 25 | //新增楼宇 26 | @PostMapping 27 | @PreAuthorize("hasAuthority('houseBuilding:building:add')") 28 | public ResultVo saveBuilding(@RequestBody Building building){ 29 | boolean flag = buildingService.save(building); 30 | if (flag){ 31 | return ResultUtils.success("添加成功!"); 32 | } 33 | return ResultUtils.error("添加失败!"); 34 | } 35 | 36 | //编辑楼宇 37 | @PutMapping 38 | @PreAuthorize("hasAuthority('houseBuilding:building:edit')") 39 | public ResultVo editBuilding(@RequestBody Building building){ 40 | boolean flag = buildingService.updateById(building); 41 | if (flag){ 42 | return ResultUtils.success("编辑成功!"); 43 | } 44 | return ResultUtils.error("编辑失败!"); 45 | } 46 | 47 | //删除楼宇 48 | @DeleteMapping("/{buildingId}") 49 | @PreAuthorize("hasAuthority('houseBuilding:building:delete')") 50 | public ResultVo deleteBuilding(@PathVariable("buildingId") Integer buildingId){ 51 | boolean flag = buildingService.deleteBuilding(buildingId); 52 | if (flag){ 53 | return ResultUtils.success("删除成功!"); 54 | } 55 | return ResultUtils.error("删除失败!该楼宇有单元绑定使用中"); 56 | } 57 | 58 | //分页查询 59 | @GetMapping("/list") 60 | @PreAuthorize("hasAuthority('houseBuilding:building:list')") 61 | public ResultVo getBuilding(BuildingParm buildingParm){ 62 | IPage buildingList = buildingService.getList(buildingParm); 63 | return ResultUtils.success("查询成功!",buildingList); 64 | } 65 | 66 | //添加单元时的数据回显 67 | @GetMapping("/unitList") 68 | public ResultVo unitList(){ 69 | List list = buildingService.list(); 70 | return ResultUtils.success("查询成功!",list); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/CommunityInfoController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | 4 | import com.cc.domain.pojo.CommunityInfo; 5 | import com.cc.domain.vo.ResultVo; 6 | import com.cc.service.CommunityInfoService; 7 | import com.cc.utils.ResultUtils; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.access.prepost.PreAuthorize; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 小区基本信息Controller 16 | */ 17 | @RestController 18 | @RequestMapping("/community") 19 | public class CommunityInfoController { 20 | 21 | @Autowired 22 | private CommunityInfoService communityInfoService; 23 | 24 | //首页查询小区基本信息 25 | @GetMapping("/comminfo") 26 | public ResultVo getCommInfo(){ 27 | List list = communityInfoService.list(); 28 | if (list != null){ 29 | return ResultUtils.success("查询到小区基本信息",list); 30 | } 31 | return ResultUtils.error("未查询到小区基本信息!"); 32 | } 33 | 34 | //查询小区基本信息也用作数据回显 35 | @GetMapping("/info") 36 | @PreAuthorize("hasAuthority('community:commInfo:info')") 37 | public ResultVo showCommInfo() { 38 | List communityInfoList = communityInfoService.list(); 39 | if (communityInfoList != null && communityInfoList.size() > 0){ 40 | Integer id = communityInfoList.get(0).getId(); 41 | CommunityInfo info = communityInfoService.getById(id); 42 | return ResultUtils.success("查询成功",info); 43 | } 44 | return ResultUtils.error("暂无数据,请添加小区基本信息!"); 45 | } 46 | 47 | //修改小区基本信息 48 | @PutMapping("/update") 49 | @PreAuthorize("hasAuthority('community:commInfo:save')") 50 | public ResultVo updateCommInfo(@RequestBody CommunityInfo communityInfo){ 51 | boolean flag = communityInfoService.updateInfo(communityInfo); 52 | if (flag) { 53 | return ResultUtils.success("修改成功"); 54 | } 55 | return ResultUtils.error("修改失败,小区信息不能为空!"); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/ComplaintController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.ComplaintParm; 5 | import com.cc.domain.pojo.Complaint; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.ComplaintService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * 投诉管理控制器 15 | */ 16 | @RestController 17 | @RequestMapping("/complaint") 18 | public class ComplaintController { 19 | 20 | @Autowired 21 | private ComplaintService complaintService; 22 | 23 | //分页查询 24 | @GetMapping("/list") 25 | @PreAuthorize("hasAuthority('complaint:complaintList:list')") 26 | public ResultVo getList(ComplaintParm complaintParm){ 27 | IPage complaintList = complaintService.getComplaintList(complaintParm); 28 | return ResultUtils.success("查询成功!",complaintList); 29 | } 30 | 31 | //添加 32 | @PostMapping 33 | @PreAuthorize("hasAuthority('complaint:myComplaint:add')") 34 | public ResultVo addComplaint(@RequestBody Complaint complaint){ 35 | boolean flag = complaintService.saveComplaint(complaint); 36 | if(flag){ 37 | return ResultUtils.success("添加成功!"); 38 | } 39 | return ResultUtils.error("添加失败!"); 40 | } 41 | 42 | //编辑 43 | @PutMapping 44 | @PreAuthorize("hasAuthority('complaint:myComplaint:edit')") 45 | public ResultVo editComplaint(@RequestBody Complaint complaint){ 46 | boolean flag = complaintService.updateComplaint(complaint); 47 | if(flag){ 48 | return ResultUtils.success("编辑成功!"); 49 | } 50 | return ResultUtils.error("不可编辑,该投诉已被处理!"); 51 | } 52 | 53 | //删除 54 | @DeleteMapping("/{complaintId}") 55 | @PreAuthorize("hasAuthority('complaint:myComplaint:delete')") 56 | public ResultVo deleteComplaint(@PathVariable("complaintId") Integer complaintId){ 57 | boolean flag = complaintService.removeComplaint(complaintId); 58 | if (flag){ 59 | return ResultUtils.success("删除成功!"); 60 | } 61 | return ResultUtils.error("不可删除,该投诉已被处理!"); 62 | } 63 | 64 | //我的投诉 65 | @GetMapping("/myComplaint") 66 | @PreAuthorize("hasAuthority('complaint:myComplaint:list')") 67 | public ResultVo getMyList(ComplaintParm complaintParm){ 68 | IPage complaintList = complaintService.getMyComplaintList(complaintParm); 69 | return ResultUtils.success("查询成功!",complaintList); 70 | } 71 | 72 | //处理投诉 73 | @PutMapping("/overComplaint") 74 | @PreAuthorize("hasAuthority('complaint:complaintList:slove')") 75 | public ResultVo overComplaint(@RequestBody Complaint complaint){ 76 | boolean flag = complaintService.sloveComplaint(complaint); 77 | if (flag){ 78 | return ResultUtils.success("处理成功!"); 79 | } 80 | return ResultUtils.error("处理失败!"); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/ElectricController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.Electric; 5 | import com.cc.domain.parm.ElectricParm; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.ElectricService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * 电费管理控制器 15 | */ 16 | @RestController 17 | @RequestMapping("/electric") 18 | public class ElectricController { 19 | 20 | @Autowired 21 | private ElectricService electricService; 22 | 23 | //新增 24 | @PostMapping 25 | @PreAuthorize("hasAuthority('pay:electric:add')") 26 | public ResultVo addElectric(@RequestBody Electric electric){ 27 | boolean flag = electricService.saveElectric(electric); 28 | if (flag){ 29 | return ResultUtils.success("添加成功!"); 30 | } 31 | return ResultUtils.error("添加失败,当前房屋暂未居住,不能收费!"); 32 | } 33 | 34 | //编辑 35 | @PutMapping 36 | @PreAuthorize("hasAuthority('pay:electric:edit')") 37 | public ResultVo editElectric(@RequestBody Electric electric){ 38 | if(electric.getElectricStatus().equals("1")){ 39 | return ResultUtils.error("该费用已经缴清,不能再次编辑!"); 40 | } 41 | boolean flag = electricService.updateElectric(electric); 42 | if (flag){ 43 | return ResultUtils.success("编辑成功!"); 44 | } 45 | return ResultUtils.error("编辑失败,当前房屋暂未居住,不能收费!"); 46 | } 47 | 48 | //删除 49 | @DeleteMapping("/{electricId}") 50 | @PreAuthorize("hasAuthority('pay:electric:delete')") 51 | public ResultVo deleteElectric(@PathVariable("electricId")Integer electricId){ 52 | boolean flag = electricService.removeElectricById(electricId); 53 | if (flag){ 54 | return ResultUtils.success("删除成功!"); 55 | } 56 | return ResultUtils.error("不能删除,该费用已经缴清!"); 57 | } 58 | 59 | //分页查询 60 | @GetMapping("/list") 61 | @PreAuthorize("hasAuthority('pay:electric:list')") 62 | public ResultVo getList(ElectricParm electricParm){ 63 | IPage electricList = electricService.getList(electricParm); 64 | return ResultUtils.success("查询成功!",electricList); 65 | } 66 | 67 | //缴电费 68 | @PostMapping("/payElectric") 69 | @PreAuthorize("hasAuthority('pay:electric:finish')") 70 | public ResultVo payElectric(@RequestBody Electric electric){ 71 | boolean flag = electricService.updateById(electric); 72 | if (flag){ 73 | return ResultUtils.success("缴费成功!"); 74 | } 75 | return ResultUtils.error("缴费失败!"); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/FacilitiesController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.parm.FacilitiesParm; 6 | import com.cc.domain.pojo.Facilities; 7 | import com.cc.domain.vo.ResultVo; 8 | import com.cc.service.FacilitiesService; 9 | import com.cc.utils.ResultUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.access.prepost.PreAuthorize; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * 小区周边设施Controller 18 | */ 19 | @RestController 20 | @RequestMapping("/facilities") 21 | public class FacilitiesController { 22 | 23 | @Autowired 24 | private FacilitiesService facilitiesService; 25 | 26 | //添加设施 27 | @PostMapping 28 | @PreAuthorize("hasAuthority('community:facilities:add')") 29 | public ResultVo addFacilities(@RequestBody Facilities facilities){ 30 | boolean flag = facilitiesService.saveFacilities(facilities); 31 | if(flag){ 32 | return ResultUtils.success("添加成功!"); 33 | } 34 | return ResultUtils.error("添加失败!"); 35 | } 36 | 37 | //分页查询 38 | @GetMapping("/list") 39 | @PreAuthorize("hasAuthority('community:facilities:list')") 40 | public ResultVo getFacilitiesList(FacilitiesParm facilitiesParm){ 41 | IPage facilitiesList = facilitiesService.getList(facilitiesParm); 42 | return ResultUtils.success("查询成功!",facilitiesList); 43 | } 44 | 45 | //编辑 46 | @PutMapping 47 | @PreAuthorize("hasAuthority('community:facilities:edit')") 48 | public ResultVo editFacilities(@RequestBody Facilities facilities){ 49 | boolean flag = facilitiesService.updateById(facilities); 50 | if(flag){ 51 | return ResultUtils.success("修改成功!"); 52 | } 53 | return ResultUtils.error("修改失败!"); 54 | } 55 | 56 | //删除 57 | @DeleteMapping("/{faId}") 58 | @PreAuthorize("hasAuthority('community:facilities:delete')") 59 | public ResultVo deleteFacilities(@PathVariable("faId")Integer faId){ 60 | boolean flag = facilitiesService.removeById(faId); 61 | if(flag){ 62 | return ResultUtils.success("删除成功!"); 63 | } 64 | return ResultUtils.error("删除失败!"); 65 | } 66 | 67 | //首页查询设施列表 68 | @GetMapping("/getFacList") 69 | public ResultVo getIndexFacilitiesList(){ 70 | List facilitiesList = facilitiesService.list(); 71 | return ResultUtils.success("查询成功",facilitiesList); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/HouseController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.House; 5 | import com.cc.domain.parm.HouseParm; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.HouseService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 房屋控制器 17 | */ 18 | 19 | @RestController 20 | @RequestMapping("/house") 21 | public class HouseController { 22 | 23 | @Autowired 24 | private HouseService houseService; 25 | 26 | //分页 27 | @GetMapping("/list") 28 | @PreAuthorize("hasAuthority('houseBuilding:house:list')") 29 | public ResultVo getHouseList(HouseParm parm){ 30 | IPage houseList = houseService.getList(parm); 31 | return ResultUtils.success("查询成功",houseList); 32 | } 33 | 34 | //添加 35 | @PostMapping 36 | @PreAuthorize("hasAuthority('houseBuilding:house:add')") 37 | public ResultVo addHouse(@RequestBody House house){ 38 | boolean flag = houseService.save(house); 39 | if (flag){ 40 | return ResultUtils.success("添加成功!"); 41 | } 42 | return ResultUtils.error("添加失败!"); 43 | } 44 | 45 | //编辑 46 | @PutMapping 47 | @PreAuthorize("hasAuthority('houseBuilding:house:edit')") 48 | public ResultVo editHouse(@RequestBody House house){ 49 | boolean flag = houseService.updateById(house); 50 | if (flag){ 51 | return ResultUtils.success("修改成功!"); 52 | } 53 | return ResultUtils.error("修改失败!"); 54 | } 55 | 56 | //删除 57 | @DeleteMapping("/{houseId}") 58 | @PreAuthorize("hasAuthority('houseBuilding:house:delete')") 59 | public ResultVo deleteHouse(@PathVariable("houseId") Integer houseId){ 60 | boolean flag = houseService.removeHouse(houseId); 61 | if (flag){ 62 | return ResultUtils.success("删除成功!"); 63 | } 64 | return ResultUtils.error("删除失败,该房屋正在使用中!"); 65 | } 66 | 67 | //根据单元id获取房屋列表 68 | @GetMapping("/getHouseListByUnitId") 69 | public ResultVo getHouseListByUnitId(House house){ 70 | List houseList = houseService.getHouseList(house); 71 | if (houseList != null){ 72 | return ResultUtils.success("查询成功!",houseList); 73 | } 74 | return ResultUtils.error("查询失败!"); 75 | } 76 | 77 | //统计房屋数量 78 | @GetMapping("/getHouseNum") 79 | public ResultVo getHouseNum(){ 80 | long houseCount = houseService.count(); 81 | return ResultUtils.success("查询成功!",houseCount); 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/MenuController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.cc.domain.pojo.Menu; 4 | import com.cc.domain.vo.ResultVo; 5 | import com.cc.service.MenuService; 6 | import com.cc.utils.ResultUtils; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.security.access.prepost.PreAuthorize; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * 菜单Controller 15 | */ 16 | @RestController 17 | @RequestMapping("/menu") 18 | public class MenuController { 19 | 20 | @Autowired 21 | private MenuService menuService; 22 | 23 | //添加菜单 24 | @PostMapping 25 | @PreAuthorize("hasAuthority('user:menu:add')") 26 | public ResultVo addMenu(@RequestBody Menu menu){ 27 | boolean flag = menuService.save(menu); 28 | if (flag){ 29 | return ResultUtils.success("添加成功!"); 30 | } 31 | return ResultUtils.error("添加失败!"); 32 | } 33 | 34 | //编辑菜单 35 | @PutMapping 36 | @PreAuthorize("hasAuthority('user:menu:edit')") 37 | public ResultVo editMenu(@RequestBody Menu menu){ 38 | boolean flag = menuService.updateById(menu); 39 | if (flag){ 40 | return ResultUtils.success("修改成功!"); 41 | } 42 | return ResultUtils.error("修改失败!"); 43 | } 44 | 45 | //删除菜单 46 | @DeleteMapping("/{menuId}") 47 | @PreAuthorize("hasAuthority('user:menu:delete')") 48 | public ResultVo deleteMenu(@PathVariable("menuId") Integer menuId){ 49 | boolean flag = menuService.deleteMenu(menuId); 50 | if (flag){ 51 | return ResultUtils.success("删除成功!"); 52 | } 53 | return ResultUtils.error("删除失败,当前删除对象存在下级!"); 54 | } 55 | 56 | //父级菜单的查询 57 | @GetMapping("/parent") 58 | public ResultVo getParent(){ 59 | List parentList = menuService.getParentList(); 60 | return ResultUtils.success("查询成功",parentList); 61 | } 62 | 63 | //树形数据的查询 64 | @GetMapping("/tree") 65 | @PreAuthorize("hasAuthority('user:menu:show')") 66 | public ResultVo getTree(){ 67 | List menuList = menuService.getMenuList(); 68 | return ResultUtils.success("查询成功",menuList); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/NoticeController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.IndexNoticeParm; 5 | import com.cc.domain.parm.NoticeParm; 6 | import com.cc.domain.pojo.Notice; 7 | import com.cc.domain.vo.ResultVo; 8 | import com.cc.service.NoticeService; 9 | import com.cc.utils.ResultUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.access.prepost.PreAuthorize; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | /** 15 | * 公告控制器 16 | */ 17 | @RestController 18 | @RequestMapping("/notice") 19 | public class NoticeController { 20 | 21 | @Autowired 22 | private NoticeService noticeService; 23 | 24 | //分页查询 25 | @GetMapping("/list") 26 | @PreAuthorize("hasAuthority('community:notice:list')") 27 | public ResultVo getNoticeList(NoticeParm noticeParm){ 28 | IPage noticeList = noticeService.getList(noticeParm); 29 | return ResultUtils.success("查询成功!",noticeList); 30 | } 31 | 32 | //添加 33 | @PostMapping 34 | @PreAuthorize("hasAuthority('community:notice:add')") 35 | public ResultVo addNotice(@RequestBody Notice notice){ 36 | boolean flag = noticeService.saveNotice(notice); 37 | if(flag){ 38 | return ResultUtils.success("发布成功!"); 39 | } 40 | return ResultUtils.error("发布失败!"); 41 | } 42 | 43 | //编辑 44 | @PutMapping 45 | @PreAuthorize("hasAuthority('community:notice:edit')") 46 | public ResultVo editNotice(@RequestBody Notice notice){ 47 | boolean flag = noticeService.updateById(notice); 48 | if(flag){ 49 | return ResultUtils.success("修改成功!"); 50 | } 51 | return ResultUtils.error("修改失败!"); 52 | } 53 | 54 | //删除 55 | @DeleteMapping("/{noticeId}") 56 | @PreAuthorize("hasAuthority('community:notice:delete')") 57 | public ResultVo deleteNotice(@PathVariable("noticeId") Integer noticeId){ 58 | boolean flag = noticeService.removeById(noticeId); 59 | if(flag){ 60 | return ResultUtils.success("删除成功!"); 61 | } 62 | return ResultUtils.error("删除失败!"); 63 | } 64 | 65 | //首页分压查询 66 | @GetMapping("/getNoticeList") 67 | public ResultVo getNoticeList(IndexNoticeParm indexNoticeParm){ 68 | IPage indexNoticeList = noticeService.getIndexNoticeList(indexNoticeParm); 69 | return ResultUtils.success("查询成功!",indexNoticeList); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/ParkController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.ParkParm; 5 | import com.cc.domain.pojo.Park; 6 | import com.cc.domain.pojo.Parking; 7 | import com.cc.domain.vo.ResultVo; 8 | import com.cc.service.ParkService; 9 | import com.cc.service.ParkingService; 10 | import com.cc.utils.ResultUtils; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.security.access.prepost.PreAuthorize; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * 停车费管理控制器 19 | */ 20 | @RestController 21 | @RequestMapping("/park") 22 | public class ParkController { 23 | 24 | @Autowired 25 | private ParkService parkService; 26 | 27 | @Autowired 28 | private ParkingService parkingService; 29 | 30 | //新增 31 | @PostMapping 32 | @PreAuthorize("hasAuthority('pay:park:add')") 33 | public ResultVo addPark(@RequestBody Park park){ 34 | boolean flag = parkService.addPayPark(park); 35 | if (flag){ 36 | return ResultUtils.success("添加成功!"); 37 | } 38 | return ResultUtils.error("添加失败,当前车位暂未使用!"); 39 | } 40 | 41 | //编辑 42 | @PutMapping 43 | @PreAuthorize("hasAuthority('pay:park:edit')") 44 | public ResultVo editPark(@RequestBody Park park){ 45 | if(park.getParkingStatus().equals("1")){ 46 | return ResultUtils.error("该账单已缴费,无法再编辑!"); 47 | } 48 | boolean flag = parkService.editPayPark(park); 49 | if (flag){ 50 | return ResultUtils.success("编辑成功!"); 51 | } 52 | return ResultUtils.error("编辑失败,当前车位暂未使用!"); 53 | } 54 | 55 | //删除 56 | @DeleteMapping("/{parkingId}") 57 | @PreAuthorize("hasAuthority('pay:park:delete')") 58 | public ResultVo deletePark(@PathVariable("parkingId")Integer parkingId){ 59 | boolean flag = parkService.deletePayPark(parkingId); 60 | if (flag){ 61 | return ResultUtils.success("删除成功!"); 62 | } 63 | return ResultUtils.error("已经缴费,删除失败!"); 64 | } 65 | 66 | //缴停车费 67 | @PostMapping("/payPark") 68 | @PreAuthorize("hasAuthority('pay:park:finish')") 69 | public ResultVo payPark(@RequestBody Park park){ 70 | park.setParkingStatus("1"); 71 | boolean flag = parkService.updateById(park); 72 | if (flag){ 73 | return ResultUtils.success("缴费成功!"); 74 | } 75 | return ResultUtils.error("缴费失败!"); 76 | } 77 | 78 | //分页查询 79 | @GetMapping("/list") 80 | @PreAuthorize("hasAuthority('pay:park:list')") 81 | public ResultVo getList(ParkParm parkParm){ 82 | IPage parkList = parkService.getList(parkParm); 83 | return ResultUtils.success("查询成功!",parkList); 84 | } 85 | 86 | //数据回显车位列表 87 | @GetMapping("/getListNoPage") 88 | public ResultVo getListNoPage(){ 89 | List parkListNoPage = parkingService.list(); 90 | return ResultUtils.success("查询成功!",parkListNoPage); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/ParkingController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.Parking; 5 | import com.cc.domain.parm.ParkingParm; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.ParkingService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * 车位管理控制器 15 | */ 16 | @RestController 17 | @RequestMapping("/parking") 18 | public class ParkingController { 19 | 20 | @Autowired 21 | private ParkingService parkingService; 22 | 23 | //分页查询 24 | @GetMapping("/list") 25 | @PreAuthorize("hasAuthority('parking:parkingList:list')") 26 | public ResultVo getList(ParkingParm parkingParm){ 27 | IPage parkingList = parkingService.getList(parkingParm); 28 | return ResultUtils.success("查询成功!",parkingList); 29 | } 30 | 31 | //新增车位 32 | @PostMapping 33 | @PreAuthorize("hasAuthority('parking:parkingList:add')") 34 | public ResultVo addParking(@RequestBody Parking parking){ 35 | boolean flag = parkingService.save(parking); 36 | if (flag){ 37 | return ResultUtils.success("添加成功!"); 38 | } 39 | return ResultUtils.error("添加失败!"); 40 | } 41 | 42 | //编辑车位 43 | @PutMapping 44 | @PreAuthorize("hasAuthority('parking:parkingList:edit')") 45 | public ResultVo editParking(@RequestBody Parking parking){ 46 | boolean flag = parkingService.updateById(parking); 47 | if (flag){ 48 | return ResultUtils.success("编辑成功!"); 49 | } 50 | return ResultUtils.error("编辑失败!"); 51 | } 52 | 53 | //删除车位 54 | @DeleteMapping("/{parkId}") 55 | @PreAuthorize("hasAuthority('parking:parkingList:delete')") 56 | public ResultVo deleteParking(@PathVariable("parkId")Integer parkId){ 57 | boolean flag = parkingService.removeParking(parkId); 58 | if (flag){ 59 | return ResultUtils.success("删除成功!"); 60 | } 61 | return ResultUtils.error("删除失败!该车位目前在使用中"); 62 | } 63 | 64 | //统计车位数量 65 | @GetMapping("/getParkingNum") 66 | public ResultVo getParkingNum(){ 67 | long parkingCount = parkingService.count(); 68 | return ResultUtils.success("查询成功!",parkingCount); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/RecordsController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.LiverElectricParm; 5 | import com.cc.domain.parm.LiverParkParm; 6 | import com.cc.domain.parm.LiverWaterParm; 7 | import com.cc.domain.pojo.Electric; 8 | import com.cc.domain.pojo.Park; 9 | import com.cc.domain.pojo.Water; 10 | import com.cc.domain.vo.ResultVo; 11 | import com.cc.service.ElectricService; 12 | import com.cc.service.ParkService; 13 | import com.cc.service.WaterService; 14 | import com.cc.utils.ResultUtils; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.security.access.prepost.PreAuthorize; 17 | import org.springframework.web.bind.annotation.GetMapping; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RestController; 20 | 21 | /** 22 | * 缴费记录控制器 23 | */ 24 | @RestController 25 | @RequestMapping("/records") 26 | public class RecordsController { 27 | 28 | @Autowired 29 | private WaterService waterService; 30 | 31 | @Autowired 32 | private ElectricService electricService; 33 | 34 | @Autowired 35 | private ParkService parkService; 36 | 37 | //水费记录查询 38 | @GetMapping("/waterList") 39 | @PreAuthorize("hasAuthority('records:myWaterList:list')") 40 | public ResultVo getMyWaterList(LiverWaterParm liverWaterParm){ 41 | IPage liverWaterList = waterService.getLiverWaterList(liverWaterParm); 42 | return ResultUtils.success("查询成功!",liverWaterList); 43 | } 44 | 45 | //电费记录查询 46 | @GetMapping("/electricList") 47 | @PreAuthorize("hasAuthority('records:myElectricList:list')") 48 | public ResultVo getMyElectricList(LiverElectricParm liverElectricParm){ 49 | IPage liverElectricList = electricService.getLiverElectricList(liverElectricParm); 50 | return ResultUtils.success("查询成功!",liverElectricList); 51 | } 52 | 53 | //停车费记录查询 54 | @GetMapping("/parkList") 55 | @PreAuthorize("hasAuthority('records:myParkList:list')") 56 | public ResultVo getMyParkList(LiverParkParm liverParkParm){ 57 | IPage liverParkList = parkService.getLiverParkList(liverParkParm); 58 | return ResultUtils.success("查询成功!",liverParkList); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/RepairController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.RepairParm; 5 | import com.cc.domain.pojo.Repair; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.RepairService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * 维修管理控制层 15 | */ 16 | @RestController 17 | @RequestMapping("/repair") 18 | public class RepairController { 19 | 20 | @Autowired 21 | private RepairService repairService; 22 | 23 | //维修列表分页查询 24 | @GetMapping("/list") 25 | @PreAuthorize("hasAuthority('repair:repairList:list')") 26 | public ResultVo getList(RepairParm repairParm){ 27 | IPage repairList = repairService.getRepairList(repairParm); 28 | return ResultUtils.success("查询成功!",repairList); 29 | } 30 | 31 | //添加 32 | @PostMapping 33 | @PreAuthorize("hasAuthority('repair:myRepair:add')") 34 | public ResultVo addRepair(@RequestBody Repair repair){ 35 | boolean flag = repairService.saveRepair(repair); 36 | if(flag){ 37 | return ResultUtils.success("添加成功!"); 38 | } 39 | return ResultUtils.error("添加失败!"); 40 | } 41 | 42 | //编辑 43 | @PutMapping 44 | @PreAuthorize("hasAuthority('repair:myRepair:edit')") 45 | public ResultVo editRepair(@RequestBody Repair repair){ 46 | boolean flag = repairService.updateRepair(repair); 47 | if(flag){ 48 | return ResultUtils.success("编辑成功!"); 49 | } 50 | return ResultUtils.error("不可编辑,该报修已被处理!"); 51 | } 52 | 53 | //删除 54 | @DeleteMapping("/{repairId}") 55 | @PreAuthorize("hasAuthority('repair:myRepair:delete')") 56 | public ResultVo deleteRepair(@PathVariable("repairId") Integer repairId){ 57 | boolean flag = repairService.removeRepair(repairId); 58 | if (flag){ 59 | return ResultUtils.success("删除成功!"); 60 | } 61 | return ResultUtils.error("不可删除,该报修已被处理!"); 62 | } 63 | 64 | //我的报修 65 | @GetMapping("/myRepair") 66 | @PreAuthorize("hasAuthority('repair:myRepair:list')") 67 | public ResultVo getMyList(RepairParm repairParm){ 68 | IPage repairList = repairService.getMyRepairList(repairParm); 69 | return ResultUtils.success("查询成功!",repairList); 70 | } 71 | 72 | //处理报修 73 | @PutMapping("/overRepair") 74 | @PreAuthorize("hasAuthority('repair:repairList:slove')") 75 | public ResultVo overRepair(@RequestBody Repair repair){ 76 | boolean flag = repairService.sloveRepair(repair); 77 | if (flag){ 78 | return ResultUtils.success("处理成功!"); 79 | } 80 | return ResultUtils.error("处理失败!"); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/ReportController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.cc.domain.vo.ResultVo; 4 | import com.cc.service.ComplaintService; 5 | import com.cc.service.HouseService; 6 | import com.cc.service.ParkingService; 7 | import com.cc.service.RepairService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.Map; 15 | 16 | /** 17 | * 报表统计控制器 18 | */ 19 | @RestController 20 | @RequestMapping("/report") 21 | public class ReportController { 22 | 23 | @Autowired 24 | private ComplaintService complaintService; 25 | 26 | @Autowired 27 | private RepairService repairService; 28 | 29 | @Autowired 30 | private HouseService houseService; 31 | 32 | @Autowired 33 | private ParkingService parkingService; 34 | 35 | //维修柱形图 36 | @GetMapping("/getRepairCount") 37 | public ResultVo getRepairCount(){ 38 | Map resultMap = repairService.listForMonths(); 39 | return ResultUtils.success("查询成功!",resultMap); 40 | } 41 | 42 | //投诉折线图 43 | @GetMapping("/getComplaintCount") 44 | public ResultVo getComplaintCount(){ 45 | Map resultMap = complaintService.listforMonths(); 46 | return ResultUtils.success("查询成功!",resultMap); 47 | } 48 | 49 | //入住率饼形图 50 | @GetMapping("/getHouseStatus") 51 | public ResultVo getHouseStatus(){ 52 | Map resultMap = houseService.getHouseLiveStatus(); 53 | return ResultUtils.success("查询成功!",resultMap); 54 | } 55 | 56 | //小区人数统计饼形图 57 | @GetMapping("/getLiverCount") 58 | public ResultVo getLiverCount(){ 59 | Map resultMap = houseService.getAllLiverCount(); 60 | return ResultUtils.success("查询成功!",resultMap); 61 | } 62 | 63 | //小区车位使用情况饼形图 64 | @GetMapping("/getParkingStatus") 65 | public ResultVo getParkingStatus(){ 66 | Map resultMap = parkingService.getParkStatus(); 67 | return ResultUtils.success("查询成功!",resultMap); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.Role; 5 | import com.cc.domain.parm.RoleAssignParm; 6 | import com.cc.domain.parm.RoleParm; 7 | import com.cc.domain.parm.RolePermissionParm; 8 | import com.cc.domain.vo.ResultVo; 9 | import com.cc.domain.vo.RolePermissionVo; 10 | import com.cc.service.RoleService; 11 | import com.cc.utils.ResultUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.security.access.prepost.PreAuthorize; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * 角色Controller 20 | */ 21 | 22 | @RestController 23 | @RequestMapping("/role") 24 | public class RoleController { 25 | 26 | @Autowired 27 | private RoleService roleService; 28 | 29 | //分页查询角色列表 30 | @GetMapping("/list") 31 | @PreAuthorize("hasAuthority('user:role:list')") 32 | public ResultVo list(RoleParm parm){ 33 | IPage list = roleService.list(parm); 34 | return ResultUtils.success("查询成功!",list); 35 | } 36 | 37 | //新增角色 38 | @PostMapping 39 | @PreAuthorize("hasAuthority('user:role:add')") 40 | public ResultVo addRole(@RequestBody Role role){ 41 | boolean flag = roleService.save(role); 42 | if (flag){ 43 | return ResultUtils.success("添加成功!"); 44 | } 45 | return ResultUtils.error("添加失败"); 46 | } 47 | 48 | //编辑角色 49 | @PutMapping 50 | @PreAuthorize("hasAuthority('user:role:edit')") 51 | public ResultVo editRole(@RequestBody Role role){ 52 | boolean flag = roleService.updateById(role); 53 | if (flag){ 54 | return ResultUtils.success("修改成功!"); 55 | } 56 | return ResultUtils.error("修改失败!"); 57 | } 58 | 59 | //删除角色 60 | @DeleteMapping("/{roleId}") 61 | @PreAuthorize("hasAuthority('user:role:delete')") 62 | public ResultVo deleteRole(@PathVariable ("roleId") Integer roleId){ 63 | boolean flag = roleService.removeRole(roleId); 64 | if (flag){ 65 | return ResultUtils.success("删除成功!"); 66 | } 67 | return ResultUtils.error("删除失败,该角色已分配用户!"); 68 | } 69 | 70 | //分配权限回显 71 | @PostMapping ("/getAssignTree") 72 | public ResultVo getAssignTree(@RequestBody RoleAssignParm roleAssignParm){ 73 | RolePermissionVo assignTree = roleService.getAssignTree(roleAssignParm); 74 | if (assignTree != null){ 75 | return ResultUtils.success("查询成功",assignTree); 76 | } 77 | return ResultUtils.error("为查询到数据!"); 78 | } 79 | 80 | //分配权限保存 81 | @PostMapping("/saveAssignTree") 82 | @PreAuthorize("hasAuthority('user:role:allocation')") 83 | public ResultVo saveAssignTree(@RequestBody RolePermissionParm rolePermissionParm){ 84 | roleService.saveAssign(rolePermissionParm); 85 | return ResultUtils.success("分配权限成功!"); 86 | } 87 | 88 | //获取角色列表不分页->添加业主数据回显 89 | @GetMapping("/roleList") 90 | public ResultVo getRoleList(){ 91 | List roleList = roleService.list(); 92 | return ResultUtils.success("获取成功!",roleList); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/UnitController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Unit; 6 | import com.cc.domain.parm.UnitParm; 7 | import com.cc.domain.vo.ResultVo; 8 | import com.cc.service.UnitService; 9 | import com.cc.utils.ResultUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.access.prepost.PreAuthorize; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * 单元控制器 18 | */ 19 | @RestController 20 | @RequestMapping("/unit") 21 | public class UnitController { 22 | 23 | @Autowired 24 | private UnitService unitService; 25 | 26 | //查询单元列表 27 | @GetMapping("/list") 28 | @PreAuthorize("hasAuthority('houseBuilding:unit:list')") 29 | public ResultVo getUnitList(UnitParm unitParm){ 30 | IPage unitList = unitService.getList(unitParm); 31 | return ResultUtils.success("查询成功!",unitList); 32 | } 33 | 34 | //新增单元 35 | @PostMapping 36 | @PreAuthorize("hasAuthority('houseBuilding:unit:add')") 37 | public ResultVo addUnit(@RequestBody Unit unit){ 38 | boolean flag = unitService.save(unit); 39 | if (flag){ 40 | return ResultUtils.success("添加成功!"); 41 | } 42 | return ResultUtils.error("添加失败!"); 43 | } 44 | 45 | //编辑单元 46 | @PutMapping 47 | @PreAuthorize("hasAuthority('houseBuilding:unit:edit')") 48 | public ResultVo editUnit(@RequestBody Unit unit){ 49 | boolean flag = unitService.updateById(unit); 50 | if (flag){ 51 | return ResultUtils.success("编辑成功!"); 52 | } 53 | return ResultUtils.error("编辑失败!"); 54 | } 55 | 56 | //删除单元 57 | @DeleteMapping("/{unitId}") 58 | @PreAuthorize("hasAuthority('houseBuilding:unit:delete')") 59 | public ResultVo deleteUnit(@PathVariable("unitId") Integer unitId){ 60 | boolean flag = unitService.removeUnit(unitId); 61 | if (flag){ 62 | return ResultUtils.success("删除成功!"); 63 | } 64 | return ResultUtils.error("删除失败!该单元被房屋绑定中"); 65 | } 66 | 67 | //根据楼宇id查询单元列表 68 | @GetMapping("/getUnitListByBuildingId") 69 | public ResultVo getUnitListByBuildingId(Unit unit){ 70 | //构造查询条件 71 | QueryWrapper wrapper = new QueryWrapper<>(); 72 | wrapper.lambda().eq(Unit::getBuildingId,unit.getBuildingId()); 73 | List unitList = unitService.list(wrapper); 74 | return ResultUtils.success("查询成功!",unitList); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | 4 | 5 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 6 | import com.cc.domain.pojo.ChangePassword; 7 | import com.cc.domain.pojo.UserAndRole; 8 | import com.cc.domain.parm.LoginParm; 9 | import com.cc.domain.vo.LoginResult; 10 | import com.cc.domain.pojo.User; 11 | import com.cc.domain.pojo.UserInfo; 12 | import com.cc.domain.vo.ResultVo; 13 | import com.cc.domain.vo.RouterVO; 14 | import com.cc.service.UserService; 15 | import com.cc.utils.ResultUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.security.access.prepost.PreAuthorize; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import javax.servlet.http.HttpServletRequest; 21 | import javax.servlet.http.HttpServletResponse; 22 | import java.util.List; 23 | 24 | /** 25 | * 用户登录控制器 26 | */ 27 | @RestController 28 | @RequestMapping("/user") 29 | public class UserController { 30 | 31 | @Autowired 32 | private UserService userService; 33 | 34 | //用户登录 35 | @PostMapping("/login") 36 | public ResultVo login(@RequestBody LoginParm loginParm){ 37 | //首先判断是否为空 38 | if (StringUtils.isEmpty(loginParm.getUsername())|| StringUtils.isEmpty(loginParm.getPassword()) || StringUtils.isEmpty(loginParm.getUserType())){ 39 | return ResultUtils.error("用户名、密码、用户类型不能为空!"); 40 | } 41 | //判断当前账户是否被禁用 42 | boolean flag = userService.isStatus(loginParm); 43 | if(!flag){ 44 | return ResultUtils.error("登陆失败,当前账号被禁用!"); 45 | } 46 | //不为空在进行登录 47 | LoginResult result = userService.loginUser(loginParm); 48 | if (result == null){ 49 | return ResultUtils.error("用户名或密码错误!"); 50 | } 51 | return ResultUtils.success("登录成功!",result); 52 | } 53 | 54 | //获取用户信息 55 | @GetMapping("/getInfo") 56 | public ResultVo getInfo(User user,HttpServletRequest request){ 57 | UserInfo result = userService.getUserInfo(user,request); 58 | if (result == null){ 59 | return ResultUtils.error("服务器错误!"); 60 | } 61 | return ResultUtils.success("获取用户信息成功!",result); 62 | } 63 | 64 | //根据用户id查询角色id 65 | @GetMapping("/getRoleByUserId") 66 | public ResultVo getRoleByUserId(UserAndRole userAndRole){ 67 | UserAndRole userRole = userService.getRoleByUserId(userAndRole); 68 | return ResultUtils.success("查询成功!",userRole); 69 | } 70 | 71 | //保存用户角色 72 | @PostMapping("/saveRole") 73 | @PreAuthorize("hasAuthority('user:worker:allocation')") 74 | public ResultVo saveRole(@RequestBody UserAndRole userAndRole){ 75 | userService.saveRole(userAndRole); 76 | return ResultUtils.success("分配角色成功!"); 77 | } 78 | 79 | //退出登录 80 | @PostMapping("/loginOut") 81 | public ResultVo logintOut(HttpServletRequest request, HttpServletResponse response){ 82 | boolean flag = userService.quitUser(request,response); 83 | if(flag){ 84 | return ResultUtils.success("退出成功!"); 85 | } 86 | return ResultUtils.error("发生错误!"); 87 | } 88 | 89 | //修改密码 90 | @PostMapping("/resetPassword") 91 | public ResultVo resetPassword(@RequestBody ChangePassword user, HttpServletRequest request){ 92 | boolean flag = userService.resetPass(user,request); 93 | if (flag){ 94 | return ResultUtils.success("修改成功!"); 95 | } 96 | return ResultUtils.error("修改失败,旧密码错误!"); 97 | } 98 | 99 | //获取菜单列表 100 | @GetMapping("/getMenuList") 101 | public ResultVo getMenuList(HttpServletRequest request){ 102 | List resultList = userService.getMenu(request); 103 | return ResultUtils.success("查询成功!",resultList); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/WaterController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.parm.WaterParm; 5 | import com.cc.domain.pojo.Water; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.WaterService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * 水费管理控制器 15 | */ 16 | @RestController 17 | @RequestMapping("/water") 18 | public class WaterController { 19 | 20 | @Autowired 21 | private WaterService waterService; 22 | 23 | //新增 24 | @PostMapping 25 | @PreAuthorize("hasAuthority('pay:water:add')") 26 | public ResultVo addWater(@RequestBody Water water){ 27 | boolean flag = waterService.saveWater(water); 28 | if (flag){ 29 | return ResultUtils.success("添加成功!"); 30 | } 31 | return ResultUtils.error("添加失败,当前房屋暂未居住,不能收费!"); 32 | } 33 | 34 | //编辑 35 | @PutMapping 36 | @PreAuthorize("hasAuthority('pay:water:edit')") 37 | public ResultVo editWater(@RequestBody Water water){ 38 | if(water.getWaterStatus().equals("1")){ 39 | return ResultUtils.error("该账单已缴费,无法再编辑!"); 40 | } 41 | boolean flag = waterService.updateWater(water); 42 | if (flag){ 43 | return ResultUtils.success("编辑成功!"); 44 | } 45 | return ResultUtils.error("编辑失败,当前房屋暂未居住,不能收费!"); 46 | } 47 | 48 | //删除 49 | @DeleteMapping("/{waterId}") 50 | @PreAuthorize("hasAuthority('pay:water:delete')") 51 | public ResultVo deleteWater(@PathVariable("waterId")Integer waterId){ 52 | boolean flag = waterService.removeWaterById(waterId); 53 | if (flag){ 54 | return ResultUtils.success("删除成功!"); 55 | } 56 | return ResultUtils.error("不能删除,该费用已经缴清!"); 57 | } 58 | 59 | //分页查询 60 | @GetMapping("/list") 61 | @PreAuthorize("hasAuthority('pay:water:list')") 62 | public ResultVo getList(WaterParm waterParm){ 63 | IPage waterList = waterService.getList(waterParm); 64 | return ResultUtils.success("查询成功!",waterList); 65 | } 66 | 67 | //缴水费 68 | @PostMapping("/payWater") 69 | @PreAuthorize("hasAuthority('pay:water:finish')") 70 | public ResultVo payWater(@RequestBody Water water){ 71 | boolean flag = waterService.updateById(water); 72 | if (flag){ 73 | return ResultUtils.success("缴费成功!"); 74 | } 75 | return ResultUtils.error("缴费失败!"); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/cc/controller/WorkerController.java: -------------------------------------------------------------------------------- 1 | package com.cc.controller; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.cc.domain.pojo.User; 5 | import com.cc.domain.parm.UserParm; 6 | import com.cc.domain.vo.ResultVo; 7 | import com.cc.service.WorkerService; 8 | import com.cc.utils.ResultUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.prepost.PreAuthorize; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 物业人员Controller 17 | */ 18 | @RestController 19 | @RequestMapping("/worker") 20 | public class WorkerController { 21 | 22 | @Autowired 23 | private WorkerService workerService; 24 | 25 | //首页物业员工列表 26 | @GetMapping("/workerList") 27 | public ResultVo workerList(){ 28 | List workerList = workerService.getAllWorker(); 29 | return ResultUtils.success("查询成功!",workerList); 30 | } 31 | 32 | //查询物业员工列表 33 | @GetMapping("/list") 34 | @PreAuthorize("hasAuthority('user:worker:list')") 35 | public ResultVo list(UserParm parm){ 36 | IPage workerList = workerService.list(parm); 37 | //前端密码脱敏处理 38 | workerList.getRecords().stream().forEach(item -> item.setPassword("********")); 39 | return ResultUtils.success("查询成功!",workerList); 40 | } 41 | 42 | //新增物业员工 43 | @PostMapping 44 | @PreAuthorize("hasAuthority('user:worker:add')") 45 | public ResultVo addWorker(@RequestBody User user){ 46 | boolean flag = workerService.saveWorker(user); 47 | if (flag){ 48 | return ResultUtils.success("添加成功!"); 49 | } 50 | return ResultUtils.error("添加失败,用户名已被占用!"); 51 | } 52 | 53 | //编辑物业员工 54 | @PutMapping 55 | @PreAuthorize("hasAuthority('user:worker:edit')") 56 | public ResultVo editWorker(@RequestBody User user){ 57 | boolean flag = workerService.updateWorker(user); 58 | if (flag){ 59 | return ResultUtils.success("修改成功!"); 60 | } 61 | return ResultUtils.error("修改失败,用户名已经被占用!"); 62 | } 63 | 64 | //删除员工 65 | @DeleteMapping("/{userId}") 66 | @PreAuthorize("hasAuthority('user:worker:delete')") 67 | public ResultVo deleteWorker(@PathVariable("userId") Integer userId){ 68 | boolean flag = workerService.removeWorker(userId); 69 | if (flag){ 70 | return ResultUtils.success("删除成功!"); 71 | } 72 | return ResultUtils.error("删除失败,请先停用该账号!"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/AssignHouseParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 分配房屋保存类 9 | */ 10 | @Data 11 | public class AssignHouseParm implements Serializable { 12 | 13 | //业主id 14 | private Integer liverId; 15 | 16 | //房屋id 17 | private Integer houseId; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/BuildingParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 楼宇结果返回 9 | */ 10 | @Data 11 | public class BuildingParm implements Serializable { 12 | //楼宇名称 13 | private String buildingName; 14 | 15 | //楼宇类型 0:普通房 1:电梯房 16 | private String buildingType; 17 | 18 | //每页显示的条数 19 | private Long pageSize; 20 | 21 | //当前页码 22 | private Long currentPage; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/ComplaintParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 投诉查询参数 7 | */ 8 | @Data 9 | public class ComplaintParm { 10 | 11 | //投诉人id 12 | private String liverId; 13 | 14 | //投诉标题 15 | private String complaintTitle; 16 | 17 | //每页显示的条数 18 | private Long pageSize; 19 | 20 | //当前页码 21 | private Long currentPage; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/ElectricParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 电费分页参数 9 | */ 10 | @Data 11 | public class ElectricParm implements Serializable { 12 | 13 | //房屋编号 14 | private String houseNum; 15 | 16 | //业主姓名 17 | private String liverName; 18 | 19 | //每页显示的条数 20 | private Long pageSize; 21 | 22 | //当前页码 23 | private Long currentPage; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/FacilitiesParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 设施请求参数 9 | */ 10 | @Data 11 | public class FacilitiesParm implements Serializable { 12 | 13 | //设施名称 14 | private String faName; 15 | 16 | //负责人 17 | private String faPerson; 18 | 19 | //联系电话 20 | private Long phoneNumber; 21 | 22 | //每页显示的条数 23 | private Long pageSize; 24 | 25 | //当前页码 26 | private Long currentPage; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/HouseParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 房屋结果返回 9 | */ 10 | @Data 11 | public class HouseParm implements Serializable { 12 | 13 | //楼宇名称 14 | private String buildingName; 15 | 16 | //单元名称 17 | private String unitName; 18 | 19 | //房屋编号 20 | private String houseNum; 21 | 22 | //使用状态 0:未使用 1:已使用 23 | private String houseStatus; 24 | 25 | //当前页 26 | private Long currentPage; 27 | 28 | //页容量 29 | private Long pageSize; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/IndexNoticeParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 首页公告分页参数 9 | */ 10 | 11 | @Data 12 | public class IndexNoticeParm implements Serializable { 13 | //每页显示的条数 14 | private Long pageSize; 15 | 16 | //当前页码 17 | private Long currentPage; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/LiverElectricParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 电费查询参数 9 | */ 10 | @Data 11 | public class LiverElectricParm implements Serializable { 12 | //业主id 13 | private Integer liverId; 14 | 15 | //每页显示的条数 16 | private Long pageSize; 17 | 18 | //当前页码 19 | private Long currentPage; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/LiverParkParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 停车费查询参数 9 | */ 10 | @Data 11 | public class LiverParkParm implements Serializable { 12 | //业主id 13 | private Integer liverId; 14 | 15 | //每页显示的条数 16 | private Long pageSize; 17 | 18 | //当前页码 19 | private Long currentPage; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/LiverParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 业主结果返回 9 | */ 10 | @Data 11 | public class LiverParm implements Serializable { 12 | 13 | //业主姓名 14 | private String liverName; 15 | 16 | //联系电话 17 | private String liverPhone; 18 | 19 | //当前页 20 | private Long currentPage; 21 | 22 | //页容量 23 | private Long pageSize; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/LiverWaterParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 水费查询参数 9 | */ 10 | @Data 11 | public class LiverWaterParm implements Serializable { 12 | 13 | //业主id 14 | private Integer liverId; 15 | 16 | //每页显示的条数 17 | private Long pageSize; 18 | 19 | //当前页码 20 | private Long currentPage; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/LoginParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 登录用户实体类 9 | */ 10 | @Data 11 | public class LoginParm implements Serializable { 12 | 13 | //用户名 14 | private String username; 15 | 16 | //密码 17 | private String password; 18 | 19 | //用户类型 20 | private String userType; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/NoticeParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 公告请求参数 9 | */ 10 | @Data 11 | public class NoticeParm implements Serializable { 12 | 13 | //公告标题 14 | private String noticeTitle; 15 | 16 | //发布人id 17 | private Integer userId; 18 | 19 | //发布人姓名 20 | private String fullName; 21 | 22 | //每页显示的条数 23 | private Long pageSize; 24 | 25 | //当前页码 26 | private Long currentPage; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/ParkParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 停车费分页参数 9 | */ 10 | @Data 11 | public class ParkParm implements Serializable { 12 | //车位名称 13 | private String parkName; 14 | 15 | //业主姓名 16 | private String liverName; 17 | 18 | //每页显示的条数 19 | private Long pageSize; 20 | 21 | //当前页码 22 | private Long currentPage; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/ParkingParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 车位管理分类查询结果返回 7 | */ 8 | @Data 9 | public class ParkingParm { 10 | //车位名称 11 | private String parkName; 12 | 13 | //车位使用状态 0->未使用 1->已使用 14 | private String parkStatus; 15 | 16 | //车位类型 0->地上 1->地下 17 | private String parkType; 18 | 19 | //当前页 20 | private Long currentPage; 21 | 22 | //页容量 23 | private Long pageSize; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/RepairParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 维修查询参数 7 | */ 8 | @Data 9 | public class RepairParm { 10 | 11 | //报修人id 12 | private Integer liverId; 13 | 14 | //报修人姓名 15 | private String liverName; 16 | 17 | //报修内容 18 | private String repairText; 19 | 20 | //每页显示的条数 21 | private Long pageSize; 22 | 23 | //当前页码 24 | private Long currentPage; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/ResetPassParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 重置密码参数类 9 | */ 10 | @Data 11 | public class ResetPassParm implements Serializable { 12 | 13 | //电话号码 14 | private String phone; 15 | 16 | //验证码 17 | private String code; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/RoleAssignParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 分配权限数据回显实体类 9 | */ 10 | @Data 11 | public class RoleAssignParm implements Serializable { 12 | //用户id 13 | private Integer userId; 14 | //角色id 15 | private Integer roleId; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/RoleParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 角色查询实体 9 | */ 10 | @Data 11 | public class RoleParm implements Serializable { 12 | //每页显示的条数 13 | private Long pageSize; 14 | 15 | //当前页码 16 | private Long currentPage; 17 | 18 | //角色名称 19 | private String roleName; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/RolePermissionParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | /** 9 | * 权限保存实体类 10 | */ 11 | @Data 12 | public class RolePermissionParm implements Serializable { 13 | private Integer roleId; 14 | List list; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/UnitParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *单元列表查询实体 7 | */ 8 | @Data 9 | public class UnitParm { 10 | 11 | //楼宇名称 12 | private String buildingName; 13 | 14 | //单元名称 15 | private String unitName; 16 | 17 | //每页显示的条数 18 | private Long pageSize; 19 | 20 | //当前页码 21 | private Long currentPage; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/UserParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 工作人员列表查询实体 9 | */ 10 | @Data 11 | public class UserParm implements Serializable { 12 | 13 | //每页显示的条数 14 | private Long pageSize; 15 | 16 | //当前页码 17 | private Long currentPage; 18 | 19 | //真实姓名 20 | private String fullName; 21 | 22 | //电话 23 | private String phoneNumber; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/parm/WaterParm.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.parm; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 水费分页参数 9 | */ 10 | @Data 11 | public class WaterParm implements Serializable { 12 | 13 | //房屋编号 14 | private String houseNum; 15 | 16 | //业主姓名 17 | private String liverName; 18 | 19 | //每页显示的条数 20 | private Long pageSize; 21 | 22 | //当前页码 23 | private Long currentPage; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Building.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 楼宇实体 13 | */ 14 | @Data 15 | @TableName("house_building") 16 | public class Building implements Serializable { 17 | 18 | //主键 19 | @TableId(type = IdType.AUTO) 20 | private Integer buildingId; 21 | 22 | //楼宇类型 0:普通房 1:电梯房 23 | private String buildingType; 24 | 25 | //楼宇名称 26 | private String buildingName; 27 | 28 | //序号 29 | private Integer buildingNumber; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/ChangePassword.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 修改密码实体类 9 | */ 10 | @Data 11 | public class ChangePassword implements Serializable { 12 | 13 | private Integer userId; 14 | 15 | //旧密码 16 | private String oldPassword; 17 | 18 | //新密码 19 | private String newPassword; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/CommunityInfo.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | *小区基本信息实体类 13 | */ 14 | @Data 15 | @TableName("comm_info") 16 | public class CommunityInfo implements Serializable { 17 | 18 | //主键递增 19 | @TableId(type = IdType.AUTO) 20 | private Integer id; 21 | 22 | //小区名称 23 | private String commName; 24 | 25 | //小区负责人 26 | private String commMan; 27 | 28 | //建成日期 29 | private String createTime; 30 | 31 | //楼宇数量 32 | private Integer buildNum; 33 | 34 | //小区地址 35 | private String commAdr; 36 | 37 | //联系电话 38 | private String phoneNumber; 39 | 40 | //建筑面积(亩) 41 | private Integer commArea; 42 | 43 | //绿化面积(亩) 44 | private Integer greenArea; 45 | 46 | //道路面积(亩) 47 | private Integer roadArea; 48 | 49 | //停车场面积(亩) 50 | private Integer stopArea; 51 | 52 | //小区简介 53 | private String commInfo; 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Complaint.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 维权实体类 14 | */ 15 | @Data 16 | @TableName("def_complaint") 17 | public class Complaint implements Serializable { 18 | 19 | //主键 20 | @TableId(type = IdType.AUTO) 21 | private Integer complaintId; 22 | 23 | //投诉人id(业主id) 24 | private Integer liverId; 25 | 26 | //投诉标题 27 | private String complaintTitle; 28 | 29 | //投诉内容 30 | private String complaintText; 31 | 32 | //投诉时间 33 | private Date complaintTime; 34 | 35 | //处理状态 0:未处理 1:已处理 36 | private String sloveStatus; 37 | 38 | //处理回复 39 | private String complaintReply; 40 | 41 | //投诉人姓名 42 | @TableField(exist = false) 43 | private String liverName; 44 | 45 | //投诉人联系方式 46 | @TableField(exist = false) 47 | private String liverPhone; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Electric.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | /** 14 | * 电费实体类 15 | */ 16 | @Data 17 | @TableName("pay_electric") 18 | public class Electric implements Serializable { 19 | 20 | //主键 21 | @TableId(type = IdType.AUTO) 22 | private Integer electricId; 23 | 24 | //业主id 25 | private Integer liverId; 26 | 27 | //房屋id 28 | private Integer houseId; 29 | 30 | //缴费年月 31 | private String electricDate; 32 | 33 | //缴费金额 34 | private BigDecimal electricMoney; 35 | 36 | //用电额度 37 | private String electricNum; 38 | 39 | //缴费状态 0:未缴费 1:已缴费 40 | private String electricStatus; 41 | 42 | //缴费时间 43 | private Date electricTime; 44 | 45 | //业主姓名 46 | @TableField(exist = false) 47 | private String liverName; 48 | 49 | //业主电话 50 | @TableField(exist = false) 51 | private String liverPhone; 52 | 53 | //房屋编号 54 | @TableField(exist = false) 55 | private String houseNum; 56 | 57 | //单元id 58 | @TableField(exist = false) 59 | private Integer unitId; 60 | 61 | //单元名称 62 | @TableField(exist = false) 63 | private String unitName; 64 | 65 | //楼宇id 66 | @TableField(exist = false) 67 | private Integer buildingId; 68 | 69 | //楼宇名称 70 | @TableField(exist = false) 71 | private String buildingName; 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Facilities.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 小区周边设施实体类 12 | */ 13 | @Data 14 | @TableName("comm_facilities") 15 | public class Facilities implements Serializable { 16 | 17 | //设置主键自增 18 | @TableId(type = IdType.AUTO) 19 | private Integer faId; 20 | 21 | //设施名称 22 | private String faName; 23 | 24 | //负责人 25 | private String faPerson; 26 | 27 | //联系电话 28 | private Long phoneNumber; 29 | 30 | //简介 31 | private String faText; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/House.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 房屋实体 13 | */ 14 | @Data 15 | @TableName("house_list") 16 | public class House implements Serializable { 17 | 18 | //房屋id 19 | @TableId(type = IdType.AUTO) 20 | private Integer houseId; 21 | 22 | //楼宇id 23 | @TableField(exist = false) 24 | private Long buildingId; 25 | 26 | //单元id 27 | private Integer unitId; 28 | 29 | //房屋编号 30 | private String houseNum; 31 | 32 | //楼宇名称 33 | @TableField(exist = false) 34 | private String buildingName; 35 | 36 | //单元名称 37 | @TableField(exist = false) 38 | private String unitName; 39 | 40 | //房屋面积 41 | private String houseArea; 42 | 43 | //使用状态0:未使用 1:已使用 44 | private String houseStatus; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Liver.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import org.springframework.security.core.GrantedAuthority; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | 11 | import java.io.Serializable; 12 | import java.util.Collection; 13 | 14 | /** 15 | * 业主实体 16 | */ 17 | @Data 18 | @TableName("liver_user") 19 | public class Liver implements UserDetails,Serializable { 20 | 21 | //业主id 22 | @TableId(type = IdType.AUTO) 23 | private Integer liverId; 24 | 25 | //业主姓名 26 | private String liverName; 27 | 28 | //业主电话 29 | private String liverPhone; 30 | 31 | //业主性别 0:男 1:女 32 | private String liverSex; 33 | 34 | //登录账号 35 | private String username; 36 | 37 | //登录密码 38 | private String password; 39 | 40 | //账号状态 0:启用 1:禁用 41 | private String liverStatus; 42 | 43 | //角色id 44 | @TableField(exist = false) 45 | private Integer roleId; 46 | 47 | //房屋id 48 | @TableField(exist = false) 49 | private Integer houseId; 50 | 51 | //房屋序号 52 | @TableField(exist = false) 53 | private String houseNum; 54 | 55 | //房屋面积 56 | @TableField(exist = false) 57 | private String houseArea; 58 | 59 | //单元名称 60 | @TableField(exist = false) 61 | private String unitName; 62 | 63 | //楼宇名称 64 | @TableField(exist = false) 65 | private String buildingName; 66 | 67 | //车位id 68 | @TableField(exist = false) 69 | private Integer parkId; 70 | 71 | //车位名称 72 | @TableField(exist = false) 73 | private String parkName; 74 | 75 | //业主房屋状态 76 | @TableField(exist = false) 77 | private String liverHouseStatus; 78 | 79 | //业主车位状态 80 | @TableField(exist = false) 81 | private String liverParkingStatus; 82 | 83 | //下面的字段,属于spring security的UserDetails的字段 84 | //帐户是否过期(1 未过期,0已过期) 85 | private boolean isAccountNonExpired = true; 86 | //帐户是否被锁定(1 未锁定,0已锁定) 87 | private boolean isAccountNonLocked = true; 88 | //密码是否过期(1 未过期,0已过期) 89 | private boolean isCredentialsNonExpired = true; 90 | //帐户是否可用(1 可用,0 删除用户) 91 | private boolean isEnabled = true; 92 | //由于authorities不是数据库里面的字段,所以要排除他,不然mybatis-plus找不到该字段会报错 93 | @TableField(exist = false) 94 | Collection authorities; 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/LiverAndHouse.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | /** 9 | * 业主和房屋实体 10 | */ 11 | @Data 12 | @TableName("liver_house") 13 | public class LiverAndHouse { 14 | 15 | //主键 16 | @TableId(type = IdType.AUTO) 17 | private Integer liverHouseId; 18 | 19 | //业主id 20 | private Integer liverId; 21 | 22 | //房屋id 23 | private Integer houseId; 24 | 25 | //使用状态 0:入住 1:退房 26 | private String liverHouseStatus; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/LiverAndParking.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 业主和车位实体 12 | */ 13 | @Data 14 | @TableName("liver_parking") 15 | public class LiverAndParking implements Serializable { 16 | 17 | //主键 18 | @TableId(type = IdType.AUTO) 19 | private Integer liverParkingId; 20 | 21 | //业主id 22 | private Integer liverId; 23 | 24 | //车位id 25 | private Integer parkId; 26 | 27 | //使用状态 0:使用中 1:解绑 28 | private String liverParkingStatus; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/LiverAndRole.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 业主角色实体 12 | */ 13 | @Data 14 | @TableName("liver_role") 15 | public class LiverAndRole implements Serializable { 16 | 17 | //主键 18 | @TableId(type = IdType.AUTO) 19 | private Integer liverRoleId; 20 | 21 | //业主id 22 | private Integer liverId; 23 | 24 | //角色id 25 | private Integer roleId; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Menu.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * 菜单实体类 15 | */ 16 | 17 | @Data 18 | @TableName("tb_menu") 19 | public class Menu implements Serializable { 20 | 21 | //主键 22 | @TableId(type = IdType.AUTO) 23 | private Integer menuId; 24 | 25 | //父级菜单id 26 | private Integer parentId; 27 | 28 | //菜单名称 29 | private String menuLabel; 30 | 31 | //权限字段 32 | private String menuCode; 33 | 34 | //路由名称 35 | private String routeName; 36 | 37 | //路由地址 38 | private String routePath; 39 | 40 | //组件路径 41 | private String routeUrl; 42 | 43 | //菜单类型 0:目录 1:菜单 2:按钮 44 | private String type; 45 | 46 | //图标 47 | private String icon; 48 | 49 | //序号 50 | private Integer orderNum; 51 | 52 | //描述 53 | private String description; 54 | 55 | //上级菜单名称 56 | private String parentName; 57 | 58 | //不属于数据库表中的字段,需要排除 59 | @TableField(exist = false) 60 | private List children = new ArrayList<>(); 61 | 62 | //菜单是否展开 63 | @TableField(exist = false) 64 | private Boolean open; 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Notice.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 公告实体类 14 | */ 15 | @Data 16 | @TableName("comm_notice") 17 | public class Notice implements Serializable { 18 | 19 | //主键 20 | @TableId(type= IdType.AUTO) 21 | private Integer noticeId; 22 | 23 | //物业人员id 24 | private Integer userId; 25 | 26 | //公告标题 27 | private String noticeTitle; 28 | 29 | //公告内容 30 | private String noticeText; 31 | 32 | //发布时间 33 | private Date noticeTime; 34 | 35 | //发布人姓名 36 | @TableField(exist = false) 37 | private String fullName; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Park.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | /** 14 | * 停车费实体 15 | */ 16 | @Data 17 | @TableName("pay_parking") 18 | public class Park implements Serializable { 19 | 20 | //主键 21 | @TableId(type = IdType.AUTO) 22 | private Integer parkingId; 23 | 24 | //业主id 25 | private Integer liverId; 26 | 27 | //车位id 28 | private Integer parkId; 29 | 30 | //缴费年月 31 | private String parkingDate; 32 | 33 | //缴费金额 34 | private BigDecimal parkingMoney; 35 | 36 | //缴费状态 0:未缴费 1:已缴费 37 | private String parkingStatus; 38 | 39 | //缴费时间 40 | private Date parkingTime; 41 | 42 | //业主姓名 43 | @TableField(exist = false) 44 | private String liverName; 45 | 46 | //业主电话 47 | @TableField(exist = false) 48 | private String liverPhone; 49 | 50 | //车位名称 51 | @TableField(exist = false) 52 | private String parkName; 53 | 54 | //车位类型(0地上 1地下) 55 | @TableField(exist = false) 56 | private String parkType; 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Parking.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 车位实体 12 | */ 13 | @Data 14 | @TableName("parking_list") 15 | public class Parking implements Serializable { 16 | 17 | //车位id 18 | @TableId(type = IdType.AUTO) 19 | private Integer parkId; 20 | 21 | //车位类型 0->地上 1->地下 22 | private String parkType; 23 | 24 | //车位名称 25 | private String parkName; 26 | 27 | //车位使用状态 0->未使用 1->已使用 28 | private String parkStatus; 29 | 30 | //车位序号 31 | private Integer parkNumber; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Repair.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | @Data 13 | @TableName("def_repair") 14 | public class Repair implements Serializable { 15 | 16 | //主键 17 | @TableId(type = IdType.AUTO) 18 | private Integer repairId; 19 | 20 | //报修业主id 21 | private Integer liverId; 22 | 23 | //维修地址 24 | private String repairPlace; 25 | 26 | //维修内容 27 | private String repairText; 28 | 29 | //报修时间 30 | private Date repairTime; 31 | 32 | //维修状态 0:未维修 1:已维修 33 | private String repairStatus; 34 | 35 | //报修人姓名 36 | @TableField(exist = false) 37 | private String liverName; 38 | 39 | //报修人联系方式 40 | @TableField(exist = false) 41 | private String liverPhone; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Role.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 角色实体类 12 | */ 13 | @Data 14 | @TableName("tb_role") 15 | public class Role implements Serializable { 16 | 17 | //角色ID 18 | @TableId(type = IdType.AUTO) 19 | private Integer roleId; 20 | 21 | //角色名称 22 | private String roleName; 23 | 24 | //角色描述 25 | private String roleDescription; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/RoleAndMenu.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 角色权限实体类 12 | */ 13 | @Data 14 | @TableName("tb_role_menu") 15 | public class RoleAndMenu implements Serializable { 16 | 17 | //主键 18 | @TableId(type = IdType.AUTO) 19 | private Integer roleMenuId; 20 | 21 | //角色id 22 | private Integer roleId; 23 | 24 | //菜单id 25 | private Integer menuId; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Unit.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | 11 | @Data 12 | @TableName("house_unit") 13 | public class Unit implements Serializable { 14 | 15 | //单元id 16 | @TableId(type= IdType.AUTO) 17 | private Integer unitId; 18 | 19 | //楼宇id 20 | private Integer buildingId; 21 | 22 | //单元名称 23 | private String unitName; 24 | 25 | //楼宇名称 26 | @TableField(exist = false) 27 | private String buildingName; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import org.springframework.security.core.GrantedAuthority; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | 11 | import java.io.Serializable; 12 | import java.util.Collection; 13 | 14 | /** 15 | * 用户实体类 16 | */ 17 | @Data 18 | @TableName("tb_user") 19 | public class User implements UserDetails,Serializable { 20 | 21 | //设置主键自增 22 | @TableId(type = IdType.AUTO) 23 | private Integer userId; 24 | 25 | //登录账户 26 | private String username; 27 | 28 | //用户真实姓名 29 | private String fullName; 30 | 31 | //密码 32 | private String password; 33 | 34 | //帐号状态(0正常 1停用) 35 | private String isStatus; 36 | 37 | //联系电话 38 | private String phoneNumber; 39 | 40 | //是否是管理员 0->不是 1->是 41 | private String isAdmin; 42 | 43 | //下面属于spring security的UserDetails的字段 44 | //帐户是否过期(1 未过期,0已过期) 45 | private boolean isAccountNonExpired = true; 46 | //帐户是否被锁定(1 未锁定,0已锁定) 47 | private boolean isAccountNonLocked = true; 48 | //密码是否过期(1 未过期,0已过期) 49 | private boolean isCredentialsNonExpired = true; 50 | //帐户是否可用(1 可用,0 删除用户) 51 | private boolean isEnabled = true; 52 | //由于authorities不是数据库里面的字段,所以要排除他,不然mybatis-plus找不到该字段会报错 53 | @TableField(exist = false) 54 | Collection authorities; 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/UserAndRole.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | @Data 11 | @TableName("tb_user_role") 12 | public class UserAndRole implements Serializable { 13 | 14 | //设置主键自增 15 | @TableId(type = IdType.AUTO) 16 | private Integer userRoleId; 17 | 18 | //角色id 19 | private Integer roleId; 20 | 21 | //用户id 22 | private Integer userId; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | *登录获取用户信息实体类 9 | */ 10 | 11 | @Data 12 | public class UserInfo implements Serializable { 13 | 14 | //用户id 15 | private Integer id; 16 | 17 | //用户名 18 | private String name; 19 | 20 | //头像 21 | private String avatar; 22 | 23 | //介绍 24 | private String introduction; 25 | 26 | //权限集合 27 | private Object[] roles; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/pojo/Water.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | /** 14 | * 水费实体 15 | */ 16 | @Data 17 | @TableName("pay_water") 18 | public class Water implements Serializable { 19 | //主键 20 | @TableId(type = IdType.AUTO) 21 | private Integer waterId; 22 | 23 | //业主id 24 | private Integer liverId; 25 | 26 | //房屋id 27 | private Integer houseId; 28 | 29 | //缴费年月 30 | private String waterDate; 31 | 32 | //缴费金额 33 | private BigDecimal waterMoney; 34 | 35 | //用水额度 36 | private String waterNum; 37 | 38 | //缴费状态 0:未缴费 1:已缴费 39 | private String waterStatus; 40 | 41 | //缴费时间 42 | private Date waterTime; 43 | 44 | //业主姓名 45 | @TableField(exist = false) 46 | private String liverName; 47 | 48 | //业主电话 49 | @TableField(exist = false) 50 | private String liverPhone; 51 | 52 | //房屋编号 53 | @TableField(exist = false) 54 | private String houseNum; 55 | 56 | //单元id 57 | @TableField(exist = false) 58 | private Integer unitId; 59 | 60 | //单元名称 61 | @TableField(exist = false) 62 | private String unitName; 63 | 64 | //楼宇id 65 | @TableField(exist = false) 66 | private Integer buildingId; 67 | 68 | //楼宇名称 69 | @TableField(exist = false) 70 | private String buildingName; 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/status/StatusCode.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.status; 2 | 3 | /** 4 | * 返回状态码 5 | */ 6 | public class StatusCode { 7 | //返回成功 8 | public static final int SUCCESS_CODE = 200; 9 | 10 | //服务端错误 11 | public static final int ERROR_CODE = 500; 12 | 13 | //未登录 14 | public static final int NO_LOGIN = 600; 15 | 16 | //无权限 17 | public static final int NO_AUTH = 700; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/vo/LoginResult.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 用户登录结果实体类 9 | */ 10 | @Data 11 | public class LoginResult implements Serializable { 12 | 13 | //用户ID 14 | private Integer userId; 15 | 16 | //token 17 | private String token; 18 | 19 | //token过期时间 20 | private Long lostTime; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/vo/ResultVo.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | @Data 7 | @AllArgsConstructor 8 | /** 9 | * 返回结果类 10 | */ 11 | public class ResultVo { 12 | private Integer code; //状态码 13 | private String msg; //提示消息 14 | private T data; //返回数据 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/vo/RolePermissionVo.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.vo; 2 | 3 | import com.cc.domain.pojo.Menu; 4 | import lombok.Data; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * 权限回显结果实体 11 | */ 12 | @Data 13 | public class RolePermissionVo { 14 | //当前登录系统用户的菜单数据 15 | List listMenu = new ArrayList<>(); 16 | //原来分配的菜单 17 | private Object[] checkList; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/domain/vo/RouterVO.java: -------------------------------------------------------------------------------- 1 | package com.cc.domain.vo; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonInclude; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | //路由需要的数据格式 12 | @Data 13 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 14 | public class RouterVO { 15 | private String path; 16 | 17 | private String component; 18 | 19 | private boolean alwaysShow; 20 | 21 | private String name; 22 | 23 | private Meta meta; 24 | 25 | @Data 26 | @AllArgsConstructor 27 | public class Meta { 28 | private String title; 29 | private String icon; 30 | private Object[] roles; 31 | } 32 | private List children =new ArrayList<>(); 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/BuildingMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.Building; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 楼宇DAO层 9 | */ 10 | @Repository 11 | public interface BuildingMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/CommunityInfoMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.cc.mapper; 3 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import com.cc.domain.pojo.CommunityInfo; 6 | import org.springframework.stereotype.Repository; 7 | 8 | /** 9 | * 小区基本信息DAO层 10 | */ 11 | @Repository 12 | public interface CommunityInfoMapper extends BaseMapper { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/ComplaintMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Complaint; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 投诉DAO层 13 | */ 14 | @Repository 15 | public interface ComplaintMapper extends BaseMapper { 16 | 17 | //分页查询 18 | IPage getList(IPage page,@Param("complaintTitle") String complaintTitle); 19 | 20 | //根据月份查询投诉数量 21 | Integer findComCountByMonths(@Param("beforeDate") String beforeDate,@Param("afterDate") String afterDate); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/ElectricMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Electric; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 电费管理DAO层 11 | */ 12 | @Repository 13 | public interface ElectricMapper extends BaseMapper { 14 | 15 | //分页查询 16 | IPage getElectricList(IPage page, @Param("liverName") String liverName,@Param("houseNum")String houseNum); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/FacilitiesMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Facilities; 6 | import org.springframework.stereotype.Repository; 7 | 8 | /** 9 | * 小区周边设施DAO层 10 | */ 11 | @Repository 12 | public interface FacilitiesMapper extends BaseMapper { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/HouseMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.House; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 房屋DAO层 14 | */ 15 | @Repository 16 | public interface HouseMapper extends BaseMapper { 17 | 18 | //分页查询 19 | IPage getList(IPage page, @Param("buildingName") String buildingName,@Param("unitName") String unitName,@Param("houseNum") String houseNum,@Param("houseStatus") String houseStatus); 20 | 21 | //查询每栋楼宇的住户的数量 22 | List> getLiverCount(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/LiverAndHouseMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.LiverAndHouse; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 业主房屋DAO层 9 | */ 10 | @Repository 11 | public interface LiverAndHouseMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/LiverAndParkingMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.LiverAndParking; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 业主车位DAO层 9 | */ 10 | @Repository 11 | public interface LiverAndParkingMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/LiverAndRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.LiverAndRole; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 业主角色DAO层 9 | */ 10 | @Repository 11 | public interface LiverAndRoleMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/LiverMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Liver; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 业主DAO层 11 | */ 12 | @Repository 13 | public interface LiverMapper extends BaseMapper { 14 | 15 | //分页查询 16 | IPage getLiverList(IPage page, @Param("liverName")String liverName,@Param("liverPhone")String liverPhone); 17 | 18 | //编辑业主时的查询 19 | Liver getLiver(@Param("liverId")Integer liverId); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.Menu; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 菜单DAO层 12 | */ 13 | @Repository 14 | public interface MenuMapper extends BaseMapper { 15 | 16 | //根据用户id查询权限 17 | List getMenuByUserId(@Param("userId") Integer userId); 18 | 19 | //根据业主id查询权限 20 | List getMenuByLiverId(@Param("liverId") Integer liverId); 21 | 22 | //根据角色id查询权限 23 | List getMenuByRoleId(@Param("roleId") Integer roleId); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/NoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Notice; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 公告DAO层 11 | */ 12 | @Repository 13 | public interface NoticeMapper extends BaseMapper { 14 | 15 | //分页查询 16 | IPage getList(IPage page,@Param("fullName")String fullName,@Param("noticeTitle")String noticeTitle); 17 | 18 | //首页分页查询 19 | IPage getIndexNoticeList(IPage page); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/ParkMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Park; 6 | import com.cc.domain.pojo.Water; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | /** 11 | * 停车费管理DAO层 12 | */ 13 | @Repository 14 | public interface ParkMapper extends BaseMapper { 15 | 16 | //分页查询 17 | IPage getParkList(IPage page, @Param("liverName")String liverName,@Param("parkName")String parkName); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/ParkingMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.Parking; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 车位管理DAO层 9 | */ 10 | @Repository 11 | public interface ParkingMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/RepairMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Repair; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 维修管理DAO层 11 | */ 12 | @Repository 13 | public interface RepairMapper extends BaseMapper { 14 | 15 | //维修列表分页查询 16 | IPage getList(IPage page, @Param("liverName") String liverName); 17 | 18 | //每月报修柱形图 19 | Integer findRepCountByMonths(@Param("beforeDate") String beforeDate, @Param("afterDate") String afterDate); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/RoleAndMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.RoleAndMenu; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 角色权限DAO 12 | */ 13 | @Repository 14 | public interface RoleAndMenuMapper extends BaseMapper { 15 | 16 | //保存权限 17 | boolean saveRoleMenu(@Param("roleId") Integer roleId,@Param("menuIds")List menuIds); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.Role; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 角色DAO层 9 | */ 10 | @Repository 11 | public interface RoleMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/UnitMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Unit; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 单元DAO层 11 | */ 12 | @Repository 13 | public interface UnitMapper extends BaseMapper { 14 | 15 | //分页查询 16 | IPage getList(IPage page, @Param("unitName")String unitName,@Param("buildingName")String buildingName); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/UserAndRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.UserAndRole; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 角色-用户DAO层 9 | */ 10 | @Repository 11 | public interface UserAndRoleMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.User; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 用户登录DAO层 9 | */ 10 | @Repository 11 | public interface UserMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/WaterMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.cc.domain.pojo.Water; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * 水费管理DAO层 11 | */ 12 | @Repository 13 | public interface WaterMapper extends BaseMapper { 14 | 15 | //分页查询 16 | IPage getWaterList(IPage page, @Param("liverName") String liverName, @Param("houseNum")String houseNum); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cc/mapper/WorkerMapper.java: -------------------------------------------------------------------------------- 1 | package com.cc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.cc.domain.pojo.User; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 物业人员DAO层 9 | */ 10 | @Repository 11 | public interface WorkerMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/BuildingService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.Building; 6 | import com.cc.domain.parm.BuildingParm; 7 | 8 | /** 9 | * 楼宇service层 10 | */ 11 | public interface BuildingService extends IService { 12 | 13 | //分页查询楼宇信息 14 | IPage getList(BuildingParm buildingParm); 15 | 16 | //删除楼宇 17 | boolean deleteBuilding(Integer buildingId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/CommunityInfoService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.CommunityInfo; 5 | 6 | /** 7 | * 小区基本信息service层 8 | */ 9 | public interface CommunityInfoService extends IService { 10 | 11 | //修改小区基本信息 12 | boolean updateInfo(CommunityInfo communityInfo); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/ComplaintService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.ComplaintParm; 6 | import com.cc.domain.pojo.Complaint; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * 投诉service层 12 | */ 13 | public interface ComplaintService extends IService { 14 | 15 | //分页查询 16 | IPage getComplaintList(ComplaintParm complaintParm); 17 | 18 | //添加 19 | boolean saveComplaint(Complaint complaint); 20 | 21 | //编辑 22 | boolean updateComplaint(Complaint complaint); 23 | 24 | //删除 25 | boolean removeComplaint(Integer complaintId); 26 | 27 | //我的投诉 28 | IPage getMyComplaintList(ComplaintParm complaintParm); 29 | 30 | //处理投诉 31 | boolean sloveComplaint(Complaint complaint); 32 | 33 | //投诉折线图 34 | Map listforMonths(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/ElectricService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.LiverElectricParm; 6 | import com.cc.domain.pojo.Electric; 7 | import com.cc.domain.parm.ElectricParm; 8 | 9 | /** 10 | * 电费管理Service层 11 | */ 12 | public interface ElectricService extends IService { 13 | 14 | //新增 15 | boolean saveElectric(Electric electric); 16 | 17 | //编辑 18 | boolean updateElectric(Electric electric); 19 | 20 | //删除 21 | boolean removeElectricById(Integer electricId); 22 | 23 | //分页查询 24 | IPage getList(ElectricParm electricParm); 25 | 26 | //电费记录查询 27 | IPage getLiverElectricList(LiverElectricParm liverElectricParm); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/FacilitiesService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import com.cc.domain.parm.FacilitiesParm; 7 | import com.cc.domain.pojo.Facilities; 8 | 9 | /** 10 | * 小区周边设施service层 11 | */ 12 | public interface FacilitiesService extends IService { 13 | 14 | //添加设施 15 | boolean saveFacilities(Facilities facilities); 16 | 17 | //分页查询 18 | IPage getList(FacilitiesParm facilitiesParm); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/HouseService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.House; 6 | import com.cc.domain.parm.HouseParm; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * 房屋service 13 | */ 14 | public interface HouseService extends IService { 15 | 16 | //分页查询 17 | IPage getList(HouseParm parm); 18 | 19 | //根据单元id获取房屋列表 20 | List getHouseList(House house); 21 | 22 | //删除 23 | boolean removeHouse(Integer houseId); 24 | 25 | //入住率饼形图 26 | Map getHouseLiveStatus(); 27 | 28 | //小区人数统计饼形图 29 | Map getAllLiverCount(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/LiverAndRoleService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.LiverAndRole; 5 | 6 | /** 7 | * 业主角色service层 8 | */ 9 | public interface LiverAndRoleService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/LiverService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.ResetPassParm; 6 | import com.cc.domain.pojo.Liver; 7 | import com.cc.domain.pojo.LiverAndParking; 8 | import com.cc.domain.parm.AssignHouseParm; 9 | 10 | /** 11 | * 业主service层 12 | */ 13 | public interface LiverService extends IService { 14 | 15 | //添加 16 | boolean saveLiverAndRole(Liver liver); 17 | 18 | //分页查询 19 | IPage getLiverList(IPage page,String liverName,String liverPhone); 20 | 21 | //编辑 22 | boolean editLiver(Liver liver); 23 | 24 | //编辑时的查询 25 | Liver getLiver(Integer liverId); 26 | 27 | //分配房屋 28 | boolean assignHouse(AssignHouseParm assignHouseParm); 29 | 30 | //分配车位 31 | boolean assignPark(LiverAndParking liverAndParking); 32 | 33 | //退房 34 | boolean returnHouse(AssignHouseParm assignHouseParm); 35 | 36 | //退车位 37 | boolean returnParking(LiverAndParking liverAndParking); 38 | 39 | //根据用户名查询用户信息 40 | Liver loadUser(String username); 41 | 42 | //删除业主 43 | boolean removeLiver(Integer liverId); 44 | 45 | //发送短信 46 | void sendMessage(String phoneNum); 47 | 48 | //重置密码 49 | boolean resetPass(ResetPassParm resetPassParm); 50 | 51 | //查询手机号是否绑定业主 52 | boolean findByPhone(String parmPhone); 53 | 54 | //添加和修改时查询手机号是否已被占用 55 | boolean PhoneIsExist(String liverPhone); 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/MenuService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.Menu; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 菜单Service层 10 | */ 11 | public interface MenuService extends IService { 12 | 13 | //父级菜单的查询 14 | List getParentList(); 15 | 16 | //查询菜单列表 17 | List getMenuList(); 18 | 19 | //删除菜单 20 | boolean deleteMenu(Integer menuId); 21 | 22 | //根据用户id查询权限 23 | List getMenuByUserId(Integer userId); 24 | 25 | //根据业主id查询权限 26 | List getMenuByLiverId(Integer liverId); 27 | 28 | //根据角色id查询权限 29 | List getMenuByRoleId(Integer roleId); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/NoticeService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.IndexNoticeParm; 6 | import com.cc.domain.parm.NoticeParm; 7 | import com.cc.domain.pojo.Notice; 8 | 9 | /** 10 | * 公告service层 11 | */ 12 | public interface NoticeService extends IService { 13 | 14 | //分页查询 15 | IPage getList(NoticeParm noticeParm); 16 | 17 | //添加 18 | boolean saveNotice(Notice notice); 19 | 20 | //首页公告分页查询 21 | IPage getIndexNoticeList(IndexNoticeParm indexNoticeParm); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/ParkService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.LiverParkParm; 6 | import com.cc.domain.parm.ParkParm; 7 | import com.cc.domain.pojo.Park; 8 | 9 | /** 10 | * 停车费service层 11 | */ 12 | public interface ParkService extends IService { 13 | 14 | //新增 15 | boolean addPayPark(Park park); 16 | 17 | //编辑 18 | boolean editPayPark(Park park); 19 | 20 | //删除 21 | boolean deletePayPark(Integer parkingId); 22 | 23 | //分页查询 24 | IPage getList(ParkParm parkParm); 25 | 26 | //停车费记录查询 27 | IPage getLiverParkList(LiverParkParm liverParkParm); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/ParkingService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.Parking; 6 | import com.cc.domain.parm.ParkingParm; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * 车位管理service 12 | */ 13 | public interface ParkingService extends IService { 14 | 15 | //分页查询 16 | IPage getList(ParkingParm parkingParm); 17 | 18 | //删除车位 19 | boolean removeParking(Integer parkId); 20 | 21 | //小区车位使用情况饼形图 22 | Map getParkStatus(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/RepairService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import com.cc.domain.parm.RepairParm; 7 | import com.cc.domain.pojo.Repair; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * 维修管理Service层 13 | */ 14 | public interface RepairService extends IService { 15 | 16 | //维修列表分页查询 17 | IPage getRepairList(RepairParm repairParm); 18 | 19 | //添加 20 | boolean saveRepair(Repair repair); 21 | 22 | //编辑 23 | boolean updateRepair(Repair repair); 24 | 25 | //删除 26 | boolean removeRepair(Integer repairId); 27 | 28 | //我的报修 29 | IPage getMyRepairList(RepairParm repairParm); 30 | 31 | //处理报修 32 | boolean sloveRepair(Repair repair); 33 | 34 | //每月报修柱形图 35 | Map listForMonths(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/RoleAndMenuService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.RoleAndMenu; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 角色菜单Service 10 | */ 11 | public interface RoleAndMenuService extends IService { 12 | 13 | //保存权限 14 | void saveRoleMenu(Integer roleId, List menuIds); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.Role; 6 | import com.cc.domain.parm.RoleAssignParm; 7 | import com.cc.domain.parm.RoleParm; 8 | import com.cc.domain.parm.RolePermissionParm; 9 | import com.cc.domain.vo.RolePermissionVo; 10 | 11 | /** 12 | * 角色service层 13 | */ 14 | public interface RoleService extends IService { 15 | 16 | //分页查询角色列表 17 | IPage list(RoleParm parm); 18 | 19 | //删除角色 20 | boolean removeRole(Integer roleId); 21 | 22 | //分配权限回显 23 | RolePermissionVo getAssignTree(RoleAssignParm roleAssignParm); 24 | 25 | //分配权限保存 26 | void saveAssign(RolePermissionParm rolePermissionParm); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/UnitService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.Unit; 6 | import com.cc.domain.parm.UnitParm; 7 | 8 | /** 9 | * 单元service 10 | */ 11 | public interface UnitService extends IService { 12 | 13 | //查询单元列表 14 | IPage getList(UnitParm unitParm); 15 | 16 | //删除单元 17 | boolean removeUnit(Integer unitId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/UserAndRoleService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.UserAndRole; 5 | 6 | /** 7 | * 用户-角色service层 8 | */ 9 | public interface UserAndRoleService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.cc.domain.pojo.ChangePassword; 5 | import com.cc.domain.pojo.UserAndRole; 6 | import com.cc.domain.parm.LoginParm; 7 | import com.cc.domain.vo.LoginResult; 8 | import com.cc.domain.pojo.User; 9 | import com.cc.domain.pojo.UserInfo; 10 | import com.cc.domain.vo.RouterVO; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.util.List; 15 | 16 | /** 17 | * 用户登录service层 18 | */ 19 | public interface UserService extends IService { 20 | 21 | //用户登录 22 | LoginResult loginUser(LoginParm loginParm); 23 | 24 | //获取用户信息 25 | UserInfo getUserInfo(User user,HttpServletRequest request); 26 | 27 | //根据用户id查询角色id 28 | UserAndRole getRoleByUserId(UserAndRole userAndRole); 29 | 30 | //保存角色 31 | void saveRole(UserAndRole userAndRole); 32 | 33 | //根据登录名查询用户信息 34 | User loadUser(String username); 35 | 36 | //获取菜单列表 37 | List getMenu(HttpServletRequest request); 38 | 39 | //退出登录 40 | boolean quitUser(HttpServletRequest request, HttpServletResponse response); 41 | 42 | //修改密码 43 | boolean resetPass(ChangePassword user, HttpServletRequest request); 44 | 45 | //判断当前账户状态 46 | boolean isStatus(LoginParm loginParm); 47 | } -------------------------------------------------------------------------------- /src/main/java/com/cc/service/WaterService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.parm.LiverWaterParm; 6 | import com.cc.domain.parm.WaterParm; 7 | import com.cc.domain.pojo.Water; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 水费管理Service层 13 | */ 14 | public interface WaterService extends IService { 15 | 16 | //新增 17 | boolean saveWater(Water water); 18 | 19 | //编辑 20 | boolean updateWater(Water water); 21 | 22 | //删除 23 | boolean removeWaterById(Integer waterId); 24 | 25 | //分页查询 26 | IPage getList(WaterParm waterParm); 27 | 28 | //水费记录查询 29 | IPage getLiverWaterList(LiverWaterParm liverWaterParm); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/WorkerService.java: -------------------------------------------------------------------------------- 1 | package com.cc.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.cc.domain.pojo.User; 6 | import com.cc.domain.parm.UserParm; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 物业人员service层 12 | */ 13 | public interface WorkerService extends IService { 14 | 15 | //分页查询物业人员列表 16 | IPage list(UserParm parm); 17 | 18 | //新增物业人员 19 | boolean saveWorker(User user); 20 | 21 | //编辑物业人员 22 | boolean updateWorker(User user); 23 | 24 | //删除员工 25 | boolean removeWorker(Integer userId); 26 | 27 | //首页物业员工列表 28 | List getAllWorker(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/BuildingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.cc.domain.pojo.Building; 9 | import com.cc.domain.pojo.Unit; 10 | import com.cc.domain.parm.BuildingParm; 11 | import com.cc.mapper.BuildingMapper; 12 | import com.cc.service.BuildingService; 13 | import com.cc.service.UnitService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | 17 | /** 18 | * 楼宇接口实现 19 | */ 20 | @Service 21 | public class BuildingServiceImpl extends ServiceImpl implements BuildingService { 22 | 23 | @Autowired 24 | private UnitService unitService; 25 | 26 | //分页查询楼宇信息 27 | @Override 28 | public IPage getList(BuildingParm buildingParm) { 29 | //构造查询条件 30 | QueryWrapper wrapper = new QueryWrapper<>(); 31 | if (StringUtils.isNotEmpty(buildingParm.getBuildingName())){ 32 | wrapper.lambda().like(Building::getBuildingName,buildingParm.getBuildingName()); 33 | } 34 | if (StringUtils.isNotEmpty(buildingParm.getBuildingType())){ 35 | wrapper.lambda().eq(Building::getBuildingType,buildingParm.getBuildingType()); 36 | } 37 | wrapper.orderByAsc("building_number"); 38 | //构造分页对象 39 | IPage page = new Page<>(); 40 | page.setSize(buildingParm.getPageSize()); 41 | page.setCurrent(buildingParm.getCurrentPage()); 42 | return baseMapper.selectPage(page,wrapper); 43 | } 44 | 45 | //删除楼宇 46 | @Override 47 | public boolean deleteBuilding(Integer buildingId) { 48 | //构造查询条件 49 | QueryWrapper wrapper = new QueryWrapper<>(); 50 | wrapper.lambda().eq(Unit::getBuildingId,buildingId); 51 | //判断查询结果 52 | long count = unitService.count(wrapper); 53 | if (count <= 0){ 54 | this.removeById(buildingId); 55 | return true; 56 | } 57 | return false; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/CommunityInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.cc.domain.pojo.CommunityInfo; 6 | import com.cc.mapper.CommunityInfoMapper; 7 | import com.cc.service.CommunityInfoService; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 小区基本信息serviceImpl层 14 | */ 15 | @Service 16 | public class CommunityInfoServiceImpl extends ServiceImpl implements CommunityInfoService { 17 | 18 | //修改小区基本信息 19 | @Override 20 | public boolean updateInfo(CommunityInfo communityInfo) { 21 | //先查询是否有数据 22 | List info = baseMapper.selectList(null); 23 | //如果没有则做插入操作 24 | if (info.size() == 0){ 25 | int selectNum = baseMapper.insert(communityInfo); 26 | if (selectNum > 0){ 27 | return true; 28 | } 29 | } 30 | //如果有则做修改操作 31 | int updateNum = baseMapper.updateById(communityInfo); 32 | return updateNum > 0; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/ComplaintServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.parm.ComplaintParm; 8 | import com.cc.domain.pojo.Complaint; 9 | import com.cc.mapper.ComplaintMapper; 10 | import com.cc.service.ComplaintService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.text.SimpleDateFormat; 15 | import java.util.*; 16 | 17 | /** 18 | * 投诉serviceImpl层 19 | */ 20 | @Service 21 | public class ComplaintServiceImpl extends ServiceImpl implements ComplaintService { 22 | 23 | @Autowired 24 | private ComplaintService complaintService; 25 | 26 | //分页查询 27 | @Override 28 | public IPage getComplaintList(ComplaintParm complaintParm) { 29 | //构造分页条件 30 | IPage page = new Page<>(); 31 | page.setCurrent(complaintParm.getCurrentPage()); 32 | page.setSize(complaintParm.getPageSize()); 33 | return baseMapper.getList(page, complaintParm.getComplaintTitle()); 34 | } 35 | 36 | //添加 37 | @Override 38 | public boolean saveComplaint(Complaint complaint) { 39 | //设置投诉状态 0->未处理 40 | complaint.setSloveStatus("0"); 41 | //设置投诉时间 42 | complaint.setComplaintTime(new Date()); 43 | //保存 44 | int count = baseMapper.insert(complaint); 45 | return count > 0; 46 | } 47 | 48 | //编辑 49 | @Override 50 | public boolean updateComplaint(Complaint complaint) { 51 | //判断该投诉是否已被处理 52 | if (complaint.getSloveStatus().equals("1")) { 53 | return false; 54 | } 55 | int count = baseMapper.updateById(complaint); 56 | return count > 0; 57 | } 58 | 59 | //删除 60 | @Override 61 | public boolean removeComplaint(Integer complaintId) { 62 | //构造查询条件 63 | QueryWrapper wrapper = new QueryWrapper<>(); 64 | wrapper.lambda().eq(Complaint::getComplaintId, complaintId) 65 | .eq(Complaint::getSloveStatus, "0"); 66 | Long count = baseMapper.selectCount(wrapper); 67 | if (count > 0) { 68 | //投诉没被处理,才可以删除 69 | baseMapper.deleteById(complaintId); 70 | return true; 71 | } 72 | return false; 73 | } 74 | 75 | //我的投诉 76 | @Override 77 | public IPage getMyComplaintList(ComplaintParm complaintParm) { 78 | //构造查询条件 79 | QueryWrapper wrapper = new QueryWrapper<>(); 80 | wrapper.lambda().like(Complaint::getComplaintTitle, complaintParm.getComplaintTitle()) 81 | .eq(Complaint::getLiverId, complaintParm.getLiverId()); 82 | //构造分页条件 83 | IPage page = new Page<>(); 84 | page.setCurrent(complaintParm.getCurrentPage()); 85 | page.setSize(complaintParm.getPageSize()); 86 | return baseMapper.selectPage(page, wrapper); 87 | } 88 | 89 | //处理投诉 90 | @Override 91 | public boolean sloveComplaint(Complaint complaint) { 92 | //设置投诉状态->已处理 93 | complaint.setSloveStatus("1"); 94 | int count = baseMapper.updateById(complaint); 95 | return count > 0; 96 | } 97 | 98 | //投诉折线图 99 | @Override 100 | public Map listforMonths() { 101 | //创建返回对象map 102 | Map resultMap = new HashMap<>(); 103 | //处理x轴日期 104 | //创建日期集合 105 | List complaintMonths = new ArrayList<>(); 106 | //获得日历对象 107 | Calendar calendar = Calendar.getInstance(); 108 | //计算过去一年的六个月 109 | calendar.add(Calendar.MONTH, -6); //当前时间往前推6个月 110 | for (int i = 0; i < 6; i++) { 111 | calendar.add(Calendar.MONTH,1); //当前时间往后推一个月日期 112 | Date date = calendar.getTime(); 113 | complaintMonths.add(new SimpleDateFormat("yyyy-MM").format(date)); 114 | } 115 | resultMap.put("complaintMonths",complaintMonths); 116 | //处理y轴投诉数量 117 | //创建投诉数量集合 118 | List complaintCount = new ArrayList<>(); 119 | //根据月份查询 120 | for (String complaintMonth : complaintMonths) { 121 | String afterDate = complaintMonth + "-1"; 122 | String beforeDate = complaintMonth + "-31"; 123 | Integer comCount = baseMapper.findComCountByMonths(beforeDate,afterDate); 124 | complaintCount.add(comCount); 125 | } 126 | resultMap.put("complaintCount",complaintCount); 127 | return resultMap; 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/ElectricServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.parm.LiverElectricParm; 8 | import com.cc.domain.pojo.Electric; 9 | import com.cc.domain.pojo.LiverAndHouse; 10 | import com.cc.domain.parm.ElectricParm; 11 | import com.cc.mapper.ElectricMapper; 12 | import com.cc.mapper.LiverAndHouseMapper; 13 | import com.cc.service.ElectricService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | 17 | /** 18 | * 电费管理ServiceImpl层 19 | */ 20 | @Service 21 | public class ElectricServiceImpl extends ServiceImpl implements ElectricService { 22 | 23 | @Autowired 24 | private LiverAndHouseMapper liverAndHouseMapper; 25 | 26 | //新增 27 | @Override 28 | public boolean saveElectric(Electric electric) { 29 | //根据房屋id查询业主 30 | QueryWrapper liverAndHouseWrapper = new QueryWrapper<>(); 31 | liverAndHouseWrapper.lambda().eq(LiverAndHouse::getHouseId,electric.getHouseId()) 32 | .eq(LiverAndHouse::getLiverHouseStatus,"0"); 33 | LiverAndHouse liverAndHouse = liverAndHouseMapper.selectOne(liverAndHouseWrapper); 34 | if (liverAndHouse != null){ 35 | //查询出的业主id设置到电费里 36 | electric.setLiverId(liverAndHouse.getLiverId()); 37 | //保存数据 38 | baseMapper.insert(electric); 39 | return true; 40 | } 41 | return false; 42 | } 43 | 44 | //编辑 45 | @Override 46 | public boolean updateElectric(Electric electric) { 47 | //根据房屋id查询业主 48 | QueryWrapper liverAndHouseWrapper = new QueryWrapper<>(); 49 | liverAndHouseWrapper.lambda().eq(LiverAndHouse::getHouseId,electric.getHouseId()) 50 | .eq(LiverAndHouse::getLiverHouseStatus,"0"); 51 | LiverAndHouse liverAndHouse = liverAndHouseMapper.selectOne(liverAndHouseWrapper); 52 | if (liverAndHouse != null) { 53 | //查询出的业主id设置到电费里 54 | electric.setLiverId(liverAndHouse.getLiverId()); 55 | //修改数据 56 | baseMapper.updateById(electric); 57 | return true; 58 | } 59 | return false; 60 | } 61 | 62 | //删除 63 | @Override 64 | public boolean removeElectricById(Integer electricId) { 65 | //如果已经缴费,就不能删除 66 | QueryWrapper electricWrapper = new QueryWrapper<>(); 67 | electricWrapper.lambda().eq(Electric::getElectricId,electricId) 68 | .eq(Electric::getElectricStatus,"1"); 69 | Long count = baseMapper.selectCount(electricWrapper); 70 | if (count <= 0){ 71 | //未缴费的记录可以执行删除 72 | baseMapper.deleteById(electricId); 73 | return true; 74 | } 75 | return false; 76 | } 77 | 78 | //分页查询 79 | @Override 80 | public IPage getList(ElectricParm electricParm) { 81 | //构造分页对象 82 | IPage page = new Page<>(); 83 | page.setCurrent(electricParm.getCurrentPage()); 84 | page.setSize(electricParm.getPageSize()); 85 | return baseMapper.getElectricList(page,electricParm.getLiverName(),electricParm.getHouseNum()); 86 | } 87 | 88 | //电费记录查询 89 | @Override 90 | public IPage getLiverElectricList(LiverElectricParm liverElectricParm) { 91 | //构造分页对象 92 | IPage page = new Page<>(); 93 | page.setCurrent(liverElectricParm.getCurrentPage()); 94 | page.setSize(liverElectricParm.getPageSize()); 95 | //构造条件构造器 96 | QueryWrapper wrapper = new QueryWrapper<>(); 97 | wrapper.lambda().eq(Electric::getLiverId,liverElectricParm.getLiverId()); 98 | return baseMapper.selectPage(page,wrapper); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/FacilitiesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.cc.domain.parm.FacilitiesParm; 9 | import com.cc.domain.pojo.Facilities; 10 | import com.cc.mapper.FacilitiesMapper; 11 | import com.cc.service.FacilitiesService; 12 | import org.springframework.stereotype.Service; 13 | 14 | @Service 15 | public class FacilitiesServiceImpl extends ServiceImpl implements FacilitiesService { 16 | 17 | //添加设施 18 | @Override 19 | public boolean saveFacilities(Facilities facilities) { 20 | int insert = baseMapper.insert(facilities); 21 | if (insert > 0){ 22 | return true; 23 | } 24 | return false; 25 | } 26 | 27 | //分页查询 28 | @Override 29 | public IPage getList(FacilitiesParm facilitiesParm) { 30 | //构造查询条件 31 | QueryWrapper wrapper = new QueryWrapper<>(); 32 | if(StringUtils.isNotEmpty(facilitiesParm.getFaName())){ 33 | wrapper.lambda().like(Facilities::getFaName,facilitiesParm.getFaName()); 34 | } 35 | if(StringUtils.isNotEmpty(facilitiesParm.getFaPerson())){ 36 | wrapper.lambda().like(Facilities::getFaPerson,facilitiesParm.getFaPerson()); 37 | } 38 | if(facilitiesParm.getPhoneNumber() != null){ 39 | wrapper.lambda().like(Facilities::getPhoneNumber,facilitiesParm.getPhoneNumber()); 40 | } 41 | //构造分页对象 42 | IPage page = new Page<>(); 43 | page.setCurrent(facilitiesParm.getCurrentPage()); 44 | page.setSize(facilitiesParm.getPageSize()); 45 | return baseMapper.selectPage(page,wrapper); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/HouseServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.pojo.House; 8 | import com.cc.domain.parm.HouseParm; 9 | import com.cc.mapper.HouseMapper; 10 | import com.cc.service.HouseService; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * 房屋service实现类 20 | */ 21 | @Service 22 | public class HouseServiceImpl extends ServiceImpl implements HouseService { 23 | 24 | //分页查询 25 | @Override 26 | public IPage getList(HouseParm parm) { 27 | //构造分页对象 28 | IPage page = new Page<>(); 29 | page.setSize(parm.getPageSize()); 30 | page.setCurrent(parm.getCurrentPage()); 31 | return baseMapper.getList(page,parm.getBuildingName(),parm.getUnitName(),parm.getHouseNum(),parm.getHouseStatus()); 32 | } 33 | 34 | //根据单元id获取房屋列表 35 | @Override 36 | public List getHouseList(House house) { 37 | //构造查询条件 38 | QueryWrapper houseWrapper = new QueryWrapper<>(); 39 | houseWrapper.lambda().eq(House::getUnitId,house.getUnitId()); 40 | List houseList = baseMapper.selectList(houseWrapper); 41 | return houseList; 42 | } 43 | 44 | //删除 45 | @Override 46 | public boolean removeHouse(Integer houseId) { 47 | //构造查询条件 48 | QueryWrapper houseWrapper = new QueryWrapper<>(); 49 | houseWrapper.lambda().eq(House::getHouseId,houseId) 50 | .eq(House::getHouseStatus,"0"); 51 | Long count = baseMapper.selectCount(houseWrapper); 52 | if (count > 0){ 53 | //如果房屋未使用才可以删除 54 | baseMapper.deleteById(houseId); 55 | return true; 56 | } 57 | return false; 58 | } 59 | 60 | //入住率饼形图 61 | @Override 62 | public Map getHouseLiveStatus() { 63 | //返回结果容器 64 | Map resultMap = new HashMap<>(); 65 | //示例容器 66 | List houseStatus = new ArrayList<>(); 67 | houseStatus.add("入住"); 68 | houseStatus.add("未入住"); 69 | resultMap.put("houseStatus",houseStatus); 70 | //数据容器 71 | List> houseCount = new ArrayList<>(); 72 | //查询未入住的数量 73 | QueryWrapper notUseWrapper = new QueryWrapper<>(); 74 | notUseWrapper.lambda().eq(House::getHouseStatus,"0"); 75 | Long notUseCount = baseMapper.selectCount(notUseWrapper); 76 | Map notUseMap = new HashMap(); 77 | notUseMap.put("name","未入住"); 78 | notUseMap.put("value",notUseCount); 79 | houseCount.add(notUseMap); 80 | //查询入住的数量 81 | QueryWrapper useWrapper = new QueryWrapper<>(); 82 | useWrapper.lambda().eq(House::getHouseStatus,"1"); 83 | Long useCount = baseMapper.selectCount(useWrapper); 84 | Map useMap = new HashMap(); 85 | useMap.put("name","入住"); 86 | useMap.put("value",useCount); 87 | houseCount.add(useMap); 88 | resultMap.put("houseCount",houseCount); 89 | return resultMap; 90 | } 91 | 92 | //小区人数统计饼形图 93 | @Override 94 | public Map getAllLiverCount() { 95 | //返回结果容器 96 | Map resultMap = new HashMap<>(); 97 | //查询每栋楼宇的住户的数量 98 | List> liverByBuildCount = baseMapper.getLiverCount(); 99 | resultMap.put("liverByBuildCount",liverByBuildCount); 100 | //示例容器 101 | List liverBuildList = new ArrayList<>(); 102 | //小区所有的楼宇 103 | for (Map map : liverByBuildCount) { 104 | String name = (String) map.get("name"); 105 | liverBuildList.add(name); 106 | } 107 | resultMap.put("liverBuildList",liverBuildList); 108 | return resultMap; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/LiverAndRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.cc.domain.pojo.LiverAndRole; 5 | import com.cc.mapper.LiverAndRoleMapper; 6 | import com.cc.service.LiverAndRoleService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * 业主角色service实现层 11 | */ 12 | @Service 13 | public class LiverAndRoleServiceImpl extends ServiceImpl implements LiverAndRoleService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/MenuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.cc.domain.pojo.Menu; 6 | import com.cc.mapper.MenuMapper; 7 | import com.cc.service.MenuService; 8 | import com.cc.utils.MyTreeUtils; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | /** 15 | * 菜单ServiceImpl层 16 | */ 17 | @Service 18 | public class MenuServiceImpl extends ServiceImpl implements MenuService { 19 | 20 | //父级菜单的查询 21 | @Override 22 | public List getParentList() { 23 | //查询目录和菜单 24 | String[] types = {"0","1"}; 25 | //构造查询条件 26 | QueryWrapper wrapper = new QueryWrapper<>(); 27 | List typesList = Arrays.asList(types); 28 | wrapper.lambda().in(Menu::getType,typesList).orderByAsc(Menu::getOrderNum); 29 | List menus = baseMapper.selectList(wrapper); 30 | //构造一个顶级树形数据 31 | Menu menu = new Menu(); 32 | menu.setMenuId(0); 33 | menu.setParentId(-1); 34 | menu.setMenuLabel("顶级菜单"); 35 | menus.add(menu); 36 | //构造树形数据 37 | List menuList = MyTreeUtils.makeTree(menus, -1); 38 | return menuList; 39 | } 40 | 41 | //查询菜单列表 42 | @Override 43 | public List getMenuList() { 44 | //构造查询条件 45 | QueryWrapper wrapper = new QueryWrapper<>(); 46 | wrapper.lambda().orderByAsc(Menu::getOrderNum); 47 | List menus = baseMapper.selectList(wrapper); 48 | //构造树形数据 49 | List menuList = MyTreeUtils.makeTree(menus, 0); 50 | return menuList; 51 | } 52 | 53 | //删除菜单 54 | @Override 55 | public boolean deleteMenu(Integer menuId) { 56 | //构造查询条件 57 | QueryWrapper wrapper = new QueryWrapper<>(); 58 | wrapper.lambda().eq(Menu::getParentId,menuId); 59 | List menuList = baseMapper.selectList(wrapper); 60 | if (menuList.size() > 0){ 61 | return false; 62 | } 63 | return true; 64 | } 65 | 66 | //根据用户id查询权限 67 | @Override 68 | public List getMenuByUserId(Integer userId) { 69 | return this.baseMapper.getMenuByUserId(userId); 70 | } 71 | 72 | //根据业主id查询权限 73 | @Override 74 | public List getMenuByLiverId(Integer liverId) { 75 | return baseMapper.getMenuByLiverId(liverId); 76 | } 77 | 78 | //根据角色id查询权限 79 | @Override 80 | public List getMenuByRoleId(Integer roleId) { 81 | return this.baseMapper.getMenuByRoleId(roleId); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/NoticeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.cc.domain.parm.IndexNoticeParm; 7 | import com.cc.domain.parm.NoticeParm; 8 | import com.cc.domain.pojo.Notice; 9 | import com.cc.mapper.NoticeMapper; 10 | import com.cc.service.NoticeService; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Date; 14 | 15 | /** 16 | * 公告service实现层 17 | */ 18 | @Service 19 | public class NoticeServiceImpl extends ServiceImpl implements NoticeService { 20 | 21 | //分页查询 22 | @Override 23 | public IPage getList(NoticeParm noticeParm) { 24 | //构造分页对象 25 | IPage page = new Page<>(); 26 | page.setCurrent(noticeParm.getCurrentPage()); 27 | page.setSize(noticeParm.getPageSize()); 28 | return baseMapper.getList(page, noticeParm.getFullName(),noticeParm.getNoticeTitle()); 29 | } 30 | 31 | //添加 32 | @Override 33 | public boolean saveNotice(Notice notice) { 34 | //设置当前时间 35 | notice.setNoticeTime(new Date()); 36 | int count = baseMapper.insert(notice); 37 | return count > 0; 38 | } 39 | 40 | //首页公告分页查询 41 | @Override 42 | public IPage getIndexNoticeList(IndexNoticeParm indexNoticeParm) { 43 | //构造分页对象 44 | IPage page = new Page<>(); 45 | page.setCurrent(indexNoticeParm.getCurrentPage()); 46 | page.setSize(indexNoticeParm.getPageSize()); 47 | return baseMapper.getIndexNoticeList(page); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/ParkServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.parm.LiverParkParm; 8 | import com.cc.domain.parm.ParkParm; 9 | import com.cc.domain.pojo.LiverAndParking; 10 | import com.cc.domain.pojo.Park; 11 | import com.cc.mapper.LiverAndParkingMapper; 12 | import com.cc.mapper.ParkMapper; 13 | import com.cc.service.ParkService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | 17 | /** 18 | * 停车费serviceImpl层 19 | */ 20 | @Service 21 | public class ParkServiceImpl extends ServiceImpl implements ParkService { 22 | 23 | @Autowired 24 | private LiverAndParkingMapper liverAndParkingMapper; 25 | 26 | //新增 27 | @Override 28 | public boolean addPayPark(Park park) { 29 | //查询当前正在使用车位的用户 30 | QueryWrapper liverAndParkingWrapper = new QueryWrapper<>(); 31 | liverAndParkingWrapper.lambda().eq(LiverAndParking::getParkId,park.getParkId()) 32 | .eq(LiverAndParking::getLiverParkingStatus,"0"); 33 | ; 34 | LiverAndParking liverAndParking = liverAndParkingMapper.selectOne(liverAndParkingWrapper); 35 | if (liverAndParking != null){ 36 | //保存车位费用信息 37 | park.setLiverId(liverAndParking.getLiverId()); 38 | baseMapper.insert(park); 39 | return true; 40 | } 41 | return false; 42 | } 43 | 44 | //编辑 45 | @Override 46 | public boolean editPayPark(Park park) { 47 | //查询当前正在使用车位的用户 48 | QueryWrapper liverAndParkingWrapper = new QueryWrapper<>(); 49 | liverAndParkingWrapper.lambda().eq(LiverAndParking::getParkId,park.getParkId()) 50 | .eq(LiverAndParking::getLiverParkingStatus,"0"); 51 | ; 52 | LiverAndParking liverAndParking = liverAndParkingMapper.selectOne(liverAndParkingWrapper); 53 | if (liverAndParking != null){ 54 | //更新 55 | park.setLiverId(liverAndParking.getLiverId()); 56 | baseMapper.updateById(park); 57 | return true; 58 | } 59 | return false; 60 | } 61 | 62 | //删除 63 | @Override 64 | public boolean deletePayPark(Integer parkingId) { 65 | //判断是否已经缴费 66 | QueryWrapper parkWrapper = new QueryWrapper<>(); 67 | parkWrapper.lambda().eq(Park::getParkingId,parkingId) 68 | .eq(Park::getParkingStatus,"0"); 69 | Long count = baseMapper.selectCount(parkWrapper); 70 | if ( count > 0){ 71 | //如果未缴费,则可以删除 72 | baseMapper.deleteById(parkingId); 73 | return true; 74 | } 75 | return false; 76 | } 77 | 78 | //分页查询 79 | @Override 80 | public IPage getList(ParkParm parkParm) { 81 | //构造分页对象 82 | IPage page = new Page<>(); 83 | page.setCurrent(parkParm.getCurrentPage()); 84 | page.setSize(parkParm.getPageSize()); 85 | return baseMapper.getParkList(page,parkParm.getLiverName(),parkParm.getParkName()); 86 | } 87 | 88 | //停车费记录查询 89 | @Override 90 | public IPage getLiverParkList(LiverParkParm liverParkParm) { 91 | //构造分页对象 92 | IPage page = new Page<>(); 93 | page.setCurrent(liverParkParm.getCurrentPage()); 94 | page.setSize(liverParkParm.getPageSize()); 95 | //构造条件构造器 96 | QueryWrapper wrapper = new QueryWrapper<>(); 97 | wrapper.lambda().eq(Park::getLiverId,liverParkParm.getLiverId()); 98 | return baseMapper.selectPage(page,wrapper); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/ParkingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.cc.domain.pojo.Parking; 9 | import com.cc.domain.parm.ParkingParm; 10 | import com.cc.mapper.ParkingMapper; 11 | import com.cc.service.ParkingService; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.ArrayList; 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * 车位管理service实现 21 | */ 22 | @Service 23 | public class ParkingServiceImpl extends ServiceImpl implements ParkingService { 24 | 25 | //分页查询 26 | @Override 27 | public IPage getList(ParkingParm parkingParm) { 28 | //构造查询条件 29 | QueryWrapper wrapper = new QueryWrapper<>(); 30 | if (StringUtils.isNotEmpty(parkingParm.getParkName())){ 31 | wrapper.lambda().like(Parking::getParkName,parkingParm.getParkName()); 32 | } 33 | if (StringUtils.isNotEmpty(parkingParm.getParkStatus())){ 34 | wrapper.lambda().eq(Parking::getParkStatus,parkingParm.getParkStatus()); 35 | } 36 | if (StringUtils.isNotEmpty(parkingParm.getParkType())){ 37 | wrapper.lambda().eq(Parking::getParkType,parkingParm.getParkType()); 38 | } 39 | wrapper.lambda().orderByAsc(Parking::getParkNumber); 40 | //构造分页对象 41 | IPage page = new Page<>(); 42 | page.setCurrent(parkingParm.getCurrentPage()); 43 | page.setSize(parkingParm.getPageSize()); 44 | return baseMapper.selectPage(page,wrapper); 45 | } 46 | 47 | //删除车位 48 | @Override 49 | public boolean removeParking(Integer parkId) { 50 | //构造查询条件 51 | QueryWrapper parkingWrapper = new QueryWrapper<>(); 52 | parkingWrapper.lambda().eq(Parking::getParkId,parkId) 53 | .eq(Parking::getParkStatus,"1"); 54 | Long count = baseMapper.selectCount(parkingWrapper); 55 | if (count <= 0){ 56 | //如果车位未使用,则可以删除 57 | baseMapper.deleteById(parkId); 58 | return true; 59 | } 60 | return false; 61 | } 62 | 63 | //小区车位使用情况饼形图 64 | @Override 65 | public Map getParkStatus() { 66 | //返回结果容器 67 | Map resultMap = new HashMap<>(); 68 | //示例容器 69 | List parkingStatus = new ArrayList<>(); 70 | parkingStatus.add("使用"); 71 | parkingStatus.add("未使用"); 72 | resultMap.put("parkingStatus",parkingStatus); 73 | //数据容器 74 | List> parkingCount = new ArrayList<>(); 75 | //查询未使用的数量 76 | QueryWrapper notUseWrapper = new QueryWrapper<>(); 77 | notUseWrapper.lambda().eq(Parking::getParkStatus,"0"); 78 | Long notUseCount = baseMapper.selectCount(notUseWrapper); 79 | Map notUseMap = new HashMap(); 80 | notUseMap.put("name","未使用"); 81 | notUseMap.put("value",notUseCount); 82 | parkingCount.add(notUseMap); 83 | //查询使用的数量 84 | QueryWrapper useWrapper = new QueryWrapper<>(); 85 | useWrapper.lambda().eq(Parking::getParkStatus,"1"); 86 | Long useCount = baseMapper.selectCount(useWrapper); 87 | Map useMap = new HashMap(); 88 | useMap.put("name","使用"); 89 | useMap.put("value",useCount); 90 | parkingCount.add(useMap); 91 | resultMap.put("parkingCount",parkingCount); 92 | return resultMap; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/RepairServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.parm.RepairParm; 8 | import com.cc.domain.pojo.Repair; 9 | import com.cc.mapper.RepairMapper; 10 | import com.cc.service.RepairService; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.text.SimpleDateFormat; 14 | import java.util.*; 15 | 16 | /** 17 | * 维修管理ServiceImpl层 18 | */ 19 | @Service 20 | public class RepairServiceImpl extends ServiceImpl implements RepairService { 21 | 22 | //维修列表分页查询 23 | @Override 24 | public IPage getRepairList(RepairParm repairParm) { 25 | //构造分页条件 26 | IPage page = new Page<>(); 27 | page.setCurrent(repairParm.getCurrentPage()); 28 | page.setSize(repairParm.getPageSize()); 29 | return baseMapper.getList(page,repairParm.getLiverName()); 30 | } 31 | 32 | //添加 33 | @Override 34 | public boolean saveRepair(Repair repair) { 35 | //设置投诉状态 0->未处理 36 | repair.setRepairStatus("0"); 37 | //设置投诉时间 38 | repair.setRepairTime(new Date()); 39 | //保存 40 | int count = baseMapper.insert(repair); 41 | return count > 0; 42 | } 43 | 44 | //编辑 45 | @Override 46 | public boolean updateRepair(Repair repair) { 47 | //判断该投诉是否已被处理 48 | if (repair.getRepairStatus().equals("1")){ 49 | return false; 50 | } 51 | int count = baseMapper.updateById(repair); 52 | return count > 0; 53 | } 54 | 55 | //删除 56 | @Override 57 | public boolean removeRepair(Integer repairId) { 58 | //构造查询条件 59 | QueryWrapper wrapper = new QueryWrapper<>(); 60 | wrapper.lambda().eq(Repair::getRepairId,repairId) 61 | .eq(Repair::getRepairStatus,"0"); 62 | Long count = baseMapper.selectCount(wrapper); 63 | if (count > 0){ 64 | //维修没被处理,才可以被删除 65 | baseMapper.deleteById(repairId); 66 | return true; 67 | } 68 | return false; 69 | } 70 | 71 | //我的报修 72 | @Override 73 | public IPage getMyRepairList(RepairParm repairParm) { 74 | //构造查询条件 75 | QueryWrapper wrapper = new QueryWrapper<>(); 76 | wrapper.lambda().like(Repair::getRepairText,repairParm.getRepairText()) 77 | .eq(Repair::getLiverId,repairParm.getLiverId()); 78 | //构造分页对象 79 | IPage page = new Page<>(); 80 | page.setCurrent(repairParm.getCurrentPage()); 81 | page.setSize(repairParm.getPageSize()); 82 | return baseMapper.selectPage(page,wrapper); 83 | } 84 | 85 | //处理报修 86 | @Override 87 | public boolean sloveRepair(Repair repair) { 88 | //设置报修状态->已处理 89 | repair.setRepairStatus("1"); 90 | int count = baseMapper.updateById(repair); 91 | return count > 0; 92 | } 93 | 94 | //每月报修柱形图 95 | @Override 96 | public Map listForMonths() { 97 | //创建返回对象map 98 | Map resultMap = new HashMap<>(); 99 | //处理x轴日期 100 | //创建日期集合 101 | List repairMonths = new ArrayList<>(); 102 | //获得日历对象 103 | Calendar calendar = Calendar.getInstance(); 104 | //计算过去一年的六个月 105 | calendar.add(Calendar.MONTH, -6); //当前时间往前推6个月 106 | for (int i = 0; i < 6; i++) { 107 | calendar.add(Calendar.MONTH,1); //当前时间往后推一个月日期 108 | Date date = calendar.getTime(); 109 | repairMonths.add(new SimpleDateFormat("yyyy-MM").format(date)); 110 | } 111 | resultMap.put("repairMonths",repairMonths); 112 | //创建投诉数量集合 113 | List repairCount = new ArrayList<>(); 114 | //根据月份查询 115 | for (String repairMonth : repairMonths) { 116 | String afterDate = repairMonth + "-1"; 117 | String beforeDate = repairMonth + "-31"; 118 | Integer comCount = baseMapper.findRepCountByMonths(beforeDate,afterDate); 119 | repairCount.add(comCount); 120 | } 121 | resultMap.put("repairCount",repairCount); 122 | return resultMap; 123 | } 124 | 125 | 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/RoleAndMenuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.cc.domain.pojo.RoleAndMenu; 5 | import com.cc.mapper.RoleAndMenuMapper; 6 | import com.cc.service.RoleAndMenuService; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 角色菜单实现类 13 | */ 14 | @Service 15 | public class RoleAndMenuServiceImpl extends ServiceImpl implements RoleAndMenuService { 16 | 17 | //保存权限 18 | @Override 19 | public void saveRoleMenu(Integer roleId, List menuIds) { 20 | this.baseMapper.saveRoleMenu(roleId, menuIds); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/UnitServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.pojo.House; 8 | import com.cc.domain.pojo.Unit; 9 | import com.cc.domain.parm.UnitParm; 10 | import com.cc.mapper.UnitMapper; 11 | import com.cc.service.HouseService; 12 | import com.cc.service.UnitService; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | /** 17 | * 单元ServiceImpl 18 | */ 19 | @Service 20 | public class UnitServiceImpl extends ServiceImpl implements UnitService { 21 | 22 | @Autowired 23 | private HouseService houseService; 24 | 25 | //查询单元列表 26 | @Override 27 | public IPage getList(UnitParm unitParm) { 28 | //构造分页对象 29 | IPage page = new Page<>(); 30 | page.setSize(unitParm.getPageSize()); 31 | page.setCurrent(unitParm.getCurrentPage()); 32 | return baseMapper.getList(page,unitParm.getUnitName(),unitParm.getBuildingName()); 33 | } 34 | 35 | //删除单元 36 | @Override 37 | public boolean removeUnit(Integer unitId) { 38 | //构造查询条件 39 | QueryWrapper wrapper = new QueryWrapper<>(); 40 | wrapper.lambda().eq(House::getUnitId, unitId); 41 | long count = houseService.count(wrapper); 42 | if (count <= 0){ 43 | this.removeById(unitId); 44 | return true; 45 | } 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/UserAndRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.cc.domain.pojo.UserAndRole; 6 | import com.cc.mapper.UserAndRoleMapper; 7 | import com.cc.service.UserAndRoleService; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 用户-角色serviceImpl层 12 | */ 13 | @Service 14 | public class UserAndRoleServiceImpl extends ServiceImpl implements UserAndRoleService { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/WaterServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.cc.domain.parm.LiverWaterParm; 8 | import com.cc.domain.parm.WaterParm; 9 | import com.cc.domain.pojo.LiverAndHouse; 10 | import com.cc.domain.pojo.Water; 11 | import com.cc.mapper.LiverAndHouseMapper; 12 | import com.cc.mapper.WaterMapper; 13 | import com.cc.service.WaterService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * 水费管理ServiceImpl层 21 | */ 22 | @Service 23 | public class WaterServiceImpl extends ServiceImpl implements WaterService { 24 | 25 | @Autowired 26 | private LiverAndHouseMapper liverAndHouseMapper; 27 | 28 | //新增 29 | @Override 30 | public boolean saveWater(Water water) { 31 | //根据房屋id查询业主 32 | QueryWrapper liverAndHouseWrapper = new QueryWrapper<>(); 33 | liverAndHouseWrapper.lambda().eq(LiverAndHouse::getHouseId,water.getHouseId()) 34 | .eq(LiverAndHouse::getLiverHouseStatus,"0"); 35 | LiverAndHouse liverAndHouse = liverAndHouseMapper.selectOne(liverAndHouseWrapper); 36 | if (liverAndHouse != null){ 37 | //查询出的业主id设置到水费里 38 | water.setLiverId(liverAndHouse.getLiverId()); 39 | //保存数据 40 | baseMapper.insert(water); 41 | return true; 42 | } 43 | return false; 44 | } 45 | 46 | //编辑 47 | @Override 48 | public boolean updateWater(Water water) { 49 | //根据房屋id查询业主 50 | QueryWrapper liverAndHouseWrapper = new QueryWrapper<>(); 51 | liverAndHouseWrapper.lambda().eq(LiverAndHouse::getHouseId,water.getHouseId()) 52 | .eq(LiverAndHouse::getLiverHouseStatus,"0"); 53 | LiverAndHouse liverAndHouse = liverAndHouseMapper.selectOne(liverAndHouseWrapper); 54 | if (liverAndHouse != null) { 55 | //查询出的业主id设置到水费里 56 | water.setLiverId(liverAndHouse.getLiverId()); 57 | //修改数据 58 | baseMapper.updateById(water); 59 | return true; 60 | } 61 | return false; 62 | } 63 | 64 | //删除 65 | @Override 66 | public boolean removeWaterById(Integer waterId) { 67 | //如果已经缴费,就不能删除 68 | QueryWrapper waterWrapper = new QueryWrapper<>(); 69 | waterWrapper.lambda().eq(Water::getWaterId,waterId) 70 | .eq(Water::getWaterStatus,"1"); 71 | Long count = baseMapper.selectCount(waterWrapper); 72 | if (count <= 0){ 73 | //未缴费的记录可以执行删除 74 | baseMapper.deleteById(waterId); 75 | return true; 76 | } 77 | return false; 78 | } 79 | 80 | //分页查询 81 | @Override 82 | public IPage getList(WaterParm waterParm) { 83 | //构造分页对象 84 | IPage page = new Page<>(); 85 | page.setCurrent(waterParm.getCurrentPage()); 86 | page.setSize(waterParm.getPageSize()); 87 | return baseMapper.getWaterList(page, waterParm.getLiverName(), waterParm.getHouseNum()); 88 | } 89 | 90 | //水费记录查询 91 | @Override 92 | public IPage getLiverWaterList(LiverWaterParm liverWaterParm) { 93 | //后遭分页对象 94 | IPage page = new Page<>(); 95 | page.setCurrent(liverWaterParm.getCurrentPage()); 96 | page.setSize(liverWaterParm.getPageSize()); 97 | //构造条件构造器 98 | QueryWrapper wrapper = new QueryWrapper<>(); 99 | wrapper.lambda().eq(Water::getLiverId,liverWaterParm.getLiverId()); 100 | return baseMapper.selectPage(page,wrapper); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/cc/service/impl/WorkerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cc.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.StringUtils; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.cc.domain.pojo.User; 9 | import com.cc.domain.pojo.UserAndRole; 10 | import com.cc.domain.parm.UserParm; 11 | import com.cc.mapper.UserAndRoleMapper; 12 | import com.cc.mapper.WorkerMapper; 13 | import com.cc.service.WorkerService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.security.crypto.password.PasswordEncoder; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.transaction.annotation.Transactional; 18 | 19 | 20 | import java.util.List; 21 | 22 | /** 23 | * 物业人员serviceImpl层 24 | */ 25 | @Service 26 | public class WorkerServiceImpl extends ServiceImpl implements WorkerService { 27 | 28 | @Autowired 29 | private UserAndRoleMapper userAndRoleMapper; 30 | 31 | @Autowired 32 | private PasswordEncoder passwordEncoder; 33 | 34 | //分页查询物业人员列表 35 | @Override 36 | public IPage list(UserParm parm) { 37 | //构造分页对象 38 | IPage workerPage = new Page<>(); 39 | workerPage.setSize(parm.getPageSize()); 40 | workerPage.setCurrent(parm.getCurrentPage()); 41 | //构造分页查询条件 42 | QueryWrapper workerQueryWrapper = new QueryWrapper<>(); 43 | if (StringUtils.isNotEmpty(parm.getPhoneNumber())){ 44 | workerQueryWrapper.lambda().like(User::getPhoneNumber,parm.getPhoneNumber()); 45 | } 46 | if (StringUtils.isNotEmpty(parm.getFullName())){ 47 | workerQueryWrapper.lambda().like(User::getFullName,parm.getFullName()); 48 | } 49 | return this.page(workerPage, workerQueryWrapper); 50 | } 51 | 52 | //新增物业人员 53 | @Override 54 | public boolean saveWorker(User user) { 55 | //确保用户名唯一 56 | if (StringUtils.isNotEmpty(user.getUsername())){ 57 | QueryWrapper wrapper = new QueryWrapper<>(); 58 | wrapper.lambda().eq(User::getUsername, user.getUsername()); 59 | User selectOne = baseMapper.selectOne(wrapper); 60 | if (selectOne != null){ 61 | return false; 62 | } 63 | } 64 | //对密码进行加密 65 | if (StringUtils.isNotEmpty(user.getPassword())){ 66 | user.setPassword(passwordEncoder.encode(user.getPassword())); 67 | } 68 | //设置工作人员不为管理员 69 | user.setIsAdmin("0"); 70 | int result = baseMapper.insert(user); 71 | if (result > 0){ 72 | return true; 73 | } 74 | return false; 75 | } 76 | 77 | //编辑物业人员 78 | @Override 79 | public boolean updateWorker(User user) { 80 | //确保用户名唯一 81 | if (StringUtils.isNotEmpty(user.getUsername())){ 82 | QueryWrapper wrapper = new QueryWrapper<>(); 83 | wrapper.lambda().eq(User::getUsername, user.getUsername()); 84 | Long count = baseMapper.selectCount(wrapper); 85 | if(count > 0){ 86 | return false; 87 | } 88 | } 89 | //密码加密 90 | if (StringUtils.isNotEmpty(user.getPassword())){ 91 | user.setPassword(passwordEncoder.encode(user.getPassword())); 92 | } 93 | int result = baseMapper.updateById(user); 94 | if (result > 0){ 95 | return true; 96 | } 97 | return false; 98 | } 99 | 100 | //删除物业工作人员 101 | @Override 102 | @Transactional 103 | public boolean removeWorker(Integer userId) { 104 | //先根据id查询当前账号是否停用 105 | User userInfo = baseMapper.selectById(userId); 106 | if (userInfo.getIsStatus().equals("1")){ 107 | //停用后执行删除 108 | baseMapper.deleteById(userId); 109 | //同时清理用户角色关系表中的数据 110 | //构造条件 111 | QueryWrapper wrapper = new QueryWrapper<>(); 112 | wrapper.lambda().eq(UserAndRole::getUserId,userId); 113 | userAndRoleMapper.delete(wrapper); 114 | return true; 115 | } 116 | return false; 117 | } 118 | 119 | //首页物业员工列表 120 | @Override 121 | public List getAllWorker() { 122 | //构造条件构造器 非管理员 123 | QueryWrapper wrapper = new QueryWrapper<>(); 124 | wrapper.lambda().eq(User::getIsAdmin,"0"); 125 | return baseMapper.selectList(wrapper); 126 | } 127 | 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/cc/utils/JwtUtils.java: -------------------------------------------------------------------------------- 1 | package com.cc.utils; 2 | 3 | import io.jsonwebtoken.Claims; 4 | import io.jsonwebtoken.Jwts; 5 | import io.jsonwebtoken.SignatureAlgorithm; 6 | import lombok.Data; 7 | import org.springframework.boot.context.properties.ConfigurationProperties; 8 | import org.springframework.stereotype.Component; 9 | import java.util.Date; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | @Data 13 | @ConfigurationProperties(prefix = "jwt") 14 | @Component 15 | public class JwtUtils { 16 | //密钥 17 | private String secret; 18 | 19 | // 过期时间 毫秒 20 | private Long expiration; 21 | 22 | 23 | /** 24 | * 从数据声明生成令牌 25 | * 26 | * @param claims 数据声明 27 | * @return 令牌 28 | */ 29 | private String generateToken(Map claims) { 30 | Date expirationDate = new Date(System.currentTimeMillis() + expiration); 31 | return Jwts.builder().setClaims(claims).setExpiration(expirationDate).signWith(SignatureAlgorithm.HS512, secret).compact(); 32 | } 33 | 34 | /** 35 | * 从令牌中获取数据声明 36 | * 37 | * @param token 令牌 38 | * @return 数据声明 39 | */ 40 | public Claims getClaimsFromToken(String token) { 41 | Claims claims; 42 | try { 43 | claims = Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); 44 | } catch (Exception e) { 45 | claims = null; 46 | } 47 | return claims; 48 | } 49 | 50 | /** 51 | * 生成令牌 52 | * 53 | * @param username 用户 54 | * @return 令牌 55 | */ 56 | public String generateToken(String username,String userType) { 57 | Map claims = new HashMap<>(2); 58 | claims.put(Claims.SUBJECT,username); 59 | claims.put(Claims.ISSUED_AT, new Date()); 60 | claims.put("userType",userType); 61 | return generateToken(claims); 62 | } 63 | 64 | /** 65 | * 从令牌中获取用户名 66 | * 67 | * @param token 令牌 68 | * @return 用户名 69 | */ 70 | public String getUsernameFromToken(String token) { 71 | String username; 72 | try { 73 | Claims claims = getClaimsFromToken(token); 74 | username = claims.getSubject(); 75 | } catch (Exception e) { 76 | username = null; 77 | } 78 | return username; 79 | } 80 | 81 | /** 82 | * 判断令牌是否过期 83 | * 84 | * @param token 令牌 85 | * @return 是否过期 86 | */ 87 | public Boolean isTokenExpired(String token) { 88 | Claims claims = getClaimsFromToken(token); 89 | Date expiration = claims.getExpiration(); 90 | return expiration.before(new Date()); 91 | } 92 | 93 | /** 94 | * 刷新令牌 95 | * 96 | * @param token 原令牌 97 | * @return 新令牌 98 | */ 99 | public String refreshToken(String token) { 100 | String refreshedToken; 101 | try { 102 | Claims claims = getClaimsFromToken(token); 103 | claims.put(Claims.ISSUED_AT, new Date()); 104 | refreshedToken = generateToken(claims); 105 | } catch (Exception e) { 106 | refreshedToken = null; 107 | } 108 | return refreshedToken; 109 | } 110 | 111 | /** 112 | * 验证令牌 113 | * 114 | * @param token 令牌 115 | * @param username 用户名 116 | * @return 是否有效 117 | */ 118 | public Boolean validateToken(String token, String username) { 119 | String tokenUsername = getUsernameFromToken(token); 120 | return (username.equals(tokenUsername) && !isTokenExpired(token)); 121 | } 122 | 123 | /** 124 | * 获取token过期时间 125 | * @param token 126 | * @return 127 | */ 128 | public Long getExpireTime(String token){ 129 | Long expireTime = Jwts.parser() 130 | .setSigningKey(secret) 131 | .parseClaimsJws(token) 132 | .getBody().getExpiration().getTime(); 133 | return expireTime; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/cc/utils/MyTreeUtils.java: -------------------------------------------------------------------------------- 1 | package com.cc.utils; 2 | 3 | import com.cc.domain.pojo.Menu; 4 | import com.cc.domain.vo.RouterVO; 5 | import org.springframework.beans.BeanUtils; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.Optional; 10 | 11 | /** 12 | * 菜单转为树形结构 13 | * 递归算法 14 | */ 15 | public class MyTreeUtils { 16 | 17 | public static List makeTree(List menuList,Integer parentId){ 18 | //存放处理后的结果 19 | List resultList = new ArrayList<>(); 20 | //拼装树形数据 21 | Optional.ofNullable(menuList).orElse(new ArrayList<>()) 22 | .stream() 23 | .filter(item -> item != null && item.getParentId() == parentId) 24 | .forEach(res -> { 25 | //过滤出的数据放到新的里面 26 | Menu newMenu = new Menu(); 27 | BeanUtils.copyProperties(res,newMenu); 28 | //找出当前对象的下级菜单 29 | List childMenu = makeTree(menuList, res.getMenuId()); 30 | newMenu.setChildren(childMenu); 31 | resultList.add(newMenu); 32 | }); 33 | return resultList; 34 | } 35 | 36 | //生成路由数据格式 37 | public static List makeRouter(List menuList,Integer parentId){ 38 | //接收生成的路由数据 39 | List resultList = new ArrayList<>(); 40 | //组装数据 41 | Optional.ofNullable(menuList).orElse(new ArrayList<>()) 42 | .stream() 43 | //数据过滤 44 | .filter(item -> item != null && item.getParentId() == parentId) 45 | .forEach(item -> { 46 | //设置路由数据 47 | RouterVO router = new RouterVO(); 48 | router.setName(item.getRouteName()); 49 | router.setPath(item.getRoutePath()); 50 | //判断是一级菜单 51 | if(item.getParentId() == 0){ 52 | router.setComponent("Layout"); 53 | router.setAlwaysShow(true); 54 | }else{ 55 | router.setComponent(item.getRouteUrl()); 56 | router.setAlwaysShow(false); 57 | } 58 | //设置meta 59 | router.setMeta(router.new Meta( 60 | item.getMenuLabel(), 61 | item.getIcon(), 62 | item.getMenuCode().split(",") 63 | )); 64 | //设置children 65 | List children = makeRouter(menuList, item.getMenuId()); 66 | router.setChildren(children); 67 | resultList.add(router); 68 | }); 69 | return resultList; 70 | } 71 | 72 | // public static List makeRouter(List menuList, Integer pid){ 73 | // List list = new ArrayList<>(); 74 | // Optional.ofNullable(menuList).orElse(new ArrayList<>()) 75 | // .stream() 76 | // .filter(item -> item != null && item.getParentId() == pid) 77 | // .forEach(item -> { 78 | // RouterVO router = new RouterVO(); 79 | // router.setName(item.getRouteName()); 80 | // router.setPath(item.getRoutePath()); 81 | // if(item.getParentId() == 0){ 82 | // router.setComponent("Layout"); 83 | // router.setAlwaysShow(true); 84 | // }else{ 85 | // router.setComponent(item.getRouteUrl()); 86 | // router.setAlwaysShow(false); 87 | // } 88 | // //设置meta 89 | // router.setMeta(router.new Meta( 90 | // item.getMenuLabel(), 91 | // item.getIcon(), 92 | // item.getMenuCode().split(",") 93 | // )); 94 | // //设置children,每一项的下级 95 | // List children = makeRouter(menuList, item.getMenuId()); 96 | // router.setChildren(children); 97 | // list.add(router); 98 | // }); 99 | // return list; 100 | // } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/cc/utils/ResultUtils.java: -------------------------------------------------------------------------------- 1 | package com.cc.utils; 2 | 3 | import com.cc.domain.vo.ResultVo; 4 | import com.cc.domain.status.StatusCode; 5 | 6 | /** 7 | * 数据返回工具类 8 | */ 9 | public class ResultUtils { 10 | 11 | /** 12 | * 无参数返回 13 | * @return 14 | */ 15 | public static ResultVo success(){ 16 | return Vo(StatusCode.SUCCESS_CODE,null,null); 17 | } 18 | public static ResultVo success(String msg){ 19 | return Vo(StatusCode.SUCCESS_CODE,msg,null); 20 | } 21 | 22 | /** 23 | * 返回带参数 24 | * @return 25 | */ 26 | public static ResultVo success(String msg,Object data){ 27 | return Vo(StatusCode.SUCCESS_CODE,msg,data); 28 | } 29 | public static ResultVo success(int code,String msg,Object data){ 30 | return Vo(code,msg,data); 31 | } 32 | public static ResultVo Vo(int code,String msg,Object data){ 33 | return new ResultVo(code,msg,data); 34 | } 35 | 36 | /** 37 | * 错误返回 38 | * @return 39 | */ 40 | public static ResultVo error(){ 41 | return Vo(StatusCode.ERROR_CODE,null,null); 42 | } 43 | public static ResultVo error(String msg){ 44 | return Vo(StatusCode.ERROR_CODE,msg,null); 45 | } 46 | public static ResultVo error(int code,String msg,Object data){ 47 | return Vo(code,msg,data); 48 | } 49 | public static ResultVo error(int code,String msg){ 50 | return Vo(code,msg,null); 51 | } 52 | public static ResultVo error(String msg,Object data){ 53 | return Vo(StatusCode.ERROR_CODE,msg,data); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/cc/utils/ValidateCodeUtils.java: -------------------------------------------------------------------------------- 1 | package com.cc.utils; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * 随机生成验证码工具类 7 | */ 8 | public class ValidateCodeUtils { 9 | /** 10 | * 随机生成验证码 11 | * @param length 长度为4位或者6位 12 | * @return 13 | */ 14 | public static Integer generateValidateCode(int length){ 15 | Integer code =null; 16 | if(length == 4){ 17 | code = new Random().nextInt(9999);//生成随机数,最大为9999 18 | if(code < 1000){ 19 | code = code + 1000;//保证随机数为4位数字 20 | } 21 | }else if(length == 6){ 22 | code = new Random().nextInt(999999);//生成随机数,最大为999999 23 | if(code < 100000){ 24 | code = code + 100000;//保证随机数为6位数字 25 | } 26 | }else{ 27 | throw new RuntimeException("只能生成4位或6位数字验证码"); 28 | } 29 | return code; 30 | } 31 | 32 | /** 33 | * 随机生成指定长度字符串验证码 34 | * @param length 长度 35 | * @return 36 | */ 37 | public static String generateValidateCode4String(int length){ 38 | Random rdm = new Random(); 39 | String hash1 = Integer.toHexString(rdm.nextInt()); 40 | String capstr = hash1.substring(0, length); 41 | return capstr; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "server", 5 | "type": "java.lang.String", 6 | "description": "Description for server." 7 | } 8 | ] } -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号配置 2 | server: 3 | port: 80 4 | 5 | #数据库连接配置 6 | spring: 7 | datasource: 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | url: jdbc:mysql://localhost:3306/management?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 11 | username: root 12 | password: root 13 | 14 | #redis配置 15 | redis: 16 | host: 47.103.1.96 17 | port: 6379 18 | Auth: 123456 19 | database: 0 20 | cache: 21 | redis: 22 | time-to-live: 300000 #设置缓存数据的过期时间 23 | 24 | #mybatis plus配置 25 | mybatis-plus: 26 | configuration: 27 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 28 | global-config: 29 | db-config: 30 | #配置mybatis plus 在更新时只更新非空和非NULL的字段 31 | update-strategy: not_empty 32 | 33 | #配置登录请求url 34 | cc: 35 | loginUrl: /user/login 36 | commInfoUrl: /community/comminfo 37 | workerListUrl: /worker/workerList 38 | noticeListUrl: /notice/getNoticeList 39 | facListUrl: /facilities/getFacList 40 | sendMsgUrl: /liver/sendMsg 41 | resetPassUrl: /liver/resetPassword 42 | 43 | #jwt配置 44 | jwt: 45 | secret: pitayafruit 46 | #30分钟过期 47 | expiration: 1800000 48 | 49 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ComplaintMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ElectricMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 22 | -------------------------------------------------------------------------------- /src/main/resources/mapper/HouseMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 32 | -------------------------------------------------------------------------------- /src/main/resources/mapper/LiverMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 30 | -------------------------------------------------------------------------------- /src/main/resources/mapper/MenuMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 24 | 25 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/mapper/NoticeMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ParkMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/mapper/RepairMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/mapper/RoleAndMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | INSERT INTO tb_role_menu(role_id,menu_id) VALUES 10 | 11 | (#{roleId},#{item}) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UnitMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/mapper/WaterMapper.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 22 | -------------------------------------------------------------------------------- /src/test/java/com/cc/ManageBackendApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.cc; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ManageBackendApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /前台.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pitayafruits/manage_backend/2c120d10c8bf9da728d41ce0923ca7ce4c05dc79/前台.png -------------------------------------------------------------------------------- /后台.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pitayafruits/manage_backend/2c120d10c8bf9da728d41ce0923ca7ce4c05dc79/后台.png --------------------------------------------------------------------------------