【添加】cgreport修复完毕

This commit is contained in:
zer0Black
2021-03-12 16:31:48 +08:00
parent e240930f17
commit 930673919a
14 changed files with 376 additions and 374 deletions
@@ -1,300 +1,300 @@
//package com.jero.common.util.dynamic.db;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.ArrayUtils;
//import com.jero.common.exception.JeroBootException;
//import com.jero.common.exception.JeroBootException;
//import com.jero.common.system.vo.DynamicDataSourceModel;
//import com.jero.common.util.ReflectHelper;
//import com.jero.common.util.oConvertUtils;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
//
//import javax.sql.DataSource;
//import java.sql.SQLException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * Spring JDBC 实时数据库访问
// *
// * @author chenguobin
// * @version 1.0
// * @date 2014-09-05
// */
//@Slf4j
//public class DynamicDBUtil {
//
// /**
// * 获取数据源【最底层方法,不要随便调用】
// *
// * @param dbSource
// * @return
// */
// private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) {
// DruidDataSource dataSource = new DruidDataSource();
//
// String driverClassName = dbSource.getDbDriver();
// String url = dbSource.getDbUrl();
// String dbUser = dbSource.getDbUsername();
// String dbPassword = dbSource.getDbPassword();
// dataSource.setDriverClassName(driverClassName);
// dataSource.setUrl(url);
// //dataSource.setValidationQuery("SELECT 1 FROM DUAL");
// dataSource.setTestWhileIdle(true);
// dataSource.setTestOnBorrow(false);
// dataSource.setTestOnReturn(false);
// dataSource.setBreakAfterAcquireFailure(true);
// dataSource.setConnectionErrorRetryAttempts(0);
// dataSource.setUsername(dbUser);
// dataSource.setMaxWait(60000);
// dataSource.setPassword(dbPassword);
//
// log.info("******************************************");
// log.info("* *");
// log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*");
// log.info("* *");
// log.info("******************************************");
// return dataSource;
// }
//
// /**
// * 通过 dbKey ,获取数据源
// *
// * @param dbKey
// * @return
// */
// public static DruidDataSource getDbSourceByDbKey(final String dbKey) {
// //获取多数据源配置
// DynamicDataSourceModel dbSource = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
// //先判断缓存中是否存在数据库链接
// DruidDataSource cacheDbSource = DataSourceCachePool.getCacheBasicDataSource(dbKey);
// if (cacheDbSource != null && !cacheDbSource.isClosed()) {
// log.debug("--------getDbSourceBydbKey------------------从缓存中获取DB连接-------------------");
// return cacheDbSource;
// } else {
// DruidDataSource dataSource = getJdbcDataSource(dbSource);
// if(dataSource!=null && dataSource.isEnable()){
// DataSourceCachePool.putCacheBasicDataSource(dbKey, dataSource);
// }else{
// throw new JeroBootException("动态数据源连接失败,dbKey"+dbKey);
// }
// log.info("--------getDbSourceBydbKey------------------创建DB数据库连接-------------------");
// return dataSource;
// }
// }
//
// /**
// * 关闭数据库连接池
// *
// * @param dbKey
// * @return
// */
// public static void closeDbKey(final String dbKey) {
// DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
// try {
// if (dataSource != null && !dataSource.isClosed()) {
// dataSource.getConnection().commit();
// dataSource.getConnection().close();
// dataSource.close();
// }
// } catch (SQLException e) {
// e.printStackTrace();
// }
// }
//
//
// private static JdbcTemplate getJdbcTemplate(String dbKey) {
// DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
// return new JdbcTemplate(dataSource);
// }
//
// /**
// * Executes the SQL statement in this <code>PreparedStatement</code> object,
// * which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
// * <code>DELETE</code>; or an SQL statement that returns nothing,
// * such as a DDL statement.
// */
// public static int update(final String dbKey, String sql, Object... param) {
// int effectCount;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
// if (ArrayUtils.isEmpty(param)) {
// effectCount = jdbcTemplate.update(sql);
// } else {
// effectCount = jdbcTemplate.update(sql, param);
// }
// return effectCount;
// }
//
// /**
// * 支持miniDao语法操作的Update
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// public static int updateByHash(final String dbKey, String sql, HashMap<String, Object> data) {
// int effectCount;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
// //根据模板获取sql
// sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
// NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
// effectCount = namedParameterJdbcTemplate.update(sql, data);
// return effectCount;
// }
//
// public static Object findOne(final String dbKey, String sql, Object... param) {
// List<Map<String, Object>> list;
// list = findList(dbKey, sql, param);
// if (oConvertUtils.listIsEmpty(list)) {
// log.error("Except one, but not find actually");
// }
// if (list.size() > 1) {
// log.error("Except one, but more than one actually");
// }
// return list.get(0);
// }
//
// /**
// * 支持miniDao语法操作的查询 返回HashMap
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// public static Object findOneByHash(final String dbKey, String sql, HashMap<String, Object> data) {
// List<Map<String, Object>> list;
// list = findListByHash(dbKey, sql, data);
// if (oConvertUtils.listIsEmpty(list)) {
// log.error("Except one, but not find actually");
// }
// if (list.size() > 1) {
// log.error("Except one, but more than one actually");
// }
// return list.get(0);
// }
//
// /**
// * 直接sql查询 根据clazz返回单个实例
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句
// * @param clazz 返回实例的Class
// * @param param
// * @return
// */
// @SuppressWarnings("unchecked")
// public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
// Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
// return ReflectHelper.setAll(clazz, map);
// }
//
// /**
// * 支持miniDao语法操作的查询 返回单个实例
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param clazz 返回实例的Class
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// @SuppressWarnings("unchecked")
// public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
// Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
// return ReflectHelper.setAll(clazz, map);
// }
//
// public static List<Map<String, Object>> findList(final String dbKey, String sql, Object... param) {
// List<Map<String, Object>> list;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
//
// if (ArrayUtils.isEmpty(param)) {
// list = jdbcTemplate.queryForList(sql);
// } else {
// list = jdbcTemplate.queryForList(sql, param);
// }
// return list;
// }
//
// /**
// * 支持miniDao语法操作的查询
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// public static List<Map<String, Object>> findListByHash(final String dbKey, String sql, HashMap<String, Object> data) {
// List<Map<String, Object>> list;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
// //根据模板获取sql
// sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
// NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
// list = namedParameterJdbcTemplate.queryForList(sql, data);
// return list;
// }
//
// //此方法只能返回单列,不能返回实体类
// public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz, Object... param) {
// List<T> list;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
//
// if (ArrayUtils.isEmpty(param)) {
// list = jdbcTemplate.queryForList(sql, clazz);
// } else {
// list = jdbcTemplate.queryForList(sql, clazz, param);
// }
// return list;
// }
//
// /**
// * 支持miniDao语法操作的查询 返回单列数据list
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param clazz 类型Long、String等
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// public static <T> List<T> findListByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
// List<T> list;
// JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
// //根据模板获取sql
// sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
// NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
// list = namedParameterJdbcTemplate.queryForList(sql, data, clazz);
// return list;
// }
//
// /**
// * 直接sql查询 返回实体类列表
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持 minidao 语法逻辑
// * @param clazz 返回实体类列表的class
// * @param param sql拼接注入中需要的数据
// * @return
// */
// public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
// List<Map<String, Object>> queryList = findList(dbKey, sql, param);
// return ReflectHelper.transList2Entrys(queryList, clazz);
// }
//
// /**
// * 支持miniDao语法操作的查询 返回实体类列表
// *
// * @param dbKey 数据源标识
// * @param sql 执行sql语句,sql支持minidao语法逻辑
// * @param clazz 返回实体类列表的class
// * @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
// * @return
// */
// public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
// List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
// return ReflectHelper.transList2Entrys(queryList, clazz);
// }
//}
package com.jero.common.util.dynamic.db;
import com.alibaba.druid.pool.DruidDataSource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import com.jero.common.exception.JeroBootException;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.DynamicDataSourceModel;
import com.jero.common.util.ReflectHelper;
import com.jero.common.util.oConvertUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Spring JDBC 实时数据库访问
*
* @author chenguobin
* @version 1.0
* @date 2014-09-05
*/
@Slf4j
public class DynamicDBUtil {
/**
* 获取数据源【最底层方法,不要随便调用】
*
* @param dbSource
* @return
*/
private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) {
DruidDataSource dataSource = new DruidDataSource();
String driverClassName = dbSource.getDbDriver();
String url = dbSource.getDbUrl();
String dbUser = dbSource.getDbUsername();
String dbPassword = dbSource.getDbPassword();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
//dataSource.setValidationQuery("SELECT 1 FROM DUAL");
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setTestOnReturn(false);
dataSource.setBreakAfterAcquireFailure(true);
dataSource.setConnectionErrorRetryAttempts(0);
dataSource.setUsername(dbUser);
dataSource.setMaxWait(60000);
dataSource.setPassword(dbPassword);
log.info("******************************************");
log.info("* *");
log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*");
log.info("* *");
log.info("******************************************");
return dataSource;
}
/**
* 通过 dbKey ,获取数据源
*
* @param dbKey
* @return
*/
public static DruidDataSource getDbSourceByDbKey(final String dbKey) {
//获取多数据源配置
DynamicDataSourceModel dbSource = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
//先判断缓存中是否存在数据库链接
DruidDataSource cacheDbSource = DataSourceCachePool.getCacheBasicDataSource(dbKey);
if (cacheDbSource != null && !cacheDbSource.isClosed()) {
log.debug("--------getDbSourceBydbKey------------------从缓存中获取DB连接-------------------");
return cacheDbSource;
} else {
DruidDataSource dataSource = getJdbcDataSource(dbSource);
if(dataSource!=null && dataSource.isEnable()){
DataSourceCachePool.putCacheBasicDataSource(dbKey, dataSource);
}else{
throw new JeroBootException("动态数据源连接失败,dbKey"+dbKey);
}
log.info("--------getDbSourceBydbKey------------------创建DB数据库连接-------------------");
return dataSource;
}
}
/**
* 关闭数据库连接池
*
* @param dbKey
* @return
*/
public static void closeDbKey(final String dbKey) {
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
try {
if (dataSource != null && !dataSource.isClosed()) {
dataSource.getConnection().commit();
dataSource.getConnection().close();
dataSource.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
private static JdbcTemplate getJdbcTemplate(String dbKey) {
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
return new JdbcTemplate(dataSource);
}
/**
* Executes the SQL statement in this <code>PreparedStatement</code> object,
* which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
* <code>DELETE</code>; or an SQL statement that returns nothing,
* such as a DDL statement.
*/
public static int update(final String dbKey, String sql, Object... param) {
int effectCount;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
if (ArrayUtils.isEmpty(param)) {
effectCount = jdbcTemplate.update(sql);
} else {
effectCount = jdbcTemplate.update(sql, param);
}
return effectCount;
}
/**
* 支持miniDao语法操作的Update
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
public static int updateByHash(final String dbKey, String sql, HashMap<String, Object> data) {
int effectCount;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
//根据模板获取sql
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
effectCount = namedParameterJdbcTemplate.update(sql, data);
return effectCount;
}
public static Object findOne(final String dbKey, String sql, Object... param) {
List<Map<String, Object>> list;
list = findList(dbKey, sql, param);
if (oConvertUtils.listIsEmpty(list)) {
log.error("Except one, but not find actually");
}
if (list.size() > 1) {
log.error("Except one, but more than one actually");
}
return list.get(0);
}
/**
* 支持miniDao语法操作的查询 返回HashMap
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
public static Object findOneByHash(final String dbKey, String sql, HashMap<String, Object> data) {
List<Map<String, Object>> list;
list = findListByHash(dbKey, sql, data);
if (oConvertUtils.listIsEmpty(list)) {
log.error("Except one, but not find actually");
}
if (list.size() > 1) {
log.error("Except one, but more than one actually");
}
return list.get(0);
}
/**
* 直接sql查询 根据clazz返回单个实例
*
* @param dbKey 数据源标识
* @param sql 执行sql语句
* @param clazz 返回实例的Class
* @param param
* @return
*/
@SuppressWarnings("unchecked")
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
return ReflectHelper.setAll(clazz, map);
}
/**
* 支持miniDao语法操作的查询 返回单个实例
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param clazz 返回实例的Class
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
@SuppressWarnings("unchecked")
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
return ReflectHelper.setAll(clazz, map);
}
public static List<Map<String, Object>> findList(final String dbKey, String sql, Object... param) {
List<Map<String, Object>> list;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
if (ArrayUtils.isEmpty(param)) {
list = jdbcTemplate.queryForList(sql);
} else {
list = jdbcTemplate.queryForList(sql, param);
}
return list;
}
/**
* 支持miniDao语法操作的查询
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
public static List<Map<String, Object>> findListByHash(final String dbKey, String sql, HashMap<String, Object> data) {
List<Map<String, Object>> list;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
//根据模板获取sql
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
list = namedParameterJdbcTemplate.queryForList(sql, data);
return list;
}
//此方法只能返回单列,不能返回实体类
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz, Object... param) {
List<T> list;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
if (ArrayUtils.isEmpty(param)) {
list = jdbcTemplate.queryForList(sql, clazz);
} else {
list = jdbcTemplate.queryForList(sql, clazz, param);
}
return list;
}
/**
* 支持miniDao语法操作的查询 返回单列数据list
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param clazz 类型Long、String等
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
public static <T> List<T> findListByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
List<T> list;
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
//根据模板获取sql
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
list = namedParameterJdbcTemplate.queryForList(sql, data, clazz);
return list;
}
/**
* 直接sql查询 返回实体类列表
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持 minidao 语法逻辑
* @param clazz 返回实体类列表的class
* @param param sql拼接注入中需要的数据
* @return
*/
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
List<Map<String, Object>> queryList = findList(dbKey, sql, param);
return ReflectHelper.transList2Entrys(queryList, clazz);
}
/**
* 支持miniDao语法操作的查询 返回实体类列表
*
* @param dbKey 数据源标识
* @param sql 执行sql语句,sql支持minidao语法逻辑
* @param clazz 返回实体类列表的class
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
* @return
*/
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
return ReflectHelper.transList2Entrys(queryList, clazz);
}
}
@@ -887,7 +887,7 @@ public class b {
String str2 = null;
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (loginUser == null) {
throw new JeecgBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
throw new JeroBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
}
@@ -985,7 +985,7 @@ public class b {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (loginUser == null) {
throw new JeecgBootException("online修改表单数据异常:系统未找到当前登陆用户信息");
throw new JeroBootException("online修改表单数据异常:系统未找到当前登陆用户信息");
}
@@ -1821,7 +1821,7 @@ public class b {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (loginUser == null) {
throw new JeecgBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
throw new JeroBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
}
for (OnlCgformField onlCgformField : paramList) {
@@ -1879,7 +1879,7 @@ public class b {
}
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (loginUser == null) {
throw new JeecgBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
throw new JeroBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
}
for (OnlCgformField onlCgformField : paramList) {
String str4 = onlCgformField.getDbFieldName();
@@ -22,7 +22,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.PermissionData;
import com.jero.common.exception.JeecgBootException;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.DynamicDataSourceModel;
@@ -347,7 +347,7 @@ public class a {
try {
map = this.onlCgreportHeadService.queryCgReportConfig(paramString);
} catch (Exception exception) {
throw new JeecgBootException("动态报表配置不存在!");
throw new JeroBootException("动态报表配置不存在!");
}
List<Map> list = (List)map.get("items");
@@ -532,7 +532,7 @@ public class a {
}
else {
throw new JeecgBootException("参数错误");
throw new JeroBootException("参数错误");
}
}
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeecgBootException;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DynamicDataSourceModel;
@@ -122,7 +122,7 @@ public class b
if (ReUtil.contains(" order\\s+by ", sql.toLowerCase()) &&
"SQLSERVER".equalsIgnoreCase(str1)) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
@@ -195,7 +195,7 @@ public class b
if (ReUtil.contains(" order\\s+by ", sql.toLowerCase()) &&
"3".equalsIgnoreCase(dynamicDataSourceModel.getDbType())) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
@@ -382,7 +382,7 @@ public class b
if (ReUtil.contains(" order\\s+by ", paramString1.toLowerCase()) &&
"3".equalsIgnoreCase(dynamicDataSourceModel.getDbType())) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
@@ -398,7 +398,7 @@ public class b
a.info("parse sql with page : " + paramString1);
Map map = (Map)DynamicDBUtil.findOne(paramString2, paramString1, new Object[0]);
if (map == null) {
throw new JeecgBootException("该报表sql没有数据");
throw new JeroBootException("该报表sql没有数据");
}
set = map.keySet();
} else {
@@ -412,14 +412,14 @@ public class b
}
if (ReUtil.contains(" order\\s+by ", paramString1.toLowerCase()) &&
"SQLSERVER".equalsIgnoreCase(str)) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
IPage iPage = this.mapper.selectPageBySql(new Page(1L, 1L), paramString1);
List<Map> list = iPage.getRecords();
if (list.size() < 1) {
throw new JeecgBootException("该报表sql没有数据");
throw new JeroBootException("该报表sql没有数据");
}
set = ((Map)list.get(0)).keySet();
}
@@ -1,7 +1,7 @@
package org.jeecg.modules.online.cgreport.b;
package org.jeecg.modules.online.cgreport.constant;
public class a {
public class CgReportConstant {
public static final String a = "main";
public static final String b = "items";
public static final String c = "params";
@@ -33,6 +33,6 @@ public class a {
public static final String C = "config_iframe";
public static final String D = "popup_param_pre__";
public a() {
public CgReportConstant() {
}
}
@@ -1,5 +1,5 @@
package org.jeecg.modules.online.cgreport.a;
package org.jeecg.modules.online.cgreport.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -24,7 +24,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.PermissionData;
import com.jero.common.exception.JeecgBootException;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.DynamicDataSourceModel;
@@ -36,7 +36,7 @@ import org.jeecg.modules.online.cgreport.entity.OnlCgreportParam;
import org.jeecg.modules.online.cgreport.mapper.OnlCgreportHeadMapper;
import org.jeecg.modules.online.cgreport.service.IOnlCgreportItemService;
import org.jeecg.modules.online.cgreport.service.IOnlCgreportParamService;
import org.jeecg.modules.online.cgreport.service.a.b;
import org.jeecg.modules.online.cgreport.service.a.OnlCgreportHeadServiceImpl;
import org.jeecg.modules.online.cgreport.util.SqlUtil;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -53,10 +53,10 @@ import org.springframework.web.bind.annotation.RestController;
@RestController("onlCgreportAPI")
@RequestMapping({"/online/cgreport/api"})
public class a {
private static final Logger a = LoggerFactory.getLogger(a.class);
public class OnlCgreportAPI {
private static final Logger a = LoggerFactory.getLogger(OnlCgreportAPI.class);
@Autowired
private b onlCgreportHeadService;
private OnlCgreportHeadServiceImpl onlCgreportHeadService;
@Autowired
private IOnlCgreportItemService onlCgreportItemService;
@Autowired
@@ -64,7 +64,7 @@ public class a {
@Autowired
private IOnlCgreportParamService onlCgreportParamService;
public a() {
public OnlCgreportAPI() {
}
@GetMapping({"/getColumnsAndData/{code}"})
@@ -272,7 +272,7 @@ public class a {
@GetMapping({"/getParamsInfo/{code}"})
public Result<?> c(@PathVariable("code") String var1) {
try {
LambdaQueryWrapper var2 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var2 = new LambdaQueryWrapper();
var2.eq(OnlCgreportParam::getCgrheadId, var1);
List var3 = this.onlCgreportParamService.list(var2);
return Result.OK(var3);
@@ -288,14 +288,14 @@ public class a {
String var4 = "报表";
String var5 = "导出信息";
if (!oConvertUtils.isNotEmpty(var1)) {
throw new JeecgBootException("参数错误");
throw new JeroBootException("参数错误");
} else {
Map var6 = null;
try {
var6 = this.onlCgreportHeadService.queryCgReportConfig(var1);
} catch (Exception var35) {
throw new JeecgBootException("动态报表配置不存在!");
throw new JeroBootException("动态报表配置不存在!");
}
List var7 = (List)var6.get("items");
@@ -431,7 +431,7 @@ public class a {
@GetMapping({"/getRpColumns/{code}"})
public Result<?> d(@PathVariable("code") String var1) {
LambdaQueryWrapper var2 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportHead> var2 = new LambdaQueryWrapper();
var2.eq(OnlCgreportHead::getCode, var1);
OnlCgreportHead var3 = (OnlCgreportHead)this.onlCgreportHeadService.getOne(var2);
if (var3 == null) {
@@ -1,5 +1,5 @@
package org.jeecg.modules.online.cgreport.a;
package org.jeecg.modules.online.cgreport.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,13 +9,14 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.jero.modules.base.service.BaseCommonService;
import org.apache.commons.lang.StringUtils;
import com.jero.common.api.vo.Result;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DynamicDataSourceModel;
import com.jero.common.util.SqlInjectionUtil;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.online.cgform.util.CgformUtil;
import org.jeecg.modules.online.cgreport.entity.OnlCgreportHead;
import org.jeecg.modules.online.cgreport.entity.OnlCgreportItem;
@@ -38,8 +39,8 @@ import org.springframework.web.bind.annotation.RestController;
@RestController("onlCgreportHeadController")
@RequestMapping({"/online/cgreport/head"})
public class b {
private static final Logger a = LoggerFactory.getLogger(b.class);
public class OnlCgreportHeadController {
private static final Logger a = LoggerFactory.getLogger(OnlCgreportHeadController.class);
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
@@ -51,7 +52,7 @@ public class b {
@Autowired
private BaseCommonService baseCommonService;
public b() {
public OnlCgreportHeadController() {
}
@GetMapping({"/parseSql"})
@@ -1,5 +1,5 @@
package org.jeecg.modules.online.cgreport.a;
package org.jeecg.modules.online.cgreport.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -25,12 +25,12 @@ import org.springframework.web.bind.annotation.RestController;
@RestController("onlCgreportItemController")
@RequestMapping({"/online/cgreport/item"})
public class c {
private static final Logger a = LoggerFactory.getLogger(c.class);
public class OnlCgreportItemController {
private static final Logger a = LoggerFactory.getLogger(OnlCgreportItemController.class);
@Autowired
private IOnlCgreportItemService onlCgreportItemService;
public c() {
public OnlCgreportItemController() {
}
@GetMapping({"/listByHeadId"})
@@ -1,5 +1,5 @@
package org.jeecg.modules.online.cgreport.a;
package org.jeecg.modules.online.cgreport.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -25,12 +25,12 @@ import org.springframework.web.bind.annotation.RestController;
@RestController("onlCgreportParamController")
@RequestMapping({"/online/cgreport/param"})
public class d {
private static final Logger a = LoggerFactory.getLogger(d.class);
public class OnlCgreportParamController {
private static final Logger a = LoggerFactory.getLogger(OnlCgreportParamController.class);
@Autowired
private IOnlCgreportParamService onlCgreportParamService;
public d() {
public OnlCgreportParamController() {
}
@GetMapping({"/listByHeadId"})
@@ -21,10 +21,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service("cgReportExcelService")
public class a implements CgReportExcelServiceI {
private static final Logger a = LoggerFactory.getLogger(a.class);
public class CgReportExcelServiceImpl implements CgReportExcelServiceI {
private static final Logger a = LoggerFactory.getLogger(CgReportExcelServiceImpl.class);
public a() {
public CgReportExcelServiceImpl() {
}
public HSSFWorkbook exportExcel(String title, Collection<?> titleSet, Collection<?> dataSet) {
@@ -18,7 +18,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeecgBootException;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DynamicDataSourceModel;
@@ -36,6 +36,7 @@ import org.jeecg.modules.online.cgreport.model.OnlCgreportModel;
import org.jeecg.modules.online.cgreport.service.IOnlCgreportHeadService;
import org.jeecg.modules.online.cgreport.service.IOnlCgreportItemService;
import org.jeecg.modules.online.cgreport.service.IOnlCgreportParamService;
import org.jeecg.modules.online.cgreport.util.CgReportQueryParamUtil;
import org.jeecg.modules.online.cgreport.util.SqlUtil;
import org.jeecg.modules.online.config.b.d;
import org.jeecg.modules.online.config.exception.DBException;
@@ -46,8 +47,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("onlCgreportHeadServiceImpl")
public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> implements IOnlCgreportHeadService {
private static final Logger a = LoggerFactory.getLogger(b.class);
public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> implements IOnlCgreportHeadService {
private static final Logger a = LoggerFactory.getLogger(OnlCgreportHeadServiceImpl.class);
@Autowired
private IOnlCgreportParamService onlCgreportParamService;
@Autowired
@@ -57,7 +58,7 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
@Autowired
private ISysBaseAPI sysBaseAPI;
public b() {
public OnlCgreportHeadServiceImpl() {
}
public Map<String, Object> executeSelectSql(String sql, String onlCgreportHeadId, Map<String, Object> params) throws SQLException {
@@ -69,7 +70,7 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
var19.printStackTrace();
}
LambdaQueryWrapper var5 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var5 = new LambdaQueryWrapper();
var5.eq(OnlCgreportParam::getCgrheadId, onlCgreportHeadId);
List var6 = this.onlCgreportParamService.list(var5);
if (var6 != null && var6.size() > 0) {
@@ -102,14 +103,14 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
Integer var21 = oConvertUtils.getInt(params.get("pageSize"), 10);
Integer var22 = oConvertUtils.getInt(params.get("pageNo"), 1);
Page var24 = new Page((long)var22, (long)var21);
LambdaQueryWrapper var23 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var23 = new LambdaQueryWrapper();
var23.eq(OnlCgreportItem::getCgrheadId, onlCgreportHeadId);
var23.eq(OnlCgreportItem::getIsSearch, 1);
List var12 = this.onlCgreportItemService.list(var23);
String var13 = "jeecg_rp_temp.";
String var14 = org.jeecg.modules.online.cgreport.util.a.a(var12, params, var13, (String)null);
String var14 = CgReportQueryParamUtil.a(var12, params, var13, (String)null);
if (ReUtil.contains(" order\\s+by ", sql.toLowerCase()) && "SQLSERVER".equalsIgnoreCase(var4)) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
} else {
String var15 = "select * from (" + sql + ") jeecg_rp_temp where 1=1 " + var14;
var15 = SqlUtil.b(var15);
@@ -142,7 +143,7 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
int var8 = oConvertUtils.getInt(params.get("pageNo"), 1);
int var9 = oConvertUtils.getInt(params.get("pageSize"), 10);
a.info("【Online多数据源逻辑】报表查询参数params: " + JSON.toJSONString(params));
LambdaQueryWrapper var10 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var10 = new LambdaQueryWrapper();
var10.eq(OnlCgreportParam::getCgrheadId, onlCgreportHeadId);
List var11 = this.onlCgreportParamService.list(var10);
OnlCgreportParam var13;
@@ -160,16 +161,16 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
}
}
LambdaQueryWrapper var24 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var24 = new LambdaQueryWrapper();
var24.eq(OnlCgreportItem::getCgrheadId, onlCgreportHeadId);
var24.eq(OnlCgreportItem::getIsSearch, 1);
List var25 = this.onlCgreportItemService.list(var24);
if (ReUtil.contains(" order\\s+by ", sql.toLowerCase()) && "3".equalsIgnoreCase(var5.getDbType())) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
} else {
String var26 = "jeecg_rp_temp.";
var15 = DataBaseEnum.getDataBaseNameByValue(var5.getDbType());
String var16 = org.jeecg.modules.online.cgreport.util.a.a(var25, params, var26, var15);
String var16 = CgReportQueryParamUtil.a(var25, params, var26, var15);
String var17 = "select * from (" + sql + ") jeecg_rp_temp where 1=1 " + var16;
var17 = SqlUtil.b(var17);
String var18 = SqlUtils.getCountSql(var17);
@@ -205,10 +206,10 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
return Result.error("未找到对应实体");
} else {
super.updateById(var2);
LambdaQueryWrapper var4 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var4 = new LambdaQueryWrapper();
var4.eq(OnlCgreportItem::getCgrheadId, var2.getId());
this.onlCgreportItemService.remove(var4);
LambdaQueryWrapper var5 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var5 = new LambdaQueryWrapper();
var5.eq(OnlCgreportParam::getCgrheadId, var2.getId());
this.onlCgreportParamService.remove(var5);
Iterator var6 = values.getParams().iterator();
@@ -238,10 +239,10 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
public Result<?> delete(String id) {
boolean var2 = super.removeById(id);
if (var2) {
LambdaQueryWrapper var3 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var3 = new LambdaQueryWrapper();
var3.eq(OnlCgreportItem::getCgrheadId, id);
this.onlCgreportItemService.remove(var3);
LambdaQueryWrapper var4 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var4 = new LambdaQueryWrapper();
var4.eq(OnlCgreportParam::getCgrheadId, id);
this.onlCgreportParamService.remove(var4);
}
@@ -260,10 +261,10 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
String var5 = var2[var4];
boolean var6 = super.removeById(var5);
if (var6) {
LambdaQueryWrapper var7 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var7 = new LambdaQueryWrapper();
var7.eq(OnlCgreportItem::getCgrheadId, var5);
this.onlCgreportItemService.remove(var7);
LambdaQueryWrapper var8 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportParam> var8 = new LambdaQueryWrapper();
var8.eq(OnlCgreportParam::getCgrheadId, var5);
this.onlCgreportParamService.remove(var8);
}
@@ -317,7 +318,7 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
a.info("parse sql : " + var1);
DynamicDataSourceModel var4 = DataSourceCachePool.getCacheDynamicDataSourceModel(var2);
if (ReUtil.contains(" order\\s+by ", var1.toLowerCase()) && "3".equalsIgnoreCase(var4.getDbType())) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
if ("1".equals(var4.getDbType())) {
@@ -331,7 +332,7 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
a.info("parse sql with page : " + var1);
Map var5 = (Map)DynamicDBUtil.findOne(var2, var1, new Object[0]);
if (var5 == null) {
throw new JeecgBootException("该报表sql没有数据");
throw new JeroBootException("该报表sql没有数据");
}
var3 = var5.keySet();
@@ -346,13 +347,13 @@ public class b extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> imple
}
if (ReUtil.contains(" order\\s+by ", var1.toLowerCase()) && "SQLSERVER".equalsIgnoreCase(var8)) {
throw new JeecgBootException("SqlServer不支持SQL内排序!");
throw new JeroBootException("SqlServer不支持SQL内排序!");
}
IPage var9 = this.mapper.selectPageBySql(new Page(1L, 1L), var1);
List var6 = var9.getRecords();
if (var6.size() < 1) {
throw new JeecgBootException("该报表sql没有数据");
throw new JeroBootException("该报表sql没有数据");
}
var3 = ((Map)var6.get(0)).keySet();
@@ -15,12 +15,12 @@ import org.jeecg.modules.online.cgreport.service.IOnlCgreportItemService;
import org.springframework.stereotype.Service;
@Service("onlCgreportItemServiceImpl")
public class c extends ServiceImpl<OnlCgreportItemMapper, OnlCgreportItem> implements IOnlCgreportItemService {
public c() {
public class OnlCgreportItemServiceImpl extends ServiceImpl<OnlCgreportItemMapper, OnlCgreportItem> implements IOnlCgreportItemService {
public OnlCgreportItemServiceImpl() {
}
public List<Map<String, String>> getAutoListQueryInfo(String cgrheadId) {
LambdaQueryWrapper var2 = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlCgreportItem> var2 = new LambdaQueryWrapper();
var2.eq(OnlCgreportItem::getCgrheadId, cgrheadId);
var2.eq(OnlCgreportItem::getIsSearch, 1);
List var3 = this.list(var2);
@@ -8,7 +8,7 @@ import org.jeecg.modules.online.cgreport.service.IOnlCgreportParamService;
import org.springframework.stereotype.Service;
@Service("onlCgreportParamServiceImpl")
public class d extends ServiceImpl<OnlCgreportParamMapper, OnlCgreportParam> implements IOnlCgreportParamService {
public d() {
public class OnlCgreportParamServiceImpl extends ServiceImpl<OnlCgreportParamMapper, OnlCgreportParam> implements IOnlCgreportParamService {
public OnlCgreportParamServiceImpl() {
}
}
@@ -22,10 +22,10 @@ import org.jeecg.modules.online.config.exception.DBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class a {
private static final Logger a = LoggerFactory.getLogger(a.class);
public class CgReportQueryParamUtil {
private static final Logger a = LoggerFactory.getLogger(CgReportQueryParamUtil.class);
public a() {
public CgReportQueryParamUtil() {
}
public static void a(HttpServletRequest var0, Map<String, Object> var1, Map<String, Object> var2, Map<String, Object> var3) {