|
@@ -2042,20 +2042,26 @@ public class AgencyController extends BaseController {
|
|
|
|
|
|
@RequestMapping("/exportClubActiveInfo")
|
|
|
public void exportClubActiveInfo(ActiveClub activeClub, HttpServletRequest request, HttpServletResponse response , RedirectAttributes redirectAttributes) {
|
|
|
- String name = "客户活跃情况";
|
|
|
+ String name = StringUtils.isBlank(activeClub.getActiveStatus()) ? "客户活跃情况" : ("2".equals(activeClub.getActiveStatus()) ? "咨询游客" : "客户活跃情况");
|
|
|
try {
|
|
|
|
|
|
- List<ActiveClubExcel> clubActive = newCmClubService.exportClubActive(activeClub);
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
|
|
String fileName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20");
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
|
|
- // 这里需要设置不关闭流
|
|
|
- EasyExcel.write(response.getOutputStream(), ActiveClubExcel.class).autoCloseStream(Boolean.FALSE).sheet("客户活跃情况")
|
|
|
- .doWrite(clubActive);
|
|
|
+ if (!"2".equals(activeClub.getActiveStatus())) {
|
|
|
+ // 活跃、不活跃用户
|
|
|
+ List<ActiveClubExcel> clubActive = newCmClubService.exportClubActive(activeClub);
|
|
|
+ // 这里需要设置不关闭流
|
|
|
+ EasyExcel.write(response.getOutputStream(), ActiveClubExcel.class).autoCloseStream(Boolean.FALSE).sheet("客户活跃情况").doWrite(clubActive);
|
|
|
+ } else {
|
|
|
+ // 咨询游客
|
|
|
+ List<TouristDataExcel> touristExcels = newCmClubService.exportTourist(activeClub);
|
|
|
+ EasyExcel.write(response.getOutputStream(), TouristDataExcel.class).autoCloseStream(Boolean.FALSE).sheet("咨询游客").doWrite(touristExcels);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
- addMessage(redirectAttributes, "机构活跃数据导出失败", e.getMessage());
|
|
|
+ addMessage(redirectAttributes, "数据导出失败", e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|