甘肃旅游服务平台代码--论文pf

@TOC

springboot422甘肃旅游服务平台代码--论文pf

绪论

1.1 研究背景

现在大家正处于互联网加的时代,这个时代它就是一个信息内容无比丰富,信息处理与管理变得越加高效的网络化的时代,这个时代让大家的生活不仅变得更加地便利化,也让时间变得更加地宝贵化,因为每天的每分钟,每秒钟这些时间都能让人们处理大批量的日常事务,这些场景,是之前的手工模式无法与之相抗衡的。对于景点信息的管理来说,传统的通过纸质文档记录信息的方式已经落后了,依靠手工管理景点信息,不仅花费较长的工作时间,在对记录各种信息的文档进行信息查询以及信息核对操作时,也不能及时保证信息的准确性,基于这样的办公低效率环境下,对于景点信息的处理就要提出新的解决方案。因为这个时代的信息一直都在高速发展,要是不抱着发展的观念看待事情,极有可能被这个市场快速遗忘,甚至被无情地淘汰掉。所以尽早开发一款甘肃旅游服务平台进行信息的快速处理,既跟上了时代的发展脚步,也能让自己的核心竞争力有所提升。

1.2目的和意义

互联网加的时代一方面是加快信息的发展,另一方面也是对传统行业进行筛选,能够继续发展的,肯定是那些能够充分运用互联网技术进行自身升级改革的行业。那些停步不前的行业只能就此结束,进而被大家所遗忘。这次设计出来的甘肃旅游服务平台,它不仅能够让管理人员在信息增加,信息的编辑等事务处理上,节省很多的时间,也会砍掉一部分的人工成本,节省不必要开支的资金。另外,此系统的操作界面是可视化的界面,管理人员无需付费培训就能尽快上手。甘肃旅游服务平台的开发意义如下:

1、管理人员再也不用在查询信息上花费大量宝贵的时间了,通过信息关键词字段就可以在几秒内获取需要的信息,在各种突发事件面前管理人员也不用慌张,可以从容淡定地处理各种相关信息。

2、该系统在每天的24小时期间都是不会停止服务的,只要有信息操作的需要,管理人员都能使用常用的360浏览器,或者百度浏览器,或者谷歌浏览器,2345浏览器等大众浏览器都能登录系统,然后操作对应的功能。

3、有了这款信息管理类操作软件,所有需要进行处理的数据不用在纸质版本的文档上进行记载,而是基于电脑进行信息录入。

4、景点方面的信息都是通过网站进行显示,其实质是这些信息都保存在网站对应的数据库里面。只要操作员不去恶意删除信息,那么这些信息将会永久保存。

1.3 论文结构安排

编写甘肃旅游服务平台相对应的论文,其实就是对开发完成的程序进行再次解读的过程。本论文从七个方面的内容讲解了开发的程序,具体内容如下:

第一个部分:就是论文的绪论,这个部分就是介绍在什么样的背景下开发的程序,以及这个程序开发出来具有什么意义等内容。

第二个部分:就是介绍开发这个程序使用了什么技术,使用什么数据库保存程序的数据信息,程序开发的语言是使用的什么语言等内容。

第三个部分:就是介绍这个程序开发在现实生活的可行性问题,也讲述了程序开发需要设置什么功能等内容。

第四个部分:就是已经知晓程序的大致功能,需要对程序的功能进行更为严格的细分,也需要出具相应的功能结构图,同时,也要设计程序对应的数据库,包括数据库里面的数据表的设计等内容。

第五个部分:就是在系统的编码阶段,需要使用编程语言完成程序的功能,完成程序的界面设计,最终以界面实现的效果图展示设计成果等内容。

第六个部分:就是程序已经完成了开发的前提之下,需要检测程序的各个模块是否衔接正常,程序各个功能能否在网络等一切外部条件正常的情况下运行,这期间要是出现任何错误都需要及时记录并在后期进行修补完善。

第七个部分:就是论文最后的总结部分,描述遇到的问题,采用的解决思路等内容。

2 相关技术

2.1 VUE介绍

Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架。与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用。Vue 的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合。另一方面,当与现代化的工具链以及各种支持类库结合使用时,Vue 也完全能够为复杂的单页应用提供驱动。

2.2 Mysql数据库介绍

有了程序功能的操作,也需要对程序操作的各个功能所产生的数据信息存放在一个固定的仓库里面,这个所谓的仓库就是大家最熟悉的程序开发需要使用的数据库了,数据库能够发展到至今的模样,其实也是经历了很多的变化历程的,在最开始由于数据信息处理的需要开始推出最低级的数据管理,这个阶段也是数据库早期的人工管理的阶段,后来也经历了文件管理的阶段,这个阶段的数据管理因为信息不能够进行共享,加上管理的数据对配套的程序产生了较强的依赖性,在数据信息管理上也存在很多数据的重复记载造成数据冗余等问题。所以为了解决上述一系列文件管理阶段所产生的数据管理的问题,对数据管理方式进行了全方位的升级改造,也就让数据管理进入了一个全新的阶段——数据库系统的阶段。这个阶段也是数据库管理数据的一个全新的相当高级的阶段。

