From 6c2e9ba62c418185361179e7014862c481f34e17 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 09 Mar 2022 14:22:09 +0800 Subject: [PATCH] conflect merge --- src/main/java/com/xcong/excoin/modules/otc/controller/OtcMarketBussinessController.java | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 117 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMarketBussinessController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMarketBussinessController.java new file mode 100644 index 0000000..cf0f695 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMarketBussinessController.java @@ -0,0 +1,117 @@ +package com.xcong.excoin.modules.otc.controller; + +import com.xcong.excoin.common.LoginUserUtils; +import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.member.dao.MemberDao; +import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; +import com.xcong.excoin.modules.member.entity.MemberEntity; +import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; +import com.xcong.excoin.modules.otc.dto.MbAddDto; +import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness; +import com.xcong.excoin.modules.otc.mapper.OtcMarketBussinessMapper; +import com.xcong.excoin.modules.otc.service.OtcEntrustOrderService; +import com.xcong.excoin.modules.otc.service.OtcMarketBussinessService; +import com.xcong.excoin.modules.otc.vo.ApplyConditionsVo; +import com.xcong.excoin.modules.otc.vo.MarketBussinessInfoVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; + +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping(value = "/api/marketBussiness") +@Api(value = "OtcMarketBussinessController", tags = "otc市商接口类") +public class OtcMarketBussinessController { + + private final OtcMarketBussinessService otcMarketBussinessService; + private final MemberWalletCoinDao memberWalletCoinDao; + private final MemberDao memberDao; + + @ApiOperation(value = "申请条件", notes = "申请条件") + @ApiResponses({ + @ApiResponse(code = 200, message = "获取成功", response = ApplyConditionsVo.class) + }) + @PostMapping(value = "/applyConditions") + public Result applyConditions() { + return otcMarketBussinessService.applyConditions(); + } + + + @ApiOperation(value = "申请市商接口", notes = "申请市商接口") + @PostMapping(value = "/applyMaketBussiness") + public Result applyMarketBussiness() { + otcMarketBussinessService.add(); + return Result.ok("申请成功, 等待审核"); + } + +// @ApiOperation(value = "modifyMarketBussiness", notes = "修改个人信息") + @PostMapping(value = "/modifyMarketBussiness") + public Result modifyMarketBussiness(@RequestBody MbAddDto mbAddDto) { + if (mbAddDto.getId() == null) { + return Result.fail("id不能为空"); + } + + OtcMarketBussiness mb = otcMarketBussinessService.getById(mbAddDto.getId()); + if (mb == null) { + return Result.fail("市商不存在"); + } + + if (!mb.getStatus().equals(OtcMarketBussiness.CHECK_PASS)) { + return Result.fail("暂不能修改信息"); + } + + OtcMarketBussiness otcMb = new OtcMarketBussiness(); + otcMb.setId(mbAddDto.getId()); +// otcMb.setNikename(mbAddDto.getNickname()); + otcMarketBussinessService.updateById(otcMb); + return Result.ok("修改成功"); + } + + @ApiOperation(value = "findMarketBussinessStatus", notes = "获取市商申请状态接口") + @GetMapping(value = "/findMarketBussinessStatus") + public Result findMarketBussinessStatus() { + return Result.ok("获取成功", otcMarketBussinessService.findMbStatus()); + } + + + @ApiOperation(value = "获取市商信息", notes = "获取市商信息") + @ApiResponses({ + @ApiResponse(code = 200, message = "获取成功", response = MarketBussinessInfoVo.class) + }) + @GetMapping(value = "/findMbInfo/{id}") + public Result findMbInfo(@PathVariable("id") Long id) { + return this.otcMarketBussinessService.findMbInfo(id); + } + + @ApiOperation(value = "修改姓名") + @PostMapping(value = "/modifyName") + public Result modifyName(@RequestBody MbAddDto mbAddDto) { + MemberEntity member = LoginUserUtils.getAppLoginUser(); + Long memberId = member.getId(); + + member = new MemberEntity(); + member.setId(memberId); + member.setName(mbAddDto.getNickname()); + memberDao.updateById(member); + + return Result.ok("修改成功"); + } + + @ApiOperation(value = "查询当前用户可用") + @GetMapping(value = "/memberWallet") + public Result memberWallet() { + MemberEntity member = LoginUserUtils.getAppLoginUser(); + MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), "USDT"); + return Result.ok(wallet.getAvailableBalance()); + } + +} -- Gitblit v1.9.1