xiaoyong931011
2021-05-25 b787caa660c2aed5281d1429d5db2ec18ac8fa7c
Merge branch 'otc' of http://120.27.238.55:7000/r/exchange into otc
1 files added
13 files modified
137 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java 23 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/dao/OtcBlackListDao.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/dto/AddBlackDto.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/dto/BlackListDto.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/dto/EntrustOrderListDto.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrder.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java 25 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/vo/BlackListVo.java 24 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/vo/BuyOrderDetailVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/vo/SaleOrderDetailVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 15 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/otc/OtcBlackListDao.xml 5 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/otc/OtcEntrustOrderDao.xml 13 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/controller/OtcBlackListController.java
@@ -1,16 +1,22 @@
package com.xcong.excoin.modules.otc.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.dto.BlackListDto;
import com.xcong.excoin.modules.otc.entity.OtcBlackList;
import com.xcong.excoin.modules.otc.entity.OtcOrder;
import com.xcong.excoin.modules.otc.vo.BlackListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -23,7 +29,7 @@
@Validated
@RestController
@RequestMapping(value = "/api/black")
@Api(value = "OtcBlackListController", tags = "黑名单列表接口类")
@Api(value = "OtcBlackListController", tags = "otc黑名单列表接口类")
public class OtcBlackListController {
    @Autowired
@@ -41,6 +47,11 @@
            return Result.fail("订单不存在");
        }
        OtcBlackList isExist = otcBlackListDao.selectByMemberIdAndBlackMemberId(member.getId(), otcOrder.getEntrustMemberId());
        if (isExist != null) {
            return Result.fail("请勿重复拉黑");
        }
        OtcBlackList otcBlackList = new OtcBlackList();
        otcBlackList.setMemberId(member.getId());
        otcBlackList.setBlackMemberId(otcOrder.getEntrustMemberId());
@@ -50,9 +61,15 @@
    }
    @ApiOperation(value = "黑名单列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = BlackListVo.class)
    })
    @PostMapping(value = "/blackList")
    public Result blackList() {
        return null;
    public Result blackList(@RequestBody BlackListDto blackListDto) {
        MemberEntity member = LoginUserUtils.getAppLoginUser();
        Page<BlackListVo> page = new Page<>(blackListDto.getPageNum(), blackListDto.getPageSize());
        IPage<BlackListVo> result = otcBlackListDao.selectBlackListInPage(member.getId(), page);
        return Result.ok(result.getRecords());
    }
    @ApiOperation(value = "删除黑名单")
src/main/java/com/xcong/excoin/modules/otc/dao/OtcBlackListDao.java
@@ -1,10 +1,15 @@
package com.xcong.excoin.modules.otc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xcong.excoin.modules.otc.entity.OtcBlackList;
import com.xcong.excoin.modules.otc.vo.BlackListVo;
import org.apache.ibatis.annotations.Param;
public interface OtcBlackListDao extends BaseMapper<OtcBlackList> {
    OtcBlackList selectByMemberIdAndBlackMemberId(@Param("memberId") Long memberId, @Param("blackMemberId") Long blackMemberId);
    IPage<BlackListVo> selectBlackListInPage(@Param("memberId") Long memberId, Page<BlackListVo> page);
}
src/main/java/com/xcong/excoin/modules/otc/dto/AddBlackDto.java
@@ -13,10 +13,11 @@
public class AddBlackDto {
    @NotNull(message = "参数错误")
    @ApiModelProperty(value = "订单id/用户id")
    @ApiModelProperty(value = "订单id/黑名单id")
    private Long id;
    @NotBlank(message = "参数错误")
    @ApiModelProperty(value = "1-订单 2-黑名单ID")
    private Integer type;
    @ApiModelProperty(value = "原因 - 删除不传")
src/main/java/com/xcong/excoin/modules/otc/dto/BlackListDto.java
@@ -1,7 +1,16 @@
package com.xcong.excoin.modules.otc.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "BlackListDto", description = "黑名单列表参数接收类")
public class BlackListDto {
    @ApiModelProperty(value = "页数")
    private Integer pageNum = 1;
    @ApiModelProperty(value = "条数")
    private Integer pageSize = 10;
}
src/main/java/com/xcong/excoin/modules/otc/dto/EntrustOrderListDto.java
@@ -24,4 +24,7 @@
    @NotBlank
    @ApiModelProperty(value = "类型", example = "B-买 S-卖")
    private String type;
    @ApiModelProperty(hidden = true)
    private Long memberId;
}
src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrder.java
@@ -1,5 +1,6 @@
package com.xcong.excoin.modules.otc.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xcong.excoin.common.system.base.BaseEntity;
import lombok.Data;
@@ -70,4 +71,7 @@
    private Integer isMb;
    public static final Integer IS_MB_Y = 1;
    public static final Integer IS_MB_N = 2;
    @TableField(exist = false)
    private String payType;
}
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java
@@ -155,7 +155,9 @@
    @Override
    public IPage<EntrustListVo> findEntrustListInPage(EntrustOrderListDto dto) {
        MemberEntity member = LoginUserUtils.getAppLoginUser();
        Page<EntrustListVo> page = new Page<>(dto.getPageNum(), dto.getPageSize());
        dto.setMemberId(member.getId());
        return this.baseMapper.selectEntrustListInPage(dto, page);
    }
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
@@ -19,18 +19,12 @@
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.entity.MemberPaymentMethodEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
import com.xcong.excoin.modules.otc.dao.OtcEntrustOrderDao;
import com.xcong.excoin.modules.otc.dao.OtcMarketBussinessDao;
import com.xcong.excoin.modules.otc.dao.OtcOrderAppealDao;
import com.xcong.excoin.modules.otc.dao.*;
import com.xcong.excoin.modules.otc.dto.HasPayDto;
import com.xcong.excoin.modules.otc.dto.OrderApealDto;
import com.xcong.excoin.modules.otc.dto.OrderListDto;
import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto;
import com.xcong.excoin.modules.otc.entity.OtcEntrustOrder;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness;
import com.xcong.excoin.modules.otc.entity.OtcOrder;
import com.xcong.excoin.modules.otc.dao.OtcOrderDao;
import com.xcong.excoin.modules.otc.entity.OtcOrderAppeal;
import com.xcong.excoin.modules.otc.entity.*;
import com.xcong.excoin.modules.otc.service.OtcOrderService;
import com.xcong.excoin.modules.otc.vo.BuyOrderDetailVo;
import com.xcong.excoin.modules.otc.vo.OrderListVo;
@@ -57,6 +51,7 @@
    private final MemberWalletCoinDao memberWalletCoinDao;
    private final MemberDao memberDao;
    private final MemberPaymentMethodDao memberPaymentMethodDao;
    private final OtcBlackListDao otcBlackListDao;
    @Override
@@ -316,6 +311,13 @@
        OtcOrder saleOrder = this.baseMapper.selectOrderByOrderNoAndType(otcOrder.getOrderNo(), OtcEntrustOrder.ORDER_TYPE_S);
        MemberEntity saleMember = memberDao.selectById(saleOrder.getMemberId());
        OtcBlackList otcBlackList = otcBlackListDao.selectByMemberIdAndBlackMemberId(member.getId(), buyOrder.getEntrustMemberId());
        if (otcBlackList != null) {
            buyDetail.setIsBlack(1);
        } else {
            buyDetail.setIsBlack(2);
        }
        buyDetail.setSaleName(saleMember.getName());
        buyDetail.setBankName(buyOrder.getBankName());
@@ -353,7 +355,6 @@
        }
        MemberEntity buyMember = memberDao.selectById(saleOrder.getOppositeMemberId());
        SaleOrderDetailVo saleDetail = new SaleOrderDetailVo();
        saleDetail.setOrderNo(saleOrder.getOrderNo());
        saleDetail.setUsdtAmount(saleOrder.getCoinAmount());
