123
This commit is contained in:
@@ -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.dto.admin.vo.account.ExportBatchAuditVo;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.service.AccountCashService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
@@ -17,8 +18,10 @@ 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.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -65,6 +68,15 @@ public class AccountCashController extends BaseController {
|
||||
ExcelUtil.exportExcel(list, "用户提现记录", AccountCashAdminVo.class, response);
|
||||
}
|
||||
|
||||
@Log(title = "用户导入提现通过", businessType = BusinessType.IMPORT)
|
||||
@SaCheckPermission("cai:accountCash:edit")
|
||||
@PostMapping(value = "/importAudit", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<ExportBatchAuditVo> importData(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
List<AccountCashAdminVo> result = ExcelUtil.importExcel(file.getInputStream(), AccountCashAdminVo.class);
|
||||
ExportBatchAuditVo audit = accountCashService.batchAudit(result);
|
||||
return R.ok(audit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户提现记录详细信息
|
||||
*
|
||||
|
||||
@@ -33,6 +33,7 @@ public class AccountCash implements Serializable {
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.cai.dto.admin.vo.account;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExportBatchAuditVo {
|
||||
private String message;
|
||||
private Integer successNum;
|
||||
private Integer ignoreNum;
|
||||
private Integer allNum;
|
||||
private Integer failNum;
|
||||
|
||||
}
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
|
||||
import com.ruoyi.cai.dto.admin.vo.account.ExportBatchAuditVo;
|
||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户提现记录Service接口
|
||||
*
|
||||
@@ -20,4 +23,7 @@ public interface AccountCashService extends IService<AccountCash> {
|
||||
Page<AccountCashAdminVo> pageAdmin(PageQuery pageQuery, AccountCashAdminVo bo);
|
||||
|
||||
void fail(Long id);
|
||||
|
||||
ExportBatchAuditVo batchAudit(List<AccountCashAdminVo> result);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.ruoyi.cai.domain.AccountBankcard;
|
||||
import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.domain.WithdrawExchange;
|
||||
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
|
||||
import com.ruoyi.cai.dto.admin.vo.account.ExportBatchAuditVo;
|
||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.enums.AuditStatusEnum;
|
||||
import com.ruoyi.cai.manager.IdManager;
|
||||
import com.ruoyi.cai.mapper.AccountCashMapper;
|
||||
import com.ruoyi.cai.service.AccountCashService;
|
||||
@@ -23,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, AccountCash> implements AccountCashService {
|
||||
@@ -84,5 +87,42 @@ public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, Accou
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExportBatchAuditVo batchAudit(List<AccountCashAdminVo> result) {
|
||||
ExportBatchAuditVo res = new ExportBatchAuditVo();
|
||||
Integer allNum = result.size();
|
||||
Integer successNum = 0;
|
||||
Integer ignoreNum = 0;
|
||||
Integer failNum = 0;
|
||||
for (AccountCashAdminVo vo : result) {
|
||||
try {
|
||||
AccountCash cash = this.getById(vo.getId());
|
||||
if(!AuditStatusEnum.AUDITING.getCode().equals(cash.getStatus())){
|
||||
ignoreNum++;
|
||||
continue;
|
||||
}
|
||||
boolean update = this.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.eq(AccountCash::getId, vo.getId())
|
||||
.eq(AccountCash::getStatus, AuditStatusEnum.AUDITING.getCode())
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.SUCCESS.getCode()));
|
||||
if(update){
|
||||
successNum++;
|
||||
}else{
|
||||
ignoreNum++;
|
||||
}
|
||||
}catch (Exception e){
|
||||
failNum++;
|
||||
log.error("提现申请审核失败");
|
||||
}
|
||||
}
|
||||
res.setSuccessNum(successNum);
|
||||
res.setIgnoreNum(ignoreNum);
|
||||
res.setAllNum(allNum);
|
||||
res.setFailNum(failNum);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="bo.status != null">
|
||||
and t1.status = #{bo.status}
|
||||
</if>
|
||||
<if test="bo.id != null">
|
||||
and t1.id = #{bo.id}
|
||||
</if>
|
||||
</where>
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user