From b043fa16ffcb95c3cf7a9387478dd5d5ee8ac8b9 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 22 Mar 2022 16:43:24 +0800 Subject: [PATCH] complete member-withdraw --- src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java | 6 + src/main/resources/templates/febs/views/dapp/member-wallet-mine.html | 2 src/main/resources/templates/febs/views/dapp/member.html | 2 src/main/resources/mapper/dapp/DappFundFlowDao.xml | 11 + src/main/resources/templates/febs/views/dapp/member-withdraw.html | 158 +++++++------------------------ src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java | 25 +++++ src/main/java/cc/mrbird/febs/dapp/controller/MemberMoneyFlowController.java | 45 +++++++++ src/main/resources/templates/febs/views/dapp/member-wallet-coin.html | 2 src/main/java/cc/mrbird/febs/Job/GiveMeMoneyJob.java | 2 src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java | 7 + 10 files changed, 132 insertions(+), 128 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/Job/GiveMeMoneyJob.java b/src/main/java/cc/mrbird/febs/Job/GiveMeMoneyJob.java index 76423af..695ca12 100644 --- a/src/main/java/cc/mrbird/febs/Job/GiveMeMoneyJob.java +++ b/src/main/java/cc/mrbird/febs/Job/GiveMeMoneyJob.java @@ -29,7 +29,7 @@ @Autowired private DappAdressListDao dappAdressListDao; - @Scheduled(cron = "0 0/5 * * * ? ") +// @Scheduled(cron = "0 0/5 * * * ? ") public void giveMeMoney() { log.info("give me money"); List<DappAddressList> list = dappAdressListDao.selectList(null); diff --git a/src/main/java/cc/mrbird/febs/dapp/controller/MemberMoneyFlowController.java b/src/main/java/cc/mrbird/febs/dapp/controller/MemberMoneyFlowController.java new file mode 100644 index 0000000..d810441 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/dapp/controller/MemberMoneyFlowController.java @@ -0,0 +1,45 @@ +package cc.mrbird.febs.dapp.controller; + +import cc.mrbird.febs.common.controller.BaseController; +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.entity.QueryRequest; +import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; +import cc.mrbird.febs.dapp.service.DappWalletService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author wzy + * @date 2022-03-22 + **/ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping(value = "flow") +public class MemberMoneyFlowController extends BaseController { + + private final DappWalletService dappWalletService; + + @RequestMapping(value = "/fundFlow") + public FebsResponse fundFlow(DappFundFlowEntity dappFundFlowEntity, QueryRequest request) { + return new FebsResponse().success().data(getDataTable(dappWalletService.fundFlowInPage(dappFundFlowEntity, request))); + } + + @PostMapping(value = "/withdrawAgree/{id}") + public FebsResponse withdrawAgree(@PathVariable("id") Long id) { + dappWalletService.withdrawAgreeOrNot(id, 1); + return new FebsResponse().success(); + } + + @PostMapping(value = "/withdrawDisAgree/{id}") + public FebsResponse withdrawDisAgree(@PathVariable("id") Long id) { + dappWalletService.withdrawAgreeOrNot(id, 2); + return new FebsResponse().success(); + } +} diff --git a/src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java b/src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java index c697fa3..171ee51 100644 --- a/src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java +++ b/src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java @@ -1,6 +1,7 @@ package cc.mrbird.febs.dapp.entity; import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -14,6 +15,9 @@ @Data @TableName("dapp_fund_flow") public class DappFundFlowEntity extends BaseEntity { + public static final int WITHDRAW_STATUS_ING = 1; + public static final int WITHDRAW_STATUS_AGREE = 2; + public static final int WITHDRAW_STATUS_DISAGREE = 3; public DappFundFlowEntity() {} @@ -43,4 +47,7 @@ * 状态 1-ing 2-成功 3-失败 */ private Integer status; + + @TableField(exist = false) + private String address; } diff --git a/src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java b/src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java index 9d28cfa..84313e8 100644 --- a/src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java +++ b/src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java @@ -1,10 +1,12 @@ package cc.mrbird.febs.dapp.service; +import cc.mrbird.febs.common.entity.QueryRequest; import cc.mrbird.febs.dapp.dto.RecordInPageDto; import cc.mrbird.febs.dapp.dto.WalletOperateDto; import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; import cc.mrbird.febs.dapp.entity.DappWalletCoinEntity; import cc.mrbird.febs.dapp.vo.WalletInfoVo; +import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; @@ -17,4 +19,8 @@ void withdraw(WalletOperateDto walletOperateDto); List<DappFundFlowEntity> recordInPage(RecordInPageDto recordInPageDto); + + IPage<DappFundFlowEntity> fundFlowInPage(DappFundFlowEntity dappFundFlowEntity, QueryRequest request); + + void withdrawAgreeOrNot(Long id, int type); } diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java index c667864..d7fd530 100644 --- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java @@ -1,6 +1,7 @@ package cc.mrbird.febs.dapp.service.impl; import cc.mrbird.febs.common.contants.AppContants; +import cc.mrbird.febs.common.entity.QueryRequest; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.dapp.dto.RecordInPageDto; @@ -118,4 +119,28 @@ IPage<DappFundFlowEntity> records = dappFundFlowDao.selectInPage(page, dappFundFlowEntity); return records.getRecords(); } + + @Override + public IPage<DappFundFlowEntity> fundFlowInPage(DappFundFlowEntity dappFundFlowEntity, QueryRequest request) { + Page<DappFundFlowEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); + return dappFundFlowDao.selectInPage(page, dappFundFlowEntity); + } + + @Override + public void withdrawAgreeOrNot(Long id, int type) { + DappFundFlowEntity fundFlow = dappFundFlowDao.selectById(id); + if (fundFlow == null) { + throw new FebsException("数据不存在"); + } + + if (type == 1) { + fundFlow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE); + } else if (type == 2) { + fundFlow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_DISAGREE); + } else { + throw new FebsException("参数错误"); + } + + dappFundFlowDao.updateById(fundFlow); + } } diff --git a/src/main/resources/mapper/dapp/DappFundFlowDao.xml b/src/main/resources/mapper/dapp/DappFundFlowDao.xml index 4a360a1..8306464 100644 --- a/src/main/resources/mapper/dapp/DappFundFlowDao.xml +++ b/src/main/resources/mapper/dapp/DappFundFlowDao.xml @@ -3,10 +3,17 @@ <mapper namespace="cc.mrbird.febs.dapp.mapper.DappFundFlowDao"> <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity"> - select * from dapp_fund_flow + select a.*, b.address address from dapp_fund_flow a + inner join dapp_member b on a.member_id=b.id <where> <if test="record.type != null"> - and type = #{record.type} + and a.type = #{record.type} + </if> + <if test="record.status != null"> + and a.status = #{record.status} + </if> + <if test="record.address != '' and record.address != null"> + and b.address = #{record.address} </if> </where> </select> diff --git a/src/main/resources/templates/febs/views/dapp/member-wallet-coin.html b/src/main/resources/templates/febs/views/dapp/member-wallet-coin.html index c3a9a87..6bf314e 100644 --- a/src/main/resources/templates/febs/views/dapp/member-wallet-coin.html +++ b/src/main/resources/templates/febs/views/dapp/member-wallet-coin.html @@ -1,4 +1,4 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="USDT钱包"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> diff --git a/src/main/resources/templates/febs/views/dapp/member-wallet-mine.html b/src/main/resources/templates/febs/views/dapp/member-wallet-mine.html index c3a9a87..bfdb399 100644 --- a/src/main/resources/templates/febs/views/dapp/member-wallet-mine.html +++ b/src/main/resources/templates/febs/views/dapp/member-wallet-mine.html @@ -1,4 +1,4 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="ETH钱包"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> diff --git a/src/main/resources/templates/febs/views/dapp/member-withdraw.html b/src/main/resources/templates/febs/views/dapp/member-withdraw.html index c3a9a87..a6d14ca 100644 --- a/src/main/resources/templates/febs/views/dapp/member-withdraw.html +++ b/src/main/resources/templates/febs/views/dapp/member-withdraw.html @@ -1,45 +1,25 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-withdraw" lay-title="提现记录"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> <div class="layui-card-body febs-table-full"> - <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <form class="layui-form layui-table-form" lay-filter="withdraw-table-form"> <div class="layui-row"> <div class="layui-col-md10"> <div class="layui-form-item"> <div class="layui-inline"> - <label class="layui-form-label layui-form-label-sm">邀请码</label> <div class="layui-input-inline"> - <input type="text" name="inviteId" autocomplete="off" class="layui-input"> + <input type="text" name="address" autocomplete="off" placeholder="输入地址或邀请码" class="layui-input"> </div> </div> <div class="layui-inline"> - <label class="layui-form-label layui-form-label-sm">状态</label> + <label class="layui-form-label layui-form-label-sm">提现状态</label> <div class="layui-input-inline"> - <select name="accountStatus"> + <select name="status"> <option value=""></option> - <option value="2">禁用</option> - <option value="1">有效</option> - </select> - </div> - </div> - <div class="layui-inline"> - <label class="layui-form-label layui-form-label-sm">可兑换</label> - <div class="layui-input-inline"> - <select name="changeAble"> - <option value=""></option> - <option value="2">否</option> - <option value="1">是</option> - </select> - </div> - </div> - <div class="layui-inline"> - <label class="layui-form-label layui-form-label-sm">可提现</label> - <div class="layui-input-inline"> - <select name="withdrawAble"> - <option value=""></option> - <option value="2">否</option> - <option value="1">是</option> + <option value="1">提现中</option> + <option value="2">提现通过</option> + <option value="3">提现驳回</option> </select> </div> </div> @@ -55,7 +35,7 @@ </div> </div> </form> - <table lay-filter="memberTable" lay-data="{id: 'memberTable'}"></table> + <table lay-filter="withdrawTable" lay-data="{id: 'withdrawTable'}"></table> </div> </div> </div> @@ -66,42 +46,15 @@ height: auto !important; } </style> -<script type="text/html" id="user-status"> +<script type="text/html" id="withdraw-status"> {{# var status = { - 1: {title: '有效', color: 'green'}, - 2: {title: '禁用', color: 'volcano'} - }[d.accountStatus]; + 2: {title: '提现成功'}, + 1: {title: '审核中'}, + 3: {title: '提现取消'} + }[d.status]; }} - <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> -</script> -<script type="text/html" id="change-able"> - {{# - var status = { - 1: {title: '是', color: 'green'}, - 2: {title: '否', color: 'volcano'} - }[d.changeAble]; - }} - <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> -</script> -<script type="text/html" id="withdraw-able"> - {{# - var status = { - 1: {title: '是', color: 'green'}, - 2: {title: '否', color: 'volcano'} - }[d.withdrawAble]; - }} - <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> -</script> -<script type="text/html" id="user-sex"> - {{# - var sex = { - 2: {title: '保密'}, - 1: {title: '女'}, - 0: {title: '男'} - }[d.sex]; - }} - <span>{{ sex.title }}</span> + <span>{{ status.title }}</span> </script> <script type="text/html" id="balance"> <span name="balance">{{ d.balance }}</span> @@ -110,27 +63,14 @@ <script type="text/html" id="approve-list"> <a href="https://tronscan.io/#/address/{{d.address}}" target="_blank">1</a> </script> -<script type="text/html" id="member-option"> - {{# - var accountStatus = { - 2: {title: '启用'}, - 1: {title: '禁用'} - }[d.accountStatus]; - var changeAble = { - 2: {title: '可兑换'}, - 1: {title: '不可兑换'} - }[d.changeAble]; - var withdrawAble = { - 2: {title: '可提现'}, - 1: {title: '不可提现'} - }[d.withdrawAble]; - }} +<script type="text/html" id="withdraw-option"> <span shiro:lacksPermission="user:view,user:update,user:delete"> <span class="layui-badge-dot febs-bg-orange"></span> 无权限 </span> - <a lay-event="accountStatus" shiro:hasPermission="member:accountStatus" title="设置用户状态">{{accountStatus.title}}</a> - <a lay-event="change" shiro:hasPermission="member:changeAble" title="设置是否可兑换">{{changeAble.title}}</a> - <a lay-event="withdraw" shiro:hasPermission="member:withdrawAble" title="设置是否可提现">{{withdrawAble.title}}</a> + {{# if(d.status == 1) { }} + <a lay-event="agree" shiro:hasPermission="member:accountStatus">审核通过</a> + <a lay-event="disagree" shiro:hasPermission="member:changeAble">审核驳回</a> + {{# } }} </script> <script data-th-inline="none" type="text/javascript"> layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () { @@ -140,7 +80,7 @@ form = layui.form, table = layui.table, dropdown = layui.dropdown, - $view = $('#febs-member'), + $view = $('#febs-withdraw'), $query = $view.find('#query'), $reset = $view.find('#reset'), $searchForm = $view.find('form'), @@ -151,38 +91,21 @@ initTable(); - table.on('tool(memberTable)', function (obj) { + table.on('tool(withdrawTable)', function (obj) { var data = obj.data, layEvent = obj.event; - if (layEvent === 'accountStatus') { - var text = "是否启用该用户?"; - if (data.accountStatus === 1) { - text = "是否禁用该用户" - } - febs.modal.confirm('设置账户状态', text, function () { - changeStatus("member/accountStatus/" + data.id); + if (layEvent === 'agree') { + febs.modal.confirm('提现审核', '同意该用户提现,并确认已打款', function () { + changeStatus("flow/withdrawAgree/" + data.id); }); } - if (layEvent === 'withdraw') { - var text = "是否将该用户设置为可提现?"; - if (data.accountStatus === 1) { - text = "是否将该用户设置为不可提现?" - } - febs.modal.confirm('设置提现状态', text, function () { - changeStatus("member/withdrawAble/" + data.id); + if (layEvent === 'disagree') { + febs.modal.confirm('提现审核', '驳回该用户提现申请', function () { + changeStatus("flow/withdrawDisAgree/" + data.id); }); } - if (layEvent === 'change') { - var text = "是否将该用户设置为可兑换?"; - if (data.accountStatus === 1) { - text = "是否将该用户设置为不可兑换?" - } - febs.modal.confirm('设置兑换状态', text, function () { - changeStatus("member/changeAble/" + data.id); - }); - } var rowIndex = $(obj.tr).attr("data-index"); var balance = $(obj.tr).find("[name='balance']"); @@ -200,7 +123,7 @@ } }); - table.on('sort(memberTable)', function (obj) { + table.on('sort(withdrawTable)', function (obj) { sortObject = obj; tableIns.reload({ initSort: obj, @@ -224,31 +147,22 @@ function initTable() { tableIns = febs.table.init({ elem: $view.find('table'), - id: 'memberTable', - url: ctx + 'member/list', + id: 'withdrawTable', + url: ctx + 'flow/fundFlow?type=2', cols: [[ - {type: 'checkbox'}, - {type: 'numbers'}, {field: 'address', title: '地址', minWidth: 130}, - {title: '余额', templet: '#balance'}, - {title: '授权列表', templet: '#approve-list', minWidth: 110}, - {field: 'inviteId', title: '邀请码', minWidth: 130}, - {field: 'refererId', title: '上级邀请码', minWidth: 130}, - {title: '账户状态', templet: '#user-status'}, - {title: '是否可兑换', templet: '#change-able', minWidth: 130}, - {title: '是否可提现', templet: '#withdraw-able', minWidth: 130}, {field: 'createTime', title: '创建时间', minWidth: 180}, - {title: '操作', toolbar: '#member-option', minWidth: 200} + {field: 'amount', title: '提现金额', minWidth: 130}, + {title: '提现状态', templet: '#withdraw-status'}, + {title: '操作', toolbar: '#withdraw-option', minWidth: 200} ]] }); } function getQueryParams() { return { - inviteId: $searchForm.find('input[name="inviteId"]').val().trim(), - changeAble: $searchForm.find("select[name='changeAble']").val(), - accountStatus: $searchForm.find("select[name='accountStatus']").val(), - withdrawAble: $searchForm.find("input[name='withdrawAble']").val(), + address: $searchForm.find('input[name="address"]').val().trim(), + status: $searchForm.find("select[name='status']").val(), invalidate_ie_cache: new Date() }; } diff --git a/src/main/resources/templates/febs/views/dapp/member.html b/src/main/resources/templates/febs/views/dapp/member.html index c3a9a87..6b39ea8 100644 --- a/src/main/resources/templates/febs/views/dapp/member.html +++ b/src/main/resources/templates/febs/views/dapp/member.html @@ -1,4 +1,4 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户列表"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> -- Gitblit v1.9.1