This commit is contained in:
dute7liang
2024-01-16 21:33:52 +08:00
parent 834d78b91b
commit a6876dabb4
7 changed files with 93 additions and 30 deletions

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.cai.domain.AccountCash;
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
import com.ruoyi.cai.enums.AccountCashStatusEnum;
import com.ruoyi.cai.service.AccountCashService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
@@ -15,6 +16,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
@@ -23,8 +25,11 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户提现记录
@@ -76,38 +81,54 @@ public class AccountCashController extends BaseController {
return R.ok(accountCashService.getById(id));
}
/**
* 新增用户提现记录
*/
@SaCheckPermission("cai:accountCash:add")
@Log(title = "用户提现记录", businessType = BusinessType.INSERT)
// @SaCheckPermission("cai:accountCash:edit")
@Log(title = "用户提现通过", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody AccountCash bo) {
return toAjax(accountCashService.save(bo));
@GetMapping("/success")
public R<Void> success(Long id) {
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
.set(AccountCash::getVerifyTime, LocalDateTime.now())
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
.set(AccountCash::getStatus, AccountCashStatusEnum.SUCCESS.getCode())
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
.eq(AccountCash::getId,id));
return R.ok();
}
/**
* 修改用户提现记录
*/
@SaCheckPermission("cai:accountCash:edit")
@Log(title = "用户提现记录", businessType = BusinessType.UPDATE)
@Log(title = "用户提现不通过", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AccountCash bo) {
return toAjax(accountCashService.updateById(bo));
@GetMapping("/fail")
public R<Void> fail(Long id) {
accountCashService.fail(id);
return R.ok();
}
/**
* 删除用户提现记录
*
* @param ids 主键串
*/
@SaCheckPermission("cai:accountCash:remove")
@Log(title = "用户提现记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Integer[] ids) {
return toAjax(accountCashService.removeBatchByIds(Arrays.asList(ids)));
@Log(title = "用户提现取消", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@GetMapping("/close")
public R<Void> close(Long id) {
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
.set(AccountCash::getVerifyTime, LocalDateTime.now())
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
.set(AccountCash::getStatus, AccountCashStatusEnum.CLOSE.getCode())
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
.eq(AccountCash::getId,id));
return R.ok();
}
@Log(title = "用户提现批量通过", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@GetMapping("/batchSuccess")
public R<Void> batchSuccess(String ids) {
List<String> idList = Arrays.stream(ids.split(",")).collect(Collectors.toList());
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
.set(AccountCash::getVerifyTime, LocalDateTime.now())
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
.set(AccountCash::getStatus, AccountCashStatusEnum.SUCCESS.getCode())
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
.in(AccountCash::getId,idList));
return R.ok();
}
}