提交 a9e815e4 作者: 925993793@qq.com

导出excel的bug修改

上级 a8d31b34
...@@ -549,11 +549,11 @@ public class EventDataController { ...@@ -549,11 +549,11 @@ public class EventDataController {
* 导出excel * 导出excel
* *
* @param projectId 项目id * @param projectId 项目id
* @param ids 资讯id集合
* @param subjectId 事件id * @param subjectId 事件id
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param position 搜索位置(title-标题;content-内容) * @param position 搜索位置(title-标题;content-内容)
* @param category 匹配度(1-模糊;2-精确) * @param category 匹配度(1-模糊;2-精确)
* @param origin 来源
* @param labelId 标签id * @param labelId 标签id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
...@@ -564,19 +564,18 @@ public class EventDataController { ...@@ -564,19 +564,18 @@ public class EventDataController {
*/ */
@ApiOperation(value = "专题信息列表-导出excel", notes = "专题信息列表-导出excel") @ApiOperation(value = "专题信息列表-导出excel", notes = "专题信息列表-导出excel")
@GetMapping(value = "/exportExcel") @GetMapping(value = "/exportExcel")
public void queryPageList(@RequestParam(name = "projectId", defaultValue = "1476527644425682945") String projectId, public void exportExcel(@RequestParam(name = "projectId", defaultValue = "1476527644425682945") String projectId,
@RequestParam(name = "ids", required = false) List<String> ids, @RequestParam(name = "ids", required = false) List<String> ids,
@RequestParam(name = "subjectId", required = false) String subjectId, @RequestParam(name = "subjectId") String subjectId,
@RequestParam(name = "searchWord", required = false) String searchWord, @RequestParam(name = "searchWord", required = false) String searchWord,
@RequestParam(name = "position", required = false) String position, @RequestParam(name = "position", required = false) String position,
@RequestParam(name = "category", required = false) Integer category, @RequestParam(name = "category", required = false) Integer category,
@RequestParam(name = "origin", required = false) String origin, @RequestParam(name = "labelId", required = false) String labelId,
@RequestParam(name = "labelId", required = false) String labelId, @RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "startTime", required = false) String startTime, @RequestParam(name = "endTime", required = false) String endTime,
@RequestParam(name = "endTime", required = false) String endTime, @RequestParam(name = "column", defaultValue = "publishDate") String column,
@RequestParam(name = "column", defaultValue = "publishDate") String column, @RequestParam(name = "order", defaultValue = "desc") String order,
@RequestParam(name = "order", defaultValue = "desc") String order, HttpServletResponse response) {
HttpServletResponse response) {
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
String username = currentUser.getUsername(); String username = currentUser.getUsername();
List<String> subjectIdList = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
...@@ -595,8 +594,8 @@ public class EventDataController { ...@@ -595,8 +594,8 @@ public class EventDataController {
List<String> headers = Arrays.asList(arr); List<String> headers = Arrays.asList(arr);
SXSSFWorkbook workbook = new SXSSFWorkbook(); SXSSFWorkbook workbook = new SXSSFWorkbook();
int pageSize = 1000; int pageSize = 1000;
for (int i = 0; ; i++) { for (int i = 1; ; i++) {
List<SubjectDataVo> informationList = esService.exportList(subjectIdList, ids, searchWord, position, category, origin, labelId, startTime, endTime, column, order, i, pageSize); List<SubjectDataVo> informationList = esService.exportList(subjectIdList, ids, searchWord, position, category, labelId, startTime, endTime, column, order, i, pageSize);
log.info("本次循环-{},数据量为-{}", i, informationList.size()); log.info("本次循环-{},数据量为-{}", i, informationList.size());
if (CollectionUtils.isEmpty(informationList)) { if (CollectionUtils.isEmpty(informationList)) {
break; break;
......
...@@ -325,7 +325,7 @@ public class EsService { ...@@ -325,7 +325,7 @@ public class EsService {
return pageData; return pageData;
} }
public List<SubjectDataVo> exportList(List<String> subjectIdList,List<String> ids, String searchWord, String position, Integer category, String origin, public List<SubjectDataVo> exportList(List<String> subjectIdList,List<String> ids, String searchWord, String position, Integer category,
String labelId, String startTime, String endTime, String column, String order, int pageNo, int pageSize) { String labelId, String startTime, String endTime, String column, String order, int pageNo, int pageSize) {
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -366,9 +366,6 @@ public class EsService { ...@@ -366,9 +366,6 @@ public class EsService {
boolQuery.must(QueryBuilders.matchPhraseQuery(position, searchWord)); boolQuery.must(QueryBuilders.matchPhraseQuery(position, searchWord));
} }
} }
if (StringUtils.isNotBlank(origin)) {
boolQuery.must(QueryBuilders.matchPhraseQuery("origin", origin));
}
if (StringUtils.isNotBlank(labelId)) { if (StringUtils.isNotBlank(labelId)) {
boolQuery.must(QueryBuilders.nestedQuery("labels", QueryBuilders.termQuery("labels.relationId", labelId), ScoreMode.None)); boolQuery.must(QueryBuilders.nestedQuery("labels", QueryBuilders.termQuery("labels.relationId", labelId), ScoreMode.None));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论