|
|
|
@ -115,28 +115,47 @@ public class CustomReportImpl implements CustomReportInterface {
|
|
|
|
|
int k=0;
|
|
|
|
|
for(CustomReportSearchConditionConfig searchConditionConfig:conditionConfigList)
|
|
|
|
|
{
|
|
|
|
|
if(searchConditionConfig.getDailogCheckboxSQL().trim().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (searchConditionConfig.getDailogCheckboxSQL().trim().isEmpty()) {
|
|
|
|
|
|
|
|
|
|
conditionConfigList.get(k).setFieldValueList(new ArrayList());
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
String dictOrSql = searchConditionConfig.getDailogCheckboxSQL();
|
|
|
|
|
if (dictOrSql.startsWith("SELECT".toUpperCase())) {
|
|
|
|
|
//当 弹出复选框数据获取SQL 有值时,依SQL获取相应的字段值列表
|
|
|
|
|
|
|
|
|
|
//List<Map<String, Object>> result=logicService.executeQuery(site, searchConditionConfig.getDailogCheckboxSQL().trim(), new HashMap<String,Object>());
|
|
|
|
|
List<Map<String, Object>> result = customReportMapper.executeSqlQuery( searchConditionConfig.getDailogCheckboxSQL().trim() );
|
|
|
|
|
if(result.size()>0)
|
|
|
|
|
{
|
|
|
|
|
List<String> lst=new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
for(Map<String,Object> m:result)
|
|
|
|
|
{
|
|
|
|
|
for(String key:m.keySet())
|
|
|
|
|
{
|
|
|
|
|
lst.add(m.get(key).toString());
|
|
|
|
|
List<Map<String, Object>> result = customReportMapper.executeSqlQuery(dictOrSql.trim());
|
|
|
|
|
if (result.size() > 0) {
|
|
|
|
|
List<Map<String, Object>> lst = new ArrayList<>();
|
|
|
|
|
for (Map<String, Object> m : result) {
|
|
|
|
|
Map<String, Object> _map = new HashMap<>();
|
|
|
|
|
for (String key : m.keySet()) {
|
|
|
|
|
_map.put("key", m.get(key));
|
|
|
|
|
_map.put("text", m.get(key));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
lst.add(_map);
|
|
|
|
|
}
|
|
|
|
|
conditionConfigList.get(k).setFieldValueList(lst);
|
|
|
|
|
}
|
|
|
|
|
} else if (dictOrSql.contains("*") && dictOrSql.contains(";")) {
|
|
|
|
|
String[] dictOrSqlArray = dictOrSql.split(";");
|
|
|
|
|
if (dictOrSqlArray != null && dictOrSqlArray.length > 0) {
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> _map = null;
|
|
|
|
|
for (int i = 0; i < dictOrSqlArray.length; i++) {
|
|
|
|
|
String keyValue = dictOrSqlArray[i];
|
|
|
|
|
if (!keyValue.contains("*")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
_map = new HashMap<>();
|
|
|
|
|
_map.put("key", keyValue.split("\\*")[0]);
|
|
|
|
|
_map.put("text", keyValue.split("\\*")[1]);
|
|
|
|
|
mapList.add(_map);
|
|
|
|
|
}
|
|
|
|
|
conditionConfigList.get(k).setFieldValueList(mapList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
k++;
|
|
|
|
@ -202,24 +221,15 @@ public class CustomReportImpl implements CustomReportInterface {
|
|
|
|
|
|
|
|
|
|
if(querySentence.trim().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
//70502.simple=请在检索语句配置栏填写 SQL语句
|
|
|
|
|
//throw Exceptions.convert(new BasicBOBeanException(70502,new Data()));
|
|
|
|
|
throw new RuntimeException("请在检索语句配置栏填写 SQL语句");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
param=null;
|
|
|
|
|
|
|
|
|
|
//2.依定的规则 检索语句中需替换的内容 以 :开头,所以此处依:先做下判断是否有需替换的内容
|
|
|
|
|
|
|
|
|
|
if(querySentence.indexOf(":")>1)
|
|
|
|
|
{
|
|
|
|
|
//处理需替换的数据
|
|
|
|
|
|
|
|
|
|
//自定义报表_检索条件动态SQL配置
|
|
|
|
|
List<CustomReportSearchConditionDynSQLConfig> dynSQLConfigList=new ArrayList<CustomReportSearchConditionDynSQLConfig>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
param = new HashMap<String, Object>();
|
|
|
|
|
param = new HashMap();
|
|
|
|
|
param.put("MAINHANDLE", "CustomReportBO:*,"+reportID);
|
|
|
|
|
|
|
|
|
|
//map=logicService.executeQuery(site, QUERY_DYNSQLCONFIG_SQL, param);
|
|
|
|
@ -235,10 +245,8 @@ public class CustomReportImpl implements CustomReportInterface {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(object.getString(dynSqlConfigMap.get(i).toString())==null || object.getString(dynSqlConfigMap.get(i).getConditionField()).isEmpty())
|
|
|
|
|
if( dynSqlConfigMap == null || dynSqlConfigMap.get(i)==null || object.getString(dynSqlConfigMap.get(i).getConditionField()) == null)
|
|
|
|
|
{
|
|
|
|
|
//当前台的json格式字串中没有 依赖条件的值时,即表示查询条件中无此项,可直接赋空字串
|
|
|
|
|
//queryMap.put(map.get(i).get("DYN_CONDITION_REPLACE_FIELD").toString().trim(), "");
|
|
|
|
|
querySentence=querySentence.replaceAll(dynSqlConfigMap.get(i).getDynConditionReplaceField().trim(), " ");
|
|
|
|
|
|
|
|
|
|
}else
|
|
|
|
@ -268,11 +276,11 @@ public class CustomReportImpl implements CustomReportInterface {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.执行查询
|
|
|
|
|
Map<String,Object> siteParam=new HashMap<String, Object>();
|
|
|
|
|
//siteParam.put("SITE", site);
|
|
|
|
|
|
|
|
|
|
//替换站点 2021/08/19
|
|
|
|
|
querySentence = querySentence.replace(":SITE","\'"+site+"\'");
|
|
|
|
|
|
|
|
|
|
//3.执行查询
|
|
|
|
|
//List<Map<String, Object>> result=logicService.executeQuery(site, querySentence,siteParam);
|
|
|
|
|
List<Map<String, Object>> result= customReportMapper.executeSqlQuery( querySentence );
|
|
|
|
|
|
|
|
|
@ -289,7 +297,5 @@ public class CustomReportImpl implements CustomReportInterface {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|