From 3341b7a0e2a8c719cf6eaf1591a721ec6b8e1fe4 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 25 May 2021 14:42:51 +0800 Subject: [PATCH] Merge branch 'otc' of http://120.27.238.55:7000/r/exchange into otc --- src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java index f7fe632..69708cf 100644 --- a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java +++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java @@ -1,12 +1,21 @@ 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.entity.MemberEntity; +import com.xcong.excoin.modules.otc.dao.OtcBlackListDao; +import com.xcong.excoin.modules.otc.dao.OtcOrderDao; +import com.xcong.excoin.modules.otc.dto.AddBlackDto; +import com.xcong.excoin.modules.otc.entity.OtcBlackList; +import com.xcong.excoin.modules.otc.entity.OtcOrder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; 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.RestController; @@ -17,17 +26,55 @@ @Api(value = "OtcBlackListController", tags = "黑名单列表接口类") public class OtcBlackListController { + @Autowired + private OtcBlackListDao otcBlackListDao; + @Autowired + private OtcOrderDao otcOrderDao; + @ApiOperation(value = "添加黑名单") @PostMapping(value = "/add") - public Result add() { - return null; + public Result add(@RequestBody AddBlackDto addBlackDto) { + MemberEntity member = LoginUserUtils.getAppLoginUser(); + + OtcOrder otcOrder = otcOrderDao.selectById(addBlackDto.getId()); + if (otcOrder == null) { + return Result.fail("订单不存在"); + } + + OtcBlackList otcBlackList = new OtcBlackList(); + otcBlackList.setMemberId(member.getId()); + otcBlackList.setBlackMemberId(otcOrder.getEntrustMemberId()); + otcBlackList.setReasons(addBlackDto.getReason()); + otcBlackListDao.insert(otcBlackList); + return Result.ok("拉黑成功"); } + @ApiOperation(value = "黑名单列表") + @PostMapping(value = "/blackList") public Result blackList() { return null; } - public Result del() { - return null; + @ApiOperation(value = "删除黑名单") + @PostMapping(value = "/del") + public Result del(@RequestBody AddBlackDto addBlackDto) { + MemberEntity member = LoginUserUtils.getAppLoginUser(); + if (addBlackDto.getType() == null) { + return Result.fail("参数错误"); + } + + if (addBlackDto.getType() == 1) { + OtcOrder otcOrder = otcOrderDao.selectById(addBlackDto.getId()); + if (otcOrder == null) { + return Result.fail("订单不存在"); + } + + OtcBlackList otcBlackList = otcBlackListDao.selectByMemberIdAndBlackMemberId(member.getId(), otcOrder.getEntrustMemberId()); + otcBlackListDao.deleteById(otcBlackList.getId()); + } else { + otcBlackListDao.deleteById(addBlackDto.getId()); + } + + return Result.ok("解除成功"); } } -- Gitblit v1.9.1