@TOC
springboot494基于java的综合小区管理系统pf
第1章 绪论
1.1 课题背景
二十一世纪互联网的出现,改变了几千年以来人们的生活,不仅仅是生活物资的丰富,还有精神层次的丰富。在互联网诞生之前,地域位置往往是人们思想上不可跨域的鸿沟,信息的传播速度极慢,信息处理的速度和要求还是通过人们骑马或者是信鸽传递,这些信息传递都是不可控制的,中间很有可能丢失,信息的传递水平决定了人们生活的水平。如今大家都在使用互联网软件产品,从内部管理设置计算机管理,提高内部信息化的管理水准,从外部市场也可以用计算机获取相关数据进行处理,如今各行各业已经严重依赖于计算机了。
本课题研究和开发综合小区管理系统管理系统,让安装在计算机上的该系统变成管理人员的小帮手,提高综合小区管理系统信息处理速度,规范综合小区管理系统信息处理流程,让管理人员的产出效益更高。
1.2 课题意义
传统处理数据,必须是一张张纸,然后处理完毕又是统计在一张张纸上面,不断的重复处理,最终有个结果给最高层作为参考,这个模式在互联网没有出现之前,是一种常见的事情,信息管理的效率提不上去,人多不一定力量大,因为人多肯定更加消耗资源,并且因为人类需要休息,需要管理,思想会不统一,会偷懒,所以人们研究出专门帮助人们计算的机器,就是计算机的前身,到了互联网时代,人们发现完全可以让程序供应商提供解决方案,自己挑选自己合适的方案来提高自己的产出比。所以在日常工作和生活中会发现各种各样方便人们的工具。
本课题研发的综合小区管理系统管理系统,就是提供综合小区管理系统信息处理的解决方案,它可以短时间处理完信息,并且这些信息都有专门的存储设备,而且数据的备份和迁移都可以设定为无人值守,从人力角度和信息处理角度以及信息安全角度,综合小区管理系统管理系统是完胜传统纸质操作的。
1.3 研究内容
本文对综合小区管理系统管理系统的设计与实现分成六个章节来说明。
第1章:研究综合小区管理系统管理系统的背景,以及开发综合小区管理系统管理系统的意义。
第2章:对开发综合小区管理系统管理系统的环境还有技术进行说明。
第3章:分析综合小区管理系统管理系统的可行性,性能,流程以及功能。
第4章:设计综合小区管理系统管理系统的功能结构,设计数据库E-R图以及对数据表的存储结构进行设计。
第5章:实现综合小区管理系统管理系统的功能并进行功能界面展示。
第6章:对系统测试进行阐述,以及对本系统部分功能进行检测。
第2章 开发环境与技术
本章节对开发综合小区管理系统管理系统需要搭建的开发环境,还有综合小区管理系统管理系统开发中使用的编程技术等进行阐述。
2.1 Java语言
Java语言是当今为止依然在编程语言行业具有生命力的常青树之一。Java语言最原始的诞生,不仅仅是创造者感觉C语言在编程上面很麻烦,如果只是专注于业务逻辑的处理,会导致忽略了各种指针以及垃圾回收这些操作,导致出现问题需要解决的时间往往大于正常编程处理业务逻辑的时间,这些是非常浪费时间的。Java语言的创造者就考虑到如何避免这个问题,把指针处理和垃圾处理全部自动化,虽然这会损失一些性能,但是计算机硬件在性能上的发展速度是很快的,这些性能是可以忽略考虑的。并且C语言是针对硬件开发的语言,虽然执行效率高,但是随着硬件的变化或者操作系统的变更,就需要重新编写程序,造成重复劳动,只有解决重复性劳动的语言才算符合生存规律的语言。Java语言的创造者就针对C语言的缺点专门开发了Java语言。让Java语言不管是在什么样的环境里都是可以运行,因为在Java语言运行外面套了一个壳,也就是虚拟机,只要是Java虚拟机能安装的电脑都可以运行Java的程序。
2.2 MYSQL数据库
MySQL数据库是一种数据存放方面的专业软件,也是传统的行式数据模式,获取一些数据是先一行一行的获取,然后一行一行的显示,与列式数据库不同。行式数据库主要是处理最重要的数据逻辑部分,并且必须是有效数据,这样每一处的数据关联都是不可损坏,对数据安全要求比较严格还是用MySQL数据库比较好。列式数据库的发明仅仅是因为读取效率高,但是也就仅仅如此罢了。MySQL虽然比起Oracle或者SQL Server来讲,安装包只是几十兆甚至几百兆,有点小,但是功能并不会弱到哪里,严格遵循SQL标准语法。MySQL的数据存放形式从大向小的说是数据库最大,然后是表,每个表里面存放数据是有一定的规则的,数据存放是表格形式的,也就是说有横也有竖,横着的为行,一般表示一条数据,表与表之间还可以进行关联,进行分表操作,如果一条数据相关项目属性太多,那么可以把有效的相关联系做成关联,可以设定是否唯一。
2.3 IDEA开发工具
IDEA是捷克共和国的Java程序员开发人员创造的一个开发软件,刚开始主要是对于用Eclipse软件他们用得不顺手,所以直接开发了这款软件。之所以不顺手原因在于没有代码提升功能,原因是Eclipse只是把代码提示作为一种插件形式的存在,如果有些程序开发人员不清楚代码提示插件可能会出问题,并且代码提示只是用来作为插件,所以功能上有所欠缺。IDEA不仅仅代码提示做的很好,在代码重构上面更上如虎添翼,程序开发人员可以选择一段代码然后IDEA就会对代码进行分解重构,有效的把代码弄得更够层次感,复用性更高,用着更简洁和方便,大大的减少了代码工作量,提升了代码开发效率。当然,IDEA对于使用者这么好,肯定也是有目的的,原因在于插件越多越友好,就需要花费大量的金钱来使用,所以说IDEA使用主要是看自己喜好。
2.4 Spring Boot框架
Spring Boot是一种不需要代码生成的一种框架,并且可以不需要配置任何的XML文件就可以,因为Spring Boot里面自带了很多接口,只需要配置不同的接口就会自动的应用并且识别需要的依赖,在配置方面非常的方便,使用起来感觉像没有用到框架的感觉。Spring Boot有很多默认的配置文件,并且可以对默认的配置文件进行修改,可以设置为自动加载,可以对异常处理分为全局异常处理和默认异常处理。Spring Boot使用过程中就像是使用什么直接注册什么,所谓的注册也就是在对应的类和方法上面进行一个特殊的声明即可。
第3章 系统分析
本文作者在确定了研究的课题之后,从各大数字图书馆下载文献来阅读,并了解同类型的网站具备的大致功能,然后具体事务具体分析,得出本系统要研究的具体功能与性能。虽然分析系统这一阶段性工作主要是确定功能,但它却影响着后面系统开发环节的进展,系统分析这个环节是不能少的。
3.1 可行性分析
从三个不同的角度来分析,确保开发成功的前提是有可行性分析,只有进行提前分析,符合程序开发流程才不至于开发过程的中断。
3.1.1 技术可行性
在技术实现层次,分析了好几种技术实现方法,并且都有对应的成功案例,也有很多开源模块可以进行参考,所以从技术可行性分析来讲,实现综合小区管理系统管理系统是没有问题的。
3.1.2 经济可行性
对于身为学生的开发者而言,在经济资源上面可用者很少,为了开发综合小区管理系统管理系统,通过开发软件对硬件的要求,发现自己的电脑是完全能用来开发的,并且学校机房的配置也可以达到要求。最重要的是选择的技术都可以在网上找到不花钱的教程以及资料,因为不花钱,所以经济方面是具有可行性的。
3.1.3 操作可行性
综合小区管理系统管理系统的具体实现,本身参考人类的正常操作逻辑,把常用的操作习惯当做主要的导航实现,可以让使用者更快速的理解并且上手操作,实现符合逻辑的操作流程是操作可行性的具体体现。
以上就是从不同的角度来分析,确保了综合小区管理系统管理系统的正常开展。
3.2 系统流程
综合小区管理系统管理系统投入使用后,使用者如果能看到相应的流程操作图会提高程序的理解能力。
3.2.1 操作流程
使用者在操作综合小区管理系统管理系统中,应该按照本系统提供的操作流程(图3.1即为本系统的操作流程图)进行操作,可以减少操作失误,从而节省进入综合小区管理系统管理系统的时间。
图3.1 系统操作流程
3.2.2 登录流程
综合小区管理系统管理系统通过登录功能(图3.2即为其登录的流程)引导使用者进入指定的功能操作区,也避免非本系统的用户享受本系统提供的服务以及查看本系统提供的信息,进而保证用户安全。
图3.2 登录流程
3.2.3 删除信息流程
综合小区管理系统管理系统在经过长期使用后,会产生很多的数据信息。为了腾出存储空间存放更多的数据,本系统数据库中存储的数据,一些没有参考价值的数据需要进行删除(图3.3即为删除信息的流程),删除数据过程中,为避免误删,使用者要根据系统的提示来决定是否删除数据。
图3.3 删除信息流程
3.2.4 添加信息流程
综合小区管理系统管理系统提供可视化的功能操作区,非常方便使用者进行数据操作,当使用者往系统中录入数据时(图3.4即为添加信息的流程),本系统也会进行数据合法性的判断,符合要求的数据才能够在数据库指定表中进行登记。
图3.4 添加信息流程
3.3 性能需求
需求分析少不了对项目用到的硬件设备进行分析,这样才符合正常的分析流程。只谈功能需求不谈性能需求,是一件很严重的事情,可能会导致一些不可控的问题出现。
以下从这几个角度来分析系统性能。
(1)系统数据的容量:从数据角度来分析,每个表和每个数据库,达到的数据量到一定的程度,是否需要分表或者是分库,超过了数据的设定限度,可能会导致数据反映迟钝,容错量增加。
(2)数据精度的要求:需要对需求分析里面数据设定环节,考虑相应的数据精度问题,需要发现数据是常用的精度还是非常用的精度,进而设定不同的数值。
(3)时间响应要求:从用户提交操作,到页面反映,中间有个数据处理的问题,需要考虑预测数据量的大小,提前预案分库分表的设计,数据量再大就要考虑增加列式数据库的问题,这些都不是一拍脑门就能决定的,都需要经验和同行业的数据分析研判,才能符合用户的要求,毕竟响应时间太久操作起来也不舒服。
(4)普适性问题:用户使用应该不需要感知服务端的数据量问题或者响应问题,只需要任意一台电脑,不需要更多的操作,打开浏览器就能用,太多的设置以及操作,不符合普适性操作。
(5)页面设计问题:功能符合要求之后,肯定是要丰富页面的。页面设计才是用户长时间面对的问题,首先考虑数据的整洁性,让页面看起来更加的清爽。颜色与数据方面,该不同颜色就不同颜色,降低用户长时间使用出现的视觉疲劳,让用户使用起来心情不至于太差。
(6)系统的稳定性:正常用户操作系统页面,必须是该提交提交,正常输入符合逻辑,不能随随便便的就出各种问题,导致用户操作疲惫,并且输入的数据和回显的数据符合用户的要求。如果正常操作都会出现问题,那设计就是不稳定的,这一点肯定不行。只要是与数据进行交互的系统,都必须稳定。系统稳定从开发部署角度上来分析,可以考虑数据的冗余备份功能,自动值守功能,机房数据同步,机房分开的功能,这些都可以让系统的稳定性得到提升。
系统的性能需求需要对业务很熟练的情况下判断然后分析,再从系统性能需求来逐条实现,可以让设计的系统有使用价值。
3.4 功能需求
综合小区管理系统管理系统根据使用权限的角度进行功能分析,并运用用例图来展示各个权限需要操作的功能。
第4章 系统设计
用户对着浏览器操作,肯定会出现某些不可预料的问题,但是不代表着系统对于用户在浏览器上的操作不进行处理,所以说,要提前考虑可能会出现的问题。
4.1 系统设计思想
系统设计,肯定要把设计的思想进行统一,只有统一的思想才能指导程序的开发,并且可以让众多的程序开发人员更快速的进入状态,提高开发速度。根据当前系统的既定需求,下面将进行本系统设计思想的阐述。
(1)扩展性:开发任何一个系统的时候不可避免要考虑这个问题。软件版本的更迭是一种常识,任何一个软件都不会一次性开发就成永恒,软件是一个不断成长的东西。所以考虑问题的时候需要对当前问题进行数据上的扩大化,然后进行归纳整理,最终形成具有一定扩展性的程序。程序的可扩展性必然会影响开发进度,所以最终需要综合评估程序的可扩展程度,进而有的放矢,循序开发。
(2)实用性:程序设计是一个先高屋建瓴式的设想,然后再具体化,实用性就是具体化的第一个步骤,要充分考虑使用者是不懂程序设计的这一点,使用者只是懂得常规性的上网操作步骤,并不需要对程序进行理解,所以一定要让使用者感觉到便利,感觉到实用性的存在,如果使用者使用程序过程中没发现使用程序的好处,那么程序设计的实用性将大大降低。
(3)安全性:当使用者使用的过程中,会产生大量的相关数据,这些数据必须有安全性的保证,否则当使用者发现数据出现问题的原因是程序设计问题的时候,将会对程序开发者失去信任,甚至可能会产生大量的费用赔偿问题,这是一个不可避免的问题。所以安全性关系开发与使用者双方的经济利益,程序的安全性是一定要保证的。
(4)先进性:程序设计的先进性是开发者进行考虑的,必须要在满足系统功能的前提下,必须要选择好当下最合适的技术。最合适的技术要从开发成本,使用成本以及维护成本里面综合分析,经过综合分析后要让技术实现最优解,保持先进的技术生产力。
(5)维护性:程序开发之初就要考虑以后的维护问题。维护是在程序开发完毕,已经上线可以运作,进入生产试用过程和使用过程中才会发现需要维护的必要。要通过各方面降低维护成本,不是说维护的越少就代表程序开发的越完美,程序既然是人类进行设计制造的,肯定有很多不可避免的问题产生,那么如何维护好程序的正常运作也是一门很重要的学问。
4.2 功能结构设计
图4.1即为设计的管理员功能结构,管理员权限操作的功能包括管理公告,管理综合小区管理系统信息,包括出入管理,报修管理,报修管理,物业费缴纳等,可以管理操作员。
图4.1 管理员功能结构
4.3 数据库设计
综合小区管理系统管理系统运行中产生的数据需要按照提前设置的存储规则进行保存,设计出一个符合项目的最优数据存储格式,因为它能减少用户的等待时间,还可以对系统的请求在最短时间内进行响应。所以,对数据库设计时,需要对功能需求进行详细的拆分,以及对业务状态的细分,然后设计具体的存储规则,保证数据库能正常运作,缩短数据处理时间,并在一定程度上降低数据冗余,节省存储空间。
4.3.1 数据库概念设计
实体-联系图还有一个名称即E-R图,是Entity Relationship Diagram各英文单词首字母的缩写,它这种概念模型通常用于对现实世界进行描述。同时它还是一种能够直观表达数据中实体,联系,属性的有效手段。绘制E-R图能够选择的工具也有很多,但是Office Visio 这款软件在E-R图的绘制上一般都是作为首选工具,因为它是基于可视化处理,使用它创建E-R图非常简单。使用基本的E-R图构成元素,比如椭圆,菱形,矩形,还有实线段来表达对应的信息,椭圆代表属性,即实体的特征,矩形代表实体,即数据库中的一个具体数据表,菱形代表实体中相互关系,实线段主要是完成椭圆,矩形,菱形的连接。
(1)下图是房屋实体和其具备的属性。
房屋实体属性图
(2)下图是出入实体和其具备的属性。
出入实体属性图
(3)下图是用户实体和其具备的属性。
用户实体属性图
(4)下图是报修实体和其具备的属性。
报修实体属性图
(5)下图是物业费缴纳实体和其具备的属性。
物业费缴纳实体属性图
(6)下图是车位分配实体和其具备的属性。
车位分配实体属性图
(7)下图是物业人员投诉实体和其具备的属性。
物业人员投诉实体属性图
(8)下图是我的私信实体和其具备的属性。
我的私信实体属性图
(9)下图是公告实体和其具备的属性。
公告实体属性图
(10)下图是车位实体和其具备的属性。
车位实体属性图
(11)下图是物业人员实体和其具备的属性。
物业人员实体属性图
4.3.2 数据库物理设计
本小节主要任务即是根据上述内容进行数据存储结构的设计,实体的属性就用来表示字段名称,不同的字段表示的数据类型以及取值都不相同,以及该表各个字段是否能够保持空等进行说明,设计完成一张数据表的结构之后,在保存时同样要命名,尽量选择英文名称进行命名并保存,还不容易导致系统出错。接下来就对设计的表进行简单说明。
表4.1报修表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | baoxiu_name | String | 报修名称 | 是 |
4 | baoxiu_photo | String | 报修图片 | 是 |
5 | baoxiu_types | Integer | 报修类型 | 是 |
6 | insert_time | Date | 申请报修时间 | 是 |
7 | baoxiu_zhuangtai_types | Integer | 报修状态 | 是 |
8 | baoxiu_content | String | 报修详情 | 是 |
9 | create_time | Date | 创建时间 | 是 |
表4.2车位表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | chewei_name | String | 车位位置 | 是 |
3 | insert_time | Date | 录入时间 | 是 |
4 | chewei_types | Integer | 车位类型 | 是 |
5 | chewei_zhuangtai_types | Integer | 车类状态 | 是 |
6 | chewei_xiangqing | String | 车位详情 | 是 |
7 | create_time | Date | 创建时间 | 是 |
表4.3车位分配表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | chewei_id | Integer | 车位 | 是 |
3 | yonghu_id | Integer | 住户 | 是 |
4 | fenpei_time | Date | 分配时间 | 是 |
5 | create_time | Date | 创建时间 | 是 |
表4.4出入表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | churu_name | String | 出入名称 | 是 |
4 | churu_types | Integer | 出入类型 | 是 |
5 | churu_time | Date | 出入时间 | 是 |
6 | churu_content | String | 出入介绍 | 是 |
7 | churu_delete | Integer | 逻辑删除 | 是 |
8 | insert_time | Date | 录入时间 | 是 |
9 | create_time | Date | 创建时间 | 是 |
表4.5字典表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | dic_code | String | 字段 | 是 |
3 | dic_name | String | 字段名 | 是 |
4 | code_index | Integer | 编码 | 是 |
5 | index_name | String | 编码名字 | 是 |
6 | super_id | Integer | 父字段id | 是 |
7 | beizhu | String | 备注 | 是 |
8 | create_time | Date | 创建时间 | 是 |
表4.6房屋表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | fangwu_louhao_types | Integer | 房屋楼号 | 是 |
4 | fangwu_danyuan_types | Integer | 单元号 | 是 |
5 | fangwu_fanghao | String | 房间号 | 是 |
6 | fangwu_delete | Integer | 逻辑删除 | 是 |
7 | insert_time | Date | 录入时间 | 是 |
8 | create_time | Date | 创建时间 | 是 |
表4.7物业费缴纳表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | feiyong_name | String | 缴费 | 是 |
4 | feiyong_types | Integer | 缴费类型 | 是 |
5 | feiyong_zhuangtai_types | Integer | 缴费状态 | 是 |
6 | feiyong_time | String | 年月 | 是 |
7 | feiyong_old_money | BigDecimal | 缴费金额 | 是 |
8 | feiyong_delete | Integer | 逻辑删除 | 是 |
9 | insert_time | Date | 录入时间 | 是 |
10 | create_time | Date | 创建时间 | 是 |
表4.8公告表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | gonggao_name | String | 公告名称 | 是 |
3 | gonggao_photo | String | 公告图片 | 是 |
4 | gonggao_types | Integer | 公告类型 | 是 |
5 | insert_time | Date | 公告发布时间 | 是 |
6 | gonggao_content | String | 公告详情 | 是 |
7 | create_time | Date | 创建时间 | 是 |
表4.9物业人员投诉表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | liuyan_name | String | 投诉标题 | 是 |
4 | liuyan_text | String | 投诉内容 | 是 |
5 | insert_time | Date | 投诉时间 | 是 |
6 | reply_text | String | 回复内容 | 是 |
7 | update_time | Date | 回复时间 | 是 |
8 | create_time | Date | 创建时间 | 是 |
表4.10我的私信表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_id | Integer | 用户 | 是 |
3 | sixin_name | String | 留言标题 | 是 |
4 | sixin_text | String | 留言内容 | 是 |
5 | insert_time | Date | 留言时间 | 是 |
6 | create_time | Date | 创建时间 | 是 |
表4.11物业人员表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | wuye_name | String | 物业人员姓名 | 是 |
3 | wuye_phone | String | 物业人员手机号 | 是 |
4 | wuye_id_number | String | 物业人员身份证号 | 是 |
5 | wuye_photo | String | 物业人员头像 | 是 |
6 | wuye_types | Integer | 人员类型 | 是 |
7 | wuye_email | String | 物业人员邮箱 | 是 |
8 | create_time | Date | 创建时间 | 是 |
表4.12用户表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | yonghu_name | String | 用户姓名 | 是 |
3 | yonghu_phone | String | 用户手机号 | 是 |
4 | yonghu_id_number | String | 用户身份证号 | 是 |
5 | yonghu_photo | String | 用户头像 | 是 |
6 | yonghu_email | String | 用户邮箱 | 是 |
7 | new_money | BigDecimal | 余额 | 是 |
8 | create_time | Date | 创建时间 | 是 |
表4.13管理员表
序号 | 列名 | 数据类型 | 说明 | 允许空 |
---|---|---|---|---|
1 | Id | Int | id | 否 |
2 | username | String | 儿童名 | 是 |
3 | password | String | 密码 | 是 |
4 | role | String | 角色 | 是 |
5 | addtime | Date | 新增时间 | 是 |
第5章 系统实现
编程人员在搭建的开发环境中,会让各种编程技术一起呈现出最终效果。本节就展示关键部分的页面效果。
5.1 管理员功能实现
5.1.1 出入管理
图5.1 即为编码实现的出入管理界面,管理员在出入管理界面中可以对界面中显示,可以对招聘信息的招聘状态进行查看,可以添加新的招聘信息等。
图5.1 出入管理界面
5.1.2 报修管理
图5.2 即为编码实现的报修管理界面,管理员在报修管理界面中查看奖罚种类信息,奖罚描述信息,新增奖惩信息等。
图5.2 报修管理界面
5.1.3 车位管理
图5.3 即为编码实现的车位管理界面,管理员在车位管理界面中新增。
图5.3 车位管理界面
5.1.4 公告管理
图5.4 即为编码实现的公告管理界面,管理员在公告管理界面查看公告的工作状态,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
图5.4 公告管理界面
5.2 用户功能实现
5.2.1 物业人员投诉
图5.5 即为编码实现的物业人员投诉界面。
图5.5 物业人员投诉界面
5.2.2 报修管理
图5.6 即为编码实现的报修管理界面。
图5.6 报修管理界面
5.2.3 物业费缴纳
图5.7 即为编码实现的物业费缴纳界面。
图5.7 物业费缴纳界面
ConfigServiceImpl.java
package com.service.impl;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.ConfigDao;
import com.entity.ConfigEntity;
import com.service.ConfigService;
import com.utils.PageUtils;
import com.utils.Query;
/**
* 系统用户
* @author yangliyuan
* @date 2019年10月10日 上午9:17:59
*/
@Service("configService")
public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity> implements ConfigService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ConfigEntity> page = this.selectPage(
new Query<ConfigEntity>(params).getPage(),
new EntityWrapper<ConfigEntity>()
);
return new PageUtils(page);
}
}
CheweiController.java
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 车位
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/chewei")
public class CheweiController {
private static final Logger logger = LoggerFactory.getLogger(CheweiController.class);
private static final String TABLE_NAME = "chewei";
@Autowired
private CheweiService cheweiService;
@Autowired
private TokenService tokenService;
@Autowired
private BaoxiuService baoxiuService;//报修
@Autowired
private CheweiFenpeiService cheweiFenpeiService;//车位分配
@Autowired
private ChuruService churuService;//出入
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private FangwuService fangwuService;//房屋
@Autowired
private FeiyongService feiyongService;//物业费缴纳
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private LiuyanService liuyanService;//物业人员投诉
@Autowired
private SixinService sixinService;//我的私信
@Autowired
private WuyeService wuyeService;//物业人员
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private UsersService usersService;//管理员
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("物业人员".equals(role))
params.put("wuyeId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = cheweiService.queryPage(params);
//字典表数据转换
List<CheweiView> list =(List<CheweiView>)page.getList();
for(CheweiView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
CheweiEntity chewei = cheweiService.selectById(id);
if(chewei !=null){
//entity转view
CheweiView view = new CheweiView();
BeanUtils.copyProperties( chewei , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CheweiEntity chewei, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,chewei:{}",this.getClass().getName(),chewei.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<CheweiEntity> queryWrapper = new EntityWrapper<CheweiEntity>()
.eq("chewei_name", chewei.getCheweiName())
.eq("chewei_types", chewei.getCheweiTypes())
.eq("chewei_zhuangtai_types", chewei.getCheweiZhuangtaiTypes())
.eq("chewei_xiangqing", chewei.getCheweiXiangqing())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
CheweiEntity cheweiEntity = cheweiService.selectOne(queryWrapper);
if(cheweiEntity==null){
chewei.setInsertTime(new Date());
chewei.setCreateTime(new Date());
cheweiService.insert(chewei);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody CheweiEntity chewei, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,chewei:{}",this.getClass().getName(),chewei.toString());
CheweiEntity oldCheweiEntity = cheweiService.selectById(chewei.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
cheweiService.updateById(chewei);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<CheweiEntity> oldCheweiList =cheweiService.selectBatchIds(Arrays.asList(ids));//要删除的数据
cheweiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName, HttpServletRequest request){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<CheweiEntity> cheweiList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
CheweiEntity cheweiEntity = new CheweiEntity();
// cheweiEntity.setCheweiName(data.get(0)); //车位位置 要改的
// cheweiEntity.setInsertTime(date);//时间
// cheweiEntity.setCheweiTypes(Integer.valueOf(data.get(0))); //车位类型 要改的
// cheweiEntity.setCheweiZhuangtaiTypes(Integer.valueOf(data.get(0))); //车类状态 要改的
// cheweiEntity.setCheweiXiangqing(data.get(0)); //车位详情 要改的
// cheweiEntity.setCreateTime(date);//时间
cheweiList.add(cheweiEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
cheweiService.insertBatch(cheweiList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
CommonUtil.checkMap(params);
PageUtils page = cheweiService.queryPage(params);
//字典表数据转换
List<CheweiView> list =(List<CheweiView>)page.getList();
for(CheweiView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
CheweiEntity chewei = cheweiService.selectById(id);
if(chewei !=null){
//entity转view
CheweiView view = new CheweiView();
BeanUtils.copyProperties( chewei , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CheweiEntity chewei, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,chewei:{}",this.getClass().getName(),chewei.toString());
Wrapper<CheweiEntity> queryWrapper = new EntityWrapper<CheweiEntity>()
.eq("chewei_name", chewei.getCheweiName())
.eq("chewei_types", chewei.getCheweiTypes())
.eq("chewei_zhuangtai_types", chewei.getCheweiZhuangtaiTypes())
.eq("chewei_xiangqing", chewei.getCheweiXiangqing())
// .notIn("chewei_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
CheweiEntity cheweiEntity = cheweiService.selectOne(queryWrapper);
if(cheweiEntity==null){
chewei.setInsertTime(new Date());
chewei.setCreateTime(new Date());
cheweiService.insert(chewei);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
WuyeController.java
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 物业人员
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/wuye")
public class WuyeController {
private static final Logger logger = LoggerFactory.getLogger(WuyeController.class);
private static final String TABLE_NAME = "wuye";
@Autowired
private WuyeService wuyeService;
@Autowired
private TokenService tokenService;
@Autowired
private BaoxiuService baoxiuService;//报修
@Autowired
private CheweiService cheweiService;//车位
@Autowired
private CheweiFenpeiService cheweiFenpeiService;//车位分配
@Autowired
private ChuruService churuService;//出入
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private FangwuService fangwuService;//房屋
@Autowired
private FeiyongService feiyongService;//物业费缴纳
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private LiuyanService liuyanService;//物业人员投诉
@Autowired
private SixinService sixinService;//我的私信
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private UsersService usersService;//管理员
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("物业人员".equals(role))
params.put("wuyeId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = wuyeService.queryPage(params);
//字典表数据转换
List<WuyeView> list =(List<WuyeView>)page.getList();
for(WuyeView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
WuyeEntity wuye = wuyeService.selectById(id);
if(wuye !=null){
//entity转view
WuyeView view = new WuyeView();
BeanUtils.copyProperties( wuye , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody WuyeEntity wuye, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,wuye:{}",this.getClass().getName(),wuye.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<WuyeEntity> queryWrapper = new EntityWrapper<WuyeEntity>()
.eq("username", wuye.getUsername())
.or()
.eq("wuye_phone", wuye.getWuyePhone())
.or()
.eq("wuye_id_number", wuye.getWuyeIdNumber())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
WuyeEntity wuyeEntity = wuyeService.selectOne(queryWrapper);
if(wuyeEntity==null){
wuye.setCreateTime(new Date());
wuye.setPassword("123456");
wuyeService.insert(wuye);
return R.ok();
}else {
return R.error(511,"账户或者物业人员手机号或者物业人员身份证号已经被使用");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody WuyeEntity wuye, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,wuye:{}",this.getClass().getName(),wuye.toString());
WuyeEntity oldWuyeEntity = wuyeService.selectById(wuye.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
if("".equals(wuye.getWuyePhoto()) || "null".equals(wuye.getWuyePhoto())){
wuye.setWuyePhoto(null);
}
wuyeService.updateById(wuye);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<WuyeEntity> oldWuyeList =wuyeService.selectBatchIds(Arrays.asList(ids));//要删除的数据
wuyeService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName, HttpServletRequest request){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<WuyeEntity> wuyeList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
WuyeEntity wuyeEntity = new WuyeEntity();
// wuyeEntity.setUsername(data.get(0)); //账户 要改的
// //wuyeEntity.setPassword("123456");//密码
// wuyeEntity.setWuyeName(data.get(0)); //物业人员姓名 要改的
// wuyeEntity.setWuyePhone(data.get(0)); //物业人员手机号 要改的
// wuyeEntity.setWuyeIdNumber(data.get(0)); //物业人员身份证号 要改的
// wuyeEntity.setWuyePhoto("");//详情和图片
// wuyeEntity.setSexTypes(Integer.valueOf(data.get(0))); //性别 要改的
// wuyeEntity.setWuyeTypes(Integer.valueOf(data.get(0))); //人员类型 要改的
// wuyeEntity.setWuyeEmail(data.get(0)); //物业人员邮箱 要改的
// wuyeEntity.setCreateTime(date);//时间
wuyeList.add(wuyeEntity);
//把要查询是否重复的字段放入map中
//账户
if(seachFields.containsKey("username")){
List<String> username = seachFields.get("username");
username.add(data.get(0));//要改的
}else{
List<String> username = new ArrayList<>();
username.add(data.get(0));//要改的
seachFields.put("username",username);
}
//物业人员手机号
if(seachFields.containsKey("wuyePhone")){
List<String> wuyePhone = seachFields.get("wuyePhone");
wuyePhone.add(data.get(0));//要改的
}else{
List<String> wuyePhone = new ArrayList<>();
wuyePhone.add(data.get(0));//要改的
seachFields.put("wuyePhone",wuyePhone);
}
//物业人员身份证号
if(seachFields.containsKey("wuyeIdNumber")){
List<String> wuyeIdNumber = seachFields.get("wuyeIdNumber");
wuyeIdNumber.add(data.get(0));//要改的
}else{
List<String> wuyeIdNumber = new ArrayList<>();
wuyeIdNumber.add(data.get(0));//要改的
seachFields.put("wuyeIdNumber",wuyeIdNumber);
}
}
//查询是否重复
//账户
List<WuyeEntity> wuyeEntities_username = wuyeService.selectList(new EntityWrapper<WuyeEntity>().in("username", seachFields.get("username")));
if(wuyeEntities_username.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(WuyeEntity s:wuyeEntities_username){
repeatFields.add(s.getUsername());
}
return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());
}
//物业人员手机号
List<WuyeEntity> wuyeEntities_wuyePhone = wuyeService.selectList(new EntityWrapper<WuyeEntity>().in("wuye_phone", seachFields.get("wuyePhone")));
if(wuyeEntities_wuyePhone.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(WuyeEntity s:wuyeEntities_wuyePhone){
repeatFields.add(s.getWuyePhone());
}
return R.error(511,"数据库的该表中的 [物业人员手机号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
//物业人员身份证号
List<WuyeEntity> wuyeEntities_wuyeIdNumber = wuyeService.selectList(new EntityWrapper<WuyeEntity>().in("wuye_id_number", seachFields.get("wuyeIdNumber")));
if(wuyeEntities_wuyeIdNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(WuyeEntity s:wuyeEntities_wuyeIdNumber){
repeatFields.add(s.getWuyeIdNumber());
}
return R.error(511,"数据库的该表中的 [物业人员身份证号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
wuyeService.insertBatch(wuyeList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
WuyeEntity wuye = wuyeService.selectOne(new EntityWrapper<WuyeEntity>().eq("username", username));
if(wuye==null || !wuye.getPassword().equals(password))
return R.error("账号或密码不正确");
String token = tokenService.generateToken(wuye.getId(),username, "wuye", "物业人员");
R r = R.ok();
r.put("token", token);
r.put("role","物业人员");
r.put("username",wuye.getWuyeName());
r.put("tableName","wuye");
r.put("userId",wuye.getId());
return r;
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody WuyeEntity wuye, HttpServletRequest request) {
// ValidatorUtils.validateEntity(user);
Wrapper<WuyeEntity> queryWrapper = new EntityWrapper<WuyeEntity>()
.eq("username", wuye.getUsername())
.or()
.eq("wuye_phone", wuye.getWuyePhone())
.or()
.eq("wuye_id_number", wuye.getWuyeIdNumber())
;
WuyeEntity wuyeEntity = wuyeService.selectOne(queryWrapper);
if(wuyeEntity != null)
return R.error("账户或者物业人员手机号或者物业人员身份证号已经被使用");
wuye.setCreateTime(new Date());
wuyeService.insert(wuye);
return R.ok();
}
/**
* 重置密码
*/
@GetMapping(value = "/resetPassword")
public R resetPassword(Integer id, HttpServletRequest request) {
WuyeEntity wuye = wuyeService.selectById(id);
wuye.setPassword("123456");
wuyeService.updateById(wuye);
return R.ok();
}
/**
* 修改密码
*/
@GetMapping(value = "/updatePassword")
public R updatePassword(String oldPassword, String newPassword, HttpServletRequest request) {
WuyeEntity wuye = wuyeService.selectById((Integer)request.getSession().getAttribute("userId"));
if(newPassword == null){
return R.error("新密码不能为空") ;
}
if(!oldPassword.equals(wuye.getPassword())){
return R.error("原密码输入错误");
}
if(newPassword.equals(wuye.getPassword())){
return R.error("新密码不能和原密码一致") ;
}
wuye.setPassword(newPassword);
wuyeService.updateById(wuye);
return R.ok();
}
/**
* 忘记密码
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) {
WuyeEntity wuye = wuyeService.selectOne(new EntityWrapper<WuyeEntity>().eq("username", username));
if(wuye!=null){
wuye.setPassword("123456");
wuyeService.updateById(wuye);
return R.ok();
}else{
return R.error("账号不存在");
}
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrWuye(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
WuyeEntity wuye = wuyeService.selectById(id);
if(wuye !=null){
//entity转view
WuyeView view = new WuyeView();
BeanUtils.copyProperties( wuye , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
CommonUtil.checkMap(params);
PageUtils page = wuyeService.queryPage(params);
//字典表数据转换
List<WuyeView> list =(List<WuyeView>)page.getList();
for(WuyeView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
WuyeEntity wuye = wuyeService.selectById(id);
if(wuye !=null){
//entity转view
WuyeView view = new WuyeView();
BeanUtils.copyProperties( wuye , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody WuyeEntity wuye, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,wuye:{}",this.getClass().getName(),wuye.toString());
Wrapper<WuyeEntity> queryWrapper = new EntityWrapper<WuyeEntity>()
.eq("username", wuye.getUsername())
.or()
.eq("wuye_phone", wuye.getWuyePhone())
.or()
.eq("wuye_id_number", wuye.getWuyeIdNumber())
// .notIn("wuye_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
WuyeEntity wuyeEntity = wuyeService.selectOne(queryWrapper);
if(wuyeEntity==null){
wuye.setCreateTime(new Date());
wuye.setPassword("123456");
wuyeService.insert(wuye);
return R.ok();
}else {
return R.error(511,"账户或者物业人员手机号或者物业人员身份证号已经被使用");
}
}
}
add-or-update.vue
<template>
<div class="addEdit-block">
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="auto"
>
<el-row>
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="性别类型编码" prop="codeIndex">
<el-input v-model="ruleForm.codeIndex"
placeholder="性别类型编码" clearable :readonly="ro.codeIndex"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="性别类型编码" prop="codeIndex">
<el-input v-model="ruleForm.codeIndex"
placeholder="性别类型编码" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="性别类型" prop="indexName">
<el-input v-model="ruleForm.indexName"
placeholder="性别类型" clearable :readonly="ro.indexName"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="性别类型" prop="indexName">
<el-input v-model="ruleForm.indexName"
placeholder="性别类型" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!--<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="备注" prop="beizhu">
<el-input v-model="ruleForm.beizhu"
placeholder="备注" clearable :readonly="ro.beizhu"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="备注" prop="beizhu">
<el-input v-model="ruleForm.beizhu"
placeholder="备注" readonly></el-input>
</el-form-item>
</div>
</el-col>-->
</el-row>
<el-form-item class="btn">
<el-button v-if="type!='info'" type="primary" class="btn-success" @click="onSubmit">提交</el-button>
<el-button v-if="type!='info'" class="btn-close" @click="back()">取消</el-button>
<el-button v-if="type=='info'" class="btn-close" @click="back()">返回</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import styleJs from "../../../utils/style.js";
// 数字,邮件,手机,url,身份证校验
import { isNumber,isIntNumer,isEmail,isPhone, isMobile,isURL,checkIdCard } from "@/utils/validate";
export default {
data() {
let self = this
return {
addEditForm:null,
id: '',
type: '',
ro:{
codeIndex : true,
indexName : false,
superId : false,
beizhu : false,
},
ruleForm: {
codeIndex: '',
indexName: '',
superId : '',
beizhu : '',
},
rules: {
/*beizhu: [
{ required: true, message: '备注不能为空', trigger: 'blur' },
{ pattern: /^[1-9]\d*$/,
message: '备注只能为正整数',
trigger: 'blur'
}
],*/
}
};
},
props: ["parent"],
computed: {
},
created() {
this.addEditForm = styleJs.addStyle();
this.addEditStyleChange()
this.addEditUploadStyleChange()
},
methods: {
// 初始化
init(id,type) {
if (id) {
this.id = id;
this.type = type;
}
if(this.type=='info'||this.type=='else'){
this.info(id);
}else{
//查询最大值 start
this.$http({
url: `dictionary/maxCodeIndex`,
method: "post",
data: {"dicCode":"sex_types"}
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm.codeIndex = data.maxCodeIndex;
} else {
this.$message.error(data.msg);
}
});
//查询最大值 end
}
},
// 多级联动参数
info(id) {
this.$http({
url: `dictionary/info/${id}`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm = data.data;
//解决前台上传图片后台不显示的问题
let reg=new RegExp('../../../upload','g')//g代表全部
} else {
this.$message.error(data.msg);
}
});
},
// 提交
onSubmit() {
if((!this.ruleForm.indexName)){
this.$message.error('性别类型不能为空');
return
}
this.$refs["ruleForm"].validate(valid => {
if (valid) {
let ruleForm = this.ruleForm;
ruleForm["dicCode"]="sex_types";
ruleForm["dicName"]="性别类型";
this.$http({
url: `dictionary/${!this.ruleForm.id ? "save" : "update"}`,
method: "post",
data: ruleForm
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.dictionaryCrossAddOrUpdateFlag = false;
this.parent.search();
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
// 返回
back() {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.dictionaryCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
// 多文本输入框
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
// 保存
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
// 返回
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px;
& /deep/ .ql-container {
height: 310px;
}
}
.amap-wrapper {
width: 100%;
height: 500px;
}
.search-box {
position: absolute;
}
.addEdit-block {
margin: -10px;
}
.detail-form-content {
padding: 12px;
background-color: transparent;
}
.btn .el-button {
padding: 0;
}</style>
声明
本博客适用于广泛的学术和教育用途,包括但不限于个人学习、开发设计,产品设计。仅供学习参考,旨在为读者提供深入理解和学术研究的材料。