|  |  |  | 
|---|
|  |  |  | package com.xcong.excoin.modules.home.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import javax.validation.Valid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PathVariable; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMethod; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.druid.util.StringUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto; | 
|---|
|  |  |  | import com.xcong.excoin.modules.home.service.MemberQuickBuySaleService; | 
|---|
|  |  |  | import com.xcong.excoin.modules.member.entity.MemberEntity; | 
|---|
|  |  |  | import com.xcong.excoin.modules.member.service.MemberService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.crypto.SecureUtil; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | MemberQuickBuySaleService memberQuickBuySaleService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | MemberService memberService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "recharge", notes = "USDT快速充值") | 
|---|
|  |  |  | @RequestMapping(value = "/recharge", method = RequestMethod.POST) | 
|---|
|  |  |  | 
|---|
|  |  |  | MemberEntity member = LoginUserUtils.getAppLoginUser(); | 
|---|
|  |  |  | log.info("查询到的会员----->{}", member); | 
|---|
|  |  |  | // 验证是否实名认证 | 
|---|
|  |  |  | if (MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) { | 
|---|
|  |  |  | return Result.fail("请先实名认证"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) { | 
|---|
|  |  |  | //   return Result.fail("请先实名认证"); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | String tradePasswordWeb = memberQuickBuySaleDto.getTradePassword(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证支付密码 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(tradePasswordWeb)) { | 
|---|
|  |  |  | return Result.fail("请输入交易密码"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // System.out.println("交易密码:"+MD5.GetMD5Code(tradePasswordWeb)+" tradePassword = | 
|---|
|  |  |  | // "+tradePassword); | 
|---|
|  |  |  | // 验证交易密码 | 
|---|
|  |  |  | if (!tradePassword.equals(SecureUtil.md5(tradePasswordWeb))) { | 
|---|
|  |  |  | return Result.fail("请输入正确的交易密码"); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "commitPay", notes = "USDT充值支付确认") | 
|---|
|  |  |  | @RequestMapping(value = "/commitPay", method = RequestMethod.POST) | 
|---|
|  |  |  | public Result commitPay(@RequestBody MemberQuickBuySaleCommitDto memberQuickBuySaleCommitDto) { | 
|---|
|  |  |  | public Result commitPay(@RequestBody @Valid MemberQuickBuySaleCommitDto memberQuickBuySaleCommitDto) { | 
|---|
|  |  |  | return memberQuickBuySaleService.commitPay(memberQuickBuySaleCommitDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return memberQuickBuySaleService.selectById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "selectAll", notes = "查询用户所有的买卖记录") | 
|---|
|  |  |  | @GetMapping(value = "/selectAll") | 
|---|
|  |  |  | public Result selectAll(@RequestParam(value = "type") String type) { | 
|---|
|  |  |  | return memberQuickBuySaleService.selectAll(type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "cancel", notes = "充值撤销") | 
|---|
|  |  |  | @GetMapping(value = "/cancel/{id}") | 
|---|
|  |  |  | public Result cancel(@PathVariable(value = "id") Long id) { | 
|---|
|  |  |  | @GetMapping(value = "/cancel") | 
|---|
|  |  |  | public Result cancel(@RequestParam(value = "id") Long id) { | 
|---|
|  |  |  | return memberQuickBuySaleService.cancelRecharge(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/sell", method = RequestMethod.POST) | 
|---|
|  |  |  | public Result sell(@RequestBody @Valid MemberQuickBuySaleDto memberQuickBuySaleDto) { | 
|---|
|  |  |  | // 获取当前登录用户 | 
|---|
|  |  |  | MemberEntity member = LoginUserUtils.getAppLoginUser(); | 
|---|
|  |  |  | if (MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) { | 
|---|
|  |  |  | Long memberId = LoginUserUtils.getAppLoginUser().getId(); | 
|---|
|  |  |  | MemberEntity member = memberService.getById(memberId); | 
|---|
|  |  |  | if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) { | 
|---|
|  |  |  | return Result.fail("请先实名认证"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String tradePasswordWeb = memberQuickBuySaleDto.getTradePassword(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return memberQuickBuySaleService.sell(member,memberQuickBuySaleDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "cancelSell", notes = "提现撤销") | 
|---|
|  |  |  | @GetMapping(value = "/cancelSell") | 
|---|
|  |  |  | public Result cancelSell(@RequestParam(value = "id") Long id) { | 
|---|
|  |  |  | return memberQuickBuySaleService.cancelSell(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|