| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | 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.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.dapp.entity.DappAccountMoneyChangeEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | 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; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author |
| | |
| | | public class MemberMoneyFlowController extends BaseController { |
| | | |
| | | private final DappWalletService dappWalletService; |
| | | private final DappFundFlowDao dappFundFlowDao; |
| | | private final ChainProducer chainProducer; |
| | | |
| | | @RequestMapping(value = "/fundFlow") |
| | | public FebsResponse fundFlow(DappFundFlowEntity dappFundFlowEntity, QueryRequest request) { |
| | |
| | | public FebsResponse accountMoneyChangeFlow(DappAccountMoneyChangeEntity record, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.accountMoneyChangeInPage(record, request))); |
| | | } |
| | | |
| | | /** |
| | | * 流水管理-手动转账 |
| | | */ |
| | | @GetMapping("transferManual/{id}") |
| | | @ControllerEndpoint(operation = "版本管理---删除", exceptionMessage = "删除失败") |
| | | public FebsResponse transferManual(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | return new FebsResponse().fail().message("数据不存在"); |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == dappFundFlowEntity.getStatus()){ |
| | | return new FebsResponse().fail().message("已转账,无法再次操作"); |
| | | } |
| | | chainProducer.sendBnbTransferMsg(id); |
| | | return new FebsResponse().success().message("操作成功,请稍后查看"); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.web3j.abi.datatypes.Int; |
| | | |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal availableAmount; |
| | | |
| | | @ApiModelProperty(value = "直推奖金(直推收益)") |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal directProfit; |
| | | |
| | | @ApiModelProperty(value = "平级奖金(层级收益)") |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal levelProfit; |
| | | |
| | | @ApiModelProperty(value = "幸运奖金(动能收益)") |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal luckyProfit; |
| | | |
| | | @TableField(exist = false) |
| | | private Long systemProfitId; |
| | | } |
| | |
| | | if (currentUser.getDeptId() == null) { |
| | | member.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return dappMemberDao.selectInPage(member, page); |
| | | IPage<DappMemberEntity> dappMemberEntityIPage = dappMemberDao.selectInPage(member, page); |
| | | List<DappMemberEntity> records = dappMemberEntityIPage.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(DappMemberEntity memberEntity : records){ |
| | | Long memberId = memberEntity.getId(); |
| | | |
| | | DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(memberId,DappSystemProfit.STATE_IN); |
| | | memberEntity.setSystemProfitId(ObjectUtil.isEmpty(dappSystemProfit) ? 0L : dappSystemProfit.getId()); |
| | | BigDecimal directProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,3,2); |
| | | memberEntity.setDirectProfit(directProfit); |
| | | BigDecimal levelProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,4,2); |
| | | memberEntity.setLevelProfit(levelProfit); |
| | | BigDecimal luckyProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,7,2); |
| | | memberEntity.setLuckyProfit(luckyProfit); |
| | | } |
| | | } |
| | | return dappMemberEntityIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | private Integer status; |
| | | |
| | | private Integer type; |
| | | |
| | | private String fromHash; |
| | | } |
| | |
| | | <if test="record.memberId != null"> |
| | | and a.member_id=#{record.memberId} |
| | | </if> |
| | | <if test="record.fromHash != '' and record.fromHash != null"> |
| | | and a.from_hash = #{record.fromHash} |
| | | </if> |
| | | <if test="record.systemProfitId != '' and record.systemProfitId != null"> |
| | | and a.system_profit_id = #{record.systemProfitId} |
| | | </if> |
| | | </where> |
| | | order by a.create_time desc, a.id desc |
| | | </select> |
| | |
| | | dapp_system_profit a |
| | | inner join dapp_member b on a.member_id = b.id |
| | | <where> |
| | | <if test="record.id != '' and record.id != null"> |
| | | and a.id = #{record.id} |
| | | </if> |
| | | <if test="record.address != '' and record.address != null"> |
| | | and b.address = #{record.address} |
| | | </if> |
| | |
| | | a.create_time createTime, |
| | | a.amount amount, |
| | | a.status status, |
| | | a.from_hash fromHash, |
| | | a.type type, |
| | | b.address address |
| | | from |
| | |
| | | {field: 'address', title: '地址', minWidth: 100, totalRowText: '合计'}, |
| | | {field: 'accountType', title: '代理级别', minWidth: 100,}, |
| | | {field: 'activeStatus', title: '是否加入动能', minWidth: 100}, |
| | | {field: 'systemProfitId', title: '编号', minWidth: 100}, |
| | | {field: 'systemProfitId', title: '动能编号', minWidth: 100}, |
| | | {field: 'directCnt', title: '直推数量', minWidth: 100, totalRow: true}, |
| | | {field: 'directProfit', title: '直推收益', minWidth: 100, totalRow: true}, |
| | | {field: 'levelProfit', title: '层级收益', minWidth: 100, totalRow: true}, |
| | |
| | | <!-- {{# } }}--> |
| | | <!--</script>--> |
| | | <script type="text/html" id="approve-list"> |
| | | {{# if(d.activeStatus == '1') { }} |
| | | <a href="https://bscscan.com/address/{{d.address}}" target="_blank">{{d.address}}</a> |
| | | {{# } else { }} |
| | | <span>未加入</span> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="member-option"> |
| | | {{# |
| | |
| | | elem: $view.find('table'), |
| | | id: 'memberTable', |
| | | url: ctx + 'member/list', |
| | | totalRow: true, |
| | | cols: [[ |
| | | // {type: 'checkbox'}, |
| | | // {type: 'numbers'}, |
| | | {title: '代理级别', |
| | | templet: function (d) { |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="teamInfo" shiro:hasPermission="teamInfo:view"><span>'+d.accountType+'</span></button>' |
| | | },minWidth: 130,align:'center'}, |
| | | {field: 'address', title: '地址', minWidth: 400}, |
| | | },minWidth: 130,align:'center', totalRowText: '合计'}, |
| | | {title: '地址', templet: '#approve-list', minWidth: 400}, |
| | | {field: 'chainType', title: '所属链', minWidth: 130}, |
| | | {title: '是否加入动能', templet: '#approve-list', minWidth: 350}, |
| | | {field: 'activeStatus', title: '加入动能', |
| | | templet: function (d) { |
| | | if (d.activeStatus === 1) { |
| | | return '<span style="color:green;">'+d.systemProfitId+'</span>' |
| | | } else{ |
| | | return '' |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'directProfit', title: '直推收益', minWidth: 100, totalRow: true}, |
| | | {field: 'levelProfit', title: '层级收益', minWidth: 100, totalRow: true}, |
| | | {field: 'luckyProfit', title: '动能收益', minWidth: 100, totalRow: true}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 100}, |
| | | {field: 'refererId', title: '上级邀请码', minWidth: 100}, |
| | | // {title: '账户状态', templet: '#user-status', minWidth: 100}, |
| | | // {title: '是否可提现', templet: '#withdraw-able', minWidth: 100}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 180}, |
| | | // {title: '操作', toolbar: '#member-option', minWidth: 300} |
| | | {field: 'createTime', title: '创建时间', minWidth: 180} |
| | | ]] |
| | | }); |
| | | } |
| | |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="systemProfitId" autocomplete="off" placeholder="输入动能编号" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="address" autocomplete="off" placeholder="输入地址" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="fromHash" autocomplete="off" placeholder="输入FromHash" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | |
| | | table.on('tool(moneyChangeTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'transferManual') { |
| | | febs.modal.confirm('人工操作', '是否人工转账?', function () { |
| | | transferManual("flow/withdrawAgree/" + data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'transferManual') { |
| | | febs.modal.confirm('人工操作', '是否人工转账?', function () { |
| | | transferManual(data.id); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function transferManual(id) { |
| | | febs.get(ctx + 'flow/transferManual/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $reset.click(); |
| | | }); |
| | | } |
| | | |
| | | table.on('sort(moneyChangeTable)', function (obj) { |
| | | sortObject = obj; |
| | |
| | | id: 'moneyChangeTable', |
| | | url: ctx + 'flow/fundFlow', |
| | | cols: [[ |
| | | {field: 'address', title: '地址', minWidth: 380}, |
| | | {field: 'address', title: '地址', minWidth: 400}, |
| | | {field: 'systemProfitId', title: '动能编号', minWidth: 100}, |
| | | {title: '类型', minWidth: 100,templet: '#flow-type',align:'center'}, |
| | | {field: 'amount', title: '金额', |
| | | templet: function (d) { |
| | |
| | | return d.amount |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'fee', title: '手续费', minWidth: 80}, |
| | | // {field: 'fee', title: '手续费', minWidth: 80}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 150}, |
| | | {title: '状态', templet: '#status-able', minWidth: 80}, |
| | | {field: 'fromHash', title: 'fromHash', minWidth: 150}, |
| | | {field: 'toHash', title: 'toHash', minWidth: 150}, |
| | | {field: 'fromHash', title: 'FromHash', minWidth: 150}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if(d.status == 3){ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="transferManual" shiro:hasPermission="transferManual:update">手动转账</button>' |
| | | }else{ |
| | | return '' |
| | | } |
| | | },minWidth: 100,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | function getQueryParams() { |
| | | return { |
| | | systemProfitId: $searchForm.find('input[name="systemProfitId"]').val().trim(), |
| | | address: $searchForm.find('input[name="address"]').val().trim(), |
| | | fromHash: $searchForm.find('input[name="fromHash"]').val().trim(), |
| | | type: $searchForm.find("select[name='type']").val(), |
| | | // accountStatus: $searchForm.find("select[name='accountStatus']").val(), |
| | | // withdrawAble: $searchForm.find("input[name='withdrawAble']").val(), |
| | |
| | | cols: [[ |
| | | {field: 'address', title: '地址', minWidth: 300}, |
| | | {field: 'amount', title: '金额', minWidth: 80}, |
| | | {field: 'fromHash', title: 'hash', minWidth: 150}, |
| | | {title: '状态', templet: '#status-able', minWidth: 80}, |
| | | {title: '类型', templet: '#type-able', minWidth: 80}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 150} |
| | |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="id" autocomplete="off" placeholder="输入动能编号" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="address" autocomplete="off" placeholder="输入地址" class="layui-input"> |
| | | </div> |
| | | </div> |
| | |
| | | id: 'systemProfitTable', |
| | | url: ctx + 'member/systemProfitList', |
| | | cols: [[ |
| | | {field: 'id', title: '序列号', minWidth: 400}, |
| | | {field: 'id', title: '动能编号', minWidth: 400}, |
| | | {field: 'address', title: '地址', minWidth: 400}, |
| | | {field: 'amount', title: '金额', minWidth: 130}, |
| | | {title: '状态', templet: '#state-able', minWidth: 100}, |
| | |
| | | |
| | | function getQueryParams() { |
| | | return { |
| | | id: $searchForm.find('input[name="id"]').val().trim(), |
| | | address: $searchForm.find('input[name="address"]').val().trim(), |
| | | state: $searchForm.find("select[name='state']").val() |
| | | }; |