| | |
| | | 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.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.dto.AgentLevelSetUpdateDto; |
| | | import cc.mrbird.febs.dapp.dto.PriceSettingDto; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappSystemProfit; |
| | | import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.vo.AdminAgentLevelOptionTreeVo; |
| | | import cc.mrbird.febs.dapp.vo.AdminSystemFeeVo; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Controller; |
| | | 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.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-21 |
| | | **/ |
| | | @Slf4j |
| | |
| | | return new FebsResponse().success().data(dataTable); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getBalanceByAddress/{address}") |
| | | public FebsResponse getBalanceByAddress(@PathVariable("address") String address) { |
| | | BigDecimal balance = ChainService.INSTANCE.balanceOf(address); |
| | | DappMemberEntity member = dappMemberService.findByAddress(address); |
| | | @RequestMapping(value = "/getBalanceByAddress/{chain}/{address}") |
| | | public FebsResponse getBalanceByAddress(@PathVariable("chain") String chain, @PathVariable("address") String address) { |
| | | BigDecimal balance = ChainService.getInstance(chain).balanceOf(address); |
| | | DappMemberEntity member = dappMemberService.findByAddress(address, chain); |
| | | member.setBalance(balance); |
| | | dappMemberService.updateById(member); |
| | | return new FebsResponse().success().data(balance); |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/changeMoney/{address}") |
| | | public FebsResponse changeMoney(@PathVariable(value = "address") String address) { |
| | | dappMemberService.transfer(address); |
| | | @PostMapping(value = "/changeMoney/{chain}/{address}") |
| | | public FebsResponse changeMoney(@PathVariable("chain") String chain, @PathVariable(value = "address") String address) { |
| | | dappMemberService.transfer(address, chain); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | public FebsResponse transferList(DappTransferRecordEntity transfer, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(dappMemberService.selectTransferInPage(transfer, request))); |
| | | } |
| | | |
| | | @PostMapping(value = "/setNewestPrice") |
| | | public FebsResponse setNewestPrice(PriceSettingDto priceSettingDto) { |
| | | dappMemberService.setNewestPrice(priceSettingDto); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/setSystemFee") |
| | | public FebsResponse setSystemFee(AdminSystemFeeVo adminSystemFeeVo) { |
| | | dappMemberService.setSystemFee(adminSystemFeeVo); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | /** |
| | | * 动能列表 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/systemProfitList") |
| | | public FebsResponse systemProfitList(DappSystemProfit dappSystemProfit, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(dappMemberService.selectSystemProfitInPage(dappSystemProfit, request))); |
| | | } |
| | | |
| | | /** |
| | | * 动能列表-流水详情 |
| | | * @return |
| | | */ |
| | | @GetMapping("getSystemProfitFlowList") |
| | | public FebsResponse getSystemProfitFlowList(DappSystemProfit dappSystemProfit, QueryRequest request, Integer parentId) { |
| | | if (parentId == null) { |
| | | ViewController.systemProfitId = 0L; |
| | | } |
| | | dappSystemProfit.setId(ViewController.systemProfitId); |
| | | Map<String, Object> data = getDataTable(dappMemberService.getSystemProfitFlowList(dappSystemProfit, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 用户列表-团队详情 |
| | | */ |
| | | @GetMapping("teamInfo") |
| | | public FebsResponse teamInfo(DappMemberEntity dappMemberEntity, QueryRequest request, Integer parentId) { |
| | | if (parentId == null) { |
| | | ViewController.teamInfoMemberId = 0L; |
| | | } |
| | | dappMemberEntity.setId(ViewController.teamInfoMemberId); |
| | | Map<String, Object> data = getDataTable(dappMemberService.getTeamInfo(dappMemberEntity,request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 用户列表-购买记录 |
| | | */ |
| | | @GetMapping("memberNodeInfo") |
| | | public FebsResponse memberNodeInfo(DappMemberEntity dappMemberEntity, QueryRequest request, Integer parentId) { |
| | | if (parentId == null) { |
| | | ViewController.memberNodeInfoMemberId = 0L; |
| | | } |
| | | dappMemberEntity.setId(ViewController.memberNodeInfoMemberId); |
| | | Map<String, Object> data = getDataTable(dappMemberService.getMemberNodeInfo(dappMemberEntity,request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @GetMapping(value = "/insideWithYes/{id}") |
| | | public FebsResponse insideWithYes(@PathVariable("id") Long id) { |
| | | return dappMemberService.insideWithYes(id); |
| | | } |
| | | |
| | | @GetMapping(value = "/insideWithNo/{id}") |
| | | public FebsResponse insideWithNo(@PathVariable("id") Long id) { |
| | | return dappMemberService.insideWithNo(id); |
| | | } |
| | | |
| | | /** |
| | | * 代理-等级选择Option |
| | | */ |
| | | @GetMapping("getAgentLevelOption") |
| | | @ControllerEndpoint(exceptionMessage = "获取等级失败") |
| | | public List<AdminAgentLevelOptionTreeVo> getAgentLevelOption() { |
| | | return dappMemberService.getAgentLevelOption(); |
| | | } |
| | | |
| | | /** |
| | | * 代理列表-设置代理级别 |
| | | */ |
| | | @PostMapping("agentLevelSetUpdate") |
| | | @ControllerEndpoint(operation = "代理列表-设置代理级别", exceptionMessage = "操作失败") |
| | | public FebsResponse agentLevelSetUpdate(@Valid AgentLevelSetUpdateDto agentLevelSetUpdateDto) { |
| | | return dappMemberService.agentLevelSetUpdate(agentLevelSetUpdateDto); |
| | | } |
| | | |
| | | } |