jeecg 3.6.6版本发布

pull/4/merge
zhangdaihao 2017-02-09 16:24:15 +08:00
parent 26ea08629b
commit 330840053d
450 changed files with 19007 additions and 34024 deletions

View File

@ -1,7 +1,7 @@
JEECG 微云快速开发平台 JEECG 微云快速开发平台
=============== ===============
当前最新版本: 3.6.5发布日期20160718 当前最新版本: 3.6.6发布日期20170208
前言: 前言:
----------------------------------- -----------------------------------
@ -11,8 +11,7 @@ JEECG ΢
简介 简介
----------------------------------- -----------------------------------
JEECGJ2EE Code Generation是一款基于代码生成器的智能开发平台。引领新的开发模式(Online Coding模式->代码生成器模式->手工MERGE智能开发) JEECGJ2EE Code Generation是一款基于代码生成器的智能开发平台。引领新的开发模式(Online Coding->代码生成器->手工MERGE智能开发)可以帮助解决Java项目60%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。
可以帮助解决Java项目60%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。
JEECG宗旨是: 简单功能由代Online Coding配置出功能;复杂功能由代码生成器生成进行手工Merge; 复杂流程业务采用表单自定义,业务流程使用工作流来实现、扩展出任务接口,供开发编写业务逻辑。实现了流程任务节点和任务接口的灵活配置,既保证了公司流程的保密行,又减少了开发人员的工作量。 JEECG宗旨是: 简单功能由代Online Coding配置出功能;复杂功能由代码生成器生成进行手工Merge; 复杂流程业务采用表单自定义,业务流程使用工作流来实现、扩展出任务接口,供开发编写业务逻辑。实现了流程任务节点和任务接口的灵活配置,既保证了公司流程的保密行,又减少了开发人员的工作量。
@ -68,7 +67,7 @@ JEECG
* <b>技术点十七:</b>插件开发业务功能组件以插件方式集成平台也可以单独部署发发布有力支撑了SAAS云应用系统需求</br> * <b>技术点十七:</b>插件开发业务功能组件以插件方式集成平台也可以单独部署发发布有力支撑了SAAS云应用系统需求</br>
* JEECG V3.6.4, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br> * JEECG V3.6.6, 经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
* 支持多种浏览器: IE, 火狐, Google 等</br> * 支持多种浏览器: IE, 火狐, Google 等</br>
* 支持数据库: Mysql,Oracle10g,Postgre,SqlServer等</br> * 支持数据库: Mysql,Oracle10g,Postgre,SqlServer等</br>
* 基础权限: 用户,角色,菜单权限,按钮权限,数据权限</br> * 基础权限: 用户,角色,菜单权限,按钮权限,数据权限</br>
@ -87,6 +86,7 @@ JEECG
* JEECG 云平台插件下载中心:[http://yun.jeecg.org](http://yun.jeecg.org) * JEECG 云平台插件下载中心:[http://yun.jeecg.org](http://yun.jeecg.org)
* [JEECG更多版本下载地址](http://www.jeecg.org/forum.php?mod=viewthread&tid=1229&extra=page%3D1) * [JEECG更多版本下载地址](http://www.jeecg.org/forum.php?mod=viewthread&tid=1229&extra=page%3D1)
* 不熟悉maven的同学直接下载 => [myeclipse非maven版本](http://git.oschina.net/jeecg/jeecg-no_maven) * 不熟悉maven的同学直接下载 => [myeclipse非maven版本](http://git.oschina.net/jeecg/jeecg-no_maven)
* Maven依赖下载慢解决方案 => [享受一下mvn时飞的感觉](http://www.jeecg.org/forum.php?mod=viewthread&tid=3949)
* maven依赖下载有问题的可以直接下载官方提供的 => [JEECG本地Maven仓库](http://git.oschina.net/jeecg/jeecg-local-maven) * maven依赖下载有问题的可以直接下载官方提供的 => [JEECG本地Maven仓库](http://git.oschina.net/jeecg/jeecg-local-maven)
@ -102,7 +102,7 @@ JEECG
技术交流 技术交流
----------------------------------- -----------------------------------
* 作者:[张代浩](http://blog.csdn.net/zhangdaiscott)</br> * 作者:[张代浩](http://blog.csdn.net/zhangdaiscott)</br>
* QQ交流群 176031980、106838471、106259349</br> * QQ交流群 ④176031980、②106838471(满)、①106259349(满)、③289782002(满)</br>
社区荣誉 社区荣誉

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

101
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.jeecgframework</groupId> <groupId>org.jeecgframework</groupId>
<artifactId>jeecg</artifactId> <artifactId>jeecg</artifactId>
<version>3.6.5</version> <version>3.6.6</version>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -11,7 +11,6 @@
<minidao.version>1.6-SNAPSHOT</minidao.version> <minidao.version>1.6-SNAPSHOT</minidao.version>
<guava.version>16.0.1</guava.version> <guava.version>16.0.1</guava.version>
<!-- 主要依赖库的版本定义 -->
<spring.version>4.0.9.RELEASE</spring.version> <spring.version>4.0.9.RELEASE</spring.version>
<hibernate.version>4.1.0.Final</hibernate.version> <hibernate.version>4.1.0.Final</hibernate.version>
<hibernate-common-annotations.version>4.0.2.Final</hibernate-common-annotations.version> <hibernate-common-annotations.version>4.0.2.Final</hibernate-common-annotations.version>
@ -45,7 +44,7 @@
<commons-beanutils.version>1.7.0</commons-beanutils.version> <commons-beanutils.version>1.7.0</commons-beanutils.version>
<commons-collections.version>3.2.1</commons-collections.version> <commons-collections.version>3.2.1</commons-collections.version>
<commons-chain.version>1.2</commons-chain.version> <commons-chain.version>1.2</commons-chain.version>
<commons-codec.version>1.3</commons-codec.version> <commons-codec.version>1.6</commons-codec.version>
<commons-digester.version>2.0</commons-digester.version> <commons-digester.version>2.0</commons-digester.version>
<commons-io.version>1.3.2</commons-io.version> <commons-io.version>1.3.2</commons-io.version>
<commons-fileupload.version>1.2.1</commons-fileupload.version> <commons-fileupload.version>1.2.1</commons-fileupload.version>
@ -71,7 +70,7 @@
<druid.version>0.2.9</druid.version> <druid.version>0.2.9</druid.version>
<mysql.version>5.1.27</mysql.version> <mysql.version>5.1.27</mysql.version>
<!-- sqlserver2005 --> <!-- sqlserver2005 -->
<sqlserver.version>1.0.0</sqlserver.version> <sqlserver.version>4.0</sqlserver.version>
<!-- oracle --> <!-- oracle -->
<ojdbc14.version>10.2.0.5.0</ojdbc14.version> <ojdbc14.version>10.2.0.5.0</ojdbc14.version>
<!-- jtds for mssql/db2 --> <!-- jtds for mssql/db2 -->
@ -120,49 +119,6 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </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> </repositories>
<dependencies> <dependencies>
@ -401,44 +357,49 @@
<version>${druid.version}</version> <version>${druid.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- mysql -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version> <version>${mysql.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- sqlserver
<dependency> <dependency>
<groupId>org.jeecgframework</groupId> <groupId>com.microsoft.sqlserver</groupId>
<artifactId>jdbc2005</artifactId> <artifactId>sqljdbc4</artifactId>
<version>${sqlserver.version}</version> <version>${sqlserver.version}</version>
<scope>runtime</scope>
</dependency> </dependency>
-->
<!-- oracle
<dependency> <dependency>
<groupId>com.oracle</groupId> <groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId> <artifactId>ojdbc14</artifactId>
<version>${ojdbc14.version}</version> <version>${ojdbc14.version}</version>
</dependency> </dependency>-->
<!-- jtds for mssql/db2 --> <!-- jtds for mssql/db2
<dependency> <dependency>
<groupId>net.sourceforge.jtds</groupId> <groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId> <artifactId>jtds</artifactId>
<version>${jtds.version}</version> <version>${jtds.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- h2 --> -->
<!-- h2
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>${h2.version}</version> <version>${h2.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- postgresql --> -->
<!-- postgresql
<dependency> <dependency>
<groupId>org.jeecgframework</groupId> <groupId>org.jeecgframework</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>${postgresql.version}</version> <version>${postgresql.version}</version>
</dependency> </dependency>
-->
<!-- 数据库相关依赖包 _end --> <!-- 数据库相关依赖包 _end -->
<!-- WEB begin --> <!-- WEB begin -->
@ -941,12 +902,18 @@
<dependency> <dependency>
<groupId>org.p3framework</groupId> <groupId>org.p3framework</groupId>
<artifactId>jeecg-p3-core</artifactId> <artifactId>jeecg-p3-core</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.p3framework</groupId> <groupId>org.p3framework</groupId>
<artifactId>jeecg-p3-ui</artifactId> <artifactId>jeecg-p3-ui</artifactId>
<version>1.1-SNAPSHOT</version> <version>1.1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.p3framework</groupId>
<artifactId>jeecg-p3-bizcore</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<!-- 插件demo --> <!-- 插件demo -->
@ -955,6 +922,7 @@
<artifactId>jeecg-p3-biz-demo</artifactId> <artifactId>jeecg-p3-biz-demo</artifactId>
<version>1.0.2</version> <version>1.0.2</version>
</dependency> </dependency>
<!-- 插件: 我的邮箱 --> <!-- 插件: 我的邮箱 -->
<dependency> <dependency>
<groupId>org.p3framework</groupId> <groupId>org.p3framework</groupId>
@ -963,23 +931,14 @@
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- 插件: 微信企业号
<!-- 在线聊天工具-->
<dependency> <dependency>
<groupId>org.p3framework</groupId> <groupId>org.p3framework</groupId>
<artifactId>jeecg-p3-biz-qywx</artifactId> <artifactId>jeecg-p3-biz-chat</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency> </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 -->
</dependencies> </dependencies>
<organization> <organization>

View File

@ -65,7 +65,6 @@ public interface ICommonDao extends IGenericBaseCommonDao{
* @return List<ComboTree> * @return List<ComboTree>
*/ */
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive); public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive);
public List<TreeGrid> treegrid(List all,TreeGridModel treeGridModel); public List<TreeGrid> treegrid(List all,TreeGridModel treeGridModel);
} }

View File

@ -322,11 +322,10 @@ public interface IGenericBaseCommonDao {
int maxResult); int maxResult);
public <T> List<T> findByDetached(DetachedCriteria dc); public <T> List<T> findByDetached(DetachedCriteria dc);
/** /**
* *
* @param execute * @param execute
*/ */
public <T> List<T> executeProcedure(String procedureSql,Object... params); public <T> List<T> executeProcedure(String procedureSql,Object... params);
} }

View File

@ -65,7 +65,6 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
return users.get(0); return users.get(0);
} }
} }
return null; return null;
} }
@ -182,9 +181,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
} }
if (uploadFile.getByteField() != null) { 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); File savefile = new File(savePath);
if (uploadFile.getRealPath() != null) { if (uploadFile.getRealPath() != null) {
@ -193,7 +190,6 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
} }
saveOrUpdate(object); saveOrUpdate(object);
// 文件拷贝到指定硬盘目录 // 文件拷贝到指定硬盘目录
if("txt".equals(extend)){ if("txt".equals(extend)){
//利用utf-8字符集的固定首行隐藏编码原理 //利用utf-8字符集的固定首行隐藏编码原理
//Unicode:FF FE UTF-8:EF BB //Unicode:FF FE UTF-8:EF BB
@ -212,13 +208,11 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
out.close(); out.close();
} }
} else { } else {
//GBK //GBK
String contents = new String(mf.getBytes(),"GBK"); String contents = new String(mf.getBytes(),"GBK");
OutputStream out = new FileOutputStream(savePath); OutputStream out = new FileOutputStream(savePath);
out.write(contents.getBytes()); out.write(contents.getBytes());
out.close(); out.close();
} }
} catch(Exception e){ } catch(Exception e){
String contents = new String(mf.getBytes(),"UTF-8"); String contents = new String(mf.getBytes(),"UTF-8");
@ -231,7 +225,6 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
} else { } else {
FileCopyUtils.copy(mf.getBytes(), savefile); FileCopyUtils.copy(mf.getBytes(), savefile);
} }
// if (uploadFile.getSwfpath() != null) { // if (uploadFile.getSwfpath() != null) {
// // 转SWF // // 转SWF
@ -496,9 +489,7 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
for (Object obj : all) { for (Object obj : all) {
trees.add(comboTree(obj, comboTreeModel, in, recursive)); trees.add(comboTree(obj, comboTreeModel, in, recursive));
} }
all.clear(); all.clear();
return trees; return trees;
} }
@ -528,11 +519,9 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
for (Object inobj : in) { for (Object inobj : in) {
ReflectHelper reflectHelper2 = new ReflectHelper(inobj); ReflectHelper reflectHelper2 = new ReflectHelper(inobj);
String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField())); String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField()));
if (inId.equals(id)) { if (inId.equals(id)) {
tree.setChecked(true); tree.setChecked(true);
} }
} }
} }
} }
@ -552,11 +541,10 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
tree.setChildren(children); tree.setChildren(children);
} }
} }
if(curChildList!=null){ if(curChildList!=null){
curChildList.clear(); curChildList.clear();
} }
return tree; return tree;
} }
/** /**
@ -651,12 +639,15 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
tg.getFieldMap().put(entry.getKey(), fieldValue); tg.getFieldMap().put(entry.getKey(), fieldValue);
} }
} }
if (treeGridModel.getFunctionType() != null) { if (treeGridModel.getFunctionType() != null) {
String functionType = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getFunctionType())); String functionType = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getFunctionType()));
tg.setFunctionType(functionType); tg.setFunctionType(functionType);
} }
if(treeGridModel.getIconStyle() != null){
String iconStyle = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getIconStyle()));
tg.setIconStyle(iconStyle);
}
treegrid.add(tg); treegrid.add(tg);
} }
return treegrid; return treegrid;

View File

@ -882,10 +882,8 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
* *
*/ */
public Long getCountForJdbcParam(String sql, Object[] objs) { public Long getCountForJdbcParam(String sql, Object[] objs) {
return this.jdbcTemplate.queryForObject(sql, objs,Long.class); return this.jdbcTemplate.queryForObject(sql, objs,Long.class);
} }
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) { public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
@ -918,15 +916,12 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
keyValue = keyHolder.getKey().longValue(); keyValue = keyHolder.getKey().longValue();
} }
} }
return keyValue; return keyValue;
} }
public Integer countByJdbc(String sql, Object... param) { public Integer countByJdbc(String sql, Object... param) {
return this.jdbcTemplate.queryForObject(sql, param,Integer.class); return this.jdbcTemplate.queryForObject(sql, param,Integer.class);
} }
public Map<String, Object> findOneForJdbc(String sql, Object... objs) { public Map<String, Object> findOneForJdbc(String sql, Object... objs) {
@ -994,5 +989,4 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
return sqlQuery.list(); return sqlQuery.list();
} }
} }

View File

@ -193,18 +193,14 @@ public class JdbcDao extends SimpleJdbcTemplate{
* 使For JDBC * 使For JDBC
*/ */
public Long getCountForJdbc(String sql) { public Long getCountForJdbc(String sql) {
return jdbcTemplate.queryForObject(sql,Long.class); return jdbcTemplate.queryForObject(sql,Long.class);
} }
/** /**
* 使For JDBC- * 使For JDBC-
* *
*/ */
public Long getCountForJdbcParam(String sql,Object... objs) { public Long getCountForJdbcParam(String sql,Object... objs) {
return jdbcTemplate.queryForObject(sql, objs,Long.class); return jdbcTemplate.queryForObject(sql, objs,Long.class);
} }
public Integer executeSql2(String sql,List<Object> param) { public Integer executeSql2(String sql,List<Object> param) {
@ -216,9 +212,7 @@ public class JdbcDao extends SimpleJdbcTemplate{
} }
public Integer countByJdbc(String sql, Object... param) { public Integer countByJdbc(String sql, Object... param) {
return this.jdbcTemplate.queryForObject(sql, param,Integer.class); return this.jdbcTemplate.queryForObject(sql, param,Integer.class);
} }
/** /**

View File

@ -22,7 +22,7 @@ import org.springframework.util.Assert;
public class SimpleJdbcTemplate { public class SimpleJdbcTemplate {
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
protected JdbcTemplate jdbcTemplate; protected JdbcTemplate jdbcTemplate;
protected NamedParameterJdbcTemplate namedJdbcTemplate; protected NamedParameterJdbcTemplate namedJdbcTemplate;
@ -33,7 +33,6 @@ public class SimpleJdbcTemplate {
simpleJdbcInsert=new SimpleJdbcInsert(dataSource); simpleJdbcInsert=new SimpleJdbcInsert(dataSource);
} }
/** /**
* sql * sql
* @param sql(select * from tb where id=:id) * @param sql(select * from tb where id=:id)
@ -69,10 +68,8 @@ public class SimpleJdbcTemplate {
if(parameters!=null){ if(parameters!=null){
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters); return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters);
}else{ }else{
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz),Long.class); return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz),Long.class);
} }
}catch (Exception e) { }catch (Exception e) {
return null; return null;
@ -88,13 +85,11 @@ public class SimpleJdbcTemplate {
public long findForLong(final String sql,Map parameters){ public long findForLong(final String sql,Map parameters){
try{ try{
Assert.hasText(sql,"sql语句不正确!"); Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){ if(parameters!=null){
return namedJdbcTemplate.queryForObject(sql, parameters,Long.class); return namedJdbcTemplate.queryForObject(sql, parameters,Long.class);
}else{ }else{
return jdbcTemplate.queryForObject(sql,Long.class); return jdbcTemplate.queryForObject(sql,Long.class);
} }
}catch (Exception e) { }catch (Exception e) {
return 0; return 0;
} }
@ -189,12 +184,11 @@ public class SimpleJdbcTemplate {
int[] updateCounts = jdbcTemplate.batchUpdate(sql,batch); int[] updateCounts = jdbcTemplate.batchUpdate(sql,batch);
return updateCounts; return updateCounts;
} }
protected BeanPropertyRowMapper resultBeanMapper(Class clazz) { protected BeanPropertyRowMapper resultBeanMapper(Class clazz) {
return BeanPropertyRowMapper.newInstance(clazz); return BeanPropertyRowMapper.newInstance(clazz);
} }
protected BeanPropertySqlParameterSource paramBeanMapper(Object object) { protected BeanPropertySqlParameterSource paramBeanMapper(Object object) {
return new BeanPropertySqlParameterSource(object); return new BeanPropertySqlParameterSource(object);
} }

View File

@ -0,0 +1,27 @@
/**
* @Title: MySQLServer2008Dialect.java
* @Package org.jeecgframework.core.common.hibernate.dialect
* @Description: TODO
* @author yokoboy
* @date 2016-6-7
*/
package org.jeecgframework.core.common.hibernate.dialect;
import java.sql.Types;
import org.hibernate.dialect.SQLServer2008Dialect;
import org.hibernate.type.StringType;
/**
* ClassName: MySQLServer2008Dialect
* @Description: TODO
* @author yokoboy
* @date 2016-6-7
*/
public class MySQLServer2008Dialect extends SQLServer2008Dialect {
public MySQLServer2008Dialect() {
super();
registerHibernateType(Types.NVARCHAR, StringType.INSTANCE.getName());
}
}

View File

@ -1,9 +1,7 @@
package org.jeecgframework.web.demo.entity.test; package org.jeecgframework.core.common.model.common;
import java.util.List; import java.util.List;
import org.jeecgframework.core.util.PropertiesUtil; import org.jeecgframework.core.util.PropertiesUtil;
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
public class QueryCondition { public class QueryCondition {
String field; String field;

View File

@ -18,8 +18,8 @@ public class TreeGrid implements java.io.Serializable {
private String state = "open";// 是否展开(open,closed) private String state = "open";// 是否展开(open,closed)
private String order;//排序 private String order;//排序
private Map<String, Object> fieldMap; // 存储实体字段信息容器: key-字段名称value-字段值 private Map<String, Object> fieldMap; // 存储实体字段信息容器: key-字段名称value-字段值
private String functionType;// 其他参数 private String functionType;// 其他参数
private String iconStyle;//菜单图表样式
public String getFunctionType() { public String getFunctionType() {
return functionType; return functionType;
@ -27,7 +27,6 @@ public class TreeGrid implements java.io.Serializable {
public void setFunctionType(String functionType) { public void setFunctionType(String functionType) {
this.functionType = functionType; this.functionType = functionType;
} }
public String getOrder() { public String getOrder() {
return order; return order;
} }
@ -118,6 +117,7 @@ public class TreeGrid implements java.io.Serializable {
", 'operations':'" + operations + '\'' + ", 'operations':'" + operations + '\'' +
", 'state':'" + state + '\'' + ", 'state':'" + state + '\'' +
", 'order':'" + order + '\'' + ", 'order':'" + order + '\'' +
", 'iconStyle':'" + iconStyle + '\'' +
assembleFieldsJson() + assembleFieldsJson() +
'}'; '}';
} }
@ -133,5 +133,11 @@ public class TreeGrid implements java.io.Serializable {
} }
return fieldsJson; return fieldsJson;
} }
public String getIconStyle() {
return iconStyle;
}
public void setIconStyle(String iconStyle) {
this.iconStyle = iconStyle;
}
} }

View File

@ -1,9 +1,8 @@
package org.jeecgframework.web.cgreport.service.excel; package org.jeecgframework.core.common.service;
import java.util.Collection; import java.util.Collection;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.common.service.CommonService;
/** /**
* *
@ -13,7 +12,7 @@ import org.jeecgframework.core.common.service.CommonService;
* @date Aug 1, 2013 8:53:54 AM * @date Aug 1, 2013 8:53:54 AM
* @version V1.0 * @version V1.0
*/ */
public interface CgReportExcelServiceI extends CommonService{ public interface CommonExcelServiceI extends CommonService{
/** /**
* *
* @param title * @param title

View File

@ -258,7 +258,6 @@ public interface CommonService {
*/ */
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive); public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in, boolean recursive);
/** /**
* *
* *
@ -351,7 +350,7 @@ public interface CommonService {
int maxResult); int maxResult);
public <T> List<T> findByDetached(DetachedCriteria dc); public <T> List<T> findByDetached(DetachedCriteria dc);
/** /**
* *
* @param executeSql * @param executeSql
@ -359,5 +358,4 @@ public interface CommonService {
* @return * @return
*/ */
public <T> List<T> executeProcedure(String procedureSql,Object... params); public <T> List<T> executeProcedure(String procedureSql,Object... params);
} }

View File