说到数据库,也不得不说数据库的模型,数据库拥有的数据模型有网状,还有层次,以及关系型这三样数据库模型。网状的结构就是把记录的每条信息都比喻成一个点,点跟点之间也有联系,最终就形成了一个像网一样的结构,就是所谓的网状数据模型。也有对数据记录使用树状结构的方式进行数据保存,这个就是层次数据模型,关系数据库模型运用在现在市面上常见的数据库当中了,像本系统开发使用的MySQL数据库,还有安装过程比较复杂的Sqlserver数据库,也有一些比较小巧的关系型数据库,像Access数据库,FoxPro数据库等数据库。这样的关系型数据库将数据表里面的行还有列进行相互关联形成一个二维矩阵的方式来保存程序所产生的数据信息。

本次之所以选择MySQL数据库来当程序数据存放的仓库,则是因为此数据库安装不用费时,也不需要各种百度信息去解决安装过程中出现的任何问题,而且由于自己的电脑内存比较小,才4个G,为了更好的开发项目程序,针对低配置的电脑选择MySQL数据库也是情理之中。图2.3展示了数据列设计中需要使用的列类型。

图2.3数据列类型图

2.3 JAVA语言介绍

在1995年这一年的5月份,著名的Sun Microsystems公司在程序开发设计上面郑重推出一种面向对象开发的程序设计语言——Java,最开始的时候Java是由詹姆斯.高斯林这位伟大的JAVA之父来进行主导,但是在后来由于各种原因,让甲骨文公司这个针对商业程序创建了oracle大型数据库的公司收购了Java。Java的平台总共算下来有3个,分别为javaME和javaSE以及javaEE这3个java平台。下面将对其进行分别介绍。

1.在电脑桌面程序的开发上面需要选择JavaME,这个用得也比较多。

2.企业也会根据工作以及业务需要开发各种软件,那么就会选用JavcEE这个支持企业版软件的开发的Java平台,JavcEE主攻运用在企业领域上面的web应用,JavcEE也在javaSE的基础上获得了比如jsp技术 ,Servlet技术等程序开发技术的支持。

3.现在生活中手机的普及化,也使得手机端这样的移动设备的软件的兴起,JavaME这个迷你版java平台就能运用于移动端的软件开发操作。图2.4就是 Java技术原理图。

图2.4 Java技术原理图

3 系统分析

3.1系统可行性分析

需要使用大部分精力开发的甘肃旅游服务平台为了充分降低开发风险,特意在开发之前进行可行性分析这个验证系统开发是否可行的步骤。本文就会从技术角度,经济角度,还有用户使用的程序的运行角度进行综合阐述。

3.1.1 技术可行性分析

开发程序选择的是面向对象的,功能强大的,简单易用的Java程序设计语言,数据库的开发工具使用到了Mysql数据库,由于自己之前接触过一些简单的程序开发方面的设计作品,所以对Myeclipse工具的使用比较熟练,对于数据库的操作技巧也有一定的积累。另外,程序开发需要在自己电脑上安装的软件并不多,在win7操作系统的大环境下,能够完全搭建好程序开发的操作环境,比如Myeclipse工具,Mysql数据库工具,游览器,以及处理程序图片的Photoshop工具等都能安装在自己的电脑上。总的说来,开发这个程序在技术上是可以实现的。

3.1.2 经济可行性分析

开发出来的程序并不是朝着商业程序的方向进行设计开发的,它只是作为一个毕业设计项目进行开发,主要用于检验学生在学校所学知识的一个检验,也锻炼学生运用网络,图书等工具进行自学的能力。所以开发这个程序软件并不会涉及到经济上面的开销,在开发软件的选择上也不会额外付费安装软件,在开发软件的官网上面就可以下载需要的软件,并根据提示的安装步骤安装软件到自己的电脑上面。总的说来,开发这个程序在经济上也不存在经费支出。

3.1.3 运行可行性分析

因为这个程序软件从开始开发到开发截止都是根据用户的需求进行定制,考虑到此程序软件是面向广大普通操作用户,鉴于他们的知识文化水平,特意开发出一个可操作性强的,能够很容易让使用用户上手的,具有可视化操作界面的一个程序软件。总的说来,这个程序站在用户运行程序的角度上分析,是不存在操作难的问题的。用户只要打开程序就可以免去专人培训进行程序功能操作。

经过上面从技术的角度,从经济的角度,从程序运行的角度这三个角度分析现打算开发的程序,可以得出该程序软件是可以进行开发操作的。

3.2系统性能分析

3.2.1 系统安全性

程序在使用中是不允许其他访问者随意窃取程序里面的隐秘信息,也不允许其他操作者越权操作其他管理用户操作的功能,要真正杜绝这些现象就必须在程序开发之前把程序的安全性给考虑进去。

