Merge pull request #3547 from dataease/pr@dev@fix_report_task_number_range_filter

fix(定时报告): 数字区间过滤器报错
This commit is contained in:
王嘉豪 2022-10-31 16:50:04 +08:00 committed by GitHub
commit ffa50c66b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View File

@ -212,7 +212,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
List<String> viewIdList = Arrays.asList(viewIds.split(",")).stream().map(s -> s.trim()).filter(viewId -> StringUtils.isNotBlank(viewId) && viewOptionIdList.contains(viewId)).collect(Collectors.toList());
PermissionProxy proxy = new PermissionProxy();
proxy.setUserId(user.getUserId());
files = viewExportExcel.export(panelId, viewIdList, proxy, justExportView);
files = viewExportExcel.export(panelId, viewIdList, proxy, justExportView, taskInstance.getTaskId().toString());
}
List<String> channels = null;

View File

@ -40,7 +40,7 @@ public class ViewExportExcel {
}.getType();
@DePermissionProxy(paramIndex = 2)
public List<File> export(String panelId, List<String> viewIds, PermissionProxy proxy, Boolean justView) throws Exception {
public List<File> export(String panelId, List<String> viewIds, PermissionProxy proxy, Boolean justView, String taskId) throws Exception {
if (CollectionUtils.isEmpty(viewIds)) {
return null;
}
@ -51,7 +51,7 @@ public class ViewExportExcel {
Map<String, ChartExtRequest> stringChartExtRequestMap = buildViewRequest(panelDto, justView);
List<File> results = new ArrayList<>();
List<ExcelSheetModel> sheets = viewIds.stream().map(viewId -> viewFiles(viewId, stringChartExtRequestMap.get(viewId))).collect(Collectors.toList());
File excelFile = ExcelUtils.exportExcel(sheets, panelDto.getName(), panelDto.getId());
File excelFile = ExcelUtils.exportExcel(sheets, panelDto.getName(), panelDto.getId() + "_" + taskId);
results.add(excelFile);
return results;
}

View File

@ -7,8 +7,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service("numberRangeWidget")
public class NumberRangeBuild extends FilterBuildTemplate {
@ -24,18 +26,22 @@ public class NumberRangeBuild extends FilterBuildTemplate {
Map<String, Object> options = null;
List<String> values = null;
if((optionObj = component.get("options")) != null && (valueObj = (options = (Map<String, Object>) optionObj).get("value")) != null && CollectionUtil.isNotEmpty((values = (List<String>) valueObj))) {
if ((optionObj = component.get("options")) != null && (valueObj = (options = (Map<String, Object>) optionObj).get("value")) != null) {
if (valueObj instanceof List) {
values = (List<String>) valueObj;
} else {
return result;
}
String min = values.get(0);
String max = null;
if(values.size() > 1) {
if (values.size() > 1) {
max = values.get(1);
}
result.setOperator("between");
result.getValue().set(0, min);
result.getValue().set(1, max);
if (StringUtils.isNotBlank(min) && StringUtils.isNotBlank(max)) {
result.setValue(values);
return result;
}