Pre Merge pull request !9 from xingqiangProfile/jeecg_3.7.8

pull/9/MERGE
xingqiangProfile 1 year ago committed by Gitee
commit 5b9066fa9d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -1,23 +1,25 @@
JEECG 微云快速开发平台
===============
当前最新版本: 3.7.1发布日期20170918
当前最新版本: 3.7.8发布日期20180806
JEECG微服务架构 [jeecg-p3 1.0版](https://gitee.com/jeecg/jeecg-p3)
前言:
-----------------------------------
随着 WEB UI 框架 ( EasyUI/Jquery UI/Ext/DWZ) 等的逐渐成熟,系统界面逐渐实现统一化,代码生成器也可以生成统一规范的界面!
代码生成+手工MERGE半智能开发将是新的趋势单表数据模型和一对多数据模型的增删改查功能直接生成使用,可节省60%工作量,快速提高开发效率!!!
随着 WEB UI 框架 ( EasyUI/Jquery UI/Ext/DWZ/VUE/Boostrap) 等的逐渐成熟,系统界面逐渐实现统一化,代码生成器也可以生成统一规范的界面!
代码生成+手工MERGE半智能开发将是新的趋势单表数据模型和一对多数据模型的增删改查功能直接生成使用,可节省80%工作量,快速提高开发效率!!!
简介
-----------------------------------
JEECGJ2EE Code Generation是一款基于代码生成器的智能开发平台。引领新的开发模式(Online Coding->代码生成器->手工MERGE智能开发)可以帮助解决Java项目60%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。
JEECGJ2EE Code Generation是一款基于代码生成器的智能开发平台。引领新的开发模式(Online Coding->代码生成器->手工MERGE智能开发)可以帮助解决Java项目90%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。
JEECG宗旨是: 简单功能由代Online Coding配置出功能;复杂功能由代码生成器生成进行手工Merge; 复杂流程业务采用表单自定义,业务流程使用工作流来实现、扩展出任务接口,供开发编写业务逻辑。实现了流程任务节点和任务接口的灵活配置,既保证了公司流程的保密行,又减少了开发人员的工作量。
适用项目
-----------------------------------
JEECG快速开发平台可以应用在任何J2EE项目的开发中尤其适合企业信息管理系统MIS、内部办公系统OA、企业资源计划系统ERP、客户关系管理系统CRM其半智能手工Merge的开发方式可以显著提高开发效率70%以上极大降低开发成本JEECG尤为显著的支持SAAS企业级应用开发插件机制更好的支持了SAAS云应用需求。
JEECG快速开发平台可以应用在任何J2EE项目的开发中尤其适合企业信息管理系统MIS、内部办公系统OA、企业资源计划系统ERP、客户关系管理系统CRM其半智能手工Merge的开发方式可以显著提高开发效率90%以上极大降低开发成本JEECG尤为显著的支持SAAS企业级应用开发插件机制更好的支持了SAAS云应用需求。
为什么选择JEECG?
-----------------------------------
@ -38,75 +40,76 @@ JEECG
* 15.在线配置报表(无需编码,通过在线配置方式,实现曲线图,柱状图,数据等报表)
* 16.简易Excel导入导出支持单表导出和一对多表模式导出生成的代码自带导入导出功能
* 17.自定义表单支持用户自定义表单布局支持单表一对多表单、支持select、radio、checkbox、textarea、date、popup、列表、宏等控件
* 18.专业接口对接机制统一采用restful接口方式集成swagger-ui在线接口文档Jwt token安全验证方便客户端对接
* 19.接口安全机制,可细化控制接口授权,非常简便实现不同客户端只看自己数据等控制
* 20.高级组合查询功能,在线配置支持主子表关联查询,可保存查询历史
* 21.支持二级管理员,权限细化管理
* 22.代码生成器支持resutful接口生成
JEECG 功能特点
-----------------------------------
* 采用SpringMVC + Hibernate + Minidao(类Mybatis) + Easyui(UI库)+ Jquery + Boostrap + Ehcache + Redis + Ztree等基础架构</br>
* 采用面向声明的开发模式, 基于泛型编写极少代码即可实现复杂的数据展示、数据编辑、
表单处理等功能再配合Online Coding在线开发与代码生成器的使用,将J2EE的开发效率提高6倍以上可以将代码减少80%以上。</br>
* 采用SpringMVC + Hibernate + Minidao(类Mybatis) + Easyui(UI库)+ Jquery + Boostrap + Ehcache + Redis + Ztree + Vue + Boostrap-table + ElementUI等基础架构</br>
* 采用面向声明的开发模式, 基于泛型编写极少代码即可实现复杂的数据展示、数据编辑、表单处理等功能再配合Online Coding在线开发与代码生成器的使用,将J2EE的开发效率提高8倍以上可以将代码减少90%以上。</br>
* JEECG 技术点总结:
* <b>技术点一:</b>Online Coding在线开发(通过在线配置实现一个表模型的增删改查功能,无需一行代码,支持用户自定义表单布局) </br>
* <b>技术点二:</b>代码生成器,支持多种数据模型,根据表生成对应的Entity,Service,Dao,Action,JSP等,增删改查功能生成直接使用</br>
* <b>技术点三:</b>UI快速开发库针对WEB UI进行标准封装页面统一采用UI标签实现功能数据datagrid,表单校验,Popup,Tab等实现JSP页面零JS开发维护非常高效</br>
* <b>技术点四:</b>在线流程定义采用开源Activiti流程引擎实现在线画流程,自定义表单,表单挂接,业务流转,流程监控,流程跟踪,流程委托等</br>
* <b>技术点五:</b>自定义表单,支持用户自定义表单布局支持单表、列表、Select\Radio\Checkbox\PopUP\Date等特殊控件</br>
* <b>技术点六:</b>查询过滤器查询功能自动生成后台动态拼SQL追加查询条件支持多种匹配方式全匹配/模糊查询/包含查询/不匹配查询)</br>
* <b>技术点七:</b>移动平台支持对Bootstrap(兼容Html5)进行标准封装 </br>
* <b>技术点八:</b>动态报表功能用户输入一个sql系统自动解析生成报表</br>
* <b>技术点九:</b>数据权限(精细化数据权限控制,控制到行级,列表级,表单字段级,实现不同人看不同数据,不同人对同一个页面操作不同字段)</br>
* <b>技术点十:</b>国际化(支持多语言,国际化的封装为多语言做了便捷支持)</br>
* <b>技术点十一:</b>多数据源(在线配置数据源,数据源工作类封装)</br>
* <b>技术点十二:</b>多种首页风格切换,支持自定义首页风格。经典风格、Shortcut风格、ACE bootstrap风格、云桌面风格</br>
* <b>技术点十三:</b>在线配置报表(无需编码,通过在线配置方式,实现曲线图,柱状图,数据等报表)</br>
* <b>技术点十四:</b>简易Excel导入导出支持单表导出和一对多表模式导出生成的代码自带导入导出功能</br>
* <b>技术点十五:</b>移动OA移动OA审批功能采用H5技术实现手机移动办公无缝对接微信、钉钉、微信企业号、也可以做APP</br>
* <b>技术点十六:</b>移动图表在线配置移动报表采用H5技术可以手机端查看</br>
* <b>技术点十七:</b>插件开发业务功能组件以插件方式集成平台也可以单独部署发发布有力支撑了SAAS云应用系统需求</br>
* JEECG V3.7, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
* <b>技术点一:</b>代码生成器SPA单页面应用快速生成采用VUE+ElementUI打造酷炫效果 </br>
* <b>技术点二:</b>新一代代码生成器更灵活的代码生成器工厂,可灵活自定义生成的代码文件名称、路径等;根据模板结构生成代码文件</br>
* <b>技术点三:</b>新一代代码生成器支持Vue+ElementUI风格Bootstrap表单+EasyUI原生态列表风格ElementUI表单+EasyUI原生态列表风格</br>
* <b>技术点四:</b>Dategrid标签多列表风格快速切换给用户提供多种选择</br>
* <b>技术点五:</b>Online Coding在线开发(通过在线配置实现一个表模型的增删改查功能,无需一行代码,支持用户自定义表单布局) </br>
* <b>技术点六:</b>代码生成器,支持多种数据模型,根据表生成对应的Entity,Service,Dao,Action,JSP等,增删改查功能生成直接使用</br>
* <b>技术点七:</b>UI快速开发库针对WEB UI进行标准封装页面统一采用UI标签实现功能数据datagrid,表单校验,Popup,Tab等实现JSP页面零JS开发维护非常高效</br>
* <b>技术点八:</b>在线流程定义采用开源Activiti流程引擎实现在线画流程,自定义表单,表单挂接,业务流转,流程监控,流程跟踪,流程委托等</br>
* <b>技术点九:</b>自定义表单,支持用户自定义表单布局支持单表、列表、Select\Radio\Checkbox\PopUP\Date等特殊控件</br>
* <b>技术点十:</b>查询过滤器查询功能自动生成后台动态拼SQL追加查询条件支持多种匹配方式全匹配/模糊查询/包含查询/不匹配查询)</br>
* <b>技术点十一::</b>移动平台支持对Bootstrap(兼容Html5)进行标准封装 </br>
* <b>技术点十二:</b>动态报表功能用户输入一个sql系统自动解析生成报表</br>
* <b>技术点十三:</b>数据权限(精细化数据权限控制,控制到行级,列表级,表单字段级,实现不同人看不同数据,不同人对同一个页面操作不同字段)</br>
* <b>技术点十四:</b>国际化(支持多语言,国际化的封装为多语言做了便捷支持)</br>
* <b>技术点十五:</b>多数据源(在线配置数据源,数据源工作类封装)</br>
* <b>技术点十六:</b>多种首页风格切换,支持自定义首页风格。经典风格、Shortcut风格、ACE bootstrap风格、云桌面风格</br>
* <b>技术点十七:</b>在线配置报表(无需编码,通过在线配置方式,实现曲线图,柱状图,数据等报表)</br>
* <b>技术点十八:</b>简易Excel导入导出支持单表导出和一对多表模式导出生成的代码自带导入导出功能</br>
* <b>技术点十九:</b>移动OA移动OA审批功能采用H5技术实现手机移动办公无缝对接微信、钉钉、微信企业号、也可以做APP</br>
* <b>技术点二十:</b>移动图表在线配置移动报表采用H5技术可以手机端查看</br>
* <b>技术点二十一::</b>插件开发业务功能组件以插件方式集成平台也可以单独部署发发布有力支撑了SAAS云应用系统需求</br>
* <b>技术点二十二::</b>专业接口对接机制统一采用restful接口方式集成swagger-ui在线接口文档Jwt token安全验证方便客户端对接</br>
* <b>技术点二十三:</b>接口安全机制,可细化控制接口授权,非常简便实现不同客户端只看自己数据等控制</br>
* <b>技术点二十四:</b>高级组合查询功能,在线配置支持主子表关联查询,可保存查询历史</br>
* <b>技术点二十五:</b>支持二级管理员,权限细化管理</br>
* <b>技术点二十六:</b>代码生成器支持resutful接口生成</br>
* JEECG V3.7.8, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
* 支持多种浏览器: IE, 火狐, Google 等</br>
* 支持数据库: Mysql,Oracle10g,Postgre,SqlServer等</br>
* 支持数据库: Mysql,Oracle,Postgre,SqlServer等</br>
* 基础权限: 用户,角色,菜单权限,按钮权限,数据权限</br>
* 智能报表集成: 简易的图像报表工具和Excel导入导出</br>
* Web容器测试通过的有Jetty和Tomcat6,Weblogic</br>
* 即将推出功能:分布式部署,云平台,移动平台开发,规则引擎</br>
* Web容器测试通过的有Jetty和Tomcat,Weblogic</br>
* 亮点功能:分布式部署,云平台,移动平台开发,规则引擎</br>
* 要求JDK1.6+</br>
技术文档
-----------------------------------
* [JEECG_3.7新版开发工具](http://blog.csdn.net/zhangdaiscott/article/details/78072438)
* [JEECG 开发环境搭建入门](http://blog.csdn.net/zhangdaiscott/article/details/50915206)
* [JEECG maven本地仓库下载](http://git.oschina.net/jeecg/jeecg-local-maven)
* [JEECG 开发手册](http://git.oschina.net/jeecg/jeecg/attach_files)
* [在线演示](http://demo.jeecg.org)
* [JEECG 入门开发环境搭建](https://blog.csdn.net/zhangdaiscott/article/details/50915206)
* [JEECG 在线开发文档](http://jeecg3.mydoc.io)
* [JEECG 常见问题贴](http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1)
* [JEECG 视频教程](http://www.jeecg.org/forum.php?mod=viewthread&tid=197&extra=page%3D1)
* [JEECG 官方百度网盘](https://pan.baidu.com/share/home?uk=2668473880#category/type=0)
* [JEECG 版本更新日志](http://www.jeecg.org/forum.php?mod=viewthread&tid=365&extra=page%3D1)
* JEECG官方Maven镜像配置 : [http://t.cn/RJCp7wO](http://t.cn/RJCp7wO)
* 在线演示地址:[http://demo.jeecg.org](http://demo.jeecg.org)
* JEECG 3.7.1 版本(非maven-myeclipse) 链接http://pan.baidu.com/s/1kVMKWuF 密码b8kf
* [JEECG 本地maven仓库下载](https://gitee.com/jeecg/jeecg-local-maven)
* [JEECG 在线视频教程](https://edu.csdn.net/lecturer/929)
* [非Maven版本下载](https://github.com/zhangdaiscott/jeecg-nomaven)
* [JEECG 版本日志](http://www.jeecg.org/forum.php?mod=viewthread&tid=365&extra=page%3D1)
技术交流
-----------------------------------
* QQ交流群 ⑤293658367、③289782002、②106838471(满)、①106259349(满)、④176031980(满)</br>
* QQ交流群 ⑥190866569、其他群(全满)</br>
* 官方论坛: [http://www.jeecg.org](http://www.jeecg.org)
* 官方网站: [http://www.guojusoft.com](http://www.guojusoft.com)
* 官方博客: [http://blog.csdn.net/zhangdaiscott](http://blog.csdn.net/zhangdaiscott)
* 技术支持: [JEECG社区官方支持QQ群汇总](http://www.jeecg.org/forum.php?mod=viewthread&tid=1249&extra=page%3D1)
JEECG云插件中心
-----------------------------------
* JEECG从V_3.6.3版本开始采用插件开发模式JEECG走简化轻量级路线后续升级和功能模块采用插件开发模式进行集成。
* 更多插件下载地址:[http://yun.jeecg.org/](http://yun.jeecg.org)
![github](http://img.blog.csdn.net/20160623162220022?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
* 关注官方微信公众号,获取更多资讯
![输入图片说明](https://static.oschina.net/uploads/img/201807/09172938_ltsb.jpg "在这里输入图片标题")
社区荣誉
@ -136,50 +139,65 @@ JEECG
系统演示
-----------------------------------
### [1].多套首页风格支持自定义Bootstrap风格|云桌面风格|经典风格|Shortcut风格等
![github](http://img.blog.csdn.net/20160428121122932?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20150607214324659?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20150607214353113?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
### [2].表单自定义设计效果
![github](http://www.jeecg.org/data/attachment/forum/201512/17/175056vgzo2j2thph29jdp.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201512/17/175135xq9fwiun3pi6i4e6.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201512/17/175152r6eg2f15g58jzzej.png "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201512/17/175103v1r87337prnfr1du.jpg "jeecg")
### [3].报表演示
![github](http://img.blog.csdn.net/20150607222027195?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20150607214724128?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20150607221941932?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20150607214807402?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
### [4].移动报表演示
![github](http://img.blog.csdn.net/20160304140805046?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160304140809176?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160304140812389?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160304140820202?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160304140823843?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
### [5].流程组件演示
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123311mf9fa22tv69b228f.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123412x003euegeg7nb68z.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/124748gyhrgvr45vshyc82.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123428ubcjjnuwjbkjrnrw.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/124749up2j5id7gj9kppp8.jpg "jeecg")
### [1].多套首页风格支持自定义H+风格|FineUI风格|ACE风格|Shortcut风格/云桌面等)
![输入图片说明](https://static.oschina.net/uploads/img/201807/09163742_IbMJ.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164411_zSuo.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164423_JfhR.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164434_NSLt.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164152_hxHU.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164204_uVWu.jpg "在这里输入图片标题")
### [2].表单设计能力online表单开发、表单设计器、word布局、积木表单
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164800_npNS.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164811_4UmX.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09164822_SE7Z.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09165024_90bw.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09165445_QkbR.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09165756_D2m3.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09165958_syDn.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19165540_CizC.jpg "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170233_i84Q.png "在这里输入图片标题")
### [3].流程组件演示
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171414_X1ee.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171521_bghO.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171532_NoB0.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171539_gh87.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171656_QTea.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171705_CTug.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171845_83W0.png "在这里输入图片标题")
### [4].报表演示(在线配置报表)
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170858_40eu.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170906_l8g0.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170916_KkLG.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170924_hDPz.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170932_HABN.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170941_McYh.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09171047_38JE.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201807/09170949_FWks.png "在这里输入图片标题")
### [5].移动报表演示
![输入图片说明](https://static.oschina.net/uploads/img/201804/19165909_OXfn.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19165929_OnoB.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19165943_eyQF.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19165955_tJkX.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170011_9CWF.png "在这里输入图片标题")
### [6].移动OA演示
![github](http://img.blog.csdn.net/20160303175110494?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160303175124104?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160303175134698?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160303175138713?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20160303175149042?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19173027_byRC.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19173036_C5Kv.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170252_9gZf.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170305_ud5Y.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170337_0myK.png "在这里输入图片标题")
### [6].移动APP
![github](http://img.blog.csdn.net/20170727143703234?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20170727143710317?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20170727143717031?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20170727143722008?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![github](http://img.blog.csdn.net/20170727143727421?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdkYWlzY290dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center "jeecg")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170420_v4qK.jpg "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170430_kqK2.jpg "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170449_W72k.jpg "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170458_qIv2.jpg "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201804/19170508_q2XJ.jpg "在这里输入图片标题")
代码示例

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,15 +0,0 @@
官方提供mysql\oracle\SqlServer脚步其他数据库可以通过工具自行转换。
转换方法参考http://blog.csdn.net/zhangdaiscott/article/details/46412453?yyue=a21bo.50862.201879
脚步说明:
1.oracle 导入命令
说明: jeecg脚本导出用户是jeecg
imp jeecgos/jeecgos@orcl file=jeecg.dmp
导入其他用户的表
imp jeecgos/jeecgos@orcl file=/opt/datatmp/jeecgbpm-oracle11g-20160413.dmp fromuser=scott touser=jeecgos ignore=y commit=y buffer=300000000 feedback=10000
2. oracle、SqlServer脚步索引会有部分丢失为了系统性能请自行补加索引。
3. jeecg系统数据库切换配置方法参考常见问题贴29
http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -0,0 +1,21 @@
官方提供mysql\oracle\SqlServer脚步其他数据库可以通过工具自行转换。
转换方法参考http://blog.csdn.net/zhangdaiscott/article/details/46412453?yyue=a21bo.50862.201879
脚步说明:
1.oracle 导入命令
说明: jeecg脚本导出用户是scott
imp scott/tiger@orcl file=jeecg_3.7.8_oracle11g.dmp
导入其他用户的表
imp jeecgos/jeecgos@orcl file=/opt/datatmp/jeecg_3.7.8_oracle11g.dmp fromuser=scott touser=jeecgos ignore=y commit=y buffer=300000000 feedback=10000
2. oracle、SqlServer脚步索引会有部分丢失为了系统性能请自行补加索引。
3. jeecg系统数据库切换配置方法参考常见问题贴29
http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1
4.老版本数据库增量升级
执行老版本升级SQL脚本
3.7.7升级到3.7.8
docs/老版本增量升级/jeecg_mysql-3.7.7-update-3.7.8.sql

@ -0,0 +1,12 @@
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('402881fa64a1ca500164a1d549e40001', NULL, '1', 'Bootstrap树形列表', '5', 'jeecgFormDemoController.do?bootstrapTreeListDemo', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-tree', 'admin', '管理员', 'admin', '2018-07-16 16:17:45', '2018-07-16 14:44:27', '管理员');
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164caf6520164cb5ecade0006', NULL, '1', '检索下拉框', '100', 'jeecgListDemoController.do?suggest', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', '', 'admin', '管理员', NULL, NULL, '2018-07-24 16:19:04', NULL);
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164caf6520164cb5d79670004', NULL, '1', 'plupload上传1', '100', 'jeecgFormDemoController.do?plupload1', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', '', 'admin', '管理员', NULL, NULL, '2018-07-24 16:17:38', NULL);
UPDATE `t_s_function` SET `function_icon_style`='fa-list-ol' WHERE (`ID`='4028f68164caf6520164cb5ecade0006');
UPDATE `t_s_function` SET `function_icon_style`='fa-upload' WHERE (`ID`='4028f68164caf6520164cb5d79670004');
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164cfec7b0164d07373540002', NULL, '1', 'plupload上传2', '100', 'jeecgFormDemoController.do?plupload2', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-upload', 'admin', '管理员', NULL, NULL, '2018-07-25 15:59:44', NULL);
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028810a64e8d94d0164e9033a580005', NULL, '1', '单据打印', '10', 'jeecgFormDemoController.do?printingDemo', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-print', 'admin', '管理员', 'admin', '2018-07-30 14:30:52', '2018-07-30 10:27:40', '管理员');
UPDATE `t_s_icon` SET `extend` = 'png', `iconclas` = 'deskIcon', `content` = NULL, `name` = 'Online表单开发', `path` = 'plug-in/sliding/icon/Finder.png', `type` = 3 WHERE `ID` = '8a8ab0b246dc81120146dc818102002c';
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('4028810264f4f97d0164f528560a0010', 'please.input.table.content', 'Please Input Table Content', 'en', '2018-08-01 19:03:39', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('4028810264f4f97d0164f527c5dd000e', 'please.input.table.content', '请填写表描述!', 'zh-cn', '2018-08-01 19:03:02', 'admin', '管理员', NULL, NULL, NULL);
UPDATE `cgform_field` SET `id`='ff8080816021b031016021fced19000f', `content`='收货人', `create_by`='admin', `create_date`='2017-12-04 22:45:12', `create_name`='管理员', `dict_field`='receiver_name,receiver_mobile', `dict_table`='user_msg', `dict_text`='realname,account', `field_default`='', `field_href`='', `field_length`='120', `field_name`='receiver_name', `field_valid_type`='', `field_must_input`='N', `is_key`='N', `is_null`='Y', `is_query`='Y', `is_show`='Y', `is_show_list`='Y', `length`='56', `main_field`='', `main_table`='', `old_field_name`='receiver_name', `order_num`='11', `point_length`='0', `query_mode`='single', `show_type`='popup', `type`='string', `update_by`='admin', `update_date`='2018-08-02 20:14:54', `update_name`='管理员', `table_id`='ff8080816021b031016021fced100004', `extend_json`='', `fill_rule_code`='' WHERE (`id`='ff8080816021b031016021fced19000f');
update t_s_muti_lang set lang_context = '3.7.8' where lang_key ='system.version.number';

File diff suppressed because it is too large Load Diff

@ -1,406 +0,0 @@
package com.jeecg.black.controller;
import com.jeecg.black.entity.TsBlackListEntity;
import com.jeecg.black.service.TsBlackListServiceI;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.common.TreeChildCount;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map;
import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.net.URI;
import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2017-05-18 22:33:13
* @version V1.0
*
*/
@Controller
@RequestMapping("/tsBlackListController")
public class TsBlackListController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(TsBlackListController.class);
@Autowired
private TsBlackListServiceI tsBlackListService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/black/tsBlackListList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(TsBlackListEntity tsBlackList,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(TsBlackListEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tsBlackList, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.tsBlackListService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(TsBlackListEntity tsBlackList, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
tsBlackList = systemService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
message = "黑名单删除成功";
try{
tsBlackListService.delete(tsBlackList);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "黑名单删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "黑名单删除成功";
try{
for(String id:ids.split(",")){
TsBlackListEntity tsBlackList = systemService.getEntity(TsBlackListEntity.class,
id
);
tsBlackListService.delete(tsBlackList);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "黑名单删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(TsBlackListEntity tsBlackList, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "黑名单添加成功";
try{
tsBlackListService.save(tsBlackList);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "黑名单添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(TsBlackListEntity tsBlackList, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "黑名单更新成功";
TsBlackListEntity t = tsBlackListService.get(TsBlackListEntity.class, tsBlackList.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(tsBlackList, t);
tsBlackListService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "黑名单更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(TsBlackListEntity tsBlackList, HttpServletRequest req) {
if (StringUtil.isNotEmpty(tsBlackList.getId())) {
tsBlackList = tsBlackListService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
req.setAttribute("tsBlackListPage", tsBlackList);
}
return new ModelAndView("com/jeecg/black/tsBlackList-add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(TsBlackListEntity tsBlackList, HttpServletRequest req) {
if (StringUtil.isNotEmpty(tsBlackList.getId())) {
tsBlackList = tsBlackListService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
req.setAttribute("tsBlackListPage", tsBlackList);
}
return new ModelAndView("com/jeecg/black/tsBlackList-update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","tsBlackListController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(TsBlackListEntity tsBlackList,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(TsBlackListEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tsBlackList, request.getParameterMap());
List<TsBlackListEntity> tsBlackLists = this.tsBlackListService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"黑名单");
modelMap.put(NormalExcelConstants.CLASS,TsBlackListEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("黑名单列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,tsBlackLists);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(TsBlackListEntity tsBlackList,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"黑名单");
modelMap.put(NormalExcelConstants.CLASS,TsBlackListEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("黑名单列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<TsBlackListEntity> listTsBlackListEntitys = ExcelImportUtil.importExcel(file.getInputStream(),TsBlackListEntity.class,params);
for (TsBlackListEntity tsBlackList : listTsBlackListEntitys) {
tsBlackListService.save(tsBlackList);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public List<TsBlackListEntity> list() {
List<TsBlackListEntity> listTsBlackLists=tsBlackListService.getList(TsBlackListEntity.class);
return listTsBlackLists;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) {
TsBlackListEntity task = tsBlackListService.get(TsBlackListEntity.class, id);
if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
return new ResponseEntity(task, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<?> create(@RequestBody TsBlackListEntity tsBlackList, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<TsBlackListEntity>> failures = validator.validate(tsBlackList);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
tsBlackListService.save(tsBlackList);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = tsBlackList.getId();
URI uri = uriBuilder.path("/rest/tsBlackListController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);
return new ResponseEntity(headers, HttpStatus.CREATED);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody TsBlackListEntity tsBlackList) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<TsBlackListEntity>> failures = validator.validate(tsBlackList);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
tsBlackListService.saveOrUpdate(tsBlackList);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) {
tsBlackListService.deleteEntityById(TsBlackListEntity.class, id);
}
}

@ -0,0 +1,328 @@
package com.jeecg.demo.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Validator;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.jeecg.demo.entity.JeecgDemoExcelEntity;
import com.jeecg.demo.service.JeecgDemoExcelServiceI;
import com.jeecg.demo.util.FreemarkerUtil;
import io.swagger.annotations.Api;
/**
* @Title: Controller
* @Description: excel
* @author onlineGenerator
* @date 2018-06-15 15:46:09
* @version V1.0
*
*/
@Controller
@RequestMapping("/jeecgDemoExcelController")
@Api(value="JeecgDemoExcel",description="excel导入导出测试表",tags="jeecgDemoExcelController")
public class JeecgDemoExcelController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(JeecgDemoExcelController.class);
@Autowired
private JeecgDemoExcelServiceI jeecgDemoExcelService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
* excel
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/excel/jeecgDemoExcelList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JeecgDemoExcelEntity jeecgDemoExcel,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JeecgDemoExcelEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jeecgDemoExcel, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.jeecgDemoExcelService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* excel
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
jeecgDemoExcel = systemService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());
message = "excel导入导出测试表删除成功";
try{
jeecgDemoExcelService.delete(jeecgDemoExcel);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "excel导入导出测试表删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* excel
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "excel导入导出测试表删除成功";
try{
for(String id:ids.split(",")){
JeecgDemoExcelEntity jeecgDemoExcel = systemService.getEntity(JeecgDemoExcelEntity.class,
id
);
jeecgDemoExcelService.delete(jeecgDemoExcel);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "excel导入导出测试表删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* excel
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "excel导入导出测试表添加成功";
try{
jeecgDemoExcelService.save(jeecgDemoExcel);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "excel导入导出测试表添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* excel
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "excel导入导出测试表更新成功";
JeecgDemoExcelEntity t = jeecgDemoExcelService.get(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(jeecgDemoExcel, t);
jeecgDemoExcelService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "excel导入导出测试表更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* excel
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemoExcel.getId())) {
jeecgDemoExcel = jeecgDemoExcelService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());
req.setAttribute("jeecgDemoExcelPage", jeecgDemoExcel);
}
return new ModelAndView("com/jeecg/demo/excel/jeecgDemoExcel-add");
}
/**
* excel
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(JeecgDemoExcelEntity jeecgDemoExcel, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemoExcel.getId())) {
jeecgDemoExcel = jeecgDemoExcelService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());
req.setAttribute("jeecgDemoExcelPage", jeecgDemoExcel);
}
return new ModelAndView("com/jeecg/demo/excel/jeecgDemoExcel-update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","jeecgDemoExcelController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JeecgDemoExcelEntity jeecgDemoExcel,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(JeecgDemoExcelEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jeecgDemoExcel, request.getParameterMap());
List<JeecgDemoExcelEntity> jeecgDemoExcels = this.jeecgDemoExcelService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"excel导入导出测试表");
modelMap.put(NormalExcelConstants.CLASS,JeecgDemoExcelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("excel导入导出测试表列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,jeecgDemoExcels);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(JeecgDemoExcelEntity jeecgDemoExcel,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"excel导入导出测试表");
modelMap.put(NormalExcelConstants.CLASS,JeecgDemoExcelEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("excel导入导出测试表列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<JeecgDemoExcelEntity> listJeecgDemoExcelEntitys = ExcelImportUtil.importExcel(file.getInputStream(),JeecgDemoExcelEntity.class,params);
for (JeecgDemoExcelEntity jeecgDemoExcel : listJeecgDemoExcelEntitys) {
jeecgDemoExcelService.save(jeecgDemoExcel);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(e.getMessage());
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping("/ftl2word")
public void velocity2word(JeecgDemoExcelEntity jeecgDemoExcel,HttpServletRequest request,HttpServletResponse response) throws IOException{
try {
jeecgDemoExcel = this.jeecgDemoExcelService.getEntity(JeecgDemoExcelEntity.class, jeecgDemoExcel.getId());
List<Map<String,Object>> departs = this.systemService.findForJdbc("select id,departname from t_s_depart");
String docFileName ="word-模板导出测试.doc";
Map<String,Object> rootMap = new HashMap<String,Object>();
rootMap.put("info", jeecgDemoExcel);
rootMap.put("departs", departs);
FreemarkerUtil.createFile("ftl2doc.ftl", docFileName, rootMap, request, response, FreemarkerUtil.WORD_FILE);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -1,13 +1,35 @@
package com.jeecg.demo.controller;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.Response;
import net.sf.json.JSONArray;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
@ -17,8 +39,17 @@ import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.StoreUploadFilePathEnum;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.util.*;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.HttpRequest;
import org.jeecgframework.core.util.JSONHelper;
import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.core.util.MyClassLoader;
import org.jeecgframework.core.util.NumberComparator;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
@ -33,10 +64,12 @@ import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
@ -62,7 +95,17 @@ public class JeecgFormDemoController extends BaseController {
public ModelAndView uitag(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/form_uitag");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "qrcode")
public ModelAndView qrcode(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/form_QRCode");
}
@RequestMapping(params = "formValidDemo")
public ModelAndView formValidDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/form_valid");
@ -83,12 +126,30 @@ public class JeecgFormDemoController extends BaseController {
return new ModelAndView("com/jeecg/demo/form_nature");
}
@RequestMapping(params = "natures")
public ModelAndView topjuiDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/form_natures");
}
/**
* tab demo
* @param request
* @return
*/
@RequestMapping(params = "ueditor")
public ModelAndView ueditor(HttpServletRequest request) {
logger.info("ueditor");
return new ModelAndView("com/jeecg/demo/ueditor");
}
/**
* popup demo
* @param request
* @return
*/
@RequestMapping(params = "popupMultiValue")
public ModelAndView popupMultiValue(HttpServletRequest request) {
logger.info("popupMultiValue");
@ -206,9 +267,7 @@ public class JeecgFormDemoController extends BaseController {
*/
@RequestMapping(params = "getAutocompleteData",method ={RequestMethod.GET, RequestMethod.POST})
public void getAutocompleteData(HttpServletRequest request, HttpServletResponse response) {
String searchVal = request.getParameter("q");
String hql = "from TSUser where userName like '%"+searchVal+"%'";
List autoList = systemService.findHql(hql);
try {
@ -228,17 +287,28 @@ public class JeecgFormDemoController extends BaseController {
}
}
/**
* demo
* @param request
* @return
*/
@RequestMapping(params = "eSign")
public ModelAndView eSignDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/zsign");
}
/**
* demo
* @param request
* @return
*/
@RequestMapping(params = "siteSelect")
public ModelAndView siteSelect(HttpServletRequest request) {
logger.info("----左右布局 demo转入页面-----");
return new ModelAndView("com/jeecg/demo/siteSelect");
}
/**
*
*/
@ -247,7 +317,11 @@ public class JeecgFormDemoController extends BaseController {
logger.info("----上下特殊布局 demo转入页面-----");
return new ModelAndView("com/jeecg/demo/specialLayout");
}
/**
* demo
* @return
*/
@RequestMapping(params = "commonUpload")
public ModelAndView commonUploadDemo(){
return new ModelAndView("system/commonupload/commonUploadFile");
@ -262,6 +336,11 @@ public class JeecgFormDemoController extends BaseController {
public AjaxJson saveUploadFile(String documentTitle,String filename,String swfpath){
AjaxJson ajaxJson = new AjaxJson();
try {
if(StringUtil.isEmpty(filename)){
ajaxJson.setSuccess(false);
ajaxJson.setMsg("未上传文件");
return ajaxJson;
}
TSTypegroup tsTypegroup=systemService.getTypeGroup("fieltype","文档分类");
TSType tsType = systemService.getType("files","附件", tsTypegroup);
TSDocument document = new TSDocument();
@ -271,11 +350,9 @@ public class JeecgFormDemoController extends BaseController {
document.setCreatedate(DateUtils.gettimestamp());
document.setTSType(tsType);
document.setSwfpath(swfpath);
String fileName = filename.substring(filename.lastIndexOf("/")+1,filename.lastIndexOf("."));
document.setAttachmenttitle(fileName);
document.setExtend(filename.substring(filename.lastIndexOf(".") + 1));
systemService.save(document);
} catch (Exception e) {
e.printStackTrace();
@ -284,7 +361,7 @@ public class JeecgFormDemoController extends BaseController {
}
return ajaxJson;
}
/**
@ -313,7 +390,7 @@ public class JeecgFormDemoController extends BaseController {
}
return new ModelAndView("system/document/files");
}
/**
*
*
@ -328,13 +405,12 @@ public class JeecgFormDemoController extends BaseController {
Map<String, Object> attributes = new HashMap<String, Object>();
TSTypegroup tsTypegroup=systemService.getTypeGroup("fieltype","文档分类");
TSType tsType = systemService.getType("files","附件", tsTypegroup);
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
String documentId = oConvertUtils.getString(request.getParameter("documentId"));// 文件ID
String documentTitle = oConvertUtils.getString(request.getParameter("documentTitle"));// 文件标题
if (StringUtil.isNotEmpty(fileKey)) {
document.setId(fileKey);
document = systemService.getEntity(TSDocument.class, fileKey);
if (StringUtil.isNotEmpty(documentId)) {
document.setId(documentId);
document = systemService.getEntity(TSDocument.class, documentId);
document.setDocumentTitle(documentTitle);
}
document.setSubclassname(MyClassLoader.getPackPath(document));
document.setCreatedate(DateUtils.gettimestamp());
@ -358,8 +434,12 @@ public class JeecgFormDemoController extends BaseController {
*
*/
@RequestMapping(params = "documentList")
public void documentList(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
public void documentList(TSDocument document,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(TSDocument.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, document,request.getParameterMap());
String typecode = oConvertUtils.getString(request.getParameter("typecode"));
cq.createAlias("TSType", "TSType");
cq.eq("TSType.typecode", typecode);
@ -389,6 +469,32 @@ public class JeecgFormDemoController extends BaseController {
return j;
}
/**
*
* @author taoYan
* @since 201882
*/
@RequestMapping(params = "updateDoc")
@ResponseBody
public AjaxJson updateDoc(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
try {
String id = request.getParameter("id");
String title = request.getParameter("title");
TSDocument document = systemService.getEntity(TSDocument.class,id);
document.setDocumentTitle(title);
systemService.updateEntitie(document);
j.setSuccess(true);
j.setMsg("文件标题修改成功!");
} catch (Exception e) {
j.setSuccess(false);
j.setMsg("文件标题修改失败!");
}
return j;
}
/**
*
*/
@ -414,16 +520,15 @@ public class JeecgFormDemoController extends BaseController {
cq.addOrder("functionOrder", SortDirection.asc);
cq.add();
//--手工加载数据权限条件--------
//获取装载数据权限的条件HQL
cq = HqlGenerateUtil.getDataAuthorConditionHql(cq, new TSFunction());
cq.add();
List<TSFunction> functionList = systemService.getListByCriteriaQuery(cq, pageflag);
Long total=systemService.getCountForJdbc("select count(*) from t_s_function where functionlevel=0");
//菜单管理页面:菜单排序
Collections.sort(functionList, new NumberComparator());
List<TreeGrid> treeGrids = new ArrayList<TreeGrid>();
TreeGridModel treeGridModel = new TreeGridModel();
treeGridModel.setIcon("TSIcon_iconPath");
@ -435,10 +540,9 @@ public class JeecgFormDemoController extends BaseController {
treeGridModel.setChildList("TSFunctions");
// 添加排序字段
treeGridModel.setOrder("functionOrder");
//添加菜单图标样式
treeGridModel.setIconStyle("functionIconStyle");
treeGridModel.setFunctionType("functionType");
treeGrids = systemService.treegrid(functionList, treeGridModel);
@ -463,7 +567,7 @@ public class JeecgFormDemoController extends BaseController {
public ModelAndView function(ModelMap model) {
return new ModelAndView("com/jeecg/demo/functionList");
}
/**
*
@ -504,7 +608,7 @@ public class JeecgFormDemoController extends BaseController {
this.systemService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
@RequestMapping(params = "ztreeDemo")
public ModelAndView ztreeDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/ztreeDemo");
@ -555,14 +659,13 @@ public class JeecgFormDemoController extends BaseController {
public AjaxJson del(TSDepart depart, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
depart = systemService.getEntity(TSDepart.class, depart.getId());
Long childCount = systemService.getCountForJdbc("select count(1) from t_s_depart where parentdepartid ='" + depart.getId() + "'");
Long childCount = systemService.getCountForJdbcParam("select count(1) from t_s_depart where parentdepartid = ?", depart.getId());
if(childCount>0){
j.setSuccess(false);
j.setMsg("有下级,不能删除");
return j;
}
systemService.executeSql("delete from t_s_role_org where org_id=?", depart.getId());
//systemService.delete();
j.setMsg("删除成功");
return j;
}
@ -580,4 +683,333 @@ public class JeecgFormDemoController extends BaseController {
logger.info("----选项卡demo转入页面-----");
return new ModelAndView("com/jeecg/demo/tabDemo");
}
}
/**
* Demo:
* @param request
* @return
*/
@RequestMapping(params = "interfaceTestDemo")
public ModelAndView interfaceTestDemo(HttpServletRequest request) {
logger.info("----接口测试demo转入页面-----");
return new ModelAndView("com/jeecg/demo/form_interfaceTestDemo");
}
/**
* Demo:
* @param request
* @param response
* @return AjaxJson
*/
@RequestMapping(params = "interfaceTest")
@ResponseBody
public AjaxJson testInterface(HttpServletRequest request,HttpServletResponse response) {
AjaxJson j=new AjaxJson();
try {
String serverUrl = request.getParameter("serverUrl");//请求的地址
String requestBody = request.getParameter("requestBody");//请求的参数
String requestMethod = request.getParameter("requestMethod");//请求的方式
if(requestMethod.equals("POST")){
if(requestBody !=""){
logger.info("----请求接口开始-----");
JSONObject sendPost = HttpRequest.sendPost(serverUrl, requestBody);
logger.info("----请求接口结束-----"+sendPost);
j.setSuccess(true);
j.setObj(sendPost.toJSONString());
}else{
j.setSuccess(false);
j.setObj("请填写请求参数");
}
}
if(requestMethod.equals("GET")){
logger.info("----请求接口开始-----");
JSONObject sendGet = HttpRequest.sendGet(serverUrl, requestBody);
logger.info("----请求接口结束-----"+sendGet.toJSONString());
j.setSuccess(true);
j.setObj(sendGet);
}
} catch (Exception e) {
j.setSuccess(false);
j.setObj("服务器请求失败");
e.printStackTrace();
}
return j;
}
/**
* Webupload
* @param request
* @return
*/
@RequestMapping(params = "webuploader")
public ModelAndView webuploader(HttpServletRequest request) {
logger.info("----webuploaderdemo-----");
return new ModelAndView("com/jeecg/demo/form_webuploader");
}
/**
* WebUploader
*
*/
@RequestMapping("/filedeal")
@ResponseBody
public AjaxJson filedeal(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
String msg="";
String ctxPath=ResourceUtil.getConfigByName("webUploadpath");//demo中设置为D://upFiles,实际项目应因事制宜
try {
String fileName = null;
String bizType=request.getParameter("bizType");//上传业务名称
String bizPath=StoreUploadFilePathEnum.getPath(bizType);//根据业务名称判断上传路径
String nowday=new SimpleDateFormat("yyyyMMdd").format(new Date());
File file = new File(ctxPath+"/"+bizPath+"/"+nowday);
if (!file.exists()) {
file.mkdirs();// 创建文件根目录
}
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultipartFile mf=multipartRequest.getFile("file");// 获取上传文件对象
String orgName = mf.getOriginalFilename();// 获取文件名
fileName = String.valueOf(UUID.randomUUID().getMostSignificantBits()).replace("-", "")+ orgName.substring(orgName.lastIndexOf("."));
String savePath = file.getPath() + "/" + fileName;
File savefile = new File(savePath);
FileCopyUtils.copy(mf.getBytes(), savefile);
msg="上传成功";
j.setMsg(msg);
String dbpath=bizPath+"/"+nowday+"/"+fileName;
Map<String,Object> info = new HashMap<String,Object>();
info.put("filename", orgName.substring(0,orgName.lastIndexOf(".")));
info.put("filesize", mf.getSize());
info.put("filetype", orgName.substring(orgName.lastIndexOf(".")));
info.put("filepath", dbpath);
j.setAttributes(info);
} catch (IOException e) {
j.setSuccess(false);
logger.info(e.getMessage());
}
j.setMsg(msg);
return j;
}
/**
*
* @param request
* @param response
* @return
*/
@RequestMapping("/filedelete")
@ResponseBody
public AjaxJson filedelete(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
String msg="";
String ctxPath=ResourceUtil.getConfigByName("webUploadpath");//demo中设置为D://upFiles,实际项目应因事制宜
String path=request.getParameter("filepath");
String delpath=ctxPath+"/"+path;
File fileDelete = new File(delpath);
if (!fileDelete.exists() || !fileDelete.isFile()) {
msg="警告: " + delpath + "不存在!";
logger.info(msg);
j.setSuccess(true);//不存在前台也给他删除
}else{
if(fileDelete.delete()){
msg="--------成功删除文件---------"+delpath;
logger.info(msg);
}else{
j.setSuccess(false);
msg="没删除成功--jdk的问题还是你文件的问题请重新试试";
logger.info(msg);
}
}
j.setMsg(msg);
return j;
}
@RequestMapping("/filedown")
public void getImgByurl(HttpServletResponse response,HttpServletRequest request) throws Exception{
String dbpath = request.getParameter("filepath");
if(oConvertUtils.isNotEmpty(dbpath)&&dbpath.endsWith(",")){
dbpath = dbpath.substring(0, dbpath.length()-1);
}
response.setContentType("application/x-msdownload;charset=utf-8");
String fileType = dbpath.substring(dbpath.lastIndexOf("."));
String fileName=request.getParameter("filename")+fileType;
String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko") ) {
fileName = URLEncoder.encode(fileName, "UTF-8");
}else {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
}
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
InputStream inputStream = null;
OutputStream outputStream=null;
try {
String localPath=ResourceUtil.getConfigByName("webUploadpath");
String imgurl = localPath+"/"+dbpath;
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
outputStream = response.getOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
response.flushBuffer();
} catch (Exception e) {
logger.info("--通过流的方式获取文件异常--"+e.getMessage());
}finally{
if(inputStream!=null){
inputStream.close();
}
if(outputStream!=null){
outputStream.close();
}
}
}
@RequestMapping(params = "dropDownDatagrid",method ={RequestMethod.GET, RequestMethod.POST})
public ModelAndView dropDownDatagrid(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/dropDownDatagrid");
}
/**
* bootstrap
*
* @return
*/
@RequestMapping(params = "bootstrapTreeListDemo")
public ModelAndView bootstrapTreeListDemo(ModelMap model) {
return new ModelAndView("com/jeecg/demo/bootstrapTreeList");
}
/**
* bootstrap
*
* @return
*/
@RequestMapping(params = "bootstrapDemoDatagrid",method ={RequestMethod.GET, RequestMethod.POST})
public void bootstrapDemoDatagrid(HttpServletRequest request,HttpServletResponse response) {
try {
String text1="[{\"id\":1,\"pid\":0,\"status\":1,\"name\":\"系统管理\",\"permissionValue\":\"系统\"},{\"id\":2,\"pid\":0,\"status\":1,\"name\":\"字典管理\",\"permissionValue\":\"字典\"},{\"id\":20,\"pid\":1,\"status\":1,\"name\":\"新增系统\",\"permissionValue\":\"新增\"},{\"id\":21,\"pid\":1,\"status\":1,\"name\":\"编辑系统\",\"permissionValue\":\"编辑\"},{\"id\":22,\"pid\":1,\"status\":1,\"name\":\"删除系统\",\"permissionValue\":\"删除\"},{\"id\":33,\"pid\":2,\"status\":1,\"name\":\"系统环境\",\"permissionValue\":\"环境\"},{\"id\":333,\"pid\":33,\"status\":1,\"name\":\"新增环境\",\"permissionValue\":\"新增\"},{\"id\":3333,\"pid\":33,\"status\":1,\"name\":\"编辑环境\",\"permissionValue\":\"编辑\"},{\"id\":233332,\"pid\":33,\"status\":0,\"name\":\"删除环境\",\"permissionValue\":\"删除\"}]";
response.getWriter().println(text1);
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(params = "plupload1")
public ModelAndView plupload(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/plupload/plupload1");
}
@RequestMapping(params = "plupload2")
public ModelAndView plupload3(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/plupload/plupload3");
}
@RequestMapping(params = "goPlupload")
public ModelAndView goPlupload(HttpServletRequest request) {
request.setAttribute("chunk", request.getParameter("chunk"));
return new ModelAndView("com/jeecg/demo/plupload/plupload5");
}
/**
*
* bug List<FileItem> items = upload.parseRequest(request); mvc
*
* @param request
* @param response
* @throws IOException
*/
@RequestMapping("/doupload")
public void doupload(HttpServletRequest request, HttpServletResponse response) throws IOException {
String ctxPath=ResourceUtil.getConfigByName("webUploadpath");//demo中设置为D://upFiles,实际项目应因事制宜
String tempFileDir = ctxPath+File.separator+"temp";
response.setCharacterEncoding("UTF-8");
Integer schunk = null;//分割块数
Integer schunks = null;//总分割数
String name = null;//文件名
BufferedOutputStream outputStream=null;
if (ServletFileUpload.isMultipartContent(request)) {
try {
String bizType=request.getParameter("bizType");//上传业务名称
String bizPath=StoreUploadFilePathEnum.getPath(bizType);//根据业务名称判断上传路径
String nowday=new SimpleDateFormat("yyyyMMdd").format(new Date());
String fileDir = ctxPath+File.separator+bizPath+File.separator+nowday;
File file = new File(fileDir);
if (!file.exists()) {
file.mkdirs();// 创建文件根目录
}
File tempFile = new File(tempFileDir);
if (!tempFile.exists()) {
tempFile.mkdirs();// 创建文件临时目录
}
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(1024);
factory.setRepository(tempFile);//设置临时目录
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("UTF-8");
upload.setSizeMax(5*1024*1024);//设置附近大小??
List<FileItem> items = upload.parseRequest(request);
//生成新的文件名
String newFilename = null;
for(FileItem item : items){
if(!item.isFormField()){
//如果是文件类型
name = item.getName();//获取文件名
System.out.println("name:"+name);
newFilename = UUID.randomUUID().toString().replace("-","").concat(".").concat(FilenameUtils.getExtension(name));
System.out.println("newFilename:"+newFilename);
if(name!=null){
String nFname = newFilename;
if(schunk!=null){
nFname = schunk+"_"+name;
}
File savedFile = new File(fileDir, nFname);
item.write(savedFile);
}
}else{
//判断是否带分割信息
if(item.getFieldName().equals("chunk")){
schunk = Integer.parseInt(item.getString());
}
if(item.getFieldName().equals("chunks")){
schunks = Integer.parseInt(item.getString());
}
}
}
System.out.println("chunk:"+schunk+"-"+schunks);
if(schunk!=null && schunk+1 == schunks){
outputStream = new BufferedOutputStream(new FileOutputStream(new File(fileDir,newFilename)));
for(int i=0;i<schunks;i++){
File itempFile = new File(fileDir,i+"_"+name);
byte[] bytes = FileUtils.readFileToByteArray(itempFile);
outputStream.write(bytes);
outputStream.flush();
itempFile.delete();
}
outputStream.flush();
}
response.getWriter().write("{\"status\":true,\"newName\":\""+newFilename+"\"}");
} catch (FileUploadException e) {
e.printStackTrace();
response.getWriter().write("{\"status\":false}");
} catch (Exception e) {
e.printStackTrace();
response.getWriter().write("{\"status\":false}");
}finally{
try {
if(outputStream!=null)
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
*demo
*
* @return
*/
@RequestMapping(params = "printingDemo")
public ModelAndView printingDemo(ModelMap model) {
return new ModelAndView("com/jeecg/demo/printingDemo");
}
}

@ -1,16 +1,25 @@
package com.jeecg.demo.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
@ -19,8 +28,9 @@ import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.fop.svg.PDFTranscoder;
import org.apache.log4j.Logger;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.exception.BusinessException;
@ -36,26 +46,43 @@ import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.jwt.util.GsonUtil;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
import org.jeecgframework.p3.core.util.oConvertUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.web.system.controller.core.LoginController;
import org.jeecgframework.web.system.enums.InterfaceEnum;
import org.jeecgframework.web.system.pojo.base.InterfaceRuleDto;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSLog;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.util.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.dao.JeecgMinidaoDao;
import com.jeecg.demo.entity.JeecgDemoEntity;
import com.jeecg.demo.entity.JeecgDemoPage;
@ -72,24 +99,25 @@ import com.jeecg.demo.service.JeecgDemoServiceI;
*/
@Controller
@RequestMapping("/jeecgListDemoController")
@Api(value="JeecgDemo",description="Angular JeecgDemo接口",tags="AngularJeecgDemoAPI")
public class JeecgListDemoController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(JeecgListDemoController.class);
private static final Logger logger = LoggerFactory.getLogger(JeecgListDemoController.class);
//【例子】报表例子
private static final String BROSWER_COUNT_ANALYSIS = "broswer.count.analysis";
@Autowired
private JeecgDemoServiceI jeecgDemoService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
@Autowired
private JeecgMinidaoDao jeecgMinidaoDao;
private static final String BROSWER_COUNT_ANALYSIS = "broswer.count.analysis";
@Autowired
private MutiLangServiceI mutiLangService;
/**
* minidao
@ -118,12 +146,57 @@ public class JeecgListDemoController extends BaseController {
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemoList");
}
/**
* vue
*/
@RequestMapping(params = "vueList")
public ModelAndView vueList(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/vueList");
}
@RequestMapping(params = "vueNewList")
public ModelAndView vueNewList(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/vueNewList");
}
/**
* vueBootstrapTable
*/
@RequestMapping(params = "vueBootstrapTableList")
public ModelAndView vueBootstrapTableList(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/vueBootstrapTableList");
}
@RequestMapping(params = "vueBootstrapTableAdd")
public ModelAndView vueBootstrapTableAdd(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/vueBootstrapTableAdd");
}
@RequestMapping(params = "vueBootstrapTableEdit")
public ModelAndView vueBootstrapTableEdit(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/vueBootstrapTableEdit");
}
@RequestMapping(params = "vueBootstrapTableGet")
@ResponseBody
public AjaxJson vueBootstrapTableGet(String id,HttpServletRequest request) {
AjaxJson json=new AjaxJson();
if(org.apache.commons.lang.StringUtils.isNotBlank(id)) {
JeecgDemoEntity t = jeecgDemoService.get(JeecgDemoEntity.class, id);
json.setObj(t);
}
json.setMsg("查询成功!");
return json;
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "multiHeaList")
public ModelAndView multiHeaList(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemoList-multihead");
}
/**
*
*/
@ -131,7 +204,15 @@ public class JeecgListDemoController extends BaseController {
public ModelAndView mysearchListDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/taglist_mysearch");
}
/**
*
*/
@RequestMapping(params = "mysearchListDemo2")
public ModelAndView mysearchListDemo2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/taglist_mysearch2");
}
/**
*
*
@ -142,6 +223,255 @@ public class JeecgListDemoController extends BaseController {
return new ModelAndView("com/jeecg/demo/reportDemo");
}
/**
* Demo
* @param request
* @return
*/
@RequestMapping(params = "querysBuilder")
public ModelAndView querysBuilder(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/querysBuilderDemo");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "goFormQuerysBuilder")
public ModelAndView goFormQuerysBuilder(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/form_querysBuilder");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "InstrumentDiagram")
public ModelAndView InstrumenDtiagram(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/InstrumentDiagram");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "Schedule")
public ModelAndView Schedule(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/Schedule");
}
/**
* 1
* @param request
* @return
*/
@RequestMapping(params = "BarGraph1")
public ModelAndView BarGraph1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/BarGraph1");
}
/**
* 2
* @param request
* @return
*/
@RequestMapping(params = "BarGraph2")
public ModelAndView BarGraph2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/BarGraph2");
}
/**
* 3
* @param request
* @return
*/
@RequestMapping(params = "BarGraph3")
public ModelAndView BarGraph3(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/BarGraph3");
}
/**
* 4
* @param request
* @return
*/
@RequestMapping(params = "BarGraph4")
public ModelAndView BarGraph4(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/BarGraph4");
}
/**
* 1
* @param request
* @return
*/
@RequestMapping(params = "funnelPlot1")
public ModelAndView funnelPlot1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/funnelPlot1");
}
/**
* 2
* @param request
* @return
*/
@RequestMapping(params = "funnelPlot2")
public ModelAndView funnelPlot2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/funnelPlot2");
}
/**
* 线1
* @param request
* @return
*/
@RequestMapping(params = "lineChart1")
public ModelAndView lineChart1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/lineChart1");
}
/**
* 线2
* @param request
* @return
*/
@RequestMapping(params = "lineChart2")
public ModelAndView lineChart2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/lineChart2");
}
/**
* 线3
* @param request
* @return
*/
@RequestMapping(params = "lineChart3")
public ModelAndView lineChart3(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/lineChart3");
}/**
* 线4
* @param request
* @return
*/
@RequestMapping(params = "lineChart4")
public ModelAndView lineChart4(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/lineChart4");
}/**
* 线5
* @param request
* @return
*/
@RequestMapping(params = "lineChart5")
public ModelAndView lineChart5(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/lineChart5");
}
/**
* 1
* @param request
* @return
*/
@RequestMapping(params = "PieChart1")
public ModelAndView PieChart1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/PieChart1");
}
/**
* 2
* @param request
* @return
*/
@RequestMapping(params = "PieChart2")
public ModelAndView PieChart2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/PieChart2");
}
/**
* 1
* @param request
* @return
*/
@RequestMapping(params = "PointChart1")
public ModelAndView PointChart1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/PointChart1");
}
/**
* 2
* @param request
* @return
*/
@RequestMapping(params = "PointChart2")
public ModelAndView PointChart2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/PointChart2");
}
/**
* 3
* @param request
* @return
*/
@RequestMapping(params = "PointChart3")
public ModelAndView PointChart3(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/PointChart3");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "RectangularGraph")
public ModelAndView RectangularGraph(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/RectangularGraph");
}
/**
* 1
* @param request
* @return
*/
@RequestMapping(params = "other1")
public ModelAndView other1(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/other1");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "TotalReport")
public ModelAndView TotalReport(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/TotalReport");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "getTotalReport")
@ResponseBody
public String getTotalReport(HttpServletRequest request) {
List<Map<String,Object>> maplist=systemService.findForJdbc("select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer", null);
Long countSutent = systemService.getCountForJdbc("select count(*) from t_s_log where 1=1");
for(Map map:maplist){
Long personcount = Long.parseLong(map.get("broswercount").toString());
Double percentage = 0.0;
if (personcount != null && personcount.intValue() != 0) {
percentage = new Double(personcount)/countSutent;
}
map.put("rate", String.format("%.2f", percentage*100)+"%");
}
Long count = 0L;
if(JdbcDao.DATABSE_TYPE_SQLSERVER.equals(DBTypeUtil.getDBType())){
count = systemService.getCountForJdbcParam("select count(0) from (select l." +
" broswer ,count(broswer) broswercount from t_s_log l group by l.broswer) as t( broswer, broswercount)",null);
}else{
count = systemService.getCountForJdbcParam("select count(0) from (select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer)t",null);
}
StringBuffer strb =new StringBuffer();
strb.append("{\"title\": {\"text\": \"浏览器登录次数统计\",\"subtext\": \"测试数据\"},\"toolbox\": {\"show\": true,\"feature\": {\"restore\": {\"show\": true,\"title\": \"还原\"},\"saveAsImage\": {\"show\": true,\"title\": \"保存为图片\",\"type\": \"png\",\"lang\": [\"点击保存\"]},}},\"series\": [{\"data\": [");
for (Map map:maplist) {
strb.append("{\"value\": \" " +map.get("broswercount")+
"\",\"name\": \"" +map.get("broswer")+
"\"},");
}
strb.append("],\"type\": \"pie\"}]}");
String option =strb.toString();
return option;
}
/**
* datagrid
@ -163,7 +493,8 @@ public class JeecgListDemoController extends BaseController {
}
Long count = 0L;
if(JdbcDao.DATABSE_TYPE_SQLSERVER.equals(DBTypeUtil.getDBType())){
count = systemService.getCountForJdbcParam("select count(0) from (select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer) as t( broswer, broswercount)",null);
count = systemService.getCountForJdbcParam("select count(0) from (select l." +
" broswer ,count(broswer) broswercount from t_s_log l group by l.broswer) as t( broswer, broswercount)",null);
}else{
count = systemService.getCountForJdbcParam("select count(0) from (select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer)t",null);
}
@ -283,28 +614,28 @@ public class JeecgListDemoController extends BaseController {
}
}
}
@RequestMapping(params = "minidaoDatagrid")
public void minidaoDatagrid(JeecgDemoEntity jeecgDemo,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
/**
* minidaospringjdbc线
* {USER_NAME}
* {user_name}
* {userName}
*/
//step.1 获取数据权限SQL片段
String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
MiniDaoPage<JeecgDemoEntity> list = jeecgMinidaoDao.getAllEntities(jeecgDemo, dataGrid.getPage(), dataGrid.getRows(),authSql);
//设置排序字段
//step.2 将权限SQL片段注入到业务SQL中
MiniDaoPage<JeecgDemoEntity> list = jeecgMinidaoDao.getAllEntities(jeecgDemo, dataGrid.getPage(), dataGrid.getRows(),dataGrid.getSort(),dataGrid.getOrder(),authSql);
dataGrid.setTotal(list.getTotal());
dataGrid.setResults(list.getResults());
//step.3 合计,格式为 字段名:值(可选,不写该值时为分页数据的合计) 多个合计 以 , 分割
String total_salary = String.valueOf(jeecgMinidaoDao.getSumSalary());
/*
* :() ,
*/
dataGrid.setFooter("salary:"+(total_salary.equalsIgnoreCase("null")?"0.0":total_salary)+",age,email:合计");
TagUtil.datagrid(response, dataGrid);
}
@ -344,9 +675,9 @@ public class JeecgListDemoController extends BaseController {
m.put("extField",this.jeecgMinidaoDao.getOrgCode(temp.getDepId()));
extMap.put(temp.getId(), m);
}
//dataGrid.setFooter("extField,salary,age,name:合计");
dataGrid.setFooter("salary,age,name:合计");
TagUtil.datagrid(response, dataGrid,extMap);
// dataGrid.setFooter("salary,age,name:合计");
dataGrid.setFooter("[{'salary':'','age':'','name':'合计'}]");
TagUtil.datagrid(response, dataGrid, extMap);
}
@RequestMapping(params = "addTab")
@ -368,6 +699,19 @@ public class JeecgListDemoController extends BaseController {
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "goBuilderDemo")
public ModelAndView goBuilderDemo( HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/superQueryDemo");
}
@RequestMapping(params = "doCheck")
@ResponseBody
public AjaxJson doCheck(String content,String id,String status) {
@ -555,7 +899,7 @@ public class JeecgListDemoController extends BaseController {
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","JeecgListDemoController");
req.setAttribute("controller_name","jeecgListDemoController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@ -656,6 +1000,7 @@ public class JeecgListDemoController extends BaseController {
jeecgDemoService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
message = "JeecgDemo例子: " + jeecgDemo.getName() + "更新失败!!";
e.printStackTrace();
}
} else {
@ -665,6 +1010,7 @@ public class JeecgListDemoController extends BaseController {
jeecgDemoService.save(jeecgDemo);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
message = "JeecgDemo例子: " + jeecgDemo.getName() + "添加失败!!";
e.printStackTrace();
}
@ -698,7 +1044,7 @@ public class JeecgListDemoController extends BaseController {
try {
cq.ge("operatetime", DateUtils.parseDate(operatetime_begin, "yyyy-MM-dd hh:mm:ss"));
} catch (ParseException e) {
logger.error(e);
logger.error(e.toString());
}
cq.add();
}
@ -706,7 +1052,7 @@ public class JeecgListDemoController extends BaseController {
try {
cq.le("operatetime", DateUtils.parseDate(operatetime_end, "yyyy-MM-dd hh:mm:ss"));
} catch (ParseException e) {
logger.error(e);
logger.error(e.toString());
}
cq.add();
}
@ -734,6 +1080,7 @@ public class JeecgListDemoController extends BaseController {
req.setAttribute("logs",arr);
return new ModelAndView("com/jeecg/demo/logrp-chart");
}
/**
*
* @param request
@ -759,7 +1106,7 @@ public class JeecgListDemoController extends BaseController {
}
/**
*
* springjdbc demo
* @param request
* @return
* 201769--4:33:43
@ -781,4 +1128,303 @@ public class JeecgListDemoController extends BaseController {
j.setMsg(message);
return j;
}
@RequestMapping(params = "echartDemo")
public ModelAndView echartDemo(HttpServletRequest req) {
return new ModelAndView("com/jeecg/demo/echartsDemo");
}
/**
* Angular jeecgDEMO
* @param pageNo
* @param pageSize
* @param entity
* @param request
* @param response
* @param dataGrid
* @return
*/
@RequestMapping(value="/list",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="jeecgDemo列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<Map<String,Object>> list(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize,JeecgDemoEntity entity,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_list);
if(interfaceRuleDto==null){
return Result.error("您没有该接口的权限!");
}
CriteriaQuery query = new CriteriaQuery(JeecgDemoEntity.class, dataGrid);
InterfaceUtil.installCriteriaQuery(query, interfaceRuleDto, InterfaceEnum.jeecgdemo_list);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(query, entity, request.getParameterMap());
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize);
query.addOrder("createDate", SortDirection.desc);
query.add();
this.jeecgDemoService.getDataGridReturn(query, true);
Map<String,Object> resultMap=new HashMap<String, Object>();
resultMap.put("data", dataGrid.getResults());
resultMap.put("total", dataGrid.getTotal());
return Result.success(resultMap);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取jeecgDemo信息",notes="根据ID获取jeecgDemo信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id,HttpServletRequest request) {
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_get);
if(interfaceRuleDto==null){
return Result.error("您没有该接口的权限!");
}
JeecgDemoEntity task = this.jeecgDemoService.get(JeecgDemoEntity.class, id);
if (task == null) {
return Result.error("根据ID获取jeecgDemo信息为空");
}
return Result.success(task);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建jeecgDemo")
public ResponseMessage<?> create(@ApiParam(name="jeecgDemo对象")@RequestBody JeecgDemoEntity jeecgDemo, UriComponentsBuilder uriBuilder,HttpServletRequest request) {
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_add);
if(interfaceRuleDto==null){
return Result.error("您没有该接口的权限!");
}
logger.info("create[{}]" , GsonUtil.toJson(jeecgDemo));
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JeecgDemoEntity>> failures = validator.validate(jeecgDemo);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
jeecgDemo.setCreateDate(new Date());
this.jeecgDemoService.save(jeecgDemo);
} catch (Exception e) {
e.printStackTrace();
return Result.error("jeecgDemo信息保存失败");
}
return Result.success(jeecgDemo);
}
@RequestMapping(method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新jeecgDemo",notes="更新jeecgDemo")
public ResponseMessage<?> update(@RequestBody JeecgDemoEntity jeecgDemo,HttpServletRequest request) {
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_edit);
if(interfaceRuleDto==null){
return Result.error("您没有该接口的权限!");
}
logger.info("update[{}]" , GsonUtil.toJson(jeecgDemo));
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JeecgDemoEntity>> failures = validator.validate(jeecgDemo);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
this.jeecgDemoService.saveOrUpdate(jeecgDemo);
} catch (Exception e) {
e.printStackTrace();
return Result.error("更新jeecgDemo信息失败");
}
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return Result.success("更新jeecgDemo信息成功");
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(value="删除jeecgDemo")
@ResponseBody
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id,HttpServletRequest request) {
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_delete);
if(interfaceRuleDto==null){
return Result.error("您没有该接口的权限!");
}
logger.info("delete[{}]" , id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
this.jeecgDemoService.deleteEntityById(JeecgDemoEntity.class, id);
} catch (Exception e) {
e.printStackTrace();
return Result.error("jeecgDemo删除失败");
}
return Result.success();
}
/**
* jeecgDemo-bootstrap-list
* @param request
* @return
*/
@RequestMapping(params = "bootTableDemo")
public ModelAndView bootTableDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-list");
}
/**
* jeecgDemo-bootstrap
*
* @return
*/
@RequestMapping(params = "goBootStrapTableUpdate")
public ModelAndView goBootStrapTableUpdate(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-update");
}
/**
* jeecgDemo-bootstrap
*
* @return
*/
@RequestMapping(params = "goBootStrapTableAdd")
public ModelAndView goBootStrapTableAdd(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-add");
}
/**
* list
* @param request
* @return
*/
@RequestMapping(params = "natureAceTableDemo")
public ModelAndView natureAceTableDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemo-nature-ace-list");
}
/**
*
* @return
*/
@RequestMapping(params = "goNatureAceTableUpdate")
public ModelAndView goNatureAceTableUpdate(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-nature-ace-update");
}
/**
*
* @return
*/
@RequestMapping(params = "goNatureAceTableAdd")
public ModelAndView goNatureAceTableAdd(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-nature-ace-add");
}
/**
*
* @param request
* @return
*/
@RequestMapping(params = "bootstrapTableTagDemo")
public ModelAndView bootstrapTableTagDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-list-tag");
}
/**
* jeecgDemo-bootstrap-list-tag
* @param request
* @return
*/
@RequestMapping(params = "bootstrapTableTagDemo2")
public ModelAndView bootstrapTableTagDemo2(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-list-tag2");
}
/**
* jeecgDemo-bootstrap
*
* @return
*/
@RequestMapping(params = "goBootStrapTableUpdate2")
public ModelAndView goBootStrapTableUpdate2(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-update2");
}
/**
* jeecgDemo-bootstrap
*
* @return
*/
@RequestMapping(params = "goBootStrapTableAdd2")
public ModelAndView goBootStrapTableAdd2(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
req.setAttribute("jeecgDemoPage", jeecgDemo);
}
return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-add2");
}
/**
* Boostrap
* @param request
* @return
*/
@RequestMapping(params = "bootStrapEchartsDemo")
public ModelAndView bootStrapEchartsDemo(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/echartsDemo/bootstrap-echarts");
}
/**
*
* @return
*/
@RequestMapping(params = "collapseDemo")
public ModelAndView collapseDemo() {
return new ModelAndView("com/jeecg/demo/jeecgDemoList-collapse");
}
/**
* bootstrap-suggest-plugin demo
* @param request
* @return
*/
@RequestMapping(params = "suggest")
public ModelAndView suggest(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/suggest");
}
@RequestMapping(value = "loadSuggestData")
@ResponseBody
public Object loadSuggestData(String keyword,HttpServletRequest request) {
String sql = "select a.username,a.realname,IFNULL(c.departname,'火星人') as depart from t_s_base_user a left join t_s_user_org b on b.user_id = a.ID left join t_s_depart c on c.id = b.org_id "
+ "";//TODO keyword 没用到
JSONObject object = new JSONObject();
object.put("message", "");
try {
List<Map<String,Object>> data = this.systemService.findForJdbc(sql);
net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(data);
object.put("value", array);
object.put("code", 200);
} catch (Exception e) {
e.printStackTrace();
}
object.put("redirect", "");
return object;
}
}

@ -0,0 +1,466 @@
package com.jeecg.demo.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.entity.JformOrderCustomer2Entity;
import com.jeecg.demo.page.JformOrderMain2Page;
import com.jeecg.demo.service.JformOrderMain2ServiceI;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2018-03-27 17:02:39
* @version V1.0
*
*/
@Controller
@RequestMapping("/jformOrderCustomer2Controller")
@Api(value="JformOrderCustomer2",description="订单客户信息",tags="jformOrderCustomer2Controller")
public class JformOrderCustomer2Controller extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(JformOrderCustomer2Controller.class);
@Autowired
private JformOrderMain2ServiceI jformOrderMain2Service;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderCustomer2/list");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JformOrderCustomer2Entity jformOrderCustomer2,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JformOrderCustomer2Entity.class, dataGrid);
String mainId = request.getParameter("mainId");
if(oConvertUtils.isNotEmpty(mainId)){
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderCustomer2, request.getParameterMap());
try{
//自定义追加查询条件
cq.eq("fkId", mainId);
String query_money_begin = request.getParameter("money_begin");
String query_money_end = request.getParameter("money_end");
if(StringUtil.isNotEmpty(query_money_begin)){
cq.ge("money", Double.parseDouble(query_money_begin));
}
if(StringUtil.isNotEmpty(query_money_end)){
cq.le("money", Double.parseDouble(query_money_end));
}
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.jformOrderMain2Service.getDataGridReturn(cq, true);
}
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JformOrderCustomer2Entity jformOrderCustomer2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
jformOrderCustomer2 = systemService.getEntity(JformOrderCustomer2Entity.class, jformOrderCustomer2.getId());
message = "订单客户信息删除成功";
try{
if(jformOrderCustomer2!=null){
jformOrderMain2Service.delete(jformOrderCustomer2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "订单客户信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "订单客户信息删除成功";
try{
for(String id:ids.split(",")){
JformOrderCustomer2Entity jformOrderCustomer2 = systemService.getEntity(JformOrderCustomer2Entity.class,
id
);
if(jformOrderCustomer2!=null){
jformOrderMain2Service.delete(jformOrderCustomer2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}
}catch(Exception e){
e.printStackTrace();
message = "订单客户信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JformOrderCustomer2Entity jformOrderCustomer2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "订单客户信息添加成功";
try{
jformOrderMain2Service.save(jformOrderCustomer2);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单客户信息添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JformOrderCustomer2Entity jformOrderCustomer2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "订单客户信息更新成功";
JformOrderCustomer2Entity t = jformOrderMain2Service.get(JformOrderCustomer2Entity.class, jformOrderCustomer2.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(jformOrderCustomer2, t);
jformOrderMain2Service.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "订单客户信息更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(JformOrderCustomer2Entity jformOrderCustomer2, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderCustomer2.getId())) {
jformOrderCustomer2 = jformOrderMain2Service.getEntity(JformOrderCustomer2Entity.class, jformOrderCustomer2.getId());
req.setAttribute("jformOrderCustomer2Page", jformOrderCustomer2);
}
req.setAttribute("mainId", req.getParameter("mainId"));
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderCustomer2/add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(JformOrderCustomer2Entity jformOrderCustomer2, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderCustomer2.getId())) {
jformOrderCustomer2 = jformOrderMain2Service.getEntity(JformOrderCustomer2Entity.class, jformOrderCustomer2.getId());
req.setAttribute("jformOrderCustomer2Page", jformOrderCustomer2);
}
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderCustomer2/update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","jformOrderCustomer2Controller");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JformOrderCustomer2Entity jformOrderCustomer2,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(JformOrderCustomer2Entity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderCustomer2, request.getParameterMap());
List<JformOrderCustomer2Entity> jformOrderCustomer2s = this.jformOrderMain2Service.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"订单客户信息");
modelMap.put(NormalExcelConstants.CLASS,JformOrderCustomer2Entity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("订单客户信息列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,jformOrderCustomer2s);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(JformOrderCustomer2Entity jformOrderCustomer2,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"订单客户信息");
modelMap.put(NormalExcelConstants.CLASS,JformOrderCustomer2Entity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("订单客户信息列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<JformOrderCustomer2Entity> listJformOrderCustomer2Entitys = ExcelImportUtil.importExcel(file.getInputStream(),JformOrderCustomer2Entity.class,params);
for (JformOrderCustomer2Entity jformOrderCustomer2 : listJformOrderCustomer2Entitys) {
jformOrderMain2Service.save(jformOrderCustomer2);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
*
* @param page
* @param req
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(JformOrderMain2Page page,HttpServletRequest req){
String message = "操作成功!";
List<JformOrderCustomer2Entity> lists=page.getJformOrderCustomer2List();
AjaxJson j = new AjaxJson();
String mainId = req.getParameter("mainId");
if(CollectionUtils.isNotEmpty(lists)){
for(JformOrderCustomer2Entity temp:lists){
if (StringUtil.isNotEmpty(temp.getId())) {
JformOrderCustomer2Entity t =this.systemService.get(JformOrderCustomer2Entity.class, temp.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(temp, t);
systemService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
//temp.setDelFlag(0);若有则需要加
temp.setFkId(mainId);
systemService.save(temp);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="订单客户信息列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<JformOrderCustomer2Entity>> list() {
List<JformOrderCustomer2Entity> listJformOrderCustomer2s=jformOrderMain2Service.getList(JformOrderCustomer2Entity.class);
return Result.success(listJformOrderCustomer2s);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取订单客户信息信息",notes="根据ID获取订单客户信息信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
JformOrderCustomer2Entity task = jformOrderMain2Service.get(JformOrderCustomer2Entity.class, id);
if (task == null) {
return Result.error("根据ID获取订单客户信息信息为空");
}
return Result.success(task);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建订单客户信息")
public ResponseMessage<?> create(@ApiParam(name="订单客户信息对象")@RequestBody JformOrderCustomer2Entity jformOrderCustomer2, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderCustomer2Entity>> failures = validator.validate(jformOrderCustomer2);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
jformOrderMain2Service.save(jformOrderCustomer2);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单客户信息信息保存失败");
}
return Result.success(jformOrderCustomer2);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新订单客户信息",notes="更新订单客户信息")
public ResponseMessage<?> update(@ApiParam(name="订单客户信息对象")@RequestBody JformOrderCustomer2Entity jformOrderCustomer2) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderCustomer2Entity>> failures = validator.validate(jformOrderCustomer2);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
jformOrderMain2Service.saveOrUpdate(jformOrderCustomer2);
} catch (Exception e) {
e.printStackTrace();
return Result.error("更新订单客户信息信息失败");
}
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return Result.success("更新订单客户信息信息成功");
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除订单客户信息")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" , id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
jformOrderMain2Service.deleteEntityById(JformOrderCustomer2Entity.class, id);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单客户信息删除失败");
}
return Result.success();
}
}

@ -0,0 +1,584 @@
package com.jeecg.demo.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.Restrictions;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.superquery.util.SuperQueryUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.entity.JformOrderCustomer2Entity;
import com.jeecg.demo.entity.JformOrderMain2Entity;
import com.jeecg.demo.entity.JformOrderTicket2Entity;
import com.jeecg.demo.page.JformOrderMain2Page;
import com.jeecg.demo.service.JformOrderMain2ServiceI;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2018-03-27 16:21:58
* @version V1.0
*
*/
@Api(value="JformOrderMain2",description="订单主信息",tags="jformOrderMain2Controller")
@Controller
@RequestMapping("/jformOrderMain2Controller")
public class JformOrderMain2Controller extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(JformOrderMain2Controller.class);
@Autowired
private JformOrderMain2ServiceI jformOrderMain2Service;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
* @return
*/
@RequestMapping(params = "index")
public ModelAndView index(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderMain2Index");
}
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/list");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JformOrderMain2Entity jformOrderMain2,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JformOrderMain2Entity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderMain2);
try{
//自定义追加查询条件
String sql = SuperQueryUtil.getComplxSuperQuerySQL(request);
if(oConvertUtils.isNotEmpty(sql)) {
cq.add(Restrictions.sqlRestriction(" id in ("+sql+")"));
}
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.jformOrderMain2Service.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JformOrderMain2Entity jformOrderMain2, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
jformOrderMain2 = systemService.getEntity(JformOrderMain2Entity.class, jformOrderMain2.getId());
String message = "订单主信息删除成功";
try{
if(jformOrderMain2!=null){
jformOrderMain2Service.delMain(jformOrderMain2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "订单主信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
AjaxJson j = new AjaxJson();
String message = "订单主信息删除成功";
try{
for(String id:ids.split(",")){
JformOrderMain2Entity jformOrderMain2 = systemService.getEntity(JformOrderMain2Entity.class,
id
);
if(jformOrderMain2!=null){
jformOrderMain2Service.delMain(jformOrderMain2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}
}catch(Exception e){
e.printStackTrace();
message = "订单主信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JformOrderMain2Entity jformOrderMain2,JformOrderMain2Page jformOrderMain2Page, HttpServletRequest request) {
List<JformOrderTicket2Entity> jformOrderTicket2List = jformOrderMain2Page.getJformOrderTicket2List();
List<JformOrderCustomer2Entity> jformOrderCustomer2List = jformOrderMain2Page.getJformOrderCustomer2List();
AjaxJson j = new AjaxJson();
String message = "添加成功";
try{
jformOrderMain2Service.addMain(jformOrderMain2, jformOrderTicket2List,jformOrderCustomer2List);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单主信息添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JformOrderMain2Entity jformOrderMain2,JformOrderMain2Page jformOrderMain2Page, HttpServletRequest request) {
List<JformOrderTicket2Entity> jformOrderTicket2List = jformOrderMain2Page.getJformOrderTicket2List();
List<JformOrderCustomer2Entity> jformOrderCustomer2List = jformOrderMain2Page.getJformOrderCustomer2List();
AjaxJson j = new AjaxJson();
String message = "更新成功";
try{
jformOrderMain2Service.updateMain(jformOrderMain2, jformOrderTicket2List,jformOrderCustomer2List);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "更新订单主信息失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(HttpServletRequest req) {
//跳转主页面
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/addOrUpdate");
}
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(HttpServletRequest req) {
//跳转主页面
String id = req.getParameter("id");
req.setAttribute("mainId",id);
req.setAttribute("load", req.getParameter("load"));
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/addOrUpdate");
}
/**
*
*
* @return
*/
@RequestMapping(params = "mainPage")
public ModelAndView mainPage(JformOrderMain2Entity jformOrderMain2, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderMain2.getId())) {
jformOrderMain2 = jformOrderMain2Service.getEntity(JformOrderMain2Entity.class, jformOrderMain2.getId());
req.setAttribute("jformOrderMain2Page", jformOrderMain2);
}
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/jformOrderMain2");
}
/**
* []
*
* @return
*/
@RequestMapping(params = "jformOrderTicket2List")
public ModelAndView jformOrderTicket2List(JformOrderMain2Entity jformOrderMain2, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id0 = jformOrderMain2.getId();
//===================================================================================
//查询-订单机票信息
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
try{
List<JformOrderTicket2Entity> jformOrderTicket2EntityList = systemService.findHql(hql0,id0);
req.setAttribute("jformOrderTicket2List", jformOrderTicket2EntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/jformOrderTicket2");
}
/**
* []
*
* @return
*/
@RequestMapping(params = "jformOrderCustomer2List")
public ModelAndView jformOrderCustomer2List(JformOrderMain2Entity jformOrderMain2, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id1 = jformOrderMain2.getId();
//===================================================================================
//查询-订单客户信息
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
try{
List<JformOrderCustomer2Entity> jformOrderCustomer2EntityList = systemService.findHql(hql1,id1);
req.setAttribute("jformOrderCustomer2List", jformOrderCustomer2EntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/demo/jformOrderMain2/main/jformOrderCustomer2");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JformOrderMain2Entity jformOrderMain2,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
CriteriaQuery cq = new CriteriaQuery(JformOrderMain2Entity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderMain2);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
List<JformOrderMain2Entity> list=this.jformOrderMain2Service.getListByCriteriaQuery(cq, false);
List<JformOrderMain2Page> pageList=new ArrayList<JformOrderMain2Page>();
if(list!=null&&list.size()>0){
for(JformOrderMain2Entity entity:list){
try{
JformOrderMain2Page page=new JformOrderMain2Page();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicket2Entity> jformOrderTicket2EntityList = systemService.findHql(hql0,id0);
page.setJformOrderTicket2List(jformOrderTicket2EntityList);
Object id1 = entity.getId();
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomer2Entity> jformOrderCustomer2EntityList = systemService.findHql(hql1,id1);
page.setJformOrderCustomer2List(jformOrderCustomer2EntityList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
map.put(NormalExcelConstants.FILE_NAME,"订单主信息");
map.put(NormalExcelConstants.CLASS,JformOrderMain2Page.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单主信息列表", "导出人:Jeecg",
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,pageList);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel
* @param request
* @param
* @return
*/
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(2);
params.setNeedSave(true);
try {
List<JformOrderMain2Page> list = ExcelImportUtil.importExcel(file.getInputStream(), JformOrderMain2Page.class, params);
JformOrderMain2Entity entity1=null;
for (JformOrderMain2Page page : list) {
entity1=new JformOrderMain2Entity();
MyBeanUtils.copyBeanNotNull2Bean(page,entity1);
jformOrderMain2Service.addMain(entity1, page.getJformOrderTicket2List(),page.getJformOrderCustomer2List());
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
* excel 使
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(ModelMap map) {
map.put(NormalExcelConstants.FILE_NAME,"订单主信息");
map.put(NormalExcelConstants.CLASS,JformOrderMain2Page.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单主信息列表", "导出人:"+ ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name", "jformOrderMain2Controller");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
*
* @param page
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(JformOrderMain2Page page,HttpServletRequest req){
String message = "操作成功!";
List<JformOrderMain2Entity> lists=page.getJformOrderMain2List();
AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(lists)){
for(JformOrderMain2Entity temp:lists){
if (StringUtil.isNotEmpty(temp.getId())) {
JformOrderMain2Entity t =this.systemService.get(JformOrderMain2Entity.class, temp.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(temp, t);
systemService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
//temp.setDelFlag(0);若有则需要加
systemService.save(temp);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="订单主信息列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<JformOrderMain2Page>> list() {
List<JformOrderMain2Entity> list= jformOrderMain2Service.getList(JformOrderMain2Entity.class);
List<JformOrderMain2Page> pageList=new ArrayList<JformOrderMain2Page>();
if(list!=null&&list.size()>0){
for(JformOrderMain2Entity entity:list){
try{
JformOrderMain2Page page=new JformOrderMain2Page();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
Object id1 = entity.getId();
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicket2Entity> jformOrderTicket2OldList = this.jformOrderMain2Service.findHql(hql0,id0);
page.setJformOrderTicket2List(jformOrderTicket2OldList);
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomer2Entity> jformOrderCustomer2OldList = this.jformOrderMain2Service.findHql(hql1,id1);
page.setJformOrderCustomer2List(jformOrderCustomer2OldList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
return Result.success(pageList);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取订单主信息信息",notes="根据ID获取订单主信息信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
JformOrderMain2Entity task = jformOrderMain2Service.get(JformOrderMain2Entity.class, id);
if (task == null) {
return Result.error("根据ID获取订单主信息信息为空");
}
JformOrderMain2Page page = new JformOrderMain2Page();
try {
MyBeanUtils.copyBeanNotNull2Bean(task, page);
Object id0 = task.getId();
Object id1 = task.getId();
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicket2Entity> jformOrderTicket2OldList = this.jformOrderMain2Service.findHql(hql0,id0);
page.setJformOrderTicket2List(jformOrderTicket2OldList);
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomer2Entity> jformOrderCustomer2OldList = this.jformOrderMain2Service.findHql(hql1,id1);
page.setJformOrderCustomer2List(jformOrderCustomer2OldList);
} catch (Exception e) {
e.printStackTrace();
}
return Result.success(page);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建订单主信息")
public ResponseMessage<?> create(@ApiParam(name="订单主信息对象")@RequestBody JformOrderMain2Page jformOrderMain2Page, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderMain2Page>> failures = validator.validate(jformOrderMain2Page);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<JformOrderTicket2Entity> jformOrderTicket2List = jformOrderMain2Page.getJformOrderTicket2List();
List<JformOrderCustomer2Entity> jformOrderCustomer2List = jformOrderMain2Page.getJformOrderCustomer2List();
JformOrderMain2Entity jformOrderMain2 = new JformOrderMain2Entity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMain2Page,jformOrderMain2);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("保存订单主信息失败");
}
jformOrderMain2Service.addMain(jformOrderMain2, jformOrderTicket2List,jformOrderCustomer2List);
return Result.success(jformOrderMain2);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新订单主信息",notes="更新订单主信息")
public ResponseMessage<?> update(@RequestBody JformOrderMain2Page jformOrderMain2Page) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderMain2Page>> failures = validator.validate(jformOrderMain2Page);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<JformOrderTicket2Entity> jformOrderTicket2List = jformOrderMain2Page.getJformOrderTicket2List();
List<JformOrderCustomer2Entity> jformOrderCustomer2List = jformOrderMain2Page.getJformOrderCustomer2List();
JformOrderMain2Entity jformOrderMain2 = new JformOrderMain2Entity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMain2Page,jformOrderMain2);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("订单主信息更新失败");
}
jformOrderMain2Service.updateMain(jformOrderMain2, jformOrderTicket2List,jformOrderCustomer2List);
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return Result.success();
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除订单主信息")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" , id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
JformOrderMain2Entity jformOrderMain2 = jformOrderMain2Service.get(JformOrderMain2Entity.class, id);
jformOrderMain2Service.delMain(jformOrderMain2);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单主信息删除失败");
}
return Result.success();
}
}

@ -0,0 +1,769 @@
package com.jeecg.demo.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ReflectHelper;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONObject;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
import com.jeecg.demo.entity.JformOrderMainEntity;
import com.jeecg.demo.entity.JformOrderTicketEntity;
import com.jeecg.demo.page.JformOrderCustomerPage;
import com.jeecg.demo.page.JformOrderMainPage;
import com.jeecg.demo.service.JformOrderMainServiceI;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2017-09-17 11:49:08
* @version V1.0
*
*/
@Controller
@RequestMapping("/jformOrderMainController")
@Api(value="orderMainRest",description="一对多订单管理",tags="JformOrderMainController")
public class JformOrderMainController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(JformOrderMainController.class);
@Autowired
private JformOrderMainServiceI jformOrderMainService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
@Autowired
private CgFormFieldServiceI cgFormFieldService;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderMainList");
}
/**
*
*
* @return
*/
@RequestMapping(params = "mainlist")
public ModelAndView mainlist(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderMainListBase");
}
/**
*
*
* @return
*/
@RequestMapping(params = "customerlist")
public ModelAndView customerlist(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderCustomerListBase");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JformOrderMainEntity jformOrderMain,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JformOrderMainEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderMain);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.jformOrderMainService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "customerDatagrid")
public void customerDatagrid(JformOrderCustomerEntity jformCustomer,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JformOrderCustomerEntity.class, dataGrid);
if(jformCustomer.getFkId() == null || "".equals(jformCustomer.getFkId())){
}else{
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformCustomer);
cq.add();
this.jformOrderMainService.getDataGridReturn(cq, true);
}
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JformOrderMainEntity jformOrderMain, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
jformOrderMain = systemService.getEntity(JformOrderMainEntity.class, jformOrderMain.getId());
String message = "订单主信息删除成功";
try{
jformOrderMainService.delMain(jformOrderMain);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单主信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
AjaxJson j = new AjaxJson();
String message = "订单主信息删除成功";
try{
for(String id:ids.split(",")){
JformOrderMainEntity jformOrderMain = systemService.getEntity(JformOrderMainEntity.class,
id
);
jformOrderMainService.delMain(jformOrderMain);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "订单主信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JformOrderMainEntity jformOrderMain,JformOrderMainPage jformOrderMainPage, HttpServletRequest request) {
List<JformOrderCustomerEntity> jformOrderCustomerList = jformOrderMainPage.getJformOrderCustomerList();
List<JformOrderTicketEntity> jformOrderTicketList = jformOrderMainPage.getJformOrderTicketList();
AjaxJson j = new AjaxJson();
String message = "添加成功";
try{
jformOrderMainService.addMain(jformOrderMain, jformOrderCustomerList,jformOrderTicketList);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单主信息添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
j.setObj(jformOrderMain);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JformOrderMainEntity jformOrderMain,JformOrderMainPage jformOrderMainPage, HttpServletRequest request) {
List<JformOrderCustomerEntity> jformOrderCustomerList = jformOrderMainPage.getJformOrderCustomerList();
List<JformOrderTicketEntity> jformOrderTicketList = jformOrderMainPage.getJformOrderTicketList();
AjaxJson j = new AjaxJson();
String message = "更新成功";
try{
jformOrderMainService.updateMain(jformOrderMain, jformOrderCustomerList,jformOrderTicketList);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "更新订单主信息失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(JformOrderMainEntity jformOrderMain, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderMain.getId())) {
jformOrderMain = jformOrderMainService.getEntity(JformOrderMainEntity.class, jformOrderMain.getId());
req.setAttribute("jformOrderMainPage", jformOrderMain);
}
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderMain-add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(JformOrderMainEntity jformOrderMain, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderMain.getId())) {
jformOrderMain = jformOrderMainService.getEntity(JformOrderMainEntity.class, jformOrderMain.getId());
req.setAttribute("jformOrderMainPage", jformOrderMain);
}
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderMain-update");
}
/**
* [JformOrderMain]
*
* @return
*/
@RequestMapping(params = "jformOrderCustomerList")
public ModelAndView jformOrderCustomerList(JformOrderMainEntity jformOrderMain, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id0 = jformOrderMain.getId();
//===================================================================================
//查询-JformOrderMain子表
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
try{
List<JformOrderCustomerEntity> jformOrderCustomerEntityList = systemService.findHql(hql0,id0);
req.setAttribute("jformOrderCustomerList", jformOrderCustomerEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderCustomerList");
}
/**
* [JformOrderMain]
*
* @return
*/
@RequestMapping(params = "jformOrderTicketList")
public ModelAndView jformOrderTicketList(JformOrderMainEntity jformOrderMain, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id1 = jformOrderMain.getId();
//===================================================================================
//查询-JformOrderMain子表
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
try{
List<JformOrderTicketEntity> jformOrderTicketEntityList = systemService.findHql(hql1,id1);
req.setAttribute("jformOrderTicketList", jformOrderTicketEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/demo/orderOne2Many/jformOrderTicketList");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JformOrderMainEntity jformOrderMain,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
CriteriaQuery cq = new CriteriaQuery(JformOrderMainEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderMain);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
List<JformOrderMainEntity> list=this.jformOrderMainService.getListByCriteriaQuery(cq, false);
List<JformOrderMainPage> pageList=new ArrayList<JformOrderMainPage>();
if(list!=null&&list.size()>0){
for(JformOrderMainEntity entity:list){
try{
JformOrderMainPage page=new JformOrderMainPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerEntityList = systemService.findHql(hql0,id0);
page.setJformOrderCustomerList(jformOrderCustomerEntityList);
Object id1 = entity.getId();
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicketEntity> jformOrderTicketEntityList = systemService.findHql(hql1,id1);
page.setJformOrderTicketList(jformOrderTicketEntityList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
map.put(NormalExcelConstants.FILE_NAME,"订单主信息");
map.put(NormalExcelConstants.CLASS,JformOrderMainPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单主信息列表", "导出人:Jeecg",
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,pageList);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel
* @param request
* @param
* @return
*/
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(2);
params.setNeedSave(true);
try {
List<JformOrderMainPage> list = ExcelImportUtil.importExcel(file.getInputStream(), JformOrderMainPage.class, params);
JformOrderMainEntity entity1=null;
for (JformOrderMainPage page : list) {
entity1=new JformOrderMainEntity();
MyBeanUtils.copyBeanNotNull2Bean(page,entity1);
jformOrderMainService.addMain(entity1, page.getJformOrderCustomerList(),page.getJformOrderTicketList());
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
* excel 使
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(ModelMap map) {
map.put(NormalExcelConstants.FILE_NAME,"订单主信息");
map.put(NormalExcelConstants.CLASS,JformOrderMainPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单主信息列表", "导出人:"+ ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name", "jformOrderMainController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="订单列表信息",produces="application/json",httpMethod="GET")
public List<JformOrderMainPage> list() {
List<JformOrderMainEntity> list= jformOrderMainService.getList(JformOrderMainEntity.class);
List<JformOrderMainPage> pageList=new ArrayList<JformOrderMainPage>();
if(list!=null&&list.size()>0){
for(JformOrderMainEntity entity:list){
try{
JformOrderMainPage page=new JformOrderMainPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
Object id1 = entity.getId();
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerOldList = this.jformOrderMainService.findHql(hql0,id0);
page.setJformOrderCustomerList(jformOrderCustomerOldList);
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicketEntity> jformOrderTicketOldList = this.jformOrderMainService.findHql(hql1,id1);
page.setJformOrderTicketList(jformOrderTicketOldList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
return pageList;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取订单信息",notes="根据ID获取订单信息",httpMethod="GET",produces="application/json")
public ResponseEntity<?> get(@PathVariable("id") String id) {
JformOrderMainEntity task = jformOrderMainService.get(JformOrderMainEntity.class, id);
if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
JformOrderMainPage page = new JformOrderMainPage();
try {
MyBeanUtils.copyBeanNotNull2Bean(task, page);
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerOldList = this.jformOrderMainService.findHql(hql0,id);
page.setJformOrderCustomerList(jformOrderCustomerOldList);
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicketEntity> jformOrderTicketOldList = this.jformOrderMainService.findHql(hql1,id);
page.setJformOrderTicketList(jformOrderTicketOldList);
} catch (Exception e) {
e.printStackTrace();
}
return new ResponseEntity(page, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建订单")
public ResponseEntity<?> create(@ApiParam(value="订单信息")@RequestBody JformOrderMainPage jformOrderMainPage, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderMainPage>> failures = validator.validate(jformOrderMainPage);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
List<JformOrderCustomerEntity> jformOrderCustomerList = jformOrderMainPage.getJformOrderCustomerList();
List<JformOrderTicketEntity> jformOrderTicketList = jformOrderMainPage.getJformOrderTicketList();
JformOrderMainEntity jformOrderMain = new JformOrderMainEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMainPage,jformOrderMain);
}catch(Exception e){
logger.info(e.getMessage());
}
jformOrderMainService.addMain(jformOrderMain, jformOrderCustomerList,jformOrderTicketList);
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = jformOrderMainPage.getId();
URI uri = uriBuilder.path("/rest/jformOrderMainController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);
return new ResponseEntity(headers, HttpStatus.CREATED);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新订单",notes="更新订单")
public ResponseEntity<?> update(@ApiParam(value="订单信息")@RequestBody JformOrderMainPage jformOrderMainPage) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderMainPage>> failures = validator.validate(jformOrderMainPage);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
List<JformOrderCustomerEntity> jformOrderCustomerList = jformOrderMainPage.getJformOrderCustomerList();
List<JformOrderTicketEntity> jformOrderTicketList = jformOrderMainPage.getJformOrderTicketList();
JformOrderMainEntity jformOrderMain = new JformOrderMainEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMainPage,jformOrderMain);
}catch(Exception e){
logger.info(e.getMessage());
}
jformOrderMainService.updateMain(jformOrderMain, jformOrderCustomerList,jformOrderTicketList);
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除订单")
public void delete(@PathVariable("id") String id) {
JformOrderMainEntity jformOrderMain = jformOrderMainService.get(JformOrderMainEntity.class, id);
jformOrderMainService.delMain(jformOrderMain);
}
/**
*
*
* @param id jformOrderMainid
*/
@RequestMapping(params = "getFiles")
@ResponseBody
public AjaxJson getFiles(String id){
List<CgUploadEntity> uploadBeans = cgFormFieldService.findByProperty(CgUploadEntity.class, "cgformId", id);
List<Map<String,Object>> files = new ArrayList<Map<String,Object>>(0);
for(CgUploadEntity b:uploadBeans){
String title = b.getAttachmenttitle();//附件名
String fileKey = b.getId();//附件主键
String path = b.getRealpath();//附件路径
String field = b.getCgformField();//表单中作为附件控件的字段
Map<String, Object> file = new HashMap<String, Object>();
file.put("title", title);
file.put("fileKey", fileKey);
file.put("path", path);
file.put("field", field==null?"":field);
files.add(file);
}
AjaxJson j = new AjaxJson();
j.setObj(files);
return j;
}
/**
*
* @param page
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(JformOrderCustomerPage page){
String message = "操作成功!";
List<JformOrderCustomerEntity> demos=page.getDemos();
AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(demos)){
for(JformOrderCustomerEntity jeecgDemo:demos){
if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
JformOrderCustomerEntity t =this.systemService.get(JformOrderCustomerEntity.class, jeecgDemo.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t);
systemService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
//jeecgDemo.setStatus("0");
systemService.save(jeecgDemo);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return j;
}
/**
*
* @param req
* @return
*/
@RequestMapping(params = "departSelect")
public String departSelect(HttpServletRequest req) {
req.setAttribute("defaultName", req.getParameter("name"));
return "com/jeecg/demo/orderOne2Many/departSelect";
}
/**
*
* @param request
* @param response
* @return
*/
@RequestMapping(params = "getDepartInfo3")
@ResponseBody
public AjaxJson getDepartInfo3(HttpServletRequest request, HttpServletResponse response){
AjaxJson j = new AjaxJson();
net.sf.json.JSONArray jsonArray = new net.sf.json.JSONArray();
//String parentid = request.getParameter("parentid");
String sql = "select id,departname as name,ifnull(parentdepartid,0) as ppp_id,org_code as code from t_s_depart where 1=1 ";
List<Map<String,Object>> dateList = this.systemService.findForJdbc(sql);
Map<String,Map<String,Object>> dataMap = new HashMap<String,Map<String,Object>>();
//TODO 不应该每次都需要查询 建议从缓存中取到所有的list
String name = request.getParameter("name");
if(oConvertUtils.isNotEmpty(name)){
for (Map<String, Object> map : dateList) {
String temp = map.get("name").toString();
String id = map.get("id").toString();
if(temp.indexOf(name)>=0){
Object pid = map.get("ppp_id");
if(temp.equals(name)){
map.put("checked", true);
}
//判断是否有子节点 可用isleaf判断
sql = "select count(1) from t_s_depart t where t.parentdepartid = ?";
long count = this.systemService.getCountForJdbcParam(sql, new Object[]{id});
if(count>0){
map.put("isParent",true);
}
dataMap.put(id, map);
upwardQueryParents(dataMap, dateList, pid==null?"":pid.toString());
}
}
jsonArray = net.sf.json.JSONArray.fromObject(dataMap.values());
}else{
jsonArray = net.sf.json.JSONArray.fromObject(dateList);
}
j.setMsg(jsonArray.toString().replace("ppp_id", "pId"));
return j;
}
/**
*
* @param request
* @param response
* @return
*/
@RequestMapping(params = "getSubContent")
@ResponseBody
public AjaxJson getSubContent(HttpServletRequest request, HttpServletResponse response){
AjaxJson j = new AjaxJson();
String parentid = request.getParameter("parentid");
List<TSDepart> tSDeparts = new ArrayList<TSDepart>();
StringBuffer hql = new StringBuffer(" from TSDepart t where 1=1 ");
if(oConvertUtils.isNotEmpty(parentid)){
TSDepart dePart = this.systemService.getEntity(TSDepart.class, parentid);
hql.append(" and TSPDepart = ?");
tSDeparts = this.systemService.findHql(hql.toString(), dePart);
}
//TODO 不应该每次都需要查询 建议从缓存中取到所有的list 再筛选
List<Map<String,Object>> dateList = new ArrayList<Map<String,Object>>();
if(tSDeparts.size()>0){
Map<String,Object> map = null;
String sql = null;
Object[] params = null;
for(TSDepart depart:tSDeparts){
map = new HashMap<String,Object>();
map.put("id", depart.getId());
map.put("name", depart.getDepartname());
map.put("code",depart.getOrgCode());
TSDepart pdepart = depart.getTSPDepart();
if(pdepart!=null){
map.put("pId", pdepart.getId());
} else{
map.put("pId", "0");
}
//根据id判断是否有子节点
sql = "select count(1) from t_s_depart t where t.parentdepartid = ?";
params = new Object[]{depart.getId()};
long count = this.systemService.getCountForJdbcParam(sql, params);
if(count>0){
map.put("isParent",true);
}
dateList.add(map);
}
}
net.sf.json.JSONArray jsonArray = net.sf.json.JSONArray.fromObject(dateList);
j.setMsg(jsonArray.toString());
return j;
}
/**
*
*/
private void upwardQueryParents(Map<String,Map<String,Object>> dataMap,List<Map<String,Object>> dateList,String pid){
String pid_next = null;
for (Map<String, Object> map : dateList) {
String id = map.get("id").toString();
if(pid.equals(id)){
pid_next = map.get("ppp_id").toString();
dataMap.put(id, map);
break;
}
}
if(pid_next!=null && !pid_next.equals("0")){
upwardQueryParents(dataMap, dateList, pid_next);
}
}
}

@ -0,0 +1,458 @@
package com.jeecg.demo.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.entity.JformOrderTicket2Entity;
import com.jeecg.demo.page.JformOrderMain2Page;
import com.jeecg.demo.service.JformOrderMain2ServiceI;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2018-03-27 17:03:29
* @version V1.0
*
*/
@Controller
@RequestMapping("/jformOrderTicket2Controller")
@Api(value="JformOrderTicket2",description="订单机票信息",tags="jformOrderTicket2Controller")
public class JformOrderTicket2Controller extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(JformOrderTicket2Controller.class);
@Autowired
private JformOrderMain2ServiceI jformOrderMain2Service;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderTicket2/list");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JformOrderTicket2Entity jformOrderTicket2,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JformOrderTicket2Entity.class, dataGrid);
String mainId = request.getParameter("mainId");
if(oConvertUtils.isNotEmpty(mainId)){
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderTicket2, request.getParameterMap());
try{
//自定义追加查询条件
cq.eq("fckId", mainId);
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.jformOrderMain2Service.getDataGridReturn(cq, true);
}
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JformOrderTicket2Entity jformOrderTicket2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
jformOrderTicket2 = systemService.getEntity(JformOrderTicket2Entity.class, jformOrderTicket2.getId());
message = "订单机票信息删除成功";
try{
if(jformOrderTicket2!=null){
jformOrderMain2Service.delete(jformOrderTicket2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "订单机票信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "订单机票信息删除成功";
try{
for(String id:ids.split(",")){
JformOrderTicket2Entity jformOrderTicket2 = systemService.getEntity(JformOrderTicket2Entity.class,
id
);
if(jformOrderTicket2!=null){
jformOrderMain2Service.delete(jformOrderTicket2);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}
}catch(Exception e){
e.printStackTrace();
message = "订单机票信息删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JformOrderTicket2Entity jformOrderTicket2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "订单机票信息添加成功";
try{
jformOrderMain2Service.save(jformOrderTicket2);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单机票信息添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JformOrderTicket2Entity jformOrderTicket2, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "订单机票信息更新成功";
JformOrderTicket2Entity t = jformOrderMain2Service.get(JformOrderTicket2Entity.class, jformOrderTicket2.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(jformOrderTicket2, t);
jformOrderMain2Service.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "订单机票信息更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(JformOrderTicket2Entity jformOrderTicket2, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderTicket2.getId())) {
jformOrderTicket2 = jformOrderMain2Service.getEntity(JformOrderTicket2Entity.class, jformOrderTicket2.getId());
req.setAttribute("jformOrderTicket2Page", jformOrderTicket2);
}
req.setAttribute("mainId", req.getParameter("mainId"));
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderTicket2/add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(JformOrderTicket2Entity jformOrderTicket2, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jformOrderTicket2.getId())) {
jformOrderTicket2 = jformOrderMain2Service.getEntity(JformOrderTicket2Entity.class, jformOrderTicket2.getId());
req.setAttribute("jformOrderTicket2Page", jformOrderTicket2);
}
return new ModelAndView("com/jeecg/demo/jformOrderMain2/jformOrderTicket2/update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","jformOrderTicket2Controller");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JformOrderTicket2Entity jformOrderTicket2,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(JformOrderTicket2Entity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderTicket2, request.getParameterMap());
List<JformOrderTicket2Entity> jformOrderTicket2s = this.jformOrderMain2Service.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"订单机票信息");
modelMap.put(NormalExcelConstants.CLASS,JformOrderTicket2Entity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("订单机票信息列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,jformOrderTicket2s);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(JformOrderTicket2Entity jformOrderTicket2,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"订单机票信息");
modelMap.put(NormalExcelConstants.CLASS,JformOrderTicket2Entity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("订单机票信息列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<JformOrderTicket2Entity> listJformOrderTicket2Entitys = ExcelImportUtil.importExcel(file.getInputStream(),JformOrderTicket2Entity.class,params);
for (JformOrderTicket2Entity jformOrderTicket2 : listJformOrderTicket2Entitys) {
jformOrderMain2Service.save(jformOrderTicket2);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
*
* @param page
* @param req
* @return
*/
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(JformOrderMain2Page page,HttpServletRequest req){
String message = "操作成功!";
List<JformOrderTicket2Entity> lists=page.getJformOrderTicket2List();
AjaxJson j = new AjaxJson();
String mainId = req.getParameter("mainId");
if(CollectionUtils.isNotEmpty(lists)){
for(JformOrderTicket2Entity temp:lists){
if (StringUtil.isNotEmpty(temp.getId())) {
JformOrderTicket2Entity t =this.systemService.get(JformOrderTicket2Entity.class, temp.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(temp, t);
systemService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
//temp.setDelFlag(0);若有则需要加
temp.setFckId(mainId);
systemService.save(temp);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="订单机票信息列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<JformOrderTicket2Entity>> list() {
List<JformOrderTicket2Entity> listJformOrderTicket2s=jformOrderMain2Service.getList(JformOrderTicket2Entity.class);
return Result.success(listJformOrderTicket2s);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取订单机票信息信息",notes="根据ID获取订单机票信息信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
JformOrderTicket2Entity task = jformOrderMain2Service.get(JformOrderTicket2Entity.class, id);
if (task == null) {
return Result.error("根据ID获取订单机票信息信息为空");
}
return Result.success(task);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建订单机票信息")
public ResponseMessage<?> create(@ApiParam(name="订单机票信息对象")@RequestBody JformOrderTicket2Entity jformOrderTicket2, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderTicket2Entity>> failures = validator.validate(jformOrderTicket2);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
jformOrderMain2Service.save(jformOrderTicket2);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单机票信息信息保存失败");
}
return Result.success(jformOrderTicket2);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新订单机票信息",notes="更新订单机票信息")
public ResponseMessage<?> update(@ApiParam(name="订单机票信息对象")@RequestBody JformOrderTicket2Entity jformOrderTicket2) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JformOrderTicket2Entity>> failures = validator.validate(jformOrderTicket2);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
jformOrderMain2Service.saveOrUpdate(jformOrderTicket2);
} catch (Exception e) {
e.printStackTrace();
return Result.error("更新订单机票信息信息失败");
}
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return Result.success("更新订单机票信息信息成功");
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除订单机票信息")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" , id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
jformOrderMain2Service.deleteEntityById(JformOrderTicket2Entity.class, id);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单机票信息删除失败");
}
return Result.success();
}
}

@ -0,0 +1,520 @@
package com.jeecg.demo.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.Restrictions;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.jwt.web.TokenController;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.entity.JfromOrderEntity;
import com.jeecg.demo.entity.JfromOrderLineEntity;
import com.jeecg.demo.page.JfromOrderPage;
import com.jeecg.demo.service.JfromOrderServiceI;
import org.jeecgframework.web.superquery.util.SuperQueryUtil;
/**
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2017-12-14 13:36:56
* @version V1.0
*
*/
//@Api(value="JfromOrder",description="订单列表",tags="jfromOrderController")
@Controller
@RequestMapping("/jfromOrderController")
public class JfromOrderController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(JfromOrderController.class);
@Autowired
private JfromOrderServiceI jfromOrderService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jfromOrderList");
}
/**
* (demo)
*
* @return
*/
@RequestMapping(params = "gridViewlist")
public ModelAndView gridViewlist(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/jfromOrderGridViewList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(JfromOrderEntity jfromOrder,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JfromOrderEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jfromOrder);
try{
String sql = SuperQueryUtil.getComplxSuperQuerySQL(request);
if(oConvertUtils.isNotEmpty(sql)) {
cq.add(Restrictions.sqlRestriction(" id in ("+sql+")"));
}
//自定义追加查询条件
}catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
cq.add();
this.jfromOrderService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(JfromOrderEntity jfromOrder, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
jfromOrder = systemService.getEntity(JfromOrderEntity.class, jfromOrder.getId());
String message = "订单列表删除成功";
try{
jfromOrderService.delMain(jfromOrder);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单列表删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
AjaxJson j = new AjaxJson();
String message = "订单列表删除成功";
try{
for(String id:ids.split(",")){
JfromOrderEntity jfromOrder = systemService.getEntity(JfromOrderEntity.class,
id
);
jfromOrderService.delMain(jfromOrder);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "订单列表删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(JfromOrderEntity jfromOrder,JfromOrderPage jfromOrderPage, HttpServletRequest request) {
List<JfromOrderLineEntity> jfromOrderLineList = jfromOrderPage.getJfromOrderLineList();
AjaxJson j = new AjaxJson();
String message = "添加成功";
try{
jfromOrderService.addMain(jfromOrder, jfromOrderLineList);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "订单列表添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(JfromOrderEntity jfromOrder,JfromOrderPage jfromOrderPage, HttpServletRequest request) {
List<JfromOrderLineEntity> jfromOrderLineList = jfromOrderPage.getJfromOrderLineList();
AjaxJson j = new AjaxJson();
String message = "更新成功";
try{
jfromOrderService.updateMain(jfromOrder, jfromOrderLineList);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "更新订单列表失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(JfromOrderEntity jfromOrder, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jfromOrder.getId())) {
jfromOrder = jfromOrderService.getEntity(JfromOrderEntity.class, jfromOrder.getId());
req.setAttribute("jfromOrderPage", jfromOrder);
}
return new ModelAndView("com/jeecg/demo/jfromOrder-add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(JfromOrderEntity jfromOrder, HttpServletRequest req) {
if (StringUtil.isNotEmpty(jfromOrder.getId())) {
jfromOrder = jfromOrderService.getEntity(JfromOrderEntity.class, jfromOrder.getId());
req.setAttribute("jfromOrderPage", jfromOrder);
}
return new ModelAndView("com/jeecg/demo/jfromOrder-update");
}
/**
* []
*
* @return
*/
@RequestMapping(params = "jfromOrderLineList")
public ModelAndView jfromOrderLineList(JfromOrderEntity jfromOrder, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id0 = jfromOrder.getId();
//===================================================================================
//查询-订单表体
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
try{
List<JfromOrderLineEntity> jfromOrderLineEntityList = systemService.findHql(hql0,id0);
req.setAttribute("jfromOrderLineList", jfromOrderLineEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/demo/jfromOrderLineList");
}
@RequestMapping(params = "jfromOrderLineDatagrid")
public void jfromOrderLineDatagrid(JfromOrderLineEntity jfromOrderLineEntity,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(JfromOrderLineEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jfromOrderLineEntity);
cq.add();
this.jfromOrderService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(JfromOrderEntity jfromOrder,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
CriteriaQuery cq = new CriteriaQuery(JfromOrderEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jfromOrder);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
List<JfromOrderEntity> list=this.jfromOrderService.getListByCriteriaQuery(cq, false);
List<JfromOrderPage> pageList=new ArrayList<JfromOrderPage>();
if(list!=null&&list.size()>0){
for(JfromOrderEntity entity:list){
try{
JfromOrderPage page=new JfromOrderPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
List<JfromOrderLineEntity> jfromOrderLineEntityList = systemService.findHql(hql0,id0);
page.setJfromOrderLineList(jfromOrderLineEntityList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
map.put(NormalExcelConstants.FILE_NAME,"订单列表");
map.put(NormalExcelConstants.CLASS,JfromOrderPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单列表列表", "导出人:Jeecg",
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,pageList);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel
* @param request
* @param
* @return
*/
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(2);
params.setNeedSave(true);
try {
List<JfromOrderPage> list = ExcelImportUtil.importExcel(file.getInputStream(), JfromOrderPage.class, params);
JfromOrderEntity entity1=null;
for (JfromOrderPage page : list) {
entity1=new JfromOrderEntity();
MyBeanUtils.copyBeanNotNull2Bean(page,entity1);
jfromOrderService.addMain(entity1, page.getJfromOrderLineList());
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
* excel 使
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(ModelMap map) {
map.put(NormalExcelConstants.FILE_NAME,"订单列表");
map.put(NormalExcelConstants.CLASS,JfromOrderPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("订单列表列表", "导出人:"+ ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name", "jfromOrderController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
//@ApiOperation(value="订单列表列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<JfromOrderPage>> list() {
List<JfromOrderEntity> list= jfromOrderService.getList(JfromOrderEntity.class);
List<JfromOrderPage> pageList=new ArrayList<JfromOrderPage>();
if(list!=null&&list.size()>0){
for(JfromOrderEntity entity:list){
try{
JfromOrderPage page=new JfromOrderPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
List<JfromOrderLineEntity> jfromOrderLineOldList = this.jfromOrderService.findHql(hql0,id0);
page.setJfromOrderLineList(jfromOrderLineOldList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
return Result.success(pageList);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
//@ApiOperation(value="根据ID获取订单列表信息",notes="根据ID获取订单列表信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
JfromOrderEntity task = jfromOrderService.get(JfromOrderEntity.class, id);
if (task == null) {
return Result.error("根据ID获取订单列表信息为空");
}
JfromOrderPage page = new JfromOrderPage();
try {
MyBeanUtils.copyBeanNotNull2Bean(task, page);
Object id0 = task.getId();
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
List<JfromOrderLineEntity> jfromOrderLineOldList = this.jfromOrderService.findHql(hql0,id0);
page.setJfromOrderLineList(jfromOrderLineOldList);
} catch (Exception e) {
e.printStackTrace();
}
return Result.success(page);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
//@ApiOperation(value="创建订单列表")
public ResponseMessage<?> create(@ApiParam(name="订单列表对象")@RequestBody JfromOrderPage jfromOrderPage, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JfromOrderPage>> failures = validator.validate(jfromOrderPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<JfromOrderLineEntity> jfromOrderLineList = jfromOrderPage.getJfromOrderLineList();
JfromOrderEntity jfromOrder = new JfromOrderEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jfromOrderPage,jfromOrder);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("保存订单列表失败");
}
jfromOrderService.addMain(jfromOrder, jfromOrderLineList);
return Result.success(jfromOrder);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
//@ApiOperation(value="更新订单列表",notes="更新订单列表")
public ResponseMessage<?> update(@RequestBody JfromOrderPage jfromOrderPage) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<JfromOrderPage>> failures = validator.validate(jfromOrderPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<JfromOrderLineEntity> jfromOrderLineList = jfromOrderPage.getJfromOrderLineList();
JfromOrderEntity jfromOrder = new JfromOrderEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(jfromOrderPage,jfromOrder);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("订单列表更新失败");
}
jfromOrderService.updateMain(jfromOrder, jfromOrderLineList);
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return Result.success();
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
//@ApiOperation(value="删除订单列表")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" , id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
JfromOrderEntity jfromOrder = jfromOrderService.get(JfromOrderEntity.class, id);
jfromOrderService.delMain(jfromOrder);
} catch (Exception e) {
e.printStackTrace();
return Result.error("订单列表删除失败");
}
return Result.success();
}
}

@ -3,9 +3,7 @@ package com.jeecg.demo.dao;
import java.util.List;
import java.util.Map;
import com.jeecg.chat.entity.ChatMessageHistory;
import org.jeecgframework.minidao.annotation.*;
import com.jeecg.demo.entity.JeecgDemoEntity;
import com.jeecg.demo.entity.JeecgLogReport;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
@ -18,48 +16,26 @@ import org.jeecgframework.minidao.pojo.MiniDaoPage;
public interface JeecgMinidaoDao {
@Arguments("pid")
@Sql("select ID,NAME,PID from t_s_region where pid=:pid order by name_en")
@Sql("select id,name,pid from t_s_region where pid=:pid order by name_en")
List<Map<String, String>> getProCity(String pid);
@Sql("select ID,NAME,PID from t_s_region order by name_en")
@Sql("select id,name,pid from t_s_region order by name_en")
List<Map<String, String>> getAllRegions();
@ResultType(JeecgDemoEntity.class)
public MiniDaoPage<JeecgDemoEntity> getAllEntities(@Param("jeecgDemo") JeecgDemoEntity jeecgDemo, @Param("page") int page, @Param("rows") int rows,@Param("authSql") String authSql);
public MiniDaoPage<JeecgDemoEntity> getAllEntities(@Param("jeecgDemo") JeecgDemoEntity jeecgDemo, @Param("page") int page, @Param("rows") int rows,@Param("sort")String sort, @Param("order")String order,@Param("authSql") String authSql);
@Sql("SELECT count(*) FROM jeecg_demo")
@Sql("select count(*) from jeecg_demo")
Integer getCount();
@Sql("SELECT SUM(salary) FROM jeecg_demo")
@Sql("select sum(salary) from jeecg_demo")
Integer getSumSalary();
@Arguments("id")
@ResultType(String.class)
@Sql("SELECT org_code FROM t_s_depart where id=:id")
@Sql("select org_code from t_s_depart where id=:id")
public java.lang.String getOrgCode(String id);
/*@Arguments({"jeecgMinidao", "page", "rows"})
public List<Map> getAllEntities(JeecgMinidaoEntity jeecgMinidao, int page, int rows);
@Arguments({"jeecgMinidao", "page", "rows"})
@ResultType(JeecgMinidaoEntity.class)
public List<JeecgMinidaoEntity> getAllEntities2(JeecgMinidaoEntity jeecgMinidao, int page, int rows);*/
//@Arguments("id")
//JeecgMinidaoEntity getJeecgMinidao(String id);
/*
*/
/*@Arguments("jeecgMinidao")
int update(JeecgMinidaoEntity jeecgMinidao);
@Arguments("jeecgMinidao")
void insert(JeecgMinidaoEntity jeecgMinidao);
@Arguments("jeecgMinidao")
void delete(JeecgMinidaoEntity jeecgMinidao);*/
@Arguments("log")
@ResultType(JeecgLogReport.class)
List<JeecgLogReport> getLogReportData(JeecgLogReport log);

@ -6,7 +6,9 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.core.common.controller.CustomJsonDateDeserializer;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
@ -45,8 +47,8 @@ public class JeecgDemoEntity implements java.io.Serializable {
@Excel(name="电话",width=12)
private java.lang.String phone;
/**工资*/
@Excel(name="工资")
private java.lang.String salary;
@Excel(name="工资",type=4)
private Double salary;
/**性别*/
@Excel(name="性别",dicCode="sex")
private java.lang.String sex;
@ -73,8 +75,6 @@ public class JeecgDemoEntity implements java.io.Serializable {
private java.lang.String touxiang;
private java.lang.String fujian;
/**
*: java.lang.String
*@return: java.lang.String id
@ -139,6 +139,7 @@ public class JeecgDemoEntity implements java.io.Serializable {
*: java.util.Date
*@param: java.util.Date
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setBirthday(java.util.Date birthday){
this.birthday = birthday;
}
@ -211,7 +212,7 @@ public class JeecgDemoEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="SALARY",nullable=true,scale=2,length=19)
public java.lang.String getSalary(){
public Double getSalary(){
return this.salary;
}
@ -219,7 +220,7 @@ public class JeecgDemoEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setSalary(java.lang.String salary){
public void setSalary(Double salary){
this.salary = salary;
}
/**
@ -267,6 +268,7 @@ public class JeecgDemoEntity implements java.io.Serializable {
*: java.util.Date
*@param: java.util.Date createDate
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
@ -385,6 +387,4 @@ public class JeecgDemoEntity implements java.io.Serializable {
public void setFujian(java.lang.String fujian) {
this.fujian = fujian;
}
}

@ -0,0 +1,168 @@
package com.jeecg.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: excel
* @author onlineGenerator
* @date 2018-06-15 15:46:09
* @version V1.0
*
*/
@Entity
@Table(name = "jeecg_demo_excel", schema = "")
@SuppressWarnings("serial")
public class JeecgDemoExcelEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**姓名*/
@Excel(name="姓名",width=15)
private java.lang.String name;
/**生日*/
@Excel(name="生日",format="yyyy-MM-dd")
private java.util.Date birthday;
/**性别*/
@Excel(name="性别",width=15,dicCode="sex")
private java.lang.String sex;
/**关联部门*/
@Excel(name="部门",dictTable="t_s_depart",dicCode="id",dicText="departname")
private java.lang.String depart;
/**测试替换*/
@Excel(name="测试替换",width=15,replace={"男_1","女_0"})
private java.lang.String fdReplace;
/**测试转换*/
@Excel(name="测试转换",width=15,exportConvert=true,importConvert=true)
private java.lang.String fdConvert;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SEX",nullable=true,length=3)
public java.lang.String getSex(){
return this.sex;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSex(java.lang.String sex){
this.sex = sex;
}
@Column(name ="name",nullable=true,length=100)
public java.lang.String getName() {
return name;
}
public void setName(java.lang.String name) {
this.name = name;
}
@Column(name ="birthday",nullable=true,length=20)
public java.util.Date getBirthday() {
return birthday;
}
public void setBirthday(java.util.Date birthday) {
this.birthday = birthday;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="DEPART",nullable=true,length=36)
public java.lang.String getDepart(){
return this.depart;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setDepart(java.lang.String depart){
this.depart = depart;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FD_REPLACE",nullable=true,length=255)
public java.lang.String getFdReplace(){
return this.fdReplace;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFdReplace(java.lang.String fdReplace){
this.fdReplace = fdReplace;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FD_CONVERT",nullable=true,length=255)
public java.lang.String getFdConvert(){
return this.fdConvert;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFdConvert(java.lang.String fdConvert){
this.fdConvert = fdConvert;
}
/**
*
* @return
*/
public String convertgetFdConvert(){
return this.fdConvert+"元";
}
/**
* excel"元"
* @return
*/
public void convertsetFdConvert(String fdConvert){
this.fdConvert = fdConvert.replace("元","");
}
}

@ -0,0 +1,160 @@
package com.jeecg.demo.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2018-03-27 16:21:58
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_customer", schema = "")
@SuppressWarnings("serial")
public class JformOrderCustomer2Entity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**客户名*/
@Excel(name="客户名",width=15)
private java.lang.String name;
/**单价*/
@Excel(name="单价",width=15)
private java.lang.Double money;
/**性别*/
@Excel(name="性别",width=15,dicCode="sex")
private java.lang.String sex;
/**电话*/
@Excel(name="电话",width=15)
private java.lang.String telphone;
/**外键*/
private java.lang.String fkId;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="NAME",nullable=true,length=32)
public java.lang.String getName(){
return this.name;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setName(java.lang.String name){
this.name = name;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
@Column(name ="MONEY",nullable=true,scale=2,length=10)
public java.lang.Double getMoney(){
return this.money;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setMoney(java.lang.Double money){
this.money = money;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SEX",nullable=true,length=4)
public java.lang.String getSex(){
return this.sex;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSex(java.lang.String sex){
this.sex = sex;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="TELPHONE",nullable=true,length=32)
public java.lang.String getTelphone(){
return this.telphone;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setTelphone(java.lang.String telphone){
this.telphone = telphone;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FK_ID",nullable=false,length=36)
public java.lang.String getFkId(){
return this.fkId;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFkId(java.lang.String fkId){
this.fkId = fkId;
}
}

@ -0,0 +1,171 @@
package com.jeecg.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: JformOrderMain
* @author onlineGenerator
* @date 2017-09-17 11:49:08
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_customer", schema = "")
@SuppressWarnings("serial")
public class JformOrderCustomerEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**客户名*/
@Excel(name="客户名",width=15)
private java.lang.String name;
/**单价*/
@Excel(name="单价",width=15)
private java.lang.Double money;
/**性别*/
@Excel(name="性别",width=15,dicCode="sex")
private java.lang.String sex;
/**电话*/
@Excel(name="电话",width=15)
private java.lang.String telphone;
/**身份证扫描件*/
@Excel(name="身份证扫描件",width=15)
private java.lang.String sfPic;
/**外键*/
private java.lang.String fkId;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="NAME",nullable=true,length=100)
public java.lang.String getName(){
return this.name;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setName(java.lang.String name){
this.name = name;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
@Column(name ="MONEY",nullable=true,scale=2,length=10)
public java.lang.Double getMoney(){
return this.money;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setMoney(java.lang.Double money){
this.money = money;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SEX",nullable=true,length=4)
public java.lang.String getSex(){
return this.sex;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSex(java.lang.String sex){
this.sex = sex;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="TELPHONE",nullable=true,length=32)
public java.lang.String getTelphone(){
return this.telphone;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setTelphone(java.lang.String telphone){
this.telphone = telphone;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SF_PIC",nullable=true,length=500)
public java.lang.String getSfPic(){
return this.sfPic;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSfPic(java.lang.String sfPic){
this.sfPic = sfPic;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FK_ID",nullable=false,length=36)
public java.lang.String getFkId(){
return this.fkId;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFkId(java.lang.String fkId){
this.fkId = fkId;
}
}

@ -0,0 +1,140 @@
package com.jeecg.demo.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2018-03-27 16:21:58
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_main", schema = "")
@SuppressWarnings("serial")
public class JformOrderMain2Entity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**订单号*/
@Excel(name="订单号",width=15)
private java.lang.String orderCode;
/**订单日期*/
@Excel(name="订单日期",width=15,format = "yyyy-MM-dd")
private java.util.Date orderDate;
/**订单金额*/
@Excel(name="订单金额",width=15)
private java.lang.Double orderMoney;
/**备注*/
@Excel(name="备注",width=15)
private java.lang.String content;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="ORDER_CODE",nullable=true,length=50)
public java.lang.String getOrderCode(){
return this.orderCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setOrderCode(java.lang.String orderCode){
this.orderCode = orderCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="ORDER_DATE",nullable=true,length=20)
public java.util.Date getOrderDate(){
return this.orderDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setOrderDate(java.util.Date orderDate){
this.orderDate = orderDate;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
@Column(name ="ORDER_MONEY",nullable=true,scale=3,length=10)
public java.lang.Double getOrderMoney(){
return this.orderMoney;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setOrderMoney(java.lang.Double orderMoney){
this.orderMoney = orderMoney;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CONTENT",nullable=true,length=255)
public java.lang.String getContent(){
return this.content;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setContent(java.lang.String content){
this.content = content;
}
}

@ -0,0 +1,151 @@
package com.jeecg.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2017-09-17 11:49:08
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_main", schema = "")
@SuppressWarnings("serial")
public class JformOrderMainEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**订单号*/
@Excel(name="订单号",width=15)
private java.lang.String orderCode;
/**订单日期*/
@Excel(name="订单日期",width=15,format = "yyyy-MM-dd")
private java.util.Date orderDate;
/**订单金额*/
@Excel(name="订单金额",width=15)
private java.lang.Double orderMoney;
/**备注*/
@Excel(name="备注",width=15)
private java.lang.String content;
/**订单扫描件*/
@Excel(name="订单扫描件",width=15,dicCode="sex")
private java.lang.String ctype;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="ORDER_CODE",nullable=true,length=50)
public java.lang.String getOrderCode(){
return this.orderCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setOrderCode(java.lang.String orderCode){
this.orderCode = orderCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="ORDER_DATE",nullable=true,length=20)
public java.util.Date getOrderDate(){
return this.orderDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setOrderDate(java.util.Date orderDate){
this.orderDate = orderDate;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
@Column(name ="ORDER_MONEY",nullable=true,scale=3,length=10)
public java.lang.Double getOrderMoney(){
return this.orderMoney;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setOrderMoney(java.lang.Double orderMoney){
this.orderMoney = orderMoney;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CONTENT",nullable=true,length=500)
public java.lang.String getContent(){
return this.content;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setContent(java.lang.String content){
this.content = content;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CTYPE",nullable=true,length=500)
public java.lang.String getCtype(){
return this.ctype;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCtype(java.lang.String ctype){
this.ctype = ctype;
}
}

@ -0,0 +1,118 @@
package com.jeecg.demo.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2018-03-27 16:21:58
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_ticket", schema = "")
@SuppressWarnings("serial")
public class JformOrderTicket2Entity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**航班号*/
@Excel(name="航班号",width=15)
private java.lang.String ticketCode;
/**航班时间*/
@Excel(name="航班时间",width=15,format = "yyyy-MM-dd")
private java.util.Date tickectDate;
/**外键*/
private java.lang.String fckId;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="TICKET_CODE",nullable=false,length=100)
public java.lang.String getTicketCode(){
return this.ticketCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setTicketCode(java.lang.String ticketCode){
this.ticketCode = ticketCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="TICKECT_DATE",nullable=false,length=10)
public java.util.Date getTickectDate(){
return this.tickectDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setTickectDate(java.util.Date tickectDate){
this.tickectDate = tickectDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FCK_ID",nullable=false,length=36)
public java.lang.String getFckId(){
return this.fckId;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFckId(java.lang.String fckId){
this.fckId = fckId;
}
}

@ -0,0 +1,108 @@
package com.jeecg.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: JformOrderMain
* @author onlineGenerator
* @date 2017-09-17 11:49:08
* @version V1.0
*
*/
@Entity
@Table(name = "jform_order_ticket", schema = "")
@SuppressWarnings("serial")
public class JformOrderTicketEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**航班号*/
@Excel(name="航班号",width=15)
private java.lang.String ticketCode;
/**航班时间*/
@Excel(name="航班时间",width=15,format = "yyyy-MM-dd")
private java.util.Date tickectDate;
/**外键*/
private java.lang.String fckId;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="TICKET_CODE",nullable=false,length=100)
public java.lang.String getTicketCode(){
return this.ticketCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setTicketCode(java.lang.String ticketCode){
this.ticketCode = ticketCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="TICKECT_DATE",nullable=true,length=10)
public java.util.Date getTickectDate(){
return this.tickectDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setTickectDate(java.util.Date tickectDate){
this.tickectDate = tickectDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="FCK_ID",nullable=false,length=36)
public java.lang.String getFckId(){
return this.fckId;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setFckId(java.lang.String fckId){
this.fckId = fckId;
}
}

@ -0,0 +1,362 @@
package com.jeecg.demo.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2017-12-14 13:36:56
* @version V1.0
*
*/
@Entity
@Table(name = "jfrom_order", schema = "")
@SuppressWarnings("serial")
public class JfromOrderEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**创建人名称*/
private java.lang.String createName;
/**创建人登录名称*/
private java.lang.String createBy;
/**创建日期*/
private java.util.Date createDate;
/**更新人名称*/
private java.lang.String updateName;
/**更新人登录名称*/
private java.lang.String updateBy;
/**更新日期*/
private java.util.Date updateDate;
/**所属部门*/
private java.lang.String sysOrgCode;
/**所属公司*/
private java.lang.String sysCompanyCode;
/**流程状态*/
private java.lang.String bpmStatus;
/**收货人*/
@Excel(name="收货人",width=15)
private java.lang.String receiverName;
/**联系电话*/
@Excel(name="联系电话",width=15)
private java.lang.String receiverMobile;
/**收货省*/
@Excel(name="收货省",width=15)
private java.lang.String receiverState;
/**收货市*/
@Excel(name="收货市",width=15)
private java.lang.String receiverCity;
/**收货区*/
@Excel(name="收货区",width=15)
private java.lang.String receiverDistrict;
/**收货地址*/
@Excel(name="收货地址",width=15)
private java.lang.String receiverAddress;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public java.lang.String getCreateName(){
return this.createName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateName(java.lang.String createName){
this.createName = createName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public java.lang.String getCreateBy(){
return this.createBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateBy(java.lang.String createBy){
this.createBy = createBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public java.util.Date getCreateDate(){
return this.createDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public java.lang.String getUpdateName(){
return this.updateName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateName(java.lang.String updateName){
this.updateName = updateName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public java.lang.String getUpdateBy(){
return this.updateBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateBy(java.lang.String updateBy){
this.updateBy = updateBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="UPDATE_DATE",nullable=true,length=20)
public java.util.Date getUpdateDate(){
return this.updateDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setUpdateDate(java.util.Date updateDate){
this.updateDate = updateDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public java.lang.String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysOrgCode(java.lang.String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
public java.lang.String getSysCompanyCode(){
return this.sysCompanyCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysCompanyCode(java.lang.String sysCompanyCode){
this.sysCompanyCode = sysCompanyCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="BPM_STATUS",nullable=true,length=32)
public java.lang.String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(java.lang.String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_NAME",nullable=true,length=56)
public java.lang.String getReceiverName(){
return this.receiverName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverName(java.lang.String receiverName){
this.receiverName = receiverName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_MOBILE",nullable=true,length=32)
public java.lang.String getReceiverMobile(){
return this.receiverMobile;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverMobile(java.lang.String receiverMobile){
this.receiverMobile = receiverMobile;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_STATE",nullable=true,length=32)
public java.lang.String getReceiverState(){
return this.receiverState;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverState(java.lang.String receiverState){
this.receiverState = receiverState;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_CITY",nullable=true,length=32)
public java.lang.String getReceiverCity(){
return this.receiverCity;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverCity(java.lang.String receiverCity){
this.receiverCity = receiverCity;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_DISTRICT",nullable=true,length=32)
public java.lang.String getReceiverDistrict(){
return this.receiverDistrict;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverDistrict(java.lang.String receiverDistrict){
this.receiverDistrict = receiverDistrict;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="RECEIVER_ADDRESS",nullable=true,length=128)
public java.lang.String getReceiverAddress(){
return this.receiverAddress;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverAddress(java.lang.String receiverAddress){
this.receiverAddress = receiverAddress;
}
}

@ -0,0 +1,340 @@
package com.jeecg.demo.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2017-12-14 13:36:56
* @version V1.0
*
*/
@Entity
@Table(name = "jfrom_order_line", schema = "")
@SuppressWarnings("serial")
public class JfromOrderLineEntity implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**创建人名称*/
private java.lang.String createName;
/**创建人登录名称*/
private java.lang.String createBy;
/**创建日期*/
private java.util.Date createDate;
/**更新人名称*/
private java.lang.String updateName;
/**更新人登录名称*/
private java.lang.String updateBy;
/**更新日期*/
private java.util.Date updateDate;
/**所属部门*/
private java.lang.String sysOrgCode;
/**所属公司*/
private java.lang.String sysCompanyCode;
/**流程状态*/
private java.lang.String bpmStatus;
/**订单ID*/
private java.lang.String orderid;
/**商品名称*/
@Excel(name="商品名称",width=15)
private java.lang.String itemName;
/**商品数量*/
@Excel(name="商品数量",width=15)
private java.lang.Integer qty;
/**商品价格*/
@Excel(name="商品价格",width=15)
private java.math.BigDecimal price;
/**金额*/
@Excel(name="金额",width=15)
private java.math.BigDecimal amount;
/**
*: java.lang.String
*@return: java.lang.String
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public java.lang.String getCreateName(){
return this.createName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateName(java.lang.String createName){
this.createName = createName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public java.lang.String getCreateBy(){
return this.createBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateBy(java.lang.String createBy){
this.createBy = createBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public java.util.Date getCreateDate(){
return this.createDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public java.lang.String getUpdateName(){
return this.updateName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateName(java.lang.String updateName){
this.updateName = updateName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public java.lang.String getUpdateBy(){
return this.updateBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateBy(java.lang.String updateBy){
this.updateBy = updateBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
@Column(name ="UPDATE_DATE",nullable=true,length=20)
public java.util.Date getUpdateDate(){
return this.updateDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setUpdateDate(java.util.Date updateDate){
this.updateDate = updateDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public java.lang.String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysOrgCode(java.lang.String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
public java.lang.String getSysCompanyCode(){
return this.sysCompanyCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysCompanyCode(java.lang.String sysCompanyCode){
this.sysCompanyCode = sysCompanyCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="BPM_STATUS",nullable=true,length=32)
public java.lang.String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(java.lang.String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String ID
*/
@Column(name ="ORDERID",nullable=true,length=36)
public java.lang.String getOrderid(){
return this.orderid;
}
/**
*: java.lang.String
*@param: java.lang.String ID
*/
public void setOrderid(java.lang.String orderid){
this.orderid = orderid;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="ITEM_NAME",nullable=true,length=128)
public java.lang.String getItemName(){
return this.itemName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setItemName(java.lang.String itemName){
this.itemName = itemName;
}
/**
*: java.lang.Integer
*@return: java.lang.Integer
*/
@Column(name ="QTY",nullable=true,length=32)
public java.lang.Integer getQty(){
return this.qty;
}
/**
*: java.lang.Integer
*@param: java.lang.Integer
*/
public void setQty(java.lang.Integer qty){
this.qty = qty;
}
/**
*: java.math.BigDecimal
*@return: java.math.BigDecimal
*/
@Column(name ="PRICE",nullable=true,length=32)
public java.math.BigDecimal getPrice(){
return this.price;
}
/**
*: java.math.BigDecimal
*@param: java.math.BigDecimal
*/
public void setPrice(java.math.BigDecimal price){
this.price = price;
}
/**
*: java.math.BigDecimal
*@return: java.math.BigDecimal
*/
@Column(name ="AMOUNT",nullable=true,length=32)
public java.math.BigDecimal getAmount(){
return this.amount;
}
/**
*: java.math.BigDecimal
*@param: java.math.BigDecimal
*/
public void setAmount(java.math.BigDecimal amount){
this.amount = amount;
}
}

@ -0,0 +1,23 @@
package com.jeecg.demo.page;
import java.util.List;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
/**
*
*/
public class JformOrderCustomerPage {
private List<JformOrderCustomerEntity> demos;
public List<JformOrderCustomerEntity> getDemos() {
return demos;
}
public void setDemos(List<JformOrderCustomerEntity> demos) {
this.demos = demos;
}
}

@ -0,0 +1,139 @@
package com.jeecg.demo.page;
import java.util.ArrayList;
import java.util.List;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeecg.demo.entity.JformOrderCustomer2Entity;
import com.jeecg.demo.entity.JformOrderMain2Entity;
import com.jeecg.demo.entity.JformOrderTicket2Entity;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2018-03-27 16:21:58
* @version V1.0
*
*/
public class JformOrderMain2Page implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**订单号*/
@Excel(name="订单号")
private java.lang.String orderCode;
/**订单日期*/
@Excel(name="订单日期",format = "yyyy-MM-dd")
private java.util.Date orderDate;
/**订单金额*/
@Excel(name="订单金额")
private java.lang.Double orderMoney;
/**备注*/
@Excel(name="备注")
private java.lang.String content;
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getOrderCode(){
return this.orderCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setOrderCode(java.lang.String orderCode){
this.orderCode = orderCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
public java.util.Date getOrderDate(){
return this.orderDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setOrderDate(java.util.Date orderDate){
this.orderDate = orderDate;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
public java.lang.Double getOrderMoney(){
return this.orderMoney;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setOrderMoney(java.lang.Double orderMoney){
this.orderMoney = orderMoney;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getContent(){
return this.content;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setContent(java.lang.String content){
this.content = content;
}
/**保存-订单机票信息*/
@ExcelCollection(name="订单机票信息")
private List<JformOrderTicket2Entity> jformOrderTicket2List = new ArrayList<JformOrderTicket2Entity>();
public List<JformOrderTicket2Entity> getJformOrderTicket2List() {
return jformOrderTicket2List;
}
public void setJformOrderTicket2List(List<JformOrderTicket2Entity> jformOrderTicket2List) {
this.jformOrderTicket2List = jformOrderTicket2List;
}
/**保存-订单客户信息*/
@ExcelCollection(name="订单客户信息")
private List<JformOrderCustomer2Entity> jformOrderCustomer2List = new ArrayList<JformOrderCustomer2Entity>();
public List<JformOrderCustomer2Entity> getJformOrderCustomer2List() {
return jformOrderCustomer2List;
}
public void setJformOrderCustomer2List(List<JformOrderCustomer2Entity> jformOrderCustomer2List) {
this.jformOrderCustomer2List = jformOrderCustomer2List;
}
@JsonIgnore
private List<JformOrderMain2Entity> jformOrderMain2List = new ArrayList<JformOrderMain2Entity>();
public List<JformOrderMain2Entity> getJformOrderMain2List() {
return jformOrderMain2List;
}
public void setJformOrderMain2List(List<JformOrderMain2Entity> jformOrderMain2List) {
this.jformOrderMain2List = jformOrderMain2List;
}
}

@ -0,0 +1,152 @@
package com.jeecg.demo.page;
import java.util.ArrayList;
import java.util.List;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
import com.jeecg.demo.entity.JformOrderTicketEntity;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2017-09-17 11:49:08
* @version V1.0
*
*/
public class JformOrderMainPage implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**订单号*/
@Excel(name="订单号")
private java.lang.String orderCode;
/**订单日期*/
@Excel(name="订单日期",format = "yyyy-MM-dd")
private java.util.Date orderDate;
/**订单金额*/
@Excel(name="订单金额")
private java.lang.Double orderMoney;
/**备注*/
@Excel(name="备注")
private java.lang.String content;
/**订单扫描件*/
@Excel(name="订单扫描件")
private java.lang.String ctype;
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getOrderCode(){
return this.orderCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setOrderCode(java.lang.String orderCode){
this.orderCode = orderCode;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
public java.util.Date getOrderDate(){
return this.orderDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setOrderDate(java.util.Date orderDate){
this.orderDate = orderDate;
}
/**
*: java.lang.Double
*@return: java.lang.Double
*/
public java.lang.Double getOrderMoney(){
return this.orderMoney;
}
/**
*: java.lang.Double
*@param: java.lang.Double
*/
public void setOrderMoney(java.lang.Double orderMoney){
this.orderMoney = orderMoney;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getContent(){
return this.content;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setContent(java.lang.String content){
this.content = content;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getCtype(){
return this.ctype;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCtype(java.lang.String ctype){
this.ctype = ctype;
}
/**保存-JformOrderMain子表*/
@ExcelCollection(name="订单客户信息")
private List<JformOrderCustomerEntity> jformOrderCustomerList = new ArrayList<JformOrderCustomerEntity>();
public List<JformOrderCustomerEntity> getJformOrderCustomerList() {
return jformOrderCustomerList;
}
public void setJformOrderCustomerList(List<JformOrderCustomerEntity> jformOrderCustomerList) {
this.jformOrderCustomerList = jformOrderCustomerList;
}
/**保存-JformOrderMain子表*/
@ExcelCollection(name="订单机票信息")
private List<JformOrderTicketEntity> jformOrderTicketList = new ArrayList<JformOrderTicketEntity>();
public List<JformOrderTicketEntity> getJformOrderTicketList() {
return jformOrderTicketList;
}
public void setJformOrderTicketList(List<JformOrderTicketEntity> jformOrderTicketList) {
this.jformOrderTicketList = jformOrderTicketList;
}
}

@ -0,0 +1,320 @@
package com.jeecg.demo.page;
import com.jeecg.demo.entity.JfromOrderEntity;
import com.jeecg.demo.entity.JfromOrderLineEntity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2017-12-14 13:36:56
* @version V1.0
*
*/
public class JfromOrderPage implements java.io.Serializable {
/**主键*/
private java.lang.String id;
/**创建人名称*/
private java.lang.String createName;
/**创建人登录名称*/
private java.lang.String createBy;
/**创建日期*/
private java.util.Date createDate;
/**更新人名称*/
private java.lang.String updateName;
/**更新人登录名称*/
private java.lang.String updateBy;
/**更新日期*/
private java.util.Date updateDate;
/**所属部门*/
private java.lang.String sysOrgCode;
/**所属公司*/
private java.lang.String sysCompanyCode;
/**流程状态*/
private java.lang.String bpmStatus;
/**收货人*/
@Excel(name="收货人")
private java.lang.String receiverName;
/**联系电话*/
@Excel(name="联系电话")
private java.lang.String receiverMobile;
/**收货省*/
@Excel(name="收货省")
private java.lang.String receiverState;
/**收货市*/
@Excel(name="收货市")
private java.lang.String receiverCity;
/**收货区*/
@Excel(name="收货区")
private java.lang.String receiverDistrict;
/**收货地址*/
@Excel(name="收货地址")
private java.lang.String receiverAddress;
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getId(){
return this.id;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setId(java.lang.String id){
this.id = id;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getCreateName(){
return this.createName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateName(java.lang.String createName){
this.createName = createName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getCreateBy(){
return this.createBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateBy(java.lang.String createBy){
this.createBy = createBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
public java.util.Date getCreateDate(){
return this.createDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getUpdateName(){
return this.updateName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateName(java.lang.String updateName){
this.updateName = updateName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getUpdateBy(){
return this.updateBy;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateBy(java.lang.String updateBy){
this.updateBy = updateBy;
}
/**
*: java.util.Date
*@return: java.util.Date
*/
public java.util.Date getUpdateDate(){
return this.updateDate;
}
/**
*: java.util.Date
*@param: java.util.Date
*/
public void setUpdateDate(java.util.Date updateDate){
this.updateDate = updateDate;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysOrgCode(java.lang.String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getSysCompanyCode(){
return this.sysCompanyCode;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setSysCompanyCode(java.lang.String sysCompanyCode){
this.sysCompanyCode = sysCompanyCode;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(java.lang.String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverName(){
return this.receiverName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverName(java.lang.String receiverName){
this.receiverName = receiverName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverMobile(){
return this.receiverMobile;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverMobile(java.lang.String receiverMobile){
this.receiverMobile = receiverMobile;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverState(){
return this.receiverState;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverState(java.lang.String receiverState){
this.receiverState = receiverState;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverCity(){
return this.receiverCity;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverCity(java.lang.String receiverCity){
this.receiverCity = receiverCity;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverDistrict(){
return this.receiverDistrict;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverDistrict(java.lang.String receiverDistrict){
this.receiverDistrict = receiverDistrict;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
public java.lang.String getReceiverAddress(){
return this.receiverAddress;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setReceiverAddress(java.lang.String receiverAddress){
this.receiverAddress = receiverAddress;
}
/**保存-订单表体*/
@ExcelCollection(name="订单表体")
private List<JfromOrderLineEntity> jfromOrderLineList = new ArrayList<JfromOrderLineEntity>();
public List<JfromOrderLineEntity> getJfromOrderLineList() {
return jfromOrderLineList;
}
public void setJfromOrderLineList(List<JfromOrderLineEntity> jfromOrderLineList) {
this.jfromOrderLineList = jfromOrderLineList;
}
}

@ -0,0 +1,16 @@
package com.jeecg.demo.service;
import java.io.Serializable;
import org.jeecgframework.core.common.service.CommonService;
import com.jeecg.demo.entity.JeecgDemoExcelEntity;
public interface JeecgDemoExcelServiceI extends CommonService{
public void delete(JeecgDemoExcelEntity entity) throws Exception;
public Serializable save(JeecgDemoExcelEntity entity) throws Exception;
public void saveOrUpdate(JeecgDemoExcelEntity entity) throws Exception;
}

@ -11,6 +11,7 @@ public interface JeecgDemoServiceI extends CommonService{
public Serializable save(JeecgDemoEntity entity) throws Exception;
public void saveOrUpdate(JeecgDemoEntity entity) throws Exception;
public void jdbcBatchSave() throws Exception;
public void jdbcProcedure() throws Exception;

@ -0,0 +1,49 @@
package com.jeecg.demo.service;
import com.jeecg.demo.entity.JformOrderMain2Entity;
import com.jeecg.demo.entity.JformOrderTicket2Entity;
import com.jeecg.demo.entity.JformOrderCustomer2Entity;
import java.util.List;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface JformOrderMain2ServiceI extends CommonService{
public <T> void delete(T entity);
/*public <T> void add(T entity);
public <T> void addOrUpdate(T entity);*/
/**
*
*
*/
public void addMain(JformOrderMain2Entity jformOrderMain2,
List<JformOrderTicket2Entity> jformOrderTicket2List,List<JformOrderCustomer2Entity> jformOrderCustomer2List) ;
/**
*
*
*/
public void updateMain(JformOrderMain2Entity jformOrderMain2,
List<JformOrderTicket2Entity> jformOrderTicket2List,List<JformOrderCustomer2Entity> jformOrderCustomer2List);
public void delMain (JformOrderMain2Entity jformOrderMain2);
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JformOrderMain2Entity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JformOrderMain2Entity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JformOrderMain2Entity t);
}

@ -0,0 +1,50 @@
package com.jeecg.demo.service;
import com.jeecg.demo.entity.JformOrderMainEntity;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
import com.jeecg.demo.entity.JformOrderTicketEntity;
import java.util.List;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface JformOrderMainServiceI extends CommonService{
public <T> void delete(T entity);
/**
*
*
*/
public void addMain(JformOrderMainEntity jformOrderMain,
List<JformOrderCustomerEntity> jformOrderCustomerList,List<JformOrderTicketEntity> jformOrderTicketList) ;
/**
*
*
*/
public void updateMain(JformOrderMainEntity jformOrderMain,
List<JformOrderCustomerEntity> jformOrderCustomerList,List<JformOrderTicketEntity> jformOrderTicketList);
public void delMain (JformOrderMainEntity jformOrderMain);
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JformOrderMainEntity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JformOrderMainEntity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JformOrderMainEntity t);
/**
*
* @param jformOrderCustomerList
*/
public void updateCustomers(List<JformOrderCustomerEntity> jformOrderCustomerList);
}

@ -0,0 +1,44 @@
package com.jeecg.demo.service;
import com.jeecg.demo.entity.JfromOrderEntity;
import com.jeecg.demo.entity.JfromOrderLineEntity;
import java.util.List;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface JfromOrderServiceI extends CommonService{
public <T> void delete(T entity);
/**
*
*
*/
public void addMain(JfromOrderEntity jfromOrder,
List<JfromOrderLineEntity> jfromOrderLineList) ;
/**
*
*
*/
public void updateMain(JfromOrderEntity jfromOrder, List<JfromOrderLineEntity> jfromOrderLineList);
public void delMain (JfromOrderEntity jfromOrder);
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JfromOrderEntity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JfromOrderEntity t);
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JfromOrderEntity t);
}

@ -0,0 +1,33 @@
package com.jeecg.demo.service.impl;
import java.io.Serializable;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeecg.demo.entity.JeecgDemoExcelEntity;
import com.jeecg.demo.service.JeecgDemoExcelServiceI;
@Service("jeecgDemoExcelService")
@Transactional
public class JeecgDemoExcelServiceImpl extends CommonServiceImpl implements JeecgDemoExcelServiceI {
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
public void delete(JeecgDemoExcelEntity entity) throws Exception{
super.delete(entity);
}
public Serializable save(JeecgDemoExcelEntity entity) throws Exception{
Serializable t = super.save(entity);
return t;
}
public void saveOrUpdate(JeecgDemoExcelEntity entity) throws Exception{
super.saveOrUpdate(entity);
}
}

@ -4,19 +4,13 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.MyClassLoader;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.stereotype.Service;
@ -29,124 +23,24 @@ import com.jeecg.demo.service.JeecgDemoServiceI;
@Transactional
public class JeecgDemoServiceImpl extends CommonServiceImpl implements JeecgDemoServiceI {
private static final Logger logger = Logger.getLogger(JeecgDemoServiceImpl.class);
@Autowired
private JdbcDao jdbcDao;
public void delete(JeecgDemoEntity entity) throws Exception{
super.delete(entity);
//执行删除操作增强业务
this.doDelBus(entity);
}
public Serializable save(JeecgDemoEntity entity) throws Exception{
Serializable t = super.save(entity);
//执行新增操作增强业务
this.doAddBus(entity);
return t;
}
public void saveOrUpdate(JeecgDemoEntity entity) throws Exception{
super.saveOrUpdate(entity);
//执行更新操作增强业务
this.doUpdateBus(entity);
}
/**
*
* @param t
* @return
*/
private void doAddBus(JeecgDemoEntity t) throws Exception{
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(JeecgDemoEntity t) throws Exception{
}
/**
*
* @param id
* @return
*/
private void doDelBus(JeecgDemoEntity t) throws Exception{
}
private Map<String,Object> populationMap(JeecgDemoEntity t){
Map<String,Object> map = new HashMap<String,Object>();
map.put("id", t.getId());
map.put("name", t.getName());
map.put("age", t.getAge());
map.put("birthday", t.getBirthday());
map.put("content", t.getContent());
map.put("dep_id", t.getDepId());
map.put("email", t.getEmail());
map.put("phone", t.getPhone());
map.put("salary", t.getSalary());
map.put("sex", t.getSex());
map.put("status", t.getStatus());
map.put("create_date", t.getCreateDate());
map.put("create_by", t.getCreateBy());
map.put("create_name", t.getCreateName());
map.put("update_by", t.getUpdateBy());
map.put("update_date", t.getUpdateDate());
map.put("update_name", t.getUpdateName());
return map;
}
/**
* sql
* @param sql
* @param t
* @return
*/
public String replaceVal(String sql,JeecgDemoEntity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{name}",String.valueOf(t.getName()));
sql = sql.replace("#{age}",String.valueOf(t.getAge()));
sql = sql.replace("#{birthday}",String.valueOf(t.getBirthday()));
sql = sql.replace("#{content}",String.valueOf(t.getContent()));
sql = sql.replace("#{dep_id}",String.valueOf(t.getDepId()));
sql = sql.replace("#{email}",String.valueOf(t.getEmail()));
sql = sql.replace("#{phone}",String.valueOf(t.getPhone()));
sql = sql.replace("#{salary}",String.valueOf(t.getSalary()));
sql = sql.replace("#{sex}",String.valueOf(t.getSex()));
sql = sql.replace("#{status}",String.valueOf(t.getStatus()));
sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
/**
* JAVA
*/
private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map<String,Object> data) throws Exception {
if(StringUtil.isNotEmpty(cgJavaValue)){
Object obj = null;
try {
if("class".equals(cgJavaType)){
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
}else if("spring".equals(cgJavaType)){
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
}
if(obj instanceof CgformEnhanceJavaInter){
CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj;
javaInter.execute("jeecg_demo",data);
}
} catch (Exception e) {
e.printStackTrace();
throw new Exception("执行JAVA增强出现异常");
}
}
}
/**
* JDBC
*/

@ -0,0 +1,205 @@
package com.jeecg.demo.service.impl;
import java.util.List;
import java.util.UUID;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeecg.demo.entity.JformOrderCustomer2Entity;
import com.jeecg.demo.entity.JformOrderMain2Entity;
import com.jeecg.demo.entity.JformOrderTicket2Entity;
import com.jeecg.demo.service.JformOrderMain2ServiceI;
@Service("jformOrderMain2Service")
@Transactional
public class JformOrderMain2ServiceImpl extends CommonServiceImpl implements JformOrderMain2ServiceI {
public <T> void delete(T entity) {
super.delete(entity);
}
public void addMain(JformOrderMain2Entity jformOrderMain2,
List<JformOrderTicket2Entity> jformOrderTicket2List,List<JformOrderCustomer2Entity> jformOrderCustomer2List){
//保存主信息
this.save(jformOrderMain2);
/**保存-订单机票信息*/
for(JformOrderTicket2Entity jformOrderTicket2:jformOrderTicket2List){
//外键设置
jformOrderTicket2.setFckId(jformOrderMain2.getId());
this.save(jformOrderTicket2);
}
/**保存-订单客户信息*/
for(JformOrderCustomer2Entity jformOrderCustomer2:jformOrderCustomer2List){
//外键设置
jformOrderCustomer2.setFkId(jformOrderMain2.getId());
this.save(jformOrderCustomer2);
}
//执行新增操作配置的sql增强
this.doAddSql(jformOrderMain2);
}
public void updateMain(JformOrderMain2Entity jformOrderMain2,
List<JformOrderTicket2Entity> jformOrderTicket2List,List<JformOrderCustomer2Entity> jformOrderCustomer2List) {
//保存主表信息
if(StringUtil.isNotEmpty(jformOrderMain2.getId())){
try {
JformOrderMain2Entity temp = findUniqueByProperty(JformOrderMain2Entity.class, "id", jformOrderMain2.getId());
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMain2, temp);
this.saveOrUpdate(temp);
} catch (Exception e) {
e.printStackTrace();
}
}else{
this.saveOrUpdate(jformOrderMain2);
}
//===================================================================================
//获取参数
Object id0 = jformOrderMain2.getId();
Object id1 = jformOrderMain2.getId();
//===================================================================================
//1.查询出数据库的明细数据-订单机票信息
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicket2Entity> jformOrderTicket2OldList = this.findHql(hql0,id0);
//2.筛选更新明细数据-订单机票信息
if(jformOrderTicket2List!=null&&jformOrderTicket2List.size()>0){
for(JformOrderTicket2Entity oldE:jformOrderTicket2OldList){
boolean isUpdate = false;
for(JformOrderTicket2Entity sendE:jformOrderTicket2List){
//需要更新的明细数据-订单机票信息
if(oldE.getId().equals(sendE.getId())){
try {
MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
this.saveOrUpdate(oldE);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
isUpdate= true;
break;
}
}
if(!isUpdate){
//如果数据库存在的明细,前台没有传递过来则是删除-订单机票信息
super.delete(oldE);
}
}
//3.持久化新增的数据-订单机票信息
for(JformOrderTicket2Entity jformOrderTicket2:jformOrderTicket2List){
if(oConvertUtils.isEmpty(jformOrderTicket2.getId())){
//外键设置
jformOrderTicket2.setFckId(jformOrderMain2.getId());
this.save(jformOrderTicket2);
}
}
}
//===================================================================================
//1.查询出数据库的明细数据-订单客户信息
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomer2Entity> jformOrderCustomer2OldList = this.findHql(hql1,id1);
//2.筛选更新明细数据-订单客户信息
if(jformOrderCustomer2List!=null&&jformOrderCustomer2List.size()>0){
for(JformOrderCustomer2Entity oldE:jformOrderCustomer2OldList){
boolean isUpdate = false;
for(JformOrderCustomer2Entity sendE:jformOrderCustomer2List){
//需要更新的明细数据-订单客户信息
if(oldE.getId().equals(sendE.getId())){
try {
MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
this.saveOrUpdate(oldE);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
isUpdate= true;
break;
}
}
if(!isUpdate){
//如果数据库存在的明细,前台没有传递过来则是删除-订单客户信息
super.delete(oldE);
}
}
//3.持久化新增的数据-订单客户信息
for(JformOrderCustomer2Entity jformOrderCustomer2:jformOrderCustomer2List){
if(oConvertUtils.isEmpty(jformOrderCustomer2.getId())){
//外键设置
jformOrderCustomer2.setFkId(jformOrderMain2.getId());
this.save(jformOrderCustomer2);
}
}
}
//执行更新操作配置的sql增强
this.doUpdateSql(jformOrderMain2);
}
public void delMain(JformOrderMain2Entity jformOrderMain2) {
//删除主表信息
this.delete(jformOrderMain2);
//===================================================================================
//获取参数
Object id0 = jformOrderMain2.getId();
Object id1 = jformOrderMain2.getId();
//===================================================================================
//删除-订单机票信息
String hql0 = "from JformOrderTicket2Entity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicket2Entity> jformOrderTicket2OldList = this.findHql(hql0,id0);
this.deleteAllEntitie(jformOrderTicket2OldList);
//===================================================================================
//删除-订单客户信息
String hql1 = "from JformOrderCustomer2Entity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomer2Entity> jformOrderCustomer2OldList = this.findHql(hql1,id1);
this.deleteAllEntitie(jformOrderCustomer2OldList);
}
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JformOrderMain2Entity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JformOrderMain2Entity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JformOrderMain2Entity t){
return true;
}
/**
* sql
* @param sql
* @return
*/
public String replaceVal(String sql,JformOrderMain2Entity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{order_code}",String.valueOf(t.getOrderCode()));
sql = sql.replace("#{order_date}",String.valueOf(t.getOrderDate()));
sql = sql.replace("#{order_money}",String.valueOf(t.getOrderMoney()));
sql = sql.replace("#{content}",String.valueOf(t.getContent()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
}

@ -0,0 +1,225 @@
package com.jeecg.demo.service.impl;
import com.jeecg.demo.service.JformOrderMainServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.jeecg.demo.entity.JformOrderMainEntity;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
import com.jeecg.demo.entity.JformOrderTicketEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import java.util.ArrayList;
import java.util.UUID;
import java.io.Serializable;
@Service("jformOrderMainService")
@Transactional
public class JformOrderMainServiceImpl extends CommonServiceImpl implements JformOrderMainServiceI {
public <T> void delete(T entity) {
super.delete(entity);
//执行删除操作配置的sql增强
this.doDelSql((JformOrderMainEntity)entity);
}
public void addMain(JformOrderMainEntity jformOrderMain,
List<JformOrderCustomerEntity> jformOrderCustomerList,List<JformOrderTicketEntity> jformOrderTicketList){
//保存主信息
this.save(jformOrderMain);
/**保存-JformOrderMain子表*/
for(JformOrderCustomerEntity jformOrderCustomer:jformOrderCustomerList){
//外键设置
jformOrderCustomer.setFkId(jformOrderMain.getId());
this.save(jformOrderCustomer);
}
/**保存-JformOrderMain子表*/
for(JformOrderTicketEntity jformOrderTicket:jformOrderTicketList){
//外键设置
jformOrderTicket.setFckId(jformOrderMain.getId());
this.save(jformOrderTicket);
}
//执行新增操作配置的sql增强
this.doAddSql(jformOrderMain);
}
public void updateMain(JformOrderMainEntity jformOrderMain,
List<JformOrderCustomerEntity> jformOrderCustomerList,List<JformOrderTicketEntity> jformOrderTicketList) {
//保存主表信息
if(StringUtil.isNotEmpty(jformOrderMain.getId())){
try {
JformOrderMainEntity temp = findUniqueByProperty(JformOrderMainEntity.class, "id", jformOrderMain.getId());
MyBeanUtils.copyBeanNotNull2Bean(jformOrderMain, temp);
this.saveOrUpdate(temp);
} catch (Exception e) {
e.printStackTrace();
}
}else{
this.saveOrUpdate(jformOrderMain);
}
//===================================================================================
//获取参数
Object id0 = jformOrderMain.getId();
Object id1 = jformOrderMain.getId();
//===================================================================================
//1.查询出数据库的明细数据-JformOrderMain子表
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerOldList = this.findHql(hql0,id0);
//2.筛选更新明细数据-JformOrderMain子表
//TODO authorXueLin for: 客户数据全删完size == 0
if(jformOrderCustomerList != null){// && jformOrderCustomerList.size() > 0
for(JformOrderCustomerEntity oldE : jformOrderCustomerOldList){
boolean isUpdate = false;
for(JformOrderCustomerEntity sendE : jformOrderCustomerList){
//需要更新的明细数据-JformOrderMain子表
if(oldE.getId().equals(sendE.getId())){
try {
MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
this.saveOrUpdate(oldE);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
isUpdate = true;
break;
}
}
if(!isUpdate){
//如果数据库存在的明细,前台没有传递过来则是删除-JformOrderMain子表
super.delete(oldE);
}
}
//3.持久化新增的数据-JformOrderMain子表
for(JformOrderCustomerEntity jformOrderCustomer:jformOrderCustomerList){
if(oConvertUtils.isEmpty(jformOrderCustomer.getId())){
//外键设置
jformOrderCustomer.setFkId(jformOrderMain.getId());
this.save(jformOrderCustomer);
}
}
}
//===================================================================================
//1.查询出数据库的明细数据-JformOrderMain子表
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicketEntity> jformOrderTicketOldList = this.findHql(hql1,id1);
//2.筛选更新明细数据-JformOrderMain子表
//TODO authorXueLin for: 机票信息全删完 size == 0
if(jformOrderTicketList != null){// && jformOrderTicketList.size() > 0
for(JformOrderTicketEntity oldE : jformOrderTicketOldList){
boolean isUpdate = false;
for(JformOrderTicketEntity sendE : jformOrderTicketList){
//需要更新的明细数据-JformOrderMain子表
if(oldE.getId().equals(sendE.getId())){
try {
MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
this.saveOrUpdate(oldE);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
isUpdate= true;
break;
}
}
if(!isUpdate){
//如果数据库存在的明细,前台没有传递过来则是删除-JformOrderMain子表
super.delete(oldE);
}
}
//3.持久化新增的数据-JformOrderMain子表
for(JformOrderTicketEntity jformOrderTicket:jformOrderTicketList){
if(oConvertUtils.isEmpty(jformOrderTicket.getId())){
//外键设置
jformOrderTicket.setFckId(jformOrderMain.getId());
this.save(jformOrderTicket);
}
}
}
//执行更新操作配置的sql增强
this.doUpdateSql(jformOrderMain);
}
public void delMain(JformOrderMainEntity jformOrderMain) {
//删除主表信息
this.delete(jformOrderMain);
//===================================================================================
//获取参数
Object id0 = jformOrderMain.getId();
Object id1 = jformOrderMain.getId();
//===================================================================================
//删除-JformOrderMain子表
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerOldList = this.findHql(hql0,id0);
this.deleteAllEntitie(jformOrderCustomerOldList);
//===================================================================================
//删除-JformOrderMain子表
String hql1 = "from JformOrderTicketEntity where 1 = 1 AND fCK_ID = ? ";
List<JformOrderTicketEntity> jformOrderTicketOldList = this.findHql(hql1,id1);
this.deleteAllEntitie(jformOrderTicketOldList);
}
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JformOrderMainEntity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JformOrderMainEntity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JformOrderMainEntity t){
return true;
}
/**
* sql
* @param sql
* @return
*/
public String replaceVal(String sql,JformOrderMainEntity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{order_code}",String.valueOf(t.getOrderCode()));
sql = sql.replace("#{order_date}",String.valueOf(t.getOrderDate()));
sql = sql.replace("#{order_money}",String.valueOf(t.getOrderMoney()));
sql = sql.replace("#{content}",String.valueOf(t.getContent()));
sql = sql.replace("#{ctype}",String.valueOf(t.getCtype()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
/**
*
* @param jformOrderCustomerList
*/
public void updateCustomers(List<JformOrderCustomerEntity> jformOrderCustomerList){
for(JformOrderCustomerEntity jformOrderCustomer:jformOrderCustomerList){
this.saveOrUpdate(jformOrderCustomer);
}
}
}

@ -0,0 +1,169 @@
package com.jeecg.demo.service.impl;
import com.jeecg.demo.service.JfromOrderServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.jeecg.demo.entity.JfromOrderEntity;
import com.jeecg.demo.entity.JfromOrderLineEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import java.util.ArrayList;
import java.util.UUID;
import java.io.Serializable;
@Service("jfromOrderService")
@Transactional
public class JfromOrderServiceImpl extends CommonServiceImpl implements JfromOrderServiceI {
public <T> void delete(T entity) {
super.delete(entity);
//执行删除操作配置的sql增强
this.doDelSql((JfromOrderEntity)entity);
}
public void addMain(JfromOrderEntity jfromOrder,
List<JfromOrderLineEntity> jfromOrderLineList){
//保存主信息
this.save(jfromOrder);
/**保存-订单表体*/
for(JfromOrderLineEntity jfromOrderLine:jfromOrderLineList){
//外键设置
jfromOrderLine.setOrderid(jfromOrder.getId());
this.save(jfromOrderLine);
}
//执行新增操作配置的sql增强
this.doAddSql(jfromOrder);
}
public void updateMain(JfromOrderEntity jfromOrder,
List<JfromOrderLineEntity> jfromOrderLineList) {
//保存主表信息
if(StringUtil.isNotEmpty(jfromOrder.getId())){
try {
JfromOrderEntity temp = findUniqueByProperty(JfromOrderEntity.class, "id", jfromOrder.getId());
MyBeanUtils.copyBeanNotNull2Bean(jfromOrder, temp);
this.saveOrUpdate(temp);
} catch (Exception e) {
e.printStackTrace();
}
}else{
this.saveOrUpdate(jfromOrder);
}
//===================================================================================
//获取参数
Object id0 = jfromOrder.getId();
//===================================================================================
//1.查询出数据库的明细数据-订单表体
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
List<JfromOrderLineEntity> jfromOrderLineOldList = this.findHql(hql0,id0);
//2.筛选更新明细数据-订单表体
if(jfromOrderLineList!=null&&jfromOrderLineList.size()>0){
for(JfromOrderLineEntity oldE:jfromOrderLineOldList){
boolean isUpdate = false;
for(JfromOrderLineEntity sendE:jfromOrderLineList){
//需要更新的明细数据-订单表体
if(oldE.getId().equals(sendE.getId())){
try {
MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
this.saveOrUpdate(oldE);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
isUpdate= true;
break;
}
}
if(!isUpdate){
//如果数据库存在的明细,前台没有传递过来则是删除-订单表体
super.delete(oldE);
}
}
//3.持久化新增的数据-订单表体
for(JfromOrderLineEntity jfromOrderLine:jfromOrderLineList){
if(oConvertUtils.isEmpty(jfromOrderLine.getId())){
//外键设置
jfromOrderLine.setOrderid(jfromOrder.getId());
this.save(jfromOrderLine);
}
}
}
//执行更新操作配置的sql增强
this.doUpdateSql(jfromOrder);
}
public void delMain(JfromOrderEntity jfromOrder) {
//删除主表信息
this.delete(jfromOrder);
//===================================================================================
//获取参数
Object id0 = jfromOrder.getId();
//===================================================================================
//删除-订单表体
String hql0 = "from JfromOrderLineEntity where 1 = 1 AND oRDERID = ? ";
List<JfromOrderLineEntity> jfromOrderLineOldList = this.findHql(hql0,id0);
this.deleteAllEntitie(jfromOrderLineOldList);
}
/**
* -sql-
* @param id
* @return
*/
public boolean doAddSql(JfromOrderEntity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doUpdateSql(JfromOrderEntity t){
return true;
}
/**
* -sql-
* @param id
* @return
*/
public boolean doDelSql(JfromOrderEntity t){
return true;
}
/**
* sql
* @param sql
* @return
*/
public String replaceVal(String sql,JfromOrderEntity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
sql = sql.replace("#{sys_org_code}",String.valueOf(t.getSysOrgCode()));
sql = sql.replace("#{sys_company_code}",String.valueOf(t.getSysCompanyCode()));
sql = sql.replace("#{bpm_status}",String.valueOf(t.getBpmStatus()));
sql = sql.replace("#{receiver_name}",String.valueOf(t.getReceiverName()));
sql = sql.replace("#{receiver_mobile}",String.valueOf(t.getReceiverMobile()));
sql = sql.replace("#{receiver_state}",String.valueOf(t.getReceiverState()));
sql = sql.replace("#{receiver_city}",String.valueOf(t.getReceiverCity()));
sql = sql.replace("#{receiver_district}",String.valueOf(t.getReceiverDistrict()));
sql = sql.replace("#{receiver_address}",String.valueOf(t.getReceiverAddress()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
}

@ -26,3 +26,7 @@ SELECT * FROM jeecg_demo WHERE 1=1
<#if authSql ?exists && authSql ?length gt 0>
${authSql}
</#if>
<#if sort ?exists && sort ?length gt 0>
ORDER BY ${sort} ${order}
</#if>

@ -0,0 +1,99 @@
package com.jeecg.demo.util;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import freemarker.template.TemplateException;
public class FreemarkerUtil {
private static final Object LOCK = new Object();
/**
* word
*/
public static final int WORD_FILE = 1;
/**
* excel
*/
public static final int EXCEL_FILE = 2;
private static Configuration cfg;
private static FreemarkerUtil ftl ;
private FreemarkerUtil(String templateFolder) throws IOException {
cfg = new Configuration();
cfg.setDirectoryForTemplateLoading(new File(templateFolder));
cfg.setObjectWrapper(new DefaultObjectWrapper());
}
private static void check(HttpServletRequest request) {
if (ftl == null) {
synchronized (LOCK) {
try {
ftl = new FreemarkerUtil(request.getServletContext().getRealPath("/")+"export/template");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* word
* response
* @throws IOException
*/
public static void createFile(String templateName,String docFileName, Map<String,Object> rootMap,HttpServletRequest request, HttpServletResponse response,int fileType) throws IOException {
// response.resetBuffer();
//设置导出
response.addHeader("Cache-Control","no-cache");
response.setCharacterEncoding("UTF-8");
if( WORD_FILE == fileType){
response.setContentType("application/vnd.ms-word;charset=UTF-8");
}else if(EXCEL_FILE == fileType){
response.setContentType("application/octet-stream;charset=UTF-8");
}else{
response.setContentType("application/octet-stream");
}
String ua = request.getHeader("user-agent");
ua = ua == null ? null : ua.toLowerCase();
if(ua != null && (ua.indexOf("firefox") > 0 || ua.indexOf("safari")>0)){
try {
docFileName = new String(docFileName.getBytes(),"ISO8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + docFileName);
} catch (Exception e) {
}
}else{
try {
docFileName = URLEncoder.encode(docFileName, "utf-8");
response.addHeader("Content-Disposition","attachment;filename=" + docFileName);
} catch (Exception e) {
}
}
check(request);
//解析模版
Template temp = cfg.getTemplate(templateName, "UTF-8");
PrintWriter write = response.getWriter();
try {
temp.process(rootMap, write);
} catch (TemplateException e) {
e.printStackTrace();
}finally {
if(write != null){
write.flush();
write.close();
}
}
}
}

@ -1,54 +0,0 @@
package com.jeecg.p3.demo.dao;
import org.jeecgframework.minidao.annotation.Param;
import org.jeecgframework.minidao.annotation.ResultType;
import org.jeecgframework.minidao.annotation.Sql;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
import org.springframework.stereotype.Repository;
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
/**
* P3
* @authorwww.jeecg.org
* @since20170515 200737
* @version:1.0
*/
@Repository
public interface JeecgP3demoDao{
/**
* Java
* @param id
* @return
*/
@Sql("SELECT * FROM jeecg_p3demo WHERE ID = :id")
JeecgP3demoEntity get(@Param("id") String id);
/**
*
* @param jeecgP3demo
* @return
*/
int update(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
/**
*
* @param act
*/
void insert(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
/**
* oraclemysqlSqlServerpostgresql
* @param jeecgP3demo
* @param page
* @param rows
* @return
*/
@ResultType(JeecgP3demoEntity.class)
public MiniDaoPage<JeecgP3demoEntity> getAll(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo,@Param("page") int page,@Param("rows") int rows);
@Sql("DELETE from jeecg_p3demo WHERE ID = :jeecgP3demo.id")
public void delete(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
}

@ -1,17 +0,0 @@
package com.jeecg.p3.demo.entity;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
/**
* P3
* @author: www.jeecg.org
* @since20170515 200737
* @version:1.0
*/
public class JeecgP3demoEntity implements Serializable{
private static final long serialVersionUID = 1L;
/** *id */ private String id; /** *创建人名称 */ private String createName; /** *创建人登录名称 */ private String createBy; /** *创建日期 */ private Date createDate; /** *更新人名称 */ private String updateName; /** *更新人登录名称 */ private String updateBy; /** *更新日期 */ private Date updateDate; /** *所属部门 */ private String sysOrgCode; /** *所属公司 */ private String sysCompanyCode; /** *流程状态 */ private String bpmStatus; /** *姓名 */ private String name; /** *性别 */ private Integer sex; /** *年龄 */ private Integer age; /** *地址 */ private String address; /** *电话 */ private String phone; /** *备注 */ private String memo; public String getId() { return this.id; } public void setId(String id) { this.id=id; } public String getCreateName() { return this.createName; } public void setCreateName(String createName) { this.createName=createName; } public String getCreateBy() { return this.createBy; } public void setCreateBy(String createBy) { this.createBy=createBy; } public Date getCreateDate() { return this.createDate; } public void setCreateDate(Date createDate) { this.createDate=createDate; } public String getUpdateName() { return this.updateName; } public void setUpdateName(String updateName) { this.updateName=updateName; } public String getUpdateBy() { return this.updateBy; } public void setUpdateBy(String updateBy) { this.updateBy=updateBy; } public Date getUpdateDate() { return this.updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate=updateDate; } public String getSysOrgCode() { return this.sysOrgCode; } public void setSysOrgCode(String sysOrgCode) { this.sysOrgCode=sysOrgCode; } public String getSysCompanyCode() { return this.sysCompanyCode; } public void setSysCompanyCode(String sysCompanyCode) { this.sysCompanyCode=sysCompanyCode; } public String getBpmStatus() { return this.bpmStatus; } public void setBpmStatus(String bpmStatus) { this.bpmStatus=bpmStatus; } public String getName() { return this.name; } public void setName(String name) { this.name=name; } public Integer getSex() { return this.sex; } public void setSex(Integer sex) { this.sex=sex; } public Integer getAge() { return this.age; } public void setAge(Integer age) { this.age=age; } public String getAddress() { return this.address; } public void setAddress(String address) { this.address=address; } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone=phone; } public String getMemo() { return this.memo; } public void setMemo(String memo) { this.memo=memo; }
}

@ -1,25 +0,0 @@
package com.jeecg.p3.demo.service;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
/**
* P3
* @author: www.jeecg.org
* @since20170515 200737
* @version:1.0
*/
public interface JeecgP3demoService {
public JeecgP3demoEntity get(String id);
public int update(JeecgP3demoEntity jeecgP3demo);
public void insert(JeecgP3demoEntity jeecgP3demo);
public MiniDaoPage<JeecgP3demoEntity> getAll(JeecgP3demoEntity jeecgP3demo,int page,int rows);
public void delete(JeecgP3demoEntity jeecgP3demo);
}

@ -1,50 +0,0 @@
package com.jeecg.p3.demo.service.impl;
import javax.annotation.Resource;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
import org.springframework.stereotype.Service;
import com.jeecg.p3.demo.dao.JeecgP3demoDao;
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
import com.jeecg.p3.demo.service.JeecgP3demoService;
/**
* P3
* @author: www.jeecg.org
* @since20170515 200737
* @version:1.0
*/
@Service("jeecgP3demoService")
public class JeecgP3demoServiceImpl implements JeecgP3demoService {
@Resource
private JeecgP3demoDao jeecgP3demoDao;
@Override
public JeecgP3demoEntity get(String id) {
return jeecgP3demoDao.get(id);
}
@Override
public int update(JeecgP3demoEntity jeecgP3demo) {
return jeecgP3demoDao.update(jeecgP3demo);
}
@Override
public void insert(JeecgP3demoEntity jeecgP3demo) {
jeecgP3demoDao.insert(jeecgP3demo);
}
@Override
public MiniDaoPage<JeecgP3demoEntity> getAll(JeecgP3demoEntity jeecgP3demo, int page, int rows) {
return jeecgP3demoDao.getAll(jeecgP3demo, page, rows);
}
@Override
public void delete(JeecgP3demoEntity jeecgP3demo) {
jeecgP3demoDao.delete(jeecgP3demo);
}
}

@ -1,60 +0,0 @@
<#if ( jeecgP3demo.createName )?? && jeecgP3demo.createName ?length gt 0>
/* 创建人名称 */
and jp.create_name = :jeecgP3demo.createName
</#if>
<#if ( jeecgP3demo.createBy )?? && jeecgP3demo.createBy ?length gt 0>
/* 创建人登录名称 */
and jp.create_by = :jeecgP3demo.createBy
</#if>
<#if ( jeecgP3demo.createDate )??>
/* 创建日期 */
and jp.create_date = :jeecgP3demo.createDate
</#if>
<#if ( jeecgP3demo.updateName )?? && jeecgP3demo.updateName ?length gt 0>
/* 更新人名称 */
and jp.update_name = :jeecgP3demo.updateName
</#if>
<#if ( jeecgP3demo.updateBy )?? && jeecgP3demo.updateBy ?length gt 0>
/* 更新人登录名称 */
and jp.update_by = :jeecgP3demo.updateBy
</#if>
<#if ( jeecgP3demo.updateDate )??>
/* 更新日期 */
and jp.update_date = :jeecgP3demo.updateDate
</#if>
<#if ( jeecgP3demo.sysOrgCode )?? && jeecgP3demo.sysOrgCode ?length gt 0>
/* 所属部门 */
and jp.sys_org_code = :jeecgP3demo.sysOrgCode
</#if>
<#if ( jeecgP3demo.sysCompanyCode )?? && jeecgP3demo.sysCompanyCode ?length gt 0>
/* 所属公司 */
and jp.sys_company_code = :jeecgP3demo.sysCompanyCode
</#if>
<#if ( jeecgP3demo.bpmStatus )?? && jeecgP3demo.bpmStatus ?length gt 0>
/* 流程状态 */
and jp.bpm_status = :jeecgP3demo.bpmStatus
</#if>
<#if ( jeecgP3demo.name )?? && jeecgP3demo.name ?length gt 0>
/* 姓名 */
and jp.name = :jeecgP3demo.name
</#if>
<#if ( jeecgP3demo.sex )?? && jeecgP3demo.sex ?length gt 0>
/* 性别 */
and jp.sex = :jeecgP3demo.sex
</#if>
<#if ( jeecgP3demo.age )?? && jeecgP3demo.age ?length gt 0>
/* 年龄 */
and jp.age = :jeecgP3demo.age
</#if>
<#if ( jeecgP3demo.address )?? && jeecgP3demo.address ?length gt 0>
/* 地址 */
and jp.address = :jeecgP3demo.address
</#if>
<#if ( jeecgP3demo.phone )?? && jeecgP3demo.phone ?length gt 0>
/* 电话 */
and jp.phone = :jeecgP3demo.phone
</#if>
<#if ( jeecgP3demo.memo )?? && jeecgP3demo.memo ?length gt 0>
/* 备注 */
and jp.memo = :jeecgP3demo.memo
</#if>

@ -1,2 +0,0 @@
SELECT * FROM jeecg_p3demo jp where 1=1
<#include "JeecgP3demoDao_condition.sql">

@ -1,39 +0,0 @@
INSERT INTO
jeecg_p3demo
(
id
,create_name
,create_by
,create_date
,update_name
,update_by
,update_date
,sys_org_code
,sys_company_code
,bpm_status
,name
,sex
,age
,address
,phone
,memo
)
values
(
:jeecgP3demo.id
,:jeecgP3demo.createName
,:jeecgP3demo.createBy
,:jeecgP3demo.createDate
,:jeecgP3demo.updateName
,:jeecgP3demo.updateBy
,:jeecgP3demo.updateDate
,:jeecgP3demo.sysOrgCode
,:jeecgP3demo.sysCompanyCode
,:jeecgP3demo.bpmStatus
,:jeecgP3demo.name
,:jeecgP3demo.sex
,:jeecgP3demo.age
,:jeecgP3demo.address
,:jeecgP3demo.phone
,:jeecgP3demo.memo
)

@ -1,48 +0,0 @@
UPDATE jeecg_p3demo
SET
<#if jeecgP3demo.createName ?exists>
create_name = :jeecgP3demo.createName,
</#if>
<#if jeecgP3demo.createBy ?exists>
create_by = :jeecgP3demo.createBy,
</#if>
<#if jeecgP3demo.createDate ?exists>
create_date = :jeecgP3demo.createDate,
</#if>
<#if jeecgP3demo.updateName ?exists>
update_name = :jeecgP3demo.updateName,
</#if>
<#if jeecgP3demo.updateBy ?exists>
update_by = :jeecgP3demo.updateBy,
</#if>
<#if jeecgP3demo.updateDate ?exists>
update_date = :jeecgP3demo.updateDate,
</#if>
<#if jeecgP3demo.sysOrgCode ?exists>
sys_org_code = :jeecgP3demo.sysOrgCode,
</#if>
<#if jeecgP3demo.sysCompanyCode ?exists>
sys_company_code = :jeecgP3demo.sysCompanyCode,
</#if>
<#if jeecgP3demo.bpmStatus ?exists>
bpm_status = :jeecgP3demo.bpmStatus,
</#if>
<#if jeecgP3demo.name ?exists>
name = :jeecgP3demo.name,
</#if>
<#if jeecgP3demo.sex ?exists>
sex = :jeecgP3demo.sex,
</#if>
<#if jeecgP3demo.age ?exists>
age = :jeecgP3demo.age,
</#if>
<#if jeecgP3demo.address ?exists>
address = :jeecgP3demo.address,
</#if>
<#if jeecgP3demo.phone ?exists>
phone = :jeecgP3demo.phone,
</#if>
<#if jeecgP3demo.memo ?exists>
memo = :jeecgP3demo.memo,
</#if>
WHERE id = :jeecgP3demo.id

@ -1,160 +0,0 @@
package com.jeecg.p3.demo.web;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.velocity.VelocityContext;
import org.jeecgframework.minidao.pojo.MiniDaoPage;
import org.jeecgframework.p3.core.common.utils.AjaxJson;
import org.jeecgframework.p3.core.page.SystemTools;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.p3.core.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
import com.jeecg.p3.demo.service.JeecgP3demoService;
/**
* P3
* @author: www.jeecg.org
* @since20170515 200737
* @version:1.0
*/
@Controller
@RequestMapping("/demo/jeecgP3demo")
public class JeecgP3demoController extends BaseController{
@Autowired
private JeecgP3demoService jeecgP3demoService;
/**
*
* @return
*/
@RequestMapping(params = "list",method = {RequestMethod.GET,RequestMethod.POST})
public void list(@ModelAttribute JeecgP3demoEntity query,HttpServletRequest request,HttpServletResponse response,
@RequestParam(required = false, value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(required = false, value = "pageSize", defaultValue = "10") int pageSize) throws Exception{
try {
LOG.info(request, " back list");
//分页数据
MiniDaoPage<JeecgP3demoEntity> list = jeecgP3demoService.getAll(query,pageNo,pageSize);
VelocityContext velocityContext = new VelocityContext();
velocityContext.put("jeecgP3demo",query);
velocityContext.put("pageInfos",SystemTools.convertPaginatedList(list));
String viewName = "demo/p3/jeecgP3demo-list.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @return
*/
@RequestMapping(params="toDetail",method = RequestMethod.GET)
public void jeecgP3demoDetail(@RequestParam(required = true, value = "id" ) String id,HttpServletResponse response,HttpServletRequest request)throws Exception{
VelocityContext velocityContext = new VelocityContext();
String viewName = "demo/p3/jeecgP3demo-detail.vm";
JeecgP3demoEntity jeecgP3demo = jeecgP3demoService.get(id);
velocityContext.put("jeecgP3demo",jeecgP3demo);
ViewVelocity.view(request,response,viewName,velocityContext);
}
/**
*
* @return
*/
@RequestMapping(params = "toAdd",method ={RequestMethod.GET, RequestMethod.POST})
public void toAddDialog(HttpServletRequest request,HttpServletResponse response)throws Exception{
VelocityContext velocityContext = new VelocityContext();
String viewName = "demo/p3/jeecgP3demo-add.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/**
*
* @return
*/
@RequestMapping(params = "doAdd",method ={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doAdd(@ModelAttribute JeecgP3demoEntity jeecgP3demo){
AjaxJson j = new AjaxJson();
try {
String randomSeed = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
jeecgP3demo.setId(randomSeed);
jeecgP3demoService.insert(jeecgP3demo);
j.setMsg("保存成功");
} catch (Exception e) {
log.info(e.getMessage());
j.setSuccess(false);
j.setMsg("保存失败");
}
return j;
}
/**
*
* @return
*/
@RequestMapping(params="toEdit",method = RequestMethod.GET)
public void toEdit(@RequestParam(required = true, value = "id" ) String id,HttpServletResponse response,HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
JeecgP3demoEntity jeecgP3demo = jeecgP3demoService.get(id);
velocityContext.put("jeecgP3demo",jeecgP3demo);
String viewName = "demo/p3/jeecgP3demo-edit.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/**
*
* @return
*/
@RequestMapping(params = "doEdit",method ={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doEdit(@ModelAttribute JeecgP3demoEntity jeecgP3demo){
AjaxJson j = new AjaxJson();
try {
jeecgP3demoService.update(jeecgP3demo);
j.setMsg("编辑成功");
} catch (Exception e) {
log.info(e.getMessage());
j.setSuccess(false);
j.setMsg("编辑失败");
}
return j;
}
/**
*
* @return
*/
@RequestMapping(params="doDelete",method = RequestMethod.GET)
@ResponseBody
public AjaxJson doDelete(@RequestParam(required = true, value = "id" ) String id){
AjaxJson j = new AjaxJson();
try {
JeecgP3demoEntity jeecgP3demo = new JeecgP3demoEntity();
jeecgP3demo.setId(id);
jeecgP3demoService.delete(jeecgP3demo);
j.setMsg("删除成功");
} catch (Exception e) {
log.info(e.getMessage());
j.setSuccess(false);
j.setMsg("删除失败");
}
return j;
}
}

@ -21,6 +21,7 @@ public @interface Ehcache {
// 增加缓存还是删除缓存,默认为增加缓存
boolean addOrdel() default true;
//临时缓存还是永久缓存,默认为永久缓存
//临时缓存还是永久缓存,默认为缓存缓存
//TODO 默认临时缓存,不支持永久缓存(可根据实际情况拓展)
boolean eternal() default true;
}

@ -16,5 +16,5 @@ import org.jeecgframework.core.enums.Permission;
@Documented
public @interface JAuth {
String value() default "";
Permission auth() default Permission.NORMAL;
Permission auth() default Permission.SKIP_AUTH;
}

@ -1,121 +1,97 @@
package org.jeecgframework.core.aop;
import java.io.Serializable;
import java.lang.reflect.Method;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jeecgframework.core.annotation.Ehcache;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.system.service.CacheServiceI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
/**
*
* @author
*
* @TODO -
* Ehcache
*/
@Component
@Aspect
//@Component
//@Aspect
public class EhcacheAspect {
// private static Cache dictCache;
// private static Cache eternalCache;
//
// static {
// if (eternalCache == null) {
// eternalCache = CacheManager.getInstance().getCache("eternalCache");
// }
// if (dictCache == null) {
// dictCache = CacheManager.getInstance().getCache("dictCache");
// }
// }
private static final Logger logger = LoggerFactory.getLogger(EhcacheAspect.class);
private static Cache SYSTEM_BASE_CACHE = CacheManager.getInstance().getCache(CacheServiceI.SYSTEM_BASE_CACHE);
private static Cache SYS_AUTH_CACHE = CacheManager.getInstance().getCache(CacheServiceI.SYS_AUTH_CACHE);
@Pointcut("@annotation(org.jeecgframework.core.annotation.Ehcache)")
public void simplePointcut() {
}
@AfterReturning(pointcut = "simplePointcut()")
public void simpleAdvice() {
}
@Around("simplePointcut()")
public Object aroundLogCalls(ProceedingJoinPoint joinPoint)
throws Throwable {
Cache eternalCache = CacheManager.getInstance().getCache("eternalCache");
Cache dictCache = CacheManager.getInstance().getCache("eternalCache");
String targetName = joinPoint.getTarget().getClass().toString();
@Around("simplePointcut() && @annotation(ehcache)")
public Object aroundLogCalls(ProceedingJoinPoint joinPoint,Ehcache ehcache)throws Throwable {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
Object[] arguments = joinPoint.getArgs();
//试图得到标注的Ehcache类
@SuppressWarnings("unused")
Method[] methods = joinPoint.getTarget().getClass().getMethods();
Ehcache flag = null;
for(Method m:methods){
if(m.getName().equals(methodName)){
Class[] tmpCs = m.getParameterTypes();
if(tmpCs.length==arguments.length){
flag = m.getAnnotation(Ehcache.class);
break;
}
}
}
if(flag==null){
return null;
}
//Ehcache flag =joinPoint.getTarget().getClass().getMethod(methodName).getAnnotation(Ehcache.class);
logger.debug("-------ehcache[aspect]-----------targetclass:[{}] , methodName:[{}] , arguments:[{}] ", new Object[] {targetName,methodName,arguments});
Cache cache = null;
Object result;
String cacheKey = getCacheKey(targetName, methodName, arguments);
Element element = null;
if(flag.eternal()){
//永久缓存
element = dictCache.get(cacheKey);
if(oConvertUtils.isNotEmpty(ehcache.cacheName()) && CacheServiceI.SYS_AUTH_CACHE.equals(ehcache.cacheName())){
//自定义缓存对象
cache = this.SYS_AUTH_CACHE;
}else{
//临时缓存
element = eternalCache.get(cacheKey);
//默认缓存对象
cache = this.SYSTEM_BASE_CACHE;
}
//获取缓存
element = cache.get(cacheKey);
if (element == null) {
if ((arguments != null) && (arguments.length != 0)) {
if ((arguments != null && arguments.length != 0)) {
result = joinPoint.proceed(arguments);
} else {
result = joinPoint.proceed();
}
element = new Element(cacheKey, (Serializable) result);
if(flag.eternal()){
//永久缓存
dictCache.put(element);
}else{
//临时缓存
eternalCache.put(element);
}
//设置缓存
cache.put(element);
logger.debug("-------ehcache[aspect]----------设置缓存成功---");
}
return element.getValue();
}
/**
* cache keycache keyCacheElement cache key
* ++com.co.cache.service.UserServiceImpl.getAllUser
* cache key
* cache key: ++
* com.co.cache.service.UserServiceImpl.getAllUser
*/
private String getCacheKey(String targetName, String methodName,
Object[] arguments) {
private String getCacheKey(String targetName, String methodName, Object[] arguments) {
StringBuffer sb = new StringBuffer();
sb.append(targetName).append(".").append(methodName);
if ((arguments != null) && (arguments.length != 0)) {
if ((arguments != null && arguments.length != 0)) {
for (int i = 0; i < arguments.length; i++) {
sb.append(".").append(JSON.toJSONString(arguments[i]));
if (arguments[i] instanceof String[]) {
String[] strArray = (String[]) arguments[i];
sb.append(".");
for (String str : strArray) {
sb.append(str);
}
} else {
sb.append(".").append(arguments[i]);
}
}
}
return sb.toString();

@ -0,0 +1,96 @@
package org.jeecgframework.core.aop;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jeecgframework.core.annotation.Ehcache;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
/**
* redisAOP
* @author Yandong
*/
//@Component
//@Aspect
public class RedisCacheAspect {
//TODO ?
@Resource
private RedisTemplate redisTemplate;
@Pointcut("@annotation(org.jeecgframework.core.annotation.Ehcache)")
public void simplePointcut() {}
@Around("simplePointcut() && @annotation(ehcache)")
public Object aroundLogCalls(ProceedingJoinPoint joinPoint,Ehcache ehcache)throws Throwable {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
String cacheKey ="";
if(StringUtils.isNotBlank(ehcache.cacheName())){
cacheKey=ehcache.cacheName();
}else{
cacheKey=getCacheKey(targetName, methodName, arguments);
}
Object result=null;
BoundValueOperations<String,Object> valueOps = redisTemplate.boundValueOps(cacheKey);
if(ehcache.eternal()){
//永久缓存
result = valueOps.get();
}else{
//临时缓存
result = valueOps.get();
valueOps.expire(20, TimeUnit.MINUTES);
}
if (result == null) {
if ((arguments != null) && (arguments.length != 0)) {
result = joinPoint.proceed(arguments);
} else {
result = joinPoint.proceed();
}
if(ehcache.eternal()){
//永久缓存
valueOps.set(result);
}else{
//临时缓存
valueOps.set(result,20, TimeUnit.MINUTES);
}
}
return result;
}
/**
* cache key
* cache key: ++
* com.co.cache.service.UserServiceImpl.getAllUser
*/
private String getCacheKey(String targetName, String methodName,Object[] arguments) {
StringBuffer sb = new StringBuffer();
sb.append(targetName).append(".").append(methodName);
if ((arguments != null) && (arguments.length != 0)) {
for (int i = 0; i < arguments.length; i++) {
if (arguments[i] instanceof String[]) {
String[] strArray = (String[]) arguments[i];
sb.append(".");
for (String str : strArray) {
sb.append(str);
}
} else {
sb.append(".").append(arguments[i]);
}
}
}
return sb.toString();
}
}

@ -0,0 +1,45 @@
package org.jeecgframework.core.common.controller;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.springframework.util.StringUtils;
/**
* @RequestBodyjsonJackson Date
* @author scott
*
*/
public class CustomJsonDateDeserializer extends JsonDeserializer<Date> {
private SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@Override
public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
String text = jp.getText();
if (StringUtils.hasText(text)) {
try {
if (text.indexOf(":") == -1 && text.length() == 10) {
return this.dateFormat.parse(text);
} else if (text.indexOf(":") > 0 && text.length() == 19) {
return this.datetimeFormat.parse(text);
} else {
throw new IllegalArgumentException("Could not parse date, date format is error ");
}
} catch (ParseException ex) {
IllegalArgumentException iae = new IllegalArgumentException("Could not parse date: " + ex.getMessage());
iae.initCause(ex);
throw iae;
}
} else {
return null;
}
}
}

@ -0,0 +1,38 @@
package org.jeecgframework.core.common.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.ser.CustomSerializerFactory;
/**
* @description @ResponseBodyjsonDATE
* @author scott
* @date 2013-5-28
*/
public class CustomObjectMapper extends ObjectMapper {
public CustomObjectMapper() {
CustomSerializerFactory factory = new CustomSerializerFactory();
factory.addGenericMapping(Date.class, new JsonSerializer<Date>() {
@Override
public void serialize(Date value, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdf.format(value);
if (dateStr.endsWith(" 00:00:00")) {
dateStr = dateStr.substring(0, 10);
} else if (dateStr.endsWith(":00")) {
dateStr = dateStr.substring(0, 16);
}
jsonGenerator.writeString(dateStr);
}
});
this.setSerializerFactory(factory);
}
}

@ -29,6 +29,7 @@ public interface ICommonDao extends IGenericBaseCommonDao{
*
* */
public TSUser getUserByUserIdAndUserNameExits(TSUser user);
public TSUser findUserByAccountAndPassword(String username,String password);
public String getUserRole(TSUser user);
/**
*
@ -66,6 +67,6 @@ public interface ICommonDao extends IGenericBaseCommonDao{
*/
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive);
public List<TreeGrid> treegrid(List all,TreeGridModel treeGridModel);
public List<TreeGrid> treegrid(List<?> all,TreeGridModel treeGridModel);
}

@ -69,6 +69,23 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
return null;
}
/**
*
* */
public TSUser findUserByAccountAndPassword(String username,String inpassword) {
String password = PasswordUtil.encrypt(username, inpassword, PasswordUtil.getStaticSalt());
String query = "from TSUser u where u.userName = :username and u.password=:passowrd";
Query queryObject = getSession().createQuery(query);
queryObject.setParameter("username", username);
queryObject.setParameter("passowrd", password);
@SuppressWarnings("unchecked")
List<TSUser> users = queryObject.list();
if (users != null && users.size() > 0) {
return users.get(0);
}
return null;
}
/**
* admin
*/
@ -106,9 +123,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
@SuppressWarnings("unchecked")
public Object uploadFile(UploadFile uploadFile) {
Object object = uploadFile.getObject();
if(uploadFile.getFileKey()!=null && !"TSDocument".equals(object.getClass().getSimpleName()))
if(uploadFile.getFileKey()!=null)
{
updateEntitie(object);
}
@ -241,12 +256,16 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
// SwfToolsUtil.convert2SWF(savePath);
// }
// FileCopyUtils.copy(mf.getBytes(), savefile);
if (uploadFile.getSwfpath() != null) {
//默认上传文件是否转换为swf实现在线预览功能开关
String globalSwfTransformFlag = ResourceUtil.getConfigByName("swf.transform.flag");
if ( "true".equals(globalSwfTransformFlag) && uploadFile.getSwfpath() != null) {
// 转SWF
reflectHelper.setMethodValue(uploadFile.getSwfpath(), path + FileUtils.getFilePrefix(myfilename) + ".swf");
SwfToolsUtil.convert2SWF(savePath);
}
}
} catch (Exception e1) {
}
@ -280,20 +299,21 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
String ctxPath = request.getSession().getServletContext().getRealPath("/");
String downLoadPath = "";
long fileLength = 0;
if (uploadFile.getRealPath() != null&&uploadFile.getContent() == null) {
downLoadPath = ctxPath + uploadFile.getRealPath();
fileLength = new File(downLoadPath).length();
try {
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} else {
if (uploadFile.getContent() != null)
bis = new ByteArrayInputStream(uploadFile.getContent());
fileLength = uploadFile.getContent().length;
}
try {
if (uploadFile.getRealPath() != null&&uploadFile.getContent() == null) {
downLoadPath = ctxPath + uploadFile.getRealPath();
fileLength = new File(downLoadPath).length();
try {
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} else {
if (uploadFile.getContent() != null)
bis = new ByteArrayInputStream(uploadFile.getContent());
fileLength = uploadFile.getContent().length;
}
if (!uploadFile.isView() && uploadFile.getExtend() != null) {
if (uploadFile.getExtend().equals("text")) {
response.setContentType("text/plain;");
@ -562,7 +582,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
/**
*
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel) {
public List<TreeGrid> treegrid(List<?> all, TreeGridModel treeGridModel) {
List<TreeGrid> treegrid = new ArrayList<TreeGrid>();
for (Object obj : all) {
ReflectHelper reflectHelper = new ReflectHelper(obj);

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -33,12 +34,10 @@ import org.jeecgframework.core.common.dao.IGenericBaseCommonDao;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.hibernate.qbc.DetachedCriteriaUtil;
import org.jeecgframework.core.common.hibernate.qbc.HqlQuery;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.hibernate.qbc.PagerUtil;
import org.jeecgframework.core.common.model.common.DBTable;
import org.jeecgframework.core.common.model.json.DataGridReturn;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.ToEntityUtil;
@ -682,7 +681,10 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
} else {
pageSize = allCounts;
}
DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(), cq.getField().split(","), cq.getEntityClass(), false);
//DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(), cq.getField().split(","), cq.getEntityClass(), false);
return new DataTableReturn(allCounts, allCounts, cq.getDataTables().getEcho(), criteria.list());
}
@ -696,35 +698,51 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
CriteriaImpl impl = (CriteriaImpl) criteria;
// 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
Projection projection = impl.getProjection();
final int allCounts = ((Long) criteria.setProjection(Projections.rowCount()).uniqueResult()).intValue();
// final int allCounts = ((Long) criteria.setProjection(Projections.rowCount()).uniqueResult()).intValue();
Object allCountsObj = criteria.setProjection(Projections.rowCount()).uniqueResult();
final int allCounts;
if(allCountsObj==null){
allCounts = 0;
}else{
allCounts = ((Long) allCountsObj).intValue();
}
criteria.setProjection(projection);
if (projection == null) {
criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
}
if (StringUtils.isNotBlank(cq.getDataGrid().getSort())) {
String []sortArr = cq.getDataGrid().getSort().split(",");
Map<String, Object> ordermap = cq.getOrdermap();
if(ordermap==null){
ordermap = new LinkedHashMap<String, Object>();
}
String sort = cq.getDataGrid().getSort();
if (StringUtils.isNotBlank(sort)) {
String []sortArr = sort.split(",");
String []orderArr = cq.getDataGrid().getOrder().split(",");
if(sortArr.length==orderArr.length){
for(int i=0;i<sortArr.length;i++){
// cq.addOrder(sortArr[i], SortDirection.toEnum(orderArr[i]));
if (SortDirection.asc.equals(SortDirection.toEnum(orderArr[i]))) {
cq.getDetachedCriteria().addOrder(Order.asc(sortArr[i]));
} else {
cq.getDetachedCriteria().addOrder(Order.desc(sortArr[i]));
if(sortArr.length != orderArr.length && orderArr.length > 0){
for (int i = 0; i < sortArr.length; i++) {
if(SortDirection.asc.equals(SortDirection.toEnum(orderArr[0]))){
ordermap.put(sortArr[i], SortDirection.asc);
}else{
ordermap.put(sortArr[i], SortDirection.desc);
}
}
}else if(orderArr.length>0){
for(int i=0;i<sortArr.length;i++){
// cq.addOrder(sortArr[i], SortDirection.toEnum(orderArr[0]));
if (SortDirection.asc.equals(SortDirection.toEnum(orderArr[0]))) {
cq.getDetachedCriteria().addOrder(Order.asc(sortArr[i]));
} else {
cq.getDetachedCriteria().addOrder(Order.desc(sortArr[i]));
}else if(sortArr.length == orderArr.length){
for (int i = 0; i < sortArr.length; i++) {
if(SortDirection.asc.equals(SortDirection.toEnum(orderArr[i]))){
ordermap.put(sortArr[i], SortDirection.asc);
}else{
ordermap.put(sortArr[i], SortDirection.desc);
}
}
}
}
if(!ordermap.isEmpty() && ordermap.size()>0){
cq.setOrder(ordermap);
}
// 判断是否有排序字段

@ -135,7 +135,16 @@ public class JdbcDao extends SimpleJdbcTemplate{
sql = jeecgCreatePageSql(sql,page,rows);
return this.jdbcTemplate.queryForList(sql);
}
/**
* 使
*/
public List<Map<String, Object>> findForListMap(String sql, Map parameters, int page, int rows) {
//封装分页SQL
sql = jeecgCreatePageSql(sql,page,rows);
return super.findForListMap(sql, parameters);
}
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
return this.jdbcTemplate.queryForList(sql,objs);

@ -46,7 +46,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
Assert.hasText(sql,"sql语句不正确!");
Assert.notNull(clazz,"集合中对象类型不能为空!");
if(parameters!=null){
return jdbcTemplate.query(sql, resultBeanMapper(clazz),parameters);
// return jdbcTemplate.query(sql, resultBeanMapper(clazz),parameters);
return namedJdbcTemplate.query(sql, parameters, resultBeanMapper(clazz));
}else{
return jdbcTemplate.query(sql, resultBeanMapper(clazz));
}
@ -67,7 +70,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
Assert.hasText(sql,"sql语句不正确!");
Assert.notNull(clazz,"集合中对象类型不能为空!");
if(parameters!=null){
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters);
// return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters);
return namedJdbcTemplate.queryForObject(sql, parameters, resultBeanMapper(clazz));
}else{
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz),Long.class);
@ -110,7 +116,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
try{
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.queryForMap(sql, parameters);
// return jdbcTemplate.queryForMap(sql, parameters);
return namedJdbcTemplate.queryForMap(sql, parameters);
}else{
return jdbcTemplate.queryForMap(sql);
}
@ -130,7 +139,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
try{
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.queryForList(sql, parameters);
// return jdbcTemplate.queryForList(sql, parameters);
return namedJdbcTemplate.queryForList(sql, parameters);
}else{
return jdbcTemplate.queryForList(sql);
}
@ -149,7 +161,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
public int executeForObject(final String sql,Object bean){
Assert.hasText(sql,"sql语句不正确!");
if(bean!=null){
return jdbcTemplate.update(sql, paramBeanMapper(bean));
// return jdbcTemplate.update(sql, paramBeanMapper(bean));
return namedJdbcTemplate.update(sql, paramBeanMapper(bean));
}else{
return jdbcTemplate.update(sql);
}
@ -165,7 +180,10 @@ public class SimpleJdbcTemplate extends JdbcTemplate{
public int executeForMap(final String sql,Map parameters){
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.update(sql, parameters);
// return jdbcTemplate.update(sql, parameters);
return namedJdbcTemplate.update(sql, parameters);
}else{
return jdbcTemplate.update(sql);
}

@ -7,7 +7,10 @@ import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.GenericGenerator;
@MappedSuperclass
public abstract class IdEntity {
public abstract class IdEntity implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String id;
@Id

@ -105,7 +105,7 @@ public class GlobalExceptionResolver implements HandlerExceptionResolver {
exceptionMessage = exceptionMessage.substring(0,WIRTE_DB_MAX_LENGTH);
}
}
systemService.addLog(exceptionMessage, LOG_LEVEL, LOG_OPT);
systemService.addLog(exceptionMessage, LOG_OPT,LOG_LEVEL);
}
/**
* ajax.
@ -132,7 +132,10 @@ public class GlobalExceptionResolver implements HandlerExceptionResolver {
} catch (IOException e) {
e.printStackTrace();
}finally{
pw.close();
try {
pw.close();
} catch (Exception e2) {
}
}
empty.clear();
return empty;

@ -1,67 +1,67 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import ognl.Ognl;
import org.hibernate.HibernateException;
import org.hibernate.transform.ResultTransformer;
import com.opensymphony.xwork2.ognl.OgnlUtil;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
/**
* xwork-core-2.1.6.jar
*
* 2009-3-30
* @author
*/
public class AliasToBean implements ResultTransformer {
private static final long serialVersionUID = 1L;
private static final OgnlUtil ognlUntil = new OgnlUtil();
private static final Map<String,Boolean> context = new HashMap<String,Boolean>(1);
static{
context.put(ReflectionContextState.CREATE_NULL_OBJECTS, true);
}
/** POJO的class */
private final Class<?> resultClass;
public AliasToBean(Class<?> pojoClass) {
if(pojoClass==null) throw new IllegalArgumentException("resultClass cannot be null");
this.resultClass = pojoClass;
}
@SuppressWarnings("unchecked")
public List transformList(List collection) {
return collection;
}
/**
*
* 2009-4-7
* @author
* @param tuple
* @param aliases
* @return POJO--
*/
public Object transformTuple(Object[] tuple, String[] aliases) {
try {
Object root = resultClass.newInstance();
for (int i = 0; i < aliases.length; i++) {
if(aliases[i]!=null && !aliases[i].equals(""))
{
Ognl.setValue(ognlUntil.compile(aliases[i]), context, root, tuple[i]);
}
}
return root;
} catch (Exception e) {
throw new HibernateException(e.getMessage(),e);
}
}
}
//package org.jeecgframework.core.common.hibernate.qbc;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import ognl.Ognl;
//
//import org.hibernate.HibernateException;
//import org.hibernate.transform.ResultTransformer;
//
//import com.opensymphony.xwork2.ognl.OgnlUtil;
//import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
//
///**
// * 此版本运行在xwork-core-2.1.6.jar
// * 支持属性为自定义对象的结果集转换的部份属性查询
// * 2009-3-30
// * @author 苍鹰
// */
//public class AliasToBean implements ResultTransformer {
// private static final long serialVersionUID = 1L;
// private static final OgnlUtil ognlUntil = new OgnlUtil();
// private static final Map<String,Boolean> context = new HashMap<String,Boolean>(1);
// static{
// context.put(ReflectionContextState.CREATE_NULL_OBJECTS, true);
// }
//
// /** POJO的class */
// private final Class<?> resultClass;
//
// public AliasToBean(Class<?> pojoClass) {
// if(pojoClass==null) throw new IllegalArgumentException("resultClass cannot be null");
// this.resultClass = pojoClass;
// }
//
// @SuppressWarnings("unchecked")
//
// public List transformList(List collection) {
// return collection;
// }
//
// /**
// * 结果集转换
// * 2009-4-7
// * @author 苍鹰
// * @param tuple 属性值集合
// * @param aliases 属性名集合
// * @return 单个POJO实例--查询结果
// */
//
// public Object transformTuple(Object[] tuple, String[] aliases) {
// try {
// Object root = resultClass.newInstance();
// for (int i = 0; i < aliases.length; i++) {
// if(aliases[i]!=null && !aliases[i].equals(""))
// {
// Ognl.setValue(ognlUntil.compile(aliases[i]), context, root, tuple[i]);
// }
// }
// return root;
// } catch (Exception e) {
// throw new HibernateException(e.getMessage(),e);
// }
// }
//
//}

@ -2,6 +2,7 @@ package org.jeecgframework.core.common.hibernate.qbc;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -14,6 +15,7 @@ import org.hibernate.transform.Transformers;
import org.hibernate.type.Type;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.vo.datatable.DataTables;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.tag.vo.datatable.SortInfo;
@ -39,8 +41,8 @@ public class CriteriaQuery {
private CriterionList jqcriterionList=new CriterionList();//jquery datatable控件生成查询条件集合
private int isUseimage = 0;// 翻页工具条样式
private DetachedCriteria detachedCriteria;
private static Map<String, Object> map;
private static Map<String, Object> ordermap;//排序字段
private Map<String, Object> map;
private Map<String, Object> ordermap;//排序字段
private boolean flag = true;// 对同一字段进行第二次重命名查询时值设置FASLE不保存重命名查询条件
private String field="";//查询需要显示的字段
private Class<?> entityClass;//POJO
@ -100,7 +102,9 @@ public class CriteriaQuery {
public CriteriaQuery(Class<?> c) {
this.detachedCriteria = DetachedCriteria.forClass(c);
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
this.ordermap = new LinkedHashMap<String, Object>();
}
public CriteriaQuery(Class<?> c, int curPage, String myAction, String myForm) {
@ -115,7 +119,9 @@ public class CriteriaQuery {
this.curPage = curPage;
this.detachedCriteria = DetachedCriteria.forClass(c);
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
this.ordermap = new LinkedHashMap<String, Object>();
}
public CriteriaQuery(Class<?> entityClass, int curPage) {
@ -136,20 +142,28 @@ public class CriteriaQuery {
this.dataGrid=dg;
this.pageSize=dg.getRows();
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
this.ordermap = new LinkedHashMap<String, Object>();
}
// 【scott 20180526 删除无用代码|xwork-core】
public CriteriaQuery(Class entityClass,DataTables dataTables) {
this.curPage = dataTables.getDisplayStart();
String[] fieldstring=dataTables.getsColumns().split(",");
this.detachedCriteria = DetachedCriteriaUtil
.createDetachedCriteria(entityClass, "start", "_table",fieldstring);
//this.detachedCriteria = DetachedCriteria.forClass(c);
this.detachedCriteria = DetachedCriteria.forClass(entityClass);
//this.detachedCriteria = DetachedCriteriaUtil.createDetachedCriteria(entityClass, "start", "_table",fieldstring);
this.field=dataTables.getsColumns();
this.entityClass=entityClass;
this.dataTables=dataTables;
this.pageSize=dataTables.getDisplayLength();
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
this.ordermap = new LinkedHashMap<String, Object>();
addJqCriteria(dataTables);
}
@ -396,12 +410,12 @@ public class CriteriaQuery {
}
}
public static Map<String, Object> getOrdermap() {
public Map<String, Object> getOrdermap() {
return ordermap;
}
public static void setOrdermap(Map<String, Object> ordermap) {
CriteriaQuery.ordermap = ordermap;
public void setOrdermap(Map<String, Object> ordermap) {
this.ordermap = ordermap;
}
/**
@ -583,11 +597,11 @@ public class CriteriaQuery {
public void between(String keyname, Object keyvalue1, Object keyvalue2) {
Criterion c = null;// 写入between查询条件
if (!keyvalue1.equals(null) && !keyvalue2.equals(null)) {
if (oConvertUtils.isNotEmpty(keyvalue1) && oConvertUtils.isNotEmpty(keyvalue2)) {
c = Restrictions.between(keyname, keyvalue1, keyvalue2);
} else if (!keyvalue1.equals(null)) {
} else if (oConvertUtils.isNotEmpty(keyvalue1)) {
c = Restrictions.ge(keyname, keyvalue1);
} else if (!keyvalue2.equals(null)) {
} else if (oConvertUtils.isNotEmpty(keyvalue2)) {
c = Restrictions.le(keyname, keyvalue2);
}
criterionList.add(c);

@ -1,253 +1,253 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.hibernate.FetchMode;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projection;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import org.hibernate.transform.Transformers;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
/**
* Hibernate
*/
public class DetachedCriteriaUtil {
/** 小写字母X */
public static final String MIDDLE_SEPRATOR_CHAR = "x";
/** 两个空格 */
public static final String SEPARATOR_TWO_SPACE = " ";// 两个空格,避免和"日期 时间"中的空格混淆
/** 此字符串内容为" <= x <= ",不包括引号 */
static public ProjectionList projectionList;
public static ProjectionList getProjectionList() {
return projectionList;
}
private DetachedCriteriaUtil(){
//do not allow to create Object
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param alias
*
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias) {
return createDetachedCriteria(pojoClazz, startChar, alias,null);
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param alias
*
* @param columnNames
* select
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias,String[] columnNames) {
return createDetachedCriteria(pojoClazz, startChar, alias, columnNames, null);
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param columnNames
* select
* @param excludeParameters
*
* @param alias
*
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias,String[] columnNames,String[] excludeParameters) {
DetachedCriteria criteria = DetachedCriteria.forClass(pojoClazz,alias);
if(columnNames!=null && columnNames.length>0){
//selectColumn(criteria, columnNames, pojoClazz, false);
}
return criteria;
}
private static final String ALIAS_KEY_IN_REQUEST = "ALIAS_KEY_IN_REQUEST";
private static final String HAS_JOIN_TABLE_KEY_IN_REQUEST = "HAS_JOIN_TABLE_KEY_IN_REQUEST";
private static void setAliasToRequest(HttpServletRequest request,Set<String> aliases) {
request.setAttribute(ALIAS_KEY_IN_REQUEST, aliases);
}
@SuppressWarnings("unchecked")
private static Set<String> getAliasesFromRequest(){
Set<String> aliases = (Set<String>) ContextHolderUtils.getRequest().getAttribute(ALIAS_KEY_IN_REQUEST);
if(aliases==null){
aliases = new HashSet<String>(5);
setAliasToRequest(ContextHolderUtils.getRequest(), aliases);
}
return aliases;
}
private static boolean getHasJoinTatleFromRequest(){
Boolean hasJoin = (Boolean) ContextHolderUtils.getRequest().getAttribute(HAS_JOIN_TABLE_KEY_IN_REQUEST);
return hasJoin==null?false:hasJoin;
}
/**
* DetachedCriteria 2008-9-29
* 2009.9.9
* user.organization.parentOrganization.parentOrganization.orgName
* 1 ,
* @author
* @param columnNames
* String[] column={"属性1","属性2","属性3"};
* @param pojoClass
* Class,Mobile.class;
* @param aials
* POJO
* @return DetachedCriteria
*
* @param forJoinTable
*/
public static void selectColumn(DetachedCriteria criteria, String[] columnNames,
Class<?> pojoClass,boolean forJoinTable) {
if (null == columnNames) {
return;
}
//使用这个临时变量集合是因为dinstinct关键字要放在最前面而distinct关键字要在下面才决定放不放
List<Projection> tempProjectionList = new ArrayList<Projection>();
Set<String> aliases = getAliasesFromRequest();
boolean hasJoniTable = false;
String rootAlias = criteria.getAlias();
for (String property : columnNames) {
if(property.contains("_")){
String[] propertyChain = property.split("_");
createAlias(criteria,rootAlias,aliases,propertyChain,0);
tempProjectionList.add(Projections.property(StringUtil.getProperty(property)).as(StringUtil.getProperty(property)));
hasJoniTable = true;
}else{
tempProjectionList.add(Projections.property(rootAlias + POINT + property).as(property));
}
}
projectionList = Projections.projectionList();
if(hasJoniTable || forJoinTable || getHasJoinTatleFromRequest()){//这个一定要放在tempProjectionList的前面因为distinct要在最前面
projectionList.add(Projections.distinct(Projections.id()));
}
for (Projection proj : tempProjectionList) {
projectionList.add(proj);
}
criteria.setProjection(projectionList);
if(!hasJoniTable){
criteria.setResultTransformer(Transformers.aliasToBean(pojoClass));
}else{//下面这个是自定义的结果转换器
criteria.setResultTransformer(new AliasToBean(pojoClass));
}
}
private static final String POINT = ".";
/**
*
* @author
* 2009-9-9
* @param criteria
* @param rootAlais
* @param aliases
* @param columns
* @param currentStep
*/
private static void createAlias(DetachedCriteria criteria, String rootAlais, Set<String> aliases,String[] columns,int currentStep){
if(currentStep<columns.length-1){
if(!aliases.contains(converArrayToAlias(columns, currentStep))){
if(currentStep>0){
criteria.createAlias(converArrayToAlias(columns, currentStep-1) + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
}else{
criteria.createAlias(rootAlais + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
}
aliases.add(converArrayToAlias(columns, currentStep));
}
currentStep++;
createAlias(criteria, rootAlais, aliases, columns, currentStep);
}
}
/**
* "organization.parentOrganization.parentOrganization.parentOrganization.id"
* "organization_parentOrganization_parentOrganization_parentOrganization.id"
* @author
* 2009-9-20
* @param property
* @return
*/
public static String getAliasFromPropertyChainString(String property){
if(property.contains(".")){
return property.substring(0, property.lastIndexOf(POINT)).replaceAll("\\.", "_") + property.substring(property.lastIndexOf(POINT));
}
return property;
}
/**
* ALIAS
* @author
* 2009-9-10
* @param columns
* @param currentStep
* @return
*/
private static String converArrayToAlias(String[] columns,int currentStep){
StringBuilder alias = new StringBuilder();
for (int i = 0; i <= currentStep; i++) {
if(alias.length()>0){
alias.append("_");
}
alias.append(columns[i]);
}
return alias.toString();
}
}
//package org.jeecgframework.core.common.hibernate.qbc;
//
//import java.util.ArrayList;
//import java.util.HashSet;
//import java.util.List;
//import java.util.Set;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.hibernate.FetchMode;
//import org.hibernate.criterion.DetachedCriteria;
//import org.hibernate.criterion.Projection;
//import org.hibernate.criterion.ProjectionList;
//import org.hibernate.criterion.Projections;
//import org.hibernate.transform.Transformers;
//import org.jeecgframework.core.util.ContextHolderUtils;
//import org.jeecgframework.core.util.ResourceUtil;
//import org.jeecgframework.core.util.StringUtil;
//
//
//
///**
// * 拼装Hibernate条件
// */
//public class DetachedCriteriaUtil {
//
// /** 小写字母X */
// public static final String MIDDLE_SEPRATOR_CHAR = "x";
// /** 两个空格 */
// public static final String SEPARATOR_TWO_SPACE = " ";// 两个空格,避免和"日期 时间"中的空格混淆
// /** 此字符串内容为" <= x <= ",不包括引号 */
// static public ProjectionList projectionList;
//
//
// public static ProjectionList getProjectionList() {
// return projectionList;
// }
//
// private DetachedCriteriaUtil(){
// //do not allow to create Object
// }
//
// /**
// * 自动拼装条件 2008-11-3
// *
// * @author 苍鹰
// * @param pojoClazz
// * 实体类名
// * @param startChar
// * 参数统一的开始字符
// * @param alias
// * 别名
// * @return DetachedCriteria 组装好的查询条件
// */
// public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
// String startChar,String alias) {
// return createDetachedCriteria(pojoClazz, startChar, alias,null);
// }
//
// /**
// * 自动拼装条件 2008-11-3
// *
// * @author 苍鹰
// * @param pojoClazz
// * 实体类名
// * @param startChar
// * 参数统一的开始字符
// * @param alias
// * 别名
// * @param columnNames
// * 作为select子句的属性名集合
// * @return DetachedCriteria 组装好的查询条件
// */
// public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
// String startChar,String alias,String[] columnNames) {
// return createDetachedCriteria(pojoClazz, startChar, alias, columnNames, null);
// }
//
// /**
// * 自动拼装条件 2008-11-3
// *
// * @author 苍鹰
// * @param pojoClazz
// * 实体类名
// * @param startChar
// * 参数统一的开始字符
// * @param columnNames
// * 作为select子句的属性名集合
// * @param excludeParameters
// * 不作为查询条件的参数
// * @param alias
// * 别名
// * @return DetachedCriteria 组装好的查询条件
// */
// public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
// String startChar,String alias,String[] columnNames,String[] excludeParameters) {
// DetachedCriteria criteria = DetachedCriteria.forClass(pojoClazz,alias);
// if(columnNames!=null && columnNames.length>0){
// //selectColumn(criteria, columnNames, pojoClazz, false);
// }
// return criteria;
// }
//
// private static final String ALIAS_KEY_IN_REQUEST = "ALIAS_KEY_IN_REQUEST";
// private static final String HAS_JOIN_TABLE_KEY_IN_REQUEST = "HAS_JOIN_TABLE_KEY_IN_REQUEST";
//
// private static void setAliasToRequest(HttpServletRequest request,Set<String> aliases) {
// request.setAttribute(ALIAS_KEY_IN_REQUEST, aliases);
// }
//
// @SuppressWarnings("unchecked")
// private static Set<String> getAliasesFromRequest(){
// Set<String> aliases = (Set<String>) ContextHolderUtils.getRequest().getAttribute(ALIAS_KEY_IN_REQUEST);
// if(aliases==null){
// aliases = new HashSet<String>(5);
// setAliasToRequest(ContextHolderUtils.getRequest(), aliases);
// }
// return aliases;
// }
//
// private static boolean getHasJoinTatleFromRequest(){
// Boolean hasJoin = (Boolean) ContextHolderUtils.getRequest().getAttribute(HAS_JOIN_TABLE_KEY_IN_REQUEST);
// return hasJoin==null?false:hasJoin;
// }
//
//
//
//
// /**
// * 该方法提供DetachedCriteria对查询字段的封装 2008-9-29
// * 2009.9.9修改后,可支持无限级联取部分字段,如取如下字段
// * user.organization.parentOrganization.parentOrganization.orgName
// * 但请注意1点 ,连接采用内联,级联越多,结果集可能就越少;
// * @author
// * @param columnNames
// * 字符串数组以数据的形式接收要查询的字段属性如String[] column={"属性1","属性2","属性3"};
// * @param pojoClass
// * 实体类的Class,如Mobile.class;
// * @param aials
// * 为要查询的POJO对象指定一个别名
// * @return DetachedCriteria 的一个对象,如果需要查询条件,在些对象后追加查询条件。
// *
// * @param forJoinTable 是否多表连接查询
// */
// public static void selectColumn(DetachedCriteria criteria, String[] columnNames,
// Class<?> pojoClass,boolean forJoinTable) {
// if (null == columnNames) {
// return;
// }
//
// //使用这个临时变量集合是因为dinstinct关键字要放在最前面而distinct关键字要在下面才决定放不放
// List<Projection> tempProjectionList = new ArrayList<Projection>();
//
// Set<String> aliases = getAliasesFromRequest();
// boolean hasJoniTable = false;
// String rootAlias = criteria.getAlias();
// for (String property : columnNames) {
// if(property.contains("_")){
// String[] propertyChain = property.split("_");
// createAlias(criteria,rootAlias,aliases,propertyChain,0);
// tempProjectionList.add(Projections.property(StringUtil.getProperty(property)).as(StringUtil.getProperty(property)));
// hasJoniTable = true;
// }else{
// tempProjectionList.add(Projections.property(rootAlias + POINT + property).as(property));
// }
// }
//
// projectionList = Projections.projectionList();
// if(hasJoniTable || forJoinTable || getHasJoinTatleFromRequest()){//这个一定要放在tempProjectionList的前面因为distinct要在最前面
// projectionList.add(Projections.distinct(Projections.id()));
// }
//
// for (Projection proj : tempProjectionList) {
// projectionList.add(proj);
// }
//
// criteria.setProjection(projectionList);
//
//
// if(!hasJoniTable){
// criteria.setResultTransformer(Transformers.aliasToBean(pojoClass));
// }else{//下面这个是自定义的结果转换器
// criteria.setResultTransformer(new AliasToBean(pojoClass));
// }
// }
//
// private static final String POINT = ".";
//
// /**
// * 创建别名
// * @author 苍鹰
// * 2009-9-9
// * @param criteria
// * @param rootAlais
// * @param aliases
// * @param columns
// * @param currentStep
// */
// private static void createAlias(DetachedCriteria criteria, String rootAlais, Set<String> aliases,String[] columns,int currentStep){
// if(currentStep<columns.length-1){
// if(!aliases.contains(converArrayToAlias(columns, currentStep))){
// if(currentStep>0){
// criteria.createAlias(converArrayToAlias(columns, currentStep-1) + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
// }else{
// criteria.createAlias(rootAlais + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
// }
// aliases.add(converArrayToAlias(columns, currentStep));
// }
// currentStep++;
// createAlias(criteria, rootAlais, aliases, columns, currentStep);
// }
// }
//
//
// /**
// * 从"organization.parentOrganization.parentOrganization.parentOrganization.id" 得到
// * "organization_parentOrganization_parentOrganization_parentOrganization.id"
// * @author 苍鹰
// * 2009-9-20
// * @param property
// * @return
// */
// public static String getAliasFromPropertyChainString(String property){
// if(property.contains(".")){
// return property.substring(0, property.lastIndexOf(POINT)).replaceAll("\\.", "_") + property.substring(property.lastIndexOf(POINT));
//
// }
// return property;
// }
//
// /**
// * 从数组中创建ALIAS
// * @author 苍鹰
// * 2009-9-10
// * @param columns
// * @param currentStep
// * @return
// */
// private static String converArrayToAlias(String[] columns,int currentStep){
// StringBuilder alias = new StringBuilder();
// for (int i = 0; i <= currentStep; i++) {
// if(alias.length()>0){
// alias.append("_");
// }
// alias.append(columns[i]);
// }
// return alias.toString();
// }
//
//
//
//
//}

@ -2,8 +2,6 @@ package org.jeecgframework.core.common.model.common;
import java.io.Serializable;
import java.util.List;
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
*
* @author Hank

@ -4,6 +4,10 @@ import java.util.List;
import org.jeecgframework.core.util.PropertiesUtil;
public class QueryCondition {
Integer id;
String state;
String field;
String type;
String condition;
@ -47,7 +51,25 @@ public class QueryCondition {
public void setRelation(String relation) {
this.relation = relation;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String toString(){
if(field == null || "".equals(field)){
return "";
}
StringBuffer sb =new StringBuffer();
sb.append(this.relation).append(" ");
sb.append(this.field).append(" ")

@ -41,12 +41,7 @@ public class UploadFile {
public UploadFile(HttpServletRequest request, Object object) {
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
if("TSDocument".equals(object.getClass().getSimpleName()) && StringUtil.isNotEmpty(fileKey)){
this.fileKey = fileKey;
this.multipartRequest =(MultipartHttpServletRequest) request;
}else if (StringUtil.isNotEmpty(fileKey)) {
if (StringUtil.isNotEmpty(fileKey)) {
this.fileKey = fileKey;
this.request = request;
} else {

@ -45,6 +45,11 @@ public class DataGrid {
}
public void setSqlbuilder(String sqlbuilder) {
if(sqlbuilder.indexOf("≤") > 0) {
sqlbuilder = sqlbuilder.replace("≤", "<=");
}
this.sqlbuilder = sqlbuilder;
}

@ -127,13 +127,13 @@ public class TreeGrid implements java.io.Serializable {
}
private String assembleFieldsJson() {
String fieldsJson = ", 'fieldMap':" + fieldMap;
String fieldsJson = ", 'fieldMap':" + JSON.toJSON(fieldMap);
if (fieldMap != null && fieldMap.size() > 0) {
Map<String, Object> resultMap = new HashMap<String, Object>();
for (Map.Entry<String, Object> entry : fieldMap.entrySet()) {
resultMap.put("fieldMap." + entry.getKey(), entry.getValue());
}
fieldsJson = ", " + JSON.toJSON(resultMap).toString().replace("{", "").replace("}", "");
fieldsJson += ", " + JSON.toJSON(resultMap).toString().replace("{", "").replace("}", "");
}
return fieldsJson;
}

@ -268,7 +268,7 @@ public interface CommonService {
* @param treeGridModel
* @return
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel);
public List<TreeGrid> treegrid(List<?> all, TreeGridModel treeGridModel);
/**
*
@ -338,7 +338,7 @@ public interface CommonService {
* 使For JDBC-
*
*/
public Long getCountForJdbcParam(String sql, Object[] objs);
public Long getCountForJdbcParam(String sql, Object... objs);
/**
* hql

@ -38,10 +38,12 @@ public class CommonServiceImpl implements CommonService {
*
* @return
*/
@Transactional(readOnly = true)
public List<DBTable> getAllDbTableName() {
return commonDao.getAllDbTableName();
}
@Transactional(readOnly = true)
public Integer getAllDbTableSize() {
return commonDao.getAllDbTableSize();
}
@ -81,6 +83,7 @@ public class CommonServiceImpl implements CommonService {
/**
*
*/
@Transactional(readOnly = true)
public <T> T get(Class<T> class1, Serializable id) {
return commonDao.get(class1, id);
}
@ -93,6 +96,7 @@ public class CommonServiceImpl implements CommonService {
* @param size
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> getList(Class clas) {
return commonDao.loadAll(clas);
}
@ -100,6 +104,7 @@ public class CommonServiceImpl implements CommonService {
/**
*
*/
@Transactional(readOnly = true)
public <T> T getEntity(Class entityName, Serializable id) {
return commonDao.getEntity(entityName, id);
}
@ -113,6 +118,7 @@ public class CommonServiceImpl implements CommonService {
* @param value
* @return
*/
@Transactional(readOnly = true)
public <T> T findUniqueByProperty(Class<T> entityClass,
String propertyName, Object value) {
return commonDao.findUniqueByProperty(entityClass, propertyName, value);
@ -121,6 +127,7 @@ public class CommonServiceImpl implements CommonService {
/**
* .
*/
@Transactional(readOnly = true)
public <T> List<T> findByProperty(Class<T> entityClass,
String propertyName, Object value) {
@ -134,10 +141,12 @@ public class CommonServiceImpl implements CommonService {
* @param entityClass
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> loadAll(final Class<T> entityClass) {
return commonDao.loadAll(entityClass);
}
@Transactional(readOnly = true)
public <T> T singleResult(String hql) {
return commonDao.singleResult(hql);
}
@ -170,6 +179,7 @@ public class CommonServiceImpl implements CommonService {
* @param query
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> findByQueryString(String hql) {
return commonDao.findByQueryString(hql);
}
@ -191,6 +201,7 @@ public class CommonServiceImpl implements CommonService {
* @param query
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> findListbySql(String query) {
return commonDao.findListbySql(query);
}
@ -202,6 +213,7 @@ public class CommonServiceImpl implements CommonService {
* @param clas
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> findByPropertyisOrder(Class<T> entityClass,
String propertyName, Object value, boolean isAsc) {
return commonDao.findByPropertyisOrder(entityClass, propertyName,
@ -216,6 +228,7 @@ public class CommonServiceImpl implements CommonService {
* @param isOffset
* @return
*/
@Transactional(readOnly = true)
public PageList getPageList(final CriteriaQuery cq, final boolean isOffset) {
return commonDao.getPageList(cq, isOffset);
}
@ -227,6 +240,7 @@ public class CommonServiceImpl implements CommonService {
* @param isOffset
* @return
*/
@Transactional(readOnly = true)
public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
final boolean isOffset) {
return commonDao.getDataTableReturn(cq, isOffset);
@ -240,6 +254,7 @@ public class CommonServiceImpl implements CommonService {
* @return
*/
@Transactional(readOnly = true)
public void getDataGridReturn(final CriteriaQuery cq,
final boolean isOffset) {
commonDao.getDataGridReturn(cq, isOffset);
@ -254,6 +269,7 @@ public class CommonServiceImpl implements CommonService {
* @param isOffset
* @return
*/
@Transactional(readOnly = true)
public PageList getPageList(final HqlQuery hqlQuery,
final boolean needParameter) {
return commonDao.getPageList(hqlQuery, needParameter);
@ -267,6 +283,7 @@ public class CommonServiceImpl implements CommonService {
* @param isOffset
* @return
*/
@Transactional(readOnly = true)
public PageList getPageListBySql(final HqlQuery hqlQuery,
final boolean isToEntity) {
return commonDao.getPageListBySql(hqlQuery, isToEntity);
@ -278,6 +295,7 @@ public class CommonServiceImpl implements CommonService {
return commonDao.getSession();
}
@Transactional(readOnly = true)
public List findByExample(final String entityName,
final Object exampleEntity) {
return commonDao.findByExample(entityName, exampleEntity);
@ -290,6 +308,7 @@ public class CommonServiceImpl implements CommonService {
* @param cq
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> getListByCriteriaQuery(final CriteriaQuery cq,
Boolean ispage) {
return commonDao.getListByCriteriaQuery(cq, ispage);
@ -304,6 +323,7 @@ public class CommonServiceImpl implements CommonService {
return commonDao.uploadFile(uploadFile);
}
@Transactional(readOnly = true)
public HttpServletResponse viewOrDownloadFile(UploadFile uploadFile)
{
@ -331,10 +351,12 @@ public class CommonServiceImpl implements CommonService {
commonDao.parserXml(fileName);
}
@Transactional(readOnly = true)
public List<ComboTree> comTree(List<TSDepart> all, ComboTree comboTree) {
return commonDao.comTree(all, comboTree);
}
@Transactional(readOnly = true)
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive) {
return commonDao.ComboTree(all, comboTreeModel, in, recursive);
}
@ -342,7 +364,8 @@ public class CommonServiceImpl implements CommonService {
/**
*
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel) {
@Transactional(readOnly = true)
public List<TreeGrid> treegrid(List<?> all, TreeGridModel treeGridModel) {
return commonDao.treegrid(all, treeGridModel);
}
@ -352,6 +375,7 @@ public class CommonServiceImpl implements CommonService {
* @param <T>
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> getAutoList(Autocomplete autocomplete) {
StringBuffer sb = new StringBuffer("");
for (String searchField : autocomplete.getSearchField().split(",")) {
@ -380,37 +404,39 @@ public class CommonServiceImpl implements CommonService {
return commonDao.executeSqlReturnKey(sql, param);
}
@Transactional(readOnly = true)
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows) {
return commonDao.findForJdbc(sql, page, rows);
}
@Transactional(readOnly = true)
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
return commonDao.findForJdbc(sql, objs);
}
@Transactional(readOnly = true)
public List<Map<String, Object>> findForJdbcParam(String sql, int page,
int rows, Object... objs) {
return commonDao.findForJdbcParam(sql, page, rows, objs);
}
@Transactional(readOnly = true)
public <T> List<T> findObjForJdbc(String sql, int page, int rows,
Class<T> clazz) {
return commonDao.findObjForJdbc(sql, page, rows, clazz);
}
@Transactional(readOnly = true)
public Map<String, Object> findOneForJdbc(String sql, Object... objs) {
return commonDao.findOneForJdbc(sql, objs);
}
@Transactional(readOnly = true)
public Long getCountForJdbc(String sql) {
return commonDao.getCountForJdbc(sql);
}
public Long getCountForJdbcParam(String sql, Object[] objs) {
@Transactional(readOnly = true)
public Long getCountForJdbcParam(String sql, Object... objs) {
return commonDao.getCountForJdbcParam(sql,objs);
}
@ -426,15 +452,18 @@ public class CommonServiceImpl implements CommonService {
* @param query
* @return
*/
@Transactional(readOnly = true)
public <T> List<T> findHql(String hql, Object... param) {
return this.commonDao.findHql(hql, param);
}
@Transactional(readOnly = true)
public <T> List<T> pageList(DetachedCriteria dc, int firstResult,
int maxResult) {
return this.commonDao.pageList(dc, firstResult, maxResult);
}
@Transactional(readOnly = true)
public <T> List<T> findByDetached(DetachedCriteria dc) {
return this.commonDao.findByDetached(dc);
}

@ -0,0 +1,67 @@
package org.jeecgframework.core.common.service.impl;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
/**
* RedisService
*/
@Service
public class RedisService {
@Resource
private StringRedisTemplate redisTemplate;
/**
* keyvalue
*/
public void delete(String key){
redisTemplate.delete(key);
}
/**
* keyvalue
*/
public String get(String key){
String value = redisTemplate.opsForValue().get(key);
return value;
}
/**
* keyvalueredis
*/
public void set(String key, String value, long timeout){
redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.DAYS);
}
/**
* keyvalueredis
*/
public void set(String key, String value){
redisTemplate.opsForValue().set(key, value);
}
/**
* redismap
*/
public Map<String, Object> getMap(String key){
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
Map<String,Object> map = hash.entries(key);
return map;
}
/**
* mapredis
*/
public void set(String key, Map<? extends String, ? extends Object> map, long timeout){
redisTemplate.opsForHash().putAll(key, map);
redisTemplate.expire(key, timeout, TimeUnit.DAYS);
}
}

@ -22,6 +22,17 @@ public final class Globals {
public static final Short User_Normal=1;//正常
public static final Short User_Forbidden=0;//禁用
public static final Short User_ADMIN=-1;//超级管理员
/**
* 1
*/
public static final String USER_TYPE_SYSTEM = "1";
/**
* 2
*
*/
public static final String USER_TYPE_INTERFACE = "2";
/**
*
@ -72,8 +83,8 @@ public final class Globals {
/**
*
*/
public static final Short Function_TYPE_PAGE=0;//页面(菜单:菜单类型
public static final Short Function_TYPE_FROM=1;//表单/或者弹出(菜单:访问类型)
public static final Short Function_TYPE_PAGE=0;//菜单:菜单类型
public static final Short Function_TYPE_FROM=1;//菜单:权限类型(权限使用,不作为菜单首页加载)
/**
* code
*/

@ -0,0 +1,106 @@
package org.jeecgframework.core.enums;
import org.jeecgframework.core.util.oConvertUtils;
/**
* ,code (add addOne)
*
* @author taoYan
* @since 20171225
*/
//addSingle,editSingle,batchDel,save,reject,template,importe,export,filter
public enum MenuButtonsEnum {
addgroup("addgroup","表单新增&word模式","iframeGoAdd&tempNoDo","fa fa-file-text-o&fa fa-file-word-o&fa fa-plus")
,editgroup("editgroup","表单编辑&word模式","iframeGoUpdate&tempNoDo","fa fa-file-text-o&fa fa-file-word-o&fa fa-pencil-square-o")
,addSingle("addSingle","新增","iframeGoAdd","fa fa-plus")
,editSingle("editSingle","编辑","iframeGoUpdate","fa fa-pencil-square-o")
,batchDel("batchDel","批量删除","iframeDeleteAll","fa fa-trash-o")
,save("save","保存","iframeGoSaveRow","fa fa-floppy-o")
,reject("reject","取消编辑","iframeRejectUpdate","fa fa-reply")
,template("template","模板下载","iframeExportXlsByT","fa fa-upload")
,importe("import","数据导入","iframeImportExcel","fa fa-download")
,export("export","数据导出","iframeExportXls","fa fa-share-square-o")
,filter("filter","过滤","iframeFilter","fa fa-filter")
,superQuery("superQuery","高级查询","superQuery","fa fa-search-plus")
;
String code;
String title;
String fun;
String icon;
MenuButtonsEnum(String code, String title, String fun, String icon) {
this.code = code;
this.title = title;
this.fun = fun;
this.icon = icon;
}
public static MenuButtonsEnum getMenuByCode(String code){
if(oConvertUtils.isNotEmpty(code)){
for (MenuButtonsEnum e : MenuButtonsEnum.values()) {
if(code.equals(e.code)){
return e;
}
}
}
return null;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the fun
*/
public String getFun() {
return fun;
}
/**
* @param fun the fun to set
*/
public void setFun(String fun) {
this.fun = fun;
}
/**
* @return the icon
*/
public String getIcon() {
return icon;
}
/**
* @param icon the icon to set
*/
public void setIcon(String icon) {
this.icon = icon;
}
}

@ -17,15 +17,47 @@ public enum OnlineGenerateEnum {
* code src/main/resources/jeecg/ext-template/{code:}
* code = default.single -> src/main/resources/jeecg/ext-template/default/single
*/
ONLINE_TABLE_SINGLE("table.single","TABLE风格表单","single","ext"),
ONLINE_TABLE_ONETOMANY("table.onetomany","TABLE风格表单","onetomany","ext"),
ONLINE_ACE_SINGLE("ace.single","ACE风格表单","single","ext"),
ONLINE_ACE_ONETOMANY("ace.onetomany","ACE风格表单","onetomany","ext"),
ONLINE_DIV_SINGLE("div.single","DIV风格表单","single","ext"),
ONLINE_NOPOP_SINGLE("nopop.single","NOPOP风格表单","single","ext"),
// ONLINE_COMMON_TABLE_SINGLE("table.single","可自定义TABLE风格模板","single","ext-common"),
// ONLINE_COMMON_TABLE_ONETOMANY("table.onetomany","可自定义TABLE风格模板","onetomany","ext-common"),
ONLINE_ROW_SINGLE("rowedit.single","行编辑风格表单","single","ext");
//***********{新一代代码生成器模板}**********************************************
ONLINE_COMMON_BOOTSTRAP_SINGLE("bootstrap.single","Bootstrap表单+EasyUI标签列表","single","ext-common",false),
ONLINE_COMMON_BOOTSTRAP_ONETOMANY("bootstrap.onetomany","Bootstrap表单+EasyUI标签列表","onetomany","ext-common",false),
ONLINE_COMMON_NATUREBT_SINGLE("naturebt.single","Bootstrap表单+EasyUI原生列表","single","ext-common",false),
ONLINE_COMMON_NATUREBT_ONETOMANY("naturebt.onetomany","ElementUI表单+EasyUI原生列表","onetomany","ext-common",false),
ONLINE_COMMON_BOOTSTRAPTABLEUI_SINGLE("bootstraptableUI.single","Boostrap表单+BootstapTable标签列表","single","ext-common",false),
ONLINE_COMMON_BOOTSTRAPTABLEUI_ONETOMANY("bootstraptableUI.onetomany","Boostrap表单+BootstapTable标签列表","onetomany","ext-common",false),
ONLINE_COMMON_BOOTSTRAPTABLE_SINGLE("bootstraptable.single","Bootstrap表单+BootstrapTable原生列表","single","ext-common",false),
ONLINE_COMMON_BOOTSTRAPTABLE_ONETOMANY("bootstraptable.onetomany","Bootstrap表单+BootstrapTable原生列表","onetomany","ext-common",false),
//船舶订制版本
ONLINE_MULTI_TABLE_ONETOMANY("multitable.onetomany","Table风格表单+EasyUI标签列表(ERP上下布局风格)","onetomany","ext-common",false),
//ElementUI风格(VUE)
ONLINE_COMMON_ELEMENT_SINGLE("element.single","VUE+ElementUI风格","single","ext-common",false),
ONLINE_COMMON_ELEMENT_ONETOMANY("element.onetomany","VUE+ElementUI风格","onetomany","ext-common",false),
//***********{老版本代码生成器模板}**********************************************
ONLINE_TABLE_SINGLE("table.single","TABLE风格表单","single","ext",true),
ONLINE_TABLE_ONETOMANY("table.onetomany","TABLE风格表单","onetomany","ext",false),
ONLINE_ACE_SINGLE("ace.single","ACE风格表单","single","ext",true),
ONLINE_ACE_ONETOMANY("ace.onetomany","ACE风格表单","onetomany","ext",false),
ONLINE_DIV_SINGLE("div.single","DIV风格表单","single","ext",true),
ONLINE_NOPOP_SINGLE("nopop.single","NOPOP风格表单","single","ext",false),
ONLINE_ROW_SINGLE("rowedit.single","行编辑风格表单","single","ext",false),
ONLINE_TAB_ONETOMANY("tab.onetomany","TAB风格表单","onetomany","ext",false);
//TODO 暂时不推荐这个版本代码生成器
// ONLINE_VUEBT_SINGLE("vuebt.single","Bootstrap表单+VUE-Bootstrap-Table列表风格","single","ext");
// ONLINE_DEFAULT_SINGLE("default.single","用户扩展风格示例","single","ext"),
// ONLINE_DEFAULT_ONETOMANY("default.onetomany","用户扩展风格示例","onetomany","ext");
@ -60,12 +92,17 @@ public enum OnlineGenerateEnum {
*/
private String version;
/**
*
*/
private boolean supportTreegrid;
private OnlineGenerateEnum(String code, String desc, String formType, String version) {
private OnlineGenerateEnum(String code, String desc, String formType, String version,boolean supportTreegrid) {
this.code = code;
this.desc = desc;
this.formType = formType;
this.version = version;
this.supportTreegrid = supportTreegrid;
}
public String getDesc() {
@ -99,6 +136,13 @@ public enum OnlineGenerateEnum {
public void setVersion(String version) {
this.version = version;
}
public boolean isSupportTreegrid() {
return supportTreegrid;
}
public void setSupportTreegrid(boolean supportTreegrid) {
this.supportTreegrid = supportTreegrid;
}
public static OnlineGenerateEnum toEnum(String code) {
if(StringUtil.isEmpty(code)){
@ -112,4 +156,19 @@ public enum OnlineGenerateEnum {
return null;
}
public static OnlineGenerateEnum toEnum(String code, String version) {
if(StringUtil.isEmpty(code)){
return null;
}
if(StringUtil.isEmpty(version)){
return null;
}
for(OnlineGenerateEnum item : OnlineGenerateEnum.values()) {
if(item.getCode().equals(code)&&item.getVersion().equals(version)) {
return item;
}
}
return null;
}
}

@ -1,5 +1,7 @@
package org.jeecgframework.core.enums;
import java.io.File;
import org.jeecgframework.core.util.oConvertUtils;
/**
@ -8,8 +10,8 @@ import org.jeecgframework.core.util.oConvertUtils;
*
*/
public enum StoreUploadFilePathEnum {
PHOTOSUCAI("photosucai", "upload/img/photosucai"),
DEFAULT("default", "upload/files");
PHOTOSUCAI("photosucai", "upload"+File.separator+"img"+File.separator+"photosucai"),
DEFAULT("default", "upload"+File.separator+"files");
private String name;
private String path;

@ -1,5 +1,8 @@
package org.jeecgframework.core.enums;
import javax.servlet.http.HttpServletRequest;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.StringUtil;
/**
@ -15,8 +18,8 @@ public enum SysThemesEnum {
ACE_STYLE("ace","main/ace_main","metro", "ACE平面风格"),
ACE_LE_STYLE("acele","main/ace_main","metrole", "ACE2风格"),
DIY("diy","main/diy","default","diy风格"),
HPLUS("hplus","main/hplus_main","metrole","H+风格");
HPLUS("hplus","main/hplus_main","metrole","H+风格"),
FINEUI_STYLE("fineui","main/fineui_main","metrole", "fineUI风格");
/**
*
@ -77,9 +80,15 @@ public enum SysThemesEnum {
}
public static SysThemesEnum toEnum(String style) {
//如果移动端访问自动切换H+首页
if(isMobileDevice()){
return HPLUS;
}
if (StringUtil.isEmpty(style)) {
//默认风格
return HPLUS;
return FINEUI_STYLE;
}
for(SysThemesEnum item : SysThemesEnum.values()) {
if(item.getStyle().equals(style)) {
@ -87,10 +96,31 @@ public enum SysThemesEnum {
}
}
//默认风格
return HPLUS;
return FINEUI_STYLE;
}
public String toString() {
return "{style: " + style + ", indexPath: " + indexPath + ", themes: " + themes + ", desc: " + desc +"}";
}
/**
*
* android : android
* mac os : iphone ipad
* windows phone:Nokiawindows
*/
private static boolean isMobileDevice(){
HttpServletRequest request = ContextHolderUtils.getRequest();
String requestHeader = request.getHeader("user-agent");
String[] deviceArray = new String[]{"android","mac os","windows phone"};
if(requestHeader == null)
return false;
requestHeader = requestHeader.toLowerCase();
for(int i=0;i<deviceArray.length;i++){
if(requestHeader.indexOf(deviceArray[i])>0){
return true;
}
}
return false;
}
}

@ -7,8 +7,12 @@ import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.persistence.Column;
@ -27,7 +31,7 @@ import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.LogUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.p3.core.util.oConvertUtils;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.system.pojo.base.TSDataRule;
import org.springframework.util.NumberUtils;
@ -90,6 +94,7 @@ public class HqlGenerateUtil {
List<QueryCondition> list = JSONHelper.toList(json , QueryCondition.class);
String sql=getSql(list,"",searchObj.getClass());
LogUtil.debug("DEBUG sqlbuilder:"+sql);
//TODO 此用法在多表关联查询两个表存在相同字段的时候会存在问题hibernate维护的实体关系
cq.add(Restrictions.sqlRestriction(sql));
}
}catch(Exception e){
@ -121,7 +126,7 @@ public class HqlGenerateUtil {
cq.add(Restrictions.sqlRestriction("1=1"));
addPreCondition = false;
}
cq.add(Restrictions.sqlRestriction("("+ruleMap.get(c).getRuleValue()+")"));
cq.add(Restrictions.sqlRestriction("("+getSqlRuleValue(ruleMap.get(c).getRuleValue())+")"));
}
}
@ -211,6 +216,13 @@ public class HqlGenerateUtil {
beginValue_ = Float.parseFloat(beginValue);
if(!"".equals(endValue)&&null!=endValue)
endValue_ =Float.parseFloat(endValue);
}else if ("class java.lang.Double".equals(type)) {
if(!"".equals(beginValue)&&null!=beginValue)
beginValue_ = Double.parseDouble(beginValue);
if(!"".equals(endValue)&&null!=endValue)
endValue_ =Double.parseDouble(endValue);
}else{
beginValue_ = beginValue;
endValue_ = endValue;
@ -267,6 +279,36 @@ public class HqlGenerateUtil {
}
}
private static String getSqlRuleValue(String sqlRule){
try {
Set<String> varParams = getSqlRuleParams(sqlRule);
for(String var:varParams){
String tempValue = ResourceUtil.converRuleValue(var);
sqlRule = sqlRule.replace("#{"+var+"}",tempValue);
}
} catch (Exception e) {
e.printStackTrace();
}
return sqlRule;
}
private static Set<String> getSqlRuleParams(String sql) {
if(oConvertUtils.isEmpty(sql)){
return null;
}
Set<String> varParams = new HashSet<String>();
String regex = "\\#\\{\\w+\\}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(sql);
while(m.find()){
String var = m.group();
varParams.add(var.substring(var.indexOf("{")+1,var.indexOf("}")));
}
return varParams;
}
/**
*
*
@ -404,8 +446,19 @@ public class HqlGenerateUtil {
* @return
*/
public static String getSql(List<QueryCondition> list,String tab,Class claszz){
if(list==null || list.size()==0){
return "";
}
StringBuffer sb=new StringBuffer();
sb.append(" 1=1 ");
if(list.get(0).getRelation().equals("or")) {
sb.append(" 1=0 ");
} else {
sb.append(" 1=1 ");
}
for(QueryCondition c :list){
String column = invokeFindColumn(claszz,c.getField());
String type = invokeFindType(claszz,c.getField());
@ -413,7 +466,6 @@ public class HqlGenerateUtil {
c.setField(column);
sb.append(tab+c);sb.append("\r\n");
if(c.getChildren()!=null){
List list1= JSONHelper.toList(c.getChildren(), QueryCondition.class);
sb.append(tab);
sb.append(c.getRelation()+"( ");
@ -450,7 +502,16 @@ public class HqlGenerateUtil {
String column=null;
Field field;
try {
field = clazz.getDeclaredField(field_name);
//TODO 只能向上找一级,其他则失败。
boolean flag = getSuperDeclaredField(clazz,field_name);
if(flag) {
field = clazz.getDeclaredField(field_name);
} else {
Class cla = clazz.getSuperclass();
field = cla.getDeclaredField(field_name);
}
PropertyDescriptor pd = new PropertyDescriptor(field.getName(),clazz);
Method getMethod = pd.getReadMethod();//获得get方法
Column col=getMethod.getAnnotation(Column.class);
@ -526,4 +587,24 @@ public class HqlGenerateUtil {
}
return cq;
}
/**
* field
* @param clazz
* @param fieldName
* @return
*/
public static boolean getSuperDeclaredField(Class clazz,String fieldName) {
Field[] fields=clazz.getDeclaredFields();
boolean b=false;
for (int i = 0; i < fields.length; i++) {
if(fields[i].getName().equals(fieldName))
{
b=true;
break;
}
}
return b;
}
}

@ -1,7 +1,15 @@
package org.jeecgframework.core.extend.hqlsearch;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jeecgframework.core.extend.hqlsearch.parse.vo.HqlRuleEnum;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.system.pojo.base.TSDataRule;
/**
@ -37,7 +45,7 @@ public class SysContextSqlConvert {
HqlRuleEnum ruleEnum=HqlRuleEnum.getByValue(dataRule.getRuleConditions());
if(ruleEnum == HqlRuleEnum.SQL_RULES){
sqlValue +=" and ("+ dataRule.getRuleValue()+")";
sqlValue +=" and ("+ getSqlRuleValue(dataRule.getRuleValue())+")";
return sqlValue;
}
@ -94,6 +102,36 @@ public class SysContextSqlConvert {
return sqlValue;
}
private static String getSqlRuleValue(String sqlRule){
try {
Set<String> varParams = getSqlRuleParams(sqlRule);
for(String var:varParams){
String tempValue = ResourceUtil.converRuleValue(var);
sqlRule = sqlRule.replace("#{"+var+"}",tempValue);
}
} catch (Exception e) {
e.printStackTrace();
}
return sqlRule;
}
private static Set<String> getSqlRuleParams(String sql) {
if(oConvertUtils.isEmpty(sql)){
return null;
}
Set<String> varParams = new HashSet<String>();
String regex = "\\#\\{\\w+\\}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(sql);
while(m.find()){
String var = m.group();
varParams.add(var.substring(var.indexOf("{")+1,var.indexOf("}")));
}
return varParams;
}
// /**
// *

@ -1,12 +1,13 @@
package org.jeecgframework.core.extend.swftools;
import java.io.File;
import java.io.FileNotFoundException;
import org.artofsolving.jodconverter.OfficeDocumentConverter;
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
import org.artofsolving.jodconverter.office.OfficeManager;
import org.jeecgframework.core.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@ -16,6 +17,7 @@ import org.jeecgframework.core.util.FileUtils;
*
*/
public class OpenOfficePDFConverter implements PDFConverter {
private static final Logger log = LoggerFactory.getLogger(OpenOfficePDFConverter.class);
private static OfficeManager officeManager;
/** OpenOffice安装根目录 */
@ -23,44 +25,21 @@ public class OpenOfficePDFConverter implements PDFConverter {
private static int[] port = { 8100 };
public void convert2PDF(String inputFile, String pdfFile, String extend) {
// if (extend.equals("txt")) {
//
// String odtFile = FileUtils.getFilePrefix(inputFile) + ".odt";
// if (new File(odtFile).exists()) {
// org.jeecgframework.core.util.LogUtil.info("odt文件已存在");
// inputFile = odtFile;
// } else {
// try {
// FileUtils.copyFile(inputFile, odtFile);
// inputFile = odtFile;
// } catch (FileNotFoundException e) {
// org.jeecgframework.core.util.LogUtil.info("Odt文档不存在");
// e.printStackTrace();
// }
// }
//
// }
startService();
//pdfFile = pdfFile.replaceAll(" ", "").replaceAll(" ", "");
org.jeecgframework.core.util.LogUtil.info("进行文档转换转换:" + inputFile + " --> " + pdfFile);
OfficeDocumentConverter converter = new OfficeDocumentConverter(
officeManager);
log.info("进行文档转换转换:" + inputFile + " --> " + pdfFile);
OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
try {
converter.convert(new File(inputFile), new File(pdfFile));
} catch (Exception e) {
// TODO: handle exception
org.jeecgframework.core.util.LogUtil.info(e.getMessage());
e.printStackTrace();
log.info(e.getMessage());
}
stopService();
org.jeecgframework.core.util.LogUtil.info("进行文档转换转换---- 结束----");
log.info("进行文档转换转换---- 结束----");
}
public void convert2PDF(String inputFile, String extend) {
//inputFile = inputFile.replaceAll(" ", "").replaceAll(" ", "");
String pdfFile = FileUtils.getFilePrefix2(inputFile) + ".pdf";
convert2PDF(inputFile, pdfFile, extend);
@ -80,17 +59,17 @@ public class OpenOfficePDFConverter implements PDFConverter {
officeManager = configuration.buildOfficeManager();
officeManager.start(); // 启动服务
org.jeecgframework.core.util.LogUtil.info("office转换服务启动成功!");
log.info("office转换服务启动成功!");
} catch (Exception ce) {
org.jeecgframework.core.util.LogUtil.info("office转换服务启动失败!详细信息:" + ce);
log.info("office转换服务启动失败!详细信息:" + ce);
}
}
public static void stopService() {
org.jeecgframework.core.util.LogUtil.info("关闭office转换服务....");
log.info("关闭office转换服务....");
if (officeManager != null) {
officeManager.stop();
}
org.jeecgframework.core.util.LogUtil.info("关闭office转换成功!");
log.info("关闭office转换成功!");
}
}

@ -0,0 +1,37 @@
package org.jeecgframework.core.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
public class CORSFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) servletResponse;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "GET,POST,HEAD,PUT,DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Accept,Origin,X-Requested-With,Content-Type,X-Auth-Token");
response.setHeader("Access-Control-Allow-Credentials", "true");
chain.doFilter(servletRequest, servletResponse);
}
@Override
public void destroy() {
}
}

@ -1,67 +0,0 @@
package org.jeecgframework.core.groovy;
import groovy.lang.Binding;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class GroovyBinding extends Binding {
private static ThreadLocal<Map<String, Object>> localVars = new ThreadLocal<Map<String, Object>>();
private static Map<String, Object> propertyMap = new ConcurrentHashMap<String, Object>();
public GroovyBinding() {
}
public GroovyBinding(Map<String, Object> variables) {
localVars.set(variables);
}
public GroovyBinding(String[] args) {
this();
setVariable("args", args);
}
public Object getVariable(String name) {
Map<String, Object> map = localVars.get();
Object result = null;
if ((map != null) && (map.containsKey(name))) {
result = map.get(name);
} else {
result = propertyMap.get(name);
}
return result;
}
public void setVariable(String name, Object value) {
if (localVars.get() == null) {
Map<String, Object> vars = new LinkedHashMap<String, Object>();
vars.put(name, value);
localVars.set(vars);
} else {
(localVars.get()).put(name, value);
}
}
public Map<String, Object> getVariables() {
if (localVars.get() == null) {
return new LinkedHashMap<String, Object>();
}
return localVars.get();
}
public void clearVariables() {
localVars.remove();
}
public Object getProperty(String property) {
return propertyMap.get(property);
}
public void setProperty(String property, Object newValue) {
propertyMap.put(property, newValue);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save