比如现在很多程序都会把用户注册的功能给考虑进去,让用户在注册页面功能区填写自己的个人信息,这些数据信息涵盖了用户本人的姓名,用户对程序登录设置的密码,用户经常使用的邮箱,用户的常用联系方式还有用户的所住地址等信息,这些信息都是设计到用户本人的隐私,那么这些信息在传输给程序后台时,是需要进行管理并保存至对应的数据库文件里面。要是有人恶意窃取程序的数据信息,也就会让那些注册了此程序软件的用户的个人隐秘信息都会遭到泄露。这些信息落入其他不法分子手里,他们极有可能根据用户的隐私信息去骚扰用户,并把这些信息用于各种商业用途谋取其他非法的利益。所以数据安全性是一个系统能不能使用的首要标准。

3.2.2 数据完整性

数据完整性是确保数据信息是否具有可靠性,是否具有参考价值的一个重要因素,数据信息只描述一部分,或者必有的数据信息反而为空等现象都是代表着这个数据信息不完整,有数据缺陷,这是个很严肃的问题,因为这样的数据信息跟垃圾信息没什么两样。

说到数据完整性,不得不提最常用的程序表单功能。这些表单主要就是提取广大用户的数据信息的,需要广大用户根据表单上的要求,填写自己的姓名信息,以及自己的联系方式信息,有些也会有额外的信息填写要求,有必须要填的选项,也有不需要必填的选项。假如广大用户为了保护自己的隐私,或者不想受到其他人的骚扰,不填写必填项等信息,广大用户在最后提交此表单的时候,往往都是提交不了的。

数据完整性不仅仅限于登记的数据要完整,它也需要程序里面的所有数据信息之间存在关联,而且这种联系也是要求不能出差错的。

由于数据表之间也会存在一定的联系,所以同一个数据也会出现在另一个表格里面,那么这两个表格记录的同一个数据应该是一样的。不能够是同样的数据信息在不同表中不一样。

3.2.3系统可扩展性

一切事物都是一直在发展,程序员开发软件也需要带着发展的思维去进行软件开发操作,这样的话,开发出来的程序在应对管理所需时,也会相对应的进行程序升级与更新。不论是功能完善还是数据库升级都能在原来的基础上对原有程序进行迭代升级。让开发出来的程序能够走得越来越远。这也是广大用户对程序软件的使用要求。

3.3系统流程分析

管理员假如要操作系统提供的功能,那么管理员就要在系统的登录界面,填写管理员登录的账号信息,填写相应的密码信息,管理员需要保证这两者能够验证身份的账号以及密码信息的正确性,这样管理员就可以通过登录界面进入系统后台操作界面。图3.1就是开发的程序软件甘肃旅游服务平台它的操作流程图。

图3.1 系统操作流程图

3.3.1系统登录流程

甘肃旅游服务平台的登录流程,针对的角色就是操作员的操作角色。在登录界面需要的必填信息就是账号信息,配上登录的密码信息就能登录甘肃旅游服务平台,需要注意的就是必填的账号信息和登录密码信息,都需要进行验证,系统会判断账号还有填写的密码信息的正确性,只有这两者信息都正确了,就能成功登录甘肃旅游服务平台了。系统登录流程图如下图。

图3.2 系统登录流程图

3.3.2信息添加流程

用户在添加信息的界面填写的任何数据信息也是需要验证的,系统会判断用户填写信息的格式还有数据信息是不是合法信息,如果用户填写的信息是合法内容,系统就会在数据库对应的数据表里面添加信息。添加信息流程如下图。

图3.3 添加信息流程图

3.3.3信息删除流程

对于那些已经失效的信息,需要用户及时进行删除,这样有利于腾出空间存放其他信息。删除信息也是先从数据库对应数据表里面删除数据,接着就是更新数据表的信息。这样删除的数据,在用户操作界面就查看不到了。信息删除流程如下图所示。

图3.4 信息删除流程图

3.4系统功能分析

甘肃旅游服务平台具有管理员角色,用户角色,这几个操作权限。

甘肃旅游服务平台针对管理员设置的功能有:添加并管理各种类型信息,管理用户账户信息,管理景点信息,管理公告信息等内容。

甘肃旅游服务平台针对用户设置的功能有:查看并修改个人信息,查看景点信息,查看公告信息等内容。

4 系统设计

4.1系统概要设计

甘肃旅游服务平台并没有使用C/S结构,而是基于网络浏览器的方式去访问服务器,进而获取需要的数据信息,这种依靠浏览器进行数据访问的模式就是现在用得比较广泛的适用于广域网并且没有网速限制要求的小程序结构,图4.1就是开发出来的程序工作原理图。

图4.1 程序工作的原理图

4.2系统功能结构设计

甘肃旅游服务平台针对管理员设置的功能有:添加并管理各种类型信息,管理用户账户信息,管理景点信息,管理公告信息等内容。

甘肃旅游服务平台针对用户设置的功能有:查看并修改个人信息,查看景点信息,查看公告信息等内容。

4.3数据库设计

4.3.1数据库E-R图设计

程序设计是离不开对应数据库的设计操作的,这样的做法就是减少数据对程序的依赖性,所以数据库的设计也是需要花费大量的日常时间来进行设计的,在设计中对程序开发需要存储的数据信息进行实体划分,先确认实体,然后设计实体的属性等操作,这种设计就是数据库设计里面不能少的必须有的E-R模型设计。为了降低程序设计的对应的数据库设计难度,开发人员也可以使用相应的工具来进行E-R模型设计,现在市面上设计E-R模型的工具有PowerDesigner建模工具,Navicat制作工具,还有微软的Visio绘图工具。为了简便起见,本程序在设计E-R模型的时候,就选用了微软的Visio这款功能强大,操作便利的绘图工具。

