mirror of https://github.com/jeecgboot/jeecg
jeecg 3.6.4 云插件开发版本发布
parent
55126032f6
commit
85a5f31808
57
README.md
57
README.md
|
@ -1,7 +1,7 @@
|
|||
JEECG 微云快速开发平台
|
||||
===============
|
||||
|
||||
当前最新版本: 3.6.3(发布日期:20160410)
|
||||
当前最新版本: 3.6.4(发布日期:20160701)
|
||||
|
||||
前言:
|
||||
-----------------------------------
|
||||
|
@ -73,7 +73,7 @@ JEECG
|
|||
* <b>技术点十七:</b>插件开发,业务功能组件以插件方式集成平台,也可以单独部署发发布,有力支撑了SAAS云应用系统需求</br>
|
||||
|
||||
|
||||
* JEECG V3.6.2, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
|
||||
* JEECG V3.6.4, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
|
||||
* 支持多种浏览器: IE, 火狐, Google 等</br>
|
||||
* 支持数据库: Mysql,Oracle10g,Postgre,SqlServer等</br>
|
||||
* 基础权限: 用户,角色,菜单权限,按钮权限,数据权限</br>
|
||||
|
@ -85,28 +85,59 @@ JEECG
|
|||
|
||||
技术文档
|
||||
-----------------------------------
|
||||
* [JEECG 开发环境手把手入门](http://blog.csdn.net/zhangdaiscott/article/details/50915206)
|
||||
* [JEECG 常见问题大全](http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1)
|
||||
* [JEECG 本地Maven仓库下载](http://git.oschina.net/jeecg/jeecg-local-maven)
|
||||
* [JEECG Lib包下载,供改造非maven工程](http://git.oschina.net/jeecg/jeecg-local-maven)
|
||||
* [JEECG 非maven版本下载](http://git.oschina.net/jeecg/jeecg-no_maven)
|
||||
* [JEECG 开发环境搭建入门必读](http://blog.csdn.net/zhangdaiscott/article/details/50915206)
|
||||
* [JEECG 开发入门视频](http://www.jeecg.org/forum.php?mod=viewthread&tid=197&extra=page%3D1)
|
||||
* [JEECG 更多文档](http://wiki.jeecg.org/display/12/Home)
|
||||
* [JEECG 在线演示DEMO](http://demo.jeecg.org)
|
||||
* [JEECG 入门常见问题必读](http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1)
|
||||
* [在线演示](http://demo.jeecg.org)
|
||||
* [JEECG云应用平台中心](http://yun.jeecg.org)
|
||||
|
||||
* maven依赖下载有问题的,可以直接下载官方提供的 => [JEECG本地Maven仓库](http://git.oschina.net/jeecg/jeecg-local-maven)
|
||||
* 不熟悉maven的同学,直接用 => [myeclipse非maven版本](http://git.oschina.net/jeecg/jeecg-no_maven)
|
||||
|
||||
|
||||
JEECG云插件中心
|
||||
-----------------------------------
|
||||
* JEECG从V_3.6.3版本开始,采用插件开发模式,JEECG走简化轻量级路线,后续升级和功能模块,采用插件开发模式,进行集成。
|
||||
* 更多插件下载地址:[http://yun.jeecg.org/](http://yun.jeecg.org)
|
||||

|
||||
|
||||
|
||||
|
||||
技术交流
|
||||
-----------------------------------
|
||||
* 作者:[张代浩](http://www.jeecg.org/forum.php?mod=viewthread&tid=1047)</br>
|
||||
* 邮箱:jeecg@sina.com</br>
|
||||
* QQ交流群: 106838471(二群)、106259349(一群)</br>
|
||||
* 论坛:[www.jeecg.org](http://www.jeecg.org)
|
||||
* 作者:[张代浩](http://blog.csdn.net/zhangdaiscott)</br>
|
||||
* QQ交流群: 176031980、106838471(满)、106259349(满)</br>
|
||||
|
||||
|
||||
社区荣誉
|
||||
-----------------------------------
|
||||
* 开源社区:http://www.jeecg.org
|
||||
|
||||
* ★2012年JEECG在Google Code上开源;
|
||||
* ★2012年底开源项目JEECG被"ITeye专家访谈";
|
||||
* ★2012年底开源项目JEECG被"CSDN专家访谈";
|
||||
* ★2013年应邀参加"第八届开源中国开源世界高峰论坛"(该论坛由中国开源软件推进联盟主办、全球最大中文IT社区CSDN与程序员杂志协办);
|
||||
* ★2013年应邀参加"开源群英会2013”的开源英雄;
|
||||
* ★2013年度中国优秀开源项目评选-公开投票,“JEECG以887票位居第九"(该项目中国开源软件推进联盟主办、全球最大中文IT社区CSDN与程序员杂志协办);
|
||||
* ★2013年度成立JEECG开源团队,创立JEECG开源社区;
|
||||
* ★2013年度JEECG参加“云计算成就创业梦想”第二届阿里云开发者大赛";
|
||||
* ★2013年度应邀参加了"SDCC 2013中国软件开发者大会" (大会由CSDN和《程序员》杂志倾力打造)
|
||||
* ★2013年下半年推出开源项目"MiniDao(持久层解决方案)"超越了Mybatis和Hibernate;
|
||||
* ★2014年5月应邀参加中国科学院大学创新创业年度论坛,探讨“创业企业发展、创新创业孵化”的主题,成为中国科学院大学创新创业和风险投资协会副会长。
|
||||
* ★2014年推出当前最火的开源项目“JeeWx(捷微:敏捷微信开发平台)”,并获得CSDN举办的“2014年开发者大会”公开投票第一名
|
||||
* ★2014年8月份捷微jeewx2.0与百度达成战略合作,集成百度地图,增加地图功能,附近商家团购等信息搜索。
|
||||
* ★2014年12月份捷微jeewx与联通集团达成战略合作,负责联通集团微信公众账号集团化运营。
|
||||
* ★2015年3月份捷微jeewx推出集团化微信运营版本,专注微信应用一体化,企业系统集成,实现公众账号上下级,类似组织机构权限模式。
|
||||
* ★2015年6月份捷微jeewx推出集企业号版本,与中国移动打成战略合作,推出企业号营销新模式。
|
||||
* ★2015开源中国最火开源项目,TOP5独占2位(jeewx\jeecg),TOP50占4位(jeewx\jeecg\easypoi\jeewx-api)
|
||||
* ★2016年2月JEECG推出移动能力版本,在线配置移动报表,在线配置移动表单,微信OA一体化集成
|
||||
* ★2016年3月JEECG插件开发机制,采用插件方式为用户提供插件服务,目前插件:OA、微信企业号、文档云盘
|
||||
* ★2016年4月捷微H5活动平台与微盟达成战略合作伙伴
|
||||
|
||||
系统演示
|
||||
-----------------------------------
|
||||
### [1].多套首页风格,支持自定义(Bootstrap风格|云桌面风格|经典风格|Shortcut风格等)
|
||||

|
||||

|
||||

|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
110
pom.xml
110
pom.xml
|
@ -3,12 +3,12 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>jeecg</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
<packaging>war</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<codegenerate.version>3.6-SNAPSHOT</codegenerate.version>
|
||||
<minidao.version>1.5.5</minidao.version>
|
||||
<minidao.version>1.6-SNAPSHOT</minidao.version>
|
||||
|
||||
<guava.version>16.0.1</guava.version>
|
||||
<!-- 主要依赖库的版本定义 -->
|
||||
|
@ -116,6 +116,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- 设定主仓库,按设定顺序进行查找 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jeecg</id>
|
||||
|
@ -133,6 +134,49 @@
|
|||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>Central Repository</name>
|
||||
<url>http://repo.maven.apache.org/maven2</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<name>sonatype-snapshots</name>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spy</id>
|
||||
<name>Spy Repository</name>
|
||||
<url>http://files.couchbase.com/maven2/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>xerces</id>
|
||||
<name>xerces</name>
|
||||
<url>https://xerces.apache.org/xerces2-j/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>proxool</id>
|
||||
<name>proxool</name>
|
||||
<url>http://proxool.cvs.sourceforge.net/viewvc/proxool/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
@ -532,7 +576,7 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
<!-- slf4j -->
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
|
@ -541,13 +585,52 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
<!-- log4j -->
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency> -->
|
||||
<!--Logger Support -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-nop</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
<!-- classmate -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml</groupId>
|
||||
|
@ -896,7 +979,24 @@
|
|||
<artifactId>jeecg-p3-biz-demo</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 插件:微信企业号
|
||||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
<artifactId>jeecg-p3-biz-qywx</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeewx</groupId>
|
||||
<artifactId>jeewx-qywx-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency> -->
|
||||
<!-- jeecg plugin end -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<organization>
|
||||
|
|
|
@ -30,7 +30,7 @@ public boolean onSave(Object entity, Serializable id, Object[] state,
|
|||
try {
|
||||
currentUser = ResourceUtil.getSessionUserName();
|
||||
} catch (RuntimeException e) {
|
||||
logger.warn("当前session为空,无法获取用户");
|
||||
//logger.warn("当前session为空,无法获取用户");
|
||||
}
|
||||
if(currentUser==null){
|
||||
return true;
|
||||
|
@ -109,7 +109,7 @@ public boolean onFlushDirty(Object entity, Serializable id,
|
|||
try {
|
||||
currentUser = ResourceUtil.getSessionUserName();
|
||||
} catch (RuntimeException e1) {
|
||||
logger.warn("当前session为空,无法获取用户");
|
||||
//logger.warn("当前session为空,无法获取用户");
|
||||
}
|
||||
if(currentUser==null){
|
||||
return true;
|
||||
|
|
|
@ -55,7 +55,6 @@ public interface ICommonDao extends IGenericBaseCommonDao{
|
|||
public void parserXml(String fileName);
|
||||
public List<ComboTree> comTree(List<TSDepart> all,ComboTree comboTree);
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140819 for:添加recuisive方法参数
|
||||
/**
|
||||
* 根据模型生成ComboTree JSON
|
||||
*
|
||||
|
@ -66,7 +65,7 @@ public interface ICommonDao extends IGenericBaseCommonDao{
|
|||
* @return List<ComboTree>
|
||||
*/
|
||||
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive);
|
||||
// update-end--Author:zhangguoming Date:20140819 for:添加recuisive方法参数
|
||||
|
||||
public List<TreeGrid> treegrid(List all,TreeGridModel treeGridModel);
|
||||
}
|
||||
|
||||
|
|
|
@ -323,11 +323,10 @@ public interface IGenericBaseCommonDao {
|
|||
|
||||
public <T> List<T> findByDetached(DetachedCriteria dc);
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
/**
|
||||
* 执行存储过程
|
||||
* @param execute
|
||||
*/
|
||||
public <T> List<T> executeProcedure(String procedureSql,Object... params);
|
||||
//update-end--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
queryObject.setParameter("username", user.getUserName());
|
||||
queryObject.setParameter("passowrd", password);
|
||||
List<TSUser> users = queryObject.list();
|
||||
//update-start-Author:jg_renjie Date:20151220 for:配合TASK #804 【基础权限】切换用户,session刷新后,重新调用该方法时,password值为加密后的值,故不需要加密
|
||||
|
||||
if (users != null && users.size() > 0) {
|
||||
return users.get(0);
|
||||
} else {
|
||||
|
@ -65,7 +65,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
return users.get(0);
|
||||
}
|
||||
}
|
||||
//update-end-Author:jg_renjie Date:20151220 for:配合TASK #804 【基础权限】切换用户,session刷新后,重新调用该方法时,password值为加密后的值,故不需要加密
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,9 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
}
|
||||
if (uploadFile.getByteField() != null) {
|
||||
// 二进制文件保存在数据库中
|
||||
reflectHelper.setMethodValue(uploadFile.getByteField(), StreamUtils.InputStreamTOByte(mf.getInputStream()));
|
||||
|
||||
// reflectHelper.setMethodValue(uploadFile.getByteField(), StreamUtils.InputStreamTOByte(mf.getInputStream()));
|
||||
|
||||
}
|
||||
File savefile = new File(savePath);
|
||||
if (uploadFile.getRealPath() != null) {
|
||||
|
@ -191,16 +193,16 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
}
|
||||
saveOrUpdate(object);
|
||||
// 文件拷贝到指定硬盘目录
|
||||
//update-begin--Author:jg_renjie Date:20150607 for:上传下载功能上传UTF-8字符集TXT文件预览出现乱码的错误
|
||||
|
||||
if("txt".equals(extend)){
|
||||
//利用utf-8字符集的固定首行隐藏编码原理
|
||||
//Unicode:FF FE UTF-8:EF BB
|
||||
byte[] allbytes = mf.getBytes();
|
||||
try{
|
||||
String head1 = toHexString(allbytes[0]);
|
||||
System.out.println(head1);
|
||||
//System.out.println(head1);
|
||||
String head2 = toHexString(allbytes[1]);
|
||||
System.out.println(head2);
|
||||
//System.out.println(head2);
|
||||
if("ef".equals(head1) && "bb".equals(head2)){
|
||||
//UTF-8
|
||||
String contents = new String(mf.getBytes(),"UTF-8");
|
||||
|
@ -210,13 +212,13 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
out.close();
|
||||
}
|
||||
} else {
|
||||
//update-begin--Author:zhoujf Date:20150610 for:TXT文件预览出现乱码的错误
|
||||
|
||||
//GBK
|
||||
String contents = new String(mf.getBytes(),"GBK");
|
||||
OutputStream out = new FileOutputStream(savePath);
|
||||
out.write(contents.getBytes());
|
||||
out.close();
|
||||
//update-end--Author:zhoujf Date:20150610 for:TXT文件预览出现乱码的错误
|
||||
|
||||
}
|
||||
} catch(Exception e){
|
||||
String contents = new String(mf.getBytes(),"UTF-8");
|
||||
|
@ -229,7 +231,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
} else {
|
||||
FileCopyUtils.copy(mf.getBytes(), savefile);
|
||||
}
|
||||
//update-begin--Author:jg_renjie Date:20150607 for:上传下载功能上传UTF-8字符集TXT文件预览出现乱码的错误
|
||||
|
||||
|
||||
// if (uploadFile.getSwfpath() != null) {
|
||||
// // 转SWF
|
||||
|
@ -494,6 +496,9 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
for (Object obj : all) {
|
||||
trees.add(comboTree(obj, comboTreeModel, in, recursive));
|
||||
}
|
||||
|
||||
all.clear();
|
||||
|
||||
return trees;
|
||||
|
||||
}
|
||||
|
@ -523,16 +528,15 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
for (Object inobj : in) {
|
||||
ReflectHelper reflectHelper2 = new ReflectHelper(inobj);
|
||||
String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField()));
|
||||
//update-begin--Author:JueYue Date:20140514 for:==不起作用--------------------
|
||||
|
||||
if (inId.equals(id)) {
|
||||
tree.setChecked(true);
|
||||
}
|
||||
//update-end--Author:JueYue Date:20140514 for:==不起作用--------------------
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140819 for:递归子节点属性
|
||||
List curChildList = (List) reflectHelper.getMethodValue(comboTreeModel.getChildField());
|
||||
if (curChildList != null && curChildList.size() > 0) {
|
||||
tree.setState("closed");
|
||||
|
@ -548,7 +552,8 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
tree.setChildren(children);
|
||||
}
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140819 for:递归子节点属性
|
||||
|
||||
curChildList.clear();
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
@ -644,12 +649,12 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
tg.getFieldMap().put(entry.getKey(), fieldValue);
|
||||
}
|
||||
}
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
if (treeGridModel.getFunctionType() != null) {
|
||||
String functionType = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getFunctionType()));
|
||||
tg.setFunctionType(functionType);
|
||||
}
|
||||
//update-end--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
treegrid.add(tg);
|
||||
}
|
||||
return treegrid;
|
||||
|
|
|
@ -74,8 +74,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
/**
|
||||
* 初始化Log4j的一个实例
|
||||
*/
|
||||
private static final Logger logger = Logger
|
||||
.getLogger(GenericBaseCommonDao.class);
|
||||
private static final Logger logger = Logger.getLogger(GenericBaseCommonDao.class);
|
||||
/**
|
||||
* 注入一个sessionFactory属性,并注入到父类(HibernateDaoSupport)
|
||||
* **/
|
||||
|
@ -173,7 +172,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
public <T> Serializable save(T entity) {
|
||||
try {
|
||||
Serializable id = getSession().save(entity);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("保存实体成功," + entity.getClass().getName());
|
||||
}
|
||||
|
@ -195,13 +194,13 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
public <T> void batchSave(List<T> entitys) {
|
||||
for (int i = 0; i < entitys.size(); i++) {
|
||||
getSession().save(entitys.get(i));
|
||||
if (i % 20 == 0) {
|
||||
// 20个对象后才清理缓存,写入数据库
|
||||
if (i % 1000 == 0) {
|
||||
// 1000个对象批量写入数据库,后才清理缓存
|
||||
getSession().flush();
|
||||
getSession().clear();
|
||||
}
|
||||
}
|
||||
// 最后清理一下----防止大于20小于40的不保存
|
||||
//最后页面的数据,进行提交手工清理
|
||||
getSession().flush();
|
||||
getSession().clear();
|
||||
}
|
||||
|
@ -217,7 +216,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
public <T> void saveOrUpdate(T entity) {
|
||||
try {
|
||||
getSession().saveOrUpdate(entity);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("添加或更新成功," + entity.getClass().getName());
|
||||
}
|
||||
|
@ -233,7 +232,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
public <T> void delete(T entity) {
|
||||
try {
|
||||
getSession().delete(entity);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("删除成功," + entity.getClass().getName());
|
||||
}
|
||||
|
@ -251,7 +250,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
*/
|
||||
public <T> void deleteEntityById(Class entityName, Serializable id) {
|
||||
delete(get(entityName, id));
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -264,7 +263,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
public <T> void deleteAllEntitie(Collection<T> entitys) {
|
||||
for (Object entity : entitys) {
|
||||
getSession().delete(entity);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +289,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
|
||||
T t = (T) getSession().get(entityName, id);
|
||||
if (t != null) {
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
@ -303,7 +302,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
*/
|
||||
public <T> void updateEntitie(T pojo) {
|
||||
getSession().update(pojo);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -314,7 +313,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
*/
|
||||
public <T> void updateEntitie(String className, Object id) {
|
||||
getSession().update(className, id);
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -335,9 +334,9 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
|
||||
Query queryObject = getSession().createQuery(query);
|
||||
List<T> list = queryObject.list();
|
||||
if (list.size() > 0) {
|
||||
getSession().flush();
|
||||
}
|
||||
// if (list.size() > 0) {
|
||||
//getSession().flush();
|
||||
// }
|
||||
return list;
|
||||
|
||||
}
|
||||
|
@ -354,7 +353,7 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
Query queryObject = getSession().createQuery(hql);
|
||||
List<T> list = queryObject.list();
|
||||
if (list.size() == 1) {
|
||||
getSession().flush();
|
||||
//getSession().flush();
|
||||
t = list.get(0);
|
||||
} else if (list.size() > 0) {
|
||||
throw new BusinessException("查询结果数:" + list.size() + "大于1");
|
||||
|
@ -883,9 +882,9 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
*
|
||||
*/
|
||||
public Long getCountForJdbcParam(String sql, Object[] objs) {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, objs,Long.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -909,7 +908,6 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
KeyHolder keyHolder = null;
|
||||
SqlParameterSource sqlp = new MapSqlParameterSource(param);
|
||||
|
||||
//update-begin--Author: jg_huangxg Date: 20150625 for:[bugfree号]oc时,录入数据在Oracle下 数据写入错误--------------------
|
||||
if (StringUtil.isNotEmpty(param.get("id"))) {//表示已经生成过id(UUID),则表示是非序列或数据库自增的形式
|
||||
this.namedParameterJdbcTemplate.update(sql,sqlp);
|
||||
}else{//NATIVE or SEQUENCE
|
||||
|
@ -920,14 +918,14 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
keyValue = keyHolder.getKey().longValue();
|
||||
}
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date: 20150625 for:[bugfree号]oc时,录入数据在Oracle下 数据写入错误----------------------
|
||||
|
||||
return keyValue;
|
||||
}
|
||||
|
||||
public Integer countByJdbc(String sql, Object... param) {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, param,Integer.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -983,7 +981,6 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
return dc.getExecutableCriteria(getSession()).list();
|
||||
}
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150710 for:增加执行存储过程方法
|
||||
/**
|
||||
* 调用存储过程
|
||||
*/
|
||||
|
@ -997,5 +994,5 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
|
||||
return sqlQuery.list();
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150710 for:增加执行存储过程方法
|
||||
|
||||
}
|
||||
|
|
|
@ -193,18 +193,18 @@ public class JdbcDao extends SimpleJdbcTemplate{
|
|||
* 使用指定的检索标准检索数据并分页返回数据For JDBC
|
||||
*/
|
||||
public Long getCountForJdbc(String sql) {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
return jdbcTemplate.queryForObject(sql,Long.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
}
|
||||
/**
|
||||
* 使用指定的检索标准检索数据并分页返回数据For JDBC-采用预处理方式
|
||||
*
|
||||
*/
|
||||
public Long getCountForJdbcParam(String sql,Object... objs) {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
return jdbcTemplate.queryForObject(sql, objs,Long.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
}
|
||||
|
||||
public Integer executeSql2(String sql,List<Object> param) {
|
||||
|
@ -216,9 +216,9 @@ public class JdbcDao extends SimpleJdbcTemplate{
|
|||
}
|
||||
|
||||
public Integer countByJdbc(String sql, Object... param) {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, param,Integer.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 -->
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@ public class SimpleJdbcTemplate {
|
|||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
protected JdbcTemplate jdbcTemplate;
|
||||
protected NamedParameterJdbcTemplate namedJdbcTemplate;
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class SimpleJdbcTemplate {
|
|||
namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
|
||||
simpleJdbcInsert=new SimpleJdbcInsert(dataSource);
|
||||
}
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
|
||||
|
||||
/**
|
||||
* 根据sql语句,返回对象集合
|
||||
|
@ -70,9 +69,9 @@ public class SimpleJdbcTemplate {
|
|||
if(parameters!=null){
|
||||
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters);
|
||||
}else{
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本
|
||||
|
||||
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz),Long.class);
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
@ -89,13 +88,13 @@ public class SimpleJdbcTemplate {
|
|||
public long findForLong(final String sql,Map parameters){
|
||||
try{
|
||||
Assert.hasText(sql,"sql语句不正确!");
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
|
||||
if(parameters!=null){
|
||||
return namedJdbcTemplate.queryForObject(sql, parameters,Long.class);
|
||||
}else{
|
||||
return jdbcTemplate.queryForObject(sql,Long.class);
|
||||
}
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
|
||||
}catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -191,11 +190,10 @@ public class SimpleJdbcTemplate {
|
|||
return updateCounts;
|
||||
}
|
||||
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
protected BeanPropertyRowMapper resultBeanMapper(Class clazz) {
|
||||
return BeanPropertyRowMapper.newInstance(clazz);
|
||||
}
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本 SimpleJdbcTemplate的功能 使用 JdbcTemplate 与 NamedParameterJdbcTemplate 实现
|
||||
|
||||
|
||||
protected BeanPropertySqlParameterSource paramBeanMapper(Object object) {
|
||||
return new BeanPropertySqlParameterSource(object);
|
||||
|
|
|
@ -124,12 +124,15 @@ public class GlobalExceptionResolver implements HandlerExceptionResolver {
|
|||
AjaxJson json = new AjaxJson();
|
||||
json.setSuccess(true);
|
||||
json.setMsg(deepestException.getMessage());
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
PrintWriter pw=response.getWriter();
|
||||
pw=response.getWriter();
|
||||
pw.write(JSONHelper.bean2json(json));
|
||||
pw.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
pw.close();
|
||||
}
|
||||
empty.clear();
|
||||
return empty;
|
||||
|
|
|
@ -18,7 +18,7 @@ public class TreeGrid implements java.io.Serializable {
|
|||
private String state = "open";// 是否展开(open,closed)
|
||||
private String order;//排序
|
||||
private Map<String, Object> fieldMap; // 存储实体字段信息容器: key-字段名称,value-字段值
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
private String functionType;// 其他参数
|
||||
|
||||
public String getFunctionType() {
|
||||
|
@ -27,7 +27,7 @@ public class TreeGrid implements java.io.Serializable {
|
|||
public void setFunctionType(String functionType) {
|
||||
this.functionType = functionType;
|
||||
}
|
||||
//update-end--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
public String getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,6 @@ public interface CommonService {
|
|||
|
||||
public List<ComboTree> comTree(List<TSDepart> all, ComboTree comboTree);
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140819 for:添加recuisive方法参数
|
||||
/**
|
||||
* 根据模型生成JSON
|
||||
*
|
||||
|
@ -258,7 +257,7 @@ public interface CommonService {
|
|||
* @return List<ComboTree>
|
||||
*/
|
||||
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive);
|
||||
// update-end--Author:zhangguoming Date:20140819 for:添加recuisive方法参数
|
||||
|
||||
|
||||
/**
|
||||
* 构建树形数据表
|
||||
|
@ -353,7 +352,6 @@ public interface CommonService {
|
|||
|
||||
public <T> List<T> findByDetached(DetachedCriteria dc);
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
/**
|
||||
* 执行存储过程
|
||||
* @param executeSql
|
||||
|
@ -361,5 +359,5 @@ public interface CommonService {
|
|||
* @return
|
||||
*/
|
||||
public <T> List<T> executeProcedure(String procedureSql,Object... params);
|
||||
//update-end--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
|
||||
}
|
||||
|
|
|
@ -414,11 +414,10 @@ public class CommonServiceImpl implements CommonService {
|
|||
return commonDao.getCountForJdbc(sql);
|
||||
}
|
||||
|
||||
//update-begin--Author:JueYue Date:20140514 for:调用方法错误--------------------
|
||||
public Long getCountForJdbcParam(String sql, Object[] objs) {
|
||||
return commonDao.getCountForJdbcParam(sql,objs);
|
||||
}
|
||||
//update-end--Author:JueYue Date:20140514 for:调用方法错误--------------------
|
||||
|
||||
|
||||
|
||||
public <T> void batchSave(List<T> entitys) {
|
||||
|
@ -445,12 +444,11 @@ public class CommonServiceImpl implements CommonService {
|
|||
return this.commonDao.findByDetached(dc);
|
||||
}
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
/**
|
||||
* 调用存储过程
|
||||
*/
|
||||
public <T> List<T> executeProcedure(String procedureSql,Object... params) {
|
||||
return this.commonDao.executeProcedure(procedureSql, params);
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150708 for:增加执行存储过程方法
|
||||
|
||||
}
|
||||
|
|
|
@ -15,87 +15,106 @@ public final class Globals {
|
|||
/**
|
||||
* 保存用户到SESSION
|
||||
*/
|
||||
public static String USER_SESSION="USER_SESSION";
|
||||
public static final String USER_SESSION="USER_SESSION";
|
||||
/**
|
||||
* 人员类型
|
||||
*/
|
||||
public static Short User_Normal=1;//正常
|
||||
public static Short User_Forbidden=0;//禁用
|
||||
public static Short User_ADMIN=-1;//超级管理员
|
||||
public static final Short User_Normal=1;//正常
|
||||
public static final Short User_Forbidden=0;//禁用
|
||||
public static final Short User_ADMIN=-1;//超级管理员
|
||||
|
||||
/**
|
||||
* 逻辑删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public static final Short Delete_Forbidden=1;
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
public static final Short Delete_Normal=0;
|
||||
|
||||
/**
|
||||
*日志级别定义
|
||||
*/
|
||||
public static Short Log_Leavel_INFO=1;
|
||||
public static Short Log_Leavel_WARRING=2;
|
||||
public static Short Log_Leavel_ERROR=3;
|
||||
public static final Short Log_Leavel_INFO=1;
|
||||
public static final Short Log_Leavel_WARRING=2;
|
||||
public static final Short Log_Leavel_ERROR=3;
|
||||
/**
|
||||
* 日志类型
|
||||
*/
|
||||
public static Short Log_Type_LOGIN=1; //登陆
|
||||
public static Short Log_Type_EXIT=2; //退出
|
||||
public static Short Log_Type_INSERT=3; //插入
|
||||
public static Short Log_Type_DEL=4; //删除
|
||||
public static Short Log_Type_UPDATE=5; //更新
|
||||
public static Short Log_Type_UPLOAD=6; //上传
|
||||
public static Short Log_Type_OTHER=7; //其他
|
||||
public static final Short Log_Type_LOGIN=1; //登陆
|
||||
public static final Short Log_Type_EXIT=2; //退出
|
||||
public static final Short Log_Type_INSERT=3; //插入
|
||||
public static final Short Log_Type_DEL=4; //删除
|
||||
public static final Short Log_Type_UPDATE=5; //更新
|
||||
public static final Short Log_Type_UPLOAD=6; //上传
|
||||
public static final Short Log_Type_OTHER=7; //其他
|
||||
|
||||
|
||||
/**
|
||||
* 词典分组定义
|
||||
*/
|
||||
public static String TypeGroup_Database="database";//数据表分类
|
||||
public static final String TypeGroup_Database="database";//数据表分类
|
||||
|
||||
/**
|
||||
* 权限等级
|
||||
*/
|
||||
public static Short Function_Leave_ONE=0;//一级权限
|
||||
public static Short Function_Leave_TWO=1;//二级权限
|
||||
public static final Short Function_Leave_ONE=0;//一级权限
|
||||
public static final Short Function_Leave_TWO=1;//二级权限
|
||||
|
||||
/**
|
||||
* 权限等级前缀
|
||||
*/
|
||||
public static String Function_Order_ONE="ofun";//一级权限
|
||||
public static String Function_Order_TWO="tfun";//二级权限
|
||||
public static final String Function_Order_ONE="ofun";//一级权限
|
||||
public static final String Function_Order_TWO="tfun";//二级权限
|
||||
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
public static Short Function_TYPE_PAGE=0;//页面(菜单:菜单类型)
|
||||
public static Short Function_TYPE_FROM=1;//表单/或者弹出(菜单:访问类型)
|
||||
public static final Short Function_TYPE_PAGE=0;//页面(菜单:菜单类型)
|
||||
public static final Short Function_TYPE_FROM=1;//表单/或者弹出(菜单:访问类型)
|
||||
/**
|
||||
* 没有勾选的操作code
|
||||
*/
|
||||
public static String NOAUTO_OPERATIONCODES ="noauto_operationCodes";
|
||||
public static final String NOAUTO_OPERATIONCODES ="noauto_operationCodes";
|
||||
/**
|
||||
* 勾选了的操作code
|
||||
*/
|
||||
public static String OPERATIONCODES ="operationCodes";
|
||||
public static final String OPERATIONCODES ="operationCodes";
|
||||
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
public static Short OPERATION_TYPE_HIDE = 0;//页面
|
||||
public static Short OPERATION_TYPE_DISABLED = 1;//表单/或者弹出
|
||||
public static final Short OPERATION_TYPE_HIDE = 0;//页面
|
||||
public static final Short OPERATION_TYPE_DISABLED = 1;//表单/或者弹出
|
||||
|
||||
|
||||
/**
|
||||
* 数据权限 - 菜单数据规则集合
|
||||
*/
|
||||
public static String MENU_DATA_AUTHOR_RULES ="MENU_DATA_AUTHOR_RULES";
|
||||
public static final String MENU_DATA_AUTHOR_RULES ="MENU_DATA_AUTHOR_RULES";
|
||||
/**
|
||||
* 数据权限 - 菜单数据规则sql
|
||||
*/
|
||||
public static String MENU_DATA_AUTHOR_RULE_SQL ="MENU_DATA_AUTHOR_RULE_SQL";
|
||||
//update-end--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
public static final String MENU_DATA_AUTHOR_RULE_SQL ="MENU_DATA_AUTHOR_RULE_SQL";
|
||||
|
||||
/**
|
||||
* 新闻法规
|
||||
*/
|
||||
public static Short Document_NEW=0; //新建
|
||||
public static Short Document_PUBLICH=0; //发布
|
||||
|
||||
public static final Short Document_NEW=0; //新建
|
||||
public static final Short Document_PUBLICH=0; //发布
|
||||
|
||||
/**
|
||||
* 内部邮件系统
|
||||
*/
|
||||
public static final String MAIL_STATUS_UNSEND ="00"; //草稿
|
||||
public static final String MAIL_STATUS_SEND ="01"; //已发送
|
||||
public static final String MAIL_STATUS_DEL ="02"; //删除 已发送的邮件不能真正删除,不然接收人就看不到邮件了。
|
||||
public static final String MAILRECEIVER_STATUS_UNREAD ="00"; //未读
|
||||
public static final String MAILRECEIVER_STATUS_READ ="01";//已读
|
||||
|
||||
/**
|
||||
* 配置系统是否开启按钮权限控制
|
||||
|
|
|
@ -14,7 +14,8 @@ public enum SysThemesEnum {
|
|||
SLIDING_STYLE("sliding","main/sliding_main","default", "Sliding云桌面"),
|
||||
ACE_STYLE("ace","main/ace_main","metro", "ACE平面风格"),
|
||||
ACE_LE_STYLE("acele","main/ace_main","metrole", "ACE2风格"),
|
||||
DIY("diy","main/diy","default","diy风格");
|
||||
DIY("diy","main/diy","default","diy风格"),
|
||||
HPLUS("hplus","main/hplus_main","metrole","H+风格");
|
||||
|
||||
|
||||
/**
|
||||
|
@ -78,7 +79,7 @@ public enum SysThemesEnum {
|
|||
public static SysThemesEnum toEnum(String style) {
|
||||
if (StringUtil.isEmpty(style)) {
|
||||
//默认风格
|
||||
return ACE_LE_STYLE;
|
||||
return HPLUS;
|
||||
}
|
||||
for(SysThemesEnum item : SysThemesEnum.values()) {
|
||||
if(item.getStyle().equals(style)) {
|
||||
|
@ -86,7 +87,7 @@ public enum SysThemesEnum {
|
|||
}
|
||||
}
|
||||
//默认风格
|
||||
return ACE_LE_STYLE;
|
||||
return HPLUS;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.jeecgframework.core.extend.hqlsearch.parse.PageValueConvertRuleEnum;
|
|||
import org.jeecgframework.core.extend.hqlsearch.parse.vo.HqlRuleEnum;
|
||||
import org.jeecgframework.core.util.JSONHelper;
|
||||
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.web.demo.entity.test.QueryCondition;
|
||||
|
@ -52,9 +53,7 @@ public class HqlGenerateUtil {
|
|||
* @throws Exception
|
||||
*/
|
||||
public static void installHql(CriteriaQuery cq, Object searchObj) {
|
||||
// --author:龙金波 ------start---date:20150519--------for:统一函数处理sqlbuilder----------------------------------
|
||||
installHql(cq,searchObj,null);
|
||||
// --author:龙金波 ------end---date:20150519--------for:统一函数处理sqlbuilder----------------------------------
|
||||
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,6 @@ public class HqlGenerateUtil {
|
|||
public static void installHql(CriteriaQuery cq, Object searchObj,
|
||||
Map<String, String[]> parameterMap) {
|
||||
installHqlJoinAlias(cq, searchObj, getRuleMap(), parameterMap, "");
|
||||
// --author:龙金波 ------start---date:20150422--------for:增加一个特殊sql参数处理----------------------------------
|
||||
try{
|
||||
String json= null;
|
||||
if(StringUtil.isNotEmpty(cq.getDataGrid().getSqlbuilder())){
|
||||
|
@ -83,13 +81,12 @@ public class HqlGenerateUtil {
|
|||
json
|
||||
, QueryCondition.class);
|
||||
String sql=getSql(list,"",searchObj.getClass());
|
||||
System.out.println("DEBUG sqlbuilder:"+sql);
|
||||
LogUtil.debug("DEBUG sqlbuilder:"+sql);
|
||||
cq.add(Restrictions.sqlRestriction(sql));
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
// --author:龙金波 ------start---date:201504022--------for:增加一个特殊sql参数处理----------------------------------
|
||||
|
||||
cq.add();
|
||||
}
|
||||
|
@ -141,27 +138,23 @@ public class HqlGenerateUtil {
|
|||
// 根据类型分类处理
|
||||
if (type.contains("class java.lang")
|
||||
|| type.contains("class java.math")) {
|
||||
// ------------update--Author:JueYue Date:2014-8-23
|
||||
|
||||
// for:查询拼装的替换
|
||||
if (value != null && !value.equals("")) {
|
||||
HqlRuleEnum rule = PageValueConvertRuleEnum
|
||||
.convert(value);
|
||||
//update-begin--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value);
|
||||
|
||||
// if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){
|
||||
// value="*%"+String.valueOf(value.toString())+"%*";
|
||||
// } else {
|
||||
// rule = HqlRuleEnum.EQ;
|
||||
// }
|
||||
|
||||
//update-begin--Author:jg_renjie Date:20150328 for:#1003:【bug】单表模式年龄查询报错
|
||||
if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){
|
||||
value="*%"+String.valueOf(value.toString())+"%*";
|
||||
} else {
|
||||
rule = HqlRuleEnum.EQ;
|
||||
}
|
||||
//update-end--Author:jg_renjie Date:20150328 for:#1003:【bug】单表模式年龄查询报错
|
||||
|
||||
//update-end--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
value = PageValueConvertRuleEnum.replaceValue(rule,
|
||||
value);
|
||||
ObjectParseUtil.addCriteria(cq, aliasName, rule, value);
|
||||
} else if (parameterMap != null) {
|
||||
//update-end--Author:ll3231@126.com Date:20151222 for:支持所有类型数据
|
||||
|
||||
Object beginValue_=null , endValue_ =null;
|
||||
if ("class java.lang.Integer".equals(type)) {
|
||||
if(!"".equals(beginValue)&&null!=beginValue)
|
||||
|
@ -197,7 +190,7 @@ public class HqlGenerateUtil {
|
|||
ObjectParseUtil.addCriteria(cq, aliasName,
|
||||
HqlRuleEnum.LE, endValue_);
|
||||
}
|
||||
// ------------update--Author:JueYue Date:2014-8-23
|
||||
|
||||
// for:查询拼装的替换
|
||||
} else if ("class java.util.Date".equals(type)) {
|
||||
QueryTimeFormat format = origDescriptors[i].getReadMethod()
|
||||
|
@ -236,7 +229,7 @@ public class HqlGenerateUtil {
|
|||
if (isHaveRuleData(ruleMap, aliasName) ||( isNotEmpty(param)
|
||||
&& itIsNotAllEmpty(param))) {
|
||||
// 如果是实体类,创建别名,继续创建查询条件
|
||||
// ------------update--Author:JueYue Date:20140521
|
||||
|
||||
// for:用户反馈
|
||||
cq.createAlias(aliasName,
|
||||
aliasName.replaceAll("\\.", "_"));
|
||||
|
@ -408,7 +401,6 @@ public class HqlGenerateUtil {
|
|||
}
|
||||
|
||||
// --author:龙金波 ------end---date:20150628--------for:sql组装
|
||||
// --author:陈璞 ------begin---date:20150612--------for:sql组装
|
||||
/**
|
||||
* 根据字段名称,获取字段的类型字符串
|
||||
* return: java.lang.Integer
|
||||
|
@ -478,14 +470,14 @@ public class HqlGenerateUtil {
|
|||
Object value = PropertyUtils.getSimpleProperty(searchObj, name);
|
||||
// 根据类型分类处理
|
||||
if (type.contains("class java.lang") || type.contains("class java.math")) {
|
||||
// ------------update--Author:JueYue Date:2014-8-23
|
||||
|
||||
// for:查询拼装的替换
|
||||
if (value != null && !value.equals("")) {
|
||||
HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value);
|
||||
value = PageValueConvertRuleEnum.replaceValue(rule, value);
|
||||
ObjectParseUtil.addCriteria(cq, aliasName, rule, value);
|
||||
}
|
||||
// ------------update--Author:JueYue Date:2014-8-23
|
||||
|
||||
// for:查询拼装的替换
|
||||
} else if ("class java.util.Date".equals(type)) {
|
||||
QueryTimeFormat format = origDescriptors[i].getReadMethod().getAnnotation(QueryTimeFormat.class);
|
||||
|
@ -500,7 +492,7 @@ public class HqlGenerateUtil {
|
|||
Object param = PropertyUtils.getSimpleProperty(searchObj, name);
|
||||
if (isHaveRuleData(ruleMap, aliasName) || (isNotEmpty(param) && itIsNotAllEmpty(param))) {
|
||||
// 如果是实体类,创建别名,继续创建查询条件
|
||||
// ------------update--Author:JueYue Date:20140521
|
||||
|
||||
// for:用户反馈
|
||||
cq.createAlias(aliasName, aliasName.replaceAll("\\.", "_"));
|
||||
// ------------end--Author:JueYue Date:20140521 for:用户反馈
|
||||
|
|
|
@ -35,8 +35,6 @@ public class SysContextSqlConvert {
|
|||
return "";
|
||||
String sqlValue="";
|
||||
HqlRuleEnum ruleEnum=HqlRuleEnum.getByValue(dataRule.getRuleConditions());
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//#{sys_user_code}%
|
||||
String ValueTemp = dataRule.getRuleValue();
|
||||
String moshi = "";
|
||||
|
@ -50,7 +48,6 @@ public class SysContextSqlConvert {
|
|||
} else {
|
||||
ValueTemp = ValueTemp;
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
String tempValue = null;
|
||||
//---author:jg_xugj----start-----date:20151226--------for:#814 【数据权限】扩展支持写表达式,通过session取值
|
||||
tempValue = ResourceUtil.converRuleValue(ValueTemp);
|
||||
|
|
|
@ -50,11 +50,11 @@ public class PageValueConvertRuleEnum {
|
|||
if(rule == null && val.startsWith(HqlParseEnum.SUFFIX_NOT_EQUAL.getValue())){
|
||||
rule = HqlRuleEnum.NE;
|
||||
}
|
||||
//update-begin--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
if(rule==null&&ResourceUtil.fuzzySearch){
|
||||
rule = HqlRuleEnum.LIKE;
|
||||
}
|
||||
//update-end--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
|
||||
// if(rule==null&&ResourceUtil.fuzzySearch){
|
||||
// rule = HqlRuleEnum.LIKE;
|
||||
// }
|
||||
|
||||
return rule != null ? rule : HqlRuleEnum.EQ;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ public class OpenOfficePDFConverter implements PDFConverter {
|
|||
|
||||
public void convert2PDF(String inputFile, String pdfFile, String extend) {
|
||||
|
||||
//update-begin--Author:zhoujf Date:20150610 for:TXT文件预览出现乱码的错误
|
||||
// if (extend.equals("txt")) {
|
||||
//
|
||||
// String odtFile = FileUtils.getFilePrefix(inputFile) + ".odt";
|
||||
|
@ -42,7 +41,7 @@ public class OpenOfficePDFConverter implements PDFConverter {
|
|||
// }
|
||||
//
|
||||
// }
|
||||
//update-begin--Author:zhoujf Date:20150610 for:TXT文件预览出现乱码的错误
|
||||
|
||||
|
||||
startService();
|
||||
//pdfFile = pdfFile.replaceAll(" ", "").replaceAll(" ", "");
|
||||
|
|
|
@ -25,10 +25,10 @@ public class SWFToolsSWFConverter implements SWFConverter {
|
|||
return;
|
||||
}
|
||||
String command = ConStant.getSWFToolsPath(extend) + " \"" + inputFile
|
||||
//---update-for--文件预览无效------ scott@2013/05/22 ADD START
|
||||
|
||||
+ "\" -o " +" \""+ swfFile +" \""+ " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
|
||||
// + "\" -o " + swfFile + " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
|
||||
// ---update-for--文件预览无效----- scott@2013/05/22 ADD END
|
||||
|
||||
try {
|
||||
// 开始转换文档
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
|
|
|
@ -77,6 +77,7 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
*/
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {
|
||||
String requestPath = ResourceUtil.getRequestPath(request);// 用户访问的资源地址
|
||||
//logger.info("-----authInterceptor----requestPath------"+requestPath);
|
||||
HttpSession session = ContextHolderUtils.getSession();
|
||||
Client client = ClientManager.getInstance().getClient(session.getId());
|
||||
if(client == null){
|
||||
|
@ -95,7 +96,7 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
//String functionId=oConvertUtils.getString(request.getParameter("clickFunctionId"));
|
||||
String functionId="";
|
||||
//update-begin--Author:JueYue Date:20140831 for:onlinecodeing 的URL判断--------------------
|
||||
|
||||
//onlinecoding的访问地址有规律可循,数据权限链接篡改
|
||||
if(requestPath.equals("cgAutoListController.do?datagrid")) {
|
||||
requestPath += "&configId=" + request.getParameter("configId");
|
||||
|
@ -107,7 +108,6 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
requestPath += "&tableName=" + request.getParameter("tableName");
|
||||
}
|
||||
|
||||
//update-begin--Author:许国杰 Date:20151219 for:#813 【online表单】扩展出三个请求:独立的添加、查看、编辑请求,原来的保留
|
||||
if(requestPath.equals("cgFormBuildController.do?goAddFtlForm")) {
|
||||
requestPath += "&tableName=" + request.getParameter("tableName");
|
||||
}
|
||||
|
@ -117,12 +117,10 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
if(requestPath.equals("cgFormBuildController.do?goDatilFtlForm")) {
|
||||
requestPath += "&tableName=" + request.getParameter("tableName");
|
||||
}
|
||||
//update-end--Author:许国杰 Date:20151219 for:#813 【online表单】扩展出三个请求:独立的添加、查看、编辑请求,原来的保留
|
||||
|
||||
//update-end--Author:JueYue Date:20140831 for:onlinecodeing 的URL判断--------------------
|
||||
//这个地方用全匹配?应该是模糊查询吧
|
||||
//TODO
|
||||
//update-begin--Author:张忠亮 Date:20150717 for:解决rest风格下 权限失效问题
|
||||
|
||||
String uri= request.getRequestURI().substring(request.getContextPath().length() + 1);
|
||||
String realRequestPath = null;
|
||||
if(uri.endsWith(".do")||uri.endsWith(".action")){
|
||||
|
@ -131,7 +129,7 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
realRequestPath=uri;
|
||||
}
|
||||
List<TSFunction> functions = systemService.findByProperty(TSFunction.class, "functionUrl", realRequestPath);
|
||||
//update-end--Author:张忠亮 Date:20150717 for:解决rest风格下 权限失效问题
|
||||
|
||||
if (functions.size()>0){
|
||||
functionId = functions.get(0).getId();
|
||||
}
|
||||
|
@ -143,7 +141,7 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
request.setAttribute(Globals.OPERATIONCODES, operationCodes);
|
||||
}
|
||||
if(!oConvertUtils.isEmpty(functionId)){
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
//List<String> allOperation=this.systemService.findListbySql("SELECT operationcode FROM t_s_operation WHERE functionid='"+functionId+"'");
|
||||
List<TSOperation> allOperation=this.systemService.findByProperty(TSOperation.class, "TSFunction.id", functionId);
|
||||
|
||||
|
@ -211,9 +209,9 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
boolean bMgrUrl = false;
|
||||
if (functionList == null) {
|
||||
// functionList = systemService.loadAll(TSFunction.class);
|
||||
// update-start--Author:zhoujf Date:20150521 for:只查询菜单类型的权限
|
||||
|
||||
functionList = systemService.findHql("from TSFunction where functionType = ? ", (short)0);
|
||||
// update---end--Author:zhoujf Date:20150521 for:只查询菜单类型的权限
|
||||
|
||||
}
|
||||
for (TSFunction function : functionList) {
|
||||
if (function.getFunctionUrl() != null && function.getFunctionUrl().startsWith(requestPath)) {
|
||||
|
@ -237,16 +235,15 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
"ru.userid='"+userid+"' AND f.functionurl like '"+requestPath+"%'";
|
||||
List list = this.systemService.findListbySql(sql);
|
||||
if(list.size()==0){
|
||||
// update-start--Author:zhangguoming Date:20140821 for:判断当前用户组织机构下角色所拥有的权限
|
||||
// update-start--Author:zhangguoming Date:20140825 for:获取当前用户登录时选择的组织机构代码
|
||||
|
||||
String orgId = currLoginUser.getCurrentDepart().getId();
|
||||
// update-end--Author:zhangguoming Date:20140825 for:获取当前用户登录时选择的组织机构代码
|
||||
|
||||
String functionOfOrgSql = "SELECT DISTINCT f.id from t_s_function f, t_s_role_function rf, t_s_role_org ro " +
|
||||
"WHERE f.ID=rf.functionid AND rf.roleid=ro.role_id " +
|
||||
"AND ro.org_id='" +orgId+ "' AND f.functionurl like '"+requestPath+"%'";
|
||||
List functionOfOrgList = this.systemService.findListbySql(functionOfOrgSql);
|
||||
return functionOfOrgList.size() > 0;
|
||||
// update-end--Author:zhangguoming Date:20140821 for:判断当前用户组织机构下角色所拥有的权限
|
||||
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.jeecgframework;
|
||||
package org.jeecgframework.core.junit;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -10,6 +10,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||
* 单元测试 抽象基类 加载配置
|
||||
* @author 许国杰
|
||||
*/
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration(locations = {"classpath*:spring*.xml"})
|
|
@ -27,14 +27,14 @@ public class DataBaseCronTriggerBean extends CronTriggerBean{
|
|||
(TSTimeTaskEntity.class,"taskId",this.getName());
|
||||
if(task!=null&&task.getIsEffect().equals("1")
|
||||
&&!task.getCronExpression().equals(this.getCronExpression())){
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本
|
||||
|
||||
try {
|
||||
this.setCronExpression(task.getCronExpression());
|
||||
} catch (ParseException e) {
|
||||
// TODO 异常必须被处理
|
||||
e.printStackTrace();
|
||||
}
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级spring 版本
|
||||
|
||||
DynamicTask.updateSpringMvcTaskXML(this,task.getCronExpression());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ public class DateUtils extends PropertyEditorSupport {
|
|||
*/
|
||||
public static Calendar getCalendar(long millis) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// --------------------cal.setTimeInMillis(millis);
|
||||
cal.setTime(new Date(millis));
|
||||
return cal;
|
||||
}
|
||||
|
@ -256,7 +255,6 @@ public class DateUtils extends PropertyEditorSupport {
|
|||
* @return 指定日历的时间戳
|
||||
*/
|
||||
public static Timestamp getCalendarTimestamp(Calendar cal) {
|
||||
// ---------------------return new Timestamp(cal.getTimeInMillis());
|
||||
return new Timestamp(cal.getTime().getTime());
|
||||
}
|
||||
|
||||
|
@ -290,7 +288,6 @@ public class DateUtils extends PropertyEditorSupport {
|
|||
* @return 指定日历的毫秒数
|
||||
*/
|
||||
public static long getMillis(Calendar cal) {
|
||||
// --------------------return cal.getTimeInMillis();
|
||||
return cal.getTime().getTime();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class DynamicDBUtil {
|
|||
}
|
||||
|
||||
private static JdbcTemplate getJdbcTemplate(String dbKey) {
|
||||
DynamicDataSourceEntity dynamicSourceEntity = DynamicDataSourceEntity.DynamicDataSourceMap.get(dbKey);
|
||||
DynamicDataSourceEntity dynamicSourceEntity = ResourceUtil.dynamicDataSourceMap.get(dbKey);
|
||||
|
||||
BasicDataSource dataSource = getDataSource(dynamicSourceEntity);
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
|
|
@ -117,13 +117,13 @@ public class LdapUtil {
|
|||
try {
|
||||
ne = dc.search(base, filter, sc);
|
||||
while (ne.hasMore()) {
|
||||
System.out.println();
|
||||
//System.out.println();
|
||||
SearchResult sr = (SearchResult) ne.next();
|
||||
String name = sr.getName();
|
||||
if (base != null && !base.equals("")) {
|
||||
System.out.println("entry: " + name + "," + base);
|
||||
LogUtil.info("entry: " + name + "," + base);
|
||||
} else {
|
||||
System.out.println("entry: " + name);
|
||||
LogUtil.info("entry: " + name);
|
||||
}
|
||||
dn = name + "," + base;
|
||||
break;
|
||||
|
@ -149,7 +149,7 @@ public class LdapUtil {
|
|||
dc.createSubcontext("ou=" + newUserName + "," + ROOT, attrs);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Exception in add():" + e);
|
||||
//System.out.println("Exception in add():" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,8 +162,7 @@ public class LdapUtil {
|
|||
try {
|
||||
dc.destroySubcontext(dn);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Exception in delete():" + e);
|
||||
LogUtil.error("Exception in delete():" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,13 +255,13 @@ public class LdapUtil {
|
|||
// Use the NamingEnumeration object to cycle through
|
||||
// the result set.
|
||||
while (ne.hasMore()) {
|
||||
System.out.println();
|
||||
//System.out.println();
|
||||
SearchResult sr = (SearchResult) ne.next();
|
||||
String name = sr.getName();
|
||||
if (base != null && !base.equals("")) {
|
||||
System.out.println("entry: " + name + "," + base);
|
||||
LogUtil.info("entry: " + name + "," + base);
|
||||
} else {
|
||||
System.out.println("entry: " + name);
|
||||
LogUtil.info("entry: " + name);
|
||||
}
|
||||
|
||||
Attributes at = sr.getAttributes();
|
||||
|
@ -276,11 +275,9 @@ public class LdapUtil {
|
|||
while (values.hasMore()) {
|
||||
Object oneVal = values.nextElement();
|
||||
if (oneVal instanceof String) {
|
||||
System.out.println(attrType + ": "
|
||||
+ (String) oneVal);
|
||||
LogUtil.info(attrType + ": "+ (String) oneVal);
|
||||
} else {
|
||||
System.out.println(attrType + ": "
|
||||
+ new String((byte[]) oneVal));
|
||||
LogUtil.info(attrType + ": "+ new String((byte[]) oneVal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,28 +313,26 @@ public class LdapUtil {
|
|||
try {
|
||||
NamingEnumeration<?> answer = dc.search(searchBase, searchFilter, searchCtls);
|
||||
if (answer == null || answer.equals(null)) {
|
||||
System.out.println("answer is null");
|
||||
LogUtil.info("answer is null");
|
||||
} else {
|
||||
System.out.println("answer not null");
|
||||
LogUtil.info("answer not null");
|
||||
}
|
||||
while (answer.hasMoreElements()) {
|
||||
SearchResult sr = (SearchResult) answer.next();
|
||||
System.out.println("************************************************");
|
||||
System.out.println("getname=" + sr.getName());
|
||||
//System.out.println("************************************************");
|
||||
//System.out.println("getname=" + sr.getName());
|
||||
Attributes Attrs = sr.getAttributes();
|
||||
if (Attrs != null) {
|
||||
try {
|
||||
|
||||
for (NamingEnumeration<?> ne = Attrs.getAll(); ne
|
||||
.hasMore();) {
|
||||
for (NamingEnumeration<?> ne = Attrs.getAll(); ne.hasMore();) {
|
||||
Attribute Attr = (Attribute) ne.next();
|
||||
System.out.println("AttributeID="
|
||||
+ Attr.getID().toString());
|
||||
//System.out.println("AttributeID="+ Attr.getID().toString());
|
||||
// 读取属性值
|
||||
for (NamingEnumeration<?> e = Attr.getAll(); e
|
||||
.hasMore(); totalResults++) {
|
||||
String user = e.next().toString(); // 接受循环遍历读取的userPrincipalName用户属性
|
||||
System.out.println(user);
|
||||
//System.out.println(user);
|
||||
}
|
||||
|
||||
// System.out.println(" ---------------");
|
||||
|
@ -356,7 +351,7 @@ public class LdapUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Number: " + totalResults);
|
||||
//System.out.println("Number: " + totalResults);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Throw Exception : " + e);
|
||||
|
@ -371,7 +366,7 @@ public class LdapUtil {
|
|||
try {
|
||||
dc.close();
|
||||
} catch (NamingException e) {
|
||||
System.out.println("NamingException in close():" + e);
|
||||
LogUtil.error("NamingException in close():" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +386,7 @@ public class LdapUtil {
|
|||
DirContext dc = getDirContext(adAdmin, adAdminPassword);
|
||||
|
||||
if (dc == null) {
|
||||
System.out.println("User or password incorrect!");
|
||||
//System.out.println("User or password incorrect!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.core.enums.SysACEIconEnum;
|
||||
import org.jeecgframework.web.system.pojo.base.TSFunction;
|
||||
import org.jeecgframework.web.system.pojo.base.TSIcon;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
@ -39,7 +36,7 @@ public class ListtoMenu {
|
|||
for (TSFunction node : set) {
|
||||
String iconClas = "default";// 权限图标样式
|
||||
if (node.getTSIcon() != null) {
|
||||
iconClas = TSIcon.allTSIcons.get(node.getTSIcon().getId()).getIconClas();
|
||||
iconClas = ResourceUtil.allTSIcons.get(node.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
buffer.append("{\"menuid\":\"" + node.getId() + "\",\"icon\":\""
|
||||
+ iconClas + "\"," + "\"menuname\":\""
|
||||
|
@ -75,7 +72,7 @@ public class ListtoMenu {
|
|||
|
||||
{
|
||||
buffer.append("{\"menuid\":\"" + node.getId()
|
||||
+ " \",\"icon\":\"" + TSIcon.allTSIcons.get(node.getTSIcon().getId()).getIconClas()
|
||||
+ " \",\"icon\":\"" + ResourceUtil.allTSIcons.get(node.getTSIcon().getId()).getIconClas()
|
||||
+ "\"," + "\"menuname\":\"" + getMutiLang(node.getFunctionName())
|
||||
+ "\",\"url\":\"" + node.getFunctionUrl() + "\"");
|
||||
if (count == set1.size()) {
|
||||
|
@ -158,7 +155,7 @@ public class ListtoMenu {
|
|||
StringBuffer menuString = new StringBuffer();
|
||||
for (TSFunction pFunction : pFunctions) {
|
||||
menuString.append("<div title=\"" + getMutiLang(pFunction.getFunctionName())
|
||||
+ "\" iconCls=\"" + TSIcon.allTSIcons.get(pFunction.getTSIcon().getId()).getIconClas()
|
||||
+ "\" iconCls=\"" + ResourceUtil.allTSIcons.get(pFunction.getTSIcon().getId()).getIconClas()
|
||||
+ "\">");
|
||||
/*int submenusize = pFunction.getSubFunctionSize();
|
||||
if (submenusize == 0) {
|
||||
|
@ -172,7 +169,7 @@ public class ListtoMenu {
|
|||
if (function.getTSFunction().getId().equals(pFunction.getId())) {
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
menuString.append("<li><div onclick=\"addTab(\'"
|
||||
+ getMutiLang(function.getFunctionName()) + "\',\'"
|
||||
|
@ -202,7 +199,7 @@ public class ListtoMenu {
|
|||
if (function.getTSFunction().getId().equals(pFunction.getId())) {
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
menuString.append("<li><div onclick=\"addTab(\'"
|
||||
+ getMutiLang(function.getFunctionName()) + "\',\'"
|
||||
|
@ -239,7 +236,7 @@ public class ListtoMenu {
|
|||
List<TSFunction> list = map.get(0);
|
||||
for (TSFunction function : list) {
|
||||
menuString.append("<div title=\"" + getMutiLang(function.getFunctionName())
|
||||
+ "\" iconCls=\"" + TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\" iconCls=\"" + ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\">");
|
||||
/*int submenusize = function.getSubFunctionSize();
|
||||
if (submenusize == 0) {
|
||||
|
@ -264,7 +261,6 @@ public class ListtoMenu {
|
|||
return menuString.toString();
|
||||
}
|
||||
|
||||
// update-start--Author:zhangguoming Date:20140622 for:左侧树调整:加大宽度、更换节点图标、修改选中颜色
|
||||
|
||||
/**
|
||||
* 拼装EASYUI 多级 菜单 下级菜单为树形
|
||||
|
@ -298,7 +294,7 @@ public class ListtoMenu {
|
|||
} else if("shortcut".equals(style)) {
|
||||
for (TSFunction function : list) {
|
||||
menuString.append("<div title=\"" + getMutiLang(function.getFunctionName())
|
||||
+ "\" iconCls=\"" + TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\" iconCls=\"" + ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\">");
|
||||
if(!function.hasSubFunction(map)){
|
||||
menuString.append("</div>");
|
||||
|
@ -313,7 +309,7 @@ public class ListtoMenu {
|
|||
|
||||
return menuString.toString();
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140622 for:左侧树调整:加大宽度、更换节点图标、修改选中颜色
|
||||
|
||||
|
||||
/**
|
||||
* 获取顶级菜单的下级菜单-----面板式菜单
|
||||
|
@ -333,7 +329,7 @@ public class ListtoMenu {
|
|||
menuString.append("<div class=\"easyui-accordion\" fit=\"false\" border=\"false\">");
|
||||
menuString.append("<div></div>");//easy ui 默认展开第一级,所以这里设置一个控制,就不展开了
|
||||
menuString.append("<div title=\"" + getMutiLang(function.getFunctionName())
|
||||
+ "\" iconCls=\"" + TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\" iconCls=\"" + ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas()
|
||||
+ "\"><ul>");
|
||||
menuString.append(getChild(function,level+1,map));
|
||||
menuString.append("</ul></div>");
|
||||
|
@ -358,7 +354,7 @@ public class ListtoMenu {
|
|||
if(!function.hasSubFunction(map)){
|
||||
menuString.append(getLeafOfTree(function));
|
||||
}else if(map.containsKey(level+1)){
|
||||
menuString.append("<li state=\"closed\" iconCls=\"" + TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas()+"\" ><span>"+ getMutiLang(function.getFunctionName()) +"</span>");
|
||||
menuString.append("<li state=\"closed\" iconCls=\"" + ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas()+"\" ><span>"+ getMutiLang(function.getFunctionName()) +"</span>");
|
||||
menuString.append("<ul >");
|
||||
menuString.append(getChildOfTree(function,level+1,map));
|
||||
menuString.append("</ul></li>");
|
||||
|
@ -376,7 +372,7 @@ public class ListtoMenu {
|
|||
StringBuffer menuString = new StringBuffer();
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
menuString.append("<li><div onclick=\"addTab(\'");
|
||||
menuString.append(getMutiLang(function.getFunctionName()));
|
||||
|
@ -410,7 +406,7 @@ public class ListtoMenu {
|
|||
StringBuffer menuString = new StringBuffer();
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
menuString.append("<li iconCls=\"");
|
||||
menuString.append(icon);
|
||||
|
@ -418,19 +414,19 @@ public class ListtoMenu {
|
|||
menuString.append(getMutiLang(function.getFunctionName()));
|
||||
menuString.append("\',\'");
|
||||
menuString.append(function.getFunctionUrl());
|
||||
//update-begin ---author:scott---for:外部链接在系统中配置无效----date:20150325
|
||||
|
||||
//如果是外部链接,则不加菜单ID
|
||||
if(function.getFunctionUrl().indexOf("http:")==-1){
|
||||
//update-begin--Author:jg_renjie Date:20150715 for:解决rest风格时,传入id错误的问题
|
||||
|
||||
if(function.getFunctionUrl().indexOf("?") == -1){
|
||||
menuString.append("?clickFunctionId=");
|
||||
} else {
|
||||
menuString.append("&clickFunctionId=");
|
||||
}
|
||||
//update-end--Author:jg_renjie Date:20150715 for:解决rest风格时,传入id错误的问题
|
||||
|
||||
menuString.append(function.getId());
|
||||
}
|
||||
//update-end ---author:scott---for:外部链接在系统中配置无效----date:20150325
|
||||
|
||||
menuString.append("\',\'");
|
||||
menuString.append(icon);
|
||||
menuString.append("\')\" title=\"");
|
||||
|
@ -462,7 +458,7 @@ public class ListtoMenu {
|
|||
//绘制一级菜单
|
||||
menuString.append(" <li class=\"dropdown\"> ");
|
||||
menuString.append(" <a href=\"javascript:;\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"> ");
|
||||
menuString.append(" <span class=\"bootstrap-icon\" style=\"background-image: url('"+TSIcon.allTSIcons.get(pFunction.getTSIcon().getId()).getIconPath()+"')\"></span> "+pFunction.getFunctionName()+" ");
|
||||
menuString.append(" <span class=\"bootstrap-icon\" style=\"background-image: url('"+ResourceUtil.allTSIcons.get(pFunction.getTSIcon().getId()).getIconPath()+"')\"></span> "+pFunction.getFunctionName()+" ");
|
||||
if(hasSub){
|
||||
menuString.append(" <b class=\"caret\"></b> ");
|
||||
}
|
||||
|
@ -518,8 +514,6 @@ public class ListtoMenu {
|
|||
return menuString.toString();
|
||||
}
|
||||
|
||||
|
||||
//update-start--Author:gaofeng Date:2014-02-14:新增webos头部菜单导航,多级菜单
|
||||
/**
|
||||
* 拼装webos头部菜单
|
||||
* @param pFunctions
|
||||
|
@ -554,7 +548,7 @@ public class ListtoMenu {
|
|||
// menuString.append("{ ");
|
||||
menuString.append("\""+ pFunction.getId() + "\":");
|
||||
menuString.append("{\"id\":\""+pFunction.getId()+"\",\"name\":\""+pFunction.getFunctionName()
|
||||
+"\",\"path\":\""+TSIcon.allTSIcons.get(pFunction.getTSIcon().getId()).getIconPath()+"\",\"level\":\""+pFunction.getFunctionLevel()+"\",");
|
||||
+"\",\"path\":\""+ResourceUtil.allTSIcons.get(pFunction.getTSIcon().getId()).getIconPath()+"\",\"level\":\""+pFunction.getFunctionLevel()+"\",");
|
||||
menuString.append("\"child\":{");
|
||||
|
||||
//绘制Deskpanel数组
|
||||
|
@ -648,10 +642,10 @@ public class ListtoMenu {
|
|||
dataString.append("'"+function.getId()+"':{ ");
|
||||
dataString.append("appid:'"+function.getId()+"',");
|
||||
dataString.append("url:'"+function.getFunctionUrl()+"',");
|
||||
// update-begin--Author:zhangguoming Date:20140509 for:添加云桌面图标
|
||||
|
||||
// dataString.append(getIconandName(function.getFunctionName()));
|
||||
dataString.append(getIconAndNameForDesk(function));
|
||||
// update-end--Author:zhangguoming Date:20140509 for:添加云桌面图标
|
||||
|
||||
dataString.append("asc :"+function.getFunctionOrder());
|
||||
dataString.append(" },");
|
||||
}
|
||||
|
@ -661,7 +655,6 @@ public class ListtoMenu {
|
|||
return data;
|
||||
}
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140512 for:添加云桌面图标管理
|
||||
private static String getIconAndNameForDesk(TSFunction function) {
|
||||
StringBuffer dataString = new StringBuffer();
|
||||
|
||||
|
@ -741,8 +734,7 @@ public class ListtoMenu {
|
|||
String lang_context = mutiLangService.getLang(functionName);
|
||||
return lang_context;
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140512 for:添加云桌面图标管理
|
||||
//update-start--Author:gaofeng Date:2014-02-14:新增Webos头部菜单导航,多级菜单
|
||||
|
||||
|
||||
public static String getDIYMultistageTree(Map<Integer, List<TSFunction>> map) {
|
||||
if(map==null||map.size()==0||!map.containsKey(0)){return "不具有任何权限,\n请找管理员分配权限";}
|
||||
|
@ -789,7 +781,7 @@ public class ListtoMenu {
|
|||
String icon = "folder";
|
||||
try{
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
}catch(Exception e){
|
||||
//TODO handle icon load exception
|
||||
|
@ -805,7 +797,6 @@ public class ListtoMenu {
|
|||
return menuString.toString();
|
||||
}
|
||||
|
||||
//update-start--Author:龙金波 Date:2015-03-16:新增ACE左侧菜单导航,多级
|
||||
public static String getAceMultistageTree(Map<Integer, List<TSFunction>> map) {
|
||||
if(map==null||map.size()==0||!map.containsKey(0)){return "不具有任何权限,\n请找管理员分配权限";}
|
||||
StringBuffer menuString = new StringBuffer();
|
||||
|
@ -857,7 +848,7 @@ public class ListtoMenu {
|
|||
StringBuffer menuString = new StringBuffer();
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
//addTabs({id:'home',title:'首页',close: false,url: 'loginController.do?home'});
|
||||
String name = getMutiLang(function.getFunctionName()) ;
|
||||
|
@ -883,7 +874,7 @@ public class ListtoMenu {
|
|||
StringBuffer menuString = new StringBuffer();
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = TSIcon.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
String name = getMutiLang(function.getFunctionName()) ;
|
||||
menuString.append("<li iconCls=\"");
|
||||
|
@ -905,4 +896,59 @@ public class ListtoMenu {
|
|||
menuString.append("</a></li>");
|
||||
return menuString.toString();
|
||||
}
|
||||
|
||||
public static String getHplusMultistageTree(Map<Integer, List<TSFunction>> map) {
|
||||
if(map==null||map.size()==0||!map.containsKey(0)){return "不具有任何权限,\n请找管理员分配权限";}
|
||||
StringBuffer menuString = new StringBuffer();
|
||||
List<TSFunction> list = map.get(0);
|
||||
int curIndex = 0;
|
||||
for (TSFunction function : list) {
|
||||
menuString.append("<li>");
|
||||
menuString.append("<a href=\"#\" class=\"\" ><i class=\"fa fa-columns\"></i>");
|
||||
menuString.append("<span class=\"menu-text\">");
|
||||
menuString.append(getMutiLang(function.getFunctionName()));
|
||||
menuString.append("</span>");
|
||||
menuString.append("<span class=\"fa arrow\">");
|
||||
menuString.append("</span>");
|
||||
if(!function.hasSubFunction(map)){
|
||||
menuString.append("</a></li>");
|
||||
//menuString.append(getSubMenu(function,1,map));
|
||||
}else{
|
||||
//menuString.append("<b class=\"arrow icon-angle-down\"></b></a><ul class=\"submenu\" >");
|
||||
menuString.append("</a><ul class=\"nav nav-second-level\" >");
|
||||
menuString.append(getHplusSubMenu(function,1,map));
|
||||
menuString.append("</ul></li>");
|
||||
}
|
||||
curIndex++;
|
||||
}
|
||||
|
||||
return menuString.toString();
|
||||
}
|
||||
|
||||
private static String getHplusSubMenu(TSFunction parent, int level, Map<Integer, List<TSFunction>> map) {
|
||||
StringBuffer menuString = new StringBuffer();
|
||||
List<TSFunction> list = map.get(level);
|
||||
for (TSFunction function : list) {
|
||||
if (function.getTSFunction().getId().equals(parent.getId())){
|
||||
if(!function.hasSubFunction(map)){
|
||||
menuString.append(getLeafOfHplusTree(function));
|
||||
}
|
||||
}
|
||||
}
|
||||
return menuString.toString();
|
||||
}
|
||||
|
||||
private static String getLeafOfHplusTree(TSFunction function) {
|
||||
StringBuffer menuString = new StringBuffer();
|
||||
String icon = "folder";
|
||||
if (function.getTSIcon() != null) {
|
||||
icon = ResourceUtil.allTSIcons.get(function.getTSIcon().getId()).getIconClas();
|
||||
}
|
||||
//addTabs({id:'home',title:'首页',close: false,url: 'loginController.do?home'});
|
||||
String name = getMutiLang(function.getFunctionName()) ;
|
||||
menuString.append("<li> <a class=\"J_menuItem\" href=\"").append(function.getFunctionUrl()).append("\">");
|
||||
menuString.append(name);
|
||||
menuString.append("</a></li>");
|
||||
return menuString.toString();
|
||||
}
|
||||
}
|
|
@ -196,11 +196,11 @@ public class LogUtil {
|
|||
|
||||
public static void log(String level, Object msg, Throwable e)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
try{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Throwable t = new Throwable();
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
t.printStackTrace(pw);
|
||||
String input = sw.getBuffer().toString();
|
||||
StringReader sr = new StringReader(input);
|
||||
|
@ -227,7 +227,13 @@ public class LogUtil {
|
|||
sb.append(msg);
|
||||
getLogger().log((Priority) Level.toLevel(level), sb.toString(), e);
|
||||
}catch(Exception ex){
|
||||
org.jeecgframework.core.util.LogUtil.info(ex.getLocalizedMessage());
|
||||
ex.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
sw.close();
|
||||
pw.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecgframework.core.util;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jeecgframework.core.common.model.json.ComboTree;
|
||||
import org.jeecgframework.web.system.pojo.base.MutiLangEntity;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
|
||||
|
@ -93,6 +94,20 @@ public class MutiLangUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ComboTree国际化方法
|
||||
* @author xgj
|
||||
* */
|
||||
public static void setMutiComboTree(List<ComboTree> treeList){
|
||||
for (ComboTree index : treeList) {
|
||||
index.setText(getMutiLangInstance().getLang(index.getText()));
|
||||
if (index.getChildren()!= null && index.getChildren().size() > 0 )
|
||||
{
|
||||
setMutiComboTree(index.getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查国际化内容或lang_key是否已经存在
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
@ -12,7 +13,11 @@ import javax.servlet.http.HttpSession;
|
|||
import org.jeecgframework.core.constant.DataBaseConstant;
|
||||
import org.jeecgframework.web.system.manager.ClientManager;
|
||||
import org.jeecgframework.web.system.pojo.base.Client;
|
||||
import org.jeecgframework.web.system.pojo.base.DynamicDataSourceEntity;
|
||||
import org.jeecgframework.web.system.pojo.base.TSIcon;
|
||||
import org.jeecgframework.web.system.pojo.base.TSRoleFunction;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.pojo.base.TSUser;
|
||||
|
||||
|
||||
|
@ -22,11 +27,38 @@ import org.jeecgframework.web.system.pojo.base.TSUser;
|
|||
*/
|
||||
public class ResourceUtil {
|
||||
public static final String LOCAL_CLINET_USER = "LOCAL_CLINET_USER";
|
||||
/**
|
||||
* 缓存字段分组【缓存】
|
||||
*/
|
||||
public static Map<String, TSTypegroup> allTypeGroups = new HashMap<String,TSTypegroup>();
|
||||
/**
|
||||
* 缓存字典【缓存】
|
||||
*/
|
||||
public static Map<String, List<TSType>> allTypes = new HashMap<String,List<TSType>>();
|
||||
|
||||
/**
|
||||
* 国际化【缓存】
|
||||
*/
|
||||
public static Map<String, String> mutiLangMap = new HashMap<String, String>();
|
||||
/**
|
||||
* 缓存系统图标【缓存】
|
||||
*/
|
||||
public static Map<String, TSIcon> allTSIcons = new HashMap<String,TSIcon>();
|
||||
/**
|
||||
* 动态数据源【缓存】
|
||||
*/
|
||||
public static Map<String, DynamicDataSourceEntity> dynamicDataSourceMap = new HashMap<String, DynamicDataSourceEntity>();
|
||||
|
||||
private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("sysConfig");
|
||||
//update-begin--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
public final static boolean fuzzySearch= ResourceUtil.isFuzzySearch();
|
||||
//update-end--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
|
||||
/**
|
||||
* 属性文件[resources/sysConfig.properties]
|
||||
* #默认开启模糊查询方式 1为开启 条件无需带*就能模糊查询[暂时取消]
|
||||
* fuzzySearch=0
|
||||
*/
|
||||
|
||||
// public final static boolean fuzzySearch= ResourceUtil.isFuzzySearch();
|
||||
|
||||
|
||||
/**
|
||||
* 获取session定义名称
|
||||
|
@ -40,7 +72,7 @@ public class ResourceUtil {
|
|||
HttpSession session = ContextHolderUtils.getSession();
|
||||
if(ClientManager.getInstance().getClient(session.getId())!=null){
|
||||
return ClientManager.getInstance().getClient(session.getId()).getUser();
|
||||
//update-begin--update---author:scott-----------date:20151218-------for:解决分布式登录问题-------
|
||||
|
||||
}else{
|
||||
TSUser u = (TSUser) session.getAttribute(ResourceUtil.LOCAL_CLINET_USER);
|
||||
Client client = new Client();
|
||||
|
@ -49,7 +81,7 @@ public class ResourceUtil {
|
|||
client.setUser(u);
|
||||
ClientManager.getInstance().addClinet(session.getId(), client);
|
||||
}
|
||||
//update-end--update---author:scott-----------date:20151218-------for:解决分布式登录问题-------
|
||||
|
||||
return null;
|
||||
}
|
||||
@Deprecated
|
||||
|
@ -160,7 +192,6 @@ public class ResourceUtil {
|
|||
return DBTypeUtil.getDBType().toLowerCase();
|
||||
}
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140226 for:添加验证码
|
||||
/**
|
||||
* 获取随机码的长度
|
||||
*
|
||||
|
@ -178,7 +209,7 @@ public class ResourceUtil {
|
|||
public static String getRandCodeType() {
|
||||
return bundle.getString("randCodeType");
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140226 for:添加验证码
|
||||
|
||||
|
||||
/**
|
||||
* 获取组织机构编码长度的类型
|
||||
|
@ -208,8 +239,6 @@ public class ResourceUtil {
|
|||
key = key;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//update-begin--Author:zhangdaihao Date:20140913 for:获取系统上下文变量
|
||||
|
||||
//替换为系统的登录用户账号
|
||||
// if (key.equals(DataBaseConstant.CREATE_BY)
|
||||
|
@ -231,9 +260,6 @@ public class ResourceUtil {
|
|||
) {
|
||||
returnValue = getSessionUserName().getRealName();
|
||||
}
|
||||
|
||||
//update-end--Author:zhangdaihao Date:20140913 for:获取系统上下文变量
|
||||
//----------------------------------------------------------------
|
||||
//替换为系统登录用户的公司编码
|
||||
if (key.equals(DataBaseConstant.SYS_COMPANY_CODE)|| key.equals(DataBaseConstant.SYS_COMPANY_CODE_TABLE)) {
|
||||
returnValue = getSessionUserName().getCurrentDepart().getOrgCode()
|
||||
|
@ -304,9 +330,9 @@ public class ResourceUtil {
|
|||
org.jeecgframework.core.util.LogUtil.info(getPorjectPath());
|
||||
org.jeecgframework.core.util.LogUtil.info(getSysPath());
|
||||
}
|
||||
//update-begin--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
public static boolean isFuzzySearch(){
|
||||
return "1".equals(bundle.getString("fuzzySearch"));
|
||||
}
|
||||
//update-end--Author:zzl Date:20151123 for:加入配置属性可默认进行模糊查询
|
||||
|
||||
// public static boolean isFuzzySearch(){
|
||||
// return "1".equals(bundle.getString("fuzzySearch"));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class SqlUtil {
|
|||
sqlParam[0] = sql;
|
||||
sqlParam[1] = beginNum+"";
|
||||
sqlParam[2] = rows+"";
|
||||
DynamicDataSourceEntity dynamicSourceEntity = DynamicDataSourceEntity.DynamicDataSourceMap.get(dbKey);
|
||||
DynamicDataSourceEntity dynamicSourceEntity = ResourceUtil.dynamicDataSourceMap.get(dbKey);
|
||||
String databaseType = dynamicSourceEntity.getDbType();
|
||||
if(DATABSE_TYPE_MYSQL.equalsIgnoreCase(databaseType)){
|
||||
sql = MessageFormat.format(MYSQL_SQL, sqlParam);
|
||||
|
|
|
@ -0,0 +1,374 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.fileupload.FileItemIterator;
|
||||
import org.apache.commons.fileupload.FileItemStream;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
|
||||
/**
|
||||
* UEditor文件上传辅助类
|
||||
*
|
||||
*/
|
||||
public class Uploader {
|
||||
|
||||
// 文件大小常量, 单位kb
|
||||
private static final int MAX_SIZE = 500 * 1024;
|
||||
// 输出文件地址
|
||||
private String url = "";
|
||||
// 上传文件名
|
||||
private String fileName = "";
|
||||
// 状态
|
||||
private String state = "";
|
||||
// 文件类型
|
||||
private String type = "";
|
||||
// 原始文件名
|
||||
private String originalName = "";
|
||||
// 文件大小
|
||||
private String size = "";
|
||||
|
||||
private HttpServletRequest request = null;
|
||||
private String title = "";
|
||||
|
||||
// 保存路径
|
||||
private String savePath = "upload";
|
||||
// 文件允许格式
|
||||
private String[] allowFiles = { ".rar", ".doc", ".docx", ".zip", ".pdf",
|
||||
".txt", ".swf", ".wmv", ".gif", ".png", ".jpg", ".jpeg", ".bmp" };
|
||||
// 文件大小限制,单位Byte
|
||||
private long maxSize = 0;
|
||||
|
||||
private HashMap<String, String> errorInfo = new HashMap<String, String>();
|
||||
private Map<String, String> params = null;
|
||||
// 上传的文件数据
|
||||
private InputStream inputStream = null;
|
||||
|
||||
public static final String ENCODEING = System.getProperties().getProperty(
|
||||
"file.encoding");
|
||||
|
||||
public Uploader(HttpServletRequest request) {
|
||||
this.request = request;
|
||||
this.params = new HashMap<String, String>();
|
||||
|
||||
this.setMaxSize(Uploader.MAX_SIZE);
|
||||
|
||||
HashMap<String, String> tmp = this.errorInfo;
|
||||
tmp.put("SUCCESS", "SUCCESS"); // 默认成功
|
||||
// 未包含文件上传域
|
||||
tmp.put("NOFILE",
|
||||
"\\u672a\\u5305\\u542b\\u6587\\u4ef6\\u4e0a\\u4f20\\u57df");
|
||||
// 不允许的文件格式
|
||||
tmp.put("TYPE",
|
||||
"\\u4e0d\\u5141\\u8bb8\\u7684\\u6587\\u4ef6\\u683c\\u5f0f");
|
||||
// 文件大小超出限制
|
||||
tmp.put("SIZE",
|
||||
"\\u6587\\u4ef6\\u5927\\u5c0f\\u8d85\\u51fa\\u9650\\u5236");
|
||||
// 请求类型错误
|
||||
tmp.put("ENTYPE", "\\u8bf7\\u6c42\\u7c7b\\u578b\\u9519\\u8bef");
|
||||
// 上传请求异常
|
||||
tmp.put("REQUEST", "\\u4e0a\\u4f20\\u8bf7\\u6c42\\u5f02\\u5e38");
|
||||
// 未找到上传文件
|
||||
tmp.put("FILE", "\\u672a\\u627e\\u5230\\u4e0a\\u4f20\\u6587\\u4ef6");
|
||||
// IO异常
|
||||
tmp.put("IO", "IO\\u5f02\\u5e38");
|
||||
// 目录创建失败
|
||||
tmp.put("DIR", "\\u76ee\\u5f55\\u521b\\u5efa\\u5931\\u8d25");
|
||||
// 未知错误
|
||||
tmp.put("UNKNOWN", "\\u672a\\u77e5\\u9519\\u8bef");
|
||||
|
||||
this.parseParams();
|
||||
|
||||
}
|
||||
|
||||
public void upload() throws Exception {
|
||||
boolean isMultipart = ServletFileUpload
|
||||
.isMultipartContent(this.request);
|
||||
if (!isMultipart) {
|
||||
this.state = this.errorInfo.get("NOFILE");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.inputStream == null) {
|
||||
this.state = this.errorInfo.get("FILE");
|
||||
return;
|
||||
}
|
||||
|
||||
// 存储title
|
||||
this.title = this.getParameter("pictitle");
|
||||
|
||||
try {
|
||||
String savePath = this.getFolder(this.savePath);
|
||||
|
||||
if (!this.checkFileType(this.originalName)) {
|
||||
this.state = this.errorInfo.get("TYPE");
|
||||
return;
|
||||
}
|
||||
|
||||
this.fileName = this.getName(this.originalName);
|
||||
this.type = this.getFileExt(this.fileName);
|
||||
this.url = savePath + "/" + this.fileName;
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(
|
||||
this.getPhysicalPath(this.url));
|
||||
BufferedInputStream bis = new BufferedInputStream(this.inputStream);
|
||||
byte[] buff = new byte[128];
|
||||
int count = -1;
|
||||
|
||||
while ((count = bis.read(buff)) != -1) {
|
||||
|
||||
fos.write(buff, 0, count);
|
||||
|
||||
}
|
||||
|
||||
bis.close();
|
||||
fos.close();
|
||||
|
||||
this.state = this.errorInfo.get("SUCCESS");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.state = this.errorInfo.get("IO");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受并保存以base64格式上传的文件
|
||||
*
|
||||
* @param fieldName
|
||||
*/
|
||||
public void uploadBase64(String fieldName) {
|
||||
String savePath = this.getFolder(this.savePath);
|
||||
String base64Data = this.request.getParameter(fieldName);
|
||||
this.fileName = this.getName("test.png");
|
||||
this.url = savePath + "/" + this.fileName;
|
||||
Base64 decoder=new Base64();
|
||||
|
||||
try {
|
||||
File outFile = new File(this.getPhysicalPath(this.url));
|
||||
OutputStream ro = new FileOutputStream(outFile);
|
||||
byte[] b = decoder.encode(base64Data.getBytes());
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
if (b[i] < 0) {
|
||||
b[i] += 256;
|
||||
}
|
||||
}
|
||||
ro.write(b);
|
||||
ro.flush();
|
||||
ro.close();
|
||||
this.state = this.errorInfo.get("SUCCESS");
|
||||
} catch (Exception e) {
|
||||
this.state = this.errorInfo.get("IO");
|
||||
}
|
||||
}
|
||||
|
||||
public String getParameter(String name) {
|
||||
|
||||
return this.params.get(name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件类型判断
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
private boolean checkFileType(String fileName) {
|
||||
Iterator<String> type = Arrays.asList(this.allowFiles).iterator();
|
||||
while (type.hasNext()) {
|
||||
String ext = type.next();
|
||||
if (fileName.toLowerCase().endsWith(ext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private String getFileExt(String fileName) {
|
||||
return fileName.substring(fileName.lastIndexOf("."));
|
||||
}
|
||||
|
||||
private void parseParams() {
|
||||
|
||||
DiskFileItemFactory dff = new DiskFileItemFactory();
|
||||
try {
|
||||
ServletFileUpload sfu = new ServletFileUpload(dff);
|
||||
sfu.setSizeMax(this.maxSize);
|
||||
sfu.setHeaderEncoding(Uploader.ENCODEING);
|
||||
|
||||
FileItemIterator fii = sfu.getItemIterator(this.request);
|
||||
|
||||
while (fii.hasNext()) {
|
||||
FileItemStream item = fii.next();
|
||||
// 普通参数存储
|
||||
if (item.isFormField()) {
|
||||
|
||||
this.params.put(item.getFieldName(),
|
||||
this.getParameterValue(item.openStream()));
|
||||
|
||||
} else {
|
||||
|
||||
// 只保留一个
|
||||
if (this.inputStream == null) {
|
||||
this.inputStream = item.openStream();
|
||||
this.originalName = item.getName();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
this.state = this.errorInfo.get("UNKNOWN");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据原始文件名生成新文件名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getName(String fileName) {
|
||||
Random random = new Random();
|
||||
return this.fileName = "" + random.nextInt(10000)
|
||||
+ System.currentTimeMillis() + this.getFileExt(fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字符串创建本地目录 并按照日期建立子目录返回
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
private String getFolder(String path) {
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyyMMdd");
|
||||
path += "/" + formater.format(new Date());
|
||||
File dir = new File(this.getPhysicalPath(path));
|
||||
if (!dir.exists()) {
|
||||
try {
|
||||
dir.mkdirs();
|
||||
} catch (Exception e) {
|
||||
this.state = this.errorInfo.get("DIR");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的虚拟路径获取物理路径
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
private String getPhysicalPath(String path) {
|
||||
String servletPath = this.request.getServletPath();
|
||||
String realPath = this.request.getSession().getServletContext()
|
||||
.getRealPath(servletPath);
|
||||
return new File(realPath).getParent() + "/" + path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从输入流中获取字符串数据
|
||||
*
|
||||
* @param in
|
||||
* 给定的输入流, 结果字符串将从该流中读取
|
||||
* @return 从流中读取到的字符串
|
||||
*/
|
||||
private String getParameterValue(InputStream in) {
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
String result = "";
|
||||
String tmpString = null;
|
||||
|
||||
try {
|
||||
|
||||
while ((tmpString = reader.readLine()) != null) {
|
||||
result += tmpString;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private byte[] getFileOutputStream(InputStream in) {
|
||||
|
||||
try {
|
||||
return IOUtils.toByteArray(in);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setSavePath(String savePath) {
|
||||
this.savePath = savePath;
|
||||
}
|
||||
|
||||
public void setAllowFiles(String[] allowFiles) {
|
||||
this.allowFiles = allowFiles;
|
||||
}
|
||||
|
||||
public void setMaxSize(long size) {
|
||||
this.maxSize = size * 1024;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.fileName;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return this.originalName;
|
||||
}
|
||||
}
|
|
@ -11,9 +11,8 @@ public class YouBianCodeUtil {
|
|||
|
||||
// 数字位数(默认生成3位的数字)
|
||||
|
||||
//----update-begin--------autor:张肖江----------date:20150120--- for:postcode生成方式一位字符加四位数字,----
|
||||
private static final int numLength = 2;//代表数字位数
|
||||
//----update-end --------autor:张肖江----------date:20150120--- for:postcode生成方式一位字符加四位数字,----
|
||||
|
||||
public static final int zhanweiLength = 1+numLength;
|
||||
|
||||
/**
|
||||
|
@ -78,10 +77,9 @@ public class YouBianCodeUtil {
|
|||
public static synchronized String getSubYouBianCode(String parentCode,String localCode) {
|
||||
if(localCode!=null && localCode!=""){
|
||||
|
||||
//----update-begin--------autor:张肖江----------date:20150120--- for:解决postcode生成bug,----
|
||||
// return parentCode + getNextYouBianCode(localCode);
|
||||
return getNextYouBianCode(localCode);
|
||||
//----update-end----------autor:张肖江----------date:20150120--- for:解决postcode生成bug,----
|
||||
|
||||
}else{
|
||||
parentCode = parentCode + "A"+ getNextStrNum(0);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,238 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
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.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
|
||||
public class ZipUtil {
|
||||
/**
|
||||
* 解压到指定目录
|
||||
*
|
||||
* @param zipPath
|
||||
* @param descDir
|
||||
* @author isea533
|
||||
*/
|
||||
@Deprecated
|
||||
public static void unZipFiles(String zipPath, String descDir)
|
||||
throws IOException {
|
||||
unZipFiles(new File(zipPath), descDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压文件到指定目录
|
||||
*
|
||||
* @param zipFile
|
||||
* @param descDir
|
||||
* @author isea533
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static void unZipFiles(File zipFile, String descDir)
|
||||
throws IOException {
|
||||
File pathFile = new File(descDir);
|
||||
if (!pathFile.exists()) {
|
||||
pathFile.mkdirs();
|
||||
}
|
||||
ZipFile zip = new ZipFile(zipFile);
|
||||
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements();) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
String zipEntryName = entry.getName();
|
||||
InputStream in = zip.getInputStream(entry);
|
||||
String outPath = (descDir + zipEntryName).replaceAll("\\*", "/");
|
||||
outPath = new String(outPath.getBytes("utf-8"), "ISO8859-1");
|
||||
;
|
||||
// 判断路径是否存在,不存在则创建文件路径
|
||||
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
// 判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
|
||||
if (new File(outPath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
// 输出文件路径信息
|
||||
//System.out.println(outPath);
|
||||
|
||||
OutputStream out = new FileOutputStream(outPath);
|
||||
byte[] buf1 = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf1)) > 0) {
|
||||
out.write(buf1, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归压缩文件
|
||||
*
|
||||
* @param source
|
||||
* 源路径,可以是文件,也可以目录
|
||||
* @param destinct
|
||||
* 目标路径,压缩文件名
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void compress(String source, String destinct)
|
||||
throws IOException {
|
||||
List fileList = loadFilename(new File(source));
|
||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(
|
||||
new File(destinct)));
|
||||
|
||||
byte[] buffere = new byte[8192];
|
||||
int length;
|
||||
BufferedInputStream bis;
|
||||
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
File file = (File) fileList.get(i);
|
||||
zos.putNextEntry(new ZipEntry(getEntryName(source, file)));
|
||||
bis = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
while (true) {
|
||||
length = bis.read(buffere);
|
||||
if (length == -1)
|
||||
break;
|
||||
zos.write(buffere, 0, length);
|
||||
}
|
||||
bis.close();
|
||||
zos.closeEntry();
|
||||
}
|
||||
zos.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归获得该文件下所有文件名(不包括目录名)
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
private static List loadFilename(File file) {
|
||||
List filenameList = new ArrayList();
|
||||
if (file.isFile()) {
|
||||
filenameList.add(file);
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
filenameList.addAll(loadFilename(f));
|
||||
}
|
||||
}
|
||||
return filenameList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得zip entry 字符串
|
||||
*
|
||||
* @param base
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
private static String getEntryName(String base, File file) {
|
||||
File baseFile = new File(base);
|
||||
String filename = file.getPath();
|
||||
// int index=filename.lastIndexOf(baseFile.getName());
|
||||
if (baseFile.getParentFile().getParentFile() == null)
|
||||
return filename.substring(baseFile.getParent().length());
|
||||
return filename.substring(baseFile.getParent().length() + 1);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
//compress("D:/tomcat-5.5.20","d:/test/testZip.zip");
|
||||
unZip("D:/saas-plugin-web-master-shiro-mybatis.zip","D:/123");
|
||||
}
|
||||
|
||||
private static final int buffer = 2048;
|
||||
|
||||
/**
|
||||
* 解压Zip文件
|
||||
* @param path 文件目录
|
||||
*/
|
||||
public static void unZip(String path,String savepath)
|
||||
{
|
||||
int count = -1;
|
||||
File file = null;
|
||||
InputStream is = null;
|
||||
FileOutputStream fos = null;
|
||||
BufferedOutputStream bos = null;
|
||||
new File(savepath).mkdir(); //创建保存目录
|
||||
ZipFile zipFile = null;
|
||||
try
|
||||
{
|
||||
zipFile = new ZipFile(path,"gbk"); //解决中文乱码问题
|
||||
Enumeration<?> entries = zipFile.getEntries();
|
||||
|
||||
while(entries.hasMoreElements())
|
||||
{
|
||||
byte buf[] = new byte[buffer];
|
||||
|
||||
ZipEntry entry = (ZipEntry)entries.nextElement();
|
||||
|
||||
String filename = entry.getName();
|
||||
boolean ismkdir = false;
|
||||
if(filename.lastIndexOf("/") != -1){ //检查此文件是否带有文件夹
|
||||
ismkdir = true;
|
||||
}
|
||||
filename = savepath + filename;
|
||||
|
||||
if(entry.isDirectory()){ //如果是文件夹先创建
|
||||
file = new File(filename);
|
||||
file.mkdirs();
|
||||
continue;
|
||||
}
|
||||
file = new File(filename);
|
||||
if(!file.exists()){ //如果是目录先创建
|
||||
if(ismkdir){
|
||||
new File(filename.substring(0, filename.lastIndexOf("/"))).mkdirs(); //目录先创建
|
||||
}
|
||||
}
|
||||
file.createNewFile(); //创建文件
|
||||
|
||||
is = zipFile.getInputStream(entry);
|
||||
fos = new FileOutputStream(file);
|
||||
bos = new BufferedOutputStream(fos, buffer);
|
||||
|
||||
while((count = is.read(buf)) > -1)
|
||||
{
|
||||
bos.write(buf, 0, count);
|
||||
}
|
||||
bos.flush();
|
||||
bos.close();
|
||||
fos.close();
|
||||
|
||||
is.close();
|
||||
}
|
||||
|
||||
zipFile.close();
|
||||
|
||||
}catch(IOException ioe){
|
||||
ioe.printStackTrace();
|
||||
}finally{
|
||||
try{
|
||||
if(bos != null){
|
||||
bos.close();
|
||||
}
|
||||
if(fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
if(is != null){
|
||||
is.close();
|
||||
}
|
||||
if(zipFile != null){
|
||||
zipFile.close();
|
||||
}
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,15 +27,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||
*
|
||||
*/
|
||||
public class oConvertUtils {
|
||||
/**
|
||||
* 判断字符串是否为空
|
||||
*/
|
||||
static Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
public static Map<String, Object> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static boolean isEmpty(Object object) {
|
||||
if (object == null) {
|
||||
return (true);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
|
@ -25,17 +23,22 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
* @version V1.0
|
||||
*/
|
||||
public class AuthFilterTag extends TagSupport{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**列表容器的ID*/
|
||||
protected String name;
|
||||
@Autowired
|
||||
private static SystemService systemService;
|
||||
private SystemService systemService;
|
||||
public int doStartTag() throws JspException {
|
||||
return super.doStartTag();
|
||||
}
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
|
@ -57,7 +60,7 @@ public class AuthFilterTag extends TagSupport{
|
|||
protected void getAuthFilter(StringBuilder out) {
|
||||
out.append("<script type=\"text/javascript\">");
|
||||
out.append("$(document).ready(function(){");
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
}else{
|
||||
Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES);
|
||||
|
@ -65,8 +68,7 @@ public class AuthFilterTag extends TagSupport{
|
|||
for (String MyoperationCode : operationCodes) {
|
||||
if (oConvertUtils.isEmpty(MyoperationCode))
|
||||
break;
|
||||
systemService = ApplicationContextUtil.getContext().getBean(
|
||||
SystemService.class);
|
||||
systemService = ApplicationContextUtil.getContext().getBean(SystemService.class);
|
||||
TSOperation operation = systemService.getEntity(TSOperation.class, MyoperationCode);
|
||||
if (operation.getOperationcode().startsWith(".") || operation.getOperationcode().startsWith("#")){
|
||||
if (operation.getOperationType().intValue()==Globals.OPERATION_TYPE_HIDE){
|
||||
|
@ -82,7 +84,7 @@ public class AuthFilterTag extends TagSupport{
|
|||
}
|
||||
|
||||
}
|
||||
//update-end--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
out.append("});");
|
||||
out.append("</script>");
|
||||
}
|
||||
|
|
|
@ -61,9 +61,11 @@ public class AutocompleteTag extends TagSupport {
|
|||
return EVAL_PAGE;
|
||||
}
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jeecgframework.core.util.oConvertUtils;
|
|||
public class BaseTag extends TagSupport {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String type = "default";// 加载类型
|
||||
// update-start--Author:longjb Date:20150317 for:修改增加easyui css主题目录切换的属性,默认default兼容前版本
|
||||
|
||||
protected String cssTheme ;
|
||||
|
||||
public String getCssTheme() {
|
||||
|
@ -33,7 +33,7 @@ public class BaseTag extends TagSupport {
|
|||
public void setCssTheme(String cssTheme) {
|
||||
this.cssTheme = cssTheme;
|
||||
}
|
||||
// update-end--Author:longjb Date:20150317 for:修改增加easyui css主题目录切换的属性
|
||||
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
|
@ -46,9 +46,11 @@ public class BaseTag extends TagSupport {
|
|||
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
JspWriter out = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String types[] = type.split(",");
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
out = this.pageContext.getOut();
|
||||
/*// update-start--Author:longjb Date:20150408 for:手动设置指定属性主题优先
|
||||
//if (cssTheme == null) {//
|
||||
Cookie[] cookies = ((HttpServletRequest) super.pageContext
|
||||
|
@ -62,7 +64,7 @@ public class BaseTag extends TagSupport {
|
|||
}
|
||||
}
|
||||
//}
|
||||
// update-start--Author:longjb Date:20150408 for:手动设置指定主题属性优先
|
||||
|
||||
if(cssTheme==null||"".equals(cssTheme)){
|
||||
cssTheme="default";
|
||||
}*/
|
||||
|
@ -72,24 +74,22 @@ public class BaseTag extends TagSupport {
|
|||
}else{
|
||||
sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
|
||||
}
|
||||
String types[] = type.split(",");
|
||||
|
||||
//插入多语言脚本
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
String langjs = StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/mutiLang/{0}.js\"></script>", "{0}", lang);
|
||||
sb.append(langjs);
|
||||
|
||||
// update-begin--Author:zhangguoming Date:20140521 for:云桌面图标拖拽、用户自定义桌面
|
||||
if (oConvertUtils.isIn("jquery-webos", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/sliding/js/jquery-1.7.1.min.js\"></script>");
|
||||
} else if (oConvertUtils.isIn("jquery", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
// update-begin--Author:longjb1 Date:20150515 for:增加jquery cookie缓存和localstorage插件
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery.cookie.js\" ></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/storage/jquery.storageapi.min.js\" ></script>");
|
||||
// update-end--Author:longjb1 Date:20150515 for:增加jquery cookie缓存和localstorage插件
|
||||
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140521 for:云桌面图标拖拽、用户自定义桌面
|
||||
|
||||
if (oConvertUtils.isIn("ckeditor", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ckeditor/ckeditor.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckeditorTool.js\"></script>");
|
||||
|
@ -100,11 +100,11 @@ public class BaseTag extends TagSupport {
|
|||
}
|
||||
if (oConvertUtils.isIn("easyui", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");
|
||||
// update-start--Author:longjb Date:20150317 for:修改增加easyui css主题目录切换的属性
|
||||
|
||||
// sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/easyui/themes/"+cssTheme+"/easyui.css\" type=\"text/css\"></link>");
|
||||
sb.append(SysThemesUtil.getEasyUiTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum));
|
||||
// update-end--Author:longjb Date:20150317 for:修改增加easyui css主题目录切换的属性
|
||||
|
||||
sb.append(SysThemesUtil.getEasyUiIconTheme(sysThemesEnum));
|
||||
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\">");
|
||||
|
@ -172,10 +172,10 @@ public class BaseTag extends TagSupport {
|
|||
|
||||
}
|
||||
if (oConvertUtils.isIn("tools", types)) {
|
||||
// update-start--Author:longjb Date:20150317 for:修改增加common css 重新定义了ace样式下的inputtxt
|
||||
|
||||
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/tools/css/"+("metro".equals(cssTheme)?"metro/":"")+"common.css\" type=\"text/css\"></link>");
|
||||
sb.append(SysThemesUtil.getCommonTheme(sysThemesEnum));
|
||||
// update-end--Author:longjb Date:20150317 for:修改增加common css 重新定义了ace样式下的inputtxt
|
||||
|
||||
// sb.append("<script type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js"+("metro".equals(cssTheme)?"?skin=metro":"")+"\"></script>");
|
||||
sb.append(SysThemesUtil.getLhgdialogTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getBootstrapTabTheme(sysThemesEnum));
|
||||
|
@ -206,8 +206,21 @@ public class BaseTag extends TagSupport {
|
|||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.datagrid.js\" type=\"text/javascript\"></script>");
|
||||
}
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(out!=null){
|
||||
try {
|
||||
|
||||
out.clearBuffer();
|
||||
sb.setLength(0);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -42,9 +42,10 @@ public class ChooseTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
title = MutiLangUtil.doMutiLang(title, langArg);
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
|
@ -165,11 +166,11 @@ public class ChooseTag extends TagSupport {
|
|||
private void clearAll(StringBuffer sb,String methodname) {
|
||||
String[] textnames=null;
|
||||
String[] inputTextnames=null;
|
||||
//update-begin--Author: jg_huangxg Date: 20160330 for: 防止空指针
|
||||
|
||||
if (!StringUtil.isEmpty(this.textname)) {
|
||||
textnames = textname.split(",");
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date: 20160330 for: 防止空指针
|
||||
|
||||
if(StringUtil.isNotEmpty(inputTextname)){
|
||||
inputTextnames = inputTextname.split(",");
|
||||
}else{
|
||||
|
|
|
@ -59,12 +59,19 @@ public class CkeditorTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -86,12 +86,19 @@ public class CkfinderTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -19,11 +19,19 @@ public class ColorChangeTag extends TagSupport {
|
|||
return EVAL_PAGE;
|
||||
}
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -30,12 +30,19 @@ public class ComboBoxTag extends TagSupport {
|
|||
return EVAL_PAGE;
|
||||
}
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -26,12 +26,19 @@ public class ComboTreeTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ public class DataGridColumnTag extends TagSupport {
|
|||
protected String title;
|
||||
protected String field;
|
||||
protected Integer width;
|
||||
//author:xugj start date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
protected Integer showLen;
|
||||
//author:xugj end date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
protected String rowspan;
|
||||
protected String colspan;
|
||||
protected String align;
|
||||
|
@ -26,9 +29,9 @@ public class DataGridColumnTag extends TagSupport {
|
|||
protected boolean checkbox;
|
||||
protected String formatter;
|
||||
protected String formatterjs;//自定义函数名称(调用页面自定义js方法 参数为(value,row,index)
|
||||
// update-start-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
protected boolean hidden=false;
|
||||
// update-end-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
protected String replace;
|
||||
protected String treefield;
|
||||
protected boolean image;
|
||||
|
@ -63,7 +66,7 @@ public class DataGridColumnTag extends TagSupport {
|
|||
|
||||
Tag t = findAncestorWithClass(this, DataGridTag.class);
|
||||
DataGridTag parent = (DataGridTag) t;
|
||||
parent.setColumn(title,field,width,rowspan,colspan,align,sortable,checkbox,formatter,formatterjs,hidden,replace,treefield,image,imageSize,query,url,funname,arg,queryMode, dictionary,popup,frozenColumn,extend,style,downloadName,autocomplete,extendParams,editor);
|
||||
parent.setColumn(title,field,width,showLen,rowspan,colspan,align,sortable,checkbox,formatter,formatterjs,hidden,replace,treefield,image,imageSize,query,url,funname,arg,queryMode, dictionary,popup,frozenColumn,extend,style,downloadName,autocomplete,extendParams,editor);
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
|
@ -207,4 +210,12 @@ public class DataGridColumnTag extends TagSupport {
|
|||
this.formatterjs = formatterjs;
|
||||
}
|
||||
|
||||
public Integer getShowLen() {
|
||||
return showLen;
|
||||
}
|
||||
|
||||
public void setShowLen(Integer showLen) {
|
||||
this.showLen = showLen;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import javax.servlet.jsp.JspTagException;
|
|||
import javax.servlet.jsp.tagext.Tag;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* 类描述:列表自定义函数操作项处理标签
|
||||
|
|
|
@ -1,33 +1,38 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.enums.SysThemesEnum;
|
||||
import org.jeecgframework.core.util.*;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.tag.vo.easyui.ColumnValue;
|
||||
import org.jeecgframework.tag.vo.easyui.DataGridColumn;
|
||||
import org.jeecgframework.tag.vo.easyui.DataGridUrl;
|
||||
import org.jeecgframework.tag.vo.easyui.OptTypeDirection;
|
||||
import org.jeecgframework.web.system.pojo.base.TSOperation;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,7 +85,8 @@ public class DataGridTag extends TagSupport {
|
|||
//private boolean frozenColumn=false; // 是否是冰冻列 默认不是
|
||||
private String langArg;
|
||||
|
||||
// update-start--Author:zhoujf Date:20150608 for:修改增加easyui css主题目录切换的属性,默认default兼容前版本
|
||||
private Boolean singleSelect;//是否单选true,false
|
||||
|
||||
protected String cssTheme ;
|
||||
|
||||
public String getCssTheme() {
|
||||
|
@ -89,7 +95,7 @@ public class DataGridTag extends TagSupport {
|
|||
public void setCssTheme(String cssTheme) {
|
||||
this.cssTheme = cssTheme;
|
||||
}
|
||||
// update-end--Author:zhoujf Date:20150608 for:修改增加easyui css主题目录切换的属性
|
||||
|
||||
|
||||
private boolean queryBuilder = false;// 高级查询器
|
||||
public boolean isQueryBuilder() {
|
||||
|
@ -176,6 +182,11 @@ public class DataGridTag extends TagSupport {
|
|||
public void setShowRefresh(boolean showRefresh) {
|
||||
this.showRefresh = showRefresh;
|
||||
}
|
||||
|
||||
public void setSingleSelect(Boolean singleSelect) {
|
||||
this.singleSelect = singleSelect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置询问操作URL
|
||||
*/
|
||||
|
@ -274,8 +285,9 @@ public class DataGridTag extends TagSupport {
|
|||
* @param title
|
||||
* @param field
|
||||
* @param width
|
||||
* @param showLen
|
||||
*/
|
||||
public void setColumn(String title, String field, Integer width, String rowspan,
|
||||
public void setColumn(String title, String field, Integer width,Integer showLen,String rowspan,
|
||||
String colspan, String align, boolean sortable, boolean checkbox,
|
||||
String formatter,String formatterjs, boolean hidden, String replace,
|
||||
String treefield, boolean image,String imageSize,
|
||||
|
@ -295,6 +307,9 @@ public class DataGridTag extends TagSupport {
|
|||
dataGridColumn.setSortable(sortable);
|
||||
dataGridColumn.setTitle(title);
|
||||
dataGridColumn.setWidth(width);
|
||||
//author:xugj--start--date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
dataGridColumn.setShowLen(showLen);
|
||||
//author:xugj--end---date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
dataGridColumn.setTreefield(treefield);
|
||||
dataGridColumn.setImage(image);
|
||||
dataGridColumn.setImageSize(imageSize);
|
||||
|
@ -314,7 +329,7 @@ public class DataGridTag extends TagSupport {
|
|||
dataGridColumn.setExtendParams(extendParams);
|
||||
dataGridColumn.setEditor(editor);
|
||||
columnList.add(dataGridColumn);
|
||||
//update-begin--Author:anchao Date:20140826 for:[bugfree号]数据列权限控制--------------------
|
||||
|
||||
Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES);
|
||||
if (null!=operationCodes) {
|
||||
for (String MyoperationCode : operationCodes) {
|
||||
|
@ -328,7 +343,7 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
}
|
||||
}
|
||||
//update-end--Author:anchao Date:20140826 for:[bugfree号]数据列权限控制--------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -374,7 +389,7 @@ public class DataGridTag extends TagSupport {
|
|||
}else{
|
||||
String text = "";
|
||||
String value = "";
|
||||
List<TSType> typeList = TSTypegroup.allTypes.get(dictionary.toLowerCase());
|
||||
List<TSType> typeList = ResourceUtil.allTypes.get(dictionary.toLowerCase());
|
||||
if (typeList != null && !typeList.isEmpty()) {
|
||||
for (TSType type : typeList) {
|
||||
text += MutiLangUtil.doMutiLang(type.getTypename(), "") + ",";
|
||||
|
@ -431,23 +446,16 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doStartTag() throws JspTagException {
|
||||
// 清空资源
|
||||
urlList.clear();
|
||||
toolBarList.clear();
|
||||
columnValueList.clear();
|
||||
columnStyleList.clear();
|
||||
columnList.clear();
|
||||
fields = "";
|
||||
searchFields = "";
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
title = MutiLangUtil.doMutiLang(title, langArg);
|
||||
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
// String indexStyle =null;
|
||||
//-----author:jg_longjb----start-----date:20150408--------for:读取cookie主题样式 ace界面下table的输出
|
||||
// Cookie[] cookies = ((HttpServletRequest) super.pageContext
|
||||
|
@ -466,6 +474,7 @@ public class DataGridTag extends TagSupport {
|
|||
// out.print(this.aceStyleTable().toString());
|
||||
// }else{
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
// }
|
||||
//-----author:jg_longjb----end-----date:20150408--------for:读取cookie主题样式 ace界面下table的输出
|
||||
}else{
|
||||
|
@ -474,6 +483,26 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(out!=null){
|
||||
try {
|
||||
|
||||
out.clearBuffer();
|
||||
end().setLength(0);
|
||||
// 清空资源
|
||||
urlList.clear();
|
||||
toolBarList.clear();
|
||||
columnValueList.clear();
|
||||
columnStyleList.clear();
|
||||
columnList.clear();
|
||||
fields = "";
|
||||
searchFields = "";
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
@ -526,9 +555,9 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append(",\"mData\":\"" + column.getField() + "\"");
|
||||
sb.append(",\"sWidth\":\"" + colwidth + "\"");
|
||||
sb.append(",\"bSortable\":" + column.isSortable() + "");
|
||||
// update-start-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
sb.append(",\"bVisible\":" + !column.isHidden() + "");
|
||||
// update-end-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
sb.append(",\"bSearchable\":" + column.isQuery() + "");
|
||||
}
|
||||
sb.append("}");
|
||||
|
@ -597,7 +626,11 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
sb.append("sortOrder:'" + sortOrder + "',");
|
||||
sb.append("rownumbers:true,");
|
||||
sb.append("singleSelect:" + !checkbox + ",");
|
||||
if(singleSelect==null){
|
||||
sb.append("singleSelect:" + !checkbox + ",");
|
||||
}else{
|
||||
sb.append("singleSelect:" + singleSelect + ",");
|
||||
}
|
||||
if (fitColumns) {
|
||||
sb.append("fitColumns:true,");
|
||||
} else {
|
||||
|
@ -643,12 +676,10 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("}");
|
||||
sb.append("});");
|
||||
this.setPager(sb, grid);
|
||||
//update-begin longjb 20150515 for:新增表头恢复函数调用
|
||||
//update-begin SCOTT 20150525 for: 特殊情况下,导致页面错乱,做下异常处理
|
||||
|
||||
sb.append("try{restoreheader();}catch(ex){}");
|
||||
sb.append("});");
|
||||
//update-end SCOTT 20150525 for: 特殊情况下,导致页面错乱,做下异常处理
|
||||
//update-begin longjb 20150515 for:新增表头恢复函数调用
|
||||
|
||||
sb.append("function reloadTable(){");
|
||||
sb.append("try{");
|
||||
sb.append(" $(\'#\'+gridname).datagrid(\'reload\');" );
|
||||
|
@ -662,7 +693,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("function getSelectRows(){");
|
||||
sb.append(" return $(\'#"+name+"\').datagrid('getChecked');");
|
||||
sb.append("}");
|
||||
//update-begin longjb 20150515 for:新增表头定义存储和恢复函数
|
||||
|
||||
sb.append(" function saveHeader(){");
|
||||
sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;");
|
||||
sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}");
|
||||
|
@ -697,7 +728,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append( "}");
|
||||
sb.append( "}");
|
||||
sb.append( "}");
|
||||
//update-end longjb 201515 for:新增表头定义存储和恢复函数
|
||||
|
||||
if (columnList.size() > 0) {
|
||||
sb.append("function " + name + "search(){");
|
||||
//update by jg_renjie at 2016/1/11 for:TASK #823 增加form实现Form表单验证
|
||||
|
@ -712,20 +743,18 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("var jsonparams=$.parseJSON(params);");
|
||||
sb.append("$(\'#" + name + "\')." + grid + "({url:'" + actionUrl + "&field=" + searchFields + "',queryParams:jsonparams});" + "}");
|
||||
|
||||
//update-begin chenxu 20140423 for:修改在弹出界面中使用single查询模式时,查询条件不起作用
|
||||
//searchbox框执行方法
|
||||
searchboxFun(sb,grid);
|
||||
//update-end chenxu 20140423 for:修改在弹出界面中使用single查询模式时,查询条件不起作用
|
||||
|
||||
//生成重置按钮功能js
|
||||
|
||||
//update-begin Robin 20140426 for:回车事件
|
||||
//回车事件
|
||||
sb.append("function EnterPress(e){");
|
||||
sb.append("var e = e || window.event;");
|
||||
sb.append("if(e.keyCode == 13){ ");
|
||||
sb.append(name+"search();");
|
||||
sb.append("}}");
|
||||
//update-begin Robin 20140426 for:回车事件
|
||||
|
||||
|
||||
sb.append("function searchReset(name){");
|
||||
sb.append(" $(\"#\"+name+\"tb\").find(\":input\").val(\"\");");
|
||||
|
@ -781,7 +810,7 @@ public class DataGridTag extends TagSupport {
|
|||
String[] dic = col.getDictionary().split(",");
|
||||
String sql = "select " + dic[1] + " as field," + dic[2]
|
||||
+ " as text from " + dic[0];
|
||||
System.out.println(dic[0]+"--"+dic[1]+"--"+dic[2]);
|
||||
//System.out.println(dic[0]+"--"+dic[1]+"--"+dic[2]);
|
||||
// <input type="text" name="order_code" style="width: 100px" class="searchbox-inputtext" value="" onClick="inputClick(this,'account','user_msg');" />
|
||||
sb.append("<input type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" style=\"width: 100px\" class=\"searchbox-inputtext\" value=\"\" onClick=\"inputClick(this,'"+dic[1]+"','"+dic[0]+"');\" /> ");
|
||||
}else if(col.getDictionary().contains(",")&&(!col.isPopup())){
|
||||
|
@ -800,7 +829,7 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
sb.append("</select>");
|
||||
}else{
|
||||
Map<String, List<TSType>> typedatas = TSTypegroup.allTypes;
|
||||
Map<String, List<TSType>> typedatas = ResourceUtil.allTypes;
|
||||
List<TSType> types = typedatas.get(col.getDictionary().toLowerCase());
|
||||
sb.append("<select name=\""+col.getField().replaceAll("_","\\.")+"\" WIDTH=\"100\" style=\"width: 104px\"> ");
|
||||
sb.append(StringUtil.replaceAll("<option value =\"\" >{0}</option>", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.please.select")));
|
||||
|
@ -818,8 +847,7 @@ public class DataGridTag extends TagSupport {
|
|||
}else if(col.isAutocomplete()){
|
||||
sb.append(getAutoSpan(col.getField().replaceAll("_","\\."),extendAttribute(col.getExtend())));
|
||||
}else{
|
||||
//update-begin Robin 20140426 for:回车事件 兼容IE,FF
|
||||
// update-start--Author:longjb Date:20150323 for:增加class属性便于样式控制
|
||||
|
||||
|
||||
sb.append("<input onkeypress=\"EnterPress(event)\" onkeydown=\"EnterPress()\" type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\" style=\"width: 100px\" />");
|
||||
}
|
||||
|
@ -827,7 +855,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("<input type=\"text\" name=\""+col.getField()+"_begin\" style=\"width: 94px\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\"/>");
|
||||
sb.append("<span style=\"display:-moz-inline-box;display:inline-block;width: 8px;text-align:right;\">~</span>");
|
||||
sb.append("<input type=\"text\" name=\""+col.getField()+"_end\" style=\"width: 94px\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\"/>");
|
||||
// update-end--Author:longjb Date:20150323 for:增加class属性便于样式控制
|
||||
|
||||
}
|
||||
sb.append("</span>");
|
||||
}
|
||||
|
@ -953,7 +981,7 @@ public class DataGridTag extends TagSupport {
|
|||
Gson gson = new Gson();
|
||||
Map<String, String> mp = gson.fromJson(field, Map.class);
|
||||
for(Map.Entry<String, String> entry: mp.entrySet()) {
|
||||
//update-author:scott for:jeecg-bpm修改- date:20151557
|
||||
|
||||
sb.append(entry.getKey()+"=" + gson.toJson(entry.getValue()) + "\"");
|
||||
}
|
||||
}
|
||||
|
@ -1049,7 +1077,6 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
}
|
||||
|
||||
//update-start--Author: jg_huangxg Date:20151204 for:增加styke属性便于样式控制
|
||||
StringBuffer style = new StringBuffer();
|
||||
if (!StringUtil.isEmpty(dataGridUrl.getUrlStyle())) {
|
||||
style.append(" style=\'");
|
||||
|
@ -1074,7 +1101,7 @@ public class DataGridTag extends TagSupport {
|
|||
if (OptTypeDirection.Deff.equals(dataGridUrl.getType())) {
|
||||
sb.append("href+=\"[<a href=\'" + url + "' title=\'"+dataGridUrl.getTitle()+"\'" + style.toString() + ">\";");
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date:20151204 for:增加styke属性便于样式控制
|
||||
|
||||
if (OptTypeDirection.OpenTab.equals(dataGridUrl.getType())) {
|
||||
sb.append("href+=\"[<a href=\'#\' onclick=addOneTab('" + dataGridUrl.getTitle() + "','" + url + "')>\";");
|
||||
}
|
||||
|
@ -1174,12 +1201,12 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append(","+column.getExtendParams().substring(0,
|
||||
column.getExtendParams().length()-1));
|
||||
}
|
||||
// update-start-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
// 隐藏字段
|
||||
if (column.isHidden()) {
|
||||
sb.append(",hidden:true");
|
||||
}
|
||||
// update-end-Author:zhangguoming Date:20140921 for:TASK #458 列表hidden=false,才是隐藏好像有点问题
|
||||
|
||||
if (!treegrid) {
|
||||
// 字段排序
|
||||
if ((column.isSortable()) && (field.indexOf("_") <= 0 && field != "opt")) {
|
||||
|
@ -1220,7 +1247,16 @@ public class DataGridTag extends TagSupport {
|
|||
{
|
||||
sb.append(",formatter:function(value,rec,index){");
|
||||
sb.append(" return new Date().format('"+column.getFormatter()+"',value);}");
|
||||
}else if (columnValueList.size() > 0 && !column.getField().equals("opt")) {// 值替換
|
||||
}
|
||||
//author:xugj-----start-----date:20160512 ---- for: TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制
|
||||
else if(column.getShowLen()!=null){ //设置了显示多少长度的
|
||||
sb.append(",formatter:function(value,rec,index){");
|
||||
sb.append(" if(value==undefined) {return ''} ");
|
||||
sb.append(" if(value.length<=");sb.append(column.getShowLen());sb.append(") {return value}");
|
||||
sb.append(" else{ return '<a title= '+value+'>'+ value.substring(0,");sb.append(column.getShowLen());sb.append(")+'...';}}");
|
||||
}
|
||||
//author:xugj-----end-----date:20160512 ---- for: TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制
|
||||
else if (columnValueList.size() > 0 && !column.getField().equals("opt")) {// 值替換
|
||||
String testString = "";
|
||||
for (ColumnValue columnValue : columnValueList) {
|
||||
if (columnValue.getName().equals(column.getField())) {
|
||||
|
@ -1323,7 +1359,7 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
|
||||
public String getNoAuthOperButton(){
|
||||
//update-begin--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
}else{
|
||||
|
@ -1349,7 +1385,7 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
|
||||
}
|
||||
//update-end--Author:anchao Date:20140822 for:[bugfree号]字段级权限(表单,列表)--------------------
|
||||
|
||||
//org.jeecgframework.core.util.LogUtil.info("----getNoAuthOperButton-------"+sb.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -1527,7 +1563,11 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
sb.append("sortOrder:'" + sortOrder + "',");
|
||||
sb.append("rownumbers:true,");
|
||||
sb.append("singleSelect:" + !checkbox + ",");
|
||||
if(singleSelect==null){
|
||||
sb.append("singleSelect:" + !checkbox + ",");
|
||||
}else{
|
||||
sb.append("singleSelect:" + singleSelect + ",");
|
||||
}
|
||||
if (fitColumns) {
|
||||
sb.append("fitColumns:true,");
|
||||
} else {
|
||||
|
@ -1587,7 +1627,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("function get" + name + "Selections(field){" + "var ids = [];" + "var rows = $(\'#" + name + "\')." + grid + "(\'getSelections\');" + "for(var i=0;i<rows.length;i++){" + "ids.push(rows[i][field]);" + "}" + "ids.join(\',\');" + "return ids" + "};");
|
||||
sb.append("function getSelectRows(){");
|
||||
sb.append(" return $(\'#"+name+"\').datagrid('getChecked');}");
|
||||
//update-begin longjb 20150515 for:新增表头定义存储和恢复函数
|
||||
|
||||
sb.append(" function saveHeader(){");
|
||||
sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;");
|
||||
sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}");
|
||||
|
@ -1622,7 +1662,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append( "}");
|
||||
sb.append( "}");
|
||||
sb.append( "}");
|
||||
//update-end longjb 201515 for:新增表头定义存储和恢复函数
|
||||
|
||||
if (columnList.size() > 0) {
|
||||
sb.append("function " + name + "search(){");
|
||||
sb.append("var queryParams=$(\'#" + name + "\').datagrid('options').queryParams;");
|
||||
|
@ -1641,7 +1681,7 @@ public class DataGridTag extends TagSupport {
|
|||
sb.append("if(e.keyCode == 13){ ");
|
||||
sb.append(name+"search();");
|
||||
sb.append("}}");
|
||||
//update-begin Robin 20140426 for:回车事件
|
||||
|
||||
|
||||
sb.append("function searchReset(name){");
|
||||
sb.append(" $(\"#"+name+"tb\").find(\":input\").val(\"\");");
|
||||
|
@ -1695,7 +1735,7 @@ public class DataGridTag extends TagSupport {
|
|||
}
|
||||
sb.append("</select>");
|
||||
}else{
|
||||
Map<String, List<TSType>> typedatas = TSTypegroup.allTypes;
|
||||
Map<String, List<TSType>> typedatas = ResourceUtil.allTypes;
|
||||
List<TSType> types = typedatas.get(col.getDictionary().toLowerCase());
|
||||
sb.append("<select name=\""+col.getField().replaceAll("_","\\.")+"\" WIDTH=\"100\" style=\"width: 104px\"> ");
|
||||
sb.append(StringUtil.replaceAll("<option value =\"\" >{0}</option>", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.please.select")));
|
||||
|
@ -1901,7 +1941,7 @@ appendLine(sb," }}\">关系</th>");
|
|||
appendLine(sb,"<th data-options=\"field:'condition',width:20,align:'right',formatter:function(value,row){");
|
||||
appendLine(sb," var data= ");
|
||||
appendLine(sb," [ ");
|
||||
Map<String, List<TSType>> typedatas = TSTypegroup.allTypes;
|
||||
Map<String, List<TSType>> typedatas = ResourceUtil.allTypes;
|
||||
List<TSType> types = typedatas.get("rulecon");
|
||||
if (types != null) {
|
||||
for (int i=0;i<types.size();i++){
|
||||
|
|
|
@ -4,10 +4,7 @@ import javax.servlet.jsp.JspTagException;
|
|||
import javax.servlet.jsp.tagext.Tag;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @author 张代浩
|
||||
|
|
|
@ -1,24 +1,13 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -107,11 +96,19 @@ public class DepartSelectTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
@ -173,7 +170,7 @@ public class DepartSelectTag extends TagSupport {
|
|||
|
||||
sb.append("function callbackDepartmentSelect() {");
|
||||
sb.append(" var iframe = this.iframe.contentWindow;");
|
||||
//update--start--by:jg_renjie--at:20160318 for:#942 【组件封装】组织机构弹出模式,目前是列表,得改造成树方式
|
||||
|
||||
//sb.append(" var departname = iframe.getdepartListSelections('text');");
|
||||
sb.append(" var treeObj = iframe.$.fn.zTree.getZTreeObj(\"departSelect\");");
|
||||
sb.append(" var nodes = treeObj.getCheckedNodes(true);");
|
||||
|
@ -188,7 +185,7 @@ public class DepartSelectTag extends TagSupport {
|
|||
sb.append(" $('#" + selectedNamesInputId + "').blur();");
|
||||
sb.append(" $('#" + selectedIdsInputId + "').val(ids);");
|
||||
sb.append("}");
|
||||
//update--end--by:jg_renjie--at:20160318 for:#942 【组件封装】组织机构弹出模式,目前是列表,得改造成树方式
|
||||
|
||||
sb.append("}");
|
||||
sb.append("</script>");
|
||||
return sb;
|
||||
|
|
|
@ -8,14 +8,13 @@ import javax.servlet.jsp.JspTagException;
|
|||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
@ -46,7 +45,6 @@ public class DictSelectTag extends TagSupport {
|
|||
private String dictText;// 自定义字典表的显示文本-字典的显示值
|
||||
private String extendJson;//扩展参数
|
||||
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
private String readonly;// 只读属性
|
||||
public String getReadonly() {
|
||||
return readonly;
|
||||
|
@ -54,9 +52,7 @@ public class DictSelectTag extends TagSupport {
|
|||
public void setReadonly(String readonly) {
|
||||
this.readonly = readonly;
|
||||
}
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
// update-begin--Author:jg_longjb龙金波 Date:20150313 for:增加查询条件属性
|
||||
private String dictCondition;
|
||||
public String getDictCondition() {
|
||||
return dictCondition;
|
||||
|
@ -65,8 +61,7 @@ public class DictSelectTag extends TagSupport {
|
|||
public void setDictCondition(String dicCondition) {
|
||||
this.dictCondition = dicCondition;
|
||||
}
|
||||
// update-end--Author:jg_longjb龙金波 Date:20150313 for:增加查询条件属性
|
||||
// update-start--Author:jg_huangxg Date:20151116 for:增加datatype属性
|
||||
|
||||
private String datatype;
|
||||
public String getDatatype() {
|
||||
return datatype;
|
||||
|
@ -75,7 +70,7 @@ public class DictSelectTag extends TagSupport {
|
|||
public void setDatatype(String datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
// update-end--Author:jg_longjb龙金波 Date:20150313 for:增加datatype属性
|
||||
|
||||
@Autowired
|
||||
private static SystemService systemService;
|
||||
|
||||
|
@ -84,11 +79,19 @@ public class DictSelectTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
@ -122,9 +125,8 @@ public class DictSelectTag extends TagSupport {
|
|||
}else {
|
||||
sb.append("<select name=\"" + field + "\"");
|
||||
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
|
||||
//增加扩展属性
|
||||
if (!StringUtils.isBlank(this.extendJson)) {
|
||||
|
@ -138,17 +140,17 @@ public class DictSelectTag extends TagSupport {
|
|||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
sb.append(">");
|
||||
//update-begin--Author:zhangdaihao Date:20140724 for:[bugfree号]默认选择项目--------------------
|
||||
|
||||
select("common.please.select", "", sb);
|
||||
//update-end--Author:zhangdaihao Date:20140724 for:[bugfree号]默认选择项目----------------------
|
||||
|
||||
for (Map<String, Object> map : list) {
|
||||
select(map.get("text").toString(), map.get("field").toString(), sb);
|
||||
}
|
||||
sb.append("</select>");
|
||||
}
|
||||
} else {
|
||||
TSTypegroup typeGroup = TSTypegroup.allTypeGroups.get(this.typeGroupCode.toLowerCase());
|
||||
List<TSType> types = TSTypegroup.allTypes.get(this.typeGroupCode.toLowerCase());
|
||||
TSTypegroup typeGroup = ResourceUtil.allTypeGroups.get(this.typeGroupCode.toLowerCase());
|
||||
List<TSType> types = ResourceUtil.allTypes.get(this.typeGroupCode.toLowerCase());
|
||||
if (hasLabel) {
|
||||
sb.append("<div class=\"" + divClass + "\">");
|
||||
sb.append("<label class=\"" + labelClass + "\" >");
|
||||
|
@ -175,9 +177,9 @@ public class DictSelectTag extends TagSupport {
|
|||
}
|
||||
} else {
|
||||
sb.append("<select name=\"" + field + "\"");
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
|
||||
//增加扩展属性
|
||||
if (!StringUtils.isBlank(this.extendJson)) {
|
||||
|
@ -192,9 +194,9 @@ public class DictSelectTag extends TagSupport {
|
|||
}
|
||||
this.datatype(sb);
|
||||
sb.append(">");
|
||||
//update-begin--Author:zhangdaihao Date:20140724 for:[bugfree号]默认选择项目--------------------
|
||||
|
||||
select("common.please.select", "", sb);
|
||||
//update-end--Author:zhangdaihao Date:20140724 for:[bugfree号]默认选择项目----------------------
|
||||
|
||||
for (TSType type : types) {
|
||||
select(type.getTypename(), type.getTypecode(), sb);
|
||||
}
|
||||
|
@ -238,9 +240,9 @@ public class DictSelectTag extends TagSupport {
|
|||
if (!StringUtils.isBlank(this.id)) {
|
||||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
|
||||
this.datatype(sb);
|
||||
sb.append(" />");
|
||||
|
@ -250,9 +252,9 @@ public class DictSelectTag extends TagSupport {
|
|||
if (!StringUtils.isBlank(this.id)) {
|
||||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.datatype(sb);
|
||||
sb.append(" />");
|
||||
}
|
||||
|
@ -285,9 +287,9 @@ public class DictSelectTag extends TagSupport {
|
|||
if (!StringUtils.isBlank(this.id)) {
|
||||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.datatype(sb);
|
||||
sb.append(" />");
|
||||
} else {
|
||||
|
@ -296,9 +298,9 @@ public class DictSelectTag extends TagSupport {
|
|||
if (!StringUtils.isBlank(this.id)) {
|
||||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
//update-begin--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.readonly(sb);
|
||||
//update-end--Author:jg_xugj 许国杰 Date:20151209 for:#775 增加只读属性
|
||||
|
||||
this.datatype(sb);
|
||||
sb.append(" />");
|
||||
}
|
||||
|
@ -332,11 +334,11 @@ public class DictSelectTag extends TagSupport {
|
|||
private List<Map<String, Object>> queryDic() {
|
||||
String sql = "select " + dictField + " as field," + dictText
|
||||
+ " as text from " + dictTable;
|
||||
// update-begin--Author:jg_longjb龙金波 Date:20150313 for:增加查询条件属性 例如:where type='xxx'
|
||||
|
||||
if(dictCondition!=null){
|
||||
sql+=dictCondition;
|
||||
}
|
||||
// update--end--Author:jg_longjb龙金波 Date:20150313 for:增加查询条件属性
|
||||
|
||||
systemService = ApplicationContextUtil.getContext().getBean(
|
||||
SystemService.class);
|
||||
List<Map<String, Object>> list = systemService.findForJdbc(sql);
|
||||
|
|
|
@ -30,9 +30,9 @@ public class FormValidationTag extends TagSupport {
|
|||
protected String action;// 表单提交路径
|
||||
protected String tabtitle;// 表单选项卡
|
||||
protected String tiptype = "4";//校验方式
|
||||
// update-start--Author:longjb Date:20150317 for:修改增加css样式类属性
|
||||
|
||||
protected String styleClass ;//table 样式
|
||||
// update-start--Author:longjb Date:20150323 for:修改增加css主题类属性
|
||||
|
||||
protected String cssTheme;//主题样式目录默认为空
|
||||
|
||||
public String getCssTheme() {
|
||||
|
@ -42,7 +42,7 @@ public class FormValidationTag extends TagSupport {
|
|||
public void setCssTheme(String cssTheme) {
|
||||
this.cssTheme = cssTheme;
|
||||
}
|
||||
// update-end--Author:longjb Date:20150323 for:修改增加css主题类属性
|
||||
|
||||
public String getStyleClass() {
|
||||
return styleClass;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class FormValidationTag extends TagSupport {
|
|||
public void setStyleClass(String styleClass) {
|
||||
this.styleClass = styleClass;
|
||||
}
|
||||
// update-end--Author:longjb Date:20150317 for:修改增加css样式类属性
|
||||
|
||||
public void setTabtitle(String tabtitle) {
|
||||
this.tabtitle = tabtitle;
|
||||
}
|
||||
|
@ -81,8 +81,10 @@ public class FormValidationTag extends TagSupport {
|
|||
|
||||
|
||||
public int doStartTag() throws JspException {
|
||||
JspWriter out = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
/*// if(cssTheme==null){//手工设置值优先
|
||||
Cookie[] cookies = ((HttpServletRequest) super.pageContext
|
||||
.getRequest()).getCookies();
|
||||
|
@ -96,18 +98,17 @@ public class FormValidationTag extends TagSupport {
|
|||
}
|
||||
// }
|
||||
if(cssTheme==null||"default".equals(cssTheme))cssTheme="";*/
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if ("div".equals(layout)) {
|
||||
sb.append("<div id=\"content\">");
|
||||
sb.append("<div id=\"wrapper\">");
|
||||
sb.append("<div id=\"steps\">");
|
||||
}
|
||||
sb.append("<form id=\"" + formid + "\" " );
|
||||
// update-start--Author:longjb Date:20150317 for:修改增加css样式类属性
|
||||
|
||||
if(this.getStyleClass()!=null){
|
||||
sb.append("class=\""+this.getStyleClass()+"\" ");
|
||||
}
|
||||
// update-end--Author:longjb Date:20150317 for:修改增加css样式类属性
|
||||
|
||||
sb.append(" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">");
|
||||
if ("btn_sub".equals(btnsub) && dialog)
|
||||
sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>");
|
||||
|
@ -121,6 +122,8 @@ public class FormValidationTag extends TagSupport {
|
|||
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
JspWriter out = null;
|
||||
try {
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
SysThemesEnum sysThemesEnum = null;
|
||||
|
@ -129,10 +132,9 @@ public class FormValidationTag extends TagSupport {
|
|||
}else{
|
||||
sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
|
||||
}
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
out = this.pageContext.getOut();
|
||||
if (layout.equals("div")) {
|
||||
// update-start--Author:longjb Date:20150323 for:修改增加css主题类属性
|
||||
|
||||
// if("metro".equals(cssTheme)){
|
||||
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/"+cssTheme+"/divfrom.css\" type=\"text/css\"/>");
|
||||
// }else{
|
||||
|
@ -155,7 +157,6 @@ public class FormValidationTag extends TagSupport {
|
|||
//tablefrom.css
|
||||
sb.append(SysThemesUtil.getValidformTablefrom(sysThemesEnum));
|
||||
|
||||
// update-end--Author:longjb Date:20150323 for:修改增加css主题类属性
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_v5.3.1_min_{0}.js\"></script>", "{0}", lang));
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_Datatype_{0}.js\"></script>", "{0}", lang));
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/Validform/js/datatype_{0}.js\"></script>", "{0}", lang));
|
||||
|
@ -231,7 +232,7 @@ public class FormValidationTag extends TagSupport {
|
|||
passsb.append("}");// trigger结尾
|
||||
passsb.append("}");// passwordstrength结尾
|
||||
}
|
||||
// update-start--Author:gaofeng Date:20140711 for:修改在使用jptransform时的逗号","拼接错误
|
||||
|
||||
sb.append("usePlugin:{");
|
||||
if (usePlugin.indexOf("password") >= 0) {
|
||||
sb.append(passsb);
|
||||
|
@ -243,7 +244,7 @@ public class FormValidationTag extends TagSupport {
|
|||
}
|
||||
jqsb.append("jqtransform :{selector:\"select\"}");
|
||||
}
|
||||
// update-end--Author:gaofeng Date:20140711 for:修改在使用jptransform时的逗号","拼接错误
|
||||
|
||||
if (usePlugin.indexOf("jqtransform") >= 0) {
|
||||
sb.append(jqsb);
|
||||
}
|
||||
|
@ -294,6 +295,14 @@ public class FormValidationTag extends TagSupport {
|
|||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
|
||||
sb.setLength(0);
|
||||
|
||||
out.clearBuffer();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -42,42 +42,52 @@ public class MenuTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
String menu = (String) this.pageContext.getSession().getAttribute("leftMenuCache"+style);
|
||||
if(menu!=null){
|
||||
out.print(menu);
|
||||
}else{
|
||||
menu=end().toString();
|
||||
this.pageContext.getSession().setAttribute("leftMenuCache"+style,menu);
|
||||
out.print(menu);
|
||||
|
||||
}
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
// String menu = (String) this.pageContext.getSession().getAttribute("leftMenuCache"+style);
|
||||
// if(menu!=null){
|
||||
// out.print(menu);
|
||||
// out.flush();
|
||||
// }else{
|
||||
// menu=end().toString();
|
||||
// this.pageContext.getSession().setAttribute("leftMenuCache"+style,menu);
|
||||
// out.print(menu);
|
||||
// out.flush();
|
||||
// }
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clearBuffer();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
public StringBuffer end() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// update-begin--Author:zhangguoming Date:20140622 for:左侧树调整:加大宽度、更换节点图标、修改选中颜色
|
||||
|
||||
if (style.equals("easyui")) {
|
||||
sb.append("<ul id=\"nav\" class=\"easyui-tree tree-lines\" fit=\"true\" border=\"false\">");
|
||||
sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style));
|
||||
sb.append("</ul>");
|
||||
}
|
||||
if(style.equals("shortcut"))
|
||||
// update-begin--Author:zhangguoming Date:20140429 for:在IE7下 导航显示问题
|
||||
|
||||
// { sb.append("<div id=\"nav\" style=\"display:none;\" class=\"easyui-accordion\" fit=\"true\" border=\"false\">");
|
||||
{
|
||||
sb.append("<div id=\"nav\" style=\"display:block;\" class=\"easyui-accordion\" fit=\"true\" border=\"false\">");
|
||||
// update-end--Author:zhangguoming Date:20140429 for:在IE7下 导航显示问题
|
||||
|
||||
sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style));
|
||||
sb.append("</div>");
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140622 for:左侧树调整:加大宽度、更换节点图标、修改选中颜色
|
||||
|
||||
if(style.equals("bootstrap"))
|
||||
{
|
||||
sb.append(ListtoMenu.getBootMenu(parentFun, childFun));
|
||||
|
@ -100,6 +110,9 @@ public class MenuTag extends TagSupport {
|
|||
{
|
||||
sb.append(ListtoMenu.getDIYMultistageTree(menuFun));
|
||||
}
|
||||
if(style.equals("hplus")){
|
||||
sb.append(ListtoMenu.getHplusMultistageTree(menuFun));
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
public void setStyle(String style) {
|
||||
|
|
|
@ -31,17 +31,24 @@ public class MutiLangTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
public StringBuffer end() {
|
||||
public String end() {
|
||||
if (mutiLangService == null)
|
||||
{
|
||||
mutiLangService = ApplicationContextUtil.getContext().getBean(MutiLangServiceI.class);
|
||||
|
@ -49,7 +56,7 @@ public class MutiLangTag extends TagSupport {
|
|||
|
||||
String lang_context = mutiLangService.getLang(langKey, langArg);
|
||||
|
||||
return new StringBuffer(lang_context);
|
||||
return lang_context;
|
||||
}
|
||||
|
||||
public void setLangKey(String langKey) {
|
||||
|
|
|
@ -94,12 +94,19 @@ public class TabsTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
@ -143,7 +150,9 @@ public class TabsTag extends TagSupport {
|
|||
|
||||
sb.append("function createFrame" + id + "(id)");
|
||||
sb.append("{");
|
||||
sb.append("var s = \'<iframe id=\"\'+id+\'\" scrolling=\"no\" frameborder=\"0\" src=\"about:jeecg\" width=\""+oConvertUtils.getString(width, "100%")+"\" height=\""+oConvertUtils.getString(heigth, "99.5%")+"\"></iframe>\';");
|
||||
|
||||
sb.append("var s = \'<iframe id=\"+id+\" scrolling=\"no\" frameborder=\"0\" src=\"about:jeecg\" width=\""+oConvertUtils.getString(width, "100%")+"\" height=\""+oConvertUtils.getString(heigth, "99.5%")+"\"></iframe>\';");
|
||||
|
||||
sb.append("return s;");
|
||||
sb.append("}");
|
||||
sb.append("});");
|
||||
|
@ -158,7 +167,9 @@ public class TabsTag extends TagSupport {
|
|||
sb.append("<div title=\"" + tab.getTitle() + "\" href=\"" + tab.getHref() + "\" style=\"margin:0px;padding:0px;overflow:hidden;\"></div>");
|
||||
} else {
|
||||
sb.append("<div title=\"" + tab.getTitle() + "\" style=\"margin:0px;padding:0px;overflow:hidden;\">");
|
||||
sb.append("<iframe id=\"\'"+tab.getId()+"\'\" scrolling=\"no\" frameborder=\"0\" src=\""+tab.getIframe()+"\" width=\""+oConvertUtils.getString(tab.getWidth(), "100%")+"\" height=\""+oConvertUtils.getString(tab.getHeigth(), "99.5%")+"\"></iframe>\';");
|
||||
|
||||
sb.append("<iframe id=\""+tab.getId()+"\" scrolling=\"no\" frameborder=\"0\" src=\""+tab.getIframe()+"\" width=\""+oConvertUtils.getString(tab.getWidth(), "100%")+"\" height=\""+oConvertUtils.getString(tab.getHeigth(), "99.5%")+"\"></iframe>");
|
||||
|
||||
sb.append("</div>");
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TagUtil {
|
|||
}
|
||||
value = reflectHelper.getMethodValue(fieldName)==null?"":reflectHelper.getMethodValue(fieldName);
|
||||
if (value !=""&&value != null && (FiledName.indexOf("_") != -1||FiledName.indexOf(".") != -1)) {
|
||||
// update-start--Author:zhangguoming Date:20140827 for:功能增强,添加处理对象中List<Object>属性字段的解析
|
||||
|
||||
if(value instanceof List) {
|
||||
Object tempValue = "";
|
||||
for (Object listValue : (List)value) {
|
||||
|
@ -84,10 +84,10 @@ public class TagUtil {
|
|||
} else {
|
||||
value = fieldNametoValues(childFieldName, value);
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140827 for:功能增强,添加处理对象中List<Object>属性字段的解析
|
||||
|
||||
}
|
||||
if(value != "" && value != null) {
|
||||
// update-begin--Author:jb_longjb 龙金波 Date:20150313 for:处理json中可能包含的特殊字符,防止页面加载出错
|
||||
|
||||
value = converunicode(value.toString());
|
||||
}
|
||||
return value;
|
||||
|
@ -97,7 +97,7 @@ public class TagUtil {
|
|||
for (int i=0; i<jsonValue.length(); i++) {
|
||||
char c = jsonValue.charAt(i);
|
||||
switch (c){
|
||||
// update-begin--Author:zhoujf Date:20150615 for:菜单图片不显示的问题
|
||||
|
||||
// case '\"':
|
||||
// sb.append("\\\"");
|
||||
// break;
|
||||
|
@ -110,7 +110,7 @@ public class TagUtil {
|
|||
// case '/':
|
||||
// sb.append("\\/");
|
||||
// break;
|
||||
// update-end--Author:zhoujf Date:20150615 for:菜单图片不显示的问题
|
||||
|
||||
case '\b':
|
||||
sb.append("\\b");
|
||||
break;
|
||||
|
@ -132,7 +132,7 @@ public class TagUtil {
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
// update-end--Author:jb_longjb 龙金波 Date:20150313 for:处理json中可能包含的特殊字符,防止页面加载出错
|
||||
|
||||
|
||||
/**
|
||||
* 对象转数组
|
||||
|
@ -157,21 +157,22 @@ public class TagUtil {
|
|||
* @param list
|
||||
*/
|
||||
private static String listtojson(String[] fields, int total, List<?> list, String[] footers) throws Exception {
|
||||
Object[] values = new Object[fields.length];
|
||||
//Object[] values = new Object[fields.length];
|
||||
StringBuffer jsonTemp = new StringBuffer();
|
||||
jsonTemp.append("{\"total\":" + total + ",\"rows\":[");
|
||||
int i;
|
||||
String fieldName;
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
jsonTemp.append("{\"state\":\"closed\",");
|
||||
Object fieldValue = null;
|
||||
for (i = 0; i < fields.length; ++i) {
|
||||
fieldName = fields[i].toString();
|
||||
if (list.get(j) instanceof Map)
|
||||
values[i] = ((Map<?, ?>) list.get(j)).get(fieldName);
|
||||
fieldValue = ((Map<?, ?>) list.get(j)).get(fieldName);
|
||||
else {
|
||||
values[i] = fieldNametoValues(fieldName, list.get(j));
|
||||
fieldValue = fieldNametoValues(fieldName, list.get(j));
|
||||
}
|
||||
jsonTemp.append("\"" + fieldName + "\"" + ":\"" + String.valueOf(values[i]).replace("\"", "\\\"") + "\"");
|
||||
jsonTemp.append("\"" + fieldName + "\"" + ":\"" + String.valueOf(fieldValue).replace("\"", "\\\"") + "\"");
|
||||
if (i != fields.length - 1) {
|
||||
jsonTemp.append(",");
|
||||
}
|
||||
|
@ -425,6 +426,11 @@ public class TagUtil {
|
|||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,12 +444,22 @@ public class TagUtil {
|
|||
response.setContentType("application/json");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
JSONObject object = TagUtil.getJson(dg);
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
PrintWriter pw=response.getWriter();
|
||||
pw=response.getWriter();
|
||||
pw.write(object.toString());
|
||||
pw.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
pw.close();
|
||||
|
||||
object.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -463,12 +479,22 @@ public class TagUtil {
|
|||
JSONObject o =(JSONObject) object2;
|
||||
o.putAll(extMap.get(o.get("id")));
|
||||
}
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
PrintWriter pw=response.getWriter();
|
||||
pw=response.getWriter();
|
||||
pw.write(object.toString());
|
||||
pw.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
pw.close();
|
||||
|
||||
object.clear();
|
||||
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,8 +511,15 @@ public class TagUtil {
|
|||
JSONObject object = TagUtil.getJson(dataTableReturn,field);
|
||||
try {
|
||||
response.getWriter().write(object.toString());
|
||||
response.getWriter().flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,7 +630,6 @@ public class TagUtil {
|
|||
return param;
|
||||
}
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150711 for:新增方法,将存储过程返回的数据解析为json格式
|
||||
public static String getJson(List fields,List datas){
|
||||
if(datas!=null && datas.size()>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
@ -617,7 +649,7 @@ public class TagUtil {
|
|||
return "{\"total\":\"0\",\"rows\":[]}";
|
||||
}
|
||||
}
|
||||
//update-begin--Author:luobaoli Date:20150711 for:新增方法,将存储过程返回的数据解析为json格式
|
||||
|
||||
|
||||
public static String getJsonByMap(List fields,List<Map<String,Object>> datas){
|
||||
if(datas!=null && datas.size()>0){
|
||||
|
|
|
@ -31,7 +31,7 @@ public class UploadTag extends TagSupport {
|
|||
protected boolean auto=false;//是否自动上传
|
||||
protected String onUploadSuccess;//上传成功处理函数
|
||||
protected boolean view=false;//生成查看删除链接
|
||||
// update-begin--Author:jb_longjb 龙金波 Date:20150318 for:新增formId属性,保持formData属性向前兼容
|
||||
|
||||
protected String formId;//参数名称
|
||||
|
||||
public String getFormId() {
|
||||
|
@ -40,7 +40,7 @@ public class UploadTag extends TagSupport {
|
|||
public void setFormId(String formId) {
|
||||
this.formId = formId;
|
||||
}
|
||||
// update-end--Author:jb_longjb 龙金波 Date:20150318 for:新增formId属性,保持formData属性向前兼容
|
||||
|
||||
|
||||
public void setView(boolean view) {
|
||||
this.view = view;
|
||||
|
@ -76,12 +76,19 @@ public class UploadTag extends TagSupport {
|
|||
return EVAL_PAGE;
|
||||
}
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
@ -135,7 +142,7 @@ public class UploadTag extends TagSupport {
|
|||
}
|
||||
}
|
||||
sb.append("});");
|
||||
// update-begin--Author:jb_longjb 龙金波 Date:20150318 for:用formId简化表单与附件同时提交的序列化问题
|
||||
|
||||
}else if (formId!=null) {
|
||||
sb.append(" var o = {};");
|
||||
sb.append(" var _array = $('#"+formId+"').serializeArray();");
|
||||
|
@ -151,7 +158,7 @@ public class UploadTag extends TagSupport {
|
|||
sb.append(" });");
|
||||
sb.append("$(\'#"+id+"\').uploadify(\"settings\", \"formData\", o);");
|
||||
};
|
||||
// update-end--Author:jb_longjb 龙金波 Date:20150318 for:简化表单与附件同时提交的序列化问题
|
||||
|
||||
sb.append("} ,"
|
||||
+"onQueueComplete : function(queueData) { ");
|
||||
if(dialog)
|
||||
|
@ -178,6 +185,9 @@ public class UploadTag extends TagSupport {
|
|||
if(view)
|
||||
{
|
||||
sb.append("var fileitem=\"<span id=\'\"+d.attributes.id+\"\'><a href=\'#\' onclick=openwindow(\'文件查看\',\'\"+d.attributes.viewhref+\"\',\'70%\',\'80%\') title=\'查看\'>\"+d.attributes.name+\"</a><img border=\'0\' onclick=confuploadify(\'\"+d.attributes.delurl+\"\',\'\"+d.attributes.id+\"\') title=\'删除\' src=\'plug-in/uploadify/img/uploadify-cancel.png\' widht=\'15\' height=\'15\'> </span>\";");
|
||||
|
||||
sb.append(" m=new Map(); ");
|
||||
|
||||
sb.append("m.put(d.attributes.id,fileitem);");
|
||||
sb.append("fileKey=d.attributes.fileKey;");
|
||||
}
|
||||
|
|
|
@ -99,11 +99,19 @@ public class UserSelectTag extends TagSupport {
|
|||
}
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
JspWriter out = this.pageContext.getOut();
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
out.clear();
|
||||
out.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ public class DataGridColumn {
|
|||
protected String title;//表格列名
|
||||
protected String field;//数据库对应字段
|
||||
protected Integer width;//宽度
|
||||
//author:xugj start date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
protected Integer showLen; //显示长度
|
||||
//author:xugj end date:2016年5月11日 for:TASK #1080 【UI标签改造】t:dgCol 显示内容长度控制 -->
|
||||
protected String rowspan;//跨列
|
||||
protected String colspan;//跨行
|
||||
protected String align;//对齐方式
|
||||
|
@ -106,6 +109,14 @@ public class DataGridColumn {
|
|||
this.width = width;
|
||||
}
|
||||
|
||||
public Integer getShowLen() {
|
||||
return showLen;
|
||||
}
|
||||
|
||||
public void setShowLen(Integer showLen) {
|
||||
this.showLen = showLen;
|
||||
}
|
||||
|
||||
public void setRowspan(String rowspan) {
|
||||
this.rowspan = rowspan;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgDynamGraphConfigHeadController.do")
|
||||
public class CgDynamGraphConfigHeadController extends BaseController {
|
||||
|
@ -49,15 +49,6 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
private CgDynamGraphConfigHeadServiceI cgDynamGraphConfigHeadService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -102,6 +93,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(CgDynamGraphConfigHeadEntity cgDynamGraphConfigHead, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgDynamGraphConfigHead = systemService.getEntity(CgDynamGraphConfigHeadEntity.class, cgDynamGraphConfigHead.getId());
|
||||
message = "动态报表配置抬头删除成功";
|
||||
|
@ -125,6 +117,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "动态报表配置抬头删除成功";
|
||||
try{
|
||||
|
@ -151,6 +144,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(CgDynamGraphConfigHeadEntity cgDynamGraphConfigHead,CgDynamGraphConfigHeadPage cgDynamGraphConfigHeadPage, HttpServletRequest request) {
|
||||
String message = null;
|
||||
List<CgDynamGraphConfigItemEntity> cgDynamGraphConfigItemList = cgDynamGraphConfigHeadPage.getCgDynamGraphConfigItemList();
|
||||
List<CgDynamGraphConfigParamEntity> cgDynamGraphConfigParamList = cgDynamGraphConfigHeadPage.getCgDynamGraphConfigParamList();
|
||||
AjaxJson j = new AjaxJson();
|
||||
|
@ -175,6 +169,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(CgDynamGraphConfigHeadEntity cgDynamGraphConfigHead,CgDynamGraphConfigHeadPage cgDynamGraphConfigHeadPage, HttpServletRequest request) {
|
||||
String message = null;
|
||||
List<CgDynamGraphConfigItemEntity> cgDynamGraphConfigItemList = cgDynamGraphConfigHeadPage.getCgDynamGraphConfigItemList();
|
||||
List<CgDynamGraphConfigParamEntity> cgDynamGraphConfigParamList = cgDynamGraphConfigHeadPage.getCgDynamGraphConfigParamList();
|
||||
AjaxJson j = new AjaxJson();
|
||||
|
|
|
@ -67,7 +67,6 @@ public class CgDynamGraphController extends BaseController {
|
|||
loadVars(cgDynamGraphMap,request);
|
||||
String html;
|
||||
|
||||
//update-begin--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
//判断是否为综合类
|
||||
Map<String, Object> mainConfig = (Map<String, Object> )cgDynamGraphMap.get(CgReportConstant.MAIN);
|
||||
String defaultGtype =mainConfig.get("graph_type")==null?null:(String)mainConfig.get("graph_type");
|
||||
|
@ -82,7 +81,7 @@ public class CgDynamGraphController extends BaseController {
|
|||
//设置gtype
|
||||
html = viewEngine.parseTemplate("/org/jeecgframework/web/cgdynamgraph/engine/core/cgDynamGraphDesignMobile.ftl", cgDynamGraphMap);
|
||||
}
|
||||
//update-end--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
|
||||
try {
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
|
@ -91,6 +90,12 @@ public class CgDynamGraphController extends BaseController {
|
|||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -259,7 +264,7 @@ public class CgDynamGraphController extends BaseController {
|
|||
}
|
||||
}
|
||||
//step.4 进行查询返回结果
|
||||
//update-begin--Author:张忠亮 Date:20150608 for:多数据源支持
|
||||
|
||||
String dbKey=(String)configM.get("db_source");
|
||||
List<Map<String, Object>> result=null;
|
||||
Long size=0l;
|
||||
|
@ -277,18 +282,24 @@ public class CgDynamGraphController extends BaseController {
|
|||
result= cgDynamGraphService.queryByCgDynamGraphSql(querySql, queryparams);
|
||||
size = cgDynamGraphService.countQueryByCgDynamGraphSql(querySql, queryparams);
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20150608 for:多数据源支持
|
||||
|
||||
dealDic(result,items);
|
||||
dealReplace(result,items);
|
||||
response.setContentType("application/json");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
PrintWriter writer;
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.println(CgReportQueryParamUtil.getJson(result,size));
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -309,7 +320,7 @@ public class CgDynamGraphController extends BaseController {
|
|||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String errorInfo = "解析失败!<br><br>失败原因:";
|
||||
//update-start--Author: jg_huangxg Date:20151210 for:修改提示内容
|
||||
|
||||
//无法直接捕捉到:java.net.ConnectException异常
|
||||
int i = e.getMessage().indexOf("Connection refused: connect");
|
||||
|
||||
|
@ -318,7 +329,7 @@ public class CgDynamGraphController extends BaseController {
|
|||
}else{
|
||||
errorInfo += "SQL语法错误.";
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date:20151210 for:修改提示内容
|
||||
|
||||
reJson.put("status", "error");
|
||||
reJson.put("datas", errorInfo);
|
||||
return reJson;
|
||||
|
@ -351,10 +362,10 @@ public class CgDynamGraphController extends BaseController {
|
|||
Matcher m = p.matcher(sql);
|
||||
while(m.find()){
|
||||
String whereParam = m.group();
|
||||
System.out.println(whereParam);
|
||||
//System.out.println(whereParam);
|
||||
sql = sql.replace(whereParam, "'' or 1=1 or 1=''");
|
||||
sql = sql.replace("'''", "''");
|
||||
System.out.println(sql);
|
||||
//System.out.println(sql);
|
||||
}
|
||||
//兼容图表
|
||||
regex = "\\{\\w+\\}";
|
||||
|
@ -362,9 +373,9 @@ public class CgDynamGraphController extends BaseController {
|
|||
m = p.matcher(sql);
|
||||
while(m.find()){
|
||||
String whereParam = m.group();
|
||||
System.out.println(whereParam);
|
||||
//System.out.println(whereParam);
|
||||
sql = sql.replace(whereParam, " 1=1 ");
|
||||
System.out.println(sql);
|
||||
//System.out.println(sql);
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
|
|
@ -44,10 +44,9 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
|
|||
/**修改人名称*/
|
||||
private java.lang.String updateName;
|
||||
|
||||
//update-begin--Author:张忠亮 Date:20150608 for:加入多数据源属性
|
||||
/**动态数据源*/
|
||||
private String dbSource;
|
||||
//update-end--Author:张忠亮 Date:20150608 for:加入多数据源属性
|
||||
|
||||
|
||||
|
||||
/**图表类型*/
|
||||
|
@ -237,7 +236,7 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
|
|||
public void setUpdateName(java.lang.String updateName){
|
||||
this.updateName = updateName;
|
||||
}
|
||||
//update-begin--Author:张忠亮 Date:20150608 for:加入多数据源属性
|
||||
|
||||
@Column(name ="db_source",length=36)
|
||||
public String getDbSource() {
|
||||
return dbSource;
|
||||
|
@ -246,7 +245,7 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
|
|||
public void setDbSource(String dbSource) {
|
||||
this.dbSource = dbSource;
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20150608 for:加入多数据源属性
|
||||
|
||||
|
||||
@Column(name ="graph_type",length=36)
|
||||
public String getGraphType() {
|
||||
|
|
|
@ -56,14 +56,13 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
|
|||
/**描述*/
|
||||
private java.lang.String content;
|
||||
|
||||
//update-begin--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
/**图表类型*/
|
||||
private String graphType;
|
||||
/**数据结构类型*/
|
||||
private String dataStructure;
|
||||
/**是否分页*/
|
||||
private String isPagination;
|
||||
//update-end--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -151,7 +150,7 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
|
|||
public void setContent(java.lang.String content){
|
||||
this.content = content;
|
||||
}
|
||||
//update-begin--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
|
||||
@Column(name ="graph_type",length=36)
|
||||
public String getGraphType() {
|
||||
return graphType;
|
||||
|
@ -178,6 +177,6 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
|
|||
public void setIsPagination(String isPagination) {
|
||||
this.isPagination = isPagination;
|
||||
}
|
||||
//update-end--Author:xuguojie Date:20160303 for: #959 【报表功能】在线配置图表改造,支持移动端单独展示
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ public class FormHtmlUtil {
|
|||
private static String getTextAreaFormHtml(
|
||||
CgFormFieldEntity cgFormFieldEntity) {
|
||||
StringBuilder html = new StringBuilder("");
|
||||
//update-begin--Author:zhoujf Date:20151218 for:online表单模板textarea优化--------------------
|
||||
|
||||
html.append("<textarea rows=\"6\" ");
|
||||
if(cgFormFieldEntity.getFieldLength()!=null&&cgFormFieldEntity.getFieldLength()>0){
|
||||
html.append("style=\"width:").append(cgFormFieldEntity.getFieldLength()).append("px\" ");
|
||||
}
|
||||
//update-end--Author:zhoujf Date:20151218 for:online表单模板textarea优化--------------------
|
||||
|
||||
html.append("id=\"").append(cgFormFieldEntity.getFieldName()).append("\" ");
|
||||
html.append("name=\"").append(cgFormFieldEntity.getFieldName()).append("\" ");
|
||||
if("Y".equals(cgFormFieldEntity.getIsNull())){
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
package org.jeecgframework.web.cgform.controller.autoform;
|
||||
|
||||
import freemarker.cache.StringTemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import oracle.sql.BLOB;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.codegenerate.database.JeecgReadTable;
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.exception.BusinessException;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
|
@ -21,8 +34,13 @@ import org.jeecgframework.core.util.MyBeanUtils;
|
|||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.SqlUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.*;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbFieldEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormParamEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity;
|
||||
import org.jeecgframework.web.cgform.service.autoform.AutoFormDbServiceI;
|
||||
import org.jeecgframework.web.cgform.service.autoform.AutoFormServiceI;
|
||||
import org.jeecgframework.web.cgform.util.AutoFormCommUtil;
|
||||
|
@ -43,22 +61,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Blob;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import freemarker.cache.StringTemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
|
||||
|
||||
|
@ -70,7 +76,7 @@ import java.util.Map;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/autoFormController")
|
||||
public class AutoFormController extends BaseController {
|
||||
|
@ -199,11 +205,11 @@ public class AutoFormController extends BaseController {
|
|||
autoForm.setFormContent(html);
|
||||
autoForm.setFormParse(autoForm.getFormContent());
|
||||
}
|
||||
//update-begin--Author:jg_renjie Date:20160131 for:针对默认字段 create_name、create_by等获取系统上下文值进行处理
|
||||
|
||||
autoForm.setCreateDate(new Date());
|
||||
autoForm.setCreateName(ResourceUtil.getSessionUserName().getRealName());
|
||||
autoForm.setCreateBy(ResourceUtil.getSessionUserName().getUserName());
|
||||
//update-end--Author:jg_renjie Date:20160131 for:针对默认字段 create_name、create_by等获取系统上下文值进行处理
|
||||
|
||||
autoFormService.save(autoForm);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
|
@ -243,11 +249,11 @@ public class AutoFormController extends BaseController {
|
|||
t.setFormContent(html);
|
||||
t.setFormParse(autoForm.getFormContent());
|
||||
}
|
||||
//update-begin--Author:jg_renjie Date:20160131 for:针对默认字段 create_name、create_by等获取系统上下文值进行处理
|
||||
|
||||
autoForm.setUpdateDate(new Date());
|
||||
autoForm.setUpdateName(ResourceUtil.getSessionUserName().getRealName());
|
||||
autoForm.setUpdateBy(ResourceUtil.getSessionUserName().getUserName());
|
||||
//update-end--Author:jg_renjie Date:20160131 for:针对默认字段 create_name、create_by等获取系统上下文值进行处理
|
||||
|
||||
autoFormService.saveOrUpdate(t);
|
||||
attributes.put("id", t.getId());
|
||||
j.setAttributes(attributes);
|
||||
|
@ -267,10 +273,8 @@ public class AutoFormController extends BaseController {
|
|||
autoForm.setFormParse(autoForm.getFormContent());
|
||||
}
|
||||
|
||||
//--update-begin-------------date:20151102---------for:check 表单编码不允许重复--------------------
|
||||
//TODO 待实现
|
||||
|
||||
//--update-end-------------date:20151102---------for:check 表单编码不允许重复----------------------
|
||||
autoFormService.save(autoForm);
|
||||
attributes.put("id", autoForm.getId());
|
||||
j.setAttributes(attributes);
|
||||
|
@ -296,14 +300,14 @@ public class AutoFormController extends BaseController {
|
|||
Elements IDs = doc.select("input[name$=.ID]");
|
||||
for (Element el: IDs) {
|
||||
String name = el.attr("name");
|
||||
System.out.println(name);
|
||||
//System.out.println(name);
|
||||
if(map.get(name)!=null){
|
||||
throw new BusinessException("主键ID有重复【"+name+"】,编辑器进入HTML模式删除重复的主键");
|
||||
}else{
|
||||
map.put(name, name);
|
||||
}
|
||||
}
|
||||
//update---begin---author:zhoujf------date:20151207---------------for:大小写问题修改-------------------------------
|
||||
|
||||
// Elements ids = doc.select("input[name$=.id]");
|
||||
// for (Element el: ids) {
|
||||
// String name = el.attr("name");
|
||||
|
@ -314,7 +318,7 @@ public class AutoFormController extends BaseController {
|
|||
// map.put(name, name);
|
||||
// }
|
||||
// }
|
||||
//update---end---author:zhoujf------date:20151207---------------for:大小写问题修改-------------------------------
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -405,9 +409,9 @@ public class AutoFormController extends BaseController {
|
|||
for(AutoFormDbEntity dbForm:list){
|
||||
map = new HashMap<String,Object>();
|
||||
map.put("id", dbForm.getId());
|
||||
//update-begin--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("name", dbForm.getDbChName()+"("+dbForm.getDbName()+")");
|
||||
//update-end--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("dbCode", dbForm.getDbName());
|
||||
map.put("pid", "0");
|
||||
//增加父节点
|
||||
|
@ -418,9 +422,9 @@ public class AutoFormController extends BaseController {
|
|||
for(AutoFormDbFieldEntity field: fieldlist){
|
||||
map = new HashMap<String,Object>();
|
||||
map.put("id", field.getId());
|
||||
//update-begin--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")");
|
||||
//update-end--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("pId", dbForm.getId());
|
||||
map.put("nocheck",true);
|
||||
dateList.add(map);
|
||||
|
@ -432,9 +436,9 @@ public class AutoFormController extends BaseController {
|
|||
for(AutoFormDbFieldEntity field: fieldlist){
|
||||
map = new HashMap<String,Object>();
|
||||
map.put("id", field.getId());
|
||||
//update-begin--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")");
|
||||
//update-end--Author: jg_huangxg Date:20151106 for:自定义表单时数据源树把数据源编码 和 字段属性名显示出来
|
||||
|
||||
map.put("pId", dbForm.getId());
|
||||
map.put("nocheck",true);
|
||||
dateList.add(map);
|
||||
|
@ -483,15 +487,15 @@ public class AutoFormController extends BaseController {
|
|||
dsData.put("dsName", db.getDbName());
|
||||
dsList.add(dsData);
|
||||
if("table".equals(db.getDbType())){
|
||||
//update-begin--Author: jg_huangxg Date:20151106 for:增加字段文本的查询,当字段文本为空时,使用字段名称
|
||||
|
||||
String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?";
|
||||
//update-end--Author: jg_huangxg Date:20151106 for:增加字段文本的查询,当字段文本为空时,使用字段名称
|
||||
|
||||
List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId);
|
||||
dsData.put("columns", columns);
|
||||
} else if("sql".equals(db.getDbType())){
|
||||
//update-begin--Author: jg_huangxg Date:20151106 for:增加字段文本的查询,当字段文本为空时,使用字段名称
|
||||
|
||||
String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?";
|
||||
//update-end--Author: jg_huangxg Date:20151106 for:增加字段文本的查询,当字段文本为空时,使用字段名称
|
||||
|
||||
List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId);
|
||||
if(columns.size()>0){
|
||||
dsData.put("columns", columns);
|
||||
|
@ -552,7 +556,15 @@ public class AutoFormController extends BaseController {
|
|||
if(StringUtils.isNotBlank(autoForm.getId())){
|
||||
autoForm = this.systemService.findUniqueByProperty(AutoFormEntity.class, "id", autoForm.getId());
|
||||
List<String> paramList = getFormParams(autoForm.getId());
|
||||
//3.传递参数
|
||||
List<AutoFormDbEntity> autoList = systemService.findByProperty(AutoFormDbEntity.class, "dbName", autoForm.getMainTableSource());
|
||||
if (autoList!=null&&autoList.size()>0) {
|
||||
AutoFormDbEntity autoFormDbEntity = autoList.get(0);
|
||||
|
||||
//3.传递参数
|
||||
//req.setAttribute("tbDbKey", autoFormDbEntity.getTbDbKey());
|
||||
req.setAttribute("dbKey", autoFormDbEntity.getDbKey());
|
||||
|
||||
}
|
||||
req.setAttribute("paramList", paramList);
|
||||
req.setAttribute("autoFormPage", autoForm);
|
||||
}
|
||||
|
@ -614,14 +626,13 @@ public class AutoFormController extends BaseController {
|
|||
public ModelAndView viewContent(AutoFormEntity autoForm, HttpServletRequest req) {
|
||||
String message = "";
|
||||
try {
|
||||
//-- update-begin author: xugj date:20160103 for: #851 controller 单元测试升级servlet-api 后,req.getParameterMap() 返回值类型变化
|
||||
//获取参数
|
||||
Map<String, String[]> tem = req.getParameterMap();
|
||||
Map<String,Object> paramMap = new HashMap<String, Object>();
|
||||
for(String key :tem.keySet()){
|
||||
paramMap.put(key, tem.get(key));
|
||||
}
|
||||
//-- update-end author: xugj date:20160103 for: #851 controller 单元测试升级servlet-api 后,req.getParameterMap() 返回值类型变化
|
||||
|
||||
|
||||
String op = req.getParameter("op");
|
||||
if(StringUtil.isEmpty(op)){
|
||||
|
@ -649,7 +660,7 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
req.setAttribute("formName", autoForm.getFormName());
|
||||
req.setAttribute("param", paramMap);
|
||||
// paras = getFormData(autoForm,paramMap);
|
||||
//paras = getFormData(autoForm,paramMap);
|
||||
|
||||
String ftlContent = autoForm.getFormParse();
|
||||
// 1.获取表单数据
|
||||
|
@ -706,7 +717,6 @@ public class AutoFormController extends BaseController {
|
|||
List<AutoFormDbEntity> formDbList = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", autoForm.getId());
|
||||
for(AutoFormDbEntity formDb: formDbList){
|
||||
List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
|
||||
|
||||
List<Map<String, Object>> typeList = getColumnTypes(formDb.getTbDbTableName(),formDb.getDbKey());
|
||||
|
||||
if("table".equals(formDb.getDbType())){
|
||||
|
@ -746,12 +756,11 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
hqlTable.append(" where ID ='").append(id).append("'");
|
||||
|
||||
//update-start--Author:luobaoli Date:20150701 for:如果数据源为空,那么以当前上下文中的DB配置为准,查询出表数据
|
||||
if("".equals(formDb.getDbKey())){
|
||||
//当前上下文中的DB环境,获取数据库表中的所有数据
|
||||
data = systemService.findForJdbc(hqlTable.toString());
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150701 for:如果数据源为空,那么以当前上下文中的DB配置为准,查询出表数据
|
||||
|
||||
else{
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(formDb.getDbKey());
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
|
@ -782,19 +791,33 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
//判断sql中是否还有没有被替换的变量,如果有,抛出错误!
|
||||
if(dbDynSql.contains("\\$")){
|
||||
// 判断sql中是否还有没有被替换的变量,如果有,抛出错误!
|
||||
if (dbDynSql.contains("\\$")) {
|
||||
message = "动态SQL数据查询失败!";
|
||||
throw new BusinessException(message);
|
||||
}else{
|
||||
} else {
|
||||
try {
|
||||
data = systemService.findForJdbc(dbDynSql);
|
||||
|
||||
// data = systemService.findForJdbc(dbDynSql);
|
||||
Object dbKeys = paramMap.get("dbKey");
|
||||
if (dbKeys != null && dbKeys != "") {
|
||||
if (dbKeys instanceof String) {
|
||||
String dbKey = dbKeys.toString();
|
||||
data = DynamicDBUtil.findList(dbKey, dbDynSql);
|
||||
} else {
|
||||
String[] keys = (String[]) dbKeys;
|
||||
String dbKey = keys[0];
|
||||
data = DynamicDBUtil.findList(dbKey, dbDynSql);
|
||||
}
|
||||
} else {
|
||||
data = systemService.findForJdbc(dbDynSql);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
message = "动态SQL数据查询失败!";
|
||||
throw new BusinessException(message);
|
||||
}
|
||||
|
||||
}
|
||||
paras.put(formDb.getDbName(), formatData(typeList,data));
|
||||
}else{
|
||||
|
@ -803,6 +826,7 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
return paras;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据表名获取各个字段的类型
|
||||
* @param dbTableNm
|
||||
|
@ -896,9 +920,9 @@ public class AutoFormController extends BaseController {
|
|||
if(StringUtils.isNotBlank(dbForm.getAutoFormId())){
|
||||
List<AutoFormDbEntity> dbFormList = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", dbForm.getAutoFormId());
|
||||
if(dbFormList.size()>0){
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请选择数据源</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
for(AutoFormDbEntity entity:dbFormList){
|
||||
//根据数据源名称进行匹配数据
|
||||
message += "<option value='"+entity.getDbName()+"'>"+(StringUtils.isBlank(entity.getDbChName())?entity.getDbName():entity.getDbChName())+"</option>";
|
||||
|
@ -907,17 +931,17 @@ public class AutoFormController extends BaseController {
|
|||
j.setMsg(message);
|
||||
} else{
|
||||
j.setSuccess(false);
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请先添加数据源</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
j.setMsg(message);
|
||||
}
|
||||
}else{
|
||||
//2.如果ID为空,则option拼接提示信息
|
||||
j.setSuccess(false);
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请先添加数据源</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
j.setMsg(message);
|
||||
}
|
||||
return j;
|
||||
|
@ -938,12 +962,11 @@ public class AutoFormController extends BaseController {
|
|||
//根据数据源名称进行匹配数据
|
||||
if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){
|
||||
|
||||
//update-begin--Author:jg_renjie Date:20150723 for:数据源根据autoFormId与dbName取数据
|
||||
String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?";
|
||||
List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId());
|
||||
if(list.size() ==1){
|
||||
dbForm = list.get(0);
|
||||
//update-end--Author:jg_renjie Date:20150723 for:数据源根据autoFormId与dbName取数据
|
||||
|
||||
//dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName());
|
||||
List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>();
|
||||
if("table".equals(dbForm.getDbType())){
|
||||
|
@ -962,9 +985,9 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
}
|
||||
if(columns.size()>0){
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请选择字段</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
for(Map<String,Object> map:columns){
|
||||
message += "<option value='"+map.get("fieldName")+"'>"+(StringUtils.isBlank((String)map.get("fieldText"))?map.get("fieldName"):map.get("fieldText")) +"</option>";
|
||||
}
|
||||
|
@ -972,17 +995,17 @@ public class AutoFormController extends BaseController {
|
|||
j.setMsg(message);
|
||||
} else{
|
||||
j.setSuccess(false);
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请先添加字段</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
j.setMsg(message);
|
||||
}
|
||||
}else{
|
||||
//2.如果ID为空,则option拼接提示信息
|
||||
j.setSuccess(false);
|
||||
//update-begin--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
message = "<option value='' selected='selected'>请先选择数据源</option>";
|
||||
//update-end--Author:jg_renjie Date:20150722 for:设置默认选项的value值
|
||||
|
||||
j.setMsg(message);
|
||||
}
|
||||
}
|
||||
|
@ -1007,7 +1030,6 @@ public class AutoFormController extends BaseController {
|
|||
|
||||
if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){
|
||||
|
||||
//update-begin--Author:jg_renjie Date:20150723 for:数据源根据autoFormId与dbName取数据
|
||||
String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?";
|
||||
List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId());
|
||||
if(list.size() ==1){
|
||||
|
@ -1020,7 +1042,6 @@ public class AutoFormController extends BaseController {
|
|||
attributes.put("dbName", dbForm.getDbName());
|
||||
}
|
||||
|
||||
//update-end--Author:jg_renjie Date:20150723 for:数据源根据autoFormId与dbName取数据
|
||||
//dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName());
|
||||
List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>();
|
||||
if("table".equals(dbForm.getDbType())){
|
||||
|
@ -1039,7 +1060,6 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
//update-start--Author:jg_renjie Date:20151107 for:优化根据数据源生成数据列
|
||||
StringBuilder options = null;
|
||||
StringBuilder trList = new StringBuilder();
|
||||
String headStr = "";
|
||||
|
@ -1181,7 +1201,7 @@ public class AutoFormController extends BaseController {
|
|||
} else {
|
||||
message = "<option value=\"\">无字段</option>";
|
||||
}
|
||||
//update-end--Author:jg_renjie Date:20151107 for:优化根据数据源生成数据列
|
||||
|
||||
|
||||
j.setSuccess(true);
|
||||
//j.setMsg(message);
|
||||
|
@ -1200,7 +1220,6 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
//add-end--Author:jg_renjie Date:20150725 for:数据源根据autoFormId与dbName取数据,并拼接成tr串
|
||||
|
||||
//update-start--Author:jg_renjie Date:20151107 for:优化根据数据源生成数据列
|
||||
/**
|
||||
* 字段下拉框选择值时,自动填充表头信息
|
||||
*/
|
||||
|
@ -1229,7 +1248,7 @@ public class AutoFormController extends BaseController {
|
|||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
//update-end--Author:jg_renjie Date:20151107 for:优化根据数据源生成数据列
|
||||
|
||||
|
||||
/**
|
||||
* 添加表单
|
||||
|
@ -1335,7 +1354,7 @@ public class AutoFormController extends BaseController {
|
|||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
//update-begin--Author:zzl Date:20151102 for:表单编码唯一性验证
|
||||
|
||||
|
||||
@RequestMapping(params = "checkTbCode")
|
||||
@ResponseBody
|
||||
|
@ -1359,8 +1378,7 @@ public class AutoFormController extends BaseController {
|
|||
jsonObject.put("status", "y");
|
||||
return jsonObject;
|
||||
}
|
||||
//update-end--Author:zzl Date:20151102 for:表单编码唯一性验证
|
||||
//update-begin--Author:zzl Date:20151110 for:数据源级联删除
|
||||
|
||||
private void delFormDb(String autoFormId){
|
||||
List<AutoFormDbEntity> list = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", autoFormId);
|
||||
if(list!=null&&list.size()>0) {
|
||||
|
@ -1370,5 +1388,5 @@ public class AutoFormController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
//update-end--Author:zzl Date:20151110 for:数据源级联删除
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
package org.jeecgframework.web.cgform.controller.autoform;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.codegenerate.database.JeecgReadTable;
|
||||
|
@ -11,16 +23,24 @@ 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.*;
|
||||
import org.jeecgframework.core.util.DynamicDBUtil;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.SqlUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.*;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbFieldEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbPage;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormParamEntity;
|
||||
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity;
|
||||
import org.jeecgframework.web.cgform.service.autoform.AutoFormDbServiceI;
|
||||
import org.jeecgframework.web.system.pojo.base.DynamicDataSourceEntity;
|
||||
import org.jeecgframework.web.system.service.DynamicDataSourceServiceI;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
@ -28,12 +48,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sun.mail.handlers.message_rfc822;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,7 +60,7 @@ import java.util.regex.Pattern;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/autoFormDbController")
|
||||
public class AutoFormDbController extends BaseController {
|
||||
|
@ -68,12 +84,12 @@ public class AutoFormDbController extends BaseController {
|
|||
*/
|
||||
@RequestMapping(params = "autoFormDb")
|
||||
public ModelAndView autoFormDb(HttpServletRequest request) {
|
||||
//update--begin---author:scott---date:20151029-----for:通过自定义表单筛选数据源-------
|
||||
|
||||
String autoFormId = request.getParameter("autoFormId");
|
||||
if(oConvertUtils.isNotEmpty(autoFormId)){
|
||||
request.setAttribute("autoFormId", autoFormId);
|
||||
}
|
||||
//update--begin---author:scott---date:20151029-----for:通过自定义表单筛选数据源-------
|
||||
|
||||
return new ModelAndView("jeecg/cgform/autoform/autoFormDbList");
|
||||
}
|
||||
|
||||
|
@ -210,23 +226,19 @@ public class AutoFormDbController extends BaseController {
|
|||
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
|
||||
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
|
||||
}
|
||||
//update-begin--Author:jg_renjie Date:20150620 for:能够将参数传递到前台页面
|
||||
|
||||
req.setAttribute("autoFormDbPage", autoFormDb);
|
||||
//update-end--Author:jg_renjie Date:20150620 for:能够将参数传递到前台页面
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150701 for:增加初始化数据源显示
|
||||
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = DynamicDataSourceEntity.DynamicDataSourceMap.values();
|
||||
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
|
||||
req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
|
||||
//update-begin--Author:luobaoli Date:20150701 for:增加初始化数据源显示
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150701 for:增加初始化数据表显示
|
||||
try {
|
||||
List<String> tableNames = new JeecgReadTable().readAllTableNames();
|
||||
req.setAttribute("tableNames", tableNames);
|
||||
} catch (SQLException e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150701 for:增加初始化数据表显示
|
||||
|
||||
return new ModelAndView("jeecg/cgform/autoform/autoFormDb-add");
|
||||
}
|
||||
|
||||
|
@ -239,33 +251,32 @@ public class AutoFormDbController extends BaseController {
|
|||
public ModelAndView goUpdate(AutoFormDbEntity autoFormDb, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
|
||||
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
|
||||
//update-begin--Author:luobaoli Date:20150620 for:当数据库类型选择为Table时,需要返回所有表用于展现
|
||||
|
||||
List<String> tableNames = null;
|
||||
if(StringUtils.isNotBlank(autoFormDb.getDbKey()) && "table".equals(autoFormDb.getDbType())){
|
||||
//update-start--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(autoFormDb.getDbKey());
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
tableNames = DynamicDBUtil.findList(autoFormDb.getDbKey(),SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'"+dynamicDataSourceEntity.getDbName()+"'"),String.class);
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
|
||||
}
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150701 for:增加初始化数据源显示
|
||||
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = DynamicDataSourceEntity.DynamicDataSourceMap.values();
|
||||
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
|
||||
req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
|
||||
//update-begin--Author:luobaoli Date:20150701 for:增加初始化数据源显示
|
||||
|
||||
//update-start--Author:luobaoli Date:20150701 for:数据库为默认的时候数据库表为当前DB环境中的表
|
||||
//update-begin--Author:scott Date:20151116 for:数据源-表-字段加载(注意数据库表类型和SQL类型冲突)---------
|
||||
//数据源类型
|
||||
String dbKey = null;
|
||||
if(CgAutoListConstant.DB_TYPE_TABLE.equals(autoFormDb.getDbType())){
|
||||
dbKey = autoFormDb.getDbKey();
|
||||
}else if(CgAutoListConstant.DB_TYPE_SQL.equals(autoFormDb.getDbType())){
|
||||
dbKey = autoFormDb.getTbDbKey();
|
||||
|
||||
//dbKey = autoFormDb.getTbDbKey();
|
||||
dbKey = autoFormDb.getDbKey();
|
||||
|
||||
}
|
||||
//update-end--Author:scott Date:20151116 for:数据源-表-字段加载(注意数据库表类型和SQL类型冲突)---------
|
||||
|
||||
if(StringUtils.isBlank(dbKey)){
|
||||
//默认当前平台数据源
|
||||
try {
|
||||
|
@ -279,9 +290,9 @@ public class AutoFormDbController extends BaseController {
|
|||
tableNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
|
||||
}
|
||||
}
|
||||
//update-start--Author:luobaoli Date:20150701 for:数据库为默认的时候数据库表为当前DB环境中的表
|
||||
|
||||
req.setAttribute("tableNames", tableNames);
|
||||
//update-end--Author:luobaoli Date:20150620 for:当数据库类型选择为Table时,需要返回所有表用于展现
|
||||
|
||||
req.setAttribute("autoFormDbPage", autoFormDb);
|
||||
|
||||
}
|
||||
|
@ -331,26 +342,36 @@ public class AutoFormDbController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 解析SQL,返回字段集
|
||||
* 解析SQL,返回字段集 支持多数据源
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "getFields", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getSqlFields(String sql){
|
||||
public Object getSqlFields(String sql,String dbKey){
|
||||
List<String> files = null;
|
||||
List<String> params = null;
|
||||
|
||||
Map reJson = new HashMap<String, Object>();
|
||||
try{
|
||||
files = autoFormDbService.getSqlFields(sql);
|
||||
|
||||
//files = autoFormDbService.getSqlFields(sql);
|
||||
//params = autoFormDbService.getSqlParams(sql);
|
||||
files = autoFormDbService.getField(sql,dbKey);
|
||||
params = autoFormDbService.getSqlParams(sql);
|
||||
|
||||
}catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
LogUtil.error(e.toString());
|
||||
e.printStackTrace();
|
||||
String errorInfo = "解析失败!<br><br>失败原因:";
|
||||
errorInfo += e.getMessage();
|
||||
|
||||
//无法直接捕捉到:java.net.ConnectException异常
|
||||
int i = e.getMessage().indexOf("Connection refused: connect");
|
||||
if (i != -1) {//非链接异常
|
||||
errorInfo += "数据源连接失败.";
|
||||
}else{
|
||||
errorInfo += "当前数据源没有查到数据.";
|
||||
}
|
||||
reJson.put("status", "error");
|
||||
reJson.put("datas", errorInfo);
|
||||
return reJson;
|
||||
|
@ -397,12 +418,12 @@ public class AutoFormDbController extends BaseController {
|
|||
List<String> tableNames = null;
|
||||
try{
|
||||
if(StringUtils.isNotBlank(dbKey)){
|
||||
//update-start--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
tableNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
}else{
|
||||
tableNames = new JeecgReadTable().readAllTableNames();
|
||||
}
|
||||
|
@ -431,12 +452,12 @@ public class AutoFormDbController extends BaseController {
|
|||
Map reJson = new HashMap<String, Object>();
|
||||
List<String> columnsNames = null;
|
||||
if(StringUtils.isNotBlank(dbKey)){
|
||||
//update-end--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
columnsNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllCloumnSql(dynamicDataSourceEntity.getDbType(), "'" + tableName + "'", "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150623 for:调整了获取数据库类型和数据库名称的逻辑
|
||||
|
||||
}else{
|
||||
try {
|
||||
List<Columnt> columns = new JeecgReadTable().readOriginalTableColumn(tableName);
|
||||
|
@ -470,7 +491,7 @@ public class AutoFormDbController extends BaseController {
|
|||
AutoFormDbEntity autoFormDbEntity = autoFormDbService.getEntity(AutoFormDbEntity.class, id);
|
||||
if(autoFormDbEntity!=null){
|
||||
//查询-表单参数
|
||||
String hql1 = "from AutoFormParamEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
|
||||
String hql1 = "from AutoFormParamEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
|
||||
try{
|
||||
List<AutoFormParamEntity> autoFormParamEntityList = systemService.findHql(hql1,id);
|
||||
req.setAttribute("autoFormParamList", autoFormParamEntityList);
|
||||
|
@ -486,6 +507,8 @@ public class AutoFormDbController extends BaseController {
|
|||
//add-end--Author:luobaoli Date:20150626 for:新增数据源展示页面
|
||||
|
||||
//add-begin--Author:luobaoli Date:20150626 for:新增通过动态SQL或者数据源表动态获取相关数据功能
|
||||
|
||||
|
||||
/**
|
||||
* 数据展示
|
||||
* @param id
|
||||
|
@ -516,12 +539,11 @@ public class AutoFormDbController extends BaseController {
|
|||
}
|
||||
hqlTable.deleteCharAt(hqlTable.length()-1).append(" from "+dbTableName);
|
||||
|
||||
//update-start--Author:luobaoli Date:20150701 for:如果数据源为空,那么以当前上下文中的DB配置为准,查询出表数据
|
||||
if("".equals(dbKey)){
|
||||
//当前上下文中的DB环境,获取数据库表中的所有数据
|
||||
map = systemService.findForJdbc(hqlTable.toString());
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150701 for:如果数据源为空,那么以当前上下文中的DB配置为准,查询出表数据
|
||||
|
||||
else{
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
|
@ -552,7 +574,22 @@ public class AutoFormDbController extends BaseController {
|
|||
msg = "动态SQL数据查询失败!";
|
||||
}else{
|
||||
try {
|
||||
map = systemService.findForJdbc(dbDynSql);
|
||||
|
||||
//map = systemService.findForJdbc(dbDynSql);
|
||||
//DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(tbDbKey);
|
||||
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
|
||||
if(dynamicDataSourceEntity!=null){
|
||||
|
||||
/*if (StringUtil.isNotEmpty(tbDbKey)) {
|
||||
map = DynamicDBUtil.findList(tbDbKey,dbDynSql);*/
|
||||
if (StringUtil.isNotEmpty(dbKey)) {
|
||||
map = DynamicDBUtil.findList(dbKey,dbDynSql);
|
||||
|
||||
}else{
|
||||
map = systemService.findForJdbc(dbDynSql);
|
||||
}
|
||||
}
|
||||
|
||||
msg = "动态SQL数据查询成功!";
|
||||
j.setObj(map);
|
||||
} catch (Exception e) {
|
||||
|
@ -573,7 +610,7 @@ public class AutoFormDbController extends BaseController {
|
|||
|
||||
|
||||
//add-begin--Author:jg_renjie Date:20150720 for:增加数据源名称的唯一性校验
|
||||
//update-begin--Author:zzl Date:20151102 for:检查数据源编码是否重复
|
||||
|
||||
/**
|
||||
* 判断数据源名称是否重复
|
||||
*/
|
||||
|
@ -601,7 +638,7 @@ public class AutoFormDbController extends BaseController {
|
|||
jsonObject.put("status", "y");
|
||||
return jsonObject;
|
||||
}
|
||||
//update-end--Author:zzl Date:20151102 for:检查数据源编码是否重复
|
||||
|
||||
//add-end--Author:jg_renjie Date:20150720 for:增加数据源名称的唯一性校验
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/autoFormStyleController")
|
||||
public class AutoFormStyleController extends BaseController {
|
||||
|
@ -55,15 +55,6 @@ public class AutoFormStyleController extends BaseController {
|
|||
private AutoFormStyleServiceI autoFormStyleService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -108,6 +99,7 @@ public class AutoFormStyleController extends BaseController {
|
|||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(AutoFormStyleEntity autoFormStyle, HttpServletRequest request) {
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
autoFormStyle = systemService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId());
|
||||
message = "表单样式表删除成功";
|
||||
|
@ -131,6 +123,7 @@ public class AutoFormStyleController extends BaseController {
|
|||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "表单样式表删除成功";
|
||||
try{
|
||||
|
@ -160,6 +153,7 @@ public class AutoFormStyleController extends BaseController {
|
|||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(AutoFormStyleEntity autoFormStyle, HttpServletRequest request) {
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "表单样式表添加成功";
|
||||
try{
|
||||
|
@ -183,6 +177,7 @@ public class AutoFormStyleController extends BaseController {
|
|||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(AutoFormStyleEntity autoFormStyle, HttpServletRequest request) {
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "表单样式表更新成功";
|
||||
AutoFormStyleEntity t = autoFormStyleService.get(AutoFormStyleEntity.class, autoFormStyle.getId());
|
||||
|
|
|
@ -87,11 +87,11 @@ public class CgAutoListController extends BaseController{
|
|||
//step.3 封装页面数据
|
||||
loadVars(configs,paras,request);
|
||||
//step.4 组合模板+数据参数,进行页面展现
|
||||
//update-begin--Author:张忠亮 Date:20151019 for:url中加入olstylecode 可指定风格
|
||||
|
||||
String template=request.getParameter("olstylecode");
|
||||
if(StringUtils.isBlank(template)){
|
||||
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id);
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
template=head.getFormTemplate();
|
||||
paras.put("_olstylecode","");
|
||||
}else{
|
||||
|
@ -100,15 +100,22 @@ public class CgAutoListController extends BaseController{
|
|||
paras.put("this_olstylecode",template);
|
||||
CgformTemplateEntity entity=cgformTemplateService.findByCode(template);
|
||||
String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, TemplateUtil.TemplateType.LIST), paras);
|
||||
//update-end--Author:张忠亮 Date:20151019 for:url中加入olstylecode 可指定风格
|
||||
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer = response.getWriter();
|
||||
writer.println(html);
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
log.debug("动态列表生成耗时:"+(end-start)+" ms");
|
||||
|
@ -142,7 +149,6 @@ public class CgAutoListController extends BaseController{
|
|||
fieldMap.put(b.getFieldName(), new String[]{b.getType(), b.getFieldDefault()});
|
||||
}
|
||||
|
||||
//------------------update-begin-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
//参数处理
|
||||
boolean isTree = configs.get(CgAutoListConstant.CONFIG_ISTREE) == null ? false
|
||||
: CgAutoListConstant.BOOL_TRUE.equalsIgnoreCase(configs.get(CgAutoListConstant.CONFIG_ISTREE).toString());
|
||||
|
@ -164,18 +170,18 @@ public class CgAutoListController extends BaseController{
|
|||
treeId = "'" + treeId + "'";
|
||||
}
|
||||
}
|
||||
if(treeId == null) {
|
||||
if(oConvertUtils.isEmpty(treeId)) {
|
||||
params.put(parentIdFieldName, " is null");
|
||||
}else {
|
||||
params.put(parentIdFieldName, "=" + treeId);
|
||||
}
|
||||
}
|
||||
//------------------update-end-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
|
||||
|
||||
int p = page==null?1:Integer.parseInt(page);
|
||||
int r = rows==null?99999:Integer.parseInt(rows);
|
||||
//step.3 进行查询返回结果,如果为tree的下级数据,则不需要分页
|
||||
//------------------update-start-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
|
||||
List<Map<String, Object>> result = null;
|
||||
if(isTree && treeId !=null) {
|
||||
//防止下级数据太大,最大只取500条
|
||||
|
@ -189,7 +195,7 @@ public class CgAutoListController extends BaseController{
|
|||
cgTableService.treeFromResultHandle(table, parentIdFieldName, parentIdFieldType,
|
||||
result);
|
||||
}
|
||||
//------------------update-end-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
|
||||
|
||||
//处理页面中若存在checkbox只能显示code值而不能显示text值问题
|
||||
Map<String, Object> dicMap = new HashMap<String, Object>();
|
||||
|
@ -222,20 +228,25 @@ public class CgAutoListController extends BaseController{
|
|||
dealDic(result,beans);
|
||||
response.setContentType("application/json");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
PrintWriter writer;
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
//------------------update-start-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
|
||||
if(isTree && treeId !=null) {
|
||||
//下级列表
|
||||
writer.println(QueryParamUtil.getJson(result));
|
||||
}else {
|
||||
writer.println(QueryParamUtil.getJson(result,size));
|
||||
}
|
||||
//------------------update-end-------2015年6月1日----author:zhongsy------for:表单配置支持树形------------
|
||||
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
log.debug("动态列表查询耗时:"+(end-start)+" ms");
|
||||
|
@ -270,9 +281,9 @@ public class CgAutoListController extends BaseController{
|
|||
// }
|
||||
for(DictEntity dictEntity:dicDataList){
|
||||
if(value.equalsIgnoreCase(dictEntity.getTypecode())){
|
||||
//------------------update-begin------for:-国际化处理-----------------------author:zhagndaihao------------
|
||||
|
||||
r.put(bean.getFieldName(),MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename()));
|
||||
//------------------update-end-----for:-国际化处理----------------------------author:zhagndaihao---------
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +354,7 @@ public class CgAutoListController extends BaseController{
|
|||
List<Map> queryList = new ArrayList<Map>();
|
||||
StringBuilder fileds = new StringBuilder();
|
||||
StringBuilder initQuery = new StringBuilder();
|
||||
//------------------update-begin-------2014年9月3日----author:JueYue------for:-列表数据隐藏权限------------
|
||||
|
||||
Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES);
|
||||
Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>();
|
||||
if(operationCodes != null){
|
||||
|
@ -359,7 +370,7 @@ public class CgAutoListController extends BaseController{
|
|||
if(operationCodesMap.containsKey(bean.getFieldName())) {
|
||||
continue;
|
||||
}
|
||||
//------------------update-end---2014年9月3日----author:JueYue------for:-列表数据隐藏权限------------
|
||||
|
||||
Map fm = new HashMap<String, Object>();
|
||||
fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName());
|
||||
fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent());
|
||||
|
|
|
@ -79,18 +79,24 @@ public class CgAutoListRestController extends BaseController{
|
|||
loadVars(configs,paras,request);
|
||||
//step.4 组合模板+数据参数,进行页面展现
|
||||
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id);
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
CgformTemplateEntity entity=cgformTemplateService.findByCode(head.getFormTemplate());
|
||||
String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity, 0, TemplateUtil.TemplateType.LIST), paras);
|
||||
//update-end--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer = response.getWriter();
|
||||
writer.println(html);
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
log.debug("动态列表生成耗时:"+(end-start)+" ms");
|
||||
|
@ -155,7 +161,7 @@ public class CgAutoListRestController extends BaseController{
|
|||
List<Map> queryList = new ArrayList<Map>();
|
||||
StringBuilder fileds = new StringBuilder();
|
||||
StringBuilder initQuery = new StringBuilder();
|
||||
//------------------update-begin-------2014年9月3日----author:JueYue------for:-列表数据隐藏权限------------
|
||||
|
||||
Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES);
|
||||
Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>();
|
||||
if(operationCodes != null){
|
||||
|
@ -171,7 +177,7 @@ public class CgAutoListRestController extends BaseController{
|
|||
if(operationCodesMap.containsKey(bean.getFieldName())) {
|
||||
continue;
|
||||
}
|
||||
//------------------update-end---2014年9月3日----author:JueYue------for:-列表数据隐藏权限------------
|
||||
|
||||
Map fm = new HashMap<String, Object>();
|
||||
fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName());
|
||||
fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent());
|
||||
|
|
|
@ -50,13 +50,11 @@ import freemarker.template.TemplateException;
|
|||
* @Description: 读取模板生成填报表单(添加、修改)-执行表单数据添加和修改操作
|
||||
* @author 周俊峰
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgFormBuildController")
|
||||
public class CgFormBuildController extends BaseController {
|
||||
private static final Logger logger = Logger.getLogger(CgFormBuildController.class);
|
||||
private String message;
|
||||
|
||||
@Autowired
|
||||
private TempletContext templetContext;
|
||||
@Autowired
|
||||
|
@ -66,14 +64,6 @@ public class CgFormBuildController extends BaseController {
|
|||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
//update-begin--Author:许国杰 Date:20151219 for:#813 【online表单】扩展出三个请求:独立的添加、查看、编辑请求,原来的保留
|
||||
@RequestMapping(params = "goAddFtlForm")
|
||||
public void goAddFtlForm(HttpServletRequest request,HttpServletResponse response) {
|
||||
ftlForm(request,response);
|
||||
|
@ -86,7 +76,7 @@ public class CgFormBuildController extends BaseController {
|
|||
public void goDatilFtlForm(HttpServletRequest request,HttpServletResponse response) {
|
||||
ftlForm(request,response);
|
||||
}
|
||||
//update-end--Author:许国杰 Date:20151219 for:#813 【online表单】扩展出三个请求:独立的添加、查看、编辑请求,原来的保留
|
||||
|
||||
|
||||
//add-start--Author:scott Date:20160301 for:online表单移动样式单独配置
|
||||
/**
|
||||
|
@ -118,10 +108,10 @@ public class CgFormBuildController extends BaseController {
|
|||
String tableName =request.getParameter("tableName");
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
String id = request.getParameter("id");
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
String mode=request.getParameter("mode");
|
||||
String templateName=tableName+"_";
|
||||
//update-begin--Author:张忠亮 Date:20151019 for:url中加入olstylecode 可指定风格
|
||||
|
||||
TemplateUtil.TemplateType templateType=TemplateUtil.TemplateType.LIST;
|
||||
if(StringUtils.isBlank(id)){
|
||||
templateName+=TemplateUtil.TemplateType.ADD.getName();
|
||||
|
@ -144,7 +134,7 @@ public class CgFormBuildController extends BaseController {
|
|||
if(StringUtils.isNotEmpty(id)){
|
||||
dataForm = dataBaseService.findOneForJdbc(tableName, id);
|
||||
}
|
||||
//update-begin--Author:zhoujf Date:20151223 for:恢复--------------------
|
||||
|
||||
Iterator it=dataForm.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
Map.Entry entry=(Map.Entry)it.next();
|
||||
|
@ -152,7 +142,7 @@ public class CgFormBuildController extends BaseController {
|
|||
Object ov=entry.getValue();
|
||||
data.put(ok, ov);
|
||||
}
|
||||
//update-begin--Author:zhoujf Date:20151223 for:恢复--------------------
|
||||
|
||||
Map<String, Object> tableData = new HashMap<String, Object>();
|
||||
//获取主表或单表表单数据
|
||||
tableData.put(tableName, dataForm);
|
||||
|
@ -173,9 +163,9 @@ public class CgFormBuildController extends BaseController {
|
|||
//装载单表/(主表和附表)表单数据
|
||||
data.put("data", tableData);
|
||||
data.put("id", id);
|
||||
//update-begin--Author:钟世云 Date:20150610 for:online支持树配置--------------------
|
||||
|
||||
data.put("head", head);
|
||||
//update-end--Author:钟世云 Date:20150610 for:online支持树配置----------------------
|
||||
|
||||
|
||||
//页面样式js引用
|
||||
data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request));
|
||||
|
@ -184,33 +174,40 @@ public class CgFormBuildController extends BaseController {
|
|||
pushImages(data, id);
|
||||
String content =null;
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
//update-begin--Author:张忠亮 Date:20151019 for:url中加入olstylecode 可指定风格
|
||||
|
||||
String urlTemplateName = request.getParameter("olstylecode");
|
||||
//update-begin---author:scott---date:20160301-----for:online表单移动样式单独配置-----
|
||||
|
||||
if(oConvertUtils.isEmpty(urlTemplateName)){
|
||||
urlTemplateName = (String) request.getAttribute("olstylecode");
|
||||
}
|
||||
//update-end---author:scott---date:20160301-----for:online表单移动样式单独配置-----
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(urlTemplateName)){
|
||||
data.put("this_olstylecode",urlTemplateName);
|
||||
LogUtil.info("-------------urlTemplateName-----------"+urlTemplateName);
|
||||
LogUtil.debug("-------------urlTemplateName-----------"+urlTemplateName);
|
||||
content=getUrlTemplate(urlTemplateName,templateType,data);
|
||||
}else{
|
||||
data.put("this_olstylecode",head.getFormTemplate());
|
||||
LogUtil.info("-------------formTemplate-----------"+head.getFormTemplate());
|
||||
LogUtil.debug("-------------formTemplate-----------"+head.getFormTemplate());
|
||||
content=getTableTemplate(templateName,request,data);
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20151019 for:url中加入olstylecode 可指定风格
|
||||
|
||||
response.getWriter().print(content);
|
||||
response.getWriter().flush();
|
||||
long end = System.currentTimeMillis();
|
||||
logger.debug("自定义表单生成耗时:"+(end-start)+" ms");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//update-begin--Author:张忠亮 Date:20151020 for:url中加入olstylecode 可指定风格 代码优化
|
||||
|
||||
/**
|
||||
* 获取url指定模板
|
||||
* @param templateName
|
||||
|
@ -223,9 +220,9 @@ public class CgFormBuildController extends BaseController {
|
|||
CgformTemplateEntity entity=cgformTemplateService.findByCode(templateName);
|
||||
if(entity!=null){
|
||||
FreemarkerHelper viewEngine = new FreemarkerHelper();
|
||||
//update-begin---author:scott---date:20160301-----for:解决传递stylecode解析模板报错问题-----
|
||||
|
||||
dataMap.put("DictData", ApplicationContextUtil.getContext().getBean("dictDataTag"));
|
||||
//update-end---author:scott---date:20160301-----for:解决传递stylecode解析模板报错问题-----
|
||||
|
||||
content = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, templateType), dataMap);
|
||||
}
|
||||
return content;
|
||||
|
@ -241,17 +238,17 @@ public class CgFormBuildController extends BaseController {
|
|||
private String getTableTemplate(String templateName,HttpServletRequest request,Map data){
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
BufferedWriter writer = new BufferedWriter(stringWriter);
|
||||
//update--begin-------author:scott------date:20151118----for:online表单缓存问题---------------
|
||||
|
||||
String ftlVersion =request.getParameter("ftlVersion");
|
||||
// String ftlVersion = oConvertUtils.getString(data.get("version"));
|
||||
//update--begin-------author:scott------date:20151118----for:online表单缓存问题---------------
|
||||
|
||||
Template template = templetContext.getTemplate(templateName, ftlVersion);
|
||||
try {
|
||||
//update-begin---author:scott---date:20150118-----for:修改linux时间格式不对问题-------------
|
||||
|
||||
template.setDateTimeFormat("yyyy-MM-dd HH:mm:ss");
|
||||
template.setDateFormat("yyyy-MM-dd");
|
||||
template.setTimeFormat("HH:mm:ss");
|
||||
//update-end---author:scott---date:20150118-----for:修改linux时间格式不对问题---------------
|
||||
|
||||
template.process(data, writer);
|
||||
} catch (TemplateException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -260,7 +257,7 @@ public class CgFormBuildController extends BaseController {
|
|||
}
|
||||
return stringWriter.toString();
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20151020 for:url中加入olstylecode 可指定风格 代码优化
|
||||
|
||||
private String getHtmlHead(HttpServletRequest request){
|
||||
HttpSession session = ContextHolderUtils.getSession();
|
||||
String lang = (String)session.getAttribute("lang");
|
||||
|
@ -326,7 +323,7 @@ public class CgFormBuildController extends BaseController {
|
|||
}
|
||||
data.put("filesList", files);
|
||||
}
|
||||
//update-start--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image
|
||||
|
||||
/**
|
||||
* 如果表单带有 附件(图片),则查询出来传递到页面
|
||||
* @param data 传往页面的数据容器
|
||||
|
@ -349,7 +346,7 @@ public class CgFormBuildController extends BaseController {
|
|||
}
|
||||
data.put("imageList", images);
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
|
@ -362,6 +359,7 @@ public class CgFormBuildController extends BaseController {
|
|||
@RequestMapping(params = "saveOrUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson saveOrUpdate(HttpServletRequest request) throws Exception{
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
Map data = request.getParameterMap();
|
||||
if(data!=null){
|
||||
|
@ -441,6 +439,7 @@ public class CgFormBuildController extends BaseController {
|
|||
@RequestMapping(params = "saveOrUpdateMore")
|
||||
@ResponseBody
|
||||
public AjaxJson saveOrUpdateMore(HttpServletRequest request) throws Exception{
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
Map data = request.getParameterMap();
|
||||
if(data!=null){
|
||||
|
@ -495,6 +494,7 @@ public class CgFormBuildController extends BaseController {
|
|||
@RequestMapping(params = "doButton")
|
||||
@ResponseBody
|
||||
public AjaxJson doButton(HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
String formId = request.getParameter("formId");
|
||||
|
@ -513,9 +513,9 @@ public class CgFormBuildController extends BaseController {
|
|||
}
|
||||
data = CommUtils.mapConvert(data);
|
||||
dataBaseService.executeSqlExtend(formId, buttonCode, data);
|
||||
//update-start--Author:luobaoli Date:20150630 for: 增加java增强逻辑处理
|
||||
|
||||
dataBaseService.executeJavaExtend(formId, buttonCode, data);
|
||||
//update-end--Author:luobaoli Date:20150630 for: 增加java增强逻辑处理
|
||||
|
||||
}
|
||||
j.setSuccess(true);
|
||||
message = "操作成功";
|
||||
|
|
|
@ -42,12 +42,11 @@ import freemarker.template.TemplateException;
|
|||
* @Description: 读取模板生成填报表单(添加、修改)-执行表单数据添加和修改操作(rest风格)
|
||||
* @author 周俊峰、luobaoli
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgform")
|
||||
public class CgFormBuildRestController extends BaseController {
|
||||
private static final Logger logger = Logger.getLogger(CgFormBuildRestController.class);
|
||||
private String message;
|
||||
|
||||
@Autowired
|
||||
private TempletContext templetContext;
|
||||
|
@ -57,13 +56,6 @@ public class CgFormBuildRestController extends BaseController {
|
|||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* form表单页面跳转
|
||||
|
@ -81,7 +73,7 @@ public class CgFormBuildRestController extends BaseController {
|
|||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
String tableName = configId;
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
String mode=request.getParameter("mode");
|
||||
String templateName=tableName+"_";
|
||||
if(StringUtils.isBlank(id)){
|
||||
|
@ -92,11 +84,9 @@ public class CgFormBuildRestController extends BaseController {
|
|||
templateName+=TemplateUtil.TemplateType.UPDATE.getName();
|
||||
}
|
||||
|
||||
// update-start--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
String ftlVersion =request.getParameter("ftlVersion");
|
||||
Template template = templetContext.getTemplate(templateName, ftlVersion);
|
||||
// update-end--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
//update-end--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
BufferedWriter writer = new BufferedWriter(stringWriter);
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
|
@ -138,9 +128,9 @@ public class CgFormBuildRestController extends BaseController {
|
|||
//装载单表/(主表和附表)表单数据
|
||||
data.put("data", tableData);
|
||||
data.put("id", id);
|
||||
//update-begin--Author:钟世云 Date:20150610 for:online支持树配置--------------------
|
||||
|
||||
data.put("head", head);
|
||||
//update-end--Author:钟世云 Date:20150610 for:online支持树配置----------------------
|
||||
|
||||
|
||||
//页面样式js引用
|
||||
data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request));
|
||||
|
@ -150,12 +140,18 @@ public class CgFormBuildRestController extends BaseController {
|
|||
String content = stringWriter.toString();
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
response.getWriter().print(content);
|
||||
response.getWriter().flush();
|
||||
long end = System.currentTimeMillis();
|
||||
logger.debug("自定义表单生成耗时:"+(end-start)+" ms");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (TemplateException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ import com.thoughtworks.xstream.XStream;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformSqlController")
|
||||
public class CgformSqlController extends BaseController {
|
||||
|
@ -77,16 +77,6 @@ public class CgformSqlController extends BaseController {
|
|||
@Qualifier("namedParameterJdbcTemplate")
|
||||
private NamedParameterJdbcTemplate namedJdbcTemplate;
|
||||
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出 Form(采用SQL方式)
|
||||
*
|
||||
|
@ -169,6 +159,7 @@ public class CgformSqlController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson doMigrateIn(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
String ls_file = "";
|
||||
UploadFile uploadFile = new UploadFile(request, ls_file);
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformButtonController")
|
||||
public class CgformButtonController extends BaseController {
|
||||
|
@ -46,15 +46,6 @@ public class CgformButtonController extends BaseController {
|
|||
private CgformButtonServiceI cgformButtonService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -98,6 +89,7 @@ public class CgformButtonController extends BaseController {
|
|||
@RequestMapping(params = "del")
|
||||
@ResponseBody
|
||||
public AjaxJson del(CgformButtonEntity cgformButton, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformButton = systemService.getEntity(CgformButtonEntity.class, cgformButton.getId());
|
||||
message = "删除成功";
|
||||
|
@ -118,6 +110,7 @@ public class CgformButtonController extends BaseController {
|
|||
@RequestMapping(params = "save")
|
||||
@ResponseBody
|
||||
public AjaxJson save(CgformButtonEntity cgformButton, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
if("add".equalsIgnoreCase(cgformButton.getButtonCode())
|
||||
||"update".equalsIgnoreCase(cgformButton.getButtonCode())
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformButtonSqlController")
|
||||
public class CgformButtonSqlController extends BaseController {
|
||||
|
@ -51,15 +51,6 @@ public class CgformButtonSqlController extends BaseController {
|
|||
private CgformButtonServiceI cgformButtonService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -103,6 +94,7 @@ public class CgformButtonSqlController extends BaseController {
|
|||
@RequestMapping(params = "del")
|
||||
@ResponseBody
|
||||
public AjaxJson del(CgformButtonSqlEntity cgformButtonSql, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformButtonSql = systemService.getEntity(CgformButtonSqlEntity.class, cgformButtonSql.getId());
|
||||
message = "删除成功";
|
||||
|
@ -142,6 +134,7 @@ public class CgformButtonSqlController extends BaseController {
|
|||
@RequestMapping(params = "save")
|
||||
@ResponseBody
|
||||
public AjaxJson save(CgformButtonSqlEntity cgformButtonSql, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
List<CgformButtonSqlEntity> list = cgformButtonSqlService.checkCgformButtonSql(cgformButtonSql);
|
||||
if(list!=null&&list.size()>0){
|
||||
|
|
|
@ -55,7 +55,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformFtlController")
|
||||
public class CgformFtlController extends BaseController {
|
||||
|
@ -72,15 +72,6 @@ public class CgformFtlController extends BaseController {
|
|||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板展示
|
||||
|
@ -175,6 +166,7 @@ public class CgformFtlController extends BaseController {
|
|||
@RequestMapping(params = "del")
|
||||
@ResponseBody
|
||||
public AjaxJson del(CgformFtlEntity cgformFtl, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformFtl = systemService.getEntity(CgformFtlEntity.class,
|
||||
cgformFtl.getId());
|
||||
|
@ -195,6 +187,7 @@ public class CgformFtlController extends BaseController {
|
|||
@RequestMapping(params = "active")
|
||||
@ResponseBody
|
||||
public AjaxJson active(CgformFtlEntity cgformFtl, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
// 判断有没有激活过的模板
|
||||
|
@ -231,6 +224,7 @@ public class CgformFtlController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson cancleActive(CgformFtlEntity cgformFtl,
|
||||
HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
cgformFtl = systemService.getEntity(CgformFtlEntity.class,
|
||||
|
@ -260,6 +254,7 @@ public class CgformFtlController extends BaseController {
|
|||
@RequestMapping(params = "save")
|
||||
@ResponseBody
|
||||
public AjaxJson save(CgformFtlEntity cgformFtl, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
if (StringUtil.isNotEmpty(cgformFtl.getId())) {
|
||||
message = "更新成功";
|
||||
|
@ -366,6 +361,7 @@ public class CgformFtlController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson saveWordFiles(HttpServletRequest request,
|
||||
HttpServletResponse response, CgformFtlEntity cgformFtl) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
|
||||
|
@ -591,11 +587,12 @@ public class CgformFtlController extends BaseController {
|
|||
@RequestMapping(params = "parseUeditorOld")
|
||||
@ResponseBody
|
||||
public AjaxJson parseUeditorOld(String parseForm,String action,HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
JSONObject json = new JSONObject().fromObject(parseForm);
|
||||
System.out.println(json.getString("parse"));
|
||||
System.out.println(json.getString("data"));
|
||||
//System.out.println(json.getString("parse"));
|
||||
//System.out.println(json.getString("data"));
|
||||
// 判断有没有激活过的模板
|
||||
message = FormUtil.GetHtml(json.getString("parse"),json.getString("data"), action);
|
||||
j.setMsg(message);
|
||||
|
@ -612,6 +609,7 @@ public class CgformFtlController extends BaseController {
|
|||
@RequestMapping(params = "parseUeditor")
|
||||
@ResponseBody
|
||||
public AjaxJson parseUeditor(String parseForm,String action,HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
// System.out.println(parseForm);
|
||||
|
@ -621,7 +619,7 @@ public class CgformFtlController extends BaseController {
|
|||
// System.out.println(json.getString("data"));
|
||||
// // 判断有没有激活过的模板
|
||||
// message = FormUtil.GetHtml(json.getString("parse"),json.getString("data"), action);
|
||||
//update-begin--Author:jg_renjie Date:20150706 for:更改解析前台传来的html
|
||||
|
||||
if(StringUtils.isNotBlank(parseForm)){
|
||||
TemplateUtil tool = new TemplateUtil();
|
||||
Map<String,Object> map = tool.processor(parseForm);
|
||||
|
@ -629,7 +627,7 @@ public class CgformFtlController extends BaseController {
|
|||
} else {
|
||||
j.setMsg("");
|
||||
}
|
||||
//update-end--Author:jg_renjie Date:20150706 for:更改解析前台传来的html
|
||||
|
||||
j.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.jeecgframework.core.constant.Globals;
|
|||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
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.ImportParams;
|
||||
|
@ -26,18 +27,17 @@ import org.jeecgframework.web.cgform.engine.TempletContext;
|
|||
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
|
||||
import org.jeecgframework.web.cgform.entity.config.CgFormFieldVO;
|
||||
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
|
||||
import org.jeecgframework.web.cgform.entity.config.CgFormIndexEntity;
|
||||
import org.jeecgframework.web.cgform.exception.BusinessException;
|
||||
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
|
||||
import org.jeecgframework.web.cgform.service.config.CgFormIndexServiceI;
|
||||
import org.jeecgframework.web.cgform.service.impl.config.util.FieldNumComparator;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -52,7 +52,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgFormHeadController")
|
||||
public class CgFormHeadController extends BaseController {
|
||||
|
@ -64,18 +64,11 @@ public class CgFormHeadController extends BaseController {
|
|||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
@Autowired
|
||||
private CgFormIndexServiceI cgFormIndexService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private TempletContext templetContext;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动生成表属性列表 页面跳转
|
||||
|
@ -100,8 +93,6 @@ public class CgFormHeadController extends BaseController {
|
|||
return new ModelAndView("jeecg/cgform/config/cgformSynChoice");
|
||||
}
|
||||
|
||||
//update-begin--Author:luobaoli Date:20150705 for:取消title参数,修改"配置地址"生成的URL为REST风格
|
||||
//update-begin--Author: jg_huangxg Date:20150806 for:恢复title参数,修改"配置地址"生成的URL为 .do风格
|
||||
@RequestMapping(params = "popmenulink")
|
||||
public ModelAndView popmenulink(ModelMap modelMap,
|
||||
@RequestParam String url,
|
||||
|
@ -110,8 +101,7 @@ public class CgFormHeadController extends BaseController {
|
|||
modelMap.put("url",url);
|
||||
return new ModelAndView("jeecg/cgform/config/popmenulink");
|
||||
}
|
||||
//update-end--Author: jg_huangxg Date:20150806 for:恢复title参数,修改"配置地址"生成的URL为 .do风格
|
||||
//update-end--Author:luobaoli Date:20150705 for:取消title参数,修改"配置地址"生成的URL为REST风格
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
|
@ -127,13 +117,13 @@ public class CgFormHeadController extends BaseController {
|
|||
DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(CgFormHeadEntity.class,
|
||||
dataGrid);
|
||||
//update-start--Author:luobaoli Date:20150607 for:添加表单查询过滤条件
|
||||
|
||||
String jformCategory = request.getParameter("jformCategory");
|
||||
if(StringUtil.isNotEmpty(jformCategory)){
|
||||
cq.eq("jformCategory", jformCategory);
|
||||
cq.add();
|
||||
}
|
||||
//update-end--Author:luobaoli Date:20150607 for:添加表单查询过滤条件
|
||||
|
||||
|
||||
// 查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||||
|
@ -154,7 +144,7 @@ public class CgFormHeadController extends BaseController {
|
|||
AjaxJson j = new AjaxJson();
|
||||
cgFormHead = systemService.getEntity(CgFormHeadEntity.class,
|
||||
cgFormHead.getId());
|
||||
message = "删除成功";
|
||||
String message = "删除成功";
|
||||
cgFormFieldService.deleteCgForm(cgFormHead);
|
||||
cgFormFieldService.removeSubTableStr4Main(cgFormHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
|
@ -176,7 +166,7 @@ public class CgFormHeadController extends BaseController {
|
|||
AjaxJson j = new AjaxJson();
|
||||
cgFormHead = systemService.getEntity(CgFormHeadEntity.class,
|
||||
cgFormHead.getId());
|
||||
message = "移除成功";
|
||||
String message = "移除成功";
|
||||
cgFormFieldService.delete(cgFormHead);
|
||||
cgFormFieldService.removeSubTableStr4Main(cgFormHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
|
@ -198,7 +188,7 @@ public class CgFormHeadController extends BaseController {
|
|||
AjaxJson j = new AjaxJson();
|
||||
cgFormField = systemService.getEntity(CgFormFieldEntity.class,
|
||||
cgFormField.getId());
|
||||
message = cgFormField.getFieldName()+"删除成功";
|
||||
String message = cgFormField.getFieldName()+"删除成功";
|
||||
cgFormFieldService.delete(cgFormField);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
@ -218,6 +208,7 @@ public class CgFormHeadController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson doDbSynch(CgFormHeadEntity cgFormHead,String synMethod,
|
||||
HttpServletRequest request) {
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgFormHead = systemService.getEntity(CgFormHeadEntity.class,
|
||||
cgFormHead.getId());
|
||||
|
@ -253,9 +244,10 @@ public class CgFormHeadController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson save(CgFormHeadEntity cgFormHead,
|
||||
HttpServletRequest request) {
|
||||
//update-begin--Author:张忠亮 Date:20151121 for:清除缓存
|
||||
String message = "";
|
||||
|
||||
templetContext.clearCache();
|
||||
//update-end--Author:张忠亮 Date:20151121 for:清除缓存
|
||||
|
||||
AjaxJson j = new AjaxJson();
|
||||
CgFormHeadEntity oldTable =cgFormFieldService.getEntity(CgFormHeadEntity.class, cgFormHead.getId());
|
||||
cgFormFieldService.removeSubTableStr4Main(oldTable);
|
||||
|
@ -275,7 +267,9 @@ public class CgFormHeadController extends BaseController {
|
|||
}
|
||||
*/
|
||||
//step.2 判定表格是否存在
|
||||
CgFormHeadEntity table = judgeTableIsNotExit(cgFormHead,oldTable);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
CgFormHeadEntity table = judgeTableIsNotExit(cgFormHead,oldTable,msg);
|
||||
message = msg.toString();
|
||||
//step.3 刷新orderNum并且去重复
|
||||
refreshFormFieldOrderNum(cgFormHead);
|
||||
|
||||
|
@ -290,9 +284,15 @@ public class CgFormHeadController extends BaseController {
|
|||
}
|
||||
|
||||
}
|
||||
cgFormFieldService.updateTable(table,null);
|
||||
|
||||
boolean isChange = cgFormIndexService.updateIndexes(cgFormHead);
|
||||
|
||||
//isChange 索引是否更新
|
||||
cgFormFieldService.updateTable(table,null,isChange);
|
||||
|
||||
cgFormFieldService.appendSubTableStr4Main(table);
|
||||
cgFormFieldService.sortSubTableStr(table);
|
||||
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE,
|
||||
Globals.Log_Leavel_INFO);
|
||||
} else if (StringUtil.isEmpty(cgFormHead.getId())&&table==null) {
|
||||
|
@ -305,6 +305,9 @@ public class CgFormHeadController extends BaseController {
|
|||
|
||||
}
|
||||
cgFormFieldService.saveTable(cgFormHead);
|
||||
|
||||
cgFormIndexService.updateIndexes(cgFormHead);
|
||||
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
}
|
||||
|
@ -329,7 +332,8 @@ public class CgFormHeadController extends BaseController {
|
|||
* @param oldTable
|
||||
* @return
|
||||
*/
|
||||
private CgFormHeadEntity judgeTableIsNotExit(CgFormHeadEntity cgFormHead, CgFormHeadEntity oldTable) {
|
||||
private CgFormHeadEntity judgeTableIsNotExit(CgFormHeadEntity cgFormHead, CgFormHeadEntity oldTable,StringBuffer msg) {
|
||||
String message = "";
|
||||
CgFormHeadEntity table = cgFormFieldService.findUniqueByProperty(CgFormHeadEntity.class, "tableName",cgFormHead.getTableName());
|
||||
if (StringUtil.isNotEmpty(cgFormHead.getId())) {
|
||||
if(table != null && !oldTable.getTableName().equals(cgFormHead.getTableName())){
|
||||
|
@ -350,6 +354,7 @@ public class CgFormHeadController extends BaseController {
|
|||
} else {
|
||||
message = table != null? "表已经存在":"创建成功";
|
||||
}
|
||||
msg.append(message);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
@ -368,10 +373,10 @@ public class CgFormHeadController extends BaseController {
|
|||
//cgFormHead.setTableName(cgFormHead.getTableName().replace(CgAutoListConstant.jform_, ""));
|
||||
req.setAttribute("cgFormHeadPage", cgFormHead);
|
||||
}
|
||||
//update-start--Author:luobaoli Date:20150607 for:增加表单分类列表
|
||||
List<TSType> typeList = TSTypegroup.allTypes.get(MutiLangUtil.getMutiLangInstance().getLang("bdfl"));
|
||||
|
||||
List<TSType> typeList = ResourceUtil.allTypes.get(MutiLangUtil.getMutiLangInstance().getLang("bdfl"));
|
||||
req.setAttribute("typeList", typeList);
|
||||
//update-end--Author:luobaoli Date:20150607 for:增加表单分类列表
|
||||
|
||||
return new ModelAndView("jeecg/cgform/config/cgFormHead");
|
||||
}
|
||||
/**
|
||||
|
@ -411,6 +416,7 @@ public class CgFormHeadController extends BaseController {
|
|||
}
|
||||
return columnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加初始化列
|
||||
* @return
|
||||
|
@ -425,13 +431,12 @@ public class CgFormHeadController extends BaseController {
|
|||
columnList.add(initCgFormFieldEntityString("update_name","更新人名称"));
|
||||
columnList.add(initCgFormFieldEntityString("update_by", "更新人登录名称"));
|
||||
columnList.add(initCgFormFieldEntityTime("update_date", "更新日期"));
|
||||
//update-begin--Author:张忠亮 Date:20150613 for:新增默认字段
|
||||
|
||||
columnList.add(initCgFormFieldEntityString("sys_org_code","所属部门"));
|
||||
columnList.add(initCgFormFieldEntityString("sys_company_code", "所属公司"));
|
||||
//update-end--Author:张忠亮 Date:20150613 for:新增默认字段
|
||||
//update-begin--Author:zhoujf Date:20160115 for:新增流程状态默认字段
|
||||
|
||||
columnList.add(initCgFormFieldEntityBpmStatus());
|
||||
//update-end--Author:zhoujf Date:20160115 for:新增流程状态默认字段
|
||||
|
||||
return columnList;
|
||||
}
|
||||
/**
|
||||
|
@ -551,10 +556,11 @@ public class CgFormHeadController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson sqlPluginSave(String id,String sql_plug_in,
|
||||
HttpServletRequest request) {
|
||||
String message = "";
|
||||
CgFormHeadEntity bean = cgFormFieldService.getEntity(
|
||||
CgFormHeadEntity.class, id);
|
||||
//bean.setSqlPlugIn(sql_plug_in);
|
||||
cgFormFieldService.updateTable(bean,null);
|
||||
cgFormFieldService.updateTable(bean,null,false);
|
||||
message = "保存成功";
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
@ -584,10 +590,11 @@ public class CgFormHeadController extends BaseController {
|
|||
@ResponseBody
|
||||
public AjaxJson jsPluginSave(String id,String js_plug_in,
|
||||
HttpServletRequest request) {
|
||||
String message = "";
|
||||
CgFormHeadEntity bean = cgFormFieldService.getEntity(
|
||||
CgFormHeadEntity.class, id);
|
||||
//bean.setJsPlugIn(js_plug_in);停用jsPlugIn这个字段
|
||||
cgFormFieldService.updateTable(bean,null);
|
||||
cgFormFieldService.updateTable(bean,null,false);
|
||||
message = "保存成功";
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
@ -626,7 +633,7 @@ public class CgFormHeadController extends BaseController {
|
|||
StringBuilder sb = new StringBuilder("");
|
||||
List<CgFormFieldEntity> saveList = new ArrayList<CgFormFieldEntity>();
|
||||
for (CgFormFieldVO field : fieldList) {
|
||||
System.out.println("-------------field------------"+field);
|
||||
//System.out.println("-------------field------------"+field);
|
||||
if(StringUtil.isEmpty(field.getFieldName())){
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,406 @@
|
|||
package org.jeecgframework.web.cgform.controller.config;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
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.log4j.Logger;
|
||||
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.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.config.CgFormIndexEntity;
|
||||
import org.jeecgframework.web.cgform.service.config.CgFormIndexServiceI;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 索引表
|
||||
* @author onlineGenerator
|
||||
* @date 2016-06-09 20:39:52
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/cgFormIndexController")
|
||||
public class CgFormIndexController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(CgFormIndexController.class);
|
||||
|
||||
@Autowired
|
||||
private CgFormIndexServiceI cgFormIndexService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 索引表列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/index/cgFormIndexList");
|
||||
}
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(CgFormIndexEntity cgFormIndex,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(CgFormIndexEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, cgFormIndex, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.cgFormIndexService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除索引表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(CgFormIndexEntity cgFormIndex, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgFormIndex = systemService.getEntity(CgFormIndexEntity.class, cgFormIndex.getId());
|
||||
message = "索引表删除成功";
|
||||
try{
|
||||
cgFormIndexService.delete(cgFormIndex);
|
||||
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(",")){
|
||||
CgFormIndexEntity cgFormIndex = systemService.getEntity(CgFormIndexEntity.class,
|
||||
id
|
||||
);
|
||||
cgFormIndexService.delete(cgFormIndex);
|
||||
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(CgFormIndexEntity cgFormIndex, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "索引表添加成功";
|
||||
try{
|
||||
cgFormIndexService.save(cgFormIndex);
|
||||
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(CgFormIndexEntity cgFormIndex, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "索引表更新成功";
|
||||
CgFormIndexEntity t = cgFormIndexService.get(CgFormIndexEntity.class, cgFormIndex.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(cgFormIndex, t);
|
||||
cgFormIndexService.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(CgFormIndexEntity cgFormIndex, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(cgFormIndex.getId())) {
|
||||
cgFormIndex = cgFormIndexService.getEntity(CgFormIndexEntity.class, cgFormIndex.getId());
|
||||
req.setAttribute("cgFormIndexPage", cgFormIndex);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/index/cgFormIndex-add");
|
||||
}
|
||||
/**
|
||||
* 索引表编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(CgFormIndexEntity cgFormIndex, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(cgFormIndex.getId())) {
|
||||
cgFormIndex = cgFormIndexService.getEntity(CgFormIndexEntity.class, cgFormIndex.getId());
|
||||
req.setAttribute("cgFormIndexPage", cgFormIndex);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/index/cgFormIndex-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","cgFormIndexController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(CgFormIndexEntity cgFormIndex,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(CgFormIndexEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, cgFormIndex, request.getParameterMap());
|
||||
List<CgFormIndexEntity> cgFormIndexs = this.cgFormIndexService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"索引表");
|
||||
modelMap.put(NormalExcelConstants.CLASS,CgFormIndexEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,cgFormIndexs);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(CgFormIndexEntity cgFormIndex,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"索引表");
|
||||
modelMap.put(NormalExcelConstants.CLASS,CgFormIndexEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUserName().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<CgFormIndexEntity> listCgFormIndexEntitys = ExcelImportUtil.importExcel(file.getInputStream(),CgFormIndexEntity.class,params);
|
||||
for (CgFormIndexEntity cgFormIndex : listCgFormIndexEntitys) {
|
||||
cgFormIndexService.save(cgFormIndex);
|
||||
}
|
||||
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<CgFormIndexEntity> list() {
|
||||
List<CgFormIndexEntity> listCgFormIndexs=cgFormIndexService.getList(CgFormIndexEntity.class);
|
||||
return listCgFormIndexs;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
CgFormIndexEntity task = cgFormIndexService.get(CgFormIndexEntity.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 CgFormIndexEntity cgFormIndex, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<CgFormIndexEntity>> failures = validator.validate(cgFormIndex);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
cgFormIndexService.save(cgFormIndex);
|
||||
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = cgFormIndex.getId();
|
||||
URI uri = uriBuilder.path("/rest/cgFormIndexController/" + 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 CgFormIndexEntity cgFormIndex) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<CgFormIndexEntity>> failures = validator.validate(cgFormIndex);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
cgFormIndexService.saveOrUpdate(cgFormIndex);
|
||||
|
||||
//按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) {
|
||||
cgFormIndexService.deleteEntityById(CgFormIndexEntity.class, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表格具体的属性列
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "getIndexList")
|
||||
@ResponseBody
|
||||
public List<CgFormIndexEntity> getColumnList(CgFormIndexEntity cgFormHead,String type,
|
||||
HttpServletRequest req) {
|
||||
|
||||
List<CgFormIndexEntity> columnList = new ArrayList<CgFormIndexEntity>();
|
||||
if (StringUtil.isNotEmpty(cgFormHead.getId())) {
|
||||
CriteriaQuery cq = new CriteriaQuery(CgFormIndexEntity.class);
|
||||
cq.eq("table.id", cgFormHead.getId());
|
||||
cq.add();
|
||||
columnList = cgFormIndexService
|
||||
.getListByCriteriaQuery(cq, false);
|
||||
//对字段列按顺序排序
|
||||
//Collections.sort(columnList,new FieldNumComparator());
|
||||
}else{
|
||||
//columnList=getInitDataList();
|
||||
}
|
||||
return columnList;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ import java.util.Map;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/jformGraphreportHeadController")
|
||||
public class JformGraphreportHeadController extends BaseController {
|
||||
|
@ -286,9 +286,9 @@ public class JformGraphreportHeadController extends BaseController {
|
|||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
//update-begin--Author:JueYue Date:20150523 for:EasyPoi升级
|
||||
|
||||
List<JformGraphreportHeadPage> listCourses = ExcelImportUtil.importExcel(file.getInputStream(), JformGraphreportHeadPage.class, params);
|
||||
//update-end--Author:JueYue Date:20150523 for:EasyPoi升级
|
||||
|
||||
for(JformGraphreportHeadPage page:listCourses){
|
||||
JformGraphreportHeadEntity headEntity=page.getJformGraphreportHeadEntity();
|
||||
List<JformGraphreportItemEntity> itemEntities=page.getJformGraphreportItemList();
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformEnhanceJavaController")
|
||||
public class CgformEnhanceJavaController extends BaseController {
|
||||
|
@ -52,15 +52,6 @@ public class CgformEnhanceJavaController extends BaseController {
|
|||
private CgformButtonServiceI cgformButtonService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -109,6 +100,7 @@ public class CgformEnhanceJavaController extends BaseController {
|
|||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(CgformEnhanceJavaEntity cgformEnhanceJava, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformEnhanceJava = systemService.getEntity(CgformEnhanceJavaEntity.class, cgformEnhanceJava.getId());
|
||||
message = "删除成功";
|
||||
|
@ -132,6 +124,7 @@ public class CgformEnhanceJavaController extends BaseController {
|
|||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "删除成功";
|
||||
try{
|
||||
|
@ -179,6 +172,7 @@ public class CgformEnhanceJavaController extends BaseController {
|
|||
@RequestMapping(params = "save")
|
||||
@ResponseBody
|
||||
public AjaxJson save(CgformEnhanceJavaEntity cgformEnhanceJavaEntity, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
List<CgformEnhanceJavaEntity> list = cgformEnhanceJavaService.checkCgformEnhanceJavaEntity(cgformEnhanceJavaEntity);
|
||||
if(list!=null&&list.size()>0){
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformEnhanceJsController")
|
||||
public class CgformEnhanceJsController extends BaseController {
|
||||
|
@ -44,15 +44,6 @@ public class CgformEnhanceJsController extends BaseController {
|
|||
private CgformEnhanceJsServiceI cgformenhanceJsService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -92,6 +83,7 @@ public class CgformEnhanceJsController extends BaseController {
|
|||
@RequestMapping(params = "del")
|
||||
@ResponseBody
|
||||
public AjaxJson del(CgformEnhanceJsEntity cgformenhanceJs, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformenhanceJs = systemService.getEntity(CgformEnhanceJsEntity.class, cgformenhanceJs.getId());
|
||||
message = "删除成功";
|
||||
|
@ -130,6 +122,7 @@ public class CgformEnhanceJsController extends BaseController {
|
|||
@RequestMapping(params = "save")
|
||||
@ResponseBody
|
||||
public AjaxJson save(CgformEnhanceJsEntity cgformenhanceJs, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
if (StringUtil.isNotEmpty(cgformenhanceJs.getId())) {
|
||||
message = "更新成功";
|
||||
|
|
|
@ -59,13 +59,12 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
* @ClassName: excelTempletController
|
||||
* @Description: excel模版处理
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/excelTempletController")
|
||||
public class ExcelTempletController extends BaseController {
|
||||
private static final Logger logger = Logger
|
||||
.getLogger(ExcelTempletController.class);
|
||||
private String message;
|
||||
@Autowired
|
||||
private ConfigServiceI configService;
|
||||
@Autowired
|
||||
|
@ -77,13 +76,6 @@ public class ExcelTempletController extends BaseController {
|
|||
@Autowired
|
||||
private SystemService systemService;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel模版
|
||||
|
@ -369,9 +361,9 @@ public class ExcelTempletController extends BaseController {
|
|||
String value = String.valueOf(r.get(bean.getFieldName()));
|
||||
for (DictEntity dictEntity : dicDataList) {
|
||||
if (value.equalsIgnoreCase(dictEntity.getTypecode())) {
|
||||
//------------------update-begin------for:-国际化处理-----------------------author:zhagndaihao------------
|
||||
|
||||
r.put(bean.getFieldName(), MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename()));
|
||||
//------------------update-end-----for:-国际化处理----------------------------author:zhagndaihao---------
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,14 +155,14 @@ public class GenerateController extends BaseController {
|
|||
//step.2 判断表是否存在
|
||||
boolean tableexist = new JeecgReadTable().checkTableExist(tableName);
|
||||
if(tableexist){
|
||||
//update--begin-------author:scott------date:20151118----for:online生成器支持自定义word模板生成---------------
|
||||
|
||||
//step.3 判断是不是用用户自定义界面
|
||||
CgformCodeGenerate generate = new CgformCodeGenerate(createFileProperty,generateEntity);
|
||||
if(createFileProperty.getJspMode().equals("04")){
|
||||
String formhtml = templetContextWord.autoFormGenerateHtml(tableName, null, null);
|
||||
generate.setCgformJspHtml(formhtml);
|
||||
}
|
||||
//update--end-------author:scott------date:20151118----for:online生成器支持自定义word模板生成---------------
|
||||
|
||||
//step.4 调用代码生成器
|
||||
generate.generateToFile();
|
||||
|
||||
|
@ -185,6 +185,11 @@ public class GenerateController extends BaseController {
|
|||
response.getWriter().flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,13 +242,13 @@ public class GenerateController extends BaseController {
|
|||
}
|
||||
codeParamEntityIn.setSubTabParam(subTabParamIn);
|
||||
//step.5 一对多(父子表)数据模型,代码生成
|
||||
//update--begin-------author:zhoujf------date:20160318----for:online生成器支持bootstrap风格生成---------------
|
||||
|
||||
if("06".equals(jspMode)){
|
||||
CgformCodeGenerateOneToMany.oneToManyCreateBootstap(subTabParamIn, codeParamEntityIn,mainG,subsG);
|
||||
}else{
|
||||
CgformCodeGenerateOneToMany.oneToManyCreate(subTabParamIn, codeParamEntityIn,mainG,subsG);
|
||||
}
|
||||
//update--end-------author:zhoujf------date:20160318----for:online生成器支持bootstrap风格生成---------------
|
||||
|
||||
//j.setMsg("成功生成增删改查->功能:"+codeParamEntityIn.getFtlDescription());
|
||||
j.setMsg(codeParamEntityIn.getFtlDescription()+":功能生成成功,请刷新项目重启,菜单访问路径:"+CodeStringUtils.getInitialSmall(codeParamEntityIn.getEntityName())+"Controller.do?list");
|
||||
}catch (Exception e) {
|
||||
|
@ -260,6 +265,11 @@ public class GenerateController extends BaseController {
|
|||
response.getWriter().flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
response.getWriter().close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -1,31 +1,41 @@
|
|||
package org.jeecgframework.web.cgform.controller.template;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import jodd.io.StreamUtil;
|
||||
import jodd.io.ZipUtil;
|
||||
import junit.framework.Assert;
|
||||
import org.apache.commons.io.*;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
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.*;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
import org.jeecgframework.core.util.FileUtils;
|
||||
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.TemplateExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity;
|
||||
import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI;
|
||||
import org.jeecgframework.web.system.manager.ClientManager;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -39,15 +49,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
|
@ -57,7 +58,7 @@ import java.util.zip.ZipOutputStream;
|
|||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgformTemplateController")
|
||||
public class CgformTemplateController extends BaseController {
|
||||
|
@ -70,15 +71,6 @@ public class CgformTemplateController extends BaseController {
|
|||
private CgformTemplateServiceI cgformTemplateService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -129,6 +121,7 @@ public class CgformTemplateController extends BaseController {
|
|||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(CgformTemplateEntity cgformTemplate, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgformTemplate = systemService.getEntity(CgformTemplateEntity.class, cgformTemplate.getId());
|
||||
message = "自定义模板删除成功";
|
||||
|
@ -162,6 +155,7 @@ public class CgformTemplateController extends BaseController {
|
|||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "自定义模板删除成功";
|
||||
try{
|
||||
|
@ -194,6 +188,7 @@ public class CgformTemplateController extends BaseController {
|
|||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(CgformTemplateEntity cgformTemplate, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "自定义模板添加成功";
|
||||
try{
|
||||
|
@ -257,6 +252,7 @@ public class CgformTemplateController extends BaseController {
|
|||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(CgformTemplateEntity cgformTemplate, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "自定义模板更新成功";
|
||||
CgformTemplateEntity t = cgformTemplateService.get(CgformTemplateEntity.class, cgformTemplate.getId());
|
||||
|
@ -548,10 +544,10 @@ public class CgformTemplateController extends BaseController {
|
|||
}
|
||||
//获取上传根路径
|
||||
private String getUploadBasePath(HttpServletRequest request){
|
||||
// update-start--Author:zhoujf Date:20150623 for:文件basePath获取
|
||||
|
||||
// String path=request.getSession().getServletContext().getRealPath("/WEB-INF/classes/online/template");
|
||||
String path= this.getClass().getResource("/").getPath()+"online/template";
|
||||
// update-end--Author:zhoujf Date:20150623 for:文件basePath获取
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,14 +80,20 @@ public class CgformTransController {
|
|||
html = getJson(index, index.size());
|
||||
} else
|
||||
html = getJson(list, list.size());
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer = response.getWriter();
|
||||
writer.println(html);
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,13 +197,13 @@ public class CgformTransController {
|
|||
cgFormField.setLength(Integer.valueOf(columnt
|
||||
.getPrecision()));
|
||||
}
|
||||
//update-begin--Author:zhangdaihao Date:20140212 for:[001]oracle下number类型,数据库表导出表单,默认长度为0同步失败
|
||||
|
||||
else{
|
||||
if(cgFormField.getType().equals(DataBaseConst.INT)){
|
||||
cgFormField.setLength(10);
|
||||
}
|
||||
}
|
||||
//update-end--Author:zhangdaihao Date:20140212 for:[001]oracle下number类型,数据库表导出表单,默认长度为0同步失败
|
||||
|
||||
if (StringUtil.isNotEmpty(columnt.getScale()))
|
||||
cgFormField.setPointLength(Integer.valueOf(columnt
|
||||
.getScale()));
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
* @date Jul 24, 2013 9:10:44 PM
|
||||
* @version V1.0
|
||||
*/
|
||||
@Scope("prototype")
|
||||
//@Scope("prototype")
|
||||
@Controller
|
||||
@RequestMapping("/cgUploadController")
|
||||
public class CgUploadController extends BaseController {
|
||||
|
@ -46,15 +46,7 @@ public class CgUploadController extends BaseController {
|
|||
private SystemService systemService;
|
||||
@Autowired
|
||||
private CgUploadServiceI cgUploadService;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
/**
|
||||
* 保存文件
|
||||
* @param request
|
||||
|
@ -102,6 +94,7 @@ public class CgUploadController extends BaseController {
|
|||
@RequestMapping(params = "delFile")
|
||||
@ResponseBody
|
||||
public AjaxJson delFile( HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
String id = request.getParameter("id");
|
||||
CgUploadEntity file = systemService.getEntity(CgUploadEntity.class, id);
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecgframework.web.cgform.engine;
|
|||
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
|
||||
import org.jeecgframework.web.cgform.common.FormHtmlUtil;
|
||||
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
|
||||
|
@ -49,7 +50,7 @@ public class DBTempletLoader implements TemplateLoader {
|
|||
name = name.replace("_zh_cn", "").replace("_ZH_CN", "").replace("_zh_CN", "");
|
||||
name = name.replace("_en_us", "").replace("_EN_US", "").replace("_en_US", "");
|
||||
//update by Robin postgreSQL 修正大小写的问题 2013-03-13
|
||||
org.jeecgframework.core.util.LogUtil.info("table name----------->"+name);
|
||||
LogUtil.debug("table name----------->"+name);
|
||||
Object obj = getObject(name);
|
||||
return obj;
|
||||
}
|
||||
|
@ -72,16 +73,14 @@ public class DBTempletLoader implements TemplateLoader {
|
|||
}
|
||||
|
||||
private Object getObject(String name) throws IOException {
|
||||
// update-start--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
String ftlVersion = "";
|
||||
String ftlVersionParam = "&ftlVersion=";
|
||||
if(name.contains(ftlVersionParam)) {
|
||||
ftlVersion = name.substring(name.indexOf(ftlVersionParam) + ftlVersionParam.length());
|
||||
name = name.substring(0, name.indexOf(ftlVersionParam));
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
TemplateUtil.TemplateType templateType= null;
|
||||
if(name.lastIndexOf(".ftl")==-1&&name.lastIndexOf("_")!=-1){
|
||||
templateType=TemplateUtil.TemplateType.getVal(name.substring(name.lastIndexOf("_")+1));
|
||||
|
@ -90,20 +89,20 @@ public class DBTempletLoader implements TemplateLoader {
|
|||
if(templateType==null){
|
||||
templateType= TemplateUtil.TemplateType.UPDATE;
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
|
||||
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
||||
if(name.lastIndexOf(".ftl")==-1){//判断是否为include的模板
|
||||
//如果是主表直接走一对多模板
|
||||
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(name);
|
||||
if(head==null)return null;
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
CgformTemplateEntity entity=cgformTemplateService.findByCode(head.getFormTemplate());
|
||||
//update-end--Author:张忠亮 Date:20150707 for:online表单风格加入录入、编辑、列表、详情页面设置
|
||||
|
||||
if(head.getJformType()==CgAutoListConstant.JFORM_TYPE_MAIN_TALBE){
|
||||
//update-begin--Author:张忠亮 Date:20150623 for:自定义模板
|
||||
|
||||
Resource[] resources = patternResolver.getResources(TemplateUtil.getTempletPath(entity, head.getJformType(), templateType));
|
||||
//update-end--Author:张忠亮 Date:20150623 for:自定义模板
|
||||
|
||||
InputStreamReader inputStreamReader =null;
|
||||
if (resources != null && resources.length > 0) {
|
||||
inputStreamReader = new InputStreamReader(resources[0].getInputStream(),"UTF-8");
|
||||
|
@ -112,23 +111,23 @@ public class DBTempletLoader implements TemplateLoader {
|
|||
}
|
||||
//1、根据table name 查询cgformftl 有则获取模板内容
|
||||
//2、没有cgformftl 则查询cgformfield 根据cgformfield生成模板
|
||||
// update-start--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
Map<String,Object> cgformFtlEntity = new HashMap<String, Object>();
|
||||
if (ftlVersion != null && ftlVersion.length() > 0) {
|
||||
cgformFtlEntity = cgformFtlService.getCgformFtlByTableName(name, ftlVersion);
|
||||
} else {
|
||||
cgformFtlEntity = cgformFtlService.getCgformFtlByTableName(name);
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
if(cgformFtlEntity!=null){
|
||||
String content = (String) (cgformFtlEntity.get("ftl_content")==null?"":cgformFtlEntity.get("ftl_content"));
|
||||
content = initFormHtml( content, name);
|
||||
// org.jeecgframework.core.util.LogUtil.info(content);
|
||||
return new StringBuilder(content);
|
||||
}else{
|
||||
//update-begin--Author:张忠亮 Date:20150623 for:自定义模板
|
||||
|
||||
Resource[] resources = patternResolver.getResources(TemplateUtil.getTempletPath(entity, head.getJformType(),templateType));
|
||||
//update-end--Author:张忠亮 Date:20150623 for:自定义模板
|
||||
|
||||
InputStreamReader inputStreamReader =null;
|
||||
if (resources != null && resources.length > 0) {
|
||||
inputStreamReader = new InputStreamReader(resources[0].getInputStream(),"UTF-8");
|
||||
|
|
|
@ -65,11 +65,11 @@ public class TempletContext {
|
|||
return null;
|
||||
}
|
||||
String oldTableName = tableName;
|
||||
// update-start--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
if (ftlVersion != null && ftlVersion.length() > 0) {
|
||||
tableName = tableName + "&ftlVersion=" + ftlVersion;
|
||||
}
|
||||
// update-end--Author:zhangguoming Date:20140922 for:根据ftlVersion动态读取模板
|
||||
|
||||
try {
|
||||
if(CgAutoListConstant.SYS_MODE_DEV.equalsIgnoreCase(_sysMode)){//开发模式
|
||||
template = freemarker.getTemplate(tableName,freemarker.getLocale(), ENCODING);
|
||||
|
@ -128,7 +128,7 @@ public class TempletContext {
|
|||
public void setTags(Map<String, TemplateDirectiveModel> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
//update-begin--Author:张忠亮 Date:20151121 for:清除缓存
|
||||
|
||||
public void clearCache(){
|
||||
try{
|
||||
ehCache.removeAll();
|
||||
|
@ -136,5 +136,5 @@ public class TempletContext {
|
|||
|
||||
}
|
||||
}
|
||||
//update-end--Author:张忠亮 Date:20151121 for:清除缓存
|
||||
|
||||
}
|
||||
|
|
|
@ -264,15 +264,15 @@ function createDataGrid${config_id}(){
|
|||
}
|
||||
//新增
|
||||
function ${config_id}add(){
|
||||
add('${config_name}录入','cgFormBuildController.do?ftlForm&tableName=${config_id}','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
add('${config_name}录入','cgFormBuildController.do?goAddFtlForm&tableName=${config_id}','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
}
|
||||
//修改
|
||||
function ${config_id}update(){
|
||||
update('${config_name}编辑','cgFormBuildController.do?ftlForm&tableName=${config_id}','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
update('${config_name}编辑','cgFormBuildController.do?goUpdateFtlForm&tableName=${config_id}','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
}
|
||||
//查看
|
||||
function ${config_id}view(){
|
||||
detail('查看','cgFormBuildController.do?ftlForm&tableName=${config_id}&mode=read','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
detail('查看','cgFormBuildController.do?goDatilFtlForm&tableName=${config_id}&mode=read','${config_id}List',${config_id}Fw,${config_id}Fh);
|
||||
}
|
||||
|
||||
//批量删除
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<input style="width:20px;" type="checkbox" name="ck"/>
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].id" id="${sub}[${subTableData_index}].id" value="${subTableData['id']?if_exists?html}"/>
|
||||
<#list field['${sub}'].hiddenFieldList as subTableField >
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].${subTableField.field_name}" id="${sub}[${subTableData_index}].${subTableField.field_name}" value="${subTableData['${subTableField.field_name}']?if_exists?html}}"/>
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].${subTableField.field_name}" id="${sub}[${subTableData_index}].${subTableField.field_name}" value="${subTableData['${subTableField.field_name}']?if_exists?html}"/>
|
||||
</#list>
|
||||
</td>
|
||||
<#list field['${sub}'].fieldList as subTableField >
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<#list data['${sub}'] as subTableData >
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].id" id="${sub}[${subTableData_index}].id" value="${subTableData['id']?if_exists?html}"/>
|
||||
<#list field['${sub}'].hiddenFieldList as subTableField >
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].${subTableField.field_name}" id="${sub}[${subTableData_index}].${subTableField.field_name}" value="${subTableData['${subTableField.field_name}']?if_exists?html}}"/>
|
||||
<input type="hidden" name="${sub}[${subTableData_index}].${subTableField.field_name}" id="${sub}[${subTableData_index}].${subTableField.field_name}" value="${subTableData['${subTableField.field_name}']?if_exists?html}"/>
|
||||
</#list>
|
||||
<#list field['${sub}'].fieldNoAreaList as subTableField >
|
||||
<#if subTableField_index%2==0>
|
||||
|
|
|
@ -6,10 +6,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -58,17 +57,16 @@ public class DictDataTag implements TemplateDirectiveModel {
|
|||
|
||||
if (tablename == null || tablename.trim().length() <= 0) {
|
||||
// 根据dict_field查询字典表list
|
||||
List<TSType> dataList = TSTypegroup.allTypes
|
||||
.get(name.toLowerCase());
|
||||
List<TSType> dataList = ResourceUtil.allTypes.get(name.toLowerCase());
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<TSType>();
|
||||
}
|
||||
//------------------update-begin------for:-国际化处理-----------------------author:zhagndaihao------------
|
||||
|
||||
for(TSType s:dataList){
|
||||
String names = s.getTypename();
|
||||
s.setTypename(MutiLangUtil.getMutiLangInstance().getLang(names));
|
||||
}
|
||||
//------------------update-end-----for:-国际化处理----------------------------author:zhagndaihao---------
|
||||
|
||||
env.setGlobalVariable(var, new SimpleCollection(dataList));
|
||||
} else {
|
||||
// table表查询
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecgframework.web.cgform.enhance;
|
||||
|
||||
import org.jeecgframework.core.common.exception.BusinessException;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -12,6 +13,6 @@ import java.util.Map;
|
|||
public class CgformJavaInterDemo implements CgformEnhanceJavaInter {
|
||||
@Override
|
||||
public void execute(Map map) throws BusinessException {
|
||||
System.out.println("============调用[java增强]成功!==============");
|
||||
LogUtil.info("============调用[java增强]成功!==============");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ public class AutoFormDbEntity implements java.io.Serializable {
|
|||
private java.lang.String tbDbKey;
|
||||
/**填报数据表*/
|
||||
private java.lang.String tbDbTableName;
|
||||
//update-begin--Author:zzl Date:20151028 for:数据源名称
|
||||
|
||||
private String dbChName;
|
||||
//update-end--Author:zzl Date:20151028 for:数据源名称
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
|
@ -347,7 +347,7 @@ public class AutoFormDbEntity implements java.io.Serializable {
|
|||
return tbDbTableName;
|
||||
}
|
||||
//add-end--Author: jg_huangxg Date:20150723 for:增加填报数据源字段和填报数据表字段
|
||||
//update-begin--Author:zzl Date:20151028 for:数据源名称
|
||||
|
||||
@Column(name ="DB_CH_NAME",nullable=true,length=32)
|
||||
public String getDbChName() {
|
||||
return dbChName;
|
||||
|
@ -356,5 +356,5 @@ public class AutoFormDbEntity implements java.io.Serializable {
|
|||
public void setDbChName(String dbChName) {
|
||||
this.dbChName = dbChName;
|
||||
}
|
||||
//update-end--Author:zzl Date:20151028 for:数据源名称
|
||||
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ public class AutoFormDbFieldEntity implements java.io.Serializable {
|
|||
/**字段名*/
|
||||
@Excel(name="字段名")
|
||||
private java.lang.String fieldName;
|
||||
//update-begin--Author:zzl Date:20151028 for:就增加字段文本
|
||||
|
||||
@Excel(name="字段文本")
|
||||
private String fieldText;
|
||||
//update-end--Author:zzl Date:20151028 for:就增加字段文本
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
|
@ -237,7 +237,6 @@ public class AutoFormDbFieldEntity implements java.io.Serializable {
|
|||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
//update-begin--Author:zzl Date:20151028 for:增加字段文本
|
||||
@Column(name ="FIELD_Text",nullable=true,length=50)
|
||||
public String getFieldText() {
|
||||
return fieldText;
|
||||
|
@ -246,6 +245,6 @@ public class AutoFormDbFieldEntity implements java.io.Serializable {
|
|||
public void setFieldText(String fieldText) {
|
||||
this.fieldText = fieldText;
|
||||
}
|
||||
//update-end--Author:zzl Date:20151028 for:增加字段文本
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ public class AutoFormEntity implements java.io.Serializable {
|
|||
private java.lang.String dbId;
|
||||
|
||||
private java.lang.String autoFormId;
|
||||
//update-begin--Author:zzl Date:20151028 for:增加主数据源
|
||||
|
||||
private String mainTableSource;
|
||||
//update-end--Author:zzl Date:20151028 for:增加主数据源
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
|
@ -311,7 +311,7 @@ public class AutoFormEntity implements java.io.Serializable {
|
|||
public void setAutoFormId(java.lang.String autoFormId) {
|
||||
this.autoFormId = autoFormId;
|
||||
}
|
||||
//update-begin--Author:zzl Date:20151028 for:增加主数据源
|
||||
|
||||
@Column(name ="main_table_source",nullable=true)
|
||||
public String getMainTableSource() {
|
||||
return mainTableSource;
|
||||
|
@ -321,5 +321,4 @@ public class AutoFormEntity implements java.io.Serializable {
|
|||
this.mainTableSource = mainTableSource;
|
||||
}
|
||||
|
||||
//update-end--Author:zzl Date:20151028 for:增加主数据源
|
||||
}
|
||||
|
|
|
@ -76,6 +76,10 @@ public class CgFormHeadEntity implements java.io.Serializable {
|
|||
* 表格列属性
|
||||
*/
|
||||
private List<CgFormFieldEntity> columns;
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private List<CgFormIndexEntity> indexes;
|
||||
|
||||
/**树形列表 父id列名*/
|
||||
private java.lang.String treeParentIdFieldName;
|
||||
|
@ -335,6 +339,16 @@ public class CgFormHeadEntity implements java.io.Serializable {
|
|||
public void setColumns(List<CgFormFieldEntity> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
@OneToMany(cascade=CascadeType.REMOVE,mappedBy="table")
|
||||
public List<CgFormIndexEntity> getIndexes() {
|
||||
return indexes;
|
||||
}
|
||||
|
||||
public void setIndexes(List<CgFormIndexEntity> indexes) {
|
||||
this.indexes = indexes;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 表单版本号
|
||||
|
|
|
@ -1,26 +1,45 @@
|
|||
package org.jeecgframework.web.image.entity;
|
||||
package org.jeecgframework.web.cgform.entity.config;
|
||||
|
||||
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.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.hibernate.annotations.ForeignKey;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Title: Entity
|
||||
* @Description: 图片表
|
||||
* @Description: 索引表
|
||||
* @author onlineGenerator
|
||||
* @date 2016-03-09 16:15:51
|
||||
* @date 2016-06-09 20:39:52
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "t_s_images", schema = "")
|
||||
@Table(name = "cgform_index", schema = "")
|
||||
@SuppressWarnings("serial")
|
||||
public class ImagesEntity implements java.io.Serializable {
|
||||
public class CgFormIndexEntity implements java.io.Serializable {
|
||||
/**主键*/
|
||||
private java.lang.String id;
|
||||
/**创建人名称*/
|
||||
|
@ -35,24 +54,17 @@ public class ImagesEntity implements java.io.Serializable {
|
|||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
private java.util.Date updateDate;
|
||||
/**所属部门*/
|
||||
private java.lang.String sysOrgCode;
|
||||
/**所属公司*/
|
||||
private java.lang.String sysCompanyCode;
|
||||
/**原名称*/
|
||||
@Excel(name="原名称")
|
||||
private java.lang.String oldName;
|
||||
/**名称*/
|
||||
@Excel(name="名称")
|
||||
private java.lang.String name;
|
||||
/**图片地址*/
|
||||
@Excel(name="图片地址")
|
||||
private java.lang.String imageAddress;
|
||||
/**URL地址*/
|
||||
@Excel(name="URL地址")
|
||||
private java.lang.String urlAddress;
|
||||
/**后缀名*/
|
||||
private java.lang.String extensions;
|
||||
/**索引名称*/
|
||||
@Excel(name="索引名称")
|
||||
private java.lang.String indexName;
|
||||
/**索引栏位*/
|
||||
@Excel(name="索引栏位")
|
||||
private java.lang.String indexField;
|
||||
/**索引类型*/
|
||||
@Excel(name="索引类型")
|
||||
private java.lang.String indexType;
|
||||
/**关联的表*/
|
||||
private CgFormHeadEntity table;
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
|
@ -171,98 +183,69 @@ public class ImagesEntity implements java.io.Serializable {
|
|||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属部门
|
||||
*@return: java.lang.String 索引名称
|
||||
*/
|
||||
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysOrgCode(){
|
||||
return this.sysOrgCode;
|
||||
@Column(name ="INDEX_NAME",nullable=true,length=100)
|
||||
public java.lang.String getIndexName(){
|
||||
return this.indexName;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属部门
|
||||
*@param: java.lang.String 索引名称
|
||||
*/
|
||||
public void setSysOrgCode(java.lang.String sysOrgCode){
|
||||
this.sysOrgCode = sysOrgCode;
|
||||
public void setIndexName(java.lang.String indexName){
|
||||
this.indexName = indexName;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属公司
|
||||
*@return: java.lang.String 索引栏位
|
||||
*/
|
||||
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysCompanyCode(){
|
||||
return this.sysCompanyCode;
|
||||
@Column(name ="INDEX_FIELD",nullable=true,length=500)
|
||||
public java.lang.String getIndexField(){
|
||||
return this.indexField;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属公司
|
||||
*@param: java.lang.String 索引栏位
|
||||
*/
|
||||
public void setSysCompanyCode(java.lang.String sysCompanyCode){
|
||||
this.sysCompanyCode = sysCompanyCode;
|
||||
public void setIndexField(java.lang.String indexField){
|
||||
this.indexField = indexField;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 名称
|
||||
*@return: java.lang.String 索引类型
|
||||
*/
|
||||
@Column(name ="NAME",nullable=true,length=32)
|
||||
public java.lang.String getName(){
|
||||
return this.name;
|
||||
@Column(name ="INDEX_TYPE",nullable=true,length=32)
|
||||
public java.lang.String getIndexType(){
|
||||
return this.indexType;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 名称
|
||||
*@param: java.lang.String 索引类型
|
||||
*/
|
||||
public void setName(java.lang.String name){
|
||||
this.name = name;
|
||||
public void setIndexType(java.lang.String indexType){
|
||||
this.indexType = indexType;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 图片地址
|
||||
*方法: 取得TablePropertyEntity
|
||||
*@return: TablePropertyEntity 关联的表ID
|
||||
*/
|
||||
@Column(name ="IMAGE_ADDRESS",nullable=true,length=200)
|
||||
public java.lang.String getImageAddress(){
|
||||
return this.imageAddress;
|
||||
@ManyToOne
|
||||
@JoinColumn(name ="table_id",nullable=false,referencedColumnName="id")
|
||||
@JsonIgnore
|
||||
@ForeignKey(name="null")
|
||||
public CgFormHeadEntity getTable(){
|
||||
return this.table;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 图片地址
|
||||
*方法: 设置TablePropertyEntity
|
||||
*@param: TablePropertyEntity 关联的表ID
|
||||
*/
|
||||
public void setImageAddress(java.lang.String imageAddress){
|
||||
this.imageAddress = imageAddress;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 后缀名
|
||||
*/
|
||||
@Column(name ="EXTENSIONS",nullable=true,length=32)
|
||||
public java.lang.String getExtensions(){
|
||||
return this.extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 后缀名
|
||||
*/
|
||||
public void setExtensions(java.lang.String extensions){
|
||||
this.extensions = extensions;
|
||||
}
|
||||
|
||||
public void setOldName(java.lang.String oldName) {
|
||||
this.oldName = oldName;
|
||||
}
|
||||
@Column(name ="OLD_NAME",nullable=true,length=32)
|
||||
public java.lang.String getOldName() {
|
||||
return oldName;
|
||||
}
|
||||
|
||||
public void setUrlAddress(java.lang.String urlAddress) {
|
||||
this.urlAddress = urlAddress;
|
||||
}
|
||||
@Column(name ="URL_ADDRESS",nullable=true,length=200)
|
||||
public java.lang.String getUrlAddress() {
|
||||
return urlAddress;
|
||||
public void setTable(CgFormHeadEntity table){
|
||||
this.table = table;
|
||||
}
|
||||
}
|
|
@ -63,12 +63,12 @@ public class CgformTemplateEntity implements java.io.Serializable {
|
|||
private String templateComment;
|
||||
|
||||
private String templateZipName;
|
||||
//update-begin--Author:张忠亮 Date:20150707 for:加入 列表、添加、修改、详情模板名称
|
||||
|
||||
private String templateListName;
|
||||
private String templateAddName;
|
||||
private String templateUpdateName;
|
||||
private String templateDetailName;
|
||||
//update-end--Author:张忠亮 Date:20150707 for:加入 列表、添加、修改、详情模板名称
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
|
|
|
@ -55,4 +55,9 @@ public interface AutoFormDbServiceI extends CommonService{
|
|||
* @return
|
||||
*/
|
||||
public List<String> getSqlParams(String sql);
|
||||
|
||||
/**
|
||||
* 支持动态数据源查询
|
||||
*/
|
||||
public List<String> getField(String sql,String dbKey);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue