src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/dao/OtcBlackListDao.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/dto/AddBlackDto.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/dto/BlackListDto.java | ●●●●● patch | view | raw | blame | history | |
src/main/resources/application-app.yml | ●●●●● patch | view | raw | blame | history | |
src/main/resources/mapper/otc/OtcBlackListDao.xml | ●●●●● patch | view | raw | blame | history |
src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java
@@ -46,6 +46,9 @@ @Value("${spring.profiles.active}") private String profiles; @Value("${app.project}") private String projectName; @Pointcut("execution(* com.xcong.excoin..*.*(..))") public void exceptionCatch() { } @@ -72,7 +75,7 @@ try { log.info("插入"); exceptionData.setCreateTime(new Date()); exceptionData.setMachine(InetAddress.getLocalHost().getHostName() + "-" + profiles); exceptionData.setMachine(projectName + "-" + InetAddress.getLocalHost().getHostName() + "-" + profiles); exceptionData.setAddress(InetAddress.getLocalHost().getHostAddress()); exceptionData.setExceptionMsg(exStr); exceptionData.setSimpleMsg(ex.getMessage()); 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("解除成功"); } } src/main/java/com/xcong/excoin/modules/otc/dao/OtcBlackListDao.java
@@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.otc.entity.OtcBlackList; import org.apache.ibatis.annotations.Param; public interface OtcBlackListDao extends BaseMapper<OtcBlackList> { OtcBlackList selectByMemberIdAndBlackMemberId(@Param("memberId") Long memberId, @Param("blackMemberId") Long blackMemberId); } src/main/java/com/xcong/excoin/modules/otc/dto/AddBlackDto.java
@@ -17,6 +17,8 @@ private Long id; @NotBlank(message = "参数错误") @ApiModelProperty(value = "类型 1-传订单ID 2-用户ID") private Integer type; @ApiModelProperty(value = "原因 - 删除不传") private String reason; } src/main/java/com/xcong/excoin/modules/otc/dto/BlackListDto.java
New file @@ -0,0 +1,7 @@ package com.xcong.excoin.modules.otc.dto; import lombok.Data; @Data public class BlackListDto { } src/main/resources/application-app.yml
@@ -93,6 +93,7 @@ app: debug: false redis_expire: 3000 project: otc kline-update-job: true newest-price-update-job: true #日线 该任务不能与最新价处于同一个服务器 src/main/resources/mapper/otc/OtcBlackListDao.xml
@@ -2,4 +2,8 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.otc.dao.OtcBlackListDao"> <select id="selectByMemberIdAndBlackMemberId" resultType="com.xcong.excoin.modules.otc.entity.OtcBlackList"> select * from otc_black_list where member_id=#{memberId} and black_member_id=#{blackMemberId} </select> </mapper>