(1)下图是美食实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\美食.jpg 美食实体属性图

(2)下图是用户实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\用户.jpg 用户实体属性图

(3)下图是公告信息实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\公告信息.jpg 公告信息实体属性图

(4)下图是字典表实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\字典表.jpg 字典表实体属性图

(5)下图是景点实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\景点.jpg 景点实体属性图

(6)下图是房间收藏实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\房间收藏.jpg 房间收藏实体属性图

(7)下图是景点收藏实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\景点收藏.jpg 景点收藏实体属性图

(8)下图是美食收藏实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\美食收藏.jpg 美食收藏实体属性图

(9)下图是美食评价实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\美食评价.jpg 美食评价实体属性图

(10)下图是美食订单实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\美食订单.jpg 美食订单实体属性图

(11)下图是商品实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\商品.jpg 商品实体属性图

(12)下图是景点门票订单实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\景点门票订单.jpg 景点门票订单实体属性图

(13)下图是酒店实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\酒店.jpg 酒店实体属性图

(14)下图是景点评价实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\景点评价.jpg 景点评价实体属性图

(15)下图是商家实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\商家.jpg 商家实体属性图

(16)下图是商品收藏实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\商品收藏.jpg 商品收藏实体属性图

(17)下图是酒店评价实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\酒店评价.jpg 酒店评价实体属性图

(18)下图是酒店订单实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\酒店订单.jpg 酒店订单实体属性图

(19)下图是商品评价实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\商品评价.jpg 商品评价实体属性图

(20)下图是商品订单实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\商品订单.jpg 商品订单实体属性图

(21)下图是收货地址实体和其具备的属性。

C:/Users/Administrator/Desktop/temp111\9.1\____img\收货地址.jpg 收货地址实体属性图

4.3.2 数据库表结构设计

本次程序开发选用的数据库管理工具是Mysql数据管理工具,使用它存放数据也需要创建程序对应的数据库文件,并命名刚创建的数据库文件,有了数据库也需要创建各种数据表来充实数据库,在数据表的创建中,不仅需要对数据表命名,也需要对数据表的字段进行设计,包括每个数据表里面需要设置的字段名称,字段对应的数据类型信息,字段的主键设置这个也是不可缺少的,因为每个数据表里面的主键就是标记着这个数据表跟其他数据表相区分的唯一标志。就相当于生活中的每个人都有姓名,但是上网搜索自己的名字,会发现全国上下有很多人的名字跟自己的名字一模一样,包括姓氏以及名字,区分每个人的唯一信息就是每个人的身份证号信息,主键在数据表里面也是起着这样的重要作用。下面就介绍本次开发的程序甘肃旅游服务平台的数据表结构信息。

表4.1收货地址表

序号列名数据类型说明允许空
1IdIntid
2yonghu_idInteger创建用户
3address_nameString收货人
4address_phoneString电话
5address_dizhiString地址
6isdefault_typesInteger是否默认地址
7insert_timeDate添加时间
8update_timeDate修改时间
9create_timeDate创建时间

表4.2字典表表

序号列名数据类型说明允许空
1IdIntid
2dic_codeString字段
3dic_nameString字段名
4code_indexInteger编码
5index_nameString编码名字
6super_idInteger父字段id
7beizhuString备注
8create_timeDate创建时间

表4.3公告信息表

序号列名数据类型说明允许空
1IdIntid
2gonggao_nameString公告名称
3gonggao_photoString公告图片
4gonggao_typesInteger公告类型
5insert_timeDate发布时间
6gonggao_contentString公告详情
7create_timeDate创建时间

表4.4景点表

序号列名数据类型说明允许空
1IdIntid
2shangjia_idInteger商家
3jingdian_nameString景点名称
4jingdian_uuid_numberString景点编号
5jingdian_photoString景点照片
6jingdian_videoString视频介绍
7jingdian_addressString景点位置
8zan_numberInteger
9cai_numberInteger
10jingdian_typesInteger景点类型
11jingdian_kucun_numberInteger剩余门票数
12jingdian_old_moneyBigDecimal景点原价
13jingdian_new_moneyBigDecimal现价/张
14jingdian_clicknumInteger景点热度
15jingdian_contentString景点介绍
16shangxia_typesInteger是否上架
17jingdian_deleteInteger逻辑删除
18insert_timeDate录入时间
19create_timeDate创建时间

表4.5景点收藏表

序号列名数据类型说明允许空
1IdIntid
2jingdian_idInteger景点
3yonghu_idInteger用户
4jingdian_collection_typesInteger类型
5insert_timeDate收藏时间
6create_timeDate创建时间

表4.6景点评价表

序号列名数据类型说明允许空
1IdIntid
2jingdian_idInteger景点
3yonghu_idInteger用户
4jingdian_commentback_textString评价内容
5insert_timeDate评价时间
6reply_textString回复内容
7update_timeDate回复时间
8create_timeDate创建时间

