zhou zhou
11 小时以前 2f8e173048d22c5b40612c3538b9c1aa5a5397f6
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;
@@ -32,7 +33,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
@@ -91,6 +92,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 +174,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 +189,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 +208,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);
    }