| | |
| | | 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 wzy |
| | | * @author |
| | | * @date 2022-03-22 |
| | | **/ |
| | | @Slf4j |
| | |
| | | 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) { |
| | |
| | | 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(); |
| | | } |
| | | |
| | | @RequestMapping(value = "accountMoneyChangeFlow") |
| | | 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("操作成功,请稍后查看"); |
| | | } |
| | | } |