表4.7景点门票订单表

序号列名数据类型说明允许空
1IdIntid
2jingdian_order_uuid_numberString订单编号
3jingdian_idInteger景点
4yonghu_idInteger用户
5buy_numberInteger购买张数
6jingdian_order_timeDate预定日期
7jingdian_order_true_priceBigDecimal实付价格
8jingdian_order_typesInteger订单类型
9jingdian_order_payment_typesInteger支付类型
10insert_timeDate订单创建时间
11create_timeDate创建时间

表4.8酒店表

序号列名数据类型说明允许空
1IdIntid
2shangjia_idInteger商家
3jiudian_nameString房间名称
4jiudian_uuid_numberString房间编号
5jiudian_photoString房间照片
6jiudian_addressString酒店位置
7jiudian_teseString特色
8zan_numberInteger
9cai_numberInteger
10jiudian_typesInteger房型
11jiudian_kucun_numberInteger剩余房间数
12jiudian_old_moneyBigDecimal房间原价
13jiudian_new_moneyBigDecimal现价/天
14jiudian_clicknumInteger房间热度
15jiudian_contentString房间介绍
16shangxia_typesInteger是否上架
17jiudian_deleteInteger逻辑删除
18insert_timeDate录入时间
19create_timeDate创建时间

表4.9房间收藏表

序号列名数据类型说明允许空
1IdIntid
2jiudian_idInteger房间
3yonghu_idInteger用户
4jiudian_collection_typesInteger类型
5insert_timeDate收藏时间
6create_timeDate创建时间

表4.10酒店评价表

序号列名数据类型说明允许空
1IdIntid
2jiudian_idInteger房间
3yonghu_idInteger用户
4jiudian_commentback_textString评价内容
5insert_timeDate评价时间
6reply_textString回复内容
7update_timeDate回复时间
8create_timeDate创建时间

表4.11酒店订单表

序号列名数据类型说明允许空
1IdIntid
2jiudian_order_uuid_numberString订单编号
3jiudian_idInteger房间
4yonghu_idInteger用户
5buy_numberInteger预定天数
6jiudian_order_timeDate预定入住日期
7jiudian_order_true_priceBigDecimal实付价格
8jiudian_order_typesInteger订单类型
9jiudian_order_payment_typesInteger支付类型
10insert_timeDate订单创建时间
11create_timeDate创建时间

表4.12美食表

序号列名数据类型说明允许空
1IdIntid
2shangjia_idInteger商家
3meishi_nameString美食名称
4meishi_uuid_numberString美食编号
5meishi_photoString美食照片
6zan_numberInteger
7cai_numberInteger
8meishi_typesInteger美食类型
9meishi_kucun_numberInteger美食库存
10meishi_old_moneyBigDecimal美食原价
11meishi_new_moneyBigDecimal现价/份
12meishi_clicknumInteger美食热度
13meishi_contentString美食介绍
14shangxia_typesInteger是否上架
15meishi_deleteInteger逻辑删除
16insert_timeDate录入时间
17create_timeDate创建时间

表4.13美食收藏表

序号列名数据类型说明允许空
1IdIntid
2meishi_idInteger美食
3yonghu_idInteger用户
4meishi_collection_typesInteger类型
5insert_timeDate收藏时间
6create_timeDate创建时间

表4.14美食评价表

序号列名数据类型说明允许空
1IdIntid
2meishi_idInteger美食
3yonghu_idInteger用户
4meishi_commentback_textString评价内容
5insert_timeDate评价时间
6reply_textString回复内容
7update_timeDate回复时间
8create_timeDate创建时间

表4.15美食订单表

序号列名数据类型说明允许空
1IdIntid
2meishi_order_uuid_numberString订单编号
3address_idInteger收货地址
4meishi_idInteger美食
5yonghu_idInteger用户
6buy_numberInteger购买数量
7meishi_order_true_priceBigDecimal实付价格
8meishi_order_courier_nameString派送人
9meishi_order_courier_numberString联系方式
10meishi_order_typesInteger订单类型
11meishi_order_payment_typesInteger支付类型
12insert_timeDate订单创建时间
13create_timeDate创建时间

表4.16商家表

序号列名数据类型说明允许空
1IdIntid
2shangjia_nameString商家名称
3shangjia_phoneString联系方式
4shangjia_emailString邮箱
5shangjia_photoString营业执照展示
6shangjia_xingji_typesInteger商家信用类型
7new_moneyBigDecimal现有余额
8shangjia_contentString商家介绍
9shangjia_deleteInteger逻辑删除
10jinyong_typesInteger账户状态
11create_timeDate创建时间

表4.17商品表

序号列名数据类型说明允许空
1IdIntid
2shangjia_idInteger商家
3shangpin_nameString商品名称
4shangpin_uuid_numberString商品编号
5shangpin_photoString商品照片
6zan_numberInteger
7cai_numberInteger
8shangpin_typesInteger商品类型
9shangpin_kucun_numberInteger商品库存
10shangpin_old_moneyBigDecimal商品原价
11shangpin_new_moneyBigDecimal现价
12shangpin_clicknumInteger商品热度
13shangpin_contentString商品介绍
14shangxia_typesInteger是否上架
15shangpin_deleteInteger逻辑删除
16insert_timeDate录入时间
17create_timeDate创建时间

