| | |
| | | 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.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity; |
| | | import cc.mrbird.febs.dapp.dto.PriceSettingDto; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.vo.AdminMemberIdentityVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | 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 |
| | |
| | | public class MemberController extends BaseController { |
| | | |
| | | private final DappMemberService dappMemberService; |
| | | private final DappSystemService dappSystemService; |
| | | |
| | | @RequestMapping(value = "/list") |
| | | public FebsResponse list(DappMemberEntity member, QueryRequest request) { |
| | |
| | | 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(); |
| | | } |
| | | |
| | | @GetMapping(value = "/findDicByType/{type}") |
| | | public FebsResponse findDicByType(@PathVariable("type") String type) { |
| | | return new FebsResponse().success().data(dappSystemService.findDataDicByType(type)); |
| | | } |
| | | |
| | | /** |
| | | * 字典表设置 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/levelSystemSetting") |
| | | public FebsResponse levelSystemSetting(@RequestBody Map<String, Object> map) { |
| | | dappSystemService.levelSystemSetting(map); |
| | | return new FebsResponse().success().message("设置成功"); |
| | | } |
| | | |
| | | /** |
| | | * 挂机方案设置启用 |
| | | */ |
| | | @GetMapping("enableOnHook/{id}") |
| | | @ControllerEndpoint(operation = "挂机方案设置启用", exceptionMessage = "设置失败") |
| | | public FebsResponse enableOnHook(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return dappSystemService.enableOnHook(id); |
| | | } |
| | | |
| | | /** |
| | | * 挂机方案设置禁用 |
| | | */ |
| | | @GetMapping("disableOnHook/{id}") |
| | | @ControllerEndpoint(operation = "挂机方案设置禁用", exceptionMessage = "设置失败") |
| | | public FebsResponse disableOnHook(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return dappSystemService.disableOnHook(id); |
| | | } |
| | | |
| | | /** |
| | | * 重置资金密码为123456 |
| | | */ |
| | | @GetMapping(value = "/resetTransferCode/{id}") |
| | | public FebsResponse resetTransferCode(@PathVariable("id") Long id) { |
| | | dappMemberService.resetTransferCode(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | /** |
| | | * 重置登录密码为123456 |
| | | */ |
| | | @GetMapping(value = "/resetPassword/{id}") |
| | | public FebsResponse resetPassword(@PathVariable("id") Long id) { |
| | | dappMemberService.resetPassword(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | /** |
| | | * App版本-列表 |
| | | * |
| | | * @param appVersion |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @GetMapping("getAppVersionList") |
| | | public FebsResponse getAppVersionList(AppVersion appVersion, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(dappMemberService.getAppVersionList(appVersion, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * App版本-删除 |
| | | */ |
| | | @GetMapping("delAppVersion/{id}") |
| | | @ControllerEndpoint(operation = " App版本-删除", exceptionMessage = "操作失败") |
| | | public FebsResponse delAppVersion(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return dappMemberService.delCategary(id); |
| | | } |
| | | |
| | | /** |
| | | * App版本-新增 |
| | | */ |
| | | @PostMapping("addAppVersion") |
| | | @ControllerEndpoint(operation = " App版本-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addAppVersion(@Valid AppVersion appVersion) { |
| | | return dappMemberService.addAppVersion(appVersion); |
| | | } |
| | | |
| | | /** |
| | | * App版本-更新 |
| | | */ |
| | | @PostMapping("updateAppVersion") |
| | | @ControllerEndpoint(operation = "App版本-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse updateAppVersion(@Valid AppVersion appVersion) { |
| | | return dappMemberService.updateAppVersion(appVersion); |
| | | } |
| | | |
| | | /** |
| | | * 充值-列表 |
| | | */ |
| | | @GetMapping("getChargeList") |
| | | public FebsResponse getChargeList(MemberCoinChargeEntity memberCoinChargeEntity, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(dappMemberService.getChargeListInPage(memberCoinChargeEntity, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | *会员列表---拨币 |
| | | * @return |
| | | */ |
| | | @PostMapping("payUsdt") |
| | | @ControllerEndpoint(operation = "会员列表-确认", exceptionMessage = "操作失败") |
| | | public FebsResponse addCoinConfirm(@Valid DappMemberEntity memberEntity) { |
| | | return dappMemberService.payUsdt(memberEntity); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 会员列表---会员等级下拉框 |
| | | */ |
| | | @GetMapping(value = "identitySetList") |
| | | public FebsResponse identitySetList() { |
| | | List<AdminMemberIdentityVo> identityVos = dappMemberService.identitySetList(); |
| | | return new FebsResponse().success().data(identityVos); |
| | | } |
| | | |
| | | /** |
| | | *会员列表---设置会员等级 |
| | | * @return |
| | | */ |
| | | @PostMapping("identitySet") |
| | | @ControllerEndpoint(operation = "会员列表-设置会员等级", exceptionMessage = "操作失败") |
| | | public FebsResponse identitySet(@Valid DappMemberEntity memberEntity) { |
| | | return dappMemberService.identitySet(memberEntity); |
| | | } |
| | | |
| | | /** |
| | | * 资金流水--回退 |
| | | */ |
| | | @GetMapping(value = "/amountFlowBack/{id}") |
| | | public FebsResponse amountFlowBack(@PathVariable("id") Long id) { |
| | | return dappMemberService.amountFlowBack(id); |
| | | } |
| | | } |