|
|
@@ -1,6 +1,8 @@
|
|
|
package com.izouma.wenlvju.web.performance;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.izouma.wenlvju.domain.performance.Participant;
|
|
|
import com.izouma.wenlvju.domain.performance.Performance;
|
|
|
import com.izouma.wenlvju.domain.performance.Programme;
|
|
|
import com.izouma.wenlvju.dto.*;
|
|
|
@@ -29,6 +31,7 @@ import java.io.IOException;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
@@ -252,7 +255,23 @@ public class ProgrammeController extends BaseController {
|
|
|
@ResponseBody
|
|
|
public void excelResult(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|
|
|
List<ProgrammeResultDTO> data = this.result(pageQuery).getContent();
|
|
|
- ExcelUtils.export(response, data);
|
|
|
+ List<Long> ids = data.stream().map(ProgrammeResultDTO::getId).collect(Collectors.toList());
|
|
|
+ Map<Long, List<Participant>> collect = participantRepo.findAllByProgrammeIdIn(ids)
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.groupingBy(Participant::getProgrammeId));
|
|
|
+ List<ProgrammeResultDTO> result = data.stream()
|
|
|
+ .peek(da -> {
|
|
|
+ if (ObjectUtil.isNotNull(collect.get(da.getId()))) {
|
|
|
+ String name = collect.get(da.getId())
|
|
|
+ .stream()
|
|
|
+ .map(Participant::getName)
|
|
|
+ .collect(Collectors.joining("、"));
|
|
|
+ da.setQuantityName(name);
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ExcelUtils.export(response, result);
|
|
|
}
|
|
|
}
|
|
|
|