表4.18商品收藏表

序号列名数据类型说明允许空
1IdIntid
2shangpin_idInteger商品
3yonghu_idInteger用户
4shangpin_collection_typesInteger类型
5insert_timeDate收藏时间
6create_timeDate创建时间

表4.19商品评价表

序号列名数据类型说明允许空
1IdIntid
2shangpin_idInteger商品
3yonghu_idInteger用户
4shangpin_commentback_textString评价内容
5insert_timeDate评价时间
6reply_textString回复内容
7update_timeDate回复时间
8create_timeDate创建时间

表4.20商品订单表

序号列名数据类型说明允许空
1IdIntid
2shangpin_order_uuid_numberString订单编号
3address_idInteger收货地址
4shangpin_idInteger商品
5yonghu_idInteger用户
6buy_numberInteger购买数量
7shangpin_order_true_priceBigDecimal实付价格
8shangpin_order_courier_nameString快递公司
9shangpin_order_courier_numberString快递单号
10shangpin_order_typesInteger订单类型
11shangpin_order_payment_typesInteger支付类型
12insert_timeDate订单创建时间
13create_timeDate创建时间

表4.21用户表

序号列名数据类型说明允许空
1IdIntid
2yonghu_uuid_numberString用户编号
3yonghu_nameString用户姓名
4yonghu_phoneString用户手机号
5yonghu_id_numberString用户身份证号
6yonghu_photoString用户头像
7yonghu_emailString用户邮箱
8new_moneyBigDecimal余额
9jinyong_typesInteger账户状态
10create_timeDate创建时间

表4.22管理员表

序号列名数据类型说明允许空
1IdIntid
2usernameString员工名
3passwordString密码
4roleString角色
5addtimeDate新增时间

5 系统实现

5.1管理员功能介绍

5.1.1管理员登录

系统登录功能是程序必不可少的功能,在登录页面必填的数据有两项,一项就是账号,另一项数据就是密码,当管理员正确填写并提交这二者数据之后,管理员就可以进入系统后台功能操作区。下图就是管理员登录页面。

图5.1 管理员登录页面

5.1.2 景点管理

项目管理页面提供的功能操作有:查看景点,删除景点操作,新增景点操作,修改景点操作。下图就是景点管理页面。

图5.2 景点管理页面

5.1.3 公告信息管理

公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。

图5.3 公告信息管理页面

5.1.4公告类型管理

公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。

图5.4 公告类型列表页面

5.1.5 商品管理

如图5.5显示的就是商品管理页面,此页面提供给管理员的功能有:新增商品,修改商品,删除商品。

图5.5商品管理页面

5.1.6 商品类型管理

如图5.6显示的就是商品类型管理页面,此页面提供给管理员的功能有:新增商品类型,修改商品类型,删除商品类型。

图5.6 商品类型管理页面

系统

GonggaoController.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("/gonggao")
public class GonggaoController {
    private static final Logger logger = LoggerFactory.getLogger(GonggaoController.class);

    private static final String TABLE_NAME = "gonggao";

