From b1c9e5683cee961946e85297eb581f26cff694ef Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期四, 09 四月 2026 15:00:07 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaveController.java | 42 +++++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaveController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaveController.java
index bb74603..94628df 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaveController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaveController.java
@@ -9,6 +9,7 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.domain.PageResult;
import com.vincent.rsf.server.common.utils.ExcelUtil;
+import com.vincent.rsf.server.common.utils.OptimisticLockUtils;
import com.vincent.rsf.server.common.annotation.OperationLog;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.KeyValVo;
@@ -25,6 +26,7 @@
import com.vincent.rsf.server.manager.service.WaveService;
import com.vincent.rsf.server.manager.service.impl.TaskItemLogServiceImpl;
import com.vincent.rsf.server.manager.service.impl.WaveItemServiceImpl;
+import com.vincent.rsf.server.manager.utils.buildPageRowsUtils;
import com.vincent.rsf.server.system.controller.BaseController;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@@ -32,7 +34,7 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@@ -54,7 +56,9 @@
public R page(@RequestBody Map<String, Object> map) {
BaseParam baseParam = buildParam(map, BaseParam.class);
PageParam<Wave, BaseParam> pageParam = new PageParam<>(baseParam, Wave.class);
- return R.ok().add(waveService.page(pageParam, pageParam.buildWrapper(true)));
+ PageParam<Wave, BaseParam> page = waveService.page(pageParam, pageParam.buildWrapper(true));
+ buildPageRowsUtils.userNameMap(page.getRecords());
+ return R.ok().add(page);
}
@PreAuthorize("hasAuthority('manager:wave:list')")
@@ -91,6 +95,7 @@
@OperationLog("Update 娉㈡鍗曟嵁")
@PostMapping("/wave/update")
public R update(@RequestBody Wave wave) {
+ OptimisticLockUtils.requireVersion("娉㈡", wave.getVersion());
wave.setUpdateBy(getLoginUserId());
wave.setUpdateTime(new Date());
if (!waveService.updateById(wave)) {
@@ -172,9 +177,14 @@
@ApiOperation("鏆傚仠涓嬪彂浠诲姟")
@PostMapping("/wave/pause/pub/{id}")
public R pausePublicTask(@PathVariable Long id) {
- waveService.update(new LambdaUpdateWrapper<Wave>()
- .eq(Wave::getId, id)
- .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_PAUSE.val));
+ Wave wave = waveService.getById(id);
+ if (Objects.isNull(wave)) {
+ throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦紒锛�");
+ }
+ wave.setExceStatus(WaveExceStatus.WAVE_EXCE_STATUS_PAUSE.val);
+ if (!waveService.updateById(wave)) {
+ throw new CoolException("娉㈡鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
return R.ok();
}
@@ -182,9 +192,14 @@
@ApiOperation("缁х画涓嬪彂浠诲姟")
@PostMapping("/wave/continue/pub/{id}")
public R continuePublicTask(@PathVariable Long id) {
- waveService.update(new LambdaUpdateWrapper<Wave>()
- .eq(Wave::getId, id)
- .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val));
+ Wave wave = waveService.getById(id);
+ if (Objects.isNull(wave)) {
+ throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦紒锛�");
+ }
+ wave.setExceStatus(WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val);
+ if (!waveService.updateById(wave)) {
+ throw new CoolException("娉㈡鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
return R.ok();
}
@@ -196,9 +211,14 @@
if (Objects.isNull(id)) {
return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
}
- waveService.update(new LambdaUpdateWrapper<Wave>()
- .eq(Wave::getId, id)
- .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_PAUSE.val));
+ Wave wave = waveService.getById(id);
+ if (Objects.isNull(wave)) {
+ throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦紒锛�");
+ }
+ wave.setExceStatus(WaveExceStatus.WAVE_EXCE_STATUS_PAUSE.val);
+ if (!waveService.updateById(wave)) {
+ throw new CoolException("娉㈡鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
return waveService.stopPubTask(id);
}
--
Gitblit v1.9.1