@ -1,11 +1,10 @@
package org.jeecgframework.web.cgreport.service.impl.excel; package org.jeecgframework.core.common.service.impl;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jeecgframework.web.cgreport.service.excel.CgReportExcelServiceI;
import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRichTextString;
@ -16,13 +15,13 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import org.jeecgframework.core.common.service.CommonExcelServiceI;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service(value="cgReportExcelService") @Service(value="cgReportExcelService")
@Transactional @Transactional
public class CgReportExcelServiceImpl extends CommonServiceImpl implements public class CommonExcelServiceImpl extends CommonServiceImpl implements
CgReportExcelServiceI { CommonExcelServiceI {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public HSSFWorkbook exportExcel(String title, Collection<?> titleSet, public HSSFWorkbook exportExcel(String title, Collection<?> titleSet,

View File

@ -418,7 +418,6 @@ public class CommonServiceImpl implements CommonService {
return commonDao.getCountForJdbcParam(sql,objs); return commonDao.getCountForJdbcParam(sql,objs);
} }
public <T> void batchSave(List<T> entitys) { public <T> void batchSave(List<T> entitys) {
this.commonDao.batchSave(entitys); this.commonDao.batchSave(entitys);
@ -450,5 +449,4 @@ public class CommonServiceImpl implements CommonService {
public <T> List<T> executeProcedure(String procedureSql,Object... params) { public <T> List<T> executeProcedure(String procedureSql,Object... params) {
return this.commonDao.executeProcedure(procedureSql, params); return this.commonDao.executeProcedure(procedureSql, params);
} }
} }

View File

@ -69,7 +69,7 @@ public final class Globals {
*/ */
public static final String Function_Order_ONE="ofun";//一级权限 public static final String Function_Order_ONE="ofun";//一级权限
public static final String Function_Order_TWO="tfun";//二级权限 public static final String Function_Order_TWO="tfun";//二级权限
/** /**
* *
*/ */
@ -100,7 +100,6 @@ public final class Globals {
* - sql * - sql
*/ */
public static final String MENU_DATA_AUTHOR_RULE_SQL ="MENU_DATA_AUTHOR_RULE_SQL"; public static final String MENU_DATA_AUTHOR_RULE_SQL ="MENU_DATA_AUTHOR_RULE_SQL";
/** /**
* *
*/ */

View File

@ -17,6 +17,7 @@ import org.apache.commons.lang.StringUtils;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.jeecgframework.core.annotation.query.QueryTimeFormat; import org.jeecgframework.core.annotation.query.QueryTimeFormat;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.common.QueryCondition;
import org.jeecgframework.core.extend.hqlsearch.parse.ObjectParseUtil; import org.jeecgframework.core.extend.hqlsearch.parse.ObjectParseUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.PageValueConvertRuleEnum; import org.jeecgframework.core.extend.hqlsearch.parse.PageValueConvertRuleEnum;
import org.jeecgframework.core.extend.hqlsearch.parse.vo.HqlRuleEnum; import org.jeecgframework.core.extend.hqlsearch.parse.vo.HqlRuleEnum;
@ -25,7 +26,6 @@ import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.LogUtil; import org.jeecgframework.core.util.LogUtil;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.demo.entity.test.QueryCondition;
import org.jeecgframework.web.system.pojo.base.TSDataRule; import org.jeecgframework.web.system.pojo.base.TSDataRule;
import org.springframework.util.NumberUtils; import org.springframework.util.NumberUtils;
@ -142,19 +142,17 @@ public class HqlGenerateUtil {
// for查询拼装的替换 // for查询拼装的替换
if (value != null && !value.equals("")) { if (value != null && !value.equals("")) {
HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value); HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value);
// if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){ // if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){
// value="*%"+String.valueOf(value.toString())+"%*"; // value="*%"+String.valueOf(value.toString())+"%*";
// } else { // } else {
// rule = HqlRuleEnum.EQ; // rule = HqlRuleEnum.EQ;
// } // }
value = PageValueConvertRuleEnum.replaceValue(rule, value = PageValueConvertRuleEnum.replaceValue(rule,
value); value);
ObjectParseUtil.addCriteria(cq, aliasName, rule, value); ObjectParseUtil.addCriteria(cq, aliasName, rule, value);
} else if (parameterMap != null) { } else if (parameterMap != null) {
Object beginValue_=null , endValue_ =null; Object beginValue_=null , endValue_ =null;
if ("class java.lang.Integer".equals(type)) { if ("class java.lang.Integer".equals(type)) {
if(!"".equals(beginValue)&&null!=beginValue) if(!"".equals(beginValue)&&null!=beginValue)
@ -233,7 +231,7 @@ public class HqlGenerateUtil {
// for用户反馈 // for用户反馈
cq.createAlias(aliasName, cq.createAlias(aliasName,
aliasName.replaceAll("\\.", "_")); aliasName.replaceAll("\\.", "_"));
// ------------end--Author:JueYue Date:20140521 for用户反馈
installHqlJoinAlias(cq, param, ruleMap, parameterMap, installHqlJoinAlias(cq, param, ruleMap, parameterMap,
aliasName); aliasName);
} }
@ -289,7 +287,7 @@ public class HqlGenerateUtil {
} }
private static String converRuleValue(String ruleValue) { private static String converRuleValue(String ruleValue) {
//---author:jg_xugj----start-----date:20151226--------for#814 【数据权限】扩展支持写表达式通过session取值
//这个方法建议去掉直接调用ResourceUtil.converRuleValue(ruleValue) //这个方法建议去掉直接调用ResourceUtil.converRuleValue(ruleValue)
String value = ResourceUtil.converRuleValue(ruleValue); String value = ResourceUtil.converRuleValue(ruleValue);
return value!= null ? value : ruleValue; return value!= null ? value : ruleValue;
@ -491,7 +489,7 @@ public class HqlGenerateUtil {
// for用户反馈 // for用户反馈
cq.createAlias(aliasName, aliasName.replaceAll("\\.", "_")); cq.createAlias(aliasName, aliasName.replaceAll("\\.", "_"));
// ------------end--Author:JueYue Date:20140521 for用户反馈
getDataAuthorConditionHql(cq, param); getDataAuthorConditionHql(cq, param);
} }
} }

View File

@ -49,7 +49,7 @@ public class SysContextSqlConvert {
ValueTemp = ValueTemp; ValueTemp = ValueTemp;
} }
String tempValue = null; String tempValue = null;
//---author:jg_xugj----start-----date:20151226--------for#814 【数据权限】扩展支持写表达式通过session取值
tempValue = ResourceUtil.converRuleValue(ValueTemp); tempValue = ResourceUtil.converRuleValue(ValueTemp);
if(tempValue!=null){ if(tempValue!=null){

View File

@ -50,11 +50,9 @@ public class PageValueConvertRuleEnum {
if(rule == null && val.startsWith(HqlParseEnum.SUFFIX_NOT_EQUAL.getValue())){ if(rule == null && val.startsWith(HqlParseEnum.SUFFIX_NOT_EQUAL.getValue())){
rule = HqlRuleEnum.NE; rule = HqlRuleEnum.NE;
} }
// if(rule==null&&ResourceUtil.fuzzySearch){ // if(rule==null&&ResourceUtil.fuzzySearch){
// rule = HqlRuleEnum.LIKE; // rule = HqlRuleEnum.LIKE;
// } // }
return rule != null ? rule : HqlRuleEnum.EQ; return rule != null ? rule : HqlRuleEnum.EQ;
} }

View File

@ -23,7 +23,7 @@ public class OpenOfficePDFConverter implements PDFConverter {
private static int[] port = { 8100 }; private static int[] port = { 8100 };
public void convert2PDF(String inputFile, String pdfFile, String extend) { public void convert2PDF(String inputFile, String pdfFile, String extend) {
// if (extend.equals("txt")) { // if (extend.equals("txt")) {
// //
// String odtFile = FileUtils.getFilePrefix(inputFile) + ".odt"; // String odtFile = FileUtils.getFilePrefix(inputFile) + ".odt";
@ -41,7 +41,6 @@ public class OpenOfficePDFConverter implements PDFConverter {
// } // }
// //
// } // }
startService(); startService();
//pdfFile = pdfFile.replaceAll(" ", "").replaceAll(" ", ""); //pdfFile = pdfFile.replaceAll(" ", "").replaceAll(" ", "");

View File

@ -11,6 +11,15 @@ public class SWFToolsSWFConverter implements SWFConverter {
/** SWFTools pdf2swf.exe路径 */ /** SWFTools pdf2swf.exe路径 */
private static String PDF2SWF_PATH = ConStant.SWFTOOLS_PDF2SWF_PATH; private static String PDF2SWF_PATH = ConStant.SWFTOOLS_PDF2SWF_PATH;
/**
* windows
* @author chenj
* @return
*/
private boolean isWindowsSystem() {
String p = System.getProperty("os.name");
return p.toLowerCase().indexOf("windows") >= 0 ? true : false;
}
public void convert2SWF(String inputFile, String swfFile, String extend) { public void convert2SWF(String inputFile, String swfFile, String extend) {
File pdfFile = new File(inputFile); File pdfFile = new File(inputFile);
File outFile = new File(swfFile); File outFile = new File(swfFile);
@ -24,14 +33,34 @@ public class SWFToolsSWFConverter implements SWFConverter {
org.jeecgframework.core.util.LogUtil.info("SWF文件已存在"); org.jeecgframework.core.util.LogUtil.info("SWF文件已存在");
return; return;
} }
String command = ConStant.getSWFToolsPath(extend) + " \"" + inputFile
+ "\" -o " +" \""+ swfFile +" \""+ " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
// + "\" -o " + swfFile + " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
try { try {
// 开始转换文档 // 开始转换文档
Process process = Runtime.getRuntime().exec(command);
//Process process = Runtime.getRuntime().exec(command);
Process process = null;
if (isWindowsSystem()) {
//如果是windows系统
//命令行命令
//String cmd = exePath + " \"" + fileDir + "\" -o \"" + filePath + "/" + fileName + ".swf\" -T 9 -f";
//ConStant.getSWFToolsPath(extend)
String command = ConStant.getSWFToolsPath(extend) + " \"" + inputFile
+ "\" -o " +" \""+ swfFile +" \""+ " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
// + "\" -o " + swfFile + " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
//Runtime执行后返回创建的进程对象
process = Runtime.getRuntime().exec(command);
} else {
//如果是linux系统,路径不能有空格,而且一定不能用双引号,否则无法创建进程
String[] command = new String[3];
command[0] = ConStant.getSWFToolsPath(extend);
command[1] = inputFile;
command[2] = swfFile;
//Runtime执行后返回创建的进程对象
process = Runtime.getRuntime().exec(command);
}
StreamGobbler errorGobbler = new StreamGobbler( StreamGobbler errorGobbler = new StreamGobbler(
process.getErrorStream(), "Error"); process.getErrorStream(), "Error");
StreamGobbler outputGobbler = new StreamGobbler( StreamGobbler outputGobbler = new StreamGobbler(
@ -48,8 +77,19 @@ public class SWFToolsSWFConverter implements SWFConverter {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void convert2SWF(String inputFile, String extend) { public void convert2SWF(String inputFile, String extend) {
String swfFile = PinyinUtil.getPinYinHeadChar(FileUtils.getFilePrefix2(inputFile)) + ".swf"; String swfFile = PinyinUtil.getPinYinHeadChar(FileUtils.getFilePrefix2(inputFile)) + ".swf";
convert2SWF(inputFile, swfFile, extend); convert2SWF(inputFile, swfFile, extend);
} }
/**
* main
* @param args
*/
public static void main(String[] args) {
//转换器安装路径
String exePath = "D:/SWFTools/pdf2swf.exe";
new SWFToolsSWFConverter().convert2SWF("C:/Users/chenj/Desktop/jeecg/陈劲任务.pdf", exePath);
}
} }

View File

@ -96,7 +96,6 @@ public class AuthInterceptor implements HandlerInterceptor {
} }
//String functionId=oConvertUtils.getString(request.getParameter("clickFunctionId")); //String functionId=oConvertUtils.getString(request.getParameter("clickFunctionId"));
String functionId=""; String functionId="";
//onlinecoding的访问地址有规律可循数据权限链接篡改 //onlinecoding的访问地址有规律可循数据权限链接篡改
if(requestPath.equals("cgAutoListController.do?datagrid")) { if(requestPath.equals("cgAutoListController.do?datagrid")) {
requestPath += "&configId=" + request.getParameter("configId"); requestPath += "&configId=" + request.getParameter("configId");
@ -107,7 +106,7 @@ public class AuthInterceptor implements HandlerInterceptor {
if(requestPath.equals("cgFormBuildController.do?ftlForm")) { if(requestPath.equals("cgFormBuildController.do?ftlForm")) {
requestPath += "&tableName=" + request.getParameter("tableName"); requestPath += "&tableName=" + request.getParameter("tableName");
} }
if(requestPath.equals("cgFormBuildController.do?goAddFtlForm")) { if(requestPath.equals("cgFormBuildController.do?goAddFtlForm")) {
requestPath += "&tableName=" + request.getParameter("tableName"); requestPath += "&tableName=" + request.getParameter("tableName");
} }
@ -117,10 +116,8 @@ public class AuthInterceptor implements HandlerInterceptor {
if(requestPath.equals("cgFormBuildController.do?goDatilFtlForm")) { if(requestPath.equals("cgFormBuildController.do?goDatilFtlForm")) {
requestPath += "&tableName=" + request.getParameter("tableName"); requestPath += "&tableName=" + request.getParameter("tableName");
} }
//这个地方用全匹配?应该是模糊查询吧 //这个地方用全匹配?应该是模糊查询吧
//TODO //TODO
String uri= request.getRequestURI().substring(request.getContextPath().length() + 1); String uri= request.getRequestURI().substring(request.getContextPath().length() + 1);
String realRequestPath = null; String realRequestPath = null;
if(uri.endsWith(".do")||uri.endsWith(".action")){ if(uri.endsWith(".do")||uri.endsWith(".action")){
@ -129,7 +126,6 @@ public class AuthInterceptor implements HandlerInterceptor {
realRequestPath=uri; realRequestPath=uri;
} }
List<TSFunction> functions = systemService.findByProperty(TSFunction.class, "functionUrl", realRequestPath); List<TSFunction> functions = systemService.findByProperty(TSFunction.class, "functionUrl", realRequestPath);
if (functions.size()>0){ if (functions.size()>0){
functionId = functions.get(0).getId(); functionId = functions.get(0).getId();
} }
@ -141,7 +137,6 @@ public class AuthInterceptor implements HandlerInterceptor {
request.setAttribute(Globals.OPERATIONCODES, operationCodes); request.setAttribute(Globals.OPERATIONCODES, operationCodes);
} }
if(!oConvertUtils.isEmpty(functionId)){ if(!oConvertUtils.isEmpty(functionId)){
//List<String> allOperation=this.systemService.findListbySql("SELECT operationcode FROM t_s_operation WHERE functionid='"+functionId+"'"); //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); List<TSOperation> allOperation=this.systemService.findByProperty(TSOperation.class, "TSFunction.id", functionId);
@ -151,7 +146,7 @@ public class AuthInterceptor implements HandlerInterceptor {
//s=s.replaceAll(" ", ""); //s=s.replaceAll(" ", "");
newall.add(s); newall.add(s);
} }
//---author:jg_xugj----start-----date:20151210--------for#781 【oracle兼容】兼容问题fun.operation!='' 在oracle 数据下不正确
String hasOperSql="SELECT operation FROM t_s_role_function fun, t_s_role_user role WHERE " + String hasOperSql="SELECT operation FROM t_s_role_function fun, t_s_role_user role WHERE " +
"fun.functionid='"+functionId+"' AND fun.operation is not null AND fun.roleid=role.roleid AND role.userid='"+client.getUser().getId()+"' "; "fun.functionid='"+functionId+"' AND fun.operation is not null AND fun.roleid=role.roleid AND role.userid='"+client.getUser().getId()+"' ";
List<String> hasOperList = this.systemService.findListbySql(hasOperSql); List<String> hasOperList = this.systemService.findListbySql(hasOperSql);
@ -236,13 +231,11 @@ public class AuthInterceptor implements HandlerInterceptor {
if(list.size()==0){ if(list.size()==0){
String orgId = currLoginUser.getCurrentDepart().getId(); String orgId = currLoginUser.getCurrentDepart().getId();
String functionOfOrgSql = "SELECT DISTINCT f.id from t_s_function f, t_s_role_function rf, t_s_role_org ro " + 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 " + "WHERE f.ID=rf.functionid AND rf.roleid=ro.role_id " +
"AND ro.org_id='" +orgId+ "' AND f.functionurl like '"+requestPath+"%'"; "AND ro.org_id='" +orgId+ "' AND f.functionurl like '"+requestPath+"%'";
List functionOfOrgList = this.systemService.findListbySql(functionOfOrgSql); List functionOfOrgList = this.systemService.findListbySql(functionOfOrgSql);
return functionOfOrgList.size() > 0; return functionOfOrgList.size() > 0;
}else{ }else{
return true; return true;
} }
@ -260,7 +253,13 @@ public class AuthInterceptor implements HandlerInterceptor {
} }
private void forward(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { private void forward(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("webpage/login/timeout.jsp").forward(request, response);
//超时,未登陆页面跳转
//response.sendRedirect(request.getServletContext().getContextPath()+"/loginController.do?login");
response.sendRedirect(request.getServletContext().getContextPath()+"/webpage/login/timeout.jsp");
//request.getRequestDispatcher("loginController.do?login").forward(request, response);
} }
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgreport.common; package org.jeecgframework.core.online.def;
/** /**
* *
* @Title:CgReportConstant * @Title:CgReportConstant
@ -65,4 +65,6 @@ public class CgReportConstant {
/**显示模式Double*/ /**显示模式Double*/
public static final String TYPE_DOUBLE = "Double"; public static final String TYPE_DOUBLE = "Double";
/** iframe */
public static final String CONFIG_IFRAME = "config_iframe";
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgreport.exception; package org.jeecgframework.core.online.exception;
/** /**
* *
* @Title:CgReportNotFoundException * @Title:CgReportNotFoundException

View File

@ -0,0 +1,249 @@
package org.jeecgframework.core.online.util;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.jeecgframework.core.online.def.CgReportConstant;
import org.jeecgframework.core.util.DBTypeUtil;
import org.jeecgframework.core.util.StringUtil;
/**
*
* @Title:QueryParamUtil
* @description:
* @author
* @date Jul 5, 2013 10:22:31 PM
* @version V1.0
*/
public class CgReportQueryParamUtil
{
/**
*
* @param request ()
* @param item
* @param params
*/
@SuppressWarnings("unchecked")
public static void loadQueryParams(HttpServletRequest request, Map item, Map params) {
String filedName = (String) item.get(CgReportConstant.ITEM_FIELDNAME);
String queryMode = (String) item.get(CgReportConstant.ITEM_QUERYMODE);
String filedType = (String) item.get(CgReportConstant.ITEM_FIELDTYPE);
if("single".equals(queryMode)){
//单条件组装方式
String value =request.getParameter(filedName);
try {
if(StringUtil.isEmpty(value)){
return;
}
String uri = request.getQueryString();
if(uri.contains(filedName+"=")){
String contiansChinesevalue = new String(value.getBytes("ISO-8859-1"), "UTF-8");
value = contiansChinesevalue;
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return;
}
sql_inj_throw(value);
value = applyType(filedType,value);
if(!StringUtil.isEmpty(value)){
if(value.contains("*")){
//模糊查询
value = value.replaceAll("\\*", "%");
params.put(filedName, CgReportConstant.OP_LIKE+value);
}else{
params.put(filedName, CgReportConstant.OP_EQ+value);
}
}
}else if("group".equals(queryMode)){
//范围查询组装
String begin = request.getParameter(filedName+"_begin");
sql_inj_throw(begin);
begin= applyType(filedType,begin);
String end = request.getParameter(filedName+"_end");
sql_inj_throw(end);
end= applyType(filedType,end);
if(!StringUtil.isEmpty(begin)){
String re = CgReportConstant.OP_RQ+begin;
if(!StringUtil.isEmpty(end)){
re +=" AND "+filedName+CgReportConstant.OP_LQ+end;
}
params.put(filedName, re);
}else if(!StringUtil.isEmpty(end)){
String re = CgReportConstant.OP_LQ+end;
params.put(filedName, re);
}
}
}
/**
* json
* @param result
* @param size
* @return json
*/
public static String getJson(List<Map<String, Object>> result,Long size){
JSONObject main = new JSONObject();
JSONArray rows = new JSONArray();
main.put("total",size );
for(Map m:result){
JSONObject item = new JSONObject();
Iterator it =m.keySet().iterator();
while(it.hasNext()){
String key = (String) it.next();
String value =String.valueOf(m.get(key));
key = key.toLowerCase();
if(key.contains("time")||key.contains("date")){
value = datatimeFormat(value);
}
item.put(key,value );
}
rows.add(item);
}
main.put("rows", rows);
return main.toString();
}
/**
* json()
* @param result
* @param size
* @return json
*/
public static String getJson(List<Map<String, Object>> result){
JSONArray rows = new JSONArray();
for(Map m:result){
JSONObject item = new JSONObject();
Iterator it =m.keySet().iterator();
while(it.hasNext()){
String key = (String) it.next();
String value =String.valueOf(m.get(key));
key = key.toLowerCase();
if(key.contains("time")||key.contains("date")){
value = datatimeFormat(value);
}
item.put(key,value );
}
rows.add(item);
}
return rows.toString();
}
/**
*
* @param datetime
* @return
*/
public static String datatimeFormat(String datetime){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
SimpleDateFormat dateFormatTo = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d = null;
try{
d = dateFormat.parse(datetime);
return dateFormatTo.format(d);
}catch (Exception e) {
return datetime;
}
}
/**
* sql
* @param str sql
* @return
*/
public static boolean sql_inj(String str) {
if(StringUtil.isEmpty(str)){
return false;
}
String inj_str = "'|and|exec|insert|select|delete|update|count|chr|mid|master|truncate|char|declare|;|or|+|,";
// String inj_str = "'|and|exec|insert|select|delete|update|count|chr|mid|master|truncate|char|declare|;|or|-|+|,";
String inj_stra[] = inj_str.split("\\|");
for (int i = 0; i < inj_stra.length; i++) {
if (str.indexOf(" "+inj_stra[i]+" ") >= 0) {
return true;
}
}
return false;
}
/**
* sql
* @param str sql
*/
public static void sql_inj_throw(String str){
if(sql_inj(str)){
throw new RuntimeException("请注意,填入的参数可能存在SQL注入!");
}
}
/**
*
* @param fieldType
* @param value
* @return
*/
public static String applyType(String fieldType, String value) {
if(!StringUtil.isEmpty(value)){
String result = "";
if(CgReportConstant.TYPE_STRING.equalsIgnoreCase(fieldType)){
//if(ResourceUtil.fuzzySearch&&(!value.contains("*"))){
// value="*"+value+"*";
//}
result = "'" +value+ "'";
}else if(CgReportConstant.TYPE_DATE.equalsIgnoreCase(fieldType)){
result = getDateFunction(value, "yyyy-MM-dd");
}else if(CgReportConstant.TYPE_DOUBLE.equalsIgnoreCase(fieldType)){
result = value;
}else if(CgReportConstant.TYPE_INTEGER.equalsIgnoreCase(fieldType)){
result = value;
}else{
result = value;
}
return result;
}else{
return "";
}
}
/**
*
* @param dateStr
* @param dateFormat
* @return
*/
public static String getDateFunction(String dateStr,String dateFormat){
String dbType = getDBType();
String dateFunction = "";
if("mysql".equalsIgnoreCase(dbType)){
//mysql日期函数
dateFunction = "'"+dateStr+"'";
}else if("oracle".equalsIgnoreCase(dbType)){
//oracle日期函数
dateFunction = "TO_DATE('"+dateStr+"','"+dateFormat+"')";
}else if("sqlserver".equalsIgnoreCase(dbType)){
//sqlserver日期函数
dateFunction = "(CONVERT(VARCHAR,'"+dateStr+"') as DATETIME)";
}else if("postgres".equalsIgnoreCase(dbType)){
//postgres日期函数
dateFunction = "'"+dateStr+"'::date ";
}else{
dateFunction = dateStr;
}
return dateFunction;
}
/**
*
* @return
*/
public static String getDBType(){
return DBTypeUtil.getDBType();
}
}

View File

@ -1,10 +1,13 @@
package org.jeecgframework.web.cgform.engine; package org.jeecgframework.core.online.util;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Map; import java.util.Map;
import org.jeecgframework.core.util.ApplicationContextUtil;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import freemarker.template.TemplateDirectiveModel;
/** /**
* *
* @Title:FreemarkerHelper * @Title:FreemarkerHelper
@ -16,6 +19,8 @@ import freemarker.template.Template;
public class FreemarkerHelper { public class FreemarkerHelper {
private static Configuration _tplConfig = new Configuration(); private static Configuration _tplConfig = new Configuration();
static{ static{
_tplConfig.setSharedVariable("DictData", (TemplateDirectiveModel)ApplicationContextUtil.getContext().getBean("dictDataTag"));
_tplConfig.setSharedVariable("mutiLang", (TemplateDirectiveModel)ApplicationContextUtil.getContext().getBean("mutiLangTag"));
_tplConfig.setClassForTemplateLoading(FreemarkerHelper.class, "/"); _tplConfig.setClassForTemplateLoading(FreemarkerHelper.class, "/");
_tplConfig.setDateTimeFormat("yyyy-MM-dd HH:mm:ss"); _tplConfig.setDateTimeFormat("yyyy-MM-dd HH:mm:ss");
_tplConfig.setDateFormat("yyyy-MM-dd"); _tplConfig.setDateFormat("yyyy-MM-dd");

View File

@ -291,9 +291,9 @@ public class Uploader {
String servletPath = this.request.getServletPath(); String servletPath = this.request.getServletPath();
String realPath = this.request.getSession().getServletContext() String realPath = this.request.getSession().getServletContext()
.getRealPath(servletPath); .getRealPath(servletPath);
//update-begin--author:scott--date:20160628----for:变更UE编辑器上传路径到upload目录下------
String newUrl = new File(realPath).getParent().replace("\\content\\plug-in\\ueditor\\jsp", "") + "/" + path; String newUrl = new File(realPath).getParent().replace("\\content\\plug-in\\ueditor\\jsp", "") + "/" + path;
//update-end--author:scott--date:20160628----for:变更UE编辑器上传路径到upload目录下------
return newUrl; return newUrl;
} }

View File

@ -27,14 +27,12 @@ public class DataBaseCronTriggerBean extends CronTriggerBean{
(TSTimeTaskEntity.class,"taskId",this.getName()); (TSTimeTaskEntity.class,"taskId",this.getName());
if(task!=null&&task.getIsEffect().equals("1") if(task!=null&&task.getIsEffect().equals("1")
&&!task.getCronExpression().equals(this.getCronExpression())){ &&!task.getCronExpression().equals(this.getCronExpression())){
try { try {
this.setCronExpression(task.getCronExpression()); this.setCronExpression(task.getCronExpression());
} catch (ParseException e) { } catch (ParseException e) {
// TODO 异常必须被处理 // TODO 异常必须被处理
e.printStackTrace(); e.printStackTrace();
} }
DynamicTask.updateSpringMvcTaskXML(this,task.getCronExpression()); DynamicTask.updateSpringMvcTaskXML(this,task.getCronExpression());
} }
} }

View File

@ -5,9 +5,6 @@ package org.jeecgframework.core.util;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.jeecgframework.web.cgform.controller.autolist.CgAutoListController;
import org.jeecgframework.web.system.listener.OnlineListener;
/** /**
* *
* @author * @author
@ -21,7 +18,7 @@ public class DBTypeUtil {
*/ */
public static String getDBType(){ public static String getDBType(){
String retStr=""; String retStr="";
ApplicationContext ctx = OnlineListener.getCtx(); ApplicationContext ctx = ApplicationContextUtil.getContext();
if (ctx==null) { if (ctx==null) {
return retStr;//如果ctx为空则服务器异常了 return retStr;//如果ctx为空则服务器异常了
}else{ }else{
@ -37,6 +34,9 @@ public class DBTypeUtil {
}else if (dbdialect.equals("org.hibernate.dialect.PostgreSQLDialect")) { }else if (dbdialect.equals("org.hibernate.dialect.PostgreSQLDialect")) {
retStr = "postgres"; retStr = "postgres";
} }
else if (dbdialect.equals("org.jeecgframework.core.common.hibernate.dialect.MySQLServer2008Dialect")) {
retStr = "sqlserver";
}
return retStr; return retStr;
} }
} }

View File

@ -326,6 +326,15 @@ public class DateUtils extends PropertyEditorSupport {
public static String formatDate() { public static String formatDate() {
return date_sdf.format(getCalendar().getTime()); return date_sdf.format(getCalendar().getTime());
} }
/**
* yyyy-MM-dd HH:mm:ss
*
* @return yyyy-MM-dd HH:mm:ss
*/
public static String formatDateTime() {
return datetimeFormat.format(getCalendar().getTime());
}
/** /**
* *
*/ */

View File

@ -29,7 +29,6 @@ public class DynamicDBUtil {
//设置数据源的时候,要重新解密 //设置数据源的时候,要重新解密
//String dbPassword = dynamicSourceEntity.getDbPassword(); //String dbPassword = dynamicSourceEntity.getDbPassword();
String dbPassword = PasswordUtil.decrypt(dynamicSourceEntity.getDbPassword(), dynamicSourceEntity.getDbUser(), PasswordUtil.getStaticSalt());//解密字符串; String dbPassword = PasswordUtil.decrypt(dynamicSourceEntity.getDbPassword(), dynamicSourceEntity.getDbUser(), PasswordUtil.getStaticSalt());//解密字符串;
dataSource.setDriverClassName(driverClassName); dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url); dataSource.setUrl(url);
@ -111,7 +110,7 @@ public class DynamicDBUtil {
} }
return list; return list;
} }
//add-begin--Author:luobaoli Date:20150620 for增加返回值为List的方法
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz,Object... param) { public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz,Object... param) {
List<T> list; List<T> list;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey); JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
@ -123,7 +122,7 @@ public class DynamicDBUtil {
} }
return list; return list;
} }
//add-end--Author:luobaoli Date:20150620 for增加返回值为List的方法
public static void main(String[] args) { public static void main(String[] args) {
DynamicDataSourceEntity dynamicSourceEntity = new DynamicDataSourceEntity(); DynamicDataSourceEntity dynamicSourceEntity = new DynamicDataSourceEntity();

View File

@ -38,7 +38,7 @@ public class JeecgDataAutorUtils {
} }
/** /**
* *
* *
* @param request * @param request
* @return * @return
@ -50,7 +50,7 @@ public class JeecgDataAutorUtils {
} }
/** /**
* * SQL
* *
* @param request * @param request
* @return * @return

View File

@ -14,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
* *
* *
* @author * @author
* update-begin--Author:jg_longjb Date:20150313 for.getTSFunctions().size().getSubFunctionSize();
* update-begin--Author:jg_gudongli Date:20150516 for.getSubFunctionSize()hasSubFunction()
* ; * ;
*/ */
public class ListtoMenu { public class ListtoMenu {
@ -310,7 +308,6 @@ public class ListtoMenu {
return menuString.toString(); return menuString.toString();
} }
/** /**
* ----- * -----
* @param parent * @param parent
@ -414,19 +411,15 @@ public class ListtoMenu {
menuString.append(getMutiLang(function.getFunctionName())); menuString.append(getMutiLang(function.getFunctionName()));
menuString.append("\',\'"); menuString.append("\',\'");
menuString.append(function.getFunctionUrl()); menuString.append(function.getFunctionUrl());
//如果是外部链接则不加菜单ID //如果是外部链接则不加菜单ID
if(function.getFunctionUrl().indexOf("http:")==-1){ if(function.getFunctionUrl().indexOf("http:")==-1){
if(function.getFunctionUrl().indexOf("?") == -1){ if(function.getFunctionUrl().indexOf("?") == -1){
menuString.append("?clickFunctionId="); menuString.append("?clickFunctionId=");
} else { } else {
menuString.append("&clickFunctionId="); menuString.append("&clickFunctionId=");
} }
menuString.append(function.getId()); menuString.append(function.getId());
} }
menuString.append("\',\'"); menuString.append("\',\'");
menuString.append(icon); menuString.append(icon);
menuString.append("\')\" title=\""); menuString.append("\')\" title=\"");
@ -642,10 +635,8 @@ public class ListtoMenu {
dataString.append("'"+function.getId()+"':{ "); dataString.append("'"+function.getId()+"':{ ");
dataString.append("appid:'"+function.getId()+"',"); dataString.append("appid:'"+function.getId()+"',");
dataString.append("url:'"+function.getFunctionUrl()+"',"); dataString.append("url:'"+function.getFunctionUrl()+"',");
// dataString.append(getIconandName(function.getFunctionName())); // dataString.append(getIconandName(function.getFunctionName()));
dataString.append(getIconAndNameForDesk(function)); dataString.append(getIconAndNameForDesk(function));
dataString.append("asc :"+function.getFunctionOrder()); dataString.append("asc :"+function.getFunctionOrder());
dataString.append(" },"); dataString.append(" },");
} }
@ -743,8 +734,12 @@ public class ListtoMenu {
int curIndex = 0; int curIndex = 0;
for (TSFunction function : list) { for (TSFunction function : list) {
menuString.append("<li>"); menuString.append("<li>");
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"menu-icon fa fa-desktop\"></i>") if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
.append(getMutiLang(function.getFunctionName())); menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"menu-icon fa "+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"menu-icon fa fa-desktop\"></i>");
}
menuString.append(getMutiLang(function.getFunctionName()));
/* int submenusize = function.getSubFunctionSize(); /* int submenusize = function.getSubFunctionSize();
if (submenusize == 0) { if (submenusize == 0) {
menuString.append("</a></li>"); menuString.append("</a></li>");
@ -804,7 +799,13 @@ public class ListtoMenu {
int curIndex = 0; int curIndex = 0;
for (TSFunction function : list) { for (TSFunction function : list) {
menuString.append("<li>"); menuString.append("<li>");
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+"\"></i>"); if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+"\"></i>");
}
menuString.append("<span class=\"menu-text\">"); menuString.append("<span class=\"menu-text\">");
menuString.append(getMutiLang(function.getFunctionName())); menuString.append(getMutiLang(function.getFunctionName()));
menuString.append("</span>"); menuString.append("</span>");
@ -838,13 +839,28 @@ public class ListtoMenu {
for (TSFunction function : list) { for (TSFunction function : list) {
if (function.getTSFunction().getId().equals(parent.getId())){ if (function.getTSFunction().getId().equals(parent.getId())){
if(!function.hasSubFunction(map)){ if(!function.hasSubFunction(map)){
menuString.append(getLeafOfACETree(function)); menuString.append(getLeafOfACETree(function,map));
}else {
/* 20160830 wangkun TASK #1330 【改造】ace首页风格菜单不支持三级菜单改造支持三级*/
menuString.append("<li>");
if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+"\"></i>");
}
menuString.append("<span class=\"menu-text\">");
menuString.append(getMutiLang(function.getFunctionName()));
menuString.append("</span>");
menuString.append("<b class=\"arrow icon-angle-down\"></b></a><ul class=\"submenu\" >");
menuString.append(getACESubMenu(function,2,map));
menuString.append("</ul></li>");
/* 20160830 wangkun TASK #1330 【改造】ace首页风格菜单不支持三级菜单改造支持三级*/
} }
} }
} }
return menuString.toString(); return menuString.toString();
} }
private static String getLeafOfACETree(TSFunction function){ private static String getLeafOfACETree(TSFunction function,Map<Integer, List<TSFunction>> map){
StringBuffer menuString = new StringBuffer(); StringBuffer menuString = new StringBuffer();
String icon = "folder"; String icon = "folder";
if (function.getTSIcon() != null) { if (function.getTSIcon() != null) {
@ -864,12 +880,16 @@ public class ListtoMenu {
menuString.append("\" url=\""); menuString.append("\" url=\"");
menuString.append(function.getFunctionUrl()); menuString.append(function.getFunctionUrl());
menuString.append("\" >"); menuString.append("\" >");
menuString.append("<i class=\"icon-double-angle-right\"></i>"); /* 20160830 wangkun TASK #1330 【改造】ace首页风格菜单不支持三级菜单改造支持三级*/
if(function.hasSubFunction(map)){
menuString.append("<i class=\"icon-double-angle-right\"></i>");
}
/* 20160830 wangkun TASK #1330 【改造】ace首页风格菜单不支持三级菜单改造支持三级*/
menuString.append(name); menuString.append(name);
menuString.append("</a></li>"); menuString.append("</a></li>");
return menuString.toString(); return menuString.toString();
} }
private static String getLeafOfDIYTree(TSFunction function){ private static String getLeafOfDIYTree(TSFunction function){
StringBuffer menuString = new StringBuffer(); StringBuffer menuString = new StringBuffer();
String icon = "folder"; String icon = "folder";
@ -904,7 +924,11 @@ public class ListtoMenu {
int curIndex = 0; int curIndex = 0;
for (TSFunction function : list) { for (TSFunction function : list) {
menuString.append("<li>"); menuString.append("<li>");
menuString.append("<a href=\"#\" class=\"\" ><i class=\"fa fa-columns\"></i>"); if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<a href=\"#\" class=\"\" ><i class=\"fa "+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<a href=\"#\" class=\"\" ><i class=\"fa fa-columns\"></i>");
}
menuString.append("<span class=\"menu-text\">"); menuString.append("<span class=\"menu-text\">");
menuString.append(getMutiLang(function.getFunctionName())); menuString.append(getMutiLang(function.getFunctionName()));
menuString.append("</span>"); menuString.append("</span>");
@ -931,14 +955,17 @@ public class ListtoMenu {
for (TSFunction function : list) { for (TSFunction function : list) {
if (function.getTSFunction().getId().equals(parent.getId())){ if (function.getTSFunction().getId().equals(parent.getId())){
if(!function.hasSubFunction(map)){ if(!function.hasSubFunction(map)){
menuString.append(getLeafOfHplusTree(function)); menuString.append(getLeafOfHplusTree(function,map));
}else{
menuString.append(getLeafOfHplusTree(function,map));
} }
} }
} }
return menuString.toString(); return menuString.toString();
} }
private static String getLeafOfHplusTree(TSFunction function) { private static String getLeafOfHplusTree(TSFunction function,Map<Integer, List<TSFunction>> map) {
StringBuffer menuString = new StringBuffer(); StringBuffer menuString = new StringBuffer();
String icon = "folder"; String icon = "folder";
if (function.getTSIcon() != null) { if (function.getTSIcon() != null) {
@ -947,8 +974,31 @@ public class ListtoMenu {
//addTabs({id:'home',title:'首页',close: false,url: 'loginController.do?home'}); //addTabs({id:'home',title:'首页',close: false,url: 'loginController.do?home'});
String name = getMutiLang(function.getFunctionName()) ; String name = getMutiLang(function.getFunctionName()) ;
menuString.append("<li> <a class=\"J_menuItem\" href=\"").append(function.getFunctionUrl()).append("\">"); menuString.append("<li> <a class=\"J_menuItem\" href=\"").append(function.getFunctionUrl()).append("\">");
menuString.append(name); if(!function.hasSubFunction(map)){
menuString.append("</a></li>"); if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<i class=\"fa "+function.getFunctionIconStyle()+"\"></i>");
}
menuString.append("<span class=\"menu-text\">");
menuString.append(name);
menuString.append("</span>");
menuString.append("</a>");
menuString.append("</li>");
}else {
if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<i class=\"fa "+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<i class=\"fa fa-columns\"></i>");
}
menuString.append("<span class=\"menu-text\">");
menuString.append(name);
menuString.append("</span>");
menuString.append("<span class=\"fa arrow\">");
menuString.append("</span>");
menuString.append("</a>");
menuString.append("<ul class=\"nav nav-third-level\" >");
menuString.append(getHplusSubMenu(function,2,map));
menuString.append("</ul></li>");
}
return menuString.toString(); return menuString.toString();
} }
} }

View File

@ -30,7 +30,6 @@ public class MutiLangUtil {
return message; return message;
} }
// add-begin--Author:zhangguoming Date:20140727 for通用删除消息方法
/** /**
* *
* *
@ -41,7 +40,7 @@ public class MutiLangUtil {
String message = getMutiLangInstance().getLang("common.delete.fail.param", param_lang_key); String message = getMutiLangInstance().getLang("common.delete.fail.param", param_lang_key);
return message; return message;
} }
// add-end--Author:zhangguoming Date:20140727 for通用删除消息方法
/** /**
* *
@ -179,7 +178,6 @@ public class MutiLangUtil {
return context; return context;
} }
// add-begin--Author:zhangguoming Date:20140928 for多语言
/** /**
* *
* @param list * @param list
@ -214,6 +212,6 @@ public class MutiLangUtil {
list.clear(); list.clear();
list.addAll(newList); list.addAll(newList);
} }
// add-end--Author:zhangguoming Date:20140928 for多语言
} }

View File

@ -56,10 +56,8 @@ public class ResourceUtil {
* # 1 *[] * # 1 *[]
* fuzzySearch=0 * fuzzySearch=0
*/ */
// public final static boolean fuzzySearch= ResourceUtil.isFuzzySearch(); // public final static boolean fuzzySearch= ResourceUtil.isFuzzySearch();
/** /**
* session * session
* *
@ -72,7 +70,6 @@ public class ResourceUtil {
HttpSession session = ContextHolderUtils.getSession(); HttpSession session = ContextHolderUtils.getSession();
if(ClientManager.getInstance().getClient(session.getId())!=null){ if(ClientManager.getInstance().getClient(session.getId())!=null){
return ClientManager.getInstance().getClient(session.getId()).getUser(); return ClientManager.getInstance().getClient(session.getId()).getUser();
}else{ }else{
TSUser u = (TSUser) session.getAttribute(ResourceUtil.LOCAL_CLINET_USER); TSUser u = (TSUser) session.getAttribute(ResourceUtil.LOCAL_CLINET_USER);
Client client = new Client(); Client client = new Client();
@ -81,7 +78,6 @@ public class ResourceUtil {
client.setUser(u); client.setUser(u);
ClientManager.getInstance().addClinet(session.getId(), client); ClientManager.getInstance().addClinet(session.getId(), client);
} }
return null; return null;
} }
@Deprecated @Deprecated
@ -210,7 +206,6 @@ public class ResourceUtil {
return bundle.getString("randCodeType"); return bundle.getString("randCodeType");
} }
/** /**
* *
* *
@ -238,7 +233,6 @@ public class ResourceUtil {
} else { } else {
key = key; key = key;
} }
//替换为系统的登录用户账号 //替换为系统的登录用户账号
// if (key.equals(DataBaseConstant.CREATE_BY) // if (key.equals(DataBaseConstant.CREATE_BY)
@ -263,7 +257,7 @@ public class ResourceUtil {
//替换为系统登录用户的公司编码 //替换为系统登录用户的公司编码
if (key.equals(DataBaseConstant.SYS_COMPANY_CODE)|| key.equals(DataBaseConstant.SYS_COMPANY_CODE_TABLE)) { if (key.equals(DataBaseConstant.SYS_COMPANY_CODE)|| key.equals(DataBaseConstant.SYS_COMPANY_CODE_TABLE)) {
returnValue = getSessionUserName().getCurrentDepart().getOrgCode() returnValue = getSessionUserName().getCurrentDepart().getOrgCode()
.substring(0, Integer.valueOf(getOrgCodeLengthType())); .substring(0, Integer.valueOf(getOrgCodeLengthType()) + 1);
} }
//替换为系统用户登录所使用的机构编码 //替换为系统用户登录所使用的机构编码
if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) { if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
@ -280,7 +274,7 @@ public class ResourceUtil {
if(returnValue!=null){returnValue = returnValue + moshi;} if(returnValue!=null){returnValue = returnValue + moshi;}
return returnValue; return returnValue;
} }
//---author:jg_xugj----start-----date:20151226--------for#814 【数据权限】扩展支持写表达式通过session取值
/** /**
* session * session
* @param key * @param key
@ -295,7 +289,7 @@ public class ResourceUtil {
moshi = key.substring(key.indexOf("}")+1); moshi = key.substring(key.indexOf("}")+1);
} }
String returnValue = null; String returnValue = null;
//---author:jg_xugj----start-----date:20151226--------for修改bug 1、key.contains("${") 应改为 key.contains("#{") 2、StringUtil.isEmpty(key) 判断 不为空
if (key.contains("#{")) { if (key.contains("#{")) {
key = key.substring(2,key.indexOf("}")); key = key.substring(2,key.indexOf("}"));
} }
@ -328,9 +322,7 @@ public class ResourceUtil {
org.jeecgframework.core.util.LogUtil.info(getPorjectPath()); org.jeecgframework.core.util.LogUtil.info(getPorjectPath());
org.jeecgframework.core.util.LogUtil.info(getSysPath()); org.jeecgframework.core.util.LogUtil.info(getSysPath());
} }
// public static boolean isFuzzySearch(){ // public static boolean isFuzzySearch(){
// return "1".equals(bundle.getString("fuzzySearch")); // return "1".equals(bundle.getString("fuzzySearch"));
// } // }
} }

View File

@ -25,7 +25,6 @@ public class SqlUtil {
public static final String ORACLE_SQL = "select * from (select row_.*,rownum rownum_ from ({0}) row_ where rownum <= {1}) where rownum_>{2}"; //oracle public static final String ORACLE_SQL = "select * from (select row_.*,rownum rownum_ from ({0}) row_ where rownum <= {1}) where rownum_>{2}"; //oracle
public static final String SQLSERVER_SQL = "select * from ( select row_number() over(order by tempColumn) tempRowNumber, * from (select top {1} tempColumn = 0, {0}) t ) tt where tempRowNumber > {2}"; //sqlserver public static final String SQLSERVER_SQL = "select * from ( select row_number() over(order by tempColumn) tempRowNumber, * from (select top {1} tempColumn = 0, {0}) t ) tt where tempRowNumber > {2}"; //sqlserver
//add-begin--Author:luobaoli Date:20150620 for增加各个数据库获取表的SQL和获取指定表列的SQL
/** /**
* SQL * SQL
*/ */
@ -41,7 +40,7 @@ public class SqlUtil {
public static final String POSTGRE_ALLCOLUMNS_SQL = "select table_name from information_schema.columns where table_name = {0}"; public static final String POSTGRE_ALLCOLUMNS_SQL = "select table_name from information_schema.columns where table_name = {0}";
public static final String ORACLE_ALLCOLUMNS_SQL = "select column_name from all_tab_columns where table_name ={0}"; public static final String ORACLE_ALLCOLUMNS_SQL = "select column_name from all_tab_columns where table_name ={0}";
public static final String SQLSERVER_ALLCOLUMNS_SQL = "select name from syscolumns where id={0}"; public static final String SQLSERVER_ALLCOLUMNS_SQL = "select name from syscolumns where id={0}";
//add-end--Author:luobaoli Date:20150620 for增加各个数据库获取表的SQL和获取指定表列的SQL
/** /**
* sql * sql
* @param sql * @param sql
@ -152,8 +151,7 @@ public class SqlUtil {
int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct"); int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6); return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
} }
//add-begin--Author:luobaoli Date:20150620 for增加各个数据库获取表的SQL和获取指定表列的SQL
public static String getAllTableSql(String dbType,String ... param){ public static String getAllTableSql(String dbType,String ... param){
if(StringUtil.isNotEmpty(dbType)){ if(StringUtil.isNotEmpty(dbType)){
if(dbType.equals(DATABSE_TYPE_MYSQL)){ if(dbType.equals(DATABSE_TYPE_MYSQL)){
@ -183,5 +181,5 @@ public class SqlUtil {
} }
return null; return null;
} }
//add-end--Author:luobaoli Date:20150620 for增加各个数据库获取表的SQL和获取指定表列的SQL
} }

View File

@ -91,6 +91,9 @@ public class SysThemesUtil {
}else{ }else{
sb.append("<link rel=\"stylesheet\" href=\"plug-in/tools/css/common.css\" type=\"text/css\"></link>"); sb.append("<link rel=\"stylesheet\" href=\"plug-in/tools/css/common.css\" type=\"text/css\"></link>");
} }
sb.append("<link rel=\"stylesheet\" href=\"plug-in/ace/css/font-awesome.css\" type=\"text/css\"></link>");
return sb.toString(); return sb.toString();
} }

View File

@ -12,7 +12,6 @@ public class YouBianCodeUtil {
// 数字位数(默认生成3位的数字) // 数字位数(默认生成3位的数字)
private static final int numLength = 2;//代表数字位数 private static final int numLength = 2;//代表数字位数
public static final int zhanweiLength = 1+numLength; public static final int zhanweiLength = 1+numLength;
/** /**
@ -79,7 +78,6 @@ public class YouBianCodeUtil {
// return parentCode + getNextYouBianCode(localCode); // return parentCode + getNextYouBianCode(localCode);
return getNextYouBianCode(localCode); return getNextYouBianCode(localCode);
}else{ }else{
parentCode = parentCode + "A"+ getNextStrNum(0); parentCode = parentCode + "A"+ getNextStrNum(0);
} }

View File

@ -60,7 +60,6 @@ public class AuthFilterTag extends TagSupport{
protected void getAuthFilter(StringBuilder out) { protected void getAuthFilter(StringBuilder out) {
out.append("<script type=\"text/javascript\">"); out.append("<script type=\"text/javascript\">");
out.append("$(document).ready(function(){"); out.append("$(document).ready(function(){");
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){ if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
}else{ }else{
Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES); Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES);
@ -84,7 +83,6 @@ public class AuthFilterTag extends TagSupport{
} }
} }
out.append("});"); out.append("});");
out.append("</script>"); out.append("</script>");
} }

View File

@ -34,7 +34,6 @@ public class BaseTag extends TagSupport {
this.cssTheme = cssTheme; this.cssTheme = cssTheme;
} }
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
@ -79,17 +78,14 @@ public class BaseTag extends TagSupport {
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang"); 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); String langjs = StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/mutiLang/{0}.js\"></script>", "{0}", lang);
sb.append(langjs); sb.append(langjs);
if (oConvertUtils.isIn("jquery-webos", types)) { if (oConvertUtils.isIn("jquery-webos", types)) {
sb.append("<script type=\"text/javascript\" src=\"plug-in/sliding/js/jquery-1.7.1.min.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/sliding/js/jquery-1.7.1.min.js\"></script>");
} else if (oConvertUtils.isIn("jquery", types)) { } else if (oConvertUtils.isIn("jquery", types)) {
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery.cookie.js\" ></script>"); 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>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/storage/jquery.storageapi.min.js\" ></script>");
} }
if (oConvertUtils.isIn("ckeditor", types)) { 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/ckeditor/ckeditor.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckeditorTool.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckeditorTool.js\"></script>");
@ -104,13 +100,14 @@ public class BaseTag extends TagSupport {
// sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/easyui/themes/"+cssTheme+"/easyui.css\" type=\"text/css\"></link>"); // 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.getEasyUiTheme(sysThemesEnum));
sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum)); sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum));
sb.append(SysThemesUtil.getEasyUiIconTheme(sysThemesEnum)); 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\" 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\">"); sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\">");
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/icons.css\">"); sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/icons.css\">");
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
// sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/{0}.js\"></script>", "{0}", lang));
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/extends/datagrid-scrollview.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/extends/datagrid-scrollview.js\"></script>");
} }
@ -176,7 +173,6 @@ public class BaseTag extends TagSupport {
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/tools/css/"+("metro".equals(cssTheme)?"metro/":"")+"common.css\" type=\"text/css\"></link>"); // 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)); sb.append(SysThemesUtil.getCommonTheme(sysThemesEnum));
// sb.append("<script type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js"+("metro".equals(cssTheme)?"?skin=metro":"")+"\"></script>"); // 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.getLhgdialogTheme(sysThemesEnum));
sb.append(SysThemesUtil.getBootstrapTabTheme(sysThemesEnum)); sb.append(SysThemesUtil.getBootstrapTabTheme(sysThemesEnum));
@ -213,10 +209,8 @@ public class BaseTag extends TagSupport {
}finally{ }finally{
if(out!=null){ if(out!=null){
try { try {
out.clearBuffer(); out.clearBuffer();
sb.setLength(0); sb.setLength(0);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -165,11 +165,9 @@ public class ChooseTag extends TagSupport {
private void clearAll(StringBuffer sb,String methodname) { private void clearAll(StringBuffer sb,String methodname) {
String[] textnames=null; String[] textnames=null;
String[] inputTextnames=null; String[] inputTextnames=null;
if (!StringUtil.isEmpty(this.textname)) { if (!StringUtil.isEmpty(this.textname)) {
textnames = textname.split(","); textnames = textname.split(",");
} }
if(StringUtil.isNotEmpty(inputTextname)){ if(StringUtil.isNotEmpty(inputTextname)){
inputTextnames = inputTextname.split(","); inputTextnames = inputTextname.split(",");
}else{ }else{

View File

@ -31,7 +31,6 @@ public class DataGridColumnTag extends TagSupport {
protected String formatterjs;//自定义函数名称(调用页面自定义js方法 参数为(value,row,index) protected String formatterjs;//自定义函数名称(调用页面自定义js方法 参数为(value,row,index)
protected boolean hidden=false; protected boolean hidden=false;
protected String replace; protected String replace;
protected String treefield; protected String treefield;
protected boolean image; protected boolean image;
@ -56,7 +55,6 @@ public class DataGridColumnTag extends TagSupport {
protected String editor;//高级查询用的编辑器 protected String editor;//高级查询用的编辑器
private String defaultVal = "";//列默认值 private String defaultVal = "";//列默认值
public String getEditor() { public String getEditor() {
return editor; return editor;
} }

View File

@ -21,13 +21,15 @@ public class DataGridConfOptTag extends TagSupport {
private String exp;//判断链接是否显示的表达式 private String exp;//判断链接是否显示的表达式
private String operationCode;//按钮的操作Code private String operationCode;//按钮的操作Code
private String urlStyle;//样式 private String urlStyle;//样式
private String urlclass;//自定义按钮样式
private String urlfont;//自定义按钮图标样式
public int doStartTag() throws JspTagException { public int doStartTag() throws JspTagException {
return EVAL_PAGE; return EVAL_PAGE;
} }
public int doEndTag() throws JspTagException { public int doEndTag() throws JspTagException {
Tag t = findAncestorWithClass(this, DataGridTag.class); Tag t = findAncestorWithClass(this, DataGridTag.class);
DataGridTag parent = (DataGridTag) t; DataGridTag parent = (DataGridTag) t;
parent.setConfUrl(url,MutiLangUtil.getMutiLangInstance().getLang(title),MutiLangUtil.getMutiLangInstance().getLang(message),exp,operationCode,urlStyle); parent.setConfUrl(url,MutiLangUtil.getMutiLangInstance().getLang(title),MutiLangUtil.getMutiLangInstance().getLang(message),exp,operationCode,urlStyle,urlclass,urlfont);
return EVAL_PAGE; return EVAL_PAGE;
} }
public void setExp(String exp) { public void setExp(String exp) {
@ -51,4 +53,17 @@ public class DataGridConfOptTag extends TagSupport {
public String getUrlStyle() { public String getUrlStyle() {
return urlStyle; return urlStyle;
} }
public String getUrlclass() {
return urlclass;
}
public void setUrlclass(String urlclass) {
this.urlclass = urlclass;
}
public String getUrlfont() {
return urlfont;
}
public void setUrlfont(String urlfont) {
this.urlfont = urlfont;
}
} }

View File

@ -24,6 +24,10 @@ public class DataGridDelOptTag extends TagSupport {
private String operationCode;//按钮的操作Code private String operationCode;//按钮的操作Code
private String langArg; private String langArg;
private String urlStyle;//样式 private String urlStyle;//样式
private String urlclass;//按钮样式
private String urlfont;//按钮图标
public int doStartTag() throws JspTagException { public int doStartTag() throws JspTagException {
return EVAL_PAGE; return EVAL_PAGE;
@ -33,7 +37,7 @@ public class DataGridDelOptTag extends TagSupport {
Tag t = findAncestorWithClass(this, DataGridTag.class); Tag t = findAncestorWithClass(this, DataGridTag.class);
DataGridTag parent = (DataGridTag) t; DataGridTag parent = (DataGridTag) t;
parent.setDelUrl(url, title, message, exp, funname,operationCode,urlStyle); parent.setDelUrl(url, title, message, exp, funname,operationCode,urlStyle,urlclass,urlfont);
return EVAL_PAGE; return EVAL_PAGE;
} }
public void setFunname(String funname) { public void setFunname(String funname) {
@ -64,4 +68,19 @@ public class DataGridDelOptTag extends TagSupport {
public String getUrlStyle() { public String getUrlStyle() {
return urlStyle; return urlStyle;
} }
public String getUrlclass() {
return urlclass;
}
public void setUrlclass(String urlclass) {
this.urlclass = urlclass;
}
public String getUrlfont() {
return urlfont;
}
public void setUrlfont(String urlfont) {
this.urlfont = urlfont;
}
} }

View File

@ -22,7 +22,10 @@ public class DataGridFunOptTag extends TagSupport {
private String operationCode;//按钮的操作Code private String operationCode;//按钮的操作Code
private String langArg;//按钮的操作Code private String langArg;//按钮的操作Code
private String urlStyle;//样式 private String urlStyle;//样式
private String urlclass;//按钮样式
private String urlfont;//按钮图标
public int doStartTag() throws JspTagException { public int doStartTag() throws JspTagException {
return EVAL_PAGE; return EVAL_PAGE;
@ -32,7 +35,7 @@ public class DataGridFunOptTag extends TagSupport {
Tag t = findAncestorWithClass(this, DataGridTag.class); Tag t = findAncestorWithClass(this, DataGridTag.class);
DataGridTag parent = (DataGridTag) t; DataGridTag parent = (DataGridTag) t;
parent.setFunUrl(title,exp,funname,operationCode,urlStyle); parent.setFunUrl(title,exp,funname,operationCode,urlStyle,urlclass,urlfont);
return EVAL_PAGE; return EVAL_PAGE;
} }
public void setFunname(String funname) { public void setFunname(String funname) {
@ -58,4 +61,20 @@ public class DataGridFunOptTag extends TagSupport {
return urlStyle; return urlStyle;
} }
public String getUrlclass() {
return urlclass;
}
public void setUrlclass(String urlclass) {
this.urlclass = urlclass;
}
public String getUrlfont() {
return urlfont;
}
public void setUrlfont(String urlfont) {
this.urlfont = urlfont;
}
} }

View File

@ -88,7 +88,9 @@ public class DataGridTag extends TagSupport {
private Boolean singleSelect;//是否单选true,false private Boolean singleSelect;//是否单选true,false
protected String cssTheme ; protected String cssTheme ;
private boolean isShowSearch=false;//检索区域是否可收缩
public String getCssTheme() { public String getCssTheme() {
return cssTheme; return cssTheme;
} }
@ -96,7 +98,6 @@ public class DataGridTag extends TagSupport {
this.cssTheme = cssTheme; this.cssTheme = cssTheme;
} }
private boolean queryBuilder = false;// 高级查询器 private boolean queryBuilder = false;// 高级查询器
public boolean isQueryBuilder() { public boolean isQueryBuilder() {
return queryBuilder; return queryBuilder;
@ -187,10 +188,18 @@ public class DataGridTag extends TagSupport {
this.singleSelect = singleSelect; this.singleSelect = singleSelect;
} }
public boolean getIsShowSearch() {
return isShowSearch;
}
public void setIsShowSearch(boolean isShowSearch) {
this.isShowSearch = isShowSearch;
}
/** /**
* URL * URL
* @param urlfont
* @param urlclass
*/ */
public void setConfUrl(String url, String title, String message, String exp,String operationCode, String urlStyle) { public void setConfUrl(String url, String title, String message, String exp,String operationCode, String urlStyle, String urlclass, String urlfont) {
DataGridUrl dataGridUrl = new DataGridUrl(); DataGridUrl dataGridUrl = new DataGridUrl();
dataGridUrl.setTitle(title); dataGridUrl.setTitle(title);
dataGridUrl.setUrl(url); dataGridUrl.setUrl(url);
@ -198,13 +207,15 @@ public class DataGridTag extends TagSupport {
dataGridUrl.setMessage(message); dataGridUrl.setMessage(message);
dataGridUrl.setExp(exp); dataGridUrl.setExp(exp);
dataGridUrl.setUrlStyle(urlStyle); dataGridUrl.setUrlStyle(urlStyle);
dataGridUrl.setUrlclass(urlclass);
dataGridUrl.setUrlfont(urlfont);
installOperationCode(dataGridUrl, operationCode,urlList); installOperationCode(dataGridUrl, operationCode,urlList);
} }
/** /**
* URL * URL
*/ */
public void setDelUrl(String url, String title, String message, String exp, String funname,String operationCode, String urlStyle) { public void setDelUrl(String url, String title, String message, String exp, String funname,String operationCode, String urlStyle,String urlclass,String urlfont) {
DataGridUrl dataGridUrl = new DataGridUrl(); DataGridUrl dataGridUrl = new DataGridUrl();
dataGridUrl.setTitle(title); dataGridUrl.setTitle(title);
dataGridUrl.setUrl(url); dataGridUrl.setUrl(url);
@ -213,6 +224,10 @@ public class DataGridTag extends TagSupport {
dataGridUrl.setExp(exp); dataGridUrl.setExp(exp);
dataGridUrl.setFunname(funname); dataGridUrl.setFunname(funname);
dataGridUrl.setUrlStyle(urlStyle); dataGridUrl.setUrlStyle(urlStyle);
dataGridUrl.setUrlclass(urlclass);
dataGridUrl.setUrlfont(urlfont);
installOperationCode(dataGridUrl, operationCode,urlList); installOperationCode(dataGridUrl, operationCode,urlList);
} }
/** /**
@ -251,13 +266,17 @@ public class DataGridTag extends TagSupport {
/** /**
* URL * URL
*/ */
public void setFunUrl(String title, String exp, String funname,String operationCode, String urlStyle) { public void setFunUrl(String title, String exp, String funname,String operationCode, String urlStyle,String urlclass,String urlfont) {
DataGridUrl dataGridUrl = new DataGridUrl(); DataGridUrl dataGridUrl = new DataGridUrl();
dataGridUrl.setTitle(title); dataGridUrl.setTitle(title);
dataGridUrl.setType(OptTypeDirection.Fun); dataGridUrl.setType(OptTypeDirection.Fun);
dataGridUrl.setExp(exp); dataGridUrl.setExp(exp);
dataGridUrl.setFunname(funname); dataGridUrl.setFunname(funname);
dataGridUrl.setUrlStyle(urlStyle); dataGridUrl.setUrlStyle(urlStyle);
dataGridUrl.setUrlclass(urlclass);
dataGridUrl.setUrlfont(urlfont);
installOperationCode(dataGridUrl, operationCode,urlList); installOperationCode(dataGridUrl, operationCode,urlList);
} }
@ -330,9 +349,7 @@ public class DataGridTag extends TagSupport {
dataGridColumn.setEditor(editor); dataGridColumn.setEditor(editor);
dataGridColumn.setDefaultVal(defaultVal); dataGridColumn.setDefaultVal(defaultVal);
columnList.add(dataGridColumn); columnList.add(dataGridColumn);
Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES); Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES);
if (null!=operationCodes) { if (null!=operationCodes) {
for (String MyoperationCode : operationCodes) { for (String MyoperationCode : operationCodes) {
@ -347,7 +364,6 @@ public class DataGridTag extends TagSupport {
} }
} }
if (field != "opt") { if (field != "opt") {
@ -479,7 +495,6 @@ public class DataGridTag extends TagSupport {
out.print(end().toString()); out.print(end().toString());
out.flush(); out.flush();
// } // }
}else{ }else{
out.print(datatables().toString()); out.print(datatables().toString());
out.flush(); out.flush();
@ -489,7 +504,6 @@ public class DataGridTag extends TagSupport {
}finally{ }finally{
if(out!=null){ if(out!=null){
try { try {
out.clearBuffer(); out.clearBuffer();
end().setLength(0); end().setLength(0);
// 清空资源 // 清空资源
@ -500,7 +514,6 @@ public class DataGridTag extends TagSupport {
columnList.clear(); columnList.clear();
fields = ""; fields = "";
searchFields = ""; searchFields = "";
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -560,7 +573,6 @@ public class DataGridTag extends TagSupport {
sb.append(",\"bSortable\":" + column.isSortable() + ""); sb.append(",\"bSortable\":" + column.isSortable() + "");
sb.append(",\"bVisible\":" + !column.isHidden() + ""); sb.append(",\"bVisible\":" + !column.isHidden() + "");
sb.append(",\"bSearchable\":" + column.isQuery() + ""); sb.append(",\"bSearchable\":" + column.isQuery() + "");
} }
sb.append("}"); sb.append("}");
@ -588,7 +600,7 @@ public class DataGridTag extends TagSupport {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
width = (width == null) ? "auto" : width; width = (width == null) ? "auto" : width;
height = (height == null) ? "auto" : height; height = (height == null) ? "auto" : height;
sb.append("<script type=\"text/javascript\">"); sb.append("<script type=\"text/javascript\">");
sb.append("$(function(){ storage=$.localStorage;if(!storage)storage=$.cookieStorage;"); sb.append("$(function(){ storage=$.localStorage;if(!storage)storage=$.cookieStorage;");
sb.append(this.getNoAuthOperButton()); sb.append(this.getNoAuthOperButton());
if (treegrid) { if (treegrid) {
@ -638,7 +650,6 @@ public class DataGridTag extends TagSupport {
//System.out.println("queryParams===="+queryParams); //System.out.println("queryParams===="+queryParams);
sb.append(queryParams); sb.append(queryParams);
} }
sb.append(StringUtil.replaceAll("loadMsg: \'{0}\',", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.data.loading"))); sb.append(StringUtil.replaceAll("loadMsg: \'{0}\',", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.data.loading")));
sb.append("pageSize: " + pageSize + ","); sb.append("pageSize: " + pageSize + ",");
sb.append("pagination:" + pagination + ","); sb.append("pagination:" + pagination + ",");
@ -698,10 +709,8 @@ public class DataGridTag extends TagSupport {
sb.append("}"); sb.append("}");
sb.append("});"); sb.append("});");
this.setPager(sb, grid); this.setPager(sb, grid);
sb.append("try{restoreheader();}catch(ex){}"); sb.append("try{restoreheader();}catch(ex){}");
sb.append("});"); sb.append("});");
sb.append("function reloadTable(){"); sb.append("function reloadTable(){");
sb.append("try{"); sb.append("try{");
sb.append(" $(\'#\'+gridname).datagrid(\'reload\');" ); sb.append(" $(\'#\'+gridname).datagrid(\'reload\');" );
@ -715,7 +724,6 @@ public class DataGridTag extends TagSupport {
sb.append("function getSelectRows(){"); sb.append("function getSelectRows(){");
sb.append(" return $(\'#"+name+"\').datagrid('getChecked');"); sb.append(" return $(\'#"+name+"\').datagrid('getChecked');");
sb.append("}"); sb.append("}");
sb.append(" function saveHeader(){"); sb.append(" function saveHeader(){");
sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;"); sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;");
sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}"); sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}");
@ -732,6 +740,22 @@ public class DataGridTag extends TagSupport {
sb.append("}} }"); sb.append("}} }");
sb.append("storage.set( '"+name+"hiddenColumns',JSON.stringify(hiddencolumns));"); sb.append("storage.set( '"+name+"hiddenColumns',JSON.stringify(hiddencolumns));");
sb.append( "}"); sb.append( "}");
sb.append(" function isShowBut(){");
sb.append(" var isShowSearchId = $(\'#isShowSearchId\').val();");
sb.append(" if(isShowSearchId == \"true\"){");
sb.append(" $(\"#searchColums\").hide();");
sb.append(" $(\'#isShowSearchId\').val(\"false\");");
sb.append(" $(\'#columsShow\').remove(\"src\");");
sb.append(" $(\'#columsShow\').attr(\"src\",\"plug-in/easyui/themes/default/images/accordion_expand.png\");");
sb.append(" } else{");
sb.append(" $(\"#searchColums\").show();");
sb.append(" $(\'#isShowSearchId\').val(\"true\");");
sb.append(" $(\'#columsShow\').remove(\"src\");");
sb.append(" $(\'#columsShow\').attr(\"src\",\"plug-in/easyui/themes/default/images/accordion_collapse.png\");");
sb.append(" }");
sb.append("}");
sb.append( "function restoreheader(){"); sb.append( "function restoreheader(){");
sb.append("var cols = storage.get( '"+name+"hiddenColumns');if(!cols)return;"); sb.append("var cols = storage.get( '"+name+"hiddenColumns');if(!cols)return;");
sb.append( "for(var i=0;i<cols.length;i++){"); sb.append( "for(var i=0;i<cols.length;i++){");
@ -750,7 +774,6 @@ public class DataGridTag extends TagSupport {
sb.append( "}"); sb.append( "}");
sb.append( "}"); sb.append( "}");
sb.append( "}"); sb.append( "}");
if (columnList.size() > 0) { if (columnList.size() > 0) {
sb.append("function " + name + "search(){"); sb.append("function " + name + "search(){");
//update by jg_renjie at 2016/1/11 for:TASK #823 增加form实现Form表单验证 //update by jg_renjie at 2016/1/11 for:TASK #823 增加form实现Form表单验证
@ -765,19 +788,17 @@ public class DataGridTag extends TagSupport {
sb.append("function dosearch(params){"); sb.append("function dosearch(params){");
sb.append("var jsonparams=$.parseJSON(params);"); sb.append("var jsonparams=$.parseJSON(params);");
sb.append("$(\'#" + name + "\')." + grid + "({url:'" + actionUrl + "&field=" + searchFields + "',queryParams:jsonparams});" + "}"); sb.append("$(\'#" + name + "\')." + grid + "({url:'" + actionUrl + "&field=" + searchFields + "',queryParams:jsonparams});" + "}");
//searchbox框执行方法 //searchbox框执行方法
searchboxFun(sb,grid); searchboxFun(sb,grid);
//生成重置按钮功能js //生成重置按钮功能js
//回车事件 //回车事件
sb.append("function EnterPress(e){"); sb.append("function EnterPress(e){");
sb.append("var e = e || window.event;"); sb.append("var e = e || window.event;");
sb.append("if(e.keyCode == 13){ "); sb.append("if(e.keyCode == 13){ ");
sb.append(name+"search();"); sb.append(name+"search();");
sb.append("}}"); sb.append("}}");
sb.append("function searchReset(name){"); sb.append("function searchReset(name){");
sb.append(" $(\"#\"+name+\"tb\").find(\":input\").val(\"\");"); sb.append(" $(\"#\"+name+\"tb\").find(\":input\").val(\"\");");
@ -793,19 +814,27 @@ public class DataGridTag extends TagSupport {
sb.append("</script>"); sb.append("</script>");
sb.append("<table width=\"100%\" id=\"" + name + "\" toolbar=\"#" + name + "tb\"></table>"); sb.append("<table width=\"100%\" id=\"" + name + "\" toolbar=\"#" + name + "tb\"></table>");
sb.append("<div id=\"" + name + "tb\" style=\"padding:3px; height: auto\">"); sb.append("<div id=\"" + name + "tb\" style=\"padding:3px; height: auto\">");
if(hasQueryColum(columnList)&&isShowSearch==true){
sb.append("<input id=\"columsShow\" type=\"image\" src=\"plug-in/easyui/themes/default/images/accordion_collapse.png\" onclick=\"isShowBut()\">");
}
if(hasQueryColum(columnList)){ if(hasQueryColum(columnList)){
sb.append("<div name=\"searchColums\">"); sb.append("<div name=\"searchColums\" id=\"searchColums\" >");
sb.append("<input id=\"isShowSearchId\" type=\"hidden\" value=\""+isShowSearch+"\"/>");
//-----longjb1 增加用于高级查询的参数项 //-----longjb1 增加用于高级查询的参数项
sb.append("<input id=\"_sqlbuilder\" name=\"sqlbuilder\" type=\"hidden\" />"); sb.append("<input id=\"_sqlbuilder\" name=\"sqlbuilder\" type=\"hidden\" />");
//update by jg_renjie at 2016/1/11 for:TASK #823 增加form实现Form表单验证 //update by jg_renjie at 2016/1/11 for:TASK #823 增加form实现Form表单验证
sb.append("<form id='"+name+"Form'>"); sb.append("<form onkeydown='if(event.keyCode==13){" + name + "search();return false;}' id='"+name+"Form'>");
sb.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/style.css\" type=\"text/css\">"); sb.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/style.css\" type=\"text/css\">");
sb.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/tablefrom.css\" type=\"text/css\">"); sb.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/tablefrom.css\" type=\"text/css\">");
sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script>"); sb.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script>");
//update by jg_renjie at 2016/1/11 for:TASK #823 //update by jg_renjie at 2016/1/11 for:TASK #823
//如果表单是组合查询 //如果表单是组合查询
if("group".equals(getQueryMode())){ if("group".equals(getQueryMode())){
for (DataGridColumn col : columnList) { for (DataGridColumn col : columnList) {
if (col.isQuery()) { if (col.isQuery()) {
@ -831,7 +860,6 @@ public class DataGridTag extends TagSupport {
}else{ }else{
sb.append("<option value =\""+value+"\" >"+text+"</option>"); sb.append("<option value =\""+value+"\" >"+text+"</option>");
} }
} }
sb.append("</select>"); sb.append("</select>");
@ -848,7 +876,6 @@ public class DataGridTag extends TagSupport {
}else{ }else{
sb.append("<input type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" style=\"width: 100px\" class=\"searchbox-inputtext\" value=\"\" onClick=\"inputClick(this,'"+dic[1]+"','"+dic[0]+"');\" /> "); 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())){ }else if(col.getDictionary().contains(",")&&(!col.isPopup())){
String[] dic = col.getDictionary().split(","); String[] dic = col.getDictionary().split(",");
@ -867,7 +894,6 @@ public class DataGridTag extends TagSupport {
sb.append(" <option value=\""+map.get("field")+"\">"); sb.append(" <option value=\""+map.get("field")+"\">");
} }
sb.append(map.get("text")); sb.append(map.get("text"));
sb.append(" </option>"); sb.append(" </option>");
} }
@ -889,7 +915,6 @@ public class DataGridTag extends TagSupport {
+ type.getTypecode() + type.getTypecode()
+ "\">"); + "\">");
} }
sb.append(MutiLangUtil.getMutiLangInstance().getLang(type.getTypename())); sb.append(MutiLangUtil.getMutiLangInstance().getLang(type.getTypename()));
sb.append(" </option>"); sb.append(" </option>");
@ -906,7 +931,6 @@ public class DataGridTag extends TagSupport {
}else{ }else{
sb.append("<input onkeypress=\"EnterPress(event)\" onkeydown=\"EnterPress()\" type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\" style=\"width: 100px\" />"); sb.append("<input onkeypress=\"EnterPress(event)\" onkeydown=\"EnterPress()\" type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\" style=\"width: 100px\" />");
} }
//sb.append("<input onkeypress=\"EnterPress(event)\" onkeydown=\"EnterPress()\" type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\" style=\"width: 100px\" value="+col.getDefaultVal()==null?"":"\""+col.getDefaultVal()+"\""+"/>"); //sb.append("<input onkeypress=\"EnterPress(event)\" onkeydown=\"EnterPress()\" type=\"text\" name=\""+col.getField().replaceAll("_","\\.")+"\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\" style=\"width: 100px\" value="+col.getDefaultVal()==null?"":"\""+col.getDefaultVal()+"\""+"/>");
@ -915,7 +939,6 @@ public class DataGridTag extends TagSupport {
sb.append("<input type=\"text\" name=\""+col.getField()+"_begin\" style=\"width: 94px\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\"/>"); 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("<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\"/>"); sb.append("<input type=\"text\" name=\""+col.getField()+"_end\" style=\"width: 94px\" "+extendAttribute(col.getExtend())+" class=\"inuptxt\"/>");
} }
sb.append("</span>"); sb.append("</span>");
} }
@ -1143,17 +1166,43 @@ public class DataGridTag extends TagSupport {
style.append(dataGridUrl.getUrlStyle()); style.append(dataGridUrl.getUrlStyle());
style.append("\' "); style.append("\' ");
} }
StringBuffer urlclass = new StringBuffer();
if(!StringUtil.isEmpty(dataGridUrl.getUrlclass())){
urlclass.append(" class=\'");
urlclass.append(dataGridUrl.getUrlclass());
urlclass.append("\'");
}
StringBuffer urlfont = new StringBuffer();
if(!StringUtil.isEmpty(dataGridUrl.getUrlfont())){
urlfont.append(" <i class=\' fa ");
urlfont.append(dataGridUrl.getUrlfont());
urlfont.append("\'></i>");
}
if (OptTypeDirection.Confirm.equals(dataGridUrl.getType())) { if (OptTypeDirection.Confirm.equals(dataGridUrl.getType())) {
sb.append("href+=\"[<a href=\'#\' onclick=confirm(\'" + url + "\',\'" + dataGridUrl.getMessage() + "\',\'"+name+"\')" + style.toString() + "> \";"); if(!StringUtil.isEmpty(dataGridUrl.getUrlclass())){
sb.append("href+=\"<a href=\'#\' "+urlclass.toString()+" onclick=confirm(\'" + url + "\',\'" + dataGridUrl.getMessage() + "\',\'"+name+"\')" + style.toString() + "> "+urlfont.toString()+" \";");
}else{
sb.append("href+=\"[<a href=\'#\' onclick=confirm(\'" + url + "\',\'" + dataGridUrl.getMessage() + "\',\'"+name+"\')" + style.toString() + "> \";");
}
} }
if (OptTypeDirection.Del.equals(dataGridUrl.getType())) { if (OptTypeDirection.Del.equals(dataGridUrl.getType())) {
sb.append("href+=\"[<a href=\'#\' onclick=delObj(\'" + url + "\',\'"+name+"\')" + style.toString() + ">\";"); if(!StringUtil.isEmpty(dataGridUrl.getUrlclass())){//倘若urlclass不为空则去掉链接前面的"[";
sb.append("href+=\"<a href=\'#\' "+urlclass.toString()+" onclick=delObj(\'" + url + "\',\'"+name+"\')" + style.toString() + "> "+urlfont.toString()+" \";");
}else{
sb.append("href+=\"[<a href=\'#\' onclick=delObj(\'" + url + "\',\'"+name+"\')" + style.toString() + ">\";");
}
} }
if (OptTypeDirection.Fun.equals(dataGridUrl.getType())) { if (OptTypeDirection.Fun.equals(dataGridUrl.getType())) {
String name = TagUtil.getFunction(dataGridUrl.getFunname()); String name = TagUtil.getFunction(dataGridUrl.getFunname());
String parmars = TagUtil.getFunParams(dataGridUrl.getFunname()); String parmars = TagUtil.getFunParams(dataGridUrl.getFunname());
sb.append("href+=\"[<a href=\'#\' onclick=" + name + "(" + parmars + ")" + style.toString() + ">\";"); if(!StringUtil.isEmpty(dataGridUrl.getUrlclass())){//倘若urlclass不为空则去掉链接前面的"[";
sb.append("href+=\"<a href=\'#\' "+urlclass.toString()+" onclick=" + name + "(" + parmars + ")" + style.toString() + "> "+urlfont.toString()+"\";");
}else{
sb.append("href+=\"[<a href=\'#\' onclick=" + name + "(" + parmars + ")" + style.toString() + ">\";");
}
} }
if (OptTypeDirection.OpenWin.equals(dataGridUrl.getType())) { if (OptTypeDirection.OpenWin.equals(dataGridUrl.getType())) {
sb.append("href+=\"[<a href=\'#\' onclick=openwindow('" + dataGridUrl.getTitle() + "','" + url + "','"+name+"'," + dataGridUrl.getWidth() + "," + dataGridUrl.getHeight() + ")" + style.toString() + ">\";"); sb.append("href+=\"[<a href=\'#\' onclick=openwindow('" + dataGridUrl.getTitle() + "','" + url + "','"+name+"'," + dataGridUrl.getWidth() + "," + dataGridUrl.getHeight() + ")" + style.toString() + ">\";");
@ -1161,11 +1210,15 @@ public class DataGridTag extends TagSupport {
if (OptTypeDirection.Deff.equals(dataGridUrl.getType())) { if (OptTypeDirection.Deff.equals(dataGridUrl.getType())) {
sb.append("href+=\"[<a href=\'" + url + "' title=\'"+dataGridUrl.getTitle()+"\'" + style.toString() + ">\";"); sb.append("href+=\"[<a href=\'" + url + "' title=\'"+dataGridUrl.getTitle()+"\'" + style.toString() + ">\";");
} }
if (OptTypeDirection.OpenTab.equals(dataGridUrl.getType())) { if (OptTypeDirection.OpenTab.equals(dataGridUrl.getType())) {
sb.append("href+=\"[<a href=\'#\' onclick=addOneTab('" + dataGridUrl.getTitle() + "','" + url + "')>\";"); sb.append("href+=\"[<a href=\'#\' onclick=addOneTab('" + dataGridUrl.getTitle() + "','" + url + "')>\";");
} }
sb.append("href+=\"" + dataGridUrl.getTitle() + "</a>]\";"); if(!StringUtil.isEmpty(dataGridUrl.getUrlclass())){//倘若urlclass不为空则去掉链接后面的"]";
sb.append("href+=\"" + dataGridUrl.getTitle() + "</a>&nbsp;\";");
}else{
sb.append("href+=\"" + dataGridUrl.getTitle() + "</a>]\";");
}
if (StringUtil.isNotEmpty(exp)) { if (StringUtil.isNotEmpty(exp)) {
for (int i = 0; i < exp.split("&&").length; i++) { for (int i = 0; i < exp.split("&&").length; i++) {
@ -1258,15 +1311,69 @@ public class DataGridTag extends TagSupport {
sb.append(",align:\'" + column.getAlign() + "\'"); sb.append(",align:\'" + column.getAlign() + "\'");
} }
if(StringUtils.isNotEmpty(column.getExtendParams())){ if(StringUtils.isNotEmpty(column.getExtendParams())){
sb.append(","+column.getExtendParams().substring(0,
column.getExtendParams().length()-1)); if(column.getExtendParams().indexOf("editor:'combobox'")>-1){//倘若扩展参数中包含editor:'combobox'
StringBuffer comboboxStr =new StringBuffer();//声明一个替换扩展参数中的editor:'combobox'的变量
if(!StringUtil.isEmpty(column.getDictionary())){//根据数据字典生成editor:'combobox'
if(column.getDictionary().contains(",")){
String[] dic = column.getDictionary().split(",");
String sql = "select " + dic[1] + " as field," + dic[2]+ " as text from " + dic[0];
systemService = ApplicationContextUtil.getContext().getBean(SystemService.class);
List<Map<String, Object>> list = systemService.findForJdbc(sql);
comboboxStr.append("editor:{type:'combobox',options:{valueField:'typecode',textField:'typename',data:[");
for (Map<String, Object> map : list){
comboboxStr.append("{'typecode':'"+map.get("field")+"','typename':'"+map.get("text")+"'},");
}
comboboxStr.append("],required:true}}");
//再增加formatter参数
comboboxStr.append(",formatter:function(value,row){");
for (Map<String, Object> map : list){
comboboxStr.append("if(value =='"+map.get("field")+"'){");
comboboxStr.append("return '"+map.get("text")+"';");
comboboxStr.append("}");
}
comboboxStr.append("return row."+map.get("field")+";");
comboboxStr.append("}");
}else{
Map<String, List<TSType>> typedatas = ResourceUtil.allTypes;
List<TSType> types = typedatas.get(column.getDictionary().toLowerCase());
if (types != null) {
comboboxStr.append("editor:{type:'combobox',options:{valueField:'typecode',textField:'typename',data:[");
for (TSType type : types) {
comboboxStr.append("{'typecode':'"+type.getTypecode()+"','typename':'"+MutiLangUtil.getMutiLangInstance().getLang(type.getTypename())+"'},");
}
comboboxStr.append("],required:true}}");
//再增加formatter参数
comboboxStr.append(",formatter:function(value,row){");
for (TSType type : types) {
comboboxStr.append("if(value =='"+type.getTypecode()+"'){");
comboboxStr.append("return '"+MutiLangUtil.getMutiLangInstance().getLang(type.getTypename())+"';");
comboboxStr.append("}");
}
comboboxStr.append("return row."+field+";");
comboboxStr.append("}");
}
}
}
column.setExtendParams(column.getExtendParams().replaceAll("editor:'combobox'", comboboxStr.toString()));//替换扩展参数
//System.out.println("column.getExtendParams()=="+column.getExtendParams());
}
//sb.append(","+column.getExtendParams().substring(0,column.getExtendParams().length()-1));
if(column.getExtendParams().endsWith(",") || column.getExtendParams().endsWith("''")){
sb.append(","+column.getExtendParams().substring(0,column.getExtendParams().length()-1));
}else{
sb.append(","+column.getExtendParams());
}
} }
// 隐藏字段 // 隐藏字段
if (column.isHidden()) { if (column.isHidden()) {
sb.append(",hidden:true"); sb.append(",hidden:true");
} }
if (!treegrid) { if (!treegrid) {
// 字段排序 // 字段排序
if ((column.isSortable()) && (field.indexOf("_") <= 0 && field != "opt")) { if ((column.isSortable()) && (field.indexOf("_") <= 0 && field != "opt")) {
@ -1274,8 +1381,13 @@ public class DataGridTag extends TagSupport {
} }
} }
if(column.getFormatterjs()!=null){ if(column.getFormatterjs()!=null){
sb.append(",formatter:function(value,rec,index){");
sb.append(" return "+column.getFormatterjs()+"(value,rec,index);}"); if(StringUtils.isNotEmpty(column.getExtendParams())&&column.getExtendParams().indexOf("editor:'combobox'")>-1){//倘若扩展参数中包含editor:'combobox'
//不再重复增加formatter参数
}else{
sb.append(",formatter:function(value,rec,index){");
sb.append(" return "+column.getFormatterjs()+"(value,rec,index);}");
}
}else { }else {
// 显示图片 // 显示图片
if (column.isImage()) { if (column.isImage()) {
@ -1315,7 +1427,6 @@ public class DataGridTag extends TagSupport {
sb.append(" if(value.length<=");sb.append(column.getShowLen());sb.append(") {return value}"); 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(")+'...';}}"); sb.append(" else{ return '<a title= '+value+'>'+ value.substring(0,");sb.append(column.getShowLen());sb.append(")+'...';}}");
} }
else if (columnValueList.size() > 0 && !column.getField().equals("opt")) {// 值替換 else if (columnValueList.size() > 0 && !column.getField().equals("opt")) {// 值替換
String testString = ""; String testString = "";
for (ColumnValue columnValue : columnValueList) { for (ColumnValue columnValue : columnValueList) {
@ -1419,7 +1530,6 @@ public class DataGridTag extends TagSupport {
} }
public String getNoAuthOperButton(){ public String getNoAuthOperButton(){
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){ if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
}else{ }else{
@ -1445,7 +1555,6 @@ public class DataGridTag extends TagSupport {
} }
} }
//org.jeecgframework.core.util.LogUtil.info("----getNoAuthOperButton-------"+sb.toString()); //org.jeecgframework.core.util.LogUtil.info("----getNoAuthOperButton-------"+sb.toString());
return sb.toString(); return sb.toString();
} }
@ -1686,7 +1795,6 @@ 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 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("function getSelectRows(){");
sb.append(" return $(\'#"+name+"\').datagrid('getChecked');}"); sb.append(" return $(\'#"+name+"\').datagrid('getChecked');}");
sb.append(" function saveHeader(){"); sb.append(" function saveHeader(){");
sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;"); sb.append(" var columnsFields =null;var easyextends=false;try{columnsFields = $('#"+name+"').datagrid('getColumns');easyextends=true;");
sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}"); sb.append("}catch(e){columnsFields =$('#"+name+"').datagrid('getColumnFields');}");
@ -1721,7 +1829,6 @@ public class DataGridTag extends TagSupport {
sb.append( "}"); sb.append( "}");
sb.append( "}"); sb.append( "}");
sb.append( "}"); sb.append( "}");
if (columnList.size() > 0) { if (columnList.size() > 0) {
sb.append("function " + name + "search(){"); sb.append("function " + name + "search(){");
sb.append("var queryParams=$(\'#" + name + "\').datagrid('options').queryParams;"); sb.append("var queryParams=$(\'#" + name + "\').datagrid('options').queryParams;");
@ -1740,7 +1847,6 @@ public class DataGridTag extends TagSupport {
sb.append("if(e.keyCode == 13){ "); sb.append("if(e.keyCode == 13){ ");
sb.append(name+"search();"); sb.append(name+"search();");
sb.append("}}"); sb.append("}}");
sb.append("function searchReset(name){"); sb.append("function searchReset(name){");
sb.append(" $(\"#"+name+"tb\").find(\":input\").val(\"\");"); sb.append(" $(\"#"+name+"tb\").find(\":input\").val(\"\");");

View File

@ -44,7 +44,7 @@ public class DictSelectTag extends TagSupport {
private String dictField;// 自定义字典表的匹配字段-字典的编码值 private String dictField;// 自定义字典表的匹配字段-字典的编码值
private String dictText;// 自定义字典表的显示文本-字典的显示值 private String dictText;// 自定义字典表的显示文本-字典的显示值
private String extendJson;//扩展参数 private String extendJson;//扩展参数
private String readonly;// 只读属性 private String readonly;// 只读属性
public String getReadonly() { public String getReadonly() {
return readonly; return readonly;
@ -70,7 +70,6 @@ public class DictSelectTag extends TagSupport {
public void setDatatype(String datatype) { public void setDatatype(String datatype) {
this.datatype = datatype; this.datatype = datatype;
} }
@Autowired @Autowired
private static SystemService systemService; private static SystemService systemService;
@ -124,9 +123,8 @@ public class DictSelectTag extends TagSupport {
} }
}else { }else {
sb.append("<select name=\"" + field + "\""); sb.append("<select name=\"" + field + "\"");
this.readonly(sb); this.readonly(sb);
//增加扩展属性 //增加扩展属性
if (!StringUtils.isBlank(this.extendJson)) { if (!StringUtils.isBlank(this.extendJson)) {
@ -140,9 +138,7 @@ public class DictSelectTag extends TagSupport {
sb.append(" id=\"" + id + "\""); sb.append(" id=\"" + id + "\"");
} }
sb.append(">"); sb.append(">");
select("common.please.select", "", sb); select("common.please.select", "", sb);
for (Map<String, Object> map : list) { for (Map<String, Object> map : list) {
select(map.get("text").toString(), map.get("field").toString(), sb); select(map.get("text").toString(), map.get("field").toString(), sb);
} }
@ -177,9 +173,7 @@ public class DictSelectTag extends TagSupport {
} }
} else { } else {
sb.append("<select name=\"" + field + "\""); sb.append("<select name=\"" + field + "\"");
this.readonly(sb); this.readonly(sb);
//增加扩展属性 //增加扩展属性
if (!StringUtils.isBlank(this.extendJson)) { if (!StringUtils.isBlank(this.extendJson)) {
@ -194,9 +188,7 @@ public class DictSelectTag extends TagSupport {
} }
this.datatype(sb); this.datatype(sb);
sb.append(">"); sb.append(">");
select("common.please.select", "", sb); select("common.please.select", "", sb);
for (TSType type : types) { for (TSType type : types) {
select(type.getTypename(), type.getTypecode(), sb); select(type.getTypename(), type.getTypecode(), sb);
} }
@ -240,10 +232,8 @@ public class DictSelectTag extends TagSupport {
if (!StringUtils.isBlank(this.id)) { if (!StringUtils.isBlank(this.id)) {
sb.append(" id=\"" + id + "\""); sb.append(" id=\"" + id + "\"");
} }
this.readonly(sb); this.readonly(sb);
this.datatype(sb); this.datatype(sb);
sb.append(" />"); sb.append(" />");
} else { } else {
@ -252,9 +242,7 @@ public class DictSelectTag extends TagSupport {
if (!StringUtils.isBlank(this.id)) { if (!StringUtils.isBlank(this.id)) {
sb.append(" id=\"" + id + "\""); sb.append(" id=\"" + id + "\"");
} }
this.readonly(sb); this.readonly(sb);
this.datatype(sb); this.datatype(sb);
sb.append(" />"); sb.append(" />");
} }
@ -271,6 +259,9 @@ public class DictSelectTag extends TagSupport {
* @param sb * @param sb
*/ */
private void checkbox(String name, String code, StringBuffer sb) { private void checkbox(String name, String code, StringBuffer sb) {
if(this.defaultVal==null){
this.defaultVal="";
}
String[] values = this.defaultVal.split(","); String[] values = this.defaultVal.split(",");
Boolean checked = false; Boolean checked = false;
for (int i = 0; i < values.length; i++) { for (int i = 0; i < values.length; i++) {
@ -287,9 +278,7 @@ public class DictSelectTag extends TagSupport {
if (!StringUtils.isBlank(this.id)) { if (!StringUtils.isBlank(this.id)) {
sb.append(" id=\"" + id + "\""); sb.append(" id=\"" + id + "\"");
} }
this.readonly(sb); this.readonly(sb);
this.datatype(sb); this.datatype(sb);
sb.append(" />"); sb.append(" />");
} else { } else {
@ -298,9 +287,7 @@ public class DictSelectTag extends TagSupport {
if (!StringUtils.isBlank(this.id)) { if (!StringUtils.isBlank(this.id)) {
sb.append(" id=\"" + id + "\""); sb.append(" id=\"" + id + "\"");
} }
this.readonly(sb); this.readonly(sb);
this.datatype(sb); this.datatype(sb);
sb.append(" />"); sb.append(" />");
} }
@ -334,7 +321,6 @@ public class DictSelectTag extends TagSupport {
private List<Map<String, Object>> queryDic() { private List<Map<String, Object>> queryDic() {
String sql = "select " + dictField + " as field," + dictText String sql = "select " + dictField + " as field," + dictText
+ " as text from " + dictTable; + " as text from " + dictTable;
if(dictCondition!=null){ if(dictCondition!=null){
sql+=dictCondition; sql+=dictCondition;
} }

View File

@ -42,7 +42,6 @@ public class FormValidationTag extends TagSupport {
public void setCssTheme(String cssTheme) { public void setCssTheme(String cssTheme) {
this.cssTheme = cssTheme; this.cssTheme = cssTheme;
} }
public String getStyleClass() { public String getStyleClass() {
return styleClass; return styleClass;
} }
@ -50,7 +49,6 @@ public class FormValidationTag extends TagSupport {
public void setStyleClass(String styleClass) { public void setStyleClass(String styleClass) {
this.styleClass = styleClass; this.styleClass = styleClass;
} }
public void setTabtitle(String tabtitle) { public void setTabtitle(String tabtitle) {
this.tabtitle = tabtitle; this.tabtitle = tabtitle;
} }
@ -108,7 +106,6 @@ public class FormValidationTag extends TagSupport {
if(this.getStyleClass()!=null){ if(this.getStyleClass()!=null){
sb.append("class=\""+this.getStyleClass()+"\" "); sb.append("class=\""+this.getStyleClass()+"\" ");
} }
sb.append(" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">"); sb.append(" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">");
if ("btn_sub".equals(btnsub) && dialog) if ("btn_sub".equals(btnsub) && dialog)
sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>"); sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>");
@ -156,7 +153,6 @@ public class FormValidationTag extends TagSupport {
sb.append(SysThemesUtil.getValidformStyleTheme(sysThemesEnum)); sb.append(SysThemesUtil.getValidformStyleTheme(sysThemesEnum));
//tablefrom.css //tablefrom.css
sb.append(SysThemesUtil.getValidformTablefrom(sysThemesEnum)); sb.append(SysThemesUtil.getValidformTablefrom(sysThemesEnum));
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_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/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)); sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/Validform/js/datatype_{0}.js\"></script>", "{0}", lang));
@ -244,7 +240,6 @@ public class FormValidationTag extends TagSupport {
} }
jqsb.append("jqtransform :{selector:\"select\"}"); jqsb.append("jqtransform :{selector:\"select\"}");
} }
if (usePlugin.indexOf("jqtransform") >= 0) { if (usePlugin.indexOf("jqtransform") >= 0) {
sb.append(jqsb); sb.append(jqsb);
} }
@ -297,9 +292,7 @@ public class FormValidationTag extends TagSupport {
e.printStackTrace(); e.printStackTrace();
}finally{ }finally{
try { try {
sb.setLength(0); sb.setLength(0);
out.clearBuffer(); out.clearBuffer();
} catch (Exception e2) { } catch (Exception e2) {
} }

View File

@ -0,0 +1,80 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import java.util.Set;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.system.pojo.base.TSOperation;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @Title:HasPermissionTag
* @description:JSP
* @author chenj
* @date 2016-08-19
* @version V1.0
*/
public class HasPermissionTag extends TagSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
/**按钮code*/
private String name;
@Autowired
private SystemService systemService;
public int doStartTag() throws JspException {
String p = getName();
boolean show = showTagBody(p);
if (show) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
}
public boolean showTagBody(String p) {
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
return true;
}else{
//权限判断;
Set<String> operationCodes = (Set<String>) super.pageContext.getRequest().getAttribute(Globals.OPERATIONCODES);
if (null!=operationCodes) {
for (String MyoperationCode : operationCodes) {
if (oConvertUtils.isEmpty(MyoperationCode))
break;
systemService = ApplicationContextUtil.getContext().getBean(SystemService.class);
TSOperation operation = systemService.getEntity(TSOperation.class, MyoperationCode);
if (operation.getOperationcode().equals(p)){
return true;
}
}
}
}
// if(p!=null&&p.trim().equals("show")){
// return true;
// }else if(p!=null&&p.trim().equals("hide")){
// return false;
// }
return false;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -44,7 +44,6 @@ public class MenuTag extends TagSupport {
public int doEndTag() throws JspTagException { public int doEndTag() throws JspTagException {
JspWriter out = null; JspWriter out = null;
try { try {
out = this.pageContext.getOut(); out = this.pageContext.getOut();
out.print(end().toString()); out.print(end().toString());
out.flush(); out.flush();
@ -58,7 +57,6 @@ public class MenuTag extends TagSupport {
// out.print(menu); // out.print(menu);
// out.flush(); // out.flush();
// } // }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
}finally{ }finally{
@ -72,22 +70,18 @@ public class MenuTag extends TagSupport {
public StringBuffer end() { public StringBuffer end() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (style.equals("easyui")) { if (style.equals("easyui")) {
sb.append("<ul id=\"nav\" class=\"easyui-tree tree-lines\" fit=\"true\" border=\"false\">"); sb.append("<ul id=\"nav\" class=\"easyui-tree tree-lines\" fit=\"true\" border=\"false\">");
sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style)); sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style));
sb.append("</ul>"); sb.append("</ul>");
} }
if(style.equals("shortcut")) if(style.equals("shortcut"))
// { sb.append("<div id=\"nav\" style=\"display:none;\" class=\"easyui-accordion\" fit=\"true\" border=\"false\">"); // { 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\">"); sb.append("<div id=\"nav\" style=\"display:block;\" class=\"easyui-accordion\" fit=\"true\" border=\"false\">");
sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style)); sb.append(ListtoMenu.getEasyuiMultistageTree(menuFun, style));
sb.append("</div>"); sb.append("</div>");
} }
if(style.equals("bootstrap")) if(style.equals("bootstrap"))
{ {
sb.append(ListtoMenu.getBootMenu(parentFun, childFun)); sb.append(ListtoMenu.getBootMenu(parentFun, childFun));

View File

@ -0,0 +1,173 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.lang.StringUtils;
/**
*
*
*
* @author: gengjiajia
* @date 2016-7-25
* @version 1.0
*/
public class SelectZTreeTag extends TagSupport {
private static final long serialVersionUID = 1;
private String id;
private String url;
private String windowWidth; //窗口宽度
private String windowHeight; //窗口高度
public String getUrl() {
return url;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void setUrl(String url) {
this.url = url;
}
public String getWindowWidth() {
return windowWidth;
}
public void setWindowWidth(String windowWidth) {
this.windowWidth = windowWidth;
}
public String getWindowHeight() {
return windowHeight;
}
public void setWindowHeight(String windowHeight) {
this.windowHeight = windowHeight;
}
public int doStartTag() throws JspTagException {
return EVAL_PAGE;
}
public int doEndTag() throws JspTagException {
JspWriter out = null;
try {
out = this.pageContext.getOut();
out.print(end().toString());
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(out!=null){
try {
out.clear();
out.close();
} catch (Exception e) {
}
}
}
return EVAL_PAGE;
}
public StringBuffer end() {
StringBuffer sb = new StringBuffer();
if (StringUtils.isBlank(url)) {
url = "url";
}
if(StringUtils.isBlank(windowWidth)){
windowWidth = "200px";
}
if(StringUtils.isBlank(windowHeight)){
windowHeight = "30px";
}
sb.append("<link rel=\"stylesheet\" href=\"plug-in/ztree/css/zTreeStyle.css\" type=\"text/css\"></link>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.core-3.5.min.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.excheck-3.5.min.js\"></script>");
sb.append("<script type=\"text/javascript\">"
+"function beforeClick(treeId, treeNode) {"
+ " var zTree = $.fn.zTree.getZTreeObj('treeDemo');"
+ " zTree.checkNode(treeNode, !treeNode.checked, null, true);"
+ " return false;"
+ "}"
+ "function onCheck(e, treeId, treeNode) {"
+ " var zTree = $.fn.zTree.getZTreeObj('treeDemo'),"
+ " nodes = zTree.getCheckedNodes(true),"
+ " v = '';"
+ " for (var i=0, l=nodes.length; i<l; i++) {"
+ " v += nodes[i].name + ',';"
+ " }"
+ " if (v.length > 0 ) v = v.substring(0, v.length-1);"
+ " var cityObj = $("+id+");"
+ " cityObj.attr('value', v);"
+ "} "
+ " function showMenu() {"
+ " var cityObj = $("+id+");"
+ " var cityOffset = $("+id+").offset();"
+ " $('#menuContent').css({left:cityOffset.left + 'px', top:cityOffset.top + cityObj.outerHeight() + 'px'}).slideDown('fast');"
+ " $('body').bind('mousedown', onBodyDown);"
+ "} "
+ " function hideMenu() {"
+ " $('#menuContent').fadeOut('fast');"
+ " $('body').unbind('blur', onBodyDown);"
+ "} "
+ " function onBodyDown(event) {"
+ " if (!(event.target.id == 'menuBtn' || event.target.id == 'citySel' || event.target.id == 'menuContent' || $(event.target).parents('#menuContent').length>0)) {"
+ " hideMenu();"
+ " }"
+ "} "
+ " var setting = {"
+ " async: {"
+ " enable: true,"
+ "}, "
+ " check: {"
+ " enable: true,"
+ " chkboxType: {'Y':'', 'N':''}"
+ " },"
+ " view: {"
+ " dblClickExpand: false"
+ " },"
+ " data: {"
+ " simpleData: {"
+ " enable: true"
+ " }"
+ " },"
+ " callback: {"
+ " beforeClick: beforeClick,"
+ " onCheck: onCheck"
+ " }"
+ " };"
+ " $(function(){"
+ " $.post("
+ " '"+url+"',"
+ " function(data){"
+ " var d = $.parseJSON(data);"
+ " if (d.success) {"
+ " var datas = eval(d.obj);"
+ " $.fn.zTree.init($('#treeDemo'), setting, datas);"
+ " }"
+ " }"
+ " );"
+ "});"
+ "</script>");
sb.append(" <input id=\""+id+"\" type=\"text\" readonly value=\"\" style=\"width:"+windowWidth+";height:"+windowHeight+"\" class=\"form-control\" onclick=\"showMenu();\" />");
sb.append("<div id=\"menuContent\" class=\"menuContent\" style=\"display:none; position: absolute;\" >");
sb.append(" <ul id=\"treeDemo\" class=\"ztree\" style=\"margin-top:0; width:100%;background-color:#f9f9f9\"></ul>");
sb.append("</div>");
return sb;
}
}

View File

@ -160,13 +160,13 @@ public class TabsTag extends TagSupport {
} }
if (tabs) { if (tabs) {
//增加width属性fit属性之前写死改为由页面设定不填默认true //增加width属性fit属性之前写死改为由页面设定不填默认true
sb.append("<div id=\"" + id + "\" tabPosition=\"" + tabPosition + "\" border=flase style=\"margin:0px;padding:0px;overflow:hidden;width:"+oConvertUtils.getString(width, "auto")+";\" class=\"easyui-tabs\" fit=\""+fit+"\">"); sb.append("<div id=\"" + id + "\" tabPosition=\"" + tabPosition + "\" border=flase style=\"margin:0px;padding:0px;overflow-x:hidden;width:"+oConvertUtils.getString(width, "auto")+";\" class=\"easyui-tabs\" fit=\""+fit+"\">");
if (!iframe) { if (!iframe) {
for (Tab tab : tabList) { for (Tab tab : tabList) {
if (tab.getHref() != null) { if (tab.getHref() != null) {
sb.append("<div title=\"" + tab.getTitle() + "\" href=\"" + tab.getHref() + "\" style=\"margin:0px;padding:0px;overflow:hidden;\"></div>"); sb.append("<div title=\"" + tab.getTitle() + "\" href=\"" + tab.getHref() + "\" style=\"margin:0px;padding:0px;overflow-x:hidden;\"></div>");
} else { } else {
sb.append("<div title=\"" + tab.getTitle() + "\" style=\"margin:0px;padding:0px;overflow:hidden;\">"); sb.append("<div title=\"" + tab.getTitle() + "\" style=\"margin:0px;padding:0px;overflow-x: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>");

View File

@ -84,10 +84,8 @@ public class TagUtil {
} else { } else {
value = fieldNametoValues(childFieldName, value); value = fieldNametoValues(childFieldName, value);
} }
} }
if(value != "" && value != null) { if(value != "" && value != null) {
value = converunicode(value.toString()); value = converunicode(value.toString());
} }
return value; return value;
@ -97,7 +95,6 @@ public class TagUtil {
for (int i=0; i<jsonValue.length(); i++) { for (int i=0; i<jsonValue.length(); i++) {
char c = jsonValue.charAt(i); char c = jsonValue.charAt(i);
switch (c){ switch (c){
// case '\"': // case '\"':
// sb.append("\\\""); // sb.append("\\\"");
// break; // break;
@ -110,7 +107,6 @@ public class TagUtil {
// case '/': // case '/':
// sb.append("\\/"); // sb.append("\\/");
// break; // break;
case '\b': case '\b':
sb.append("\\b"); sb.append("\\b");
break; break;
@ -133,7 +129,6 @@ public class TagUtil {
return sb.toString(); return sb.toString();
} }
/** /**
* *
* @param fields * @param fields
@ -454,9 +449,7 @@ public class TagUtil {
}finally{ }finally{
try { try {
pw.close(); pw.close();
object.clear(); object.clear();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -489,9 +482,7 @@ public class TagUtil {
}finally{ }finally{
try { try {
pw.close(); pw.close();
object.clear(); object.clear();
} catch (Exception e2) { } catch (Exception e2) {
// TODO: handle exception // TODO: handle exception
} }
@ -629,7 +620,7 @@ public class TagUtil {
param += "'\"+index+\"'";// 传出行索引号参数 param += "'\"+index+\"'";// 传出行索引号参数
return param; return param;
} }
public static String getJson(List fields,List datas){ public static String getJson(List fields,List datas){
if(datas!=null && datas.size()>0){ if(datas!=null && datas.size()>0){
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@ -650,7 +641,6 @@ public class TagUtil {
} }
} }
public static String getJsonByMap(List fields,List<Map<String,Object>> datas){ public static String getJsonByMap(List fields,List<Map<String,Object>> datas){
if(datas!=null && datas.size()>0){ if(datas!=null && datas.size()>0){
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();

View File

@ -31,15 +31,23 @@ public class UploadTag extends TagSupport {
protected boolean auto=false;//是否自动上传 protected boolean auto=false;//是否自动上传
protected String onUploadSuccess;//上传成功处理函数 protected String onUploadSuccess;//上传成功处理函数
protected boolean view=false;//生成查看删除链接 protected boolean view=false;//生成查看删除链接
protected String formId;//参数名称 protected String formId;//参数名称
public String getFormId() { public String getFormId() {
return formId; return formId;
} }
public void setFormId(String formId) { public void setFormId(String formId) {
this.formId = formId; this.formId = formId;
} }
private String fileSizeLimit = "15MB";//上传文件大小设置
public String getFileSizeLimit() {
return fileSizeLimit;
}
public void setFileSizeLimit(String fileSizeLimit) {
this.fileSizeLimit = fileSizeLimit;
}
public void setView(boolean view) { public void setView(boolean view) {
@ -122,7 +130,7 @@ public class UploadTag extends TagSupport {
+"fileTypeDesc:\'文件格式:\'," +"fileTypeDesc:\'文件格式:\',"
+"queueID:\'"+queueID+"\'," +"queueID:\'"+queueID+"\',"
+"fileTypeExts:\'"+extend+"\'," +"fileTypeExts:\'"+extend+"\',"
+"fileSizeLimit:\'15MB\'," +"fileSizeLimit:\'"+fileSizeLimit+"\',"
+"swf:\'plug-in/uploadify/uploadify.swf\', " +"swf:\'plug-in/uploadify/uploadify.swf\', "
+"uploader:\'"+getUploader() +"uploader:\'"+getUploader()
+"onUploadStart : function(file) { "); +"onUploadStart : function(file) { ");
@ -142,7 +150,6 @@ public class UploadTag extends TagSupport {
} }
} }
sb.append("});"); sb.append("});");
}else if (formId!=null) { }else if (formId!=null) {
sb.append(" var o = {};"); sb.append(" var o = {};");
sb.append(" var _array = $('#"+formId+"').serializeArray();"); sb.append(" var _array = $('#"+formId+"').serializeArray();");
@ -158,7 +165,6 @@ public class UploadTag extends TagSupport {
sb.append(" });"); sb.append(" });");
sb.append("$(\'#"+id+"\').uploadify(\"settings\", \"formData\", o);"); sb.append("$(\'#"+id+"\').uploadify(\"settings\", \"formData\", o);");
}; };
sb.append("} ," sb.append("} ,"
+"onQueueComplete : function(queueData) { "); +"onQueueComplete : function(queueData) { ");
if(dialog) if(dialog)
@ -185,9 +191,7 @@ public class UploadTag extends TagSupport {
if(view) 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\'>&nbsp;&nbsp;</span>\";"); 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\'>&nbsp;&nbsp;</span>\";");
sb.append(" m=new Map(); "); sb.append(" m=new Map(); ");
sb.append("m.put(d.attributes.id,fileitem);"); sb.append("m.put(d.attributes.id,fileitem);");
sb.append("fileKey=d.attributes.fileKey;"); sb.append("fileKey=d.attributes.fileKey;");
} }

View File

@ -44,7 +44,6 @@ public class DataGridColumn {
protected String editor;//高级查询用的编辑器 protected String editor;//高级查询用的编辑器
private String defaultVal = "";//列默认值 private String defaultVal = "";//列默认值
public String getEditor() { public String getEditor() {
return editor; return editor;

View File

@ -20,6 +20,10 @@ public class DataGridUrl {
private boolean isRadio;//是否是单选框 private boolean isRadio;//是否是单选框
private String onclick;//选项单击事件 private String onclick;//选项单击事件
private String urlStyle;//url样式 private String urlStyle;//url样式
private String urlclass;//按钮样式
private String urlfont;//按钮图标
public String getOnclick() { public String getOnclick() {
return onclick; return onclick;
} }
@ -124,6 +128,19 @@ public class DataGridUrl {
public String getUrlStyle() { public String getUrlStyle() {
return urlStyle; return urlStyle;
} }
public String getUrlclass() {
return urlclass;
}
public void setUrlclass(String urlclass) {
this.urlclass = urlclass;
}
public String getUrlfont() {
return urlfont;
}
public void setUrlfont(String urlfont) {
this.urlfont = urlfont;
}
} }

View File

@ -22,6 +22,7 @@ public class TreeGridModel implements java.io.Serializable {
private String icon; private String icon;
private String order; private String order;
private String functionType; private String functionType;
private String iconStyle;//图标样式
public String getFunctionType() { public String getFunctionType() {
return functionType; return functionType;
@ -101,6 +102,13 @@ public class TreeGridModel implements java.io.Serializable {
public void setFieldMap(Map<String, Object> fieldMap) { public void setFieldMap(Map<String, Object> fieldMap) {
this.fieldMap = fieldMap; this.fieldMap = fieldMap;
} }
public String getIconStyle() {
return iconStyle;
}
public void setIconStyle(String iconStyle) {
this.iconStyle = iconStyle;
}
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.controller.autoform; package org.jeecgframework.web.autoform.controller;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
@ -9,10 +9,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; 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.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -22,7 +18,7 @@ import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jeecgframework.codegenerate.database.JeecgReadTable; import org.apache.velocity.VelocityContext;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
@ -32,19 +28,19 @@ import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.DynamicDBUtil; import org.jeecgframework.core.util.DynamicDBUtil;
import org.jeecgframework.core.util.MyBeanUtils; import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SqlUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbFieldEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbFieldEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormEntity; import org.jeecgframework.web.autoform.entity.AutoFormEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormParamEntity; import org.jeecgframework.web.autoform.entity.AutoFormParamEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity; import org.jeecgframework.web.autoform.entity.AutoFormStyleEntity;
import org.jeecgframework.web.cgform.service.autoform.AutoFormDbServiceI; import org.jeecgframework.web.autoform.service.AutoFormDbServiceI;
import org.jeecgframework.web.cgform.service.autoform.AutoFormServiceI; import org.jeecgframework.web.autoform.service.AutoFormServiceI;
import org.jeecgframework.web.cgform.util.AutoFormCommUtil; import org.jeecgframework.web.autoform.util.AutoFormCommUtil;
import org.jeecgframework.web.cgform.util.AutoFormTemplateParseUtil; import org.jeecgframework.web.autoform.util.AutoFormTemplateParseUtil;
import org.jeecgframework.web.cgform.util.TemplateUtil; import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.jeecgframework.web.system.pojo.base.DynamicDataSourceEntity; import org.jeecgframework.web.system.pojo.base.DynamicDataSourceEntity;
import org.jeecgframework.web.system.pojo.base.TSType; import org.jeecgframework.web.system.pojo.base.TSType;
@ -55,7 +51,6 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -102,7 +97,7 @@ public class AutoFormController extends BaseController {
*/ */
@RequestMapping(params = "autoForm") @RequestMapping(params = "autoForm")
public ModelAndView autoForm(HttpServletRequest request) { public ModelAndView autoForm(HttpServletRequest request) {
return new ModelAndView("jeecg/cgform/autoform/autoFormList"); return new ModelAndView("jeecg/autoform/autoFormList");
} }
/** /**
@ -114,7 +109,6 @@ public class AutoFormController extends BaseController {
* @param * @param
*/ */
@SuppressWarnings("unchecked")
@RequestMapping(params = "datagrid") @RequestMapping(params = "datagrid")
public void datagrid(AutoFormEntity autoForm,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public void datagrid(AutoFormEntity autoForm,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(AutoFormEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(AutoFormEntity.class, dataGrid);
@ -205,11 +199,9 @@ public class AutoFormController extends BaseController {
autoForm.setFormContent(html); autoForm.setFormContent(html);
autoForm.setFormParse(autoForm.getFormContent()); autoForm.setFormParse(autoForm.getFormContent());
} }
autoForm.setCreateDate(new Date()); autoForm.setCreateDate(new Date());
autoForm.setCreateName(ResourceUtil.getSessionUserName().getRealName()); autoForm.setCreateName(ResourceUtil.getSessionUserName().getRealName());
autoForm.setCreateBy(ResourceUtil.getSessionUserName().getUserName()); autoForm.setCreateBy(ResourceUtil.getSessionUserName().getUserName());
autoFormService.save(autoForm); autoFormService.save(autoForm);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){ }catch(Exception e){
@ -249,17 +241,15 @@ public class AutoFormController extends BaseController {
t.setFormContent(html); t.setFormContent(html);
t.setFormParse(autoForm.getFormContent()); t.setFormParse(autoForm.getFormContent());
} }
autoForm.setUpdateDate(new Date()); autoForm.setUpdateDate(new Date());
autoForm.setUpdateName(ResourceUtil.getSessionUserName().getRealName()); autoForm.setUpdateName(ResourceUtil.getSessionUserName().getRealName());
autoForm.setUpdateBy(ResourceUtil.getSessionUserName().getUserName()); autoForm.setUpdateBy(ResourceUtil.getSessionUserName().getUserName());
autoFormService.saveOrUpdate(t); autoFormService.saveOrUpdate(t);
attributes.put("id", t.getId()); attributes.put("id", t.getId());
j.setAttributes(attributes); j.setAttributes(attributes);
message = "表单更新成功"; message = "表单更新成功";
if(StringUtils.isBlank(autoForm.getMainTableSource())) if(StringUtils.isBlank(autoForm.getMainTableSource()))
message+=",主数据源为空,请选择主数据源!"; message+="(主数据源尚未设置)";
} else { } else {
if(StringUtils.isNotBlank(autoForm.getFormContent())){ if(StringUtils.isNotBlank(autoForm.getFormContent())){
// Map<String,Object> map = tool.processor(autoForm.getFormContent()); // Map<String,Object> map = tool.processor(autoForm.getFormContent());
@ -272,15 +262,14 @@ public class AutoFormController extends BaseController {
autoForm.setFormContent(html); autoForm.setFormContent(html);
autoForm.setFormParse(autoForm.getFormContent()); autoForm.setFormParse(autoForm.getFormContent());
} }
//TODO 待实现 //TODO 待实现
autoFormService.save(autoForm); autoFormService.save(autoForm);
attributes.put("id", autoForm.getId()); attributes.put("id", autoForm.getId());
j.setAttributes(attributes); j.setAttributes(attributes);
message = "表单添加成功"; message = "表单添加成功";
if(StringUtils.isBlank(autoForm.getMainTableSource())) if(StringUtils.isBlank(autoForm.getMainTableSource()))
message+=",主数据源为空,请选择主数据源!"; message+="(主数据源尚未设置)";
} }
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
@ -307,7 +296,6 @@ public class AutoFormController extends BaseController {
map.put(name, name); map.put(name, name);
} }
} }
// Elements ids = doc.select("input[name$=.id]"); // Elements ids = doc.select("input[name$=.id]");
// for (Element el: ids) { // for (Element el: ids) {
// String name = el.attr("name"); // String name = el.attr("name");
@ -318,7 +306,6 @@ public class AutoFormController extends BaseController {
// map.put(name, name); // map.put(name, name);
// } // }
// } // }
} }
@ -336,7 +323,7 @@ public class AutoFormController extends BaseController {
JSONArray jsonArray = JSONArray.fromObject(getStyleList("")); JSONArray jsonArray = JSONArray.fromObject(getStyleList(""));
req.setAttribute("styleSelect", jsonArray.toString()); req.setAttribute("styleSelect", jsonArray.toString());
return new ModelAndView("jeecg/cgform/autoform/autoForm-add"); return new ModelAndView("jeecg/autoform/autoForm-add");
} }
/** /**
* *
@ -355,7 +342,7 @@ public class AutoFormController extends BaseController {
JSONArray dbArray = JSONArray.fromObject(getFormDbList(autoForm.getId())); JSONArray dbArray = JSONArray.fromObject(getFormDbList(autoForm.getId()));
req.setAttribute("dbDate", dbArray.toString()); req.setAttribute("dbDate", dbArray.toString());
return new ModelAndView("jeecg/cgform/autoform/autoForm-update"); return new ModelAndView("jeecg/autoform/autoForm-update");
} }
/** /**
@ -409,9 +396,7 @@ public class AutoFormController extends BaseController {
for(AutoFormDbEntity dbForm:list){ for(AutoFormDbEntity dbForm:list){
map = new HashMap<String,Object>(); map = new HashMap<String,Object>();
map.put("id", dbForm.getId()); map.put("id", dbForm.getId());
map.put("name", dbForm.getDbChName()+"("+dbForm.getDbName()+")"); map.put("name", dbForm.getDbChName()+"("+dbForm.getDbName()+")");
map.put("dbCode", dbForm.getDbName()); map.put("dbCode", dbForm.getDbName());
map.put("pid", "0"); map.put("pid", "0");
//增加父节点 //增加父节点
@ -422,9 +407,7 @@ public class AutoFormController extends BaseController {
for(AutoFormDbFieldEntity field: fieldlist){ for(AutoFormDbFieldEntity field: fieldlist){
map = new HashMap<String,Object>(); map = new HashMap<String,Object>();
map.put("id", field.getId()); map.put("id", field.getId());
map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")"); map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")");
map.put("pId", dbForm.getId()); map.put("pId", dbForm.getId());
map.put("nocheck",true); map.put("nocheck",true);
dateList.add(map); dateList.add(map);
@ -436,9 +419,7 @@ public class AutoFormController extends BaseController {
for(AutoFormDbFieldEntity field: fieldlist){ for(AutoFormDbFieldEntity field: fieldlist){
map = new HashMap<String,Object>(); map = new HashMap<String,Object>();
map.put("id", field.getId()); map.put("id", field.getId());
map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")"); map.put("name", (StringUtils.isBlank(field.getFieldText())||"null".equals(field.getFieldText()))?field.getFieldName():field.getFieldText()+"("+field.getFieldName()+")");
map.put("pId", dbForm.getId()); map.put("pId", dbForm.getId());
map.put("nocheck",true); map.put("nocheck",true);
dateList.add(map); dateList.add(map);
@ -487,15 +468,11 @@ public class AutoFormController extends BaseController {
dsData.put("dsName", db.getDbName()); dsData.put("dsName", db.getDbName());
dsList.add(dsData); dsList.add(dsData);
if("table".equals(db.getDbType())){ if("table".equals(db.getDbType())){
String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?"; String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?";
List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId); List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId);
dsData.put("columns", columns); dsData.put("columns", columns);
} else if("sql".equals(db.getDbType())){ } else if("sql".equals(db.getDbType())){
String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?"; String hql = "select new Map(t.fieldName as fieldName,t.fieldText as fieldText) from AutoFormDbFieldEntity t where t.autoFormDbId=?";
List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId); List<Map<String,Object>> columns = this.systemService.findHql(hql, autoFormDbId);
if(columns.size()>0){ if(columns.size()>0){
dsData.put("columns", columns); dsData.put("columns", columns);
@ -563,12 +540,11 @@ public class AutoFormController extends BaseController {
//3.传递参数 //3.传递参数
//req.setAttribute("tbDbKey", autoFormDbEntity.getTbDbKey()); //req.setAttribute("tbDbKey", autoFormDbEntity.getTbDbKey());
req.setAttribute("dbKey", autoFormDbEntity.getDbKey()); req.setAttribute("dbKey", autoFormDbEntity.getDbKey());
} }
req.setAttribute("paramList", paramList); req.setAttribute("paramList", paramList);
req.setAttribute("autoFormPage", autoForm); req.setAttribute("autoFormPage", autoForm);
} }
return new ModelAndView("jeecg/cgform/autoform/autoForm-view"); return new ModelAndView("jeecg/autoform/autoForm-view");
} }
@ -633,7 +609,6 @@ public class AutoFormController extends BaseController {
paramMap.put(key, tem.get(key)); paramMap.put(key, tem.get(key));
} }
String op = req.getParameter("op"); String op = req.getParameter("op");
if(StringUtil.isEmpty(op)){ if(StringUtil.isEmpty(op)){
op = AutoFormTemplateParseUtil.OP_VIEW; op = AutoFormTemplateParseUtil.OP_VIEW;
@ -642,10 +617,10 @@ public class AutoFormController extends BaseController {
if(StringUtils.isNotBlank(autoForm.getFormName())){ if(StringUtils.isNotBlank(autoForm.getFormName())){
autoForm = this.systemService.findUniqueByProperty(AutoFormEntity.class, "formName", autoForm.getFormName()); autoForm = this.systemService.findUniqueByProperty(AutoFormEntity.class, "formName", autoForm.getFormName());
if(autoForm==null){ if(autoForm==null){
return new ModelAndView("jeecg/cgform/autoform/autoForm-error").addObject("message", "表单信息获取失败!"); return new ModelAndView("jeecg/autoform/autoForm-error").addObject("message", "表单信息获取失败!");
} }
}else{ }else{
return new ModelAndView("jeecg/cgform/autoform/autoForm-error").addObject("message", "formName不能为空"); return new ModelAndView("jeecg/autoform/autoForm-error").addObject("message", "formName不能为空");
} }
//根据formid查询表单的参数 //根据formid查询表单的参数
@ -654,7 +629,7 @@ public class AutoFormController extends BaseController {
for(String param:paramList){ for(String param:paramList){
String paramValue = req.getParameter(param); String paramValue = req.getParameter(param);
if(paramValue==null){ if(paramValue==null){
return new ModelAndView("jeecg/cgform/autoform/autoForm-error").addObject("message", "缺少表单参数:"+param); return new ModelAndView("jeecg/autoform/autoForm-error").addObject("message", "缺少表单参数:"+param);
} }
} }
} }
@ -673,7 +648,7 @@ public class AutoFormController extends BaseController {
ftlContent = AutoFormTemplateParseUtil.parseHtmlForAdd(ftlContent,paras); ftlContent = AutoFormTemplateParseUtil.parseHtmlForAdd(ftlContent,paras);
req.setAttribute("formContent", ftlContent); req.setAttribute("formContent", ftlContent);
req.setAttribute("op", op); req.setAttribute("op", op);
return new ModelAndView("jeecg/cgform/autoform/autoForm-review-add"); return new ModelAndView("jeecg/autoform/autoForm-review-add");
}else if(AutoFormTemplateParseUtil.OP_UPDATE.equals(op)){ }else if(AutoFormTemplateParseUtil.OP_UPDATE.equals(op)){
paras = getFormData(autoForm,paramMap); paras = getFormData(autoForm,paramMap);
String id = req.getParameter("id"); String id = req.getParameter("id");
@ -684,23 +659,23 @@ public class AutoFormController extends BaseController {
ftlContent = AutoFormTemplateParseUtil.parseHtmlForUpdate(ftlContent,paras); ftlContent = AutoFormTemplateParseUtil.parseHtmlForUpdate(ftlContent,paras);
req.setAttribute("formContent", ftlContent); req.setAttribute("formContent", ftlContent);
req.setAttribute("op", op); req.setAttribute("op", op);
return new ModelAndView("jeecg/cgform/autoform/autoForm-review-update"); return new ModelAndView("jeecg/autoform/autoForm-review-update");
}else if(AutoFormTemplateParseUtil.OP_ADD_OR_UPDATE.equals(op)){ }else if(AutoFormTemplateParseUtil.OP_ADD_OR_UPDATE.equals(op)){
paras = getFormData(autoForm,paramMap); paras = getFormData(autoForm,paramMap);
// 2.解析ueditor html 注入数据【智能提交模式】 // 2.解析ueditor html 注入数据【智能提交模式】
ftlContent = AutoFormTemplateParseUtil.parseHtmlForAddOrUpdate(ftlContent,paras); ftlContent = AutoFormTemplateParseUtil.parseHtmlForAddOrUpdate(ftlContent,paras);
req.setAttribute("formContent", ftlContent); req.setAttribute("formContent", ftlContent);
req.setAttribute("op", op); req.setAttribute("op", op);
return new ModelAndView("jeecg/cgform/autoform/autoForm-review-addorupdate"); return new ModelAndView("jeecg/autoform/autoForm-review-addorupdate");
} }
req.setAttribute("formContent", ftlContent); req.setAttribute("formContent", ftlContent);
req.setAttribute("op", op); req.setAttribute("op", op);
return new ModelAndView("jeecg/cgform/autoform/autoForm-review"); return new ModelAndView("jeecg/autoform/autoForm-review");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "表单添加失败:"+e.getMessage(); message = "表单添加失败:"+e.getMessage();
} }
return new ModelAndView("jeecg/cgform/autoform/autoForm-error").addObject("message", message); return new ModelAndView("jeecg/autoform/autoForm-error").addObject("message", message);
} }
@ -728,7 +703,7 @@ public class AutoFormController extends BaseController {
if(autoFormDbFieldEntityList.size()>0){ if(autoFormDbFieldEntityList.size()>0){
StringBuffer hqlTable = new StringBuffer().append("select "); StringBuffer hqlTable = new StringBuffer().append("select ");
for(AutoFormDbFieldEntity autoFormDbFieldEntity:autoFormDbFieldEntityList){ for(AutoFormDbFieldEntity autoFormDbFieldEntity:autoFormDbFieldEntityList){
//author:jg_renjie----start-----date:20160228--------forTASK #704 【表单填报预览】针对特殊类型数据需要进行转换比如blob
boolean flag = false; boolean flag = false;
for(Map<String,Object> typeMap:typeList){ for(Map<String,Object> typeMap:typeList){
String dataType = typeMap.get("dataType").toString().toUpperCase(); String dataType = typeMap.get("dataType").toString().toUpperCase();
@ -759,7 +734,6 @@ public class AutoFormController extends BaseController {
//当前上下文中的DB环境获取数据库表中的所有数据 //当前上下文中的DB环境获取数据库表中的所有数据
data = systemService.findForJdbc(hqlTable.toString()); data = systemService.findForJdbc(hqlTable.toString());
} }
else{ else{
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(formDb.getDbKey()); DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(formDb.getDbKey());
if(dynamicDataSourceEntity!=null){ if(dynamicDataSourceEntity!=null){
@ -799,14 +773,18 @@ public class AutoFormController extends BaseController {
// data = systemService.findForJdbc(dbDynSql); // data = systemService.findForJdbc(dbDynSql);
Object dbKeys = paramMap.get("dbKey"); Object dbKeys = paramMap.get("dbKey");
if (dbKeys != null && dbKeys != "") { if (oConvertUtils.isNotEmpty(dbKeys)) {
if (dbKeys instanceof String) { if (dbKeys instanceof String) {
String dbKey = dbKeys.toString(); String dbKey = dbKeys.toString();
data = DynamicDBUtil.findList(dbKey, dbDynSql); data = DynamicDBUtil.findList(dbKey, dbDynSql);
} else { } else {
String[] keys = (String[]) dbKeys; String[] keys = (String[]) dbKeys;
String dbKey = keys[0]; String dbKey = keys[0];
data = DynamicDBUtil.findList(dbKey, dbDynSql); if(oConvertUtils.isNotEmpty(dbKey)){
data = DynamicDBUtil.findList(dbKey, dbDynSql);
}else{
data = systemService.findForJdbc(dbDynSql);
}
} }
} else { } else {
data = systemService.findForJdbc(dbDynSql); data = systemService.findForJdbc(dbDynSql);
@ -831,7 +809,7 @@ public class AutoFormController extends BaseController {
* @param dbTableNm * @param dbTableNm
* @return * @return
*/ */
//author:jg_renjie----start-----date:20160228--------forTASK #704 【表单填报预览】针对特殊类型数据需要进行转换比如blob
private List<Map<String, Object>> getColumnTypes(String dbTableNm,String dbkey){ private List<Map<String, Object>> getColumnTypes(String dbTableNm,String dbkey){
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
String sql = "select DATA_TYPE as dataType,COLUMN_NAME as columnNm from information_schema.COLUMNS where TABLE_NAME='"+dbTableNm+"'"; String sql = "select DATA_TYPE as dataType,COLUMN_NAME as columnNm from information_schema.COLUMNS where TABLE_NAME='"+dbTableNm+"'";
@ -884,7 +862,7 @@ public class AutoFormController extends BaseController {
TemplateUtil tool = new TemplateUtil(); TemplateUtil tool = new TemplateUtil();
Map<String,Object> map = tool.processor(autoForm.getFormContent()); Map<String,Object> map = tool.processor(autoForm.getFormContent());
req.setAttribute("formContent", map.get("parseHtml")); req.setAttribute("formContent", map.get("parseHtml"));
return new ModelAndView("jeecg/cgform/autoform/autoForm-review"); return new ModelAndView("jeecg/autoform/autoForm-review");
} }
/** /**
* *
@ -917,9 +895,7 @@ public class AutoFormController extends BaseController {
if(StringUtils.isNotBlank(dbForm.getAutoFormId())){ if(StringUtils.isNotBlank(dbForm.getAutoFormId())){
List<AutoFormDbEntity> dbFormList = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", dbForm.getAutoFormId()); List<AutoFormDbEntity> dbFormList = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", dbForm.getAutoFormId());
if(dbFormList.size()>0){ if(dbFormList.size()>0){
message = "<option value='' selected='selected'>请选择数据源</option>"; message = "<option value='' selected='selected'>请选择数据源</option>";
for(AutoFormDbEntity entity:dbFormList){ for(AutoFormDbEntity entity:dbFormList){
//根据数据源名称进行匹配数据 //根据数据源名称进行匹配数据
message += "<option value='"+entity.getDbName()+"'>"+(StringUtils.isBlank(entity.getDbChName())?entity.getDbName():entity.getDbChName())+"</option>"; message += "<option value='"+entity.getDbName()+"'>"+(StringUtils.isBlank(entity.getDbChName())?entity.getDbName():entity.getDbChName())+"</option>";
@ -928,17 +904,13 @@ public class AutoFormController extends BaseController {
j.setMsg(message); j.setMsg(message);
} else{ } else{
j.setSuccess(false); j.setSuccess(false);
message = "<option value='' selected='selected'>请先添加数据源</option>"; message = "<option value='' selected='selected'>请先添加数据源</option>";
j.setMsg(message); j.setMsg(message);
} }
}else{ }else{
//2.如果ID为空则option拼接提示信息 //2.如果ID为空则option拼接提示信息
j.setSuccess(false); j.setSuccess(false);
message = "<option value='' selected='selected'>请先添加数据源</option>"; message = "<option value='' selected='selected'>请先添加数据源</option>";
j.setMsg(message); j.setMsg(message);
} }
return j; return j;
@ -958,12 +930,11 @@ public class AutoFormController extends BaseController {
//1.如果ID不为空则拼接option字符串 //1.如果ID不为空则拼接option字符串
//根据数据源名称进行匹配数据 //根据数据源名称进行匹配数据
if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){ if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){
String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?"; String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?";
List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId()); List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId());
if(list.size() ==1){ if(list.size() ==1){
dbForm = list.get(0); dbForm = list.get(0);
//dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName()); //dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName());
List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>(); List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>();
if("table".equals(dbForm.getDbType())){ if("table".equals(dbForm.getDbType())){
@ -982,9 +953,7 @@ public class AutoFormController extends BaseController {
} }
} }
if(columns.size()>0){ if(columns.size()>0){
message = "<option value='' selected='selected'>请选择字段</option>"; message = "<option value='' selected='selected'>请选择字段</option>";
for(Map<String,Object> map:columns){ 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>"; message += "<option value='"+map.get("fieldName")+"'>"+(StringUtils.isBlank((String)map.get("fieldText"))?map.get("fieldName"):map.get("fieldText")) +"</option>";
} }
@ -992,23 +961,19 @@ public class AutoFormController extends BaseController {
j.setMsg(message); j.setMsg(message);
} else{ } else{
j.setSuccess(false); j.setSuccess(false);
message = "<option value='' selected='selected'>请先添加字段</option>"; message = "<option value='' selected='selected'>请先添加字段</option>";
j.setMsg(message); j.setMsg(message);
} }
}else{ }else{
//2.如果ID为空则option拼接提示信息 //2.如果ID为空则option拼接提示信息
j.setSuccess(false); j.setSuccess(false);
message = "<option value='' selected='selected'>请先选择数据源</option>"; message = "<option value='' selected='selected'>请先选择数据源</option>";
j.setMsg(message); j.setMsg(message);
} }
} }
return j; return j;
} }
//add-begin--Author:jg_renjie Date:20150725 for数据源根据autoFormId与dbName取数据,并拼接成tr串
/** /**
* ,table * ,table
* @param dbForm * @param dbForm
@ -1026,7 +991,7 @@ public class AutoFormController extends BaseController {
Map<String, Object> attributes = new HashMap<String, Object>(); Map<String, Object> attributes = new HashMap<String, Object>();
if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){ if(StringUtils.isNotBlank(dbForm.getDbName()) && StringUtils.isNotBlank(dbForm.getAutoFormId())){
String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?"; String hqlList = "from AutoFormDbEntity t where t.dbName = ? and autoFormId = ?";
List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId()); List<AutoFormDbEntity> list= this.systemService.findHql(hqlList, dbForm.getDbName(),dbForm.getAutoFormId());
if(list.size() ==1){ if(list.size() ==1){
@ -1038,7 +1003,6 @@ public class AutoFormController extends BaseController {
} else { } else {
attributes.put("dbName", dbForm.getDbName()); attributes.put("dbName", dbForm.getDbName());
} }
//dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName()); //dbForm = this.systemService.findUniqueByProperty(AutoFormDbEntity.class, "dbName", dbForm.getDbName());
List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>(); List<Map<String,Object>> columns = new ArrayList<Map<String,Object>>();
if("table".equals(dbForm.getDbType())){ if("table".equals(dbForm.getDbType())){
@ -1198,7 +1162,6 @@ public class AutoFormController extends BaseController {
} else { } else {
message = "<option value=\"\">无字段</option>"; message = "<option value=\"\">无字段</option>";
} }
j.setSuccess(true); j.setSuccess(true);
//j.setMsg(message); //j.setMsg(message);
@ -1215,7 +1178,7 @@ public class AutoFormController extends BaseController {
} }
return j; return j;
} }
//add-end--Author:jg_renjie Date:20150725 for数据源根据autoFormId与dbName取数据,并拼接成tr串
/** /**
* *
@ -1245,7 +1208,6 @@ public class AutoFormController extends BaseController {
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* *
@ -1352,7 +1314,6 @@ public class AutoFormController extends BaseController {
return j; return j;
} }
@RequestMapping(params = "checkTbCode") @RequestMapping(params = "checkTbCode")
@ResponseBody @ResponseBody
public com.alibaba.fastjson.JSONObject checkTbCode(String param,String cVal){ public com.alibaba.fastjson.JSONObject checkTbCode(String param,String cVal){
@ -1375,7 +1336,6 @@ public class AutoFormController extends BaseController {
jsonObject.put("status", "y"); jsonObject.put("status", "y");
return jsonObject; return jsonObject;
} }
private void delFormDb(String autoFormId){ private void delFormDb(String autoFormId){
List<AutoFormDbEntity> list = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", autoFormId); List<AutoFormDbEntity> list = this.systemService.findByProperty(AutoFormDbEntity.class, "autoFormId", autoFormId);
if(list!=null&&list.size()>0) { if(list!=null&&list.size()>0) {
@ -1386,4 +1346,169 @@ public class AutoFormController extends BaseController {
} }
} }
/**
*
*
* @return
*/
@RequestMapping(params = "autoForm_vm")
public void autoFormVM(HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "autoform/autoFormList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
@RequestMapping(params = "goAdd_vm")
public void goAddVM(HttpServletResponse response, HttpServletRequest request) throws Exception {
JSONArray jsonArray = JSONArray.fromObject(getStyleList(""));
VelocityContext velocityContext = new VelocityContext();
String viewName = "autoform/autoForm-add.vm";
velocityContext.put("styleSelect", jsonArray.toString());
ViewVelocity.view(request,response,viewName,velocityContext);
}
@RequestMapping(params = "goUpdate_vm")
public void goUpdateVM(AutoFormEntity autoForm, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoForm.getId())) {
autoForm = autoFormService.getEntity(AutoFormEntity.class, autoForm.getId());
velocityContext.put("autoFormPage", autoForm);
}
JSONArray jsonArray = JSONArray.fromObject(getStyleList(autoForm.getFormStyleId()));
velocityContext.put("styleSelect", jsonArray.toString());
JSONArray dbArray = JSONArray.fromObject(getFormDbList(autoForm.getId()));
velocityContext.put("dbDate", dbArray.toString());
String viewName = "autoform/autoForm-update.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/*
*
*/
@RequestMapping(params = "parse_vm")
public void parseVM(AutoFormEntity autoForm, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
if(StringUtils.isNotBlank(autoForm.getId())){
autoForm = this.systemService.findUniqueByProperty(AutoFormEntity.class, "id", autoForm.getId());
List<String> paramList = getFormParams(autoForm.getId());
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());
velocityContext.put("dbKey", autoFormDbEntity.getDbKey());
}
velocityContext.put("paramList", paramList);
velocityContext.put("autoFormPage", autoForm);
}
String viewName = "autoform/autoForm-view.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
@RequestMapping(params = "viewContent_vm")
public void viewContentVM(AutoFormEntity autoForm, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String message = "";
try {
//获取参数
Map<String, String[]> tem = request.getParameterMap();
Map<String,Object> paramMap = new HashMap<String, Object>();
for(String key :tem.keySet()){
paramMap.put(key, tem.get(key));
}
String op = request.getParameter("op");
if(StringUtil.isEmpty(op)){
op = AutoFormTemplateParseUtil.OP_VIEW;
}
Map<String, List<Map<String, Object>>> paras = new HashMap<String, List<Map<String, Object>>>();
if(StringUtils.isNotBlank(autoForm.getFormName())){
autoForm = this.systemService.findUniqueByProperty(AutoFormEntity.class, "formName", autoForm.getFormName());
if(autoForm==null){
String viewName = "autoform/autoForm-error.vm";
velocityContext.put("message", "表单信息获取失败!");
ViewVelocity.view(request,response,viewName,velocityContext);
}
}else{
String viewName = "autoform/autoForm-error.vm";
velocityContext.put("message", "formName不能为空");
ViewVelocity.view(request,response,viewName,velocityContext);
}
//根据formid查询表单的参数
List<String> paramList = getFormParams(autoForm.getId());
if(paramList!=null&&paramList.size()>0){
for(String param:paramList){
String paramValue = request.getParameter(param);
if(paramValue==null){
String viewName = "autoform/autoForm-error.vm";
velocityContext.put("message", "缺少表单参数:"+param);
ViewVelocity.view(request,response,viewName,velocityContext);
}
}
}
velocityContext.put("formName", autoForm.getFormName());
velocityContext.put("param", paramMap);
//paras = getFormData(autoForm,paramMap);
String ftlContent = autoForm.getFormParse();
// 1.获取表单数据
if(AutoFormTemplateParseUtil.OP_VIEW.equals(op)){
// 2.解析ueditor html 注入数据【预览查看模式】
paras = getFormData(autoForm,paramMap);
ftlContent = AutoFormTemplateParseUtil.parseHtmlForView(ftlContent,paras);
}else if(AutoFormTemplateParseUtil.OP_ADD.equals(op)){
// 2.解析ueditor html 注入数据【添加提交模式】
ftlContent = AutoFormTemplateParseUtil.parseHtmlForAdd(ftlContent,paras);
velocityContext.put("formContent", ftlContent);
velocityContext.put("op", op);
String viewName = "autoform/autoForm-review-add.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}else if(AutoFormTemplateParseUtil.OP_UPDATE.equals(op)){
paras = getFormData(autoForm,paramMap);
String id = request.getParameter("id");
if(StringUtil.isEmpty(id)){
throw new BusinessException("参数id不能为空");
}
// 2.解析ueditor html 注入数据【更新提交模式】
ftlContent = AutoFormTemplateParseUtil.parseHtmlForUpdate(ftlContent,paras);
velocityContext.put("formContent", ftlContent);
velocityContext.put("op", op);
String viewName = "autoform/autoForm-review-update.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}else if(AutoFormTemplateParseUtil.OP_ADD_OR_UPDATE.equals(op)){
paras = getFormData(autoForm,paramMap);
// 2.解析ueditor html 注入数据【智能提交模式】
ftlContent = AutoFormTemplateParseUtil.parseHtmlForAddOrUpdate(ftlContent,paras);
velocityContext.put("formContent", ftlContent);
velocityContext.put("op", op);
String viewName = "autoform/autoForm-review-addorupdate.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
velocityContext.put("formContent", ftlContent);
velocityContext.put("op", op);
String viewName = "autoform/autoForm-review.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
} catch (Exception e) {
e.printStackTrace();
message = "表单添加失败:"+e.getMessage();
}
String viewName = "autoform/autoForm-error.vm";
velocityContext.put("message", message);
ViewVelocity.view(request,response,viewName,velocityContext);
}
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.controller.autoform; package org.jeecgframework.web.autoform.controller;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,15 +6,13 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.velocity.VelocityContext;
import org.jeecgframework.codegenerate.database.JeecgReadTable; import org.jeecgframework.codegenerate.database.JeecgReadTable;
import org.jeecgframework.codegenerate.pojo.Columnt; import org.jeecgframework.codegenerate.pojo.Columnt;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
@ -24,19 +22,19 @@ import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.DynamicDBUtil; import org.jeecgframework.core.util.DynamicDBUtil;
import org.jeecgframework.core.util.LogUtil;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SqlUtil; import org.jeecgframework.core.util.SqlUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.autoform.entity.AutoFormDbEntity;
import org.jeecgframework.web.autoform.entity.AutoFormDbFieldEntity;
import org.jeecgframework.web.autoform.entity.AutoFormDbPage;
import org.jeecgframework.web.autoform.entity.AutoFormParamEntity;
import org.jeecgframework.web.autoform.entity.AutoFormStyleEntity;
import org.jeecgframework.web.autoform.service.AutoFormDbServiceI;
import org.jeecgframework.web.cgform.common.CgAutoListConstant; import org.jeecgframework.web.cgform.common.CgAutoListConstant;
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.pojo.base.DynamicDataSourceEntity;
import org.jeecgframework.web.system.service.DynamicDataSourceServiceI; import org.jeecgframework.web.system.service.DynamicDataSourceServiceI;
import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.web.system.service.SystemService;
@ -49,7 +47,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.sun.mail.handlers.message_rfc822;
/** /**
@ -90,7 +87,7 @@ public class AutoFormDbController extends BaseController {
request.setAttribute("autoFormId", autoFormId); request.setAttribute("autoFormId", autoFormId);
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormDbList"); return new ModelAndView("jeecg/autoform/autoFormDbList");
} }
/** /**
@ -226,20 +223,18 @@ public class AutoFormDbController extends BaseController {
if (StringUtil.isNotEmpty(autoFormDb.getId())) { if (StringUtil.isNotEmpty(autoFormDb.getId())) {
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId()); autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
} }
req.setAttribute("autoFormDbPage", autoFormDb); req.setAttribute("autoFormDbPage", autoFormDb);
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values(); Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys); req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
try { try {
List<String> tableNames = new JeecgReadTable().readAllTableNames(); List<String> tableNames = new JeecgReadTable().readAllTableNames();
req.setAttribute("tableNames", tableNames); req.setAttribute("tableNames", tableNames);
} catch (SQLException e) { } catch (SQLException e) {
logger.info(e.getMessage()); logger.info(e.getMessage());
} }
return new ModelAndView("jeecg/autoform/autoFormDb-add");
return new ModelAndView("jeecg/cgform/autoform/autoFormDb-add");
} }
/** /**
@ -251,7 +246,6 @@ public class AutoFormDbController extends BaseController {
public ModelAndView goUpdate(AutoFormDbEntity autoFormDb, HttpServletRequest req) { public ModelAndView goUpdate(AutoFormDbEntity autoFormDb, HttpServletRequest req) {
if (StringUtil.isNotEmpty(autoFormDb.getId())) { if (StringUtil.isNotEmpty(autoFormDb.getId())) {
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId()); autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
List<String> tableNames = null; List<String> tableNames = null;
if(StringUtils.isNotBlank(autoFormDb.getDbKey()) && "table".equals(autoFormDb.getDbType())){ if(StringUtils.isNotBlank(autoFormDb.getDbKey()) && "table".equals(autoFormDb.getDbType())){
@ -259,10 +253,9 @@ public class AutoFormDbController extends BaseController {
if(dynamicDataSourceEntity!=null){ if(dynamicDataSourceEntity!=null){
tableNames = DynamicDBUtil.findList(autoFormDb.getDbKey(),SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'"+dynamicDataSourceEntity.getDbName()+"'"),String.class); tableNames = DynamicDBUtil.findList(autoFormDb.getDbKey(),SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'"+dynamicDataSourceEntity.getDbName()+"'"),String.class);
} }
} }
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values(); Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys); req.setAttribute("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
@ -274,9 +267,7 @@ public class AutoFormDbController extends BaseController {
//dbKey = autoFormDb.getTbDbKey(); //dbKey = autoFormDb.getTbDbKey();
dbKey = autoFormDb.getDbKey(); dbKey = autoFormDb.getDbKey();
} }
if(StringUtils.isBlank(dbKey)){ if(StringUtils.isBlank(dbKey)){
//默认当前平台数据源 //默认当前平台数据源
try { try {
@ -292,11 +283,10 @@ public class AutoFormDbController extends BaseController {
} }
req.setAttribute("tableNames", tableNames); req.setAttribute("tableNames", tableNames);
req.setAttribute("autoFormDbPage", autoFormDb); req.setAttribute("autoFormDbPage", autoFormDb);
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormDb-update"); return new ModelAndView("jeecg/autoform/autoFormDb-update");
} }
@ -318,7 +308,7 @@ public class AutoFormDbController extends BaseController {
logger.info(e.getMessage()); logger.info(e.getMessage());
} }
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormDbFieldList"); return new ModelAndView("jeecg/autoform/autoFormDbFieldList");
} }
/** /**
* [] * []
@ -338,7 +328,7 @@ public class AutoFormDbController extends BaseController {
logger.info(e.getMessage()); logger.info(e.getMessage());
} }
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormParamList"); return new ModelAndView("jeecg/autoform/autoFormParamList");
} }
/** /**
@ -360,7 +350,6 @@ public class AutoFormDbController extends BaseController {
//params = autoFormDbService.getSqlParams(sql); //params = autoFormDbService.getSqlParams(sql);
files = autoFormDbService.getField(sql,dbKey); files = autoFormDbService.getField(sql,dbKey);
params = autoFormDbService.getSqlParams(sql); params = autoFormDbService.getSqlParams(sql);
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
String errorInfo = "解析失败!<br><br>失败原因:"; String errorInfo = "解析失败!<br><br>失败原因:";
@ -381,8 +370,7 @@ public class AutoFormDbController extends BaseController {
reJson.put("params", params); reJson.put("params", params);
return reJson; return reJson;
} }
//add-begin--Author:luobaoli Date:20150621 for当数据库类型选择为Table时增加表属性列表
/** /**
* [] * []
* *
@ -401,11 +389,9 @@ public class AutoFormDbController extends BaseController {
logger.info(e.getMessage()); logger.info(e.getMessage());
} }
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormDbFieldForTableList"); return new ModelAndView("jeecg/autoform/autoFormDbFieldForTableList");
} }
//add-end--Author:luobaoli Date:20150621 for当数据库类型选择为Table时增加表属性列表
//add-begin--Author:luobaoli Date:20150621 for获取数据源类型对应数据库的所有表
/** /**
* *
* @param db_key * @param db_key
@ -423,7 +409,6 @@ public class AutoFormDbController extends BaseController {
if(dynamicDataSourceEntity!=null){ if(dynamicDataSourceEntity!=null){
tableNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class); tableNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
} }
}else{ }else{
tableNames = new JeecgReadTable().readAllTableNames(); tableNames = new JeecgReadTable().readAllTableNames();
} }
@ -437,9 +422,7 @@ public class AutoFormDbController extends BaseController {
return reJson; return reJson;
} }
//add-end--Author:luobaoli Date:20150621 for获取数据源类型对应数据库的所有表
//add-begin--Author:luobaoli Date:20150621 for获取指定表的所有列
/** /**
* *
* @param sql * @param sql
@ -452,12 +435,10 @@ public class AutoFormDbController extends BaseController {
Map reJson = new HashMap<String, Object>(); Map reJson = new HashMap<String, Object>();
List<String> columnsNames = null; List<String> columnsNames = null;
if(StringUtils.isNotBlank(dbKey)){ if(StringUtils.isNotBlank(dbKey)){
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey); DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
if(dynamicDataSourceEntity!=null){ if(dynamicDataSourceEntity!=null){
columnsNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllCloumnSql(dynamicDataSourceEntity.getDbType(), "'" + tableName + "'", "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class); columnsNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllCloumnSql(dynamicDataSourceEntity.getDbType(), "'" + tableName + "'", "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
} }
}else{ }else{
try { try {
List<Columnt> columns = new JeecgReadTable().readOriginalTableColumn(tableName); List<Columnt> columns = new JeecgReadTable().readOriginalTableColumn(tableName);
@ -477,9 +458,7 @@ public class AutoFormDbController extends BaseController {
return reJson; return reJson;
} }
//add-end--Author:luobaoli Date:20150621 for获取指定表的所有列
//add-begin--Author:luobaoli Date:20150626 for新增数据源展示页面
/** /**
* *
* @param id * @param id
@ -502,11 +481,9 @@ public class AutoFormDbController extends BaseController {
req.setAttribute("autoFormDbEntity", autoFormDbEntity); req.setAttribute("autoFormDbEntity", autoFormDbEntity);
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormDb-view"); return new ModelAndView("jeecg/autoform/autoFormDb-view");
} }
//add-end--Author:luobaoli Date:20150626 for新增数据源展示页面
//add-begin--Author:luobaoli Date:20150626 for新增通过动态SQL或者数据源表动态获取相关数据功能
/** /**
@ -543,7 +520,6 @@ public class AutoFormDbController extends BaseController {
//当前上下文中的DB环境获取数据库表中的所有数据 //当前上下文中的DB环境获取数据库表中的所有数据
map = systemService.findForJdbc(hqlTable.toString()); map = systemService.findForJdbc(hqlTable.toString());
} }
else{ else{
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey); DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
if(dynamicDataSourceEntity!=null){ if(dynamicDataSourceEntity!=null){
@ -584,12 +560,10 @@ public class AutoFormDbController extends BaseController {
map = DynamicDBUtil.findList(tbDbKey,dbDynSql);*/ map = DynamicDBUtil.findList(tbDbKey,dbDynSql);*/
if (StringUtil.isNotEmpty(dbKey)) { if (StringUtil.isNotEmpty(dbKey)) {
map = DynamicDBUtil.findList(dbKey,dbDynSql); map = DynamicDBUtil.findList(dbKey,dbDynSql);
}else{ }else{
map = systemService.findForJdbc(dbDynSql); map = systemService.findForJdbc(dbDynSql);
} }
} }
msg = "动态SQL数据查询成功"; msg = "动态SQL数据查询成功";
j.setObj(map); j.setObj(map);
} catch (Exception e) { } catch (Exception e) {
@ -605,11 +579,6 @@ public class AutoFormDbController extends BaseController {
j.setMsg(msg); j.setMsg(msg);
return j; return j;
} }
//add-end--Author:luobaoli Date:20150626 for新增通过动态SQL或者数据源表动态获取相关数据功能
//add-begin--Author:jg_renjie Date:20150720 for增加数据源名称的唯一性校验
/** /**
* *
@ -639,7 +608,208 @@ public class AutoFormDbController extends BaseController {
return jsonObject; return jsonObject;
} }
//add-end--Author:jg_renjie Date:20150720 for增加数据源名称的唯一性校验
/**
*
*
* @return
*/
@RequestMapping(params = "autoFormDb_vm")
public void autoFormDbVM(HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String autoFormId = request.getParameter("autoFormId");
if(oConvertUtils.isNotEmpty(autoFormId)){
velocityContext.put("autoFormId", autoFormId);
}
String viewName = "autoform/autoFormDbList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd_vm")
public void goAddVM(AutoFormDbEntity autoFormDb, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
}
velocityContext.put("autoFormDbPage", autoFormDb);
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
velocityContext.put("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
try {
List<String> tableNames = new JeecgReadTable().readAllTableNames();
velocityContext.put("tableNames", tableNames);
} catch (SQLException e) {
logger.info(e.getMessage());
}
String viewName = "autoform/autoFormDb-add.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate_vm")
public void goUpdateVM(AutoFormDbEntity autoFormDb, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
autoFormDb = autoFormDbService.getEntity(AutoFormDbEntity.class, autoFormDb.getId());
List<String> tableNames = null;
if(StringUtils.isNotBlank(autoFormDb.getDbKey()) && "table".equals(autoFormDb.getDbType())){
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(autoFormDb.getDbKey());
if(dynamicDataSourceEntity!=null){
tableNames = DynamicDBUtil.findList(autoFormDb.getDbKey(),SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'"+dynamicDataSourceEntity.getDbName()+"'"),String.class);
}
}
Collection<DynamicDataSourceEntity> dynamicDataSourceEntitys = ResourceUtil.dynamicDataSourceMap.values();
velocityContext.put("dynamicDataSourceEntitys", dynamicDataSourceEntitys);
//数据源类型
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.getDbKey();
}
if(StringUtils.isBlank(dbKey)){
//默认当前平台数据源
try {
tableNames = new JeecgReadTable().readAllTableNames();
} catch (SQLException e) {
}
}else{
//个性化配置多数据源
DynamicDataSourceEntity dynamicDataSourceEntity = dynamicDataSourceServiceI.getDynamicDataSourceEntityForDbKey(dbKey);
if(dynamicDataSourceEntity!=null){
tableNames = DynamicDBUtil.findList(dbKey,SqlUtil.getAllTableSql(dynamicDataSourceEntity.getDbType(), "'" + dynamicDataSourceEntity.getDbName() + "'"),String.class);
}
}
velocityContext.put("tableNames", tableNames);
velocityContext.put("autoFormDbPage", autoFormDb);
}
String viewName = "autoform/autoFormDb-update.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
* []
*
* @return
*/
@RequestMapping(params = "autoFormDbFieldList_vm")
public void autoFormDbFieldListVM(AutoFormDbEntity autoFormDb, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
//===================================================================================
//查询-表单数据源属性
String hql0 = "from AutoFormDbFieldEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
try{
List<AutoFormDbFieldEntity> autoFormDbFieldEntityList = systemService.findHql(hql0,autoFormDb.getId());
velocityContext.put("autoFormDbFieldList", autoFormDbFieldEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
}
String viewName = "autoform/autoFormDbFieldList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
* []
*
* @return
*/
@RequestMapping(params = "autoFormParamList_vm")
public void autoFormParamListVM(AutoFormDbEntity autoFormDb, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
//===================================================================================
//查询-表单参数
String hql1 = "from AutoFormParamEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
try{
List<AutoFormParamEntity> autoFormParamEntityList = systemService.findHql(hql1,autoFormDb.getId());
velocityContext.put("autoFormParamList", autoFormParamEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
}
String viewName = "autoform/autoFormParamList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
*
* @param id
* @return
*/
@RequestMapping(params="goView_vm")
public void goViewVM(@RequestParam String id, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if(StringUtil.isNotEmpty(id)){
AutoFormDbEntity autoFormDbEntity = autoFormDbService.getEntity(AutoFormDbEntity.class, id);
if(autoFormDbEntity!=null){
//查询-表单参数
String hql1 = "from AutoFormParamEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
try{
List<AutoFormParamEntity> autoFormParamEntityList = systemService.findHql(hql1,id);
velocityContext.put("autoFormParamList", autoFormParamEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
}
velocityContext.put("autoFormDbEntity", autoFormDbEntity);
}
String viewName = "autoform/autoFormDb-view.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/**
* []
*
* @return
*/
@RequestMapping(params = "autoFormDbFieldForTableList_vm")
public void autoFormDbFieldForTableListVM(AutoFormDbEntity autoFormDb, HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormDb.getId())) {
//===================================================================================
//查询-表单数据源属性
String hql0 = "from AutoFormDbFieldEntity where 1 = 1 AND aUTO_FORM_DB_ID = ? ";
try{
List<AutoFormDbFieldEntity> autoFormDbFieldEntityList = systemService.findHql(hql0,autoFormDb.getId());
velocityContext.put("autoFormDbFieldList", autoFormDbFieldEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
}
String viewName = "autoform/autoFormDbFieldForTableList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
} }

View File

@ -1,34 +1,32 @@
package org.jeecgframework.web.cgform.controller.autoform; package org.jeecgframework.web.autoform.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.apache.velocity.VelocityContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.context.annotation.Scope;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity;
import org.jeecgframework.web.cgform.service.autoform.AutoFormStyleServiceI;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils; import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.autoform.entity.AutoFormStyleEntity;
import org.jeecgframework.web.autoform.service.AutoFormStyleServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -64,7 +62,7 @@ public class AutoFormStyleController extends BaseController {
*/ */
@RequestMapping(params = "autoFormStyle") @RequestMapping(params = "autoFormStyle")
public ModelAndView autoFormStyle(HttpServletRequest request) { public ModelAndView autoFormStyle(HttpServletRequest request) {
return new ModelAndView("jeecg/cgform/autoform/autoFormStyleList"); return new ModelAndView("jeecg/autoform/autoFormStyleList");
} }
/** /**
@ -206,7 +204,7 @@ public class AutoFormStyleController extends BaseController {
autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId()); autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId());
req.setAttribute("autoFormStylePage", autoFormStyle); req.setAttribute("autoFormStylePage", autoFormStyle);
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormStyle-add"); return new ModelAndView("jeecg/autoform/autoFormStyle-add");
} }
/** /**
* *
@ -219,7 +217,7 @@ public class AutoFormStyleController extends BaseController {
autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId()); autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId());
req.setAttribute("autoFormStylePage", autoFormStyle); req.setAttribute("autoFormStylePage", autoFormStyle);
} }
return new ModelAndView("jeecg/cgform/autoform/autoFormStyle-update"); return new ModelAndView("jeecg/autoform/autoFormStyle-update");
} }
@ -330,4 +328,49 @@ public class AutoFormStyleController extends BaseController {
} }
return j; return j;
}*/ }*/
/**
*
*
* @return
*/
@RequestMapping(params = "goAdd_vm")
public void goAddVM(AutoFormStyleEntity autoFormStyle, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormStyle.getId())) {
autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId());
velocityContext.put("autoFormStylePage", autoFormStyle);
}
String viewName = "autoform/autoFormStyle-add.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate_vm")
public void goUpdateVM(AutoFormStyleEntity autoFormStyle, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
if (StringUtil.isNotEmpty(autoFormStyle.getId())) {
autoFormStyle = autoFormStyleService.getEntity(AutoFormStyleEntity.class, autoFormStyle.getId());
velocityContext.put("autoFormStylePage", autoFormStyle);
}
String viewName = "autoform/autoFormStyle-update.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/**
*
*
* @return
*/
@RequestMapping(params = "autoFormStyle_vm")
public void autoFormStyleVM(HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "autoform/autoFormStyleList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -54,9 +54,7 @@ public class AutoFormDbEntity implements java.io.Serializable {
private java.lang.String tbDbKey; private java.lang.String tbDbKey;
/**填报数据表*/ /**填报数据表*/
private java.lang.String tbDbTableName; private java.lang.String tbDbTableName;
private String dbChName; private String dbChName;
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String
@ -312,7 +310,6 @@ public class AutoFormDbEntity implements java.io.Serializable {
this.autoFormId = autoFormId; this.autoFormId = autoFormId;
} }
//add-begin--Author:luobaoli Date:20150620 for增加数据源字段
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String
@ -326,9 +323,7 @@ public class AutoFormDbEntity implements java.io.Serializable {
public void setDbKey(java.lang.String dbKey) { public void setDbKey(java.lang.String dbKey) {
this.dbKey = dbKey; this.dbKey = dbKey;
} }
//add-end--Author:luobaoli Date:20150620 for增加数据源字段
//add-begin--Author: jg_huangxg Date:20150723 for增加填报数据源字段和填报数据表字段
public void setTbDbKey(java.lang.String tbDbKey) { public void setTbDbKey(java.lang.String tbDbKey) {
this.tbDbKey = tbDbKey; this.tbDbKey = tbDbKey;
} }
@ -346,7 +341,6 @@ public class AutoFormDbEntity implements java.io.Serializable {
public java.lang.String getTbDbTableName() { public java.lang.String getTbDbTableName() {
return tbDbTableName; return tbDbTableName;
} }
//add-end--Author: jg_huangxg Date:20150723 for增加填报数据源字段和填报数据表字段
@Column(name ="DB_CH_NAME",nullable=true,length=32) @Column(name ="DB_CH_NAME",nullable=true,length=32)
public String getDbChName() { public String getDbChName() {
@ -356,5 +350,4 @@ public class AutoFormDbEntity implements java.io.Serializable {
public void setDbChName(String dbChName) { public void setDbChName(String dbChName) {
this.dbChName = dbChName; this.dbChName = dbChName;
} }
} }

View File

@ -1,21 +1,12 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
/** /**
@ -53,10 +44,8 @@ public class AutoFormDbFieldEntity implements java.io.Serializable {
/**字段名*/ /**字段名*/
@Excel(name="字段名") @Excel(name="字段名")
private java.lang.String fieldName; private java.lang.String fieldName;
@Excel(name="字段文本") @Excel(name="字段文本")
private String fieldText; private String fieldText;
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String
@ -246,5 +235,4 @@ public class AutoFormDbFieldEntity implements java.io.Serializable {
this.fieldText = fieldText; this.fieldText = fieldText;
} }
} }

View File

@ -1,9 +1,10 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* @Title: Entity * @Title: Entity
* @Description: * @Description:
@ -271,12 +272,12 @@ public class AutoFormDbPage implements java.io.Serializable {
public void setAutoFormId(java.lang.String autoFormId){ public void setAutoFormId(java.lang.String autoFormId){
this.autoFormId = autoFormId; this.autoFormId = autoFormId;
} }
//add-begin--Author:luobaoli Date:20150620 for增加数据源字段
public java.lang.String getDbKey() { public java.lang.String getDbKey() {
return dbKey; return dbKey;
} }
public void setDbKey(java.lang.String dbKey) { public void setDbKey(java.lang.String dbKey) {
this.dbKey = dbKey; this.dbKey = dbKey;
} }
//add-end--Author:luobaoli Date:20150620 for增加数据源字段
} }

View File

@ -1,23 +1,13 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
/** /**
@ -71,9 +61,7 @@ public class AutoFormEntity implements java.io.Serializable {
private java.lang.String dbId; private java.lang.String dbId;
private java.lang.String autoFormId; private java.lang.String autoFormId;
private String mainTableSource; private String mainTableSource;
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String
@ -311,7 +299,6 @@ public class AutoFormEntity implements java.io.Serializable {
public void setAutoFormId(java.lang.String autoFormId) { public void setAutoFormId(java.lang.String autoFormId) {
this.autoFormId = autoFormId; this.autoFormId = autoFormId;
} }
@Column(name ="main_table_source",nullable=true) @Column(name ="main_table_source",nullable=true)
public String getMainTableSource() { public String getMainTableSource() {
return mainTableSource; return mainTableSource;
@ -320,5 +307,4 @@ public class AutoFormEntity implements java.io.Serializable {
public void setMainTableSource(String mainTableSource) { public void setMainTableSource(String mainTableSource) {
this.mainTableSource = mainTableSource; this.mainTableSource = mainTableSource;
} }
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;

View File

@ -1,21 +1,12 @@
package org.jeecgframework.web.cgform.entity.autoform; package org.jeecgframework.web.autoform.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
/** /**

View File

@ -1,10 +1,10 @@
package org.jeecgframework.web.cgform.service.autoform; package org.jeecgframework.web.autoform.service;
import java.util.List; import java.util.List;
import org.jeecgframework.core.common.service.CommonService; import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbFieldEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbFieldEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormParamEntity; import org.jeecgframework.web.autoform.entity.AutoFormParamEntity;
public interface AutoFormDbServiceI extends CommonService{ public interface AutoFormDbServiceI extends CommonService{

View File

@ -1,7 +1,7 @@
package org.jeecgframework.web.cgform.service.autoform; package org.jeecgframework.web.autoform.service;
import org.jeecgframework.core.common.service.CommonService; import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormEntity; import org.jeecgframework.web.autoform.entity.AutoFormEntity;
import org.jeecgframework.web.cgform.exception.BusinessException; import org.jeecgframework.web.cgform.exception.BusinessException;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,7 +1,7 @@
package org.jeecgframework.web.cgform.service.autoform; package org.jeecgframework.web.autoform.service;
import org.jeecgframework.core.common.service.CommonService; import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity; import org.jeecgframework.web.autoform.entity.AutoFormStyleEntity;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.service.impl.autoform; package org.jeecgframework.web.autoform.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -15,10 +15,10 @@ import org.jeecgframework.core.util.DynamicDBUtil;
import org.jeecgframework.core.util.MyBeanUtils; import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.SqlUtil; import org.jeecgframework.core.util.SqlUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbFieldEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbFieldEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormParamEntity; import org.jeecgframework.web.autoform.entity.AutoFormParamEntity;
import org.jeecgframework.web.cgform.service.autoform.AutoFormDbServiceI; import org.jeecgframework.web.autoform.service.AutoFormDbServiceI;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -288,5 +288,4 @@ public class AutoFormDbServiceImpl extends CommonServiceImpl implements AutoForm
} }
return fields; return fields;
} }
} }

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.service.impl.autoform; package org.jeecgframework.web.autoform.service.impl;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -16,11 +16,11 @@ import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.UUIDGenerator; import org.jeecgframework.core.util.UUIDGenerator;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormDbEntity; import org.jeecgframework.web.autoform.entity.AutoFormDbEntity;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormEntity; import org.jeecgframework.web.autoform.entity.AutoFormEntity;
import org.jeecgframework.web.autoform.service.AutoFormServiceI;
import org.jeecgframework.web.autoform.util.AutoFormTemplateParseUtil;
import org.jeecgframework.web.cgform.exception.BusinessException; import org.jeecgframework.web.cgform.exception.BusinessException;
import org.jeecgframework.web.cgform.service.autoform.AutoFormServiceI;
import org.jeecgframework.web.cgform.util.AutoFormTemplateParseUtil;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.jdbc.UncategorizedSQLException; import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -152,7 +152,7 @@ public class AutoFormServiceImpl extends CommonServiceImpl implements AutoFormSe
} }
} }
} }
//add-start--Author:chenchunpeng Date:20160613 for自定义表单设定默认值
/** /**
* *
* @param data * @param data
@ -198,7 +198,7 @@ public class AutoFormServiceImpl extends CommonServiceImpl implements AutoFormSe
data.put(DataBaseConstant.UPDATE_NAME_TABLE, ResourceUtil.getUserSystemData(DataBaseConstant.SYS_USER_NAME)); data.put(DataBaseConstant.UPDATE_NAME_TABLE, ResourceUtil.getUserSystemData(DataBaseConstant.SYS_USER_NAME));
} }
} }
//add-end--Author:chenchunpeng Date:chenchunpeng Date:20160613 for自定义表单设定默认值
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Override @Override
public String doUpdateTable(String formName, public String doUpdateTable(String formName,
@ -232,7 +232,7 @@ public class AutoFormServiceImpl extends CommonServiceImpl implements AutoFormSe
} }
String tbDbTableName = autoFormDbEntity.getTbDbTableName(); String tbDbTableName = autoFormDbEntity.getTbDbTableName();
//系统上下文变量赋值 //系统上下文变量赋值
//add-start--Author:chenchunpeng Date:20160613 for自定义表单设定默认值
Object val=data.get("id"); Object val=data.get("id");
//通过判断id是否有值确定是添加还是修改 //通过判断id是否有值确定是添加还是修改
if(StringUtil.isNotEmpty(val)){ if(StringUtil.isNotEmpty(val)){
@ -240,7 +240,7 @@ public class AutoFormServiceImpl extends CommonServiceImpl implements AutoFormSe
}else{ }else{
fillInsertSysVar(data); fillInsertSysVar(data);
} }
//add-end--Author:chenchunpeng Date:20160613 for自定义表单设定默认值
String id = null; String id = null;
String comma = ""; String comma = "";
StringBuffer updateSqlBuffer = new StringBuffer(); StringBuffer updateSqlBuffer = new StringBuffer();

View File

@ -1,8 +1,8 @@
package org.jeecgframework.web.cgform.service.impl.autoform; package org.jeecgframework.web.autoform.service.impl;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.web.cgform.entity.autoform.AutoFormStyleEntity; import org.jeecgframework.web.autoform.entity.AutoFormStyleEntity;
import org.jeecgframework.web.cgform.service.autoform.AutoFormStyleServiceI; import org.jeecgframework.web.autoform.service.AutoFormStyleServiceI;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.UUID; import java.util.UUID;

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.util; package org.jeecgframework.web.autoform.util;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;

View File

@ -1,4 +1,4 @@
package org.jeecgframework.web.cgform.util; package org.jeecgframework.web.autoform.util;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -479,13 +479,11 @@ public class AutoFormTemplateParseUtil {
if ((i+1) == tdCount)// 最后一列不显示 if ((i+1) == tdCount)// 最后一列不显示
{ {
// if(row == 0){ // if(row == 0){
// tr += "<td></td>"; // tr += "<td></td>";
// } else { // } else {
tr += "<td><button class=\"btn btn-small btn-success delrow\" type=\"button\">删除</button></td>"; tr += "<td><button class=\"btn btn-small btn-success delrow\" type=\"button\">删除</button></td>";
// } // }
} }
if (row == 0)// 统计的行只有一行 if (row == 0)// 统计的行只有一行
@ -493,9 +491,7 @@ public class AutoFormTemplateParseUtil {
// region // region
if(!"1".equals(flag)){ if(!"1".equals(flag)){
if (sum != "") { if (sum != "") {
isExistSum = true; isExistSum = true;
tdSum += MessageFormat tdSum += MessageFormat
.format( .format(
"<td>合计:<input class=\"input-small\" type=\"text\" value=\"value{0}\" name=\"{1}[total]\" {2}\">{3}</td>", "<td>合计:<input class=\"input-small\" type=\"text\" value=\"value{0}\" name=\"{1}[total]\" {2}\">{3}</td>",
@ -524,7 +520,6 @@ public class AutoFormTemplateParseUtil {
temp_html = MessageFormat.format(temp, theader, sbTr.toString(), tdSum); temp_html = MessageFormat.format(temp, theader, sbTr.toString(), tdSum);
String divId = name+"_row_templet"; String divId = name+"_row_templet";
temp_html += "<script type=\"text/javascript\">"; temp_html += "<script type=\"text/javascript\">";
temp_html += "$(function(){"; temp_html += "$(function(){";
temp_html += "$(\"#"+name+"_listAdd\").click(function(){"; temp_html += "$(\"#"+name+"_listAdd\").click(function(){";
@ -543,7 +538,7 @@ public class AutoFormTemplateParseUtil {
//添加删除按钮的方法 //添加删除按钮的方法
temp_html +="$(\".delrow\").click(function(){$(this).parent().parent().remove();"+name+"_resetTrNum();});"; temp_html +="$(\".delrow\").click(function(){$(this).parent().parent().remove();"+name+"_resetTrNum();});";
temp_html += "});"; temp_html += "});";
temp_html +="function "+name+"_resetTrNum() {"; temp_html +="function "+name+"_resetTrNum() {";
temp_html +="$(\"#"+name + "_table tbody tr\").each(function(i) {"; temp_html +="$(\"#"+name + "_table tbody tr\").each(function(i) {";
temp_html +=" $(':input, select,a', this).each(function() {"; temp_html +=" $(':input, select,a', this).each(function() {";
@ -562,7 +557,6 @@ public class AutoFormTemplateParseUtil {
temp_html +="});"; temp_html +="});";
temp_html +="}"; temp_html +="}";
temp_html +="</script>"; temp_html +="</script>";
return temp_html; return temp_html;
} }
@ -766,9 +760,7 @@ public class AutoFormTemplateParseUtil {
// String leipiplugins = (String)atrrMap.get("leipiplugins"); // String leipiplugins = (String)atrrMap.get("leipiplugins");
String orgtype = (String)atrrMap.get("orgtype"); String orgtype = (String)atrrMap.get("orgtype");
String autofield = (String)atrrMap.get("autofield"); String autofield = (String)atrrMap.get("autofield");
String datatype = (String)atrrMap.get("datatype"); String datatype = (String)atrrMap.get("datatype");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
//add by jg_renjie at 20151029 for:自定义单行文本控件实现日历选项及datatype无值时提示错误 //add by jg_renjie at 20151029 for:自定义单行文本控件实现日历选项及datatype无值时提示错误
sb.append("<input "); sb.append("<input ");
@ -789,11 +781,9 @@ public class AutoFormTemplateParseUtil {
sb.append(" title=").append("\"").append(title).append("\""); sb.append(" title=").append("\"").append(title).append("\"");
sb.append(" name=").append("\"").append(name).append("\""); sb.append(" name=").append("\"").append(name).append("\"");
sb.append(" value=").append("\"").append(getSingleValue(autofield,paras)).append("\""); sb.append(" value=").append("\"").append(getSingleValue(autofield,paras)).append("\"");
if(StringUtils.isNotBlank(datatype)){ if(StringUtils.isNotBlank(datatype)){
sb.append(" datatype=").append("\"").append(datatype).append("\""); sb.append(" datatype=").append("\"").append(datatype).append("\"");
} }
sb.append(" />"); sb.append(" />");
html = sb.toString(); html = sb.toString();
return html; return html;

View File

@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.velocity.VelocityContext;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
@ -12,15 +13,17 @@ import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigHeadEntity; import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigHeadEntity;
import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigItemEntity; import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigItemEntity;
import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigParamEntity; import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigParamEntity;
import org.jeecgframework.web.cgdynamgraph.page.core.CgDynamGraphConfigHeadPage; import org.jeecgframework.web.cgdynamgraph.page.core.CgDynamGraphConfigHeadPage;
import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphConfigHeadServiceI; import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphConfigHeadServiceI;
import org.jeecgframework.web.cgreport.entity.core.CgreportConfigHeadEntity;
import org.jeecgframework.web.cgreport.entity.core.CgreportConfigParamEntity;
import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -30,8 +33,8 @@ import org.springframework.web.servlet.ModelAndView;
/** /**
* @Title: Controller * @Title: Controller
* @Description: * @Description: Online
* @author * @author scott
* @date 2016-01-10 16:00:21 * @date 2016-01-10 16:00:21
* @version V1.0 * @version V1.0
* *
@ -60,6 +63,13 @@ public class CgDynamGraphConfigHeadController extends BaseController {
public ModelAndView CgDynamGraphConfigHead(HttpServletRequest request) { public ModelAndView CgDynamGraphConfigHead(HttpServletRequest request) {
return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHeadList"); return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHeadList");
} }
@RequestMapping(params = "cgDynamGraphConfigHeadVM")
public void CgDynamGraphConfigHeadVM(HttpServletResponse response, HttpServletRequest request) throws Exception{
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/cgDynamGraphConfigHeadList.vm";
ViewVelocity.view(request, response, viewName, velocityContext);
}
/** /**
* easyui AJAX * easyui AJAX
@ -200,6 +210,14 @@ public class CgDynamGraphConfigHeadController extends BaseController {
return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHead-add"); return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHead-add");
} }
@RequestMapping(params = "goAdd_vm")
public void goAddVM(HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/cgDynamGraphConfigHead-add.vm";
ViewVelocity.view(request,response,viewName,velocityContext);
}
/** /**
* *
* *
@ -214,6 +232,18 @@ public class CgDynamGraphConfigHeadController extends BaseController {
return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHead-update"); return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigHead-update");
} }
@RequestMapping(params = "goUpdate_vm")
public void goUpdateVM(@RequestParam(required = true, value = "id" ) String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/cgDynamGraphConfigHead-update.vm";
CgDynamGraphConfigHeadEntity cgDynamGraphConfigHead = cgDynamGraphConfigHeadService.getEntity(CgDynamGraphConfigHeadEntity.class, id);
velocityContext.put("cgDynamGraphConfigHeadPage",cgDynamGraphConfigHead);
ViewVelocity.view(request,response,viewName,velocityContext);
}
/** /**
* [] * []
@ -238,6 +268,26 @@ public class CgDynamGraphConfigHeadController extends BaseController {
return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigItemList"); return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigItemList");
} }
@RequestMapping(params = "cgDynamGraphConfigItemList_vm")
public void cgDynamGraphConfigItemListVM(@RequestParam(required = true, value = "id" ) String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/cgDynamGraphConfigItemList.vm";
//===================================================================================
//获取参数
Object id0 = id;
//===================================================================================
//查询-动态报表配置明细
String hql0 = "from CgDynamGraphConfigItemEntity where 1 = 1 AND cgrheadId = ? ";
try{
List<CgDynamGraphConfigItemEntity> cgDynamGraphConfigItemEntityList = systemService.findHql(hql0,id0);
velocityContext.put("cgDynamGraphConfigItemList", cgDynamGraphConfigItemEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
ViewVelocity.view(request,response,viewName,velocityContext);
}
/** /**
* [] * []
* *
@ -261,6 +311,25 @@ public class CgDynamGraphConfigHeadController extends BaseController {
return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigParamList"); return new ModelAndView("jeecg/cgdynamgraph/core/cgDynamGraphConfigParamList");
} }
@RequestMapping(params = "cgDynamGraphConfigParamList_vm")
public void cgDynamGraphConfigParamListVM(@RequestParam(required = true, value = "id" ) String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/cgDynamGraphConfigParamList.vm";
//===================================================================================
//获取参数
Object id0 = id;
//===================================================================================
//查询-动态报表配置明细
String hql0 = "from CgDynamGraphConfigParamEntity where 1 = 1 AND cgrheadId = ? ";
try{
List<CgDynamGraphConfigParamEntity> cgDynamGraphConfigParamEntityList = systemService.findHql(hql0,id0);
velocityContext.put("cgDynamGraphConfigParamList",cgDynamGraphConfigParamEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
ViewVelocity.view(request,response,viewName,velocityContext);
}
@RequestMapping(params = "popmenulink") @RequestMapping(params = "popmenulink")
public ModelAndView popmenulink(ModelMap modelMap, public ModelAndView popmenulink(ModelMap modelMap,
@RequestParam String url, @RequestParam String url,
@ -287,4 +356,33 @@ public class CgDynamGraphConfigHeadController extends BaseController {
modelMap.put("params",sb.toString()); modelMap.put("params",sb.toString());
return new ModelAndView("jeecg/cgreport/core/popmenulink"); return new ModelAndView("jeecg/cgreport/core/popmenulink");
} }
@RequestMapping(params = "popmenulink_vm")
public void popmenulinkVM(@RequestParam String url, @RequestParam String title, HttpServletResponse response, HttpServletRequest request) throws Exception {
VelocityContext velocityContext = new VelocityContext();
String viewName = "cgdynamgraph/popmenulink.vm";
StringBuilder sb = new StringBuilder("");
try{
CgreportConfigHeadEntity cgreportConfigHead = systemService.findUniqueByProperty(CgreportConfigHeadEntity.class, "code", title);
String hql0 = "from CgreportConfigParamEntity where 1 = 1 AND cgrheadId = ? ";
List<CgreportConfigParamEntity> cgreportConfigParamList = systemService.findHql(hql0,cgreportConfigHead.getId());
if(cgreportConfigParamList!=null&cgreportConfigParamList.size()>0){
for(CgreportConfigParamEntity cgreportConfigParam :cgreportConfigParamList){
sb.append("&").append(cgreportConfigParam.getParamName()).append("=");
if(StringUtil.isNotEmpty(cgreportConfigParam.getParamValue())){
sb.append(cgreportConfigParam.getParamValue());
}else{
sb.append("${"+cgreportConfigParam.getParamName()+"}");
}
}
}
}catch(Exception e){
logger.info(e.getMessage());
}
velocityContext.put("title",title);
velocityContext.put("url",url);
velocityContext.put("params",sb.toString());
ViewVelocity.view(request,response,viewName,velocityContext);
}
} }

View File

@ -20,6 +20,10 @@ import org.apache.commons.lang.StringUtils;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.enums.SysThemesEnum; import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.def.CgReportConstant;
import org.jeecgframework.core.online.exception.CgReportNotFoundException;
import org.jeecgframework.core.online.util.CgReportQueryParamUtil;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils; import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.DynamicDBUtil; import org.jeecgframework.core.util.DynamicDBUtil;
import org.jeecgframework.core.util.SqlUtil; import org.jeecgframework.core.util.SqlUtil;
@ -27,11 +31,6 @@ import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.SysThemesUtil; import org.jeecgframework.core.util.SysThemesUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphServiceI; import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphServiceI;
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.engine.FreemarkerHelper;
import org.jeecgframework.web.cgreport.common.CgReportConstant;
import org.jeecgframework.web.cgreport.exception.CgReportNotFoundException;
import org.jeecgframework.web.cgreport.util.CgReportQueryParamUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -40,8 +39,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
/** /**
* *
* @Title:CgReportController * @Title:CgReportController
* @description: * @description: Online
* @author * @author scott
* @date Jul 29, 2013 9:39:40 PM * @date Jul 29, 2013 9:39:40 PM
* @version V1.0 * @version V1.0
*/ */
@ -66,7 +65,7 @@ public class CgDynamGraphController extends BaseController {
//step.3 组合模板+数据参数,进行页面展现 //step.3 组合模板+数据参数,进行页面展现
loadVars(cgDynamGraphMap,request); loadVars(cgDynamGraphMap,request);
String html; String html;
//判断是否为综合类 //判断是否为综合类
Map<String, Object> mainConfig = (Map<String, Object> )cgDynamGraphMap.get(CgReportConstant.MAIN); Map<String, Object> mainConfig = (Map<String, Object> )cgDynamGraphMap.get(CgReportConstant.MAIN);
String defaultGtype =mainConfig.get("graph_type")==null?null:(String)mainConfig.get("graph_type"); String defaultGtype =mainConfig.get("graph_type")==null?null:(String)mainConfig.get("graph_type");
@ -81,7 +80,6 @@ public class CgDynamGraphController extends BaseController {
//设置gtype //设置gtype
html = viewEngine.parseTemplate("/org/jeecgframework/web/cgdynamgraph/engine/core/cgDynamGraphDesignMobile.ftl", cgDynamGraphMap); html = viewEngine.parseTemplate("/org/jeecgframework/web/cgdynamgraph/engine/core/cgDynamGraphDesignMobile.ftl", cgDynamGraphMap);
} }
try { try {
response.setContentType("text/html"); response.setContentType("text/html");
response.setHeader("Cache-Control", "no-store"); response.setHeader("Cache-Control", "no-store");
@ -264,7 +262,6 @@ public class CgDynamGraphController extends BaseController {
} }
} }
//step.4 进行查询返回结果 //step.4 进行查询返回结果
String dbKey=(String)configM.get("db_source"); String dbKey=(String)configM.get("db_source");
List<Map<String, Object>> result=null; List<Map<String, Object>> result=null;
Long size=0l; Long size=0l;
@ -282,7 +279,6 @@ public class CgDynamGraphController extends BaseController {
result= cgDynamGraphService.queryByCgDynamGraphSql(querySql, queryparams); result= cgDynamGraphService.queryByCgDynamGraphSql(querySql, queryparams);
size = cgDynamGraphService.countQueryByCgDynamGraphSql(querySql, queryparams); size = cgDynamGraphService.countQueryByCgDynamGraphSql(querySql, queryparams);
} }
dealDic(result,items); dealDic(result,items);
dealReplace(result,items); dealReplace(result,items);
response.setContentType("application/json"); response.setContentType("application/json");
@ -329,7 +325,6 @@ public class CgDynamGraphController extends BaseController {
}else{ }else{
errorInfo += "SQL语法错误."; errorInfo += "SQL语法错误.";
} }
reJson.put("status", "error"); reJson.put("status", "error");
reJson.put("datas", errorInfo); reJson.put("datas", errorInfo);
return reJson; return reJson;

View File

@ -43,10 +43,9 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
private java.lang.String updateBy; private java.lang.String updateBy;
/**修改人名称*/ /**修改人名称*/
private java.lang.String updateName; private java.lang.String updateName;
/**动态数据源*/ /**动态数据源*/
private String dbSource; private String dbSource;
/**图表类型*/ /**图表类型*/
@ -236,7 +235,6 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
public void setUpdateName(java.lang.String updateName){ public void setUpdateName(java.lang.String updateName){
this.updateName = updateName; this.updateName = updateName;
} }
@Column(name ="db_source",length=36) @Column(name ="db_source",length=36)
public String getDbSource() { public String getDbSource() {
return dbSource; return dbSource;
@ -245,7 +243,6 @@ public class CgDynamGraphConfigHeadEntity implements java.io.Serializable {
public void setDbSource(String dbSource) { public void setDbSource(String dbSource) {
this.dbSource = dbSource; this.dbSource = dbSource;
} }
@Column(name ="graph_type",length=36) @Column(name ="graph_type",length=36)
public String getGraphType() { public String getGraphType() {

View File

@ -55,7 +55,7 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
private java.lang.String cgrSql; private java.lang.String cgrSql;
/**描述*/ /**描述*/
private java.lang.String content; private java.lang.String content;
/**图表类型*/ /**图表类型*/
private String graphType; private String graphType;
/**数据结构类型*/ /**数据结构类型*/
@ -63,7 +63,6 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
/**是否分页*/ /**是否分页*/
private String isPagination; private String isPagination;
/** /**
@ -150,7 +149,6 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
public void setContent(java.lang.String content){ public void setContent(java.lang.String content){
this.content = content; this.content = content;
} }
@Column(name ="graph_type",length=36) @Column(name ="graph_type",length=36)
public String getGraphType() { public String getGraphType() {
return graphType; return graphType;
@ -178,5 +176,4 @@ public class CgDynamGraphConfigHeadPage implements java.io.Serializable {
this.isPagination = isPagination; this.isPagination = isPagination;
} }
} }

View File

@ -10,13 +10,13 @@ import java.util.Set;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao; import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.online.def.CgReportConstant;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.cgdynamgraph.dao.core.CgDynamGraphDao; import org.jeecgframework.web.cgdynamgraph.dao.core.CgDynamGraphDao;
import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigHeadEntity; import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigHeadEntity;
import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigParamEntity; import org.jeecgframework.web.cgdynamgraph.entity.core.CgDynamGraphConfigParamEntity;
import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphServiceI; import org.jeecgframework.web.cgdynamgraph.service.core.CgDynamGraphServiceI;
import org.jeecgframework.web.cgreport.common.CgReportConstant;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@ -157,4 +157,8 @@ public class CgAutoListConstant {
public static final String CODE_JSP_MODE_03 = "03"; public static final String CODE_JSP_MODE_03 = "03";
/** 自定义模板 */ /** 自定义模板 */
public static final String CODE_JSP_MODE_04 = "04"; public static final String CODE_JSP_MODE_04 = "04";
/** online配置表单版本分隔符 */
public static final String ONLINE_TABLE_SPLIT_STR = "__";
} }

View File

@ -50,12 +50,10 @@ public class FormHtmlUtil {
private static String getTextAreaFormHtml( private static String getTextAreaFormHtml(
CgFormFieldEntity cgFormFieldEntity) { CgFormFieldEntity cgFormFieldEntity) {
StringBuilder html = new StringBuilder(""); StringBuilder html = new StringBuilder("");
html.append("<textarea rows=\"6\" "); html.append("<textarea rows=\"6\" ");
if(cgFormFieldEntity.getFieldLength()!=null&&cgFormFieldEntity.getFieldLength()>0){ if(cgFormFieldEntity.getFieldLength()!=null&&cgFormFieldEntity.getFieldLength()>0){
html.append("style=\"width:").append(cgFormFieldEntity.getFieldLength()).append("px\" "); html.append("style=\"width:").append(cgFormFieldEntity.getFieldLength()).append("px\" ");
} }
html.append("id=\"").append(cgFormFieldEntity.getFieldName()).append("\" "); html.append("id=\"").append(cgFormFieldEntity.getFieldName()).append("\" ");
html.append("name=\"").append(cgFormFieldEntity.getFieldName()).append("\" "); html.append("name=\"").append(cgFormFieldEntity.getFieldName()).append("\" ");
if("Y".equals(cgFormFieldEntity.getIsNull())){ if("Y".equals(cgFormFieldEntity.getIsNull())){
@ -165,8 +163,10 @@ public class FormHtmlUtil {
if(StringUtil.isEmpty(cgFormFieldEntity.getDictField())){ if(StringUtil.isEmpty(cgFormFieldEntity.getDictField())){
return getTextFormHtml(cgFormFieldEntity); return getTextFormHtml(cgFormFieldEntity);
}else{ }else{
StringBuilder html = new StringBuilder(""); StringBuilder html = new StringBuilder("");
html.append("<#assign checkboxstr>\\${data['").append(cgFormFieldEntity.getFieldName()).append("']?if_exists?html}</#assign>");
html.append("<#assign checkboxstr>\\${").append(cgFormFieldEntity.getFieldName()).append("?if_exists?html}</#assign>");
html.append("<#assign checkboxlist=checkboxstr?split(\",\")> "); html.append("<#assign checkboxlist=checkboxstr?split(\",\")> ");
html.append("<@DictData name=\""+cgFormFieldEntity.getDictField()+"\""); html.append("<@DictData name=\""+cgFormFieldEntity.getDictField()+"\"");
if(!StringUtil.isEmpty(cgFormFieldEntity.getDictTable())){ if(!StringUtil.isEmpty(cgFormFieldEntity.getDictTable())){
@ -280,18 +280,49 @@ public class FormHtmlUtil {
/** /**
*filehtml *filehtml
*/ */
private static String getFileFormHtml(CgFormFieldEntity cgFormFieldEntity) private static String getFileFormHtml(CgFormFieldEntity cgFormFieldEntity){
{ StringBuilder html = new StringBuilder("");
StringBuilder html = new StringBuilder("");
html.append("<input type=\"text\" "); html.append("<link rel=\"stylesheet\" href=\"plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
html.append("id=\"").append(cgFormFieldEntity.getFieldName()).append("\" "); html.append("<script type=\"text/javascript\" src=\"plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
html.append("name=\"").append(cgFormFieldEntity.getFieldName()).append("\" ");
if(cgFormFieldEntity.getFieldLength()!=null&&cgFormFieldEntity.getFieldLength()>0){ html.append("<table>");
html.append("style=\"width:").append(cgFormFieldEntity.getFieldLength()).append("px\" "); html.append("<#list filesList as fileB>");
} html.append("<tr style=\"height:34px;\">");
html.append("value=\"\\${").append(cgFormFieldEntity.getFieldName()).append("?if_exists?html}\" "); html.append("<td>\\${fileB['title']}</td>");
html.append("\\/>"); html.append("<td><a href=\"commonController.do?viewFile&fileid=\\${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity\" title=\"下载\">下载</a></td>");
return html.toString(); html.append("<td><a href=\"javascript:void(0);\" onclick=\"openwindow('预览','commonController.do?openViewFile&fileid=\\${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)\">预览</a></td>");
html.append("<td><a href=\"javascript:void(0)\" class=\"jeecgDetail\" onclick=\"del('cgUploadController.do?delFile&id=\\${fileB['fileKey']}',this)\">删除</a></td>");
html.append("</tr></#list></table>");
html.append("<div class=\"form jeecgDetail\">");
html.append("<script type=\"text/javascript\">");
html.append("var serverMsg=\"\";");
html.append("var m = new Map();");
html.append("\\$(function(){\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify(");
html.append("{buttonText:'添加文件',auto:false,progressData:'speed',multi:true,height:25,overrideEvents:['onDialogClose'],fileTypeDesc:'文件格式:',");
html.append("queueID:'filediv_").append(cgFormFieldEntity.getFieldName()).append("',");
html.append("fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png',");
html.append("fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',");
html.append("uploader:'cgUploadController.do?saveFiles&jsessionid='+\\$(\"#sessionUID\").val()+'',");
html.append("onUploadStart : function(file) { ");
html.append("var cgFormId=\\$(\"input[name='id']\").val();");
html.append("\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify(\"settings\", \"formData\", {'cgFormId':cgFormId,'cgFormName':'").append(cgFormFieldEntity.getTable().getTableName()).append("','cgFormField':'").append(cgFormFieldEntity.getFieldName()).append("'});} ,");
html.append("onQueueComplete : function(queueData) {var win = frameElement.api.opener;win.reloadTable();win.tip(serverMsg);frameElement.api.close();},");
html.append("onUploadSuccess : function(file, data, response) {var d=\\$.parseJSON(data);if(d.success){var win = frameElement.api.opener;serverMsg = d.msg;}},onFallback : function(){tip(\"您未安装FLASH控件无法上传图片请安装FLASH控件后再试\")},onSelectError : function(file, errorCode, errorMsg){switch(errorCode) {case -100:tip(\"上传的文件数量已经超出系统限制的\"+\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('settings','queueSizeLimit')+\"个文件!\");break;case -110:tip(\"文件 [\"+file.name+\"] 大小超出系统限制的\"+\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('settings','fileSizeLimit')+\"大小!\");break;case -120:tip(\"文件 [\"+file.name+\"] 大小异常!\");break;case -130:tip(\"文件 [\"+file.name+\"] 类型不正确!\");break;}},");
html.append("onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});");
html.append("</script><span id=\"file_uploadspan\"><input type=\"file\" name=\"").append(cgFormFieldEntity.getFieldName()).append("\" id=\"").append(cgFormFieldEntity.getFieldName()).append("\" /></span>");
html.append("</div><div class=\"form\" id=\"filediv_").append(cgFormFieldEntity.getFieldName()).append("\"> </div>");
html.append("<script type=\"text/javascript\">");
html.append("function uploadFile(data){");
html.append("if(!\\$(\"input[name='id']\").val()){");
html.append("if(data.obj != null && data.obj != 'undefined'){\\$(\"input[name='id']\").val(data.obj.id);}}");
html.append("if(\\$(\".uploadify-queue-item\").length > 0){upload();}else{if (neibuClickFlag){alert(data.msg); neibuClickFlag = false;}else {var win = frameElement.api.opener; win.reloadTable(); win.tip(data.msg); frameElement.api.close();}}}");
html.append("function upload() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('upload', '\\*');}");
html.append("function cancel() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('cancel', '\\*');}");
html.append("var neibuClickFlag = false;function neibuClick() {neibuClickFlag = true;\\$('#btn_sub').trigger('click');}");
html.append("</script>");
return html.toString();
} }

View File

@ -19,10 +19,12 @@
<property name="tags"> <property name="tags">
<map> <map>
<entry key="DictData" value-ref="dictDataTag" /> <entry key="DictData" value-ref="dictDataTag" />
<entry key="mutiLang" value-ref="mutiLangTag" />
</map> </map>
</property> </property>
</bean> </bean>
<!-- update begin online代码生成器支持 自定义word改造 -->
<!-- FreeMarker 自定义word代码生成器 --> <!-- FreeMarker 自定义word代码生成器 -->
<bean id="freemarkerWord" class="freemarker.template.Configuration"> <bean id="freemarkerWord" class="freemarker.template.Configuration">
<property name="templateLoader" ref="templetLoaderWord" /> <property name="templateLoader" ref="templetLoaderWord" />
@ -38,6 +40,7 @@
</map> </map>
</property> </property>
</bean> </bean>
<!-- update end online代码生成器支持 自定义word改造 -->
<!-- 拦截器 --> <!-- 拦截器 -->
<mvc:interceptors> <mvc:interceptors>

View File

@ -14,7 +14,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.jeecgframework.web.cgform.common.CgAutoListConstant; import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.engine.FreemarkerHelper;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity; import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity; import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity; import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity;
@ -22,6 +21,7 @@ import org.jeecgframework.web.cgform.service.autolist.CgTableServiceI;
import org.jeecgframework.web.cgform.service.autolist.ConfigServiceI; import org.jeecgframework.web.cgform.service.autolist.ConfigServiceI;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI; import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI; import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI;
import org.jeecgframework.web.cgform.util.PublicUtil;
import org.jeecgframework.web.cgform.util.QueryParamUtil; import org.jeecgframework.web.cgform.util.QueryParamUtil;
import org.jeecgframework.web.cgform.util.TemplateUtil; import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.jeecgframework.web.system.pojo.base.DictEntity; import org.jeecgframework.web.system.pojo.base.DictEntity;
@ -34,6 +34,7 @@ import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.SysThemesEnum; import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils; import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.JeecgDataAutorUtils; import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.MutiLangUtil; import org.jeecgframework.core.util.MutiLangUtil;
@ -87,11 +88,9 @@ public class CgAutoListController extends BaseController{
//step.3 封装页面数据 //step.3 封装页面数据
loadVars(configs,paras,request); loadVars(configs,paras,request);
//step.4 组合模板+数据参数,进行页面展现 //step.4 组合模板+数据参数,进行页面展现
String template=request.getParameter("olstylecode"); String template=request.getParameter("olstylecode");
if(StringUtils.isBlank(template)){ if(StringUtils.isBlank(template)){
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id); CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id);
template=head.getFormTemplate(); template=head.getFormTemplate();
paras.put("_olstylecode",""); paras.put("_olstylecode","");
}else{ }else{
@ -100,7 +99,6 @@ public class CgAutoListController extends BaseController{
paras.put("this_olstylecode",template); paras.put("this_olstylecode",template);
CgformTemplateEntity entity=cgformTemplateService.findByCode(template); CgformTemplateEntity entity=cgformTemplateService.findByCode(template);
String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, TemplateUtil.TemplateType.LIST), paras); String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, TemplateUtil.TemplateType.LIST), paras);
PrintWriter writer = null; PrintWriter writer = null;
try { try {
response.setContentType("text/html"); response.setContentType("text/html");
@ -140,6 +138,7 @@ public class CgAutoListController extends BaseController{
String jversion = cgFormFieldService.getCgFormVersionByTableName(configId); String jversion = cgFormFieldService.getCgFormVersionByTableName(configId);
Map<String, Object> configs = configService.queryConfigs(configId,jversion); Map<String, Object> configs = configService.queryConfigs(configId,jversion);
String table = (String) configs.get(CgAutoListConstant.TABLENAME); String table = (String) configs.get(CgAutoListConstant.TABLENAME);
table = PublicUtil.replaceTableName(table);
Map params = new HashMap<String,Object>(); Map params = new HashMap<String,Object>();
//step.2 获取查询条件以及值 //step.2 获取查询条件以及值
List<CgFormFieldEntity> beans = (List<CgFormFieldEntity>) configs.get(CgAutoListConstant.FILEDS); List<CgFormFieldEntity> beans = (List<CgFormFieldEntity>) configs.get(CgAutoListConstant.FILEDS);
@ -148,7 +147,7 @@ public class CgAutoListController extends BaseController{
QueryParamUtil.loadQueryParams(request,b,params); QueryParamUtil.loadQueryParams(request,b,params);
fieldMap.put(b.getFieldName(), new String[]{b.getType(), b.getFieldDefault()}); fieldMap.put(b.getFieldName(), new String[]{b.getType(), b.getFieldDefault()});
} }
//参数处理 //参数处理
boolean isTree = configs.get(CgAutoListConstant.CONFIG_ISTREE) == null ? false boolean isTree = configs.get(CgAutoListConstant.CONFIG_ISTREE) == null ? false
: CgAutoListConstant.BOOL_TRUE.equalsIgnoreCase(configs.get(CgAutoListConstant.CONFIG_ISTREE).toString()); : CgAutoListConstant.BOOL_TRUE.equalsIgnoreCase(configs.get(CgAutoListConstant.CONFIG_ISTREE).toString());
@ -176,7 +175,6 @@ public class CgAutoListController extends BaseController{
params.put(parentIdFieldName, "=" + treeId); params.put(parentIdFieldName, "=" + treeId);
} }
} }
int p = page==null?1:Integer.parseInt(page); int p = page==null?1:Integer.parseInt(page);
int r = rows==null?99999:Integer.parseInt(rows); int r = rows==null?99999:Integer.parseInt(rows);
@ -195,7 +193,6 @@ public class CgAutoListController extends BaseController{
cgTableService.treeFromResultHandle(table, parentIdFieldName, parentIdFieldType, cgTableService.treeFromResultHandle(table, parentIdFieldName, parentIdFieldType,
result); result);
} }
//处理页面中若存在checkbox只能显示code值而不能显示text值问题 //处理页面中若存在checkbox只能显示code值而不能显示text值问题
Map<String, Object> dicMap = new HashMap<String, Object>(); Map<String, Object> dicMap = new HashMap<String, Object>();
@ -238,7 +235,6 @@ public class CgAutoListController extends BaseController{
}else { }else {
writer.println(QueryParamUtil.getJson(result,size)); writer.println(QueryParamUtil.getJson(result,size));
} }
writer.flush(); writer.flush();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -281,9 +277,7 @@ public class CgAutoListController extends BaseController{
// } // }
for(DictEntity dictEntity:dicDataList){ for(DictEntity dictEntity:dicDataList){
if(value.equalsIgnoreCase(dictEntity.getTypecode())){ if(value.equalsIgnoreCase(dictEntity.getTypecode())){
r.put(bean.getFieldName(),MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename())); r.put(bean.getFieldName(),MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename()));
} }
} }
} }
@ -304,8 +298,11 @@ public class CgAutoListController extends BaseController{
public AjaxJson del(String configId,String id, public AjaxJson del(String configId,String id,
HttpServletRequest request) { HttpServletRequest request) {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
String jversion = cgFormFieldService.getCgFormVersionByTableName(configId); String tableName = PublicUtil.replaceTableName(configId);
String table = (String) configService.queryConfigs(configId,jversion).get(CgAutoListConstant.TABLENAME); String jversion = cgFormFieldService.getCgFormVersionByTableName(tableName);
String table = (String) configService.queryConfigs(tableName,jversion).get(CgAutoListConstant.TABLENAME);
//String jversion = cgFormFieldService.getCgFormVersionByTableName(configId);
//String table = (String) configService.queryConfigs(configId,jversion).get(CgAutoListConstant.TABLENAME);
cgTableService.delete(table, id); cgTableService.delete(table, id);
String message = "删除成功"; String message = "删除成功";
systemService.addLog(message, Globals.Log_Type_DEL, systemService.addLog(message, Globals.Log_Type_DEL,
@ -354,7 +351,6 @@ public class CgAutoListController extends BaseController{
List<Map> queryList = new ArrayList<Map>(); List<Map> queryList = new ArrayList<Map>();
StringBuilder fileds = new StringBuilder(); StringBuilder fileds = new StringBuilder();
StringBuilder initQuery = new StringBuilder(); StringBuilder initQuery = new StringBuilder();
Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES); Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES);
Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>(); Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>();
if(operationCodes != null){ if(operationCodes != null){
@ -370,7 +366,6 @@ public class CgAutoListController extends BaseController{
if(operationCodesMap.containsKey(bean.getFieldName())) { if(operationCodesMap.containsKey(bean.getFieldName())) {
continue; continue;
} }
Map fm = new HashMap<String, Object>(); Map fm = new HashMap<String, Object>();
fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName()); fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName());
fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent()); fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent());
@ -638,7 +633,7 @@ public class CgAutoListController extends BaseController{
sysVarName = sysVarName.replaceAll("\\{", ""); sysVarName = sysVarName.replaceAll("\\{", "");
sysVarName = sysVarName.replaceAll("\\}", ""); sysVarName = sysVarName.replaceAll("\\}", "");
sysVarName =sysVarName.replace("sys.", ""); sysVarName =sysVarName.replace("sys.", "");
//---author:jg_xugj----start-----date:20151226--------for#814 【数据权限】扩展支持写表达式通过session取值
return ResourceUtil.converRuleValue(sysVarName); return ResourceUtil.converRuleValue(sysVarName);
}else{ }else{
return sysVarName; return sysVarName;

View File

@ -13,7 +13,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.jeecgframework.web.cgform.common.CgAutoListConstant; import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.engine.FreemarkerHelper;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity; import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity; import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity; import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity;
@ -30,6 +29,7 @@ import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.SysThemesEnum; import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils; import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
@ -79,10 +79,8 @@ public class CgAutoListRestController extends BaseController{
loadVars(configs,paras,request); loadVars(configs,paras,request);
//step.4 组合模板+数据参数,进行页面展现 //step.4 组合模板+数据参数,进行页面展现
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id); CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(id);
CgformTemplateEntity entity=cgformTemplateService.findByCode(head.getFormTemplate()); CgformTemplateEntity entity=cgformTemplateService.findByCode(head.getFormTemplate());
String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity, 0, TemplateUtil.TemplateType.LIST), paras); String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity, 0, TemplateUtil.TemplateType.LIST), paras);
PrintWriter writer = null; PrintWriter writer = null;
try { try {
response.setContentType("text/html"); response.setContentType("text/html");
@ -161,7 +159,6 @@ public class CgAutoListRestController extends BaseController{
List<Map> queryList = new ArrayList<Map>(); List<Map> queryList = new ArrayList<Map>();
StringBuilder fileds = new StringBuilder(); StringBuilder fileds = new StringBuilder();
StringBuilder initQuery = new StringBuilder(); StringBuilder initQuery = new StringBuilder();
Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES); Set<String> operationCodes = (Set<String>) request.getAttribute(Globals.OPERATIONCODES);
Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>(); Map<String,TSOperation> operationCodesMap = new HashMap<String, TSOperation>();
if(operationCodes != null){ if(operationCodes != null){
@ -177,7 +174,6 @@ public class CgAutoListRestController extends BaseController{
if(operationCodesMap.containsKey(bean.getFieldName())) { if(operationCodesMap.containsKey(bean.getFieldName())) {
continue; continue;
} }
Map fm = new HashMap<String, Object>(); Map fm = new HashMap<String, Object>();
fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName()); fm.put(CgAutoListConstant.FILED_ID, bean.getFieldName());
fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent()); fm.put(CgAutoListConstant.FIELD_TITLE, bean.getContent());
@ -445,7 +441,7 @@ public class CgAutoListRestController extends BaseController{
sysVarName = sysVarName.replaceAll("\\{", ""); sysVarName = sysVarName.replaceAll("\\{", "");
sysVarName = sysVarName.replaceAll("\\}", ""); sysVarName = sysVarName.replaceAll("\\}", "");
sysVarName =sysVarName.replace("sys.", ""); sysVarName =sysVarName.replace("sys.", "");
//---author:jg_xugj----start-----date:20151226--------for#814 【数据权限】扩展支持写表达式通过session取值
return ResourceUtil.converRuleValue(sysVarName); return ResourceUtil.converRuleValue(sysVarName);
}else{ }else{

View File

@ -18,6 +18,7 @@ import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.enums.SysThemesEnum; import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ApplicationContextUtil; import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.ContextHolderUtils; import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.LogUtil; import org.jeecgframework.core.util.LogUtil;
@ -26,7 +27,6 @@ import org.jeecgframework.core.util.SysThemesUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.cgform.common.CgAutoListConstant; import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.common.CommUtils; import org.jeecgframework.web.cgform.common.CommUtils;
import org.jeecgframework.web.cgform.engine.FreemarkerHelper;
import org.jeecgframework.web.cgform.engine.TempletContext; import org.jeecgframework.web.cgform.engine.TempletContext;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity; import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity; import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity;
@ -35,9 +35,9 @@ import org.jeecgframework.web.cgform.exception.BusinessException;
import org.jeecgframework.web.cgform.service.build.DataBaseService; import org.jeecgframework.web.cgform.service.build.DataBaseService;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI; import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI; import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI;
import org.jeecgframework.web.cgform.util.PublicUtil;
import org.jeecgframework.web.cgform.util.TemplateUtil; import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -77,8 +77,6 @@ public class CgFormBuildController extends BaseController {
ftlForm(request,response); ftlForm(request,response);
} }
//add-start--Author:scott Date:20160301 foronline表单移动样式单独配置
/** /**
* Online访 * Online访
*/ */
@ -95,7 +93,7 @@ public class CgFormBuildController extends BaseController {
} }
ftlForm(request,response); ftlForm(request,response);
} }
//add-end--Author:scott Date:20160301 foronline表单移动样式单独配置
/** /**
* form * form
@ -108,10 +106,10 @@ public class CgFormBuildController extends BaseController {
String tableName =request.getParameter("tableName"); String tableName =request.getParameter("tableName");
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
String id = request.getParameter("id"); String id = request.getParameter("id");
String mode=request.getParameter("mode"); String mode=request.getParameter("mode");
String templateName=tableName+"_"; String tablename = PublicUtil.replaceTableName(tableName);
String templateName=tablename+"_";
//String templateName=tableName+"_";
TemplateUtil.TemplateType templateType=TemplateUtil.TemplateType.LIST; TemplateUtil.TemplateType templateType=TemplateUtil.TemplateType.LIST;
if(StringUtils.isBlank(id)){ if(StringUtils.isBlank(id)){
templateName+=TemplateUtil.TemplateType.ADD.getName(); templateName+=TemplateUtil.TemplateType.ADD.getName();
@ -132,9 +130,9 @@ public class CgFormBuildController extends BaseController {
CgFormHeadEntity head = (CgFormHeadEntity)data.get("head"); CgFormHeadEntity head = (CgFormHeadEntity)data.get("head");
Map<String, Object> dataForm = new HashMap<String, Object>(); Map<String, Object> dataForm = new HashMap<String, Object>();
if(StringUtils.isNotEmpty(id)){ if(StringUtils.isNotEmpty(id)){
dataForm = dataBaseService.findOneForJdbc(tableName, id); dataForm = dataBaseService.findOneForJdbc(tablename, id);
//dataForm = dataBaseService.findOneForJdbc(tableName, id);
} }
Iterator it=dataForm.entrySet().iterator(); Iterator it=dataForm.entrySet().iterator();
while(it.hasNext()){ while(it.hasNext()){
Map.Entry entry=(Map.Entry)it.next(); Map.Entry entry=(Map.Entry)it.next();
@ -142,10 +140,10 @@ public class CgFormBuildController extends BaseController {
Object ov=entry.getValue(); Object ov=entry.getValue();
data.put(ok, ov); data.put(ok, ov);
} }
Map<String, Object> tableData = new HashMap<String, Object>(); Map<String, Object> tableData = new HashMap<String, Object>();
//获取主表或单表表单数据 //获取主表或单表表单数据
tableData.put(tableName, dataForm); tableData.put(tablename, dataForm);
//tableData.put(tableName, dataForm);
//获取附表表表单数据 //获取附表表表单数据
if(StringUtils.isNotEmpty(id)){ if(StringUtils.isNotEmpty(id)){
if(head.getJformType()==CgAutoListConstant.JFORM_TYPE_MAIN_TALBE){ if(head.getJformType()==CgAutoListConstant.JFORM_TYPE_MAIN_TALBE){
@ -163,9 +161,7 @@ public class CgFormBuildController extends BaseController {
//装载单表/(主表和附表)表单数据 //装载单表/(主表和附表)表单数据
data.put("data", tableData); data.put("data", tableData);
data.put("id", id); data.put("id", id);
data.put("head", head); data.put("head", head);
//页面样式js引用 //页面样式js引用
data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request)); data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request));
@ -174,13 +170,10 @@ public class CgFormBuildController extends BaseController {
pushImages(data, id); pushImages(data, id);
String content =null; String content =null;
response.setContentType("text/html;charset=utf-8"); response.setContentType("text/html;charset=utf-8");
String urlTemplateName = request.getParameter("olstylecode"); String urlTemplateName = request.getParameter("olstylecode");
if(oConvertUtils.isEmpty(urlTemplateName)){ if(oConvertUtils.isEmpty(urlTemplateName)){
urlTemplateName = (String) request.getAttribute("olstylecode"); urlTemplateName = (String) request.getAttribute("olstylecode");
} }
if(StringUtils.isNotBlank(urlTemplateName)){ if(StringUtils.isNotBlank(urlTemplateName)){
data.put("this_olstylecode",urlTemplateName); data.put("this_olstylecode",urlTemplateName);
@ -191,7 +184,6 @@ public class CgFormBuildController extends BaseController {
LogUtil.debug("-------------formTemplate-----------"+head.getFormTemplate()); LogUtil.debug("-------------formTemplate-----------"+head.getFormTemplate());
content=getTableTemplate(templateName,request,data); content=getTableTemplate(templateName,request,data);
} }
response.getWriter().print(content); response.getWriter().print(content);
response.getWriter().flush(); response.getWriter().flush();
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
@ -207,7 +199,7 @@ public class CgFormBuildController extends BaseController {
} }
} }
/** /**
* url * url
* @param templateName * @param templateName
@ -220,9 +212,7 @@ public class CgFormBuildController extends BaseController {
CgformTemplateEntity entity=cgformTemplateService.findByCode(templateName); CgformTemplateEntity entity=cgformTemplateService.findByCode(templateName);
if(entity!=null){ if(entity!=null){
FreemarkerHelper viewEngine = new FreemarkerHelper(); FreemarkerHelper viewEngine = new FreemarkerHelper();
dataMap.put("DictData", ApplicationContextUtil.getContext().getBean("dictDataTag")); dataMap.put("DictData", ApplicationContextUtil.getContext().getBean("dictDataTag"));
content = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, templateType), dataMap); content = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, templateType), dataMap);
} }
return content; return content;
@ -244,11 +234,9 @@ public class CgFormBuildController extends BaseController {
Template template = templetContext.getTemplate(templateName, ftlVersion); Template template = templetContext.getTemplate(templateName, ftlVersion);
try { try {
template.setDateTimeFormat("yyyy-MM-dd HH:mm:ss"); template.setDateTimeFormat("yyyy-MM-dd HH:mm:ss");
template.setDateFormat("yyyy-MM-dd"); template.setDateFormat("yyyy-MM-dd");
template.setTimeFormat("HH:mm:ss"); template.setTimeFormat("HH:mm:ss");
template.process(data, writer); template.process(data, writer);
} catch (TemplateException e) { } catch (TemplateException e) {
e.printStackTrace(); e.printStackTrace();
@ -257,7 +245,6 @@ public class CgFormBuildController extends BaseController {
} }
return stringWriter.toString(); return stringWriter.toString();
} }
private String getHtmlHead(HttpServletRequest request){ private String getHtmlHead(HttpServletRequest request){
HttpSession session = ContextHolderUtils.getSession(); HttpSession session = ContextHolderUtils.getSession();
String lang = (String)session.getAttribute("lang"); String lang = (String)session.getAttribute("lang");
@ -346,7 +333,6 @@ public class CgFormBuildController extends BaseController {
} }
data.put("imageList", images); data.put("imageList", images);
} }
/** /**
* *
* *
@ -515,7 +501,6 @@ public class CgFormBuildController extends BaseController {
dataBaseService.executeSqlExtend(formId, buttonCode, data); dataBaseService.executeSqlExtend(formId, buttonCode, data);
dataBaseService.executeJavaExtend(formId, buttonCode, data); dataBaseService.executeJavaExtend(formId, buttonCode, data);
} }
j.setSuccess(true); j.setSuccess(true);
message = "操作成功"; message = "操作成功";

View File

@ -73,7 +73,6 @@ public class CgFormBuildRestController extends BaseController {
try { try {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
String tableName = configId; String tableName = configId;
String mode=request.getParameter("mode"); String mode=request.getParameter("mode");
String templateName=tableName+"_"; String templateName=tableName+"_";
if(StringUtils.isBlank(id)){ if(StringUtils.isBlank(id)){
@ -86,7 +85,6 @@ public class CgFormBuildRestController extends BaseController {
String ftlVersion =request.getParameter("ftlVersion"); String ftlVersion =request.getParameter("ftlVersion");
Template template = templetContext.getTemplate(templateName, ftlVersion); Template template = templetContext.getTemplate(templateName, ftlVersion);
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
BufferedWriter writer = new BufferedWriter(stringWriter); BufferedWriter writer = new BufferedWriter(stringWriter);
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
@ -128,9 +126,7 @@ public class CgFormBuildRestController extends BaseController {
//装载单表/(主表和附表)表单数据 //装载单表/(主表和附表)表单数据
data.put("data", tableData); data.put("data", tableData);
data.put("id", id); data.put("id", id);
data.put("head", head); data.put("head", head);
//页面样式js引用 //页面样式js引用
data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request)); data.put(CgAutoListConstant.CONFIG_IFRAME, getHtmlHead(request));

View File

@ -8,16 +8,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.jeecgframework.web.cgform.common.OfficeHtmlUtil;
import org.jeecgframework.web.cgform.entity.cgformftl.CgformFtlEntity;
import org.jeecgframework.web.cgform.service.cgformftl.CgformFtlServiceI;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
@ -36,8 +28,14 @@ import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils; import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.common.OfficeHtmlUtil;
import org.jeecgframework.web.cgform.engine.TempletContext;
import org.jeecgframework.web.cgform.entity.cgformftl.CgformFtlEntity;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
import org.jeecgframework.web.cgform.service.cgformftl.CgformFtlServiceI;
import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -70,7 +68,7 @@ public class CgformFtlController extends BaseController {
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private CgFormFieldServiceI cgFormFieldService; private TempletContext templetContext;
/** /**
@ -191,14 +189,16 @@ public class CgformFtlController extends BaseController {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
try { try {
// 判断有没有激活过的模板 // 判断有没有激活过的模板
cgformFtl = systemService.getEntity(CgformFtlEntity.class, cgformFtl = systemService.getEntity(CgformFtlEntity.class,cgformFtl.getId());
cgformFtl.getId());
if (!cgformFtlService.hasActive(cgformFtl.getCgformId())) { if (!cgformFtlService.hasActive(cgformFtl.getCgformId())) {
cgformFtl.setFtlStatus("1"); cgformFtl.setFtlStatus("1");
cgformFtlService.saveOrUpdate(cgformFtl); cgformFtlService.saveOrUpdate(cgformFtl);
message = "激活成功"; message = "激活成功";
systemService.addLog(message, Globals.Log_Type_UPDATE, CgFormHeadEntity po = systemService.getEntity(CgFormHeadEntity.class, cgformFtl.getCgformId());
Globals.Log_Leavel_INFO); templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.ADD.getName());
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.DETAIL.getName());
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.UPDATE.getName());
systemService.addLog(message, Globals.Log_Type_UPDATE,Globals.Log_Leavel_INFO);
j.setSuccess(true); j.setSuccess(true);
j.setMsg(message); j.setMsg(message);
} else { } else {
@ -227,8 +227,11 @@ public class CgformFtlController extends BaseController {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
try { try {
cgformFtl = systemService.getEntity(CgformFtlEntity.class, cgformFtl = systemService.getEntity(CgformFtlEntity.class,cgformFtl.getId());
cgformFtl.getId()); CgFormHeadEntity po = systemService.getEntity(CgFormHeadEntity.class, cgformFtl.getCgformId());
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.ADD.getName());
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.DETAIL.getName());
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.UPDATE.getName());
cgformFtl.setFtlStatus("0"); cgformFtl.setFtlStatus("0");
cgformFtlService.saveOrUpdate(cgformFtl); cgformFtlService.saveOrUpdate(cgformFtl);
message = "取消激活成功"; message = "取消激活成功";
@ -318,16 +321,20 @@ public class CgformFtlController extends BaseController {
sb.append("src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script><script type=\"text/javascript\" "); sb.append("src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script><script type=\"text/javascript\" ");
sb.append("src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script><script type=\"text/javascript\" "); sb.append("src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script><script type=\"text/javascript\" ");
sb.append("src=\"plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>"); sb.append("src=\"plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>");
sb.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:4,"); //表单提交 js
sb.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:1,");
sb.append("btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:"); sb.append("btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:");
sb.append("{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next()."); sb.append("{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().");
sb.append("find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}"); sb.append("find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}");
sb.append("else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\")"); sb.append("else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\")");
sb.append(".hide();}}}},callback:function(data){if(data.success"); sb.append(".hide();}}}},callback:function(data){if(data.success");
sb.append("==true){if(!neibuClickFlag){var win = frameElement.api.opener;frameElement.api.close();win.tip(data.msg);win.reloadTable();}else {alert(data.msg)}}else{if(data.responseText==''||"); sb.append("==true) {uploadFile(data);}else{ if (data.responseText == '' || data.responseText == undefined) {");
sb.append("data.responseText==undefined)$(\"#formobj\").html(data.msg);else $(\"#formobj\")"); sb.append(" $.messager.alert('错误', data.msg); $.Hidemsg();} else {");
sb.append(".html(data.responseText); return false;}if(!neibuClickFlag){var win = frameElement.api.opener;win.reloadTable();}}});});</script><body>"); sb.append(" try { var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));");
sb.append(" $.messager.alert('错误', emsg); $.Hidemsg();");
sb.append(" } catch(ex) { $.messager.alert('错误', data.responseText + '');}}return false;}");
sb.append("if (!neibuClickFlag) { var win = frameElement.api.opener;win.reloadTable(); }}});});</script><body>");
sb.append("<div align=\"center\" id=\"sub_tr\" style=\"display: none;\"><input class=\"ui_state_highlight\" onclick=\"neibuClick()\" type=\"button\" value=\"提交\" /></div>"); sb.append("<div align=\"center\" id=\"sub_tr\" style=\"display: none;\"><input class=\"ui_state_highlight\" onclick=\"neibuClick()\" type=\"button\" value=\"提交\" /></div>");
sb.append("</body>"); sb.append("</body>");
@ -619,7 +626,6 @@ public class CgformFtlController extends BaseController {
// System.out.println(json.getString("data")); // System.out.println(json.getString("data"));
// // 判断有没有激活过的模板 // // 判断有没有激活过的模板
// message = FormUtil.GetHtml(json.getString("parse"),json.getString("data"), action); // message = FormUtil.GetHtml(json.getString("parse"),json.getString("data"), action);
if(StringUtils.isNotBlank(parseForm)){ if(StringUtils.isNotBlank(parseForm)){
TemplateUtil tool = new TemplateUtil(); TemplateUtil tool = new TemplateUtil();
Map<String,Object> map = tool.processor(parseForm); Map<String,Object> map = tool.processor(parseForm);
@ -627,7 +633,6 @@ public class CgformFtlController extends BaseController {
} else { } else {
j.setMsg(""); j.setMsg("");
} }
j.setSuccess(true); j.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage()); logger.info(e.getMessage());

View File

@ -23,15 +23,16 @@ import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.engine.TempletContext; import org.jeecgframework.web.cgform.engine.TempletContext;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity; import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldVO; import org.jeecgframework.web.cgform.entity.config.CgFormFieldVO;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity; 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.exception.BusinessException;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI; import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
import org.jeecgframework.web.cgform.service.config.CgFormIndexServiceI; import org.jeecgframework.web.cgform.service.config.CgFormIndexServiceI;
import org.jeecgframework.web.cgform.service.impl.config.util.FieldNumComparator; import org.jeecgframework.web.cgform.service.impl.config.util.FieldNumComparator;
import org.jeecgframework.web.cgform.util.PublicUtil;
import org.jeecgframework.web.system.pojo.base.TSType; import org.jeecgframework.web.system.pojo.base.TSType;
import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -101,7 +102,6 @@ public class CgFormHeadController extends BaseController {
modelMap.put("url",url); modelMap.put("url",url);
return new ModelAndView("jeecg/cgform/config/popmenulink"); return new ModelAndView("jeecg/cgform/config/popmenulink");
} }
/** /**
* easyui AJAX * easyui AJAX
* *
@ -121,9 +121,11 @@ public class CgFormHeadController extends BaseController {
String jformCategory = request.getParameter("jformCategory"); String jformCategory = request.getParameter("jformCategory");
if(StringUtil.isNotEmpty(jformCategory)){ if(StringUtil.isNotEmpty(jformCategory)){
cq.eq("jformCategory", jformCategory); cq.eq("jformCategory", jformCategory);
cq.add(); //cq.add();
} }
cq.isNull("physiceId");
cq.add();
// 查询条件组装器 // 查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
@ -218,7 +220,14 @@ public class CgFormHeadController extends BaseController {
if(bl){ if(bl){
//追加主表的附表串 //追加主表的附表串
cgFormFieldService.appendSubTableStr4Main(cgFormHead); cgFormFieldService.appendSubTableStr4Main(cgFormHead);
message = "同步成功";
//判断表单下是否有配置表
List<CgFormHeadEntity> list = cgFormFieldService.findByProperty(CgFormHeadEntity.class, "physiceId", cgFormHead.getId());
if(list!=null&&list.size()>0){
message = "同步成功,当前表单的配置表单已被重置";
}else{
message = "同步成功";
}
j.setMsg(message); j.setMsg(message);
}else{ }else{
message = "同步失败"; message = "同步失败";
@ -245,9 +254,7 @@ public class CgFormHeadController extends BaseController {
public AjaxJson save(CgFormHeadEntity cgFormHead, public AjaxJson save(CgFormHeadEntity cgFormHead,
HttpServletRequest request) { HttpServletRequest request) {
String message = ""; String message = "";
templetContext.clearCache(); templetContext.clearCache();
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
CgFormHeadEntity oldTable =cgFormFieldService.getEntity(CgFormHeadEntity.class, cgFormHead.getId()); CgFormHeadEntity oldTable =cgFormFieldService.getEntity(CgFormHeadEntity.class, cgFormHead.getId());
cgFormFieldService.removeSubTableStr4Main(oldTable); cgFormFieldService.removeSubTableStr4Main(oldTable);
@ -282,16 +289,19 @@ public class CgFormHeadController extends BaseController {
cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().toLowerCase()); cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().toLowerCase());
cgFormFieldEntity.setOldFieldName(cgFormFieldEntity.getFieldName()); cgFormFieldEntity.setOldFieldName(cgFormFieldEntity.getFieldName());
} }
if (StringUtil.isNotEmpty(cgFormFieldEntity.getFieldName()))
cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().trim());
} }
boolean isChange = cgFormIndexService.updateIndexes(cgFormHead); boolean isChange = cgFormIndexService.updateIndexes(cgFormHead);
//isChange 索引是否更新 //isChange 索引是否更新
cgFormFieldService.updateTable(table,null,isChange); cgFormFieldService.updateTable(table,null,isChange);
cgFormFieldService.appendSubTableStr4Main(table); cgFormFieldService.appendSubTableStr4Main(table);
cgFormFieldService.sortSubTableStr(table); cgFormFieldService.sortSubTableStr(table);
/**同步配置表*/
syncTable(table);
systemService.addLog(message, Globals.Log_Type_UPDATE, systemService.addLog(message, Globals.Log_Type_UPDATE,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
@ -302,18 +312,170 @@ public class CgFormHeadController extends BaseController {
cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().toLowerCase()); cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().toLowerCase());
cgFormFieldEntity.setOldFieldName(cgFormFieldEntity.getFieldName()); cgFormFieldEntity.setOldFieldName(cgFormFieldEntity.getFieldName());
} }
if (StringUtil.isNotEmpty(cgFormFieldEntity.getFieldName()))
cgFormFieldEntity.setFieldName(cgFormFieldEntity.getFieldName().trim());
} }
cgFormFieldService.saveTable(cgFormHead); cgFormFieldService.saveTable(cgFormHead);
cgFormIndexService.updateIndexes(cgFormHead); cgFormIndexService.updateIndexes(cgFormHead);
systemService.addLog(message, Globals.Log_Type_INSERT, systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/**
*
* @param table
*/
private void syncTable(CgFormHeadEntity table) {
List<CgFormHeadEntity> headList = systemService.findByProperty(CgFormHeadEntity.class, "physiceId", table.getId());
List<CgFormFieldEntity> formFieldEntities = table.getColumns();
if(headList!=null&&headList.size()>0){
for (CgFormHeadEntity cgform : headList) {
List<CgFormFieldEntity> fieldList = new ArrayList<CgFormFieldEntity>();
List<CgFormFieldEntity> columns = cgform.getColumns();
if(columns==null||columns.size()<=0){
for (CgFormFieldEntity column : formFieldEntities) {
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(column.getContent());
field.setDictField(column.getDictField());
field.setDictTable(column.getDictTable());
field.setDictText(column.getDictText());
field.setExtendJson(column.getExtendJson());
field.setFieldDefault(column.getFieldDefault());
field.setFieldHref(column.getFieldHref());
field.setFieldLength(column.getFieldLength());
field.setFieldName(column.getFieldName());
field.setFieldValidType(column.getFieldValidType());
field.setLength(column.getLength());
field.setMainField(null);
field.setMainTable(null);
field.setOldFieldName(column.getOldFieldName());
field.setOrderNum(column.getOrderNum());
field.setPointLength(column.getPointLength());
field.setQueryMode(column.getQueryMode());
field.setShowType(column.getShowType());
field.setType(column.getType());
field.setIsNull(column.getIsNull());
field.setIsShow(column.getIsShow());
field.setIsShowList(column.getIsShowList());
field.setIsKey(column.getIsKey());
field.setIsQuery(column.getIsQuery());
fieldList.add(field);
}
}else{
for (CgFormFieldEntity cgFormFieldEntity : formFieldEntities) {
if(columns!=null&&columns.size()>0){
for (CgFormFieldEntity column : columns) {
//相同添加,不同的不做处理
if(cgFormFieldEntity.getFieldName().equals(column.getFieldName())){
//相同添加到新list,从原数据中remove;
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(column.getContent());
field.setDictField(column.getDictField());
field.setDictTable(column.getDictTable());
field.setDictText(column.getDictText());
field.setExtendJson(column.getExtendJson());
field.setFieldDefault(column.getFieldDefault());
field.setFieldHref(column.getFieldHref());
field.setFieldLength(column.getFieldLength());
field.setFieldName(column.getFieldName());
field.setFieldValidType(column.getFieldValidType());
field.setLength(column.getLength());
field.setMainField(null);
field.setMainTable(null);
field.setOldFieldName(column.getOldFieldName());
field.setOrderNum(column.getOrderNum());
field.setPointLength(column.getPointLength());
field.setQueryMode(column.getQueryMode());
field.setShowType(column.getShowType());
field.setType(column.getType());
field.setIsNull(cgFormFieldEntity.getIsNull());
field.setIsShow(cgFormFieldEntity.getIsShow());
field.setIsShowList(cgFormFieldEntity.getIsShowList());
field.setIsKey(cgFormFieldEntity.getIsKey());
field.setIsQuery(cgFormFieldEntity.getIsQuery());
fieldList.add(field);
columns.remove(column);
//相同,就跳出进行下一次
break;
}else{
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(cgFormFieldEntity.getContent());
field.setDictField(cgFormFieldEntity.getDictField());
field.setDictTable(cgFormFieldEntity.getDictTable());
field.setDictText(cgFormFieldEntity.getDictText());
field.setExtendJson(cgFormFieldEntity.getExtendJson());
field.setFieldDefault(cgFormFieldEntity.getFieldDefault());
field.setFieldHref(cgFormFieldEntity.getFieldHref());
field.setFieldLength(cgFormFieldEntity.getFieldLength());
field.setFieldName(cgFormFieldEntity.getFieldName());
field.setFieldValidType(cgFormFieldEntity.getFieldValidType());
field.setLength(cgFormFieldEntity.getLength());
field.setMainField(null);
field.setMainTable(null);
field.setOldFieldName(cgFormFieldEntity.getOldFieldName());
field.setOrderNum(cgFormFieldEntity.getOrderNum());
field.setPointLength(cgFormFieldEntity.getPointLength());
field.setQueryMode(cgFormFieldEntity.getQueryMode());
field.setShowType(cgFormFieldEntity.getShowType());
field.setType(cgFormFieldEntity.getType());
field.setIsNull(cgFormFieldEntity.getIsNull());
field.setIsShow(cgFormFieldEntity.getIsShow());
field.setIsShowList(cgFormFieldEntity.getIsShowList());
field.setIsKey(cgFormFieldEntity.getIsKey());
field.setIsQuery(cgFormFieldEntity.getIsQuery());
fieldList.add(field);
columns.remove(column);
//相同,就跳出进行下一次
break;
}
}
}else{
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(cgFormFieldEntity.getContent());
field.setDictField(cgFormFieldEntity.getDictField());
field.setDictTable(cgFormFieldEntity.getDictTable());
field.setDictText(cgFormFieldEntity.getDictText());
field.setExtendJson(cgFormFieldEntity.getExtendJson());
field.setFieldDefault(cgFormFieldEntity.getFieldDefault());
field.setFieldHref(cgFormFieldEntity.getFieldHref());
field.setFieldLength(cgFormFieldEntity.getFieldLength());
field.setFieldName(cgFormFieldEntity.getFieldName());
field.setFieldValidType(cgFormFieldEntity.getFieldValidType());
field.setLength(cgFormFieldEntity.getLength());
field.setMainField(null);
field.setMainTable(null);
field.setOldFieldName(cgFormFieldEntity.getOldFieldName());
field.setOrderNum(cgFormFieldEntity.getOrderNum());
field.setPointLength(cgFormFieldEntity.getPointLength());
field.setQueryMode(cgFormFieldEntity.getQueryMode());
field.setShowType(cgFormFieldEntity.getShowType());
field.setType(cgFormFieldEntity.getType());
field.setIsNull(cgFormFieldEntity.getIsNull());
field.setIsShow(cgFormFieldEntity.getIsShow());
field.setIsShowList(cgFormFieldEntity.getIsShowList());
field.setIsKey(cgFormFieldEntity.getIsKey());
field.setIsQuery(cgFormFieldEntity.getIsQuery());
fieldList.add(field);
}
}
}
List<CgFormFieldEntity> colums = cgFormFieldService.findByProperty(CgFormFieldEntity.class, "table.id", cgform.getId());
cgFormFieldService.deleteAllEntitie(colums);
cgform.setColumns(fieldList);
cgFormFieldService.saveTable(cgform);
}
}
}
/** /**
* OrderNum * OrderNum
* @param cgFormHead * @param cgFormHead
@ -376,7 +538,6 @@ public class CgFormHeadController extends BaseController {
List<TSType> typeList = ResourceUtil.allTypes.get(MutiLangUtil.getMutiLangInstance().getLang("bdfl")); List<TSType> typeList = ResourceUtil.allTypes.get(MutiLangUtil.getMutiLangInstance().getLang("bdfl"));
req.setAttribute("typeList", typeList); req.setAttribute("typeList", typeList);
return new ModelAndView("jeecg/cgform/config/cgFormHead"); return new ModelAndView("jeecg/cgform/config/cgFormHead");
} }
/** /**
@ -431,12 +592,9 @@ public class CgFormHeadController extends BaseController {
columnList.add(initCgFormFieldEntityString("update_name","更新人名称")); columnList.add(initCgFormFieldEntityString("update_name","更新人名称"));
columnList.add(initCgFormFieldEntityString("update_by", "更新人登录名称")); columnList.add(initCgFormFieldEntityString("update_by", "更新人登录名称"));
columnList.add(initCgFormFieldEntityTime("update_date", "更新日期")); columnList.add(initCgFormFieldEntityTime("update_date", "更新日期"));
columnList.add(initCgFormFieldEntityString("sys_org_code","所属部门")); columnList.add(initCgFormFieldEntityString("sys_org_code","所属部门"));
columnList.add(initCgFormFieldEntityString("sys_company_code", "所属公司")); columnList.add(initCgFormFieldEntityString("sys_company_code", "所属公司"));
columnList.add(initCgFormFieldEntityBpmStatus()); columnList.add(initCgFormFieldEntityBpmStatus());
return columnList; return columnList;
} }
/** /**
@ -531,6 +689,9 @@ public class CgFormHeadController extends BaseController {
public AjaxJson checkIsExit(String name, public AjaxJson checkIsExit(String name,
HttpServletRequest req) { HttpServletRequest req) {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
//判断如果是带有V字符的,截取获取真实表名
name = PublicUtil.replaceTableName(name);
j.setSuccess(cgFormFieldService.judgeTableIsExit(name)); j.setSuccess(cgFormFieldService.judgeTableIsExit(name));
return j; return j;
} }
@ -677,6 +838,11 @@ public class CgFormHeadController extends BaseController {
fieldEntity.setIsShow("Y"); fieldEntity.setIsShow("Y");
fieldEntity.setIsShowList("Y"); fieldEntity.setIsShowList("Y");
fieldEntity.setFieldLength(120); fieldEntity.setFieldLength(120);
//--authorzhoujf---start------date:20170207--------for:online表单 配置表 导入字段 默认值处理
fieldEntity.setIsQuery("N");
fieldEntity.setShowType("text");
fieldEntity.setOldFieldName(field.getFieldName());
fieldEntity.setQueryMode("single");
list.add(fieldEntity); list.add(fieldEntity);
saveList.add(fieldEntity); saveList.add(fieldEntity);
} }
@ -722,5 +888,205 @@ public class CgFormHeadController extends BaseController {
request.setAttribute("headId", id); request.setAttribute("headId", id);
return "jeecg/cgform/config/cgformColUpload"; return "jeecg/cgform/config/cgformColUpload";
} }
/**
*
* copyOnline
*/
@RequestMapping(params = "copyOnline")
@ResponseBody
public AjaxJson copyOnline(String id,HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
if(StringUtil.isNotEmpty(id)){
String hql = "select max(c.tableVersion) from CgFormHeadEntity c where c.physiceId = ?";
List<Integer> versions = systemService.findHql(hql, id);
if(versions.get(0)!=null){
int version = versions.get(0);
CgFormHeadEntity cgFormHead = new CgFormHeadEntity();
CgFormHeadEntity physicsTable = systemService.get(CgFormHeadEntity.class,id);
cgFormHead.setTableName(physicsTable.getTableName()+CgAutoListConstant.ONLINE_TABLE_SPLIT_STR+(version+1+""));
cgFormHead.setIsTree(physicsTable.getIsTree());
cgFormHead.setContent(physicsTable.getContent());
cgFormHead.setJformPkType(physicsTable.getJformPkType());
cgFormHead.setJformPkSequence(physicsTable.getJformPkSequence());
cgFormHead.setQuerymode(physicsTable.getQuerymode());
cgFormHead.setIsCheckbox(physicsTable.getIsCheckbox());
cgFormHead.setIsPagination(physicsTable.getIsPagination());
cgFormHead.setJformType(1);//配置表统一为单表
cgFormHead.setJformCategory(physicsTable.getJformCategory());
cgFormHead.setRelationType(physicsTable.getRelationType());
cgFormHead.setSubTableStr(null);
cgFormHead.setPhysiceId(physicsTable.getId());
cgFormHead.setTabOrder(physicsTable.getTabOrder());
cgFormHead.setTableVersion(version+1);
cgFormHead.setTableType("1");
cgFormHead.setIsDbSynch("N");
cgFormHead.setJformVersion(physicsTable.getJformVersion());
cgFormHead.setFormTemplate(physicsTable.getFormTemplate());
cgFormHead.setFormTemplateMobile(physicsTable.getFormTemplateMobile());
cgFormHead.setTreeFieldname(physicsTable.getTreeFieldname());
cgFormHead.setTreeIdFieldname(physicsTable.getTreeIdFieldname());
cgFormHead.setTreeParentIdFieldName(physicsTable.getTreeParentIdFieldName());
List<CgFormFieldEntity> fieldList = new ArrayList<CgFormFieldEntity>();
List<CgFormFieldEntity> columns = physicsTable.getColumns();
for (CgFormFieldEntity f : columns) {
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(f.getContent());
field.setDictField(f.getDictField());
field.setDictTable(f.getDictTable());
field.setDictText(f.getDictText());
field.setExtendJson(f.getExtendJson());
field.setFieldDefault(f.getFieldDefault());
field.setFieldHref(f.getFieldHref());
field.setFieldLength(f.getFieldLength());
field.setFieldName(f.getFieldName());
field.setFieldValidType(f.getFieldValidType());
field.setLength(f.getLength());
field.setMainField(null);//默认为单表
field.setMainTable(null);//默认为单表
field.setOldFieldName(f.getOldFieldName());
field.setOrderNum(f.getOrderNum());
field.setPointLength(f.getPointLength());
field.setQueryMode(f.getQueryMode());
field.setShowType(f.getShowType());
field.setType(f.getType());
field.setIsNull(f.getIsNull());
field.setIsShow(f.getIsShow());
field.setIsShowList(f.getIsShowList());
field.setIsKey(f.getIsKey());
field.setIsQuery(f.getIsQuery());
fieldList.add(field);
}
cgFormHead.setColumns(fieldList);
cgFormFieldService.saveTable(cgFormHead);
j.setObj(cgFormHead.getId());
j.setMsg("新版本配置表单:"+cgFormHead.getTableName()+"创建完成");
j.setSuccess(true);
return j;
}else{
CgFormHeadEntity cgFormHead = new CgFormHeadEntity();
CgFormHeadEntity physicsTable = systemService.get(CgFormHeadEntity.class,id);
cgFormHead.setTableName(physicsTable.getTableName()+CgAutoListConstant.ONLINE_TABLE_SPLIT_STR+"0");
cgFormHead.setIsTree(physicsTable.getIsTree());
cgFormHead.setContent(physicsTable.getContent());
cgFormHead.setJformPkType(physicsTable.getJformPkType());
cgFormHead.setJformPkSequence(physicsTable.getJformPkSequence());
cgFormHead.setQuerymode(physicsTable.getQuerymode());
cgFormHead.setIsCheckbox(physicsTable.getIsCheckbox());
cgFormHead.setIsPagination(physicsTable.getIsPagination());
cgFormHead.setJformType(1);//配置表统一为单表
cgFormHead.setJformCategory(physicsTable.getJformCategory());
cgFormHead.setRelationType(physicsTable.getRelationType());
cgFormHead.setSubTableStr(null);
cgFormHead.setPhysiceId(physicsTable.getId());
cgFormHead.setTabOrder(physicsTable.getTabOrder());
cgFormHead.setTableVersion(0);
cgFormHead.setTableType("1");
cgFormHead.setIsDbSynch("N");
cgFormHead.setJformVersion(physicsTable.getJformVersion());
cgFormHead.setFormTemplate(physicsTable.getFormTemplate());
cgFormHead.setFormTemplateMobile(physicsTable.getFormTemplateMobile());
cgFormHead.setTreeFieldname(physicsTable.getTreeFieldname());
cgFormHead.setTreeIdFieldname(physicsTable.getTreeIdFieldname());
cgFormHead.setTreeParentIdFieldName(physicsTable.getTreeParentIdFieldName());
List<CgFormFieldEntity> fieldList = new ArrayList<CgFormFieldEntity>();
List<CgFormFieldEntity> columns = physicsTable.getColumns();
for (CgFormFieldEntity f : columns) {
CgFormFieldEntity field = new CgFormFieldEntity();
field.setContent(f.getContent());
field.setDictField(f.getDictField());
field.setDictTable(f.getDictTable());
field.setDictText(f.getDictText());
field.setExtendJson(f.getExtendJson());
field.setFieldDefault(f.getFieldDefault());
field.setFieldHref(f.getFieldHref());
field.setFieldLength(f.getFieldLength());
field.setFieldName(f.getFieldName());
field.setFieldValidType(f.getFieldValidType());
field.setLength(f.getLength());
field.setMainField(null);
field.setMainTable(null);
field.setOldFieldName(f.getOldFieldName());
field.setOrderNum(f.getOrderNum());
field.setPointLength(f.getPointLength());
field.setQueryMode(f.getQueryMode());
field.setShowType(f.getShowType());
field.setType(f.getType());
field.setIsNull(f.getIsNull());
field.setIsShow(f.getIsShow());
field.setIsShowList(f.getIsShowList());
field.setIsKey(f.getIsKey());
field.setIsQuery(f.getIsQuery());
fieldList.add(field);
}
cgFormHead.setColumns(fieldList);
cgFormFieldService.saveTable(cgFormHead);
j.setObj(cgFormHead.getId());
j.setMsg("配置表单:"+cgFormHead.getTableName()+"创建完成");
j.setSuccess(true);
return j;
}
}
return j;
}
/**
*
*/
@RequestMapping(params = "cgFormHeadConfigList")
public ModelAndView cgFormHeadConfigList(String id,HttpServletRequest request) {
if(StringUtil.isNotEmpty(id)){
request.setAttribute("physiceId", id);
return new ModelAndView("jeecg/cgform/config/cgFormHeadConfigList");
}else{
return null;
}
}
/**
*
*/
@RequestMapping(params = "configDatagrid")
public void configDatagrid(CgFormHeadEntity cgFormHead,String id,
HttpServletRequest request, HttpServletResponse response,
DataGrid dataGrid) {
String hql = "from CgFormHeadEntity c where c.physiceId = ? order by c.tableVersion asc";
List<CgFormHeadEntity> findHql = systemService.findHql(hql, id);
dataGrid.setResults(findHql);
dataGrid.setTotal(findHql.size());
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
*/
@RequestMapping(params = "getConfigId")
@ResponseBody
public AjaxJson getConfigId(String id,HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
if(StringUtil.isNotEmpty(id)){
String hql = "from CgFormHeadEntity c where physiceId = ?";
List<CgFormHeadEntity> cgformList = systemService.findHql(hql, id);
if(cgformList!=null&&cgformList.size()>0){
CgFormHeadEntity cgFormHeadEntity = cgformList.get(0);
j.setSuccess(true);
j.setObj(cgFormHeadEntity.getPhysiceId());
return j;
}else{
j.setSuccess(false);
j.setMsg("当前表单无配置表单");
return j;
}
}
return j;
}
} }

View File

@ -103,6 +103,8 @@ public class ExcelTempletController extends BaseController {
QueryParamUtil.loadQueryParams(request, b, params); QueryParamUtil.loadQueryParams(request, b, params);
// } // }
} }
//--authorzhoujf---start------date:20170207--------for:online表单物理表查询数据异常处理
configId = configId.split("__")[0];
List<Map<String, Object>> result = cgTableService.querySingle(configId, field.toString(), params, null, null, 1, 99999); List<Map<String, Object>> result = cgTableService.querySingle(configId, field.toString(), params, null, null, 1, 99999);
//表单列集合 //表单列集合
@ -279,6 +281,8 @@ public class ExcelTempletController extends BaseController {
message = "识别模版数据错误"; message = "识别模版数据错误";
logger.error(message); logger.error(message);
} else { } else {
//--authorzhoujf---start------date:20170207--------for:online表单物理表查询数据异常处理
configId = configId.split("__")[0];
for (Map<String, Object> map : listDate) { for (Map<String, Object> map : listDate) {
map.put("id", UUIDGenerator.generate()); map.put("id", UUIDGenerator.generate());
dataBaseService.insertTable(configId, map); dataBaseService.insertTable(configId, map);
@ -361,9 +365,7 @@ public class ExcelTempletController extends BaseController {
String value = String.valueOf(r.get(bean.getFieldName())); String value = String.valueOf(r.get(bean.getFieldName()));
for (DictEntity dictEntity : dicDataList) { for (DictEntity dictEntity : dicDataList) {
if (value.equalsIgnoreCase(dictEntity.getTypecode())) { if (value.equalsIgnoreCase(dictEntity.getTypecode())) {
r.put(bean.getFieldName(), MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename())); r.put(bean.getFieldName(), MutiLangUtil.getMutiLangInstance().getLang(dictEntity.getTypename()));
} }
} }
} }

View File

@ -547,7 +547,6 @@ public class CgformTemplateController extends BaseController {
// String path=request.getSession().getServletContext().getRealPath("/WEB-INF/classes/online/template"); // String path=request.getSession().getServletContext().getRealPath("/WEB-INF/classes/online/template");
String path= this.getClass().getResource("/").getPath()+"online/template"; String path= this.getClass().getResource("/").getPath()+"online/template";
return path; return path;
} }

View File

@ -198,13 +198,11 @@ public class CgformTransController {
cgFormField.setLength(Integer.valueOf(columnt cgFormField.setLength(Integer.valueOf(columnt
.getPrecision())); .getPrecision()));
} }
//update-begin--Author:zhangdaihao Date:20140212 for[001]oracle下number类型数据库表导出表单默认长度为0同步失败
else{ else{
if(cgFormField.getType().equals(DataBaseConst.INT)){ if(cgFormField.getType().equals(DataBaseConst.INT)){
cgFormField.setLength(10); cgFormField.setLength(10);
} }
} }
//update-end--Author:zhangdaihao Date:20140212 for[001]oracle下number类型数据库表导出表单默认长度为0同步失败
if (StringUtil.isNotEmpty(columnt.getScale())) if (StringUtil.isNotEmpty(columnt.getScale()))
cgFormField.setPointLength(Integer.valueOf(columnt cgFormField.setPointLength(Integer.valueOf(columnt
.getScale())); .getScale()));
@ -213,11 +211,9 @@ public class CgformTransController {
columnsList.add(cgFormField); columnsList.add(cgFormField);
} }
cgFormHead.setColumns(columnsList); cgFormHead.setColumns(columnsList);
//update-begin--Author:scott Date:20170720 for导入报单报错-----
if(oConvertUtils.isEmpty(cgFormHead.getJformCategory())){ if(oConvertUtils.isEmpty(cgFormHead.getJformCategory())){
cgFormHead.setJformCategory("bdfl_ptbd"); cgFormHead.setJformCategory("bdfl_ptbd");
} }
//update-end--Author:scott Date:20170720 for导入报单报错-----
cgFormFieldService.saveTable(cgFormHead, ""); cgFormFieldService.saveTable(cgFormHead, "");
if (yes != "") if (yes != "")
yes += ","; yes += ",";

View File

@ -6,6 +6,7 @@ import freemarker.template.TemplateDirectiveModel;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager; import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element; import net.sf.ehcache.Element;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.PropertiesUtil; import org.jeecgframework.core.util.PropertiesUtil;
import org.jeecgframework.web.cgform.common.CgAutoListConstant; import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI; import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
@ -69,7 +70,6 @@ public class TempletContext {
if (ftlVersion != null && ftlVersion.length() > 0) { if (ftlVersion != null && ftlVersion.length() > 0) {
tableName = tableName + "&ftlVersion=" + ftlVersion; tableName = tableName + "&ftlVersion=" + ftlVersion;
} }
try { try {
if(CgAutoListConstant.SYS_MODE_DEV.equalsIgnoreCase(_sysMode)){//开发模式 if(CgAutoListConstant.SYS_MODE_DEV.equalsIgnoreCase(_sysMode)){//开发模式
template = freemarker.getTemplate(tableName,freemarker.getLocale(), ENCODING); template = freemarker.getTemplate(tableName,freemarker.getLocale(), ENCODING);
@ -112,6 +112,24 @@ public class TempletContext {
} }
return template; return template;
} }
/**
* ftl
* @param template
* @param encoding
* @return
*/
public void removeTemplateFromCache(String tableName){
try {
//获取版本号
String version = cgFormFieldService.getCgFormVersionByTableName(tableName);
//cache的键类名.方法名.参数名
String cacheKey = FreemarkerHelper.class.getName()+".getTemplateFormCache."+tableName+"."+version;
ehCache.remove(cacheKey);
} catch (Exception e) {
e.printStackTrace();
}
}
public Configuration getFreemarker() { public Configuration getFreemarker() {
return freemarker; return freemarker;
@ -128,7 +146,6 @@ public class TempletContext {
public void setTags(Map<String, TemplateDirectiveModel> tags) { public void setTags(Map<String, TemplateDirectiveModel> tags) {
this.tags = tags; this.tags = tags;
} }
public void clearCache(){ public void clearCache(){
try{ try{
ehCache.removeAll(); ehCache.removeAll();
@ -136,5 +153,4 @@ public class TempletContext {
} }
} }
} }

View File

@ -61,12 +61,10 @@ public class DictDataTag implements TemplateDirectiveModel {
if (dataList == null) { if (dataList == null) {
dataList = new ArrayList<TSType>(); dataList = new ArrayList<TSType>();
} }
for(TSType s:dataList){ for(TSType s:dataList){
String names = s.getTypename(); String names = s.getTypename();
s.setTypename(MutiLangUtil.getMutiLangInstance().getLang(names)); s.setTypename(MutiLangUtil.getMutiLangInstance().getLang(names));
} }
env.setGlobalVariable(var, new SimpleCollection(dataList)); env.setGlobalVariable(var, new SimpleCollection(dataList));
} else { } else {
// table表查询 // table表查询

View File

@ -94,10 +94,10 @@ public class CgFormFieldEntity implements java.io.Serializable {
private java.lang.String oldFieldName; private java.lang.String oldFieldName;
/**字段默认值*/ /**字段默认值*/
private java.lang.String fieldDefault; private java.lang.String fieldDefault;
//add-start--Author:luobaoli Date:20150610 for添加扩展参数字段
/**扩展参数**/ /**扩展参数**/
private java.lang.String extendJson; private java.lang.String extendJson;
//add-start--Author:luobaoli Date:20150610 for添加扩展参数字段
/** /**
*: java.lang.String *: java.lang.String
@ -446,7 +446,7 @@ public class CgFormFieldEntity implements java.io.Serializable {
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String
*/ */
@Column(name ="field_valid_type",nullable=true,length=10) @Column(name ="field_valid_type",nullable=true,length=300)
public java.lang.String getFieldValidType() { public java.lang.String getFieldValidType() {
return fieldValidType; return fieldValidType;
} }
@ -552,7 +552,6 @@ public class CgFormFieldEntity implements java.io.Serializable {
this.fieldDefault = fieldDefault; this.fieldDefault = fieldDefault;
} }
//add-start--Author:luobaoli Date:20150610 for添加扩展参数字段
@Column(name ="extend_json",nullable=true,length=500) @Column(name ="extend_json",nullable=true,length=500)
public java.lang.String getExtendJson() { public java.lang.String getExtendJson() {
return extendJson; return extendJson;
@ -561,5 +560,5 @@ public class CgFormFieldEntity implements java.io.Serializable {
public void setExtendJson(java.lang.String extendJson) { public void setExtendJson(java.lang.String extendJson) {
this.extendJson = extendJson; this.extendJson = extendJson;
} }
//add-end--Author:luobaoli Date:20150610 for添加扩展参数字段
} }

View File

@ -87,20 +87,24 @@ public class CgFormHeadEntity implements java.io.Serializable {
private java.lang.String treeIdFieldname; private java.lang.String treeIdFieldname;
/**树形列表 菜单列名*/ /**树形列表 菜单列名*/
private java.lang.String treeFieldname; private java.lang.String treeFieldname;
//add-start--Author:luobaoli Date:20150607 for增加表单分类列
/**表单分类*/ /**表单分类*/
private java.lang.String jformCategory; private java.lang.String jformCategory;
//add-end--Author:luobaoli Date:20150607 for增加表单分类列
//add-start--Author:张忠亮 Date:20150618 for增加表单模板选择
/**表单模板*/ /**表单模板*/
private String formTemplate; private String formTemplate;
//add-end--Author:张忠亮 Date:20150618 for增加表单模板选择
//add-start--Author:scott Date:20160301 foronline表单移动样式单独配置
/**表单模板样式(移动端)*/ /**表单模板样式(移动端)*/
private String formTemplateMobile; private String formTemplateMobile;
//add-end--Author:scott Date:20160301 foronline表单移动样式单独配置
/**表单类型0为物理表1为配置表*/
private String tableType;
/**配置表版本*/
private Integer tableVersion;
/**物理表id*/
private String physiceId;
/** /**
*: java.lang.String *: java.lang.String
@ -471,7 +475,7 @@ public class CgFormHeadEntity implements java.io.Serializable {
public void setJformCategory(java.lang.String jformCategory) { public void setJformCategory(java.lang.String jformCategory) {
this.jformCategory = jformCategory; this.jformCategory = jformCategory;
} }
//add-start--Author:张忠亮 Date:20150618 for增加表单模板选择
@Column(name ="form_template",length=50) @Column(name ="form_template",length=50)
public String getFormTemplate() { public String getFormTemplate() {
return formTemplate; return formTemplate;
@ -480,7 +484,7 @@ public class CgFormHeadEntity implements java.io.Serializable {
public void setFormTemplate(String formTemplate) { public void setFormTemplate(String formTemplate) {
this.formTemplate = formTemplate; this.formTemplate = formTemplate;
} }
//add-end--Author:张忠亮 Date:20150618 for增加表单模板选择
@Column(name ="form_template_mobile",length=50) @Column(name ="form_template_mobile",length=50)
public String getFormTemplateMobile() { public String getFormTemplateMobile() {
return formTemplateMobile; return formTemplateMobile;
@ -489,5 +493,29 @@ public class CgFormHeadEntity implements java.io.Serializable {
public void setFormTemplateMobile(String formTemplateMobile) { public void setFormTemplateMobile(String formTemplateMobile) {
this.formTemplateMobile = formTemplateMobile; this.formTemplateMobile = formTemplateMobile;
} }
@Column(name ="table_type",length=50)
public String getTableType() {
return tableType;
}
public void setTableType(String tableType) {
this.tableType = tableType;
}
@Column(name ="table_version",length=11)
public Integer getTableVersion() {
return tableVersion;
}
public void setTableVersion(Integer tableVersion) {
this.tableVersion = tableVersion;
}
@Column(name ="physice_id",length=32)
public String getPhysiceId() {
return physiceId;
}
public void setPhysiceId(String physiceId) {
this.physiceId = physiceId;
}
} }

View File

@ -63,12 +63,10 @@ public class CgformTemplateEntity implements java.io.Serializable {
private String templateComment; private String templateComment;
private String templateZipName; private String templateZipName;
private String templateListName; private String templateListName;
private String templateAddName; private String templateAddName;
private String templateUpdateName; private String templateUpdateName;
private String templateDetailName; private String templateDetailName;
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String *@return: java.lang.String

View File

@ -54,6 +54,26 @@ public class CgFormHeadPojo implements java.io.Serializable {
/**一对多Tab顺序*/ /**一对多Tab顺序*/
private Integer tabOrder; private Integer tabOrder;
//--authorzhoujf---start------date:20170207--------for:online表单 表单导出字段不全
/**树形列表 父id列名*/
private java.lang.String treeParentIdFieldName;
/**树形列表 id列名*/
private java.lang.String treeIdFieldname;
/**树形列表 菜单列名*/
private java.lang.String treeFieldname;
/**表单分类*/
private java.lang.String jformCategory;
/**表单模板*/
private String formTemplate;
/**表单模板样式(移动端)*/
private String formTemplateMobile;
/**表单类型0为物理表1为配置表*/
private String tableType;
/**配置表版本*/
private Integer tableVersion;
/**物理表id*/
private String physiceId;
/** /**
*: java.lang.String *: java.lang.String
*@return: java.lang.String id *@return: java.lang.String id
@ -340,4 +360,78 @@ public class CgFormHeadPojo implements java.io.Serializable {
public void setTabOrder(Integer tabOrder) { public void setTabOrder(Integer tabOrder) {
this.tabOrder = tabOrder; this.tabOrder = tabOrder;
} }
public java.lang.String getTreeParentIdFieldName() {
return treeParentIdFieldName;
}
public void setTreeParentIdFieldName(java.lang.String treeParentIdFieldName) {
this.treeParentIdFieldName = treeParentIdFieldName;
}
public java.lang.String getTreeIdFieldname() {
return treeIdFieldname;
}
public void setTreeIdFieldname(java.lang.String treeIdFieldname) {
this.treeIdFieldname = treeIdFieldname;
}
public java.lang.String getTreeFieldname() {
return treeFieldname;
}
public void setTreeFieldname(java.lang.String treeFieldname) {
this.treeFieldname = treeFieldname;
}
public java.lang.String getJformCategory() {
return jformCategory;
}
public void setJformCategory(java.lang.String jformCategory) {
this.jformCategory = jformCategory;
}
public String getFormTemplate() {
return formTemplate;
}
public void setFormTemplate(String formTemplate) {
this.formTemplate = formTemplate;
}
public String getFormTemplateMobile() {
return formTemplateMobile;
}
public void setFormTemplateMobile(String formTemplateMobile) {
this.formTemplateMobile = formTemplateMobile;
}
public String getTableType() {
return tableType;
}
public void setTableType(String tableType) {
this.tableType = tableType;
}
public Integer getTableVersion() {
return tableVersion;
}
public void setTableVersion(Integer tableVersion) {
this.tableVersion = tableVersion;
}
public String getPhysiceId() {
return physiceId;
}
public void setPhysiceId(String physiceId) {
this.physiceId = physiceId;
}
} }

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