    @Autowired
    private GonggaoService gonggaoService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private AddressService addressService;//收货地址
    @Autowired
    private DictionaryService dictionaryService;//字典表
    @Autowired
    private JingdianService jingdianService;//景点
    @Autowired
    private JingdianCollectionService jingdianCollectionService;//景点收藏
    @Autowired
    private JingdianCommentbackService jingdianCommentbackService;//景点评价
    @Autowired
    private JingdianOrderService jingdianOrderService;//景点门票订单
    @Autowired
    private JiudianService jiudianService;//酒店
    @Autowired
    private JiudianCollectionService jiudianCollectionService;//房间收藏
    @Autowired
    private JiudianCommentbackService jiudianCommentbackService;//酒店评价
    @Autowired
    private JiudianOrderService jiudianOrderService;//酒店订单
    @Autowired
    private MeishiService meishiService;//美食
    @Autowired
    private MeishiCollectionService meishiCollectionService;//美食收藏
    @Autowired
    private MeishiCommentbackService meishiCommentbackService;//美食评价
    @Autowired
    private MeishiOrderService meishiOrderService;//美食订单
    @Autowired
    private ShangjiaService shangjiaService;//商家
    @Autowired
    private ShangpinService shangpinService;//商品
    @Autowired
    private ShangpinCollectionService shangpinCollectionService;//商品收藏
    @Autowired
    private ShangpinCommentbackService shangpinCommentbackService;//商品评价
    @Autowired
    private ShangpinOrderService shangpinOrderService;//商品订单
    @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("shangjiaId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = gonggaoService.queryPage(params);

        //字典表数据转换
        List<GonggaoView> list =(List<GonggaoView>)page.getList();
        for(GonggaoView 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);
        GonggaoEntity gonggao = gonggaoService.selectById(id);
        if(gonggao !=null){
            //entity转view
            GonggaoView view = new GonggaoView();
            BeanUtils.copyProperties( gonggao , view );//把实体数据重构到view中
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody GonggaoEntity gonggao, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,gonggao:{}",this.getClass().getName(),gonggao.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<GonggaoEntity> queryWrapper = new EntityWrapper<GonggaoEntity>()
            .eq("gonggao_name", gonggao.getGonggaoName())
            .eq("gonggao_types", gonggao.getGonggaoTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonggaoEntity gonggaoEntity = gonggaoService.selectOne(queryWrapper);
        if(gonggaoEntity==null){
            gonggao.setInsertTime(new Date());
            gonggao.setCreateTime(new Date());
            gonggaoService.insert(gonggao);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody GonggaoEntity gonggao, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,gonggao:{}",this.getClass().getName(),gonggao.toString());
        GonggaoEntity oldGonggaoEntity = gonggaoService.selectById(gonggao.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(gonggao.getGonggaoPhoto()) || "null".equals(gonggao.getGonggaoPhoto())){
                gonggao.setGonggaoPhoto(null);
        }
        if("".equals(gonggao.getGonggaoContent()) || "null".equals(gonggao.getGonggaoContent())){
                gonggao.setGonggaoContent(null);
        }

            gonggaoService.updateById(gonggao);//根据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<GonggaoEntity> oldGonggaoList =gonggaoService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        gonggaoService.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");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<GonggaoEntity> gonggaoList = 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){
                            //循环
                            GonggaoEntity gonggaoEntity = new GonggaoEntity();
//                            gonggaoEntity.setGonggaoName(data.get(0));                    //公告名称 要改的
//                            gonggaoEntity.setGonggaoPhoto("");//详情和图片
//                            gonggaoEntity.setGonggaoTypes(Integer.valueOf(data.get(0)));   //公告类型 要改的
//                            gonggaoEntity.setInsertTime(date);//时间
//                            gonggaoEntity.setGonggaoContent("");//详情和图片
//                            gonggaoEntity.setCreateTime(date);//时间
                            gonggaoList.add(gonggaoEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        gonggaoService.insertBatch(gonggaoList);
                        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 = gonggaoService.queryPage(params);

        //字典表数据转换
        List<GonggaoView> list =(List<GonggaoView>)page.getList();
        for(GonggaoView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Integer id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GonggaoEntity gonggao = gonggaoService.selectById(id);
            if(gonggao !=null){


                //entity转view
                GonggaoView view = new GonggaoView();
                BeanUtils.copyProperties( gonggao , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody GonggaoEntity gonggao, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,gonggao:{}",this.getClass().getName(),gonggao.toString());
        Wrapper<GonggaoEntity> queryWrapper = new EntityWrapper<GonggaoEntity>()
            .eq("gonggao_name", gonggao.getGonggaoName())
            .eq("gonggao_types", gonggao.getGonggaoTypes())
//            .notIn("gonggao_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GonggaoEntity gonggaoEntity = gonggaoService.selectOne(queryWrapper);
        if(gonggaoEntity==null){
            gonggao.setInsertTime(new Date());
            gonggao.setCreateTime(new Date());
        gonggaoService.insert(gonggao);

            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

}


MeishiCommentbackController.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("/meishiCommentback")
public class MeishiCommentbackController {
    private static final Logger logger = LoggerFactory.getLogger(MeishiCommentbackController.class);

    private static final String TABLE_NAME = "meishiCommentback";

    @Autowired
    private MeishiCommentbackService meishiCommentbackService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private AddressService addressService;//收货地址
    @Autowired
    private DictionaryService dictionaryService;//字典表
    @Autowired
    private GonggaoService gonggaoService;//公告信息
    @Autowired
    private JingdianService jingdianService;//景点
    @Autowired
    private JingdianCollectionService jingdianCollectionService;//景点收藏
    @Autowired
    private JingdianCommentbackService jingdianCommentbackService;//景点评价
    @Autowired
    private JingdianOrderService jingdianOrderService;//景点门票订单
    @Autowired
    private JiudianService jiudianService;//酒店
    @Autowired
    private JiudianCollectionService jiudianCollectionService;//房间收藏
    @Autowired
    private JiudianCommentbackService jiudianCommentbackService;//酒店评价
    @Autowired
    private JiudianOrderService jiudianOrderService;//酒店订单
    @Autowired
    private MeishiService meishiService;//美食
    @Autowired
    private MeishiCollectionService meishiCollectionService;//美食收藏
    @Autowired
    private MeishiOrderService meishiOrderService;//美食订单
    @Autowired
    private ShangjiaService shangjiaService;//商家
    @Autowired
    private ShangpinService shangpinService;//商品
    @Autowired
    private ShangpinCollectionService shangpinCollectionService;//商品收藏
    @Autowired
    private ShangpinCommentbackService shangpinCommentbackService;//商品评价
    @Autowired
    private ShangpinOrderService shangpinOrderService;//商品订单
    @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("shangjiaId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = meishiCommentbackService.queryPage(params);

        //字典表数据转换
        List<MeishiCommentbackView> list =(List<MeishiCommentbackView>)page.getList();
        for(MeishiCommentbackView 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);
        MeishiCommentbackEntity meishiCommentback = meishiCommentbackService.selectById(id);
        if(meishiCommentback !=null){
            //entity转view
            MeishiCommentbackView view = new MeishiCommentbackView();
            BeanUtils.copyProperties( meishiCommentback , view );//把实体数据重构到view中
            //级联表 美食
            //级联表
            MeishiEntity meishi = meishiService.selectById(meishiCommentback.getMeishiId());
            if(meishi != null){
            BeanUtils.copyProperties( meishi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setMeishiId(meishi.getId());
            }
            //级联表 用户
            //级联表
            YonghuEntity yonghu = yonghuService.selectById(meishiCommentback.getYonghuId());
            if(yonghu != null){
            BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYonghuId(yonghu.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody MeishiCommentbackEntity meishiCommentback, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,meishiCommentback:{}",this.getClass().getName(),meishiCommentback.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            meishiCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        meishiCommentback.setCreateTime(new Date());
        meishiCommentback.setInsertTime(new Date());
        meishiCommentbackService.insert(meishiCommentback);

        return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody MeishiCommentbackEntity meishiCommentback, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,meishiCommentback:{}",this.getClass().getName(),meishiCommentback.toString());
        MeishiCommentbackEntity oldMeishiCommentbackEntity = meishiCommentbackService.selectById(meishiCommentback.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            meishiCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        if("".equals(meishiCommentback.getMeishiCommentbackText()) || "null".equals(meishiCommentback.getMeishiCommentbackText())){
                meishiCommentback.setMeishiCommentbackText(null);
        }
        if("".equals(meishiCommentback.getReplyText()) || "null".equals(meishiCommentback.getReplyText())){
                meishiCommentback.setReplyText(null);
        }
        meishiCommentback.setUpdateTime(new Date());

            meishiCommentbackService.updateById(meishiCommentback);//根据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<MeishiCommentbackEntity> oldMeishiCommentbackList =meishiCommentbackService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        meishiCommentbackService.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");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<MeishiCommentbackEntity> meishiCommentbackList = 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){
                            //循环
                            MeishiCommentbackEntity meishiCommentbackEntity = new MeishiCommentbackEntity();
//                            meishiCommentbackEntity.setMeishiId(Integer.valueOf(data.get(0)));   //美食 要改的
//                            meishiCommentbackEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户 要改的
//                            meishiCommentbackEntity.setMeishiCommentbackText(data.get(0));                    //评价内容 要改的
//                            meishiCommentbackEntity.setInsertTime(date);//时间
//                            meishiCommentbackEntity.setReplyText(data.get(0));                    //回复内容 要改的
//                            meishiCommentbackEntity.setUpdateTime(sdf.parse(data.get(0)));          //回复时间 要改的
//                            meishiCommentbackEntity.setCreateTime(date);//时间
                            meishiCommentbackList.add(meishiCommentbackEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        meishiCommentbackService.insertBatch(meishiCommentbackList);
                        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 = meishiCommentbackService.queryPage(params);

        //字典表数据转换
        List<MeishiCommentbackView> list =(List<MeishiCommentbackView>)page.getList();
        for(MeishiCommentbackView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Integer id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        MeishiCommentbackEntity meishiCommentback = meishiCommentbackService.selectById(id);
            if(meishiCommentback !=null){


                //entity转view
                MeishiCommentbackView view = new MeishiCommentbackView();
                BeanUtils.copyProperties( meishiCommentback , view );//把实体数据重构到view中

                //级联表
                    MeishiEntity meishi = meishiService.selectById(meishiCommentback.getMeishiId());
                if(meishi != null){
                    BeanUtils.copyProperties( meishi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setMeishiId(meishi.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(meishiCommentback.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody MeishiCommentbackEntity meishiCommentback, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,meishiCommentback:{}",this.getClass().getName(),meishiCommentback.toString());
        meishiCommentback.setCreateTime(new Date());
        meishiCommentback.setInsertTime(new Date());
        meishiCommentbackService.insert(meishiCommentback);

            return R.ok();
        }

}


GonggaoServiceImpl.java
package com.service.impl;

import com.utils.StringUtil;
import com.service.DictionaryService;
import com.utils.ClazzDiff;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.util.*;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.dao.GonggaoDao;
import com.entity.GonggaoEntity;
import com.service.GonggaoService;
import com.entity.view.GonggaoView;

/**
 * 公告信息 服务实现类
 */
@Service("gonggaoService")
@Transactional
public class GonggaoServiceImpl extends ServiceImpl<GonggaoDao, GonggaoEntity> implements GonggaoService {

    @Override
    public PageUtils queryPage(Map<String,Object> params) {
        Page<GonggaoView> page =new Query<GonggaoView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,params));
        return new PageUtils(page);
    }


}

index.js
import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg component

// register globally
Vue.component('svg-icon', SvgIcon)

const req = require.context('./svg/svg', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)

声明

本博客适用于广泛的学术和教育用途,包括但不限于个人学习、开发设计,产品设计。仅供学习参考,旨在为读者提供深入理解和学术研究的材料。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值