|
@ -515,9 +515,9 @@ public class ResourceBrowseService extends BaseJpaService {
|
|
|
if (rsResources == null) {
|
|
|
throw new ApiException( "无效的资源编码" + code,ErrorCode.BAD_REQUEST.value());
|
|
|
}
|
|
|
if(rsResources.getDataSource()==2&&codeList.size()>1){
|
|
|
throw new ApiException("指标统计,只能选择当个指标");
|
|
|
}
|
|
|
// if(rsResources.getDataSource()==2&&codeList.size()>1){
|
|
|
// throw new ApiException("指标统计,只能选择单个指标");
|
|
|
// }
|
|
|
List<RsResourceMetadata> resourceMetadataList = resourceBrowseMetadataDao.findResourceMetadata(code);
|
|
|
for (RsResourceMetadata metadata:resourceMetadataList){
|
|
|
filedMap.put(metadata.getMetadataId(),code);
|
|
@ -549,10 +549,6 @@ public class ResourceBrowseService extends BaseJpaService {
|
|
|
paramSql = param.getParamValue();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(!StringUtils.isEmpty(paramSql)){
|
|
|
tableName = resourceBrowseDao.transforParam(paramSql,tableName);
|
|
|
}
|
|
|
}
|
|
|
String code1 = codeList.get(0);
|
|
|
int codeLength = codeList.size();
|
|
@ -568,6 +564,14 @@ public class ResourceBrowseService extends BaseJpaService {
|
|
|
}
|
|
|
|
|
|
tableName = tableName.substring(0,tableName.length()-1);
|
|
|
|
|
|
Map<String,String> dataMap = null;
|
|
|
if (!StringUtils.isEmpty(queryCondition)) {
|
|
|
dataMap = parseConditionMap(queryCondition);
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(paramSql)){
|
|
|
tableName = resourceBrowseDao.transforParam(paramSql,tableName,dataMap);
|
|
|
}
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
if (!StringUtils.isEmpty(queryCondition)) {
|
|
|
stringBuffer = parseCondition1(queryCondition);
|
|
@ -580,7 +584,12 @@ public class ResourceBrowseService extends BaseJpaService {
|
|
|
List<String> customizeList = (List<String>) objectMapper.readValue(metaData, List.class);
|
|
|
//参数集合
|
|
|
List<String> paramList = new ArrayList<>(customizeList.size() * 2);
|
|
|
Map<String,Integer> fieldMap = new HashMap<>();//去除重复的列
|
|
|
for (String id : customizeList) {
|
|
|
if(fieldMap.containsKey(id)){
|
|
|
continue;
|
|
|
}
|
|
|
fieldMap.put(id,1);
|
|
|
String codeTmp = filedMap.get(id);
|
|
|
if(id.contains("-")){
|
|
|
String tmp = id.substring(id.lastIndexOf("-")+1);
|
|
@ -750,6 +759,33 @@ public class ResourceBrowseService extends BaseJpaService {
|
|
|
return stringBuffer;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询条件转换
|
|
|
*
|
|
|
* @param queryCondition
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private Map<String,String> parseConditionMap(String queryCondition) throws Exception {
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, Map.class);
|
|
|
List<Map<String, Object>> list = objectMapper.readValue(queryCondition, javaType);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (Map<String, Object> item : list) {
|
|
|
String andOr = String.valueOf(item.get("andOr")).trim();
|
|
|
String field = String.valueOf(item.get("field")).trim();
|
|
|
if(field.contains("-")){
|
|
|
field = field.substring(field.lastIndexOf("-")+1);
|
|
|
}
|
|
|
String cond = String.valueOf(item.get("condition")).trim();
|
|
|
String value = String.valueOf(item.get("value"));
|
|
|
map.put(field,value);
|
|
|
}
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增参数
|
|
|
*
|