From 999ee579f2d18132d29d39f709c4e15d4843b668 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Fri, 01 Mar 2024 15:34:28 +0800
Subject: [PATCH] bug 修复
---
src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 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 9cc4d3a..bd40dce 100644
--- a/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java
+++ b/src/main/java/org/springblade/modules/discuss/controller/UserTopicsController.java
@@ -25,21 +25,25 @@
import lombok.AllArgsConstructor;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.discuss.entity.PublicDiscussEntity;
import org.springblade.modules.discuss.entity.UserTopicsEntity;
+import org.springblade.modules.discuss.excel.UserTopicsExcel;
import org.springblade.modules.discuss.service.IPublicDiscussService;
import org.springblade.modules.discuss.service.IUserTopicsService;
import org.springblade.modules.discuss.vo.TopicsVO;
import org.springblade.modules.discuss.vo.UserTopicsVO;
import org.springblade.modules.discuss.wrapper.UserTopicsWrapper;
+import org.springblade.modules.house.excel.HouseExcel;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
@@ -67,6 +71,7 @@
UserTopicsEntity detail = userTopicsService.getOne(Condition.getQueryWrapper(userTopics));
return R.data(UserTopicsWrapper.build().entityVO(detail));
}
+
/**
* 用户议题报表 分页
*/
@@ -124,7 +129,6 @@
if (one.getVoteRestrictions().equals(CommonConstant.NUMBER_ONE)) {
long count = userTopicsService.count(Wrappers.<UserTopicsEntity>lambdaQuery()
.eq(UserTopicsEntity::getPublicDiscussId, userTopics.getPublicDiscussId())
- .eq(UserTopicsEntity::getUserId, userTopics.getUserId())
.eq(UserTopicsEntity::getHouseCode, userTopics.getHouseCode()));
if (count > 0) {
return R.fail("您房屋已经投票,不能重复投票!");
@@ -147,8 +151,11 @@
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
- return R.status(userTopicsService.removeByIds(Func.toLongList(ids)));
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Integer ids) {
+ UserTopicsEntity userTopicsEntity = new UserTopicsEntity();
+ userTopicsEntity.setDeleteFlag(1);
+ userTopicsEntity.setId(ids);
+ return R.status(userTopicsService.updateById(userTopicsEntity));
}
/**
@@ -158,8 +165,22 @@
@ApiOperationSupport(order = 5)
@ApiOperation(value = "批量更新", notes = "传入topics")
public R updateBath(@Valid @RequestBody List<TopicsVO> topics) throws Exception {
- Boolean result = userTopicsService.batchSave(topics);
- return R.status(result);
+ String result = userTopicsService.batchSave(topics);
+ if (result.equals("200")) {
+ R.data("操作成功");
+ }
+ return R.fail(result);
+ }
+
+ /**
+ * 导出用户
+ */
+ @GetMapping("/exportUser")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "导出用户", notes = "传入userTopics")
+ public void exportUser(UserTopicsVO userTopics, HttpServletResponse response) {
+ List<UserTopicsExcel> list = userTopicsService.exportUser(userTopics);
+ ExcelUtil.export(response, "投票人员" + DateUtil.time(), "投票人员数据表", list, UserTopicsExcel.class);
}
--
Gitblit v1.9.3