From 5123f48f469dba99f6929a3f6abbe3690ce3e8c2 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Fri, 29 Mar 2024 17:37:13 +0800
Subject: [PATCH] 短信验证码+导出议事报名人员+居住证申请统计bug

---
 src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java b/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java
index 5f806a0..09bae54 100644
--- a/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java
+++ b/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java
@@ -19,10 +19,13 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.xxl.job.core.biz.impl.ExecutorBizImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.excel.util.ExcelUtil;
@@ -45,6 +48,8 @@
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.io.OutputStream;
+import java.net.URLEncoder;
 import java.util.List;
 
 /**
@@ -58,6 +63,8 @@
 @RequestMapping("blade-userTopics/userTopics")
 @Api(value = "用户议题报表", tags = "用户议题报表接口")
 public class UserTopicsController extends BladeController {
+	private static Logger logger = LoggerFactory.getLogger(UserTopicsController.class);
+
 
 	private final IUserTopicsService userTopicsService;
 
@@ -143,7 +150,7 @@
 	@PostMapping("/updateBath")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "批量更新", notes = "传入topics")
-	public R updateBath(@Valid @RequestBody List<TopicsVO> topics) throws Exception {
+	public R updateBath(@Valid @RequestBody TopicsVO topics) throws Exception {
 		String result = userTopicsService.batchSave(topics);
 		if (result.equals("200")) {
 			return R.data("操作成功");
@@ -162,5 +169,18 @@
 		ExcelUtil.export(response, "投票人员" + DateUtil.time(), "投票人员数据表", list, UserTopicsExcel.class);
 	}
 
+	@GetMapping("/exportDataIndex")
+	public void exportExcel(HttpServletResponse response,UserTopicsVO userTopics) {
+		try (OutputStream out = response.getOutputStream()) {
+			response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+			response.setCharacterEncoding("utf-8");
+			String fileName = URLEncoder.encode("投票人员", "UTF-8").replaceAll("\\+", "%20");
+			response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+			userTopicsService.handleExcel(out,userTopics);
+			out.flush();
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}}
+
 
 }

--
Gitblit v1.9.3