@@ -366,6 +367,12 @@
        saleDetail.setSaleName(buyMember.getName());
        saleDetail.setPayType(saleOrder.getPayType());
        OtcBlackList otcBlackList = otcBlackListDao.selectByMemberIdAndBlackMemberId(member.getId(), saleOrder.getEntrustMemberId());
        if (otcBlackList != null) {
            saleDetail.setIsBlack(1);
        } else {
            saleDetail.setIsBlack(2);
        }
        if (!saleOrder.getMemberId().equals(saleOrder.getEntrustMemberId())) {
            OtcMarketBussiness otcMb = otcMarketBussinessDao.selectMarketBussinessByMemberId(saleOrder.getEntrustMemberId());
            saleDetail.setMbId(otcMb.getId());
src/main/java/com/xcong/excoin/modules/otc/vo/BlackListVo.java
New file
@@ -0,0 +1,24 @@
package com.xcong.excoin.modules.otc.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "BlackListVo", description = "黑名单列表接口返回类")
public class BlackListVo {
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "昵称")
    private String name;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "拉黑时间")
    private Date time;
}
src/main/java/com/xcong/excoin/modules/otc/vo/BuyOrderDetailVo.java
@@ -68,4 +68,7 @@
    @ApiModelProperty(value = "剩余秒数")
    private Long times;
    @ApiModelProperty(value = "是否已拉黑 1-是 2-否")
    private Integer isBlack;
}
src/main/java/com/xcong/excoin/modules/otc/vo/SaleOrderDetailVo.java
@@ -59,4 +59,7 @@
    @ApiModelProperty(value = "剩余秒数")
    private Long times;
    @ApiModelProperty(value = "是否已拉黑")
    private Integer isBlack;
}
src/main/resources/application.yml
@@ -7,12 +7,12 @@
  profiles:
    active: dev
  datasource:
#    url: jdbc:mysql://rm-bp151tw8er79ig9kb5o.mysql.rds.aliyuncs.com:3306/db_biue?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
#    username: ctcoin_data
#    password: ctcoin_123
    url: jdbc:mysql://120.27.238.55:3306/db_otc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
    username: ct_test
    password: 123456
    url: jdbc:mysql://154.91.195.170:3306/db_otc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
    username: yd_otc
    password: yd_otc123!@#
#    url: jdbc:mysql://120.27.238.55:3306/db_otc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
#    username: ct_test
#    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
@@ -95,6 +95,7 @@
app:
  debug: true
  project: otc
  redis_expire: 3000
  # k线更新任务控制
  kline-update-job: false
@@ -107,7 +108,7 @@
  loop-job: false
  rabbit-consumer: false
  block-job: false
  otc-job: true
  otc-job: false
aliyun:
  oss:
src/main/resources/mapper/otc/OtcBlackListDao.xml
@@ -6,4 +6,9 @@
        select * from otc_black_list
        where member_id=#{memberId} and black_member_id=#{blackMemberId}
    </select>
    <select id="selectBlackListInPage" resultType="com.xcong.excoin.modules.otc.vo.BlackListVo">
        select a.id, a.create_time time, b.name from otc_black_list a, member b
        where a.black_member_id=b.id and a.member_id=#{memberId}
    </select>
</mapper>
src/main/resources/mapper/otc/OtcEntrustOrderDao.xml
@@ -18,6 +18,7 @@
        left join otc_market_bussiness b on a.member_id=b.member_id
        left join member c on a.member_id=c.id
        left join member_payment_method d on a.member_id=d.member_id and d.is_defualt=1
        inner join otc_black_list e on a.member_id!=e.black_member_id and e.member_id=#{record.memberId}
        <where>
            a.status=1 and a.remain_coin_amount > 0
            <if test="record != null">
@@ -30,19 +31,21 @@
    </select>
    <select id="selectEntrustOrderByOrderType" resultType="com.xcong.excoin.modules.otc.entity.OtcEntrustOrder">
        select * from otc_entrust_order
        select a.*, b.payment_type payType
        from otc_entrust_order a
        left join member_payment_method b on a.member_id=b.member_id and b.is_defualt=1
        <where>
            <if test="record.orderType != null and record.orderType != ''" >
               and order_type = #{record.orderType}
               and a.order_type = #{record.orderType}
            </if>
            <if test="record.memberId != null">
                and member_id = #{record.memberId}
                and a.member_id = #{record.memberId}
            </if>
            <if test="record.status != null and record.status == 3">
                and status != #{record.status}
                and a.status != #{record.status}
            </if>
            <if test="record.status != null and record.status != 3">
                and status = #{record.status}
                and a.status = #{record.status}
            </if>
        </where>
    </select>