feat:钱包申请防止重复提交

This commit is contained in:
dzc committed 2026-04-29 11:12:37 +08:00
1 parent 8422ed1d4b
commit 7f8f160863
4 files changed
+13 -15

No files matched your search

@@ -98,6 +98,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-idempotent</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
@@ -1,6 +1,7 @@
package com.bsd.pjcloud.flow.task.controller;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
import com.bsd.pjcloud.flow.task.dto.BatchCompleteTaskDto;
import com.bsd.pjcloud.flow.task.dto.TaskParamDto;
import com.bsd.pjcloud.flow.task.service.ITaskService;
@@ -51,8 +52,8 @@ public class TaskController {
*/
@SneakyThrows
@PostMapping("completeTask")
@Idempotent(expireTime = 3, key = "'/task/completeTask/' + #completeParamDto.getTaskId()", info = "正在操作中,请勿重复操作")
public R completeTask(@RequestBody TaskParamDto completeParamDto) {
return taskService.completeTask(completeParamDto);
}
@@ -86,7 +86,7 @@ public class WalletRechargeApplyController {
@SysLog("提交申请")
@GetMapping("/apply")
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_apply')")
@Idempotent(expireTime = 5, info = "正在申请中,请勿重复操作")
@Idempotent(expireTime = 5, key = "'/wallet-recharge-apply/apply/' + #id", info = "正在申请中,请勿重复操作")
public R apply(@RequestParam Long id) {
walletRechargeApplyService.apply(id);
return R.ok(true);
@@ -173,13 +173,13 @@ public class WalletRechargeApplyController {
}
@PostMapping("/read-excel")
@Idempotent(expireTime = 3, info = "正在上传中,请勿重复操作")
@Idempotent(expireTime = 3, key = "'/wallet-recharge-apply/read-excel'", info = "正在上传中,请勿重复操作")
public R readExcel(@RequestExcel List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult, @RequestParam(required = false) String bizType) {
return walletRechargeApplyService.readExcel(excelVOList, bindingResult, bizType);
}
@PostMapping("/read-topup-excel")
@Idempotent(expireTime = 3, info = "正在上传中,请勿重复操作")
@Idempotent(expireTime = 3, key = "'/wallet-recharge-apply/read-topup-excel'", info = "正在上传中,请勿重复操作")
public R readTopupExcel(@RequestExcel List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult) {
return walletRechargeApplyService.readTopupExcel(excelVOList, bindingResult);
}
@@ -1,21 +1,14 @@
package com.bsd.pjcloud.wallet.controller.recharge;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.wallet.api.constant.WalletInvoiceStatusCheckEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletManageBalanceDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeBindInvoiceDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeInvoiceApplyDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeInvoiceRefreshDto;
@@ -34,8 +27,6 @@ import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 充值/扣款申请发票记录
*/
@@ -59,7 +50,7 @@ public class WalletRechargeInvoiceController {
@Operation(summary = "重新生成发票", description = "重新生成发票")
@SysLog("重新生成发票")
@PostMapping("/refreshInvoice")
@Idempotent(expireTime = 10, info = "正在重新生成发票中,请勿重复操作")
@Idempotent(expireTime = 3, key = "'/walletRechargeInvoice/refreshInvoice/' + #dto.getId()", info = "正在重新生成发票中,请勿重复操作")
public R refreshInvoice(@Valid @RequestBody WalletRechargeInvoiceRefreshDto dto) {
walletRechargeInvoiceService.refreshInvoice(dto);
return R.ok(true);
@@ -68,7 +59,7 @@ public class WalletRechargeInvoiceController {
@Operation(summary = "提交申请", description = "提交申请")
@SysLog("提交申请")
@PostMapping("/apply")
@Idempotent(expireTime = 3, info = "正在申请中,请勿重复操作")
@Idempotent(expireTime = 3, key = "'/walletRechargeInvoice/apply/' + #body.getId()", info = "正在申请中,请勿重复操作")
public R apply(@Valid @RequestBody WalletRechargeInvoiceApplyDto body) {
walletRechargeInvoiceService.apply(body);
return R.ok(true);
@@ -83,6 +74,7 @@ public class WalletRechargeInvoiceController {
@GetMapping("/back")
@Operation(summary = "退回作废发票")
@Idempotent(expireTime = 3, key = "'/walletRechargeInvoice/back/' + #id", info = "正在退回中,请勿重复操作")
public R backInvoice(@RequestParam("id") Long id) {
walletRechargeInvoiceService.backInvoice(id);
return R.ok();
@@ -90,6 +82,7 @@ public class WalletRechargeInvoiceController {
@PostMapping("/bind-invoice")
@Operation(summary = "绑定发票")
@Idempotent(expireTime = 3, key = "'/walletRechargeInvoice/bind-invoice/' + #dto.getApplyId()", info = "正在申请中,请勿重复操作")
public R bindInvoice(@Valid @RequestBody WalletRechargeBindInvoiceDto dto) {
walletRechargeInvoiceService.bindInvoice(dto);